* fixing linking flag form.
[blender.git] / config / darwin-config.py
1 #
2 # Note : if you want to alter this file
3 # copy it as a whole in the upper folder
4 # as user-config.py
5 # dont create a new file with only some
6 # vars changed.
7
8 import commands
9
10 # IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
11 USE_SDK=True
12
13 cmd = 'uname -p'
14 MAC_PROC=commands.getoutput(cmd) 
15 cmd = 'uname -r'
16 cmd_res=commands.getoutput(cmd) 
17 if cmd_res[0]=='7':
18         MAC_CUR_VER='10.3'
19 elif cmd_res[0]=='8':
20         MAC_CUR_VER='10.4'
21 else:
22         MAC_CUR_VER='10.5'
23
24 if MAC_PROC == 'powerpc':
25         LCGDIR = '#../lib/darwin-6.1-powerpc'
26 else :
27         LCGDIR = '#../lib/darwin-8.x.i386'
28 LIBDIR = '${LCGDIR}'
29
30 BF_PYTHON_VERSION = '3.1'
31
32 if MAC_PROC== 'powerpc' and BF_PYTHON_VERSION == '2.3':
33         MAC_MIN_VERS = '10.3'
34         MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
35 else:
36         MAC_MIN_VERS = '10.4'
37         MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
38
39
40 # enable ffmpeg  support
41 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
42 FFMPEG_PRECOMPILED = False
43 if FFMPEG_PRECOMPILED:
44         # use precompiled ffmpeg in /lib
45         BF_FFMPEG = LIBDIR + '/ffmpeg'
46         BF_FFMPEG_INC = "#extern/ffmpeg"
47         BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
48         BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore'
49 else:
50         # use ffmpeg in extern
51         BF_FFMPEG = "#extern/ffmpeg"
52         BF_FFMPEG_INC = '${BF_FFMPEG}'
53         if USE_SDK==True:
54                 BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
55         BF_XVIDCORE_CONFIG = '--disable-assembly'       # currently causes errors, even with yasm installed
56         BF_X264_CONFIG = '--disable-pthread'
57
58 if BF_PYTHON_VERSION=='3.1':
59         # python 3.1 uses precompiled libraries in bf svn /lib by default
60
61         BF_PYTHON = LIBDIR + '/python'
62         BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
63         # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
64         BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
65         BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
66         # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
67 else:
68         # python 2.5 etc. uses built-in framework
69
70         # python.org libs install in /library we want to use that for 2.5 
71         #
72         # if you want py2.5 on leopard without installing
73         # change value to BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
74         # BEWARE: in that case it will work only on leopard
75
76         BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
77
78         BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}'
79         BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
80         BF_PYTHON_LIB = ''
81         BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
82         BF_PYTHON_LINKFLAGS = ['-u','_PyMac_Error','-framework','System','-framework','Python']
83         if MAC_CUR_VER=='10.3' or  MAC_CUR_VER=='10.4':
84                 BF_PYTHON_LINKFLAGS = ['-u', '__dummy']+BF_PYTHON_LINKFLAGS
85         
86 BF_QUIET = '1'
87 WITH_BF_OPENMP = '0'
88
89 #different lib must be used  following version of gcc
90 # for gcc 3.3
91 #BF_OPENAL = LIBDIR + '/openal'
92 # for gcc 3.4 and ulterior
93 if MAC_PROC == 'powerpc':
94         BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
95 else :
96         BF_OPENAL = LIBDIR + '/openal'
97
98 WITH_BF_STATICOPENAL = False
99 BF_OPENAL_INC = '${BF_OPENAL}/include'
100 BF_OPENAL_LIB = 'openal'
101 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
102 # Warning, this static lib configuration is untested! users of this OS please confirm.
103 BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
104
105 # Warning, this static lib configuration is untested! users of this OS please confirm.
106 BF_CXX = '/usr'
107 WITH_BF_STATICCXX = False
108 BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
109
110 BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
111 BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
112 BF_LIBSAMPLERATE_LIB = 'samplerate'
113 BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
114
115 WITH_BF_SDL = True
116 BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
117 BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
118 BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
119 BF_SDL_LIBPATH = '${BF_SDL}/lib'
120
121 WITH_BF_OPENEXR = True
122 WITH_BF_STATICOPENEXR = False
123 BF_OPENEXR = '${LCGDIR}/openexr'
124 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
125 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
126 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
127 # Warning, this static lib configuration is untested! users of this OS please confirm.
128 BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
129
130 WITH_BF_DDS = True
131
132 WITH_BF_JPEG = True
133 BF_JPEG = LIBDIR + '/jpeg'
134 BF_JPEG_INC = '${BF_JPEG}/include'
135 BF_JPEG_LIB = 'jpeg'
136 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
137
138 WITH_BF_PNG = True
139 BF_PNG = LIBDIR + '/png'
140 BF_PNG_INC = '${BF_PNG}/include'
141 BF_PNG_LIB = 'png'
142 BF_PNG_LIBPATH = '${BF_PNG}/lib'
143
144 BF_TIFF = LIBDIR + '/tiff'
145 BF_TIFF_INC = '${BF_TIFF}/include'
146
147 WITH_BF_ZLIB = True
148 BF_ZLIB = '/usr'
149 BF_ZLIB_INC = '${BF_ZLIB}/include'
150 BF_ZLIB_LIB = 'z'
151
152 WITH_BF_INTERNATIONAL = True
153
154 BF_GETTEXT = LIBDIR + '/gettext'
155 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
156 BF_GETTEXT_LIB = 'intl'
157 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
158
159 WITH_BF_GAMEENGINE=True
160 WITH_BF_PLAYER = False
161
162 WITH_BF_BULLET = True
163 BF_BULLET = '#extern/bullet2/src'
164 BF_BULLET_INC = '${BF_BULLET}'
165 BF_BULLET_LIB = 'extern_bullet'
166
167 WITH_BF_FFTW3 = False
168 BF_FFTW3 = LIBDIR + '/fftw3'
169 BF_FFTW3_INC = '${BF_FFTW3}/include'
170 BF_FFTW3_LIB = 'libfftw3'
171 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
172
173 #WITH_BF_NSPR = True
174 #BF_NSPR = $(LIBDIR)/nspr
175 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
176 #BF_NSPR_LIB = 
177
178 # Uncomment the following line to use Mozilla inplace of netscape
179 #CPPFLAGS += -DMOZ_NOT_NET
180 # Location of MOZILLA/Netscape header files...
181 #BF_MOZILLA = $(LIBDIR)/mozilla
182 #BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
183 #BF_MOZILLA_LIB =
184 # Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
185 # if this is not set.
186 #
187 # Be paranoid regarding library creation (do not update archives)
188 #BF_PARANOID = True
189
190 # enable freetype2 support for text objects
191 BF_FREETYPE = LIBDIR + '/freetype'
192 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
193 BF_FREETYPE_LIB = 'freetype'
194 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
195
196 WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME
197
198 WITH_BF_ICONV = True
199 BF_ICONV = LIBDIR + "/iconv"
200 BF_ICONV_INC = '${BF_ICONV}/include'
201 BF_ICONV_LIB = 'iconv'
202 #BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
203
204 # Mesa Libs should go here if your using them as well....
205 WITH_BF_STATICOPENGL = True
206 BF_OPENGL_LIB = 'GL GLU'
207 BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
208 BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
209
210 CFLAGS = ['-pipe','-fPIC','-funsigned-char']
211
212 CPPFLAGS = ['-fpascal-strings']
213 CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fpascal-strings']
214 CXXFLAGS = [ '-pipe','-fPIC','-funsigned-char', '-fpascal-strings']
215 PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','QuickTime']
216
217 #note to build succesfully on 10.3.9 SDK you need to patch  10.3.9 by adding the SystemStubs.a lib from 10.4
218 LLIBS = ['stdc++', 'SystemStubs']
219
220 # some flags shuffling for different Os versions
221 if MAC_MIN_VERS == '10.3':
222         CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
223         CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
224         PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit']+PLATFORM_LINKFLAGS
225         LLIBS.append('crt3.o')
226         
227 if USE_SDK==True:
228         SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]        
229         PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS, '-Wl,-syslibroot,' + MACOSX_SDK]+PLATFORM_LINKFLAGS
230         CCFLAGS=SDK_FLAGS+CCFLAGS
231         CXXFLAGS=SDK_FLAGS+CXXFLAGS
232         
233 # you can add -mssse3 if gcc >= 4.2
234 if MAC_PROC == 'i386':
235         REL_CFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
236         REL_CCFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
237 else:
238         CFLAGS = CFLAGS+['-fno-strict-aliasing']
239         CCFLAGS =  CCFLAGS+['-fno-strict-aliasing']
240         CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing']
241         
242         REL_CFLAGS = ['-O2']
243         REL_CCFLAGS = ['-O2']
244
245 ##BF_DEPEND = True
246 ##
247 ##AR = ar
248 ##ARFLAGS = ruv
249 ##ARFLAGSQUIET = ru
250 ##
251 CC = 'gcc'
252 CXX = 'g++'
253 C_WARN = ['-Wdeclaration-after-statement']
254
255 CC_WARN = ['-Wall', '-Wno-long-double']
256
257 ##FIX_STUBS_WARNINGS = -Wno-unused
258
259 ##LOPTS = --dynamic
260 ##DYNLDFLAGS = -shared $(LDFLAGS)
261
262 BF_PROFILE_CCFLAGS = ['-pg', '-g ']
263 BF_PROFILE_LINKFLAGS = ['-pg']
264 BF_PROFILE = False
265
266 BF_DEBUG = False
267 BF_DEBUG_CCFLAGS = ['-g']
268
269 BF_BUILDDIR='../build/darwin'
270 BF_INSTALLDIR='../install/darwin'
271 BF_DOCDIR='../install/doc'