Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 May 2008 05:13:17 +0400 (MSD)
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/123806: [PATCH] games/openastromenace: fix build with CMake 2.6, sanitize port
Message-ID:  <20080519011317.110921702D@hades.panopticon>
Resent-Message-ID: <200805190120.m4J1K1r7032777@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         123806
>Category:       ports
>Synopsis:       [PATCH] games/openastromenace: fix build with CMake 2.6, sanitize port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 19 01:20:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 7.0-RELEASE-p1 i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 7.0-RELEASE-p1 FreeBSD 7.0-RELEASE-p1 #0: Fri Apr 25 11:18:45 MSD 2008 root@hades.panopticon:/usr/obj/usr/src/sys/HADES i386


>Description:
* Patch CMakeLists.txt so this builds with new CMake 2.6
* Remove useless DATA and SRC knobs
* Improve language knobs handling
* Make game run without need so specify --dir argument, thus remove pkg-message
* Other minor improvements to the port
>How-To-Repeat:
>Fix:

--- openastromenace.patch begins here ---
diff -ruN openastromenace.orig/Makefile openastromenace/Makefile
--- openastromenace.orig/Makefile	2008-05-19 04:35:40.080764974 +0400
+++ openastromenace/Makefile	2008-05-19 05:07:31.386478689 +0400
@@ -7,90 +7,65 @@
 
 PORTNAME=	openastromenace
 PORTVERSION=	1.2.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	games
 MASTER_SITES=	SF
+DISTFILES=	oamenace-src-${PORTVERSION}${EXTRACT_SUFX} \
+		oamenace-data-${PORTVERSION}${EXTRACT_SUFX} \
+		oamenace-lang-${LANGPACK}-${PORTVERSION}${EXTRACT_SUFX}
 
 MAINTAINER=	proler@gmail.com
 COMMENT=	Hardcore 3D space shooter with spaceship upgrade possibilities
 
+BUILD_DEPENDS=	${CMAKE}:${PORTSDIR}/devel/cmake
+LIB_DEPENDS+=	vorbisfile:${PORTSDIR}/audio/libvorbis \
+		jpeg:${PORTSDIR}/graphics/jpeg	\
+		openal:${PORTSDIR}/audio/openal	\
+		alut:${PORTSDIR}/audio/freealut
+
 USE_BZIP2=	yes
-USE_GL=		yes
+USE_GL=		gl glu
 WANT_SDL=	yes
 USE_SDL=	sdl
 
+CMAKE?=		${LOCALBASE}/bin/cmake
 CMAKE_ARGS=	-DCMAKE_BUILD_TYPE:STRING=Release \
-		-DCMAKE_C_COMPILER:STRING='${CC}' \
-		-DCMAKE_CXX_COMPILER:STRING=${CXX} \
+		-DCMAKE_C_COMPILER:STRING="${CC}" \
+		-DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
+		-DCMAKE_CXX_COMPILER:STRING="${CXX}" \
 		-DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \
-		-DCMAKE_INSTALL_PREFIX=${PREFIX}
-
-SUB_FILES=	pkg-message
-
-BUILD_DEPENDS+=	${LOCALBASE}/bin/cmake:${PORTSDIR}/devel/cmake	\
+		-DCMAKE_INSTALL_PREFIX="${PREFIX}"
 
-LIB_DEPENDS+=	vorbisfile:${PORTSDIR}/audio/libvorbis	\
-		jpeg:${PORTSDIR}/graphics/jpeg	\
-		openal:${PORTSDIR}/audio/openal	\
-		alut:${PORTSDIR}/audio/freealut	\
-
-OPTIONS=	SRC        	"build src"	on	\
-		DATA        	"install data file"	on	\
-		EN        	" en lang"	on	\
-		DE        	" de lang "	on	\
-		RU        	" ru lang "	on	\
+OPTIONS=	EN	"English language pack"	on \
+		DE	"German language pack"	off \
+		RU	"Russian language pack"	off
 
 .include <bsd.port.pre.mk>
 
-.undef DISTFILES
-.if defined(WITH_SRC)
-DISTFILES+=oamenace-src-${PORTVERSION}.tar.bz2
+.if !defined(WITHOUT_EN)
+LANGPACK=	en
+.elif defined(WITH_DE)
+LANGPACK=	de
+.elif defined(WITH_RU)
+LANGPACK=	ru
 .else
-NO_BUILD=	yes
-.endif
-.if defined(WITH_DATA)
-DISTFILES+=oamenace-data-${PORTVERSION}.tar.bz2
-.endif
-.if defined(WITH_EN)
-DISTFILES+=oamenace-lang-en-${PORTVERSION}.tar.bz2
-.endif
-.if defined(WITH_DE)
-DISTFILES+=oamenace-lang-de-${PORTVERSION}.tar.bz2
-.endif
-.if defined(WITH_RU)
-DISTFILES+=oamenace-lang-ru-${PORTVERSION}.tar.bz2
+IGNORE=		cannot be build without/with multiple language packs. Please rerun 'make config' and select single language pack
 .endif
 
+post-patch:
+	${REINPLACE_CMD} -e 's|/usr/local/share/openastromenace|${DATADIR}|' \
+		${WRKSRC}/AstroMenaceSource/Main.cpp
+
 do-configure:
-.if defined(WITH_SRC)
-	@(cd ${WRKSRC}; \
-	${LOCALBASE}/bin/cmake ${CMAKE_ARGS} ${PATCH_WRKSRC})
-.endif
+	@cd ${WRKSRC} && ${CMAKE} . ${CMAKE_ARGS}
 
 do-install:
-.if defined(WITH_SRC)
 	${INSTALL_PROGRAM} ${WRKSRC}/AstroMenace ${PREFIX}/bin
-.endif
 	${MKDIR} ${DATADIR}
-.if defined(WITH_DATA)
 	${INSTALL_DATA} ${WRKDIR}/gamedata.vfs ${DATADIR}/
 	${MKDIR} ${DATADIR}/DATA/SCRIPT
 	${INSTALL_DATA} ${WRKDIR}/DATA/SCRIPT/* ${DATADIR}/DATA/SCRIPT
-.endif
-.if defined(WITH_EN)
-	${INSTALL_DATA} ${WRKDIR}/gamelang_en.vfs ${DATADIR}/
-	${LN} -sf ${DATADIR}/gamelang_en.vfs ${DATADIR}/gamelang.vfs
-.endif
-.if defined(WITH_DE)
-	${INSTALL_DATA} ${WRKDIR}/gamelang_de.vfs ${DATADIR}/
-	${LN} -sf ${DATADIR}/gamelang_de.vfs ${DATADIR}/gamelang.vfs
-.endif
-.if defined(WITH_RU)
-	${INSTALL_DATA} ${WRKDIR}/gamelang_ru.vfs ${DATADIR}/
-	${LN} -sf ${DATADIR}/gamelang_ru.vfs ${DATADIR}/gamelang.vfs
-.endif
-
-post-install:
-	@${CAT} ${PKGMESSAGE}
+	${INSTALL_DATA} ${WRKDIR}/gamelang_${LANGPACK}.vfs \
+		${DATADIR}/gamelang.vfs
 
 .include <bsd.port.post.mk>
diff -ruN openastromenace.orig/files/patch-AstroMenaceSource-Main.cpp openastromenace/files/patch-AstroMenaceSource-Main.cpp
--- openastromenace.orig/files/patch-AstroMenaceSource-Main.cpp	1970-01-01 03:00:00.000000000 +0300
+++ openastromenace/files/patch-AstroMenaceSource-Main.cpp	2008-05-19 05:03:02.687044264 +0400
@@ -0,0 +1,39 @@
+--- AstroMenaceSource/Main.cpp.orig	2007-09-23 00:51:32.000000000 +0400
++++ AstroMenaceSource/Main.cpp	2008-05-19 04:59:05.387115362 +0400
+@@ -312,35 +312,7 @@
+ 	const char* key = "HOME";
+ 	const char* homeval = getenv(key);
+ 
+-	bool dirpresent = false;
+-	for (int i=1; i<argc; i++)
+-	{
+-		if (!strncmp(argv[i], "--dir=", sizeof("--dir")))
+-		{
+-			dirpresent = true;
+-			// если передали относительный путь в папку пользователя с тильдой
+-			if (argv[i][6] != '~')
+-				strncpy(ProgrammDir, argv[i]+strlen("--dir="), strlen(argv[i])-strlen("--dir=")+1);
+-			else
+-			{
+-				strcpy(ProgrammDir, homeval);// -1, это тильда... а в кол-ве нет, т.к. /0 там должен остаться
+-				strncat(ProgrammDir, argv[i]+strlen("--dir=")+1, strlen(argv[i])-strlen("--dir="));
+-			}
+-			// если в конце нет слеша - ставим его
+-			if (ProgrammDir[strlen(ProgrammDir)-1] != '/')
+-				strncat(ProgrammDir, "/", strlen("/"));
+-
+-		}
+-	}
+-	if (!dirpresent)
+-	{
+-		strcpy(ProgrammDir, argv[0]);
+-		char* s = strrchr(ProgrammDir,'/');
+-		if (s) s[0]=0x0;
+-		const char *Fi = "/";
+-		strcat( ProgrammDir, Fi );
+-	}
+-
++	strcpy(ProgrammDir, "/usr/local/share/openastromenace/");
+ 
+ 	strcpy(ScreenshotDir, homeval);
+ 	strcat(ScreenshotDir, "/Desktop/AstroMenaceScreenshot");
diff -ruN openastromenace.orig/files/patch-CMakeLists.txt openastromenace/files/patch-CMakeLists.txt
--- openastromenace.orig/files/patch-CMakeLists.txt	1970-01-01 03:00:00.000000000 +0300
+++ openastromenace/files/patch-CMakeLists.txt	2008-05-19 04:25:03.281389076 +0400
@@ -0,0 +1,26 @@
+--- CMakeLists.txt.orig	2007-09-23 00:51:32.000000000 +0400
++++ CMakeLists.txt	2008-05-19 04:24:59.253802609 +0400
+@@ -12,6 +12,8 @@
+ # into current directory and run ./AstroMenace
+ #
+ 
++CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
++
+ # project name
+ PROJECT(AstroMenace)
+ 
+@@ -34,9 +36,12 @@
+ FILE(GLOB_RECURSE astromenace_SRCS AstroMenaceSource/*.cpp)
+ 
+ # targets
+-ADD_DEFINITIONS(`${SDL_CONFIG} --cflags` -g -Wall)
++EXEC_PROGRAM(${SDL_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE SDL_CFLAGS)
++EXEC_PROGRAM(${SDL_CONFIG} ARGS "--libs" OUTPUT_VARIABLE SDL_LIBS)
++
++ADD_DEFINITIONS(${SDL_CFLAGS})
+ ADD_EXECUTABLE(AstroMenace ${astromenace_SRCS})
+-TARGET_LINK_LIBRARIES(AstroMenace `${SDL_CONFIG} --libs` ${OPENGL_gl_LIBRARY} ${OPENAL_LIBRARY} ${JPEG_LIBRARY} ${GLU_LIBRARY} -lalut -lvorbis -lvorbisfile)
++TARGET_LINK_LIBRARIES(AstroMenace ${SDL_LIBS} ${OPENGL_gl_LIBRARY} ${OPENAL_LIBRARY} ${JPEG_LIBRARY} ${GLU_LIBRARY} -lalut -lvorbis -lvorbisfile)
+ IF(CYGWIN)
+ 	TARGET_LINK_LIBRARIES(AstroMenace -lGL.dll  -lGLU.dll -lglfw -lX11.dll)
+ #	ADD_DEFINITIONS(-mno-cygwin)
diff -ruN openastromenace.orig/files/pkg-message.in openastromenace/files/pkg-message.in
--- openastromenace.orig/files/pkg-message.in	2008-05-19 04:35:40.069481697 +0400
+++ openastromenace/files/pkg-message.in	1970-01-01 03:00:00.000000000 +0300
@@ -1,8 +0,0 @@
-=======================================================================
-OpenAstroMenace is now installed. 
-
-You can run game:
-
-AstroMenace --dir=/usr/local/share/openastromenace
-
-=======================================================================
diff -ruN openastromenace.orig/pkg-descr openastromenace/pkg-descr
--- openastromenace.orig/pkg-descr	2008-05-19 04:35:40.075694497 +0400
+++ openastromenace/pkg-descr	2008-05-19 04:27:32.022030694 +0400
@@ -16,3 +16,5 @@
 a great number of improvements for enhancing the defensive abilities of your
 spaceship. Collect money during the combat and invest them into turning your
 spaceship into an ultimate weapon of mass destruction.
+
+WWW: http://sourceforge.net/projects/openastromenace/
diff -ruN openastromenace.orig/pkg-plist openastromenace/pkg-plist
--- openastromenace.orig/pkg-plist	2008-05-19 04:35:40.072582929 +0400
+++ openastromenace/pkg-plist	2008-05-19 04:12:02.195120849 +0400
@@ -24,9 +24,6 @@
 %%DATADIR%%/DATA/SCRIPT/my_aimode_7.xml
 %%DATADIR%%/gamedata.vfs
 %%DATADIR%%/gamelang.vfs
-%%DATADIR%%/gamelang_de.vfs
-%%DATADIR%%/gamelang_en.vfs
-%%DATADIR%%/gamelang_ru.vfs
 @dirrm %%DATADIR%%/DATA/SCRIPT
 @dirrm %%DATADIR%%/DATA
 @dirrm %%DATADIR%%
--- openastromenace.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080519011317.110921702D>