aboutsummaryrefslogtreecommitdiff
path: root/games/gtkradiant/files/patch-SConstruct
blob: 64c22e9411c47e40e2e3e3cb2d37d397c5422a95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
--- 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 ----------------------