diff --git a/games/battletanks/Makefile b/games/battletanks/Makefile index a7d1f03471e1..76c29885973a 100644 --- a/games/battletanks/Makefile +++ b/games/battletanks/Makefile @@ -1,58 +1,58 @@ PORTNAME= btanks PORTVERSION= 0.9.8083 PORTREVISION= 11 CATEGORIES= games MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-source/ MAINTAINER= danfe@FreeBSD.org COMMENT= Fast 2D tank arcade game with multiplayer and split-screen modes WWW= https://btanks.sourceforge.net/ LICENSE= GPLv2+ LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= zip:archivers/zip LIB_DEPENDS= libsigc-2.0.so:devel/libsigc++20 \ libexpat.so:textproc/expat2 \ libvorbisfile.so:audio/libvorbis \ libsmpeg.so:multimedia/smpeg USES= lua:51 openal:al pkgconfig python:build scons sdl tar:bzip2 USE_CXXSTD= gnu++98 USE_LDCONFIG= yes USE_SDL= image sdl MAKE_ARGS= prefix=${PREFIX} resources_dir=${DATADIR} \ --install-sandbox=${STAGEDIR} CXXFLAGS+= -fpermissive PORTDOCS= LICENSE LICENSE.EXCEPTION README-en.txt README-linux.txt \ donate.url homepage.url project_page.url video.txt DESKTOP_ENTRIES="Battle Tanks" "" "" "${PORTNAME}" "Game;ArcadeGame;" "" OPTIONS_DEFINE= DOCS post-patch: - @${REINPLACE_CMD} -e 's/lua5\.1/lua-${LUA_VER}/' \ - ${WRKSRC}/engine/SConscript + @${REINPLACE_CMD} -e '/for lua in/s/lua5\.1/lua-${LUA_VER}/ ; \ + /^env.*ENABLE_LUA/d' ${WRKSRC}/engine/SConscript @${REINPLACE_CMD} -e "s/env\.has_key('prefix')/'prefix' in env/" \ ${WRKSRC}/mrt/SConscript # Prevent the clash with /usr/include/semaphore.h @${MV} ${WRKSRC}/sdlx/semaphore.h ${WRKSRC}/sdlx/sdlx_semaphore.h @${REINPLACE_CMD} -e 's/semaphore\.h"/sdlx_&/' \ ${WRKSRC}/sdlx/semaphore.cpp ${WRKSRC}/sdlx/thread.h pre-build: # Regenerate `sl08.h' after we patch `sl08.py' (patching the header itself # would've resulted in a larger diff and gratuitous difference with Debian) cd ${WRKSRC}/engine/sl08 && ${PYTHON_CMD} sl08.py > sl08.h post-install: ${INSTALL_MAN} ${FILESDIR}/${PORTNAME}.6 \ ${STAGEDIR}${PREFIX}/share/man/man6 @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR} ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/* ${STAGEDIR}${PREFIX}/lib/*.so \ ${STAGEDIR}${PREFIX}/lib/btanks/*.so .include diff --git a/games/battletanks/files/patch-SConstruct b/games/battletanks/files/patch-SConstruct index d65bd1f6f72a..dcf0da69efb9 100644 --- a/games/battletanks/files/patch-SConstruct +++ b/games/battletanks/files/patch-SConstruct @@ -1,175 +1,172 @@ --- SConstruct.orig 2009-12-10 14:58:55 UTC +++ SConstruct -@@ -16,7 +16,7 @@ env['BUILDERS']['Library'] = picLibBuilder +@@ -16,7 +16,7 @@ picLibBuilder = Builder( env['BUILDERS']['StaticLibrary'] = picLibBuilder env['BUILDERS']['Library'] = picLibBuilder -opts = Options(['options.cache']) +opts = Variables(['options.cache']) #opts.Add('CC', 'C compiler') #opts.Add('CXX', 'C++ compiler') opts.Add('CCFLAGS', 'General options that are passed to the C compiler') -@@ -30,12 +30,13 @@ if sys.platform != "win32": +@@ -30,12 +30,13 @@ opts.Add('CPPPATH', 'extra cpp path') if sys.platform != "win32": opts.Add('prefix', 'prefix for **nix packaging', '') + opts.Add('DESTDIR', 'staging dir (also for packaging)', '') opts.Add('lib_dir', 'resources directory (default: prefix/lib)', '') opts.Add('plugins_dir', 'plugins directory (default: prefix/lib/btanks)', '') opts.Add('resources_dir', 'resources directory (default: prefix/share/btanks)', '') - opts.Add(BoolOption('gcc_visibility', 'gcc visibility', 'true')) + opts.Add(BoolVariable('gcc_visibility', 'gcc visibility', 'true')) -opts.Add(EnumOption('mode', 'build mode', 'release', allowed_values=('debug','release'))) +opts.Add(EnumVariable('mode', 'build mode', 'release', allowed_values=('debug','release'))) opts.Update(env) opts.Save('options.cache', env.Clone()) -@@ -47,16 +48,18 @@ import SCons.Util +@@ -47,16 +48,18 @@ debug = buildmode == "debug" Export('debug') import SCons.Util -if os.environ.has_key('CC'): +if 'CC' in os.environ: env['CC'] = os.environ['CC'] -if os.environ.has_key('CFLAGS'): +if 'CFLAGS' in os.environ: env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS']) -if os.environ.has_key('CXX'): +if 'CXX' in os.environ: env['CXX'] = os.environ['CXX'] -if os.environ.has_key('CXXFLAGS'): +if 'CXXFLAGS' in os.environ: env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS']) -if os.environ.has_key('LDFLAGS'): +if 'LDFLAGS' in os.environ: env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS']) +if 'CPPPATH' in os.environ: + env['CPPPATH'] = os.environ['CPPPATH'].split() if (sys.platform != "win32" and env['gcc_visibility']): env.Append(CCFLAGS=['-fvisibility=hidden', '-DGCC_HASCLASSVISIBILITY']) @@ -98,9 +101,6 @@ else: if debug: env.Append(CCFLAGS=['-ggdb', '-D_FORTIFY_SOURCE=2']) env.Append(CPPFLAGS=['-ggdb', '-D_FORTIFY_SOURCE=2']) - else: - env.Append(CCFLAGS=['-O3']) - env.Append(CPPFLAGS=['-O3']) env.Append(CPPFLAGS=['-Wall', '-Wno-deprecated', '-pedantic', '-Wno-long-long', '-pipe', '-pthread']) env.Append(CCFLAGS=['-Wall', '-Wno-deprecated', '-pedantic', '-Wno-long-long', '-pipe', '-pthread']) @@ -119,17 +119,17 @@ else: #print conf.env['CCFLAGS'] -if not conf.CheckLibWithHeader('expat', 'expat.h', 'c', "XML_ParserCreate(NULL);", False): +if not conf.CheckLibWithHeader('expat', 'expat.h', 'c', None, "XML_ParserCreate(NULL);", False): Exit(1) -if not conf.CheckLibWithHeader('z', 'zlib.h', 'c', "zlibVersion();", False): +if not conf.CheckLibWithHeader('z', 'zlib.h', 'c', None, "zlibVersion();", False): Exit(1) if sys.platform == "win32": conf.env.Append(LINKFLAGS = ['/SUBSYSTEM:WINDOWS', '/FORCE']) conf.env.Append(LIBS=['SDLmain']) -if not conf.CheckLibWithHeader('SDL', 'SDL.h', 'c++', "SDL_Init(0);", False): +if not conf.CheckLibWithHeader('SDL', 'SDL.h', 'c++', None, "SDL_Init(0);", False): Exit(1) -@@ -140,23 +140,23 @@ Export('smpeg_lib') +@@ -140,23 +140,23 @@ if debug and sys.platform == 'win32': smpeg_lib = 'smpeg_d' Export('smpeg_lib') -if not conf.CheckLibWithHeader(smpeg_lib, 'smpeg/smpeg.h', 'c++', "SMPEG_new_data(malloc(42), 42, NULL, 0);", False): +if not conf.CheckLibWithHeader(smpeg_lib, 'smpeg/smpeg.h', 'c++', None, "SMPEG_new_data(malloc(42), 42, NULL, 0);", False): Exit(1) -if not conf.CheckLibWithHeader('SDL_image', 'SDL_image.h', 'c++', "IMG_Load(0);", False): +if not conf.CheckLibWithHeader('SDL_image', 'SDL_image.h', 'c++', None, "IMG_Load(0);", False): Exit(1) -if not conf.CheckLibWithHeader('vorbisfile', 'vorbis/vorbisfile.h', 'c++', "ov_open(0, 0, 0, 0);", False): +if not conf.CheckLibWithHeader('vorbisfile', 'vorbis/vorbisfile.h', 'c++', None, "ov_open(0, 0, 0, 0);", False): Exit(1) if sys.platform == 'win32': - if not conf.CheckLibWithHeader('lua', 'lua.hpp', 'c++', "lua_newstate(NULL, NULL);", False): + if not conf.CheckLibWithHeader('lua', 'lua.hpp', 'c++', None, "lua_newstate(NULL, NULL);", False): Exit(1) if sys.platform != 'win32': - have_sse = conf.CheckLibWithHeader('m', "xmmintrin.h", 'c', '_mm_set_ss(1.0f);', False) + have_sse = conf.CheckLibWithHeader('m', "xmmintrin.h", 'c', None, '_mm_set_ss(1.0f);', False) else: - have_sse = conf.CheckLibWithHeader('kernel32', "xmmintrin.h", 'c', '_mm_set_ss(1.0f);', False) # hackish lib :( + have_sse = conf.CheckLibWithHeader('kernel32', "xmmintrin.h", 'c', None, '_mm_set_ss(1.0f);', False) # hackish lib :( conf.Finish() +@@ -177,7 +177,7 @@ Export('have_sse') + lib_dir = '.' + plugins_dir = '' + try : +- version_file = file('.svnversion', 'r') ++ version_file = open('.svnversion') + try : + version = version_file.readline().strip() + prefix = env['prefix'] @@ -205,7 +205,7 @@ try : except: info = sys.exc_info() - print "%s %s %s" %(info[0], info[1], info[2]) + print("%s %s %s" %(info[0], info[1], info[2])) except : svnversion = os.popen('svnversion -n .', 'r') version = svnversion.readline().strip() -@@ -238,7 +238,10 @@ version = version[version.rfind(':') + 1:] - env.Append(CPPDEFINES='PLUGINS_DIR="\\"' + plugins_dir + '\\""') - - version = version[version.rfind(':') + 1:] --revision = int(version.replace('M', '')) -+try: -+ revision = int(version.replace('M', '')) -+except ValueError: -+ revision = 0 - - Export('version') - Export('revision') -@@ -246,31 +249,35 @@ version = '0.9.%s' %version +@@ -246,31 +246,35 @@ Export('lib_dir') Export('plugins_dir') version = '0.9.%s' %version -print "version: %s" %version +print("version: %s" %version) bt_sublibs = ['mrt', 'sdlx', 'objects', 'clunk'] env.Append(CPPPATH=['#']) if (os.path.exists('private')): dir = 'private' - BuildDir('#/build/' + buildmode + '/' + dir, dir, 0) + VariantDir('#/build/' + buildmode + '/' + dir, dir, 0) SConscript('#/build/' + buildmode + '/' + dir + '/SConscript') for dir in bt_sublibs: - BuildDir('#/build/' + buildmode + '/' + dir, dir, 0) + VariantDir('#/build/' + buildmode + '/' + dir, dir, 0) SConscript('#/build/' + buildmode + '/' + dir + '/SConscript') for dir in bt_sublibs: env.Append(LIBPATH=['#/build/' + buildmode + '/' + dir]) -env.BuildDir('#/build/' + buildmode + '/editor', 'editor', 0) +env.VariantDir('#/build/' + buildmode + '/editor', 'editor', 0) SConscript('#/build/' + buildmode + '/editor/SConscript') env.Append(LIBPATH=['#/build/' + buildmode + '/engine']) -env.BuildDir('#/build/' + buildmode + '/engine', 'engine', 0) +env.VariantDir('#/build/' + buildmode + '/engine', 'engine', 0) SConscript('#/build/' + buildmode + '/engine/' + 'SConscript') if len(install_targets) > 0: - install_targets.append(env.Command(resources_dir + '/resources.dat', '#/data', 'zip -q -0 -r $TARGET * -x \*.svn\* -x \*.wav', chdir='data')) + install_targets.append( + env.Command(env['DESTDIR'] + resources_dir + '/resources.dat', + '#/data', + 'zip -q -0 -r $TARGET * -x \*.svn\* -x \*.wav', + chdir='data')) env.Alias('install', install_targets)