summaryrefslogtreecommitdiff
path: root/games/marsnomercy/files/patch-SConstruct
blob: e2581d1bd8b63b8ecd5b7febbccc4421ad271723 (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
--- SConstruct	Mon Jul 24 18:19:52 2006
+++ SConstruct	Fri Sep  1 18:41:23 2006
@@ -1,3 +1,5 @@
+import os
+import sys
 # create build environment and options
 env = Environment()
 opts = Options()
@@ -40,12 +42,19 @@
 
 # PLATFORM posix or pure cygwin
 else:
+	# Section used for FreeBSD port
+	LOCALBASE = os.environ['LOCALBASE']
+	X11BASE = os.environ['X11BASE']
+	SDL_CONFIG = os.environ['SDL_CONFIG']
 	# determine compiler and linker flags for SDL
-	env.ParseConfig('sdl-config --cflags')
-	env.ParseConfig('sdl-config --libs')
+	env.ParseConfig(SDL_CONFIG + ' --cflags')
+	env.ParseConfig(SDL_CONFIG + ' --libs')
 	# add additional compiler flags
-	env.Append(CCFLAGS = ['-O2'])
-
+	env.Replace(CC = os.environ['CC'])
+	env.Replace(CXX = os.environ['CXX'])
+	env.Replace(CPPPATH = [X11BASE + '/include',LOCALBASE+ '/include'])
+	env.Replace(LIBPATH = [X11BASE + '/lib',LOCALBASE+ '/lib'])
+	env.Append(CXXFLAGS = os.environ['CXXFLAGS'] + ' `' + SDL_CONFIG + ' --cflags`')
 
 # generate help for options
 Help(opts.GenerateHelpText(env))
@@ -53,7 +62,7 @@
 
 # build for debug
 if int(env['debug']):
-	env.Append(CCFLAGS = ['-g', '-O0'])
+	env.Append(CXXFLAGS = ['-g', '-O0'])
 	# of course no stripping if debug
 	env['strip'] = 0
 
@@ -63,20 +72,20 @@
 
 # print all warnings
 if int(env['warnings']):
-	env.Append(CCFLAGS = ['-Wall'])
+	env.Append(CXXFLAGS = ['-Wall'])
 
 
 # check for libraries and headers (if not cleaning)
 if not env.GetOption('clean'):
 	print ":: Checking for libs"
 	conf = Configure(env)
-	if not conf.CheckLibWithHeader('libSDL', 'SDL.h', 'c', 'SDL_Init(SDL_INIT_VIDEO);', autoadd = 0):
+	if not conf.CheckLibWithHeader('libSDL-1.1', 'SDL11/SDL.h', 'c', 'SDL_Init(SDL_INIT_VIDEO);', autoadd = 0):
 		print 'Did not find libSDL, exiting!'
 		Exit(1)
-	if not conf.CheckLibWithHeader('libSDL_image', 'SDL_image.h', 'c', 'IMG_GetError();'):
+	if not conf.CheckLibWithHeader('libSDL_image', 'SDL11/SDL_image.h', 'c', 'IMG_GetError();'):
 		print 'Did not find libSDL_image, exiting!'
 		Exit(1)
-	if not conf.CheckLibWithHeader('libSDL_ttf', 'SDL_ttf.h', 'c', 'TTF_Init();'):
+	if not conf.CheckLibWithHeader('libSDL_ttf', 'SDL11/SDL_ttf.h', 'c', 'TTF_Init();'):
 		print 'Did not find libSDL_ttf, exiting!'
 		Exit(1)
 	if int(env['with_opengl']):
@@ -85,7 +94,7 @@
 			print 'Try "scons with_opengl=no"'
 			Exit(1)
 		else:
-			env.Append(CCFLAGS = ['-DWITH_OPENGL'])
+			env.Append(CXXFLAGS = ['-DWITH_OPENGL'])
 	env = conf.Finish()