Index: Makefile
===================================================================
RCS file: /cvs/ports/games/jag/Makefile,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 Makefile
--- Makefile	20 Mar 2020 16:44:23 -0000	1.11
+++ Makefile	7 Jul 2020 02:33:34 -0000
@@ -1,35 +1,42 @@
-# $OpenBSD: Makefile,v 1.11 2020/03/20 16:44:23 naddy Exp $ 
+# $OpenBSD: Makefile,v 1.11 2020/03/20 16:44:23 naddy Exp $
 COMMENT =		arcade-puzzle game
-V = 			0.3.2
+V =			0.3.7
 DISTNAME =		jag-${V}
 CATEGORIES =		games
-HOMEPAGE =		http://jag.xlabsoft.com
-REVISION =		2
+HOMEPAGE =		https://gitlab.com/coringao/jag
 
 # GPLv3
-PERMIT_PACKAGE =	Yes
+# https://gitlab.com/coringao/jag/-/issues/1
+PERMIT_PACKAGE =	restrictively licensed themes
+PERMIT_DISTFILES =	restrictively licensed themes
 
-WANTLIB += GL ICE QtGui QtOpenGL QtXml SDL SDL_mixer SM X11 Xext
-WANTLIB += Xi Xinerama Xrandr Xrender c fontconfig freetype m
-WANTLIB += pthread ${COMPILER_LIBCXX}
+WANTLIB += ${COMPILER_LIBCXX} Qt5Core Qt5Gui Qt5OpenGL Qt5Widgets
+WANTLIB += Qt5X11Extras SDL2 SDL2_mixer X11 Xrandr c
 
 COMPILER =		base-clang ports-gcc base-gcc
 
-MASTER_SITES = 		http://jag.xlabsoft.com/files/
-DISTFILES = 		jag-${V}-src.zip jag-${V}-data.zip
+MASTER_SITES =		https://gitlab.com/coringao/jag/-/archive/${V}/
 
-MODULES =		devel/qmake x11/qt4
-BUILD_DEPENDS = 	archivers/unzip
-LIB_DEPENDS =		devel/sdl \
-			devel/sdl-mixer
-WRKDIST =		${WRKDIR}/jag-${V}-src
+MODULES =		devel/qmake x11/qt5
+LIB_DEPENDS =		devel/sdl2 \
+			devel/sdl2-mixer \
+			x11/qt5/qtx11extras
+# make jag and jag-editor
+MODQMAKE_PROJECTS =	. \
+			src/editor
+
+# delete DOS line endings
+post-extract:
+	@find ${WRKSRC} -type f \( -name "*.cpp" -o -name "*.h" \) -exec \
+		perl -i -pe 's/\r$$//' {} +
 
 pre-configure:
-	@${SUBST_CMD} ${WRKSRC}/Game.pro ${WRKSRC}/main.cpp
+	@${SUBST_CMD} ${WRKSRC}/game.pro ${WRKSRC}/src/main.cpp \
+		${WRKSRC}/src/editor/jag-editor.pro
 
 post-install:
 	${INSTALL_DATA_DIR} ${PREFIX}/share/jag
-	cd ${WRKDIR}/jag-${V}-data/data && pax -rw . ${PREFIX}/share/jag
+	cd ${WRKSRC}/data && pax -rw . ${PREFIX}/share/jag
 	chown -R ${SHAREOWN}:${SHAREGRP} ${PREFIX}/share/
 	find ${PREFIX}/share -type d -exec chmod ${DIRMODE} {} + -o \
 		-type f -exec chmod ${SHAREMODE} {} +
Index: distinfo
===================================================================
RCS file: /cvs/ports/games/jag/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 distinfo
--- distinfo	27 Jan 2013 23:54:51 -0000	1.1.1.1
+++ distinfo	7 Jul 2020 02:33:34 -0000
@@ -1,4 +1,2 @@
-SHA256 (jag-0.3.2-data.zip) = 0zG4sewgBo3g8113R7Pk60Vn9QVWjD2GIYhNLKRrbSI=
-SHA256 (jag-0.3.2-src.zip) = Cx/EY3PXtwvdNZypPlU7wkSklyH6GhjVIlxeiHtUykQ=
-SIZE (jag-0.3.2-data.zip) = 6237911
-SIZE (jag-0.3.2-src.zip) = 995053
+SHA256 (jag-0.3.7.tar.gz) = jI+SYKL476N4ojzhUdWjoEDklJ+EFBClnRDUzeJH9t4=
+SIZE (jag-0.3.7.tar.gz) = 6971529
Index: patches/patch-Game_pro
===================================================================
RCS file: patches/patch-Game_pro
diff -N patches/patch-Game_pro
--- patches/patch-Game_pro	27 Jan 2013 23:54:51 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-Game_pro,v 1.1.1.1 2013/01/27 23:54:51 stsp Exp $
---- Game.pro.orig	Wed Jan  9 02:41:03 2013
-+++ Game.pro	Wed Jan  9 02:41:45 2013
-@@ -5,9 +5,9 @@ QT += xml \
-     opengl
- unix: {
-     TARGET = ./bin/jag
--    target.path = /usr/local/bin/
-+    target.path = ${PREFIX}/bin/
-     INSTALLS += target
--    datas.path = /usr/local/games/jag
-+    datas.path = ${PREFIX}/share/jag
-     datas.files = data
-     INSTALLS += datas
-     LIBS += -lXrandr
Index: patches/patch-displaywrapper_cpp
===================================================================
RCS file: patches/patch-displaywrapper_cpp
diff -N patches/patch-displaywrapper_cpp
--- patches/patch-displaywrapper_cpp	24 Apr 2016 11:07:55 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-$OpenBSD: patch-displaywrapper_cpp,v 1.1 2016/04/24 11:07:55 zhuk Exp $
---- displaywrapper.cpp.orig	Sun Apr 24 13:55:59 2016
-+++ displaywrapper.cpp	Sun Apr 24 13:56:19 2016
-@@ -280,8 +280,6 @@ void DisplayWrapper::dw_init(bool filter, int minWidth
-   //short original_rate = XRRConfigCurrentRate(conf);
-   //SizeID original_size_id = XRRConfigCurrentConfiguration(conf, &original_rotation);
- 
--  XCloseDisplay(dpy);
--
-   for (int i = 0; i < num_sizes; i++)
-   {
-     int width = xrrs[i].width;
-@@ -300,6 +298,8 @@ void DisplayWrapper::dw_init(bool filter, int minWidth
-       modes.append(mode);
-     }
-   }
-+
-+  XCloseDisplay(dpy);
- 
-   if (filter)
-     modeNames.removeDuplicates();
Index: patches/patch-game_pro
===================================================================
RCS file: patches/patch-game_pro
diff -N patches/patch-game_pro
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-game_pro	7 Jul 2020 02:33:34 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+Index: game.pro
+--- game.pro.orig
++++ game.pro
+@@ -30,11 +30,8 @@ RCC_DIR += src
+ UI_DIR += src
+ 
+ unix: {
+-	target.path = /usr/games/
++	target.path = ${PREFIX}/bin/
+ 	INSTALLS += target
+-	datas.path = /usr/share/games/jag
+-	datas.files = data
+-	INSTALLS += datas
+ }
+ 
+ # The following define makes your compiler warn you if you use any
Index: patches/patch-gameprofile_cpp
===================================================================
RCS file: patches/patch-gameprofile_cpp
diff -N patches/patch-gameprofile_cpp
--- patches/patch-gameprofile_cpp	27 Jan 2013 23:54:51 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-gameprofile_cpp,v 1.1.1.1 2013/01/27 23:54:51 stsp Exp $
---- gameprofile.cpp.orig	Wed Jan  9 03:39:07 2013
-+++ gameprofile.cpp	Wed Jan  9 03:39:18 2013
-@@ -66,7 +66,7 @@ GameProfile::GameProfile(QObject *parent) : QObject(pa
- #ifdef Q_OS_WIN32
-   userPath += "/Application Data/XlabSoft/JAG/";
- #else
--  userPath += "/.xlabsoft/jag/";
-+  userPath += "/.jag/";
- #endif
- 
-     QDir userdir(userPath);
Index: patches/patch-main_cpp
===================================================================
RCS file: patches/patch-main_cpp
diff -N patches/patch-main_cpp
--- patches/patch-main_cpp	27 Jan 2013 23:54:51 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-main_cpp,v 1.1.1.1 2013/01/27 23:54:51 stsp Exp $
---- main.cpp.orig	Wed Jan  9 02:56:19 2013
-+++ main.cpp	Wed Jan  9 02:57:07 2013
-@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
-   // on X11, we'll check if data directory exists locally first
- #ifdef Q_WS_X11
-   if (!QDir(resourcePath).exists())
--    resourcePath = "/usr/local/games/jag/data/";
-+    resourcePath = "${TRUEPREFIX}/share/jag/";
- #endif
- 
-   if (!QDir(resourcePath).exists()) {
Index: patches/patch-src_displaywrapper_cpp
===================================================================
RCS file: patches/patch-src_displaywrapper_cpp
diff -N patches/patch-src_displaywrapper_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_displaywrapper_cpp	7 Jul 2020 02:33:34 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Index: src/displaywrapper.cpp
+--- src/displaywrapper.cpp.orig
++++ src/displaywrapper.cpp
+@@ -305,8 +305,6 @@ void DisplayWrapper::dw_init(bool filter, int minWidth
+   //short original_rate = XRRConfigCurrentRate(conf);
+   //SizeID original_size_id = XRRConfigCurrentConfiguration(conf, &original_rotation);
+ 
+-  XCloseDisplay(dpy);
+-
+   for (int i = 0; i < num_sizes; i++)
+   {
+     int width = xrrs[i].width;
+@@ -325,6 +323,8 @@ void DisplayWrapper::dw_init(bool filter, int minWidth
+       modes.append(mode);
+     }
+   }
++
++  XCloseDisplay(dpy);
+ 
+   if (filter)
+     modeNames.removeDuplicates();
Index: patches/patch-src_editor_jag-editor_pro
===================================================================
RCS file: patches/patch-src_editor_jag-editor_pro
diff -N patches/patch-src_editor_jag-editor_pro
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_editor_jag-editor_pro	7 Jul 2020 02:33:34 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+install jag-editor to correct prefix. jag-editor still works without data files.
+
+Index: src/editor/jag-editor.pro
+--- src/editor/jag-editor.pro.orig
++++ src/editor/jag-editor.pro
+@@ -22,11 +22,8 @@ QMAKE_CXXFLAGS += -g -std=gnu++14 -D_FORTIFY_SOURCE=2
+ QMAKE_LFLAGS += -lpthread -fPIE -pie -Wl,--as-needed -Wl,-z,now
+ 
+ unix: {
+-	target.path = /usr/games/
++	target.path = ${PREFIX}/bin/
+ 	INSTALLS += target
+-	datas.path = /usr/share/games/jag/editor/
+-	datas.files = images
+-	INSTALLS += datas
+ }
+ 
+ # The following define makes your compiler warn you if you use any
Index: patches/patch-src_gameprofile_cpp
===================================================================
RCS file: patches/patch-src_gameprofile_cpp
diff -N patches/patch-src_gameprofile_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_gameprofile_cpp	7 Jul 2020 02:33:34 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: src/gameprofile.cpp
+--- src/gameprofile.cpp.orig
++++ src/gameprofile.cpp
+@@ -88,7 +88,7 @@ GameProfile::GameProfile(QObject *parent) : QObject(pa
+   m_accel(false)
+ {
+     userPath = QDir::homePath();
+-    userPath += "/.xlabsoft/jag/";
++    userPath += "/.jag/";
+ 
+ 
+     QDir userdir(userPath);
Index: patches/patch-src_main_cpp
===================================================================
RCS file: patches/patch-src_main_cpp
diff -N patches/patch-src_main_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_main_cpp	7 Jul 2020 02:33:34 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: src/main.cpp
+--- src/main.cpp.orig
++++ src/main.cpp
+@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
+   // on X11, we'll check if data directory exists locally first
+ #ifdef Q_OS_UNIX
+   if (!QDir(resourcePath).exists())
+-    resourcePath = "/usr/share/games/jag/data/";
++    resourcePath = "${TRUEPREFIX}/share/jag/";
+ #endif
+ 
+   if (!QDir(resourcePath).exists()) {
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/games/jag/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 PLIST
--- pkg/PLIST	27 Jan 2013 23:54:51 -0000	1.1.1.1
+++ pkg/PLIST	7 Jul 2020 02:33:34 -0000
@@ -1,5 +1,6 @@
 @comment $OpenBSD: PLIST,v 1.1.1.1 2013/01/27 23:54:51 stsp Exp $
 @bin bin/jag
+@bin bin/jag-editor
 share/jag/
 share/jag/bonus/
 share/jag/bonus/clock.png
@@ -12,17 +13,19 @@ share/jag/bonus/timer.png
 share/jag/bonus/x.png
 share/jag/help/
 share/jag/help/index.htm
-share/jag/help/index_nl.htm
-share/jag/help/index_ru.htm
 share/jag/lang/
 share/jag/lang/jag_de.qm
 share/jag/lang/jag_de.ts
+share/jag/lang/jag_es.qm
+share/jag/lang/jag_es.ts
 share/jag/lang/jag_fr.qm
 share/jag/lang/jag_fr.ts
 share/jag/lang/jag_it.qm
 share/jag/lang/jag_it.ts
 share/jag/lang/jag_nl.qm
 share/jag/lang/jag_nl.ts
+share/jag/lang/jag_pt.qm
+share/jag/lang/jag_pt.ts
 share/jag/lang/jag_ru.qm
 share/jag/lang/jag_ru.ts
 share/jag/lang/langlist.dat
