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