diff --git a/games/gtkradiant/Makefile b/games/gtkradiant/Makefile index 907426700916..3fb93b36f945 100644 --- a/games/gtkradiant/Makefile +++ b/games/gtkradiant/Makefile @@ -1,85 +1,91 @@ PORTNAME= gtkradiant PORTVERSION= 1.5.0 PORTREVISION= 19 CATEGORIES= games cad MASTER_SITES= IDSOFTWARE/source/:id \ http://www.bsd-geek.de/FreeBSD/distfiles/:fb DISTNAME= GtkRadiant-GPL DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:id \ ${PORTNAME}_gamepacks${EXTRACT_SUFX}:fb MAINTAINER= danfe@FreeBSD.org COMMENT= Map editor for FPS games, by id Software and Loki Software WWW= http://www.qeradiant.com/ LICENSE= GPLv2 LIB_DEPENDS= libgtkglext-x11-1.0.so:x11-toolkits/gtkglext \ libmhash.so:security/mhash \ libpng.so:graphics/png USES= compiler:c++11-lang gnome pkgconfig python:build scons zip -USE_GNOME= gtk20 libxml2 +USE_GNOME= gdkpixbuf2 gtk20 libxml2 MAKE_ARGS= ${MAKE_ENV} BUILD=release SSP_UNSAFE= yes DATADIR= ${PREFIX}/lib/${PORTNAME} WRKSRC= ${WRKDIR}/GPL/GtkRadiant SUB_FILES= ${PORTNAME} post-patch: @${GREP} -Rl 'defined[[:blank:]]*([[:blank:]]*__linux__[[:blank:]]*) || defined[[:blank:]]*([[:blank:]]*__APPLE__[[:blank:]]*)' ${WRKSRC} | \ ${XARGS} ${REINPLACE_CMD} -e \ 's/\(defined[[:blank:]]*([[:blank:]]*__linux__[[:blank:]]*) || defined[[:blank:]]*([[:blank:]]*__APPLE__[[:blank:]]*)\)/\1 || defined (__FreeBSD__)/' @${REINPLACE_CMD} -e 's|glib/.*\.h>|glib.h>|g' \ ${WRKSRC}/libs/os/dir.h \ ${WRKSRC}/libs/gtkutil/idledraw.h \ ${WRKSRC}/libs/gtkutil/cursor.h \ ${WRKSRC}/libs/convert.h \ ${WRKSRC}/plugins/shaders/shaders.cpp \ ${WRKSRC}/plugins/vfspk3/vfs.cpp \ ${WRKSRC}/radiant/feedback.h \ ${WRKSRC}/radiant/environment.cpp \ ${WRKSRC}/radiant/patch.cpp \ ${WRKSRC}/radiant/watchbsp.cpp \ ${WRKSRC}/tools/quake3/common/inout.c -# Fix the build against Clang +# Fix the build against Clang and possibly other modern compilers + @${REINPLACE_CMD} -e 's,register ,,g' \ + ${WRKSRC}/libs/container/hashfunc.h \ + ${WRKSRC}/libs/jpeg6/jdcolor.cpp \ + ${WRKSRC}/libs/jpeg6/jdhuff.* \ + ${WRKSRC}/libs/jpeg6/jdsample.cpp \ + ${WRKSRC}/libs/jpeg6/jutils.cpp @${REINPLACE_CMD} -e '/#include "generic\/reference\.h"/x ; 318G' \ ${WRKSRC}/libs/scenelib.h @${REINPLACE_CMD} -e '/#include "generic\/referencecounted\.h/ { \ x ; s/^/#include "scenelib.h"/ ; G ; }' \ ${WRKSRC}/plugins/mapq3/parse.h # Fix warnings of "GtkSpinButton: setting an adjustment with non-zero # page size is deprecated" (very annoying) @${GREP} -Rl --null gtk_adjustment_new ${WRKSRC} | ${XARGS} -0 \ ${REINPLACE_CMD} -E 's|(gtk_adjustment_new[^)]*,)[^)]*|\1 0|' # Do not #include header which is deprecated @${REINPLACE_CMD} -e '/#include/s, diff --git a/games/gtkradiant/files/patch-SConstruct b/games/gtkradiant/files/patch-SConstruct index 7484c3a34b55..1e8ca062178f 100644 --- a/games/gtkradiant/files/patch-SConstruct +++ b/games/gtkradiant/files/patch-SConstruct @@ -1,236 +1,239 @@ --- SConstruct.orig 2006-02-10 22:01:20 UTC +++ SConstruct @@ -1,9 +1,8 @@ # scons build script # http://scons.sourceforge.net -import commands, re, sys, os, pickle, string, popen2 +import subprocess as commands, re, sys, os, pickle, string from makeversion import radiant_makeversion, get_version -from osx_setup import do_osx_setup # to access some internal stuff import SCons @@ -11,7 +10,7 @@ import SCons conf_filename='site.conf' # there is a default hardcoded value, you can override on command line, those are saved between runs # we only handle strings -serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'SETUP'] +serialized=['CC', 'CXX', 'CCFLAGS', 'CXXFLAGS', 'LINKFLAGS', 'LOCALBASE', 'JOBS', 'BUILD', 'SETUP'] # help ------------------------------------------- @@ -55,7 +54,7 @@ SETUP #EnsurePythonVersion(2,1) # above 0.90 EnsureSConsVersion( 0, 96 ) -print 'SCons ' + SCons.__version__ +print('SCons ' + SCons.__version__) # end sanity ------------------------------------- @@ -64,18 +63,11 @@ print 'SCons ' + SCons.__version__ # TODO: detect Darwin / OSX # CPU type -g_cpu = commands.getoutput('uname -m') -exp = re.compile('.*i?86.*') -if (g_cpu == 'Power Macintosh' or g_cpu == 'ppc'): - g_cpu = 'ppc' -elif exp.match(g_cpu): - g_cpu = 'x86' -else: - g_cpu = 'cpu' +g_cpu = 'cpu' # OS OS = commands.getoutput('uname') -print "OS=\"" + OS + "\"" +print("OS=\"" + OS + "\"") if (OS == 'Linux'): # libc .. do the little magic! @@ -99,13 +91,15 @@ g_build_root = 'build' site_dict = {} if (os.path.exists(conf_filename)): - site_file = open(conf_filename, 'r') + print( conf_filename ) + site_file = open(conf_filename, 'rb') p = pickle.Unpickler(site_file) - site_dict = p.load() - print 'Loading build configuration from ' + conf_filename + try: site_dict = p.load() + except EOFError: site_dict = {} + print('Loading build configuration from ' + conf_filename) for k, v in site_dict.items(): exec_cmd = k + '=\"' + v + '\"' - print exec_cmd + print(exec_cmd) exec(exec_cmd) # end site settings ------------------------------ @@ -113,9 +107,9 @@ if (os.path.exists(conf_filename)): # command line settings -------------------------- for k in serialized: - if (ARGUMENTS.has_key(k)): + if (k in ARGUMENTS): exec_cmd = k + '=\"' + ARGUMENTS[k] + '\"' - print 'Command line: ' + exec_cmd + print('Command line: ' + exec_cmd) exec(exec_cmd) # end command line settings ---------------------- @@ -123,14 +117,14 @@ for k in serialized: # sanity check ----------------------------------- if (SETUP == '1' and BUILD != 'release' and BUILD != 'info'): - print 'Forcing release build for setup' + print('Forcing release build for setup') BUILD = 'release' def GetGCCVersion(name): ret = commands.getstatusoutput('%s -dumpversion' % name) if ( ret[0] != 0 ): return None - vers = string.split(ret[1], '.') + vers = ret[1].split('.') if ( len(vers) == 2 ): return [ vers[0], vers[1], 0 ] elif ( len(vers) == 3 ): @@ -140,9 +134,9 @@ def GetGCCVersion(name): ver_cc = GetGCCVersion(CC) ver_cxx = GetGCCVersion(CXX) -if ( ver_cc is None or ver_cxx is None or ver_cc[0] < '3' or ver_cxx[0] < '3' or ver_cc != ver_cxx ): - print 'Compiler version check failed - need gcc 3.x or later:' - print 'CC: %s %s\nCXX: %s %s' % ( CC, repr(ver_cc), CXX, repr(ver_cxx) ) +if ( ver_cc is None or ver_cxx is None or int(ver_cc[0]) < 3 or int(ver_cxx[0]) < 3 or ver_cc != ver_cxx ): + print('Compiler version check failed - need gcc 3.x or later:') + print('CC: %s %s\nCXX: %s %s' % ( CC, repr(ver_cc), CXX, repr(ver_cxx) )) Exit(1) # end sanity check ------------------------------- @@ -153,7 +147,7 @@ for k in serialized: exec_cmd = 'site_dict[\'' + k + '\'] = ' + k exec(exec_cmd) -site_file = open(conf_filename, 'w') +site_file = open(conf_filename, 'wb') p = pickle.Pickler(site_file) p.dump(site_dict) site_file.close() -@@ -172,8 +166,8 @@ LINK = CXX +@@ -170,7 +164,7 @@ SetOption('num_jobs', JOBS) + + LINK = CXX # common flags - warningFlags = '-W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter ' +-warningFlags = '-W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter ' ++warningFlags = '-Wall -Wextra -Wcast-align -Wcast-qual -Wno-implicit-function-declaration -Wno-unused-parameter ' warningFlagsCXX = '-Wno-non-virtual-dtor -Wreorder ' # -Wold-style-cast --CCFLAGS = '' + warningFlags --CXXFLAGS = '-pipe -DQ_NO_STLPORT ' + warningFlags + warningFlagsCXX -+CCFLAGS += ' ' -+CXXFLAGS += ' -pipe -DQ_NO_STLPORT ' - CPPPATH = [] - if (BUILD == 'debug'): + CCFLAGS = '' + warningFlags + CXXFLAGS = '-pipe -DQ_NO_STLPORT ' + warningFlags + warningFlagsCXX +@@ -179,18 +173,17 @@ if (BUILD == 'debug'): CXXFLAGS += '-g -D_DEBUG ' -@@ -182,15 +176,14 @@ elif (BUILD == 'release'): - CXXFLAGS += '-O2 ' - CCFLAGS += '-O2 ' + CCFLAGS += '-g -D_DEBUG ' + elif (BUILD == 'release'): +- CXXFLAGS += '-O2 ' +- CCFLAGS += '-O2 ' ++ # uphold system-provided compilation flags ++ pass elif ( BUILD == 'info' ): - print 'Preparing OSX release' + print('Preparing OSX release') ( line, major, minor ) = get_version() do_osx_setup( major, minor, 'osx-radiant-%s.run' % line ) sys.exit( 0 ) else: - print 'Unknown build configuration ' + BUILD + print('Unknown build configuration ' + BUILD) sys.exit( 0 ) -LINKFLAGS = '' if ( OS == 'Linux' ): # static @@ -218,6 +211,11 @@ if ( OS == 'Darwin' ): CPPPATH.append('/sw/include') CPPPATH.append('/usr/X11R6/include') LINKFLAGS += '-L/sw/lib -L/usr/lib -L/usr/X11R6/lib ' +elif ( OS == 'FreeBSD' ): + CCFLAGS += '-fPIC ' + CXXFLAGS += '-fPIC ' + CPPPATH.append(LOCALBASE + '/include') + LINKFLAGS += '-L' + LOCALBASE + '/lib ' CPPPATH.append('libs') @@ -248,7 +246,7 @@ class idEnvironment(Environment): def useGtk2(self): self['CXXFLAGS'] += '`pkg-config gtk+-2.0 --cflags` ' self['CCFLAGS'] += '`pkg-config gtk+-2.0 --cflags` ' - self['LINKFLAGS'] += '-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpango-1.0 -lgdk_pixbuf-2.0 ' + self['LINKFLAGS'] += '-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpango-1.0 -lgdk_pixbuf-2.0 -lgobject-2.0 ' def useGtkGLExt(self): self['CXXFLAGS'] += '`pkg-config gtkglext-1.0 --cflags` ' @@ -278,18 +276,18 @@ class idEnvironment(Environment): print('ERROR: CheckLDD: target %s not found\n' % target[0]) Exit(1) # not using os.popen3 as I want to check the return code - ldd = popen2.Popen3('`which ldd` -r %s' % target[0], 1) - stdout_lines = ldd.fromchild.readlines() - stderr_lines = ldd.childerr.readlines() + ldd = commands.Popen(['ldd', str(file)], 1, stdout=commands.PIPE, stderr=commands.PIPE) + stdout_lines = ldd.stdout.readlines() + stderr_lines = ldd.stderr.readlines() ldd_ret = ldd.wait() del ldd have_undef = 0 if ( ldd_ret != 0 ): - print "ERROR: ldd command returned with exit code %d" % ldd_ret + print("ERROR: ldd command returned with exit code %d" % ldd_ret) os.system('rm %s' % target[0]) Exit() for i_line in stderr_lines: - print repr(i_line) + print(repr(i_line)) regex = re.compile('undefined symbol: (.*)\t\\((.*)\\)\n') if ( regex.match(i_line) ): symbol = regex.sub('\\1', i_line) @@ -298,11 +296,11 @@ class idEnvironment(Environment): except: have_undef = 1 else: - print "ERROR: failed to parse ldd stderr line: %s" % i_line + print("ERROR: failed to parse ldd stderr line: %s" % i_line) os.system('rm %s' % target[0]) Exit(1) if ( have_undef ): - print "ERROR: undefined symbols" + print("ERROR: undefined symbols") os.system('rm %s' % target[0]) Exit(1) @@ -317,8 +315,14 @@ g_env = idEnvironment() # export the globals GLOBALS = 'g_env INSTALL SETUP g_cpu' -radiant_makeversion('\\ngcc version: %s.%s.%s' % ( ver_cc[0], ver_cc[1], ver_cc[2] ) ) +def get_compiler_info(cxx): + ret = commands.getstatusoutput('%s -v' % cxx) + if (ret[0] != 0): return None + info = re.search('(gcc|clang) version [0-9.]+', ret[1]) + return info.group(0) if info else None +radiant_makeversion('\\n%s' % get_compiler_info(CXX)) + # end general configuration ---------------------- # targets ---------------------------------------- @@ -326,7 +330,7 @@ radiant_makeversion('\\ngcc version: %s.%s.%s' % ( ver Default('.') Export('GLOBALS ' + GLOBALS) -BuildDir(g_build, '.', duplicate = 0) +VariantDir(g_build, '.', duplicate = 0) SConscript(g_build + '/SConscript') # end targets ------------------------------------