freebsd-ports/games/gtkradiant/files/patch-SConstruct
Alexey Dokuchaev c3b4f43e44 - Fix the build against modern libpng (do not try to access private data)
- Clang insists that reference cannot be bound to dereferenced null pointer
  in well-defined C++ code (that is correct) and evaluates comparisons like
  &foo == 0 to false, which breaks GtkRadiant; "fix" this with a dirty hack
  by casting those "bad" references to a local volatile int variable
- Remove no longer required and no-op -lpthread vs. -pthread patch hunk
- Report operating system and correct compiler version in the About dialog
- When fixing annoying "GtkSpinButton: setting an adjustment with non-zero
  page size is deprecated" warnings, replace find(1) with grep(1) to narrow
  down initial search results and, subsequently, sed(1) furiousness
- Omit port revision bump as the port was BROKEN for quite some time
2015-04-18 16:29:01 +00:00

99 lines
3.2 KiB
Text

--- SConstruct.orig Fri Feb 10 19:01:20 2006
+++ SConstruct Tue May 30 22:35:47 2006
@@ -3,7 +3,6 @@
import commands, re, sys, os, pickle, string, popen2
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 @@
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 -------------------------------------------
@@ -64,14 +63,7 @@
# 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')
@@ -172,8 +164,8 @@
# common flags
warningFlags = '-W -Wall -Wcast-align -Wcast-qual -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'):
CXXFLAGS += '-g -D_DEBUG '
@@ -190,7 +182,6 @@
print 'Unknown build configuration ' + BUILD
sys.exit( 0 )
-LINKFLAGS = ''
if ( OS == 'Linux' ):
# static
@@ -218,6 +209,11 @@
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 +244,7 @@
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,7 +276,7 @@
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)
+ ldd = popen2.Popen3('`which ldd` %s' % target[0], 1)
stdout_lines = ldd.fromchild.readlines()
stderr_lines = ldd.childerr.readlines()
ldd_ret = ldd.wait()
@@ -317,7 +313,13 @@
# 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 ----------------------