1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00

- Fix building on non-i386 architectures.

- Avoid hacking the SConstruct file, pass information through the environment.
This commit is contained in:
Alejandro Pulver 2006-05-31 01:51:05 +00:00
parent a816e06ff7
commit a7e888c12d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=164036
3 changed files with 55 additions and 37 deletions

View File

@ -30,8 +30,10 @@ USE_GCC= 3.4+
USE_GNOME= gtk20 libxml2
USE_PYTHON_BUILD= yes
SUB_FILES= ${PORTNAME}
MAKE_ENV+= CC="${CC}" CXX="${CXX}" CCFLAGS="${CFLAGS}" BUILD=release \
LINKFLAGS="${LDFLAGS}" PTHREAD_LIBS="${PTHREAD_LIBS}" \
SUB_FILES= ${PORTNAME}
DATADIR= ${PREFIX}/lib/${PORTNAME}
.include <bsd.port.pre.mk>
@ -42,16 +44,13 @@ EXTRA_PATCHES+= ${FILESDIR}/extra-patch-libs__bytestreamutils.h \
.endif
post-patch:
.for f in CC CXX CFLAGS LOCALBASE PTHREAD_CFLAGS PTHREAD_LIBS X11BASE
@${REINPLACE_CMD} -i '' -e 's|%%${f}%%|${${f}}|g' ${WRKSRC}/SConstruct
.endfor
@${REINPLACE_CMD} -e 's/-ldl//' ${WRKSRC}/SConscript
@${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__)/'
do-build:
cd ${WRKSRC} && scons && ${PYTHON_CMD} install.py
cd ${WRKSRC} && scons ${MAKE_ENV} && ${PYTHON_CMD} install.py
${CP} -R ${WRKDIR}/${PORTNAME}_gamepacks/* ${WRKSRC}/install
do-install:

View File

@ -1,5 +1,5 @@
--- SConstruct.orig Fri Feb 10 19:01:20 2006
+++ SConstruct Tue Feb 21 12:46:47 2006
+++ SConstruct Tue May 30 22:35:47 2006
@@ -3,7 +3,6 @@
import commands, re, sys, os, pickle, string, popen2
@ -8,54 +8,73 @@
# to access some internal stuff
import SCons
@@ -85,10 +84,10 @@
@@ -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', 'PTHREAD_LIBS', 'LOCALBASE', 'X11BASE', 'JOBS', 'BUILD', 'SETUP']
# default settings -------------------------------
# help -------------------------------------------
-CC='gcc'
-CXX='g++'
+CC='%%CC%%'
+CXX='%%CXX%%'
JOBS='1'
-BUILD='debug'
+BUILD='release'
INSTALL='#install'
SETUP='0'
g_build_root = 'build'
@@ -172,9 +171,9 @@
@@ -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
-CPPPATH = []
+CCFLAGS = '%%CFLAGS%% '
+CXXFLAGS = '%%CFLAGS%% -pipe -DQ_NO_STLPORT '
+CPPPATH = ['%%LOCALBASE%%/include', '%%X11BASE%%/include']
+CCFLAGS += ' '
+CXXFLAGS += ' -pipe -DQ_NO_STLPORT '
CPPPATH = []
if (BUILD == 'debug'):
CXXFLAGS += '-g -D_DEBUG '
CCFLAGS += '-g -D_DEBUG '
@@ -190,7 +189,7 @@
@@ -190,7 +182,6 @@
print 'Unknown build configuration ' + BUILD
sys.exit( 0 )
-LINKFLAGS = ''
+LINKFLAGS = '-L%%LOCALBASE%%/lib -L%%X11BASE%%/lib '
if ( OS == 'Linux' ):
# static
@@ -270,7 +269,9 @@
@@ -218,6 +209,12 @@
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')
+ CPPPATH.append(X11BASE + '/include')
+ LINKFLAGS += '-L' + LOCALBASE + '/lib ' + '-L' + X11BASE + '/lib '
CPPPATH.append('libs')
@@ -269,6 +266,8 @@
def usePThread(self):
if ( OS == 'Darwin' ):
self['LINKFLAGS'] += '-lpthread -Wl,-stack_size,0x400000 '
+ elif ( OS == 'FreeBSD' ):
+ self['LINKFLAGS'] += PTHREAD_LIBS
else:
- self['LINKFLAGS'] += '-lpthread '
+ self['CCFLAGS'] += '%%PTHREAD_CFLAGS%% '
+ self['CXXFLAGS'] += '%%PTHREAD_CFLAGS%% '
+ self['LINKFLAGS'] += '%%PTHREAD_LIBS%% '
self['LINKFLAGS'] += '-lpthread '
def CheckLDD(self, target, source, env):
file = target[0]
@@ -278,7 +279,7 @@
@@ -278,7 +277,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

View File

@ -153,12 +153,12 @@ bin/gtkradiant
%%DATADIR%%/q3bp.game/default_build_menu.xml
%%DATADIR%%/q3bp.game/game.xlink
%%DATADIR%%/q3data.qdt
%%DATADIR%%/q3data.x86
%%DATADIR%%/q3map2.x86
%%DATADIR%%/q3data.cpu
%%DATADIR%%/q3map2.cpu
%%DATADIR%%/q4.game/default_build_menu.xml
%%DATADIR%%/q4.game/q4base/default_shaderlist.txt
%%DATADIR%%/qdata3
%%DATADIR%%/radiant.x86
%%DATADIR%%/radiant.cpu
%%DATADIR%%/sof2.game/BehavEd.bhc
%%DATADIR%%/sof2.game/ChangeLog.txt
%%DATADIR%%/sof2.game/base/default_shaderlist.txt