OSDN Git Service

libhb: Fix linux compilation. Only set the pthread mutex type on cygwin since it...
[handbrake-jp/handbrake-jp-git.git] / contrib / Jamfile
1 SubDir TOP contrib ;
2
3 # Use curl on Mac OS X since it's always installed, and assume wget
4 # is installed for all other systems
5 if $(OS) = MACOSX
6 {
7     WGET = curl -L -o ;
8 }
9 else
10 {
11     WGET = wget -O ;
12 }
13
14 if $(OS) = UNKNOWN
15 {
16     OS = CYGWIN ;
17 }
18
19 if $(OS) = SOLARIS
20 {
21     PATCH = gpatch ;
22     STRIP = echo ;
23 }
24 else
25 {
26     PATCH = patch ;
27     STRIP = strip -S ;
28 }
29
30 # Wget rule: downloads $(<) from the link in $(>)
31 rule Wget
32 {
33     Depends $(<) : $(>) ;
34 }
35 actions Wget
36 {
37     $(RM) $(<) &&
38     $(WGET) $(<) `cat $(>)` &&
39     ( touch $(<) || true )
40 }
41
42 # liba52
43 rule LibA52
44 {
45     Depends $(<) : $(>) ;
46     Depends lib  : $(<) ;
47 }
48 actions LibA52
49 {
50
51     cd `dirname $(>)` && CONTRIB=`pwd` &&
52     rm -rf a52dec && (gzip -dc a52dec.tar.gz | tar xf -) && 
53     cd a52dec && $(PATCH) -p1 < ../patch-a52dec.patch &&
54     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
55     $(STRIP) $CONTRIB/lib/liba52.a
56 }
57 Wget   $(SUBDIR)/a52dec.tar.gz : $(SUBDIR)/version_a52dec.txt ;
58 LibA52 $(SUBDIR)/lib/liba52.a  : $(SUBDIR)/a52dec.tar.gz ;
59
60 # FAAD2
61 rule LibFaad2
62 {
63     Depends $(<) : $(>) ;
64     Depends lib  : $(<) ;
65 }
66
67 actions LibFaad2
68 {
69     cd `dirname $(>)` && CONTRIB=`pwd` &&
70     rm -rf faad2 && (gzip -dc faad2.tar.gz | tar xf -) &&
71     cd faad2 && $(PATCH) -p1 < ../patch-faad2-libtool22.patch &&
72     ./bootstrap && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared && $(MAKE) && $(MAKE) install
73 }
74 Wget     $(SUBDIR)/faad2.tar.gz    : $(SUBDIR)/version_faad2.txt ;
75 LibFaad2 $(SUBDIR)/lib/libfaad.a : $(SUBDIR)/faad2.tar.gz ;
76
77 # libavcodec
78 rule LibAvCodec
79 {
80     FFMPEG_PATCH = "$(PATCH) -p0 < ../patch-ffmpeg.patch" ;
81     FFMPEG_PATCH += " && $(PATCH) -p0 < ../patch-ffmpeg-latm.patch " ;
82     FFMPEG_PATCH += " && $(PATCH) -p0 < ../patch-ffmpeg-mpegleak.patch " ;
83     if $(OS) = CYGWIN
84     {
85         FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-cygwin.patch " ;
86     }
87     else if $(OS) = SOLARIS
88     {
89         FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-solaris.patch " ;
90     } 
91
92     if $(OS) = SOLARIS
93     {
94        #
95        # Not all of ffmpeg works on Solaris - disable the bits that
96        # don't. When we get new versions of FFMPEG we can try enabling
97        # then again.
98        #
99        FFMPEG_EXTRA_OPTIONS = "--disable-vis --disable-demuxer=mpc8 --disable-vhook" ;
100     }
101
102     Depends $(<) : $(>) ;
103     Depends lib  : $(<) ;
104 }
105 actions LibAvCodec
106 {
107     cd `dirname $(>)` && CONTRIB=`pwd` &&
108     rm -rf ffmpeg && (gzip -dc ffmpeg.tar.gz | tar xf -) &&
109     cd ffmpeg && $(FFMPEG_PATCH) &&
110     ./configure --prefix=$CONTRIB --enable-gpl --enable-pthreads --enable-swscale \
111         --disable-shared --enable-static --disable-encoders \
112         --enable-encoder=mpeg4 --enable-encoder=ac3 --enable-encoder=snow \
113         --enable-libfaad --disable-ffmpeg --disable-ffserver \
114         --disable-muxers --enable-muxer=ipod --disable-bsfs \
115         --extra-cflags="-I$CONTRIB/include" \
116         --extra-ldflags="-L$CONTRIB/lib" $(FFMPEG_EXTRA_OPTIONS) &&
117     $(MAKE) && $(MAKE) install &&
118     $(STRIP) $CONTRIB/lib/libavcodec.a
119 }
120 Wget       $(SUBDIR)/ffmpeg.tar.gz    : $(SUBDIR)/version_ffmpeg.txt ;
121 LibAvCodec $(SUBDIR)/lib/libavcodec.a : $(SUBDIR)/ffmpeg.tar.gz ;
122
123 rule LibAvUtil
124 {
125     Depends $(<) : $(>) ;
126     Depends lib  : $(<) ;
127 }
128 actions LibAvUtil
129 {
130     $(STRIP) $(<)
131 }
132 LibAvUtil $(SUBDIR)/lib/libavutil.a : $(SUBDIR)/lib/libavcodec.a ;
133 LibAvUtil $(SUBDIR)/lib/libavformat.a : $(SUBDIR)/lib/libavcodec.a ;
134 LibAvUtil $(SUBDIR)/lib/libswscale.a : $(SUBDIR)/lib/libavcodec.a ;
135
136 # HandBrake does not include a DVD decrypting library,
137 # so if a user requests it, let them download and compile it from a 3rd party
138 if $(CSS) = 1
139 {
140     # libdvdcss
141     # We need libdvdcss.so for libdvdread's configure to work...
142     rule LibDvdCss
143     {
144         Depends $(<) : $(>) ;
145         Depends lib  : $(<) ;
146     }
147     actions LibDvdCss
148     {
149         cd `dirname $(>)` && CONTRIB=`pwd` &&
150         rm -rf libdvdcss-1.2.9 && (gzip -dc libdvdcss.tar.gz | tar xf - ) && 
151         cd libdvdcss-1.2.9 &&
152         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
153         $(STRIP) $CONTRIB/lib/libdvdcss.a
154     }
155     Wget      $(SUBDIR)/libdvdcss.tar.gz : $(SUBDIR)/version_libdvdcss.txt ;
156     LibDvdCss $(SUBDIR)/lib/libdvdcss.a  : $(SUBDIR)/libdvdcss.tar.gz ;
157 }
158
159 # libdca
160 rule LibDCA
161 {
162     Depends $(<) : $(>) ;
163     Depends lib  : $(<) ;
164 }
165 actions LibDCA
166 {
167     cd `dirname $(>)` && CONTRIB=`pwd` &&
168     rm -rf libdca && (gzip -dc libdca.tar.gz | tar xf - ) && 
169     cd libdca && $(PATCH) -p1 < ../patch-libdca.patch &&
170     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
171     $(STRIP) $CONTRIB/lib/libdca.a
172 }
173 Wget   $(SUBDIR)/libdca.tar.gz : $(SUBDIR)/version_libdca.txt ;
174 LibDCA $(SUBDIR)/lib/libdca.a  : $(SUBDIR)/libdca.tar.gz ;
175
176 # libdvdread
177 rule LibDvdRead
178 {
179     Depends $(<) : $(>) ;
180     Depends lib  : $(<) ;
181     
182     if $(OS) = MACOSX
183     {
184         DVDREAD_PATCH = "$(PATCH) -p0 < ../patch-libdvdread-css-vlc-dylib.patch &&" ;
185     }
186         
187     if $(OS) = CYGWIN
188     {
189         DVDREAD_PATCH = "$(PATCH) -p1 < ../patch-libdvdread-cygwin.patch &&" ;
190     }
191     
192 }
193 if $(CSS) = 1 # Include CSS support in libdvdread if requested
194 {
195     actions LibDvdRead
196     {
197         cd `dirname $(>)` && CONTRIB=`pwd` &&
198         rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) && 
199         cd libdvdread &&
200         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --with-libdvdcss=$CONTRIB &&
201         $(MAKE) && $(MAKE) install &&
202         $(STRIP) $CONTRIB/lib/libdvdread.a
203     }
204 }
205 else {
206     # Cygwin/Windows doesn't use CSS as of now, so don't include it on the
207     # configure line.
208     # MacOSX uses a dylib for CSS, so it doesn't need including there either.
209     actions LibDvdRead
210     {
211         cd `dirname $(>)` && CONTRIB=`pwd` &&
212         rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) &&
213         cd libdvdread && $(DVDREAD_PATCH)
214         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
215         $(MAKE) && $(MAKE) install &&
216         $(STRIP) $CONTRIB/lib/libdvdread.a
217     }
218 }
219 Wget       $(SUBDIR)/libdvdread.tar.gz : $(SUBDIR)/version_libdvdread.txt ;
220 LibDvdRead $(SUBDIR)/lib/libdvdread.a  : $(SUBDIR)/libdvdread.tar.gz ;
221
222 # libfaac
223 rule LibFaac
224 {
225     Depends $(<) : $(>) ;
226     Depends lib  : $(<) ;
227         if $(OS) = CYGWIN
228     {
229         CYGWIN_PATCH = "$(PATCH) -p1 < ../patch-faac-cygwin.patch &&" ;
230     }
231 }
232 actions LibFaac
233 {
234     cd `dirname $(>)` && CONTRIB=`pwd` &&
235     rm -rf faac && (gzip -dc faac.tar.gz | tar xf - ) && cd faac && $(CYGWIN_PATCH) ./bootstrap &&
236     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --enable-static --without-mp4v2 &&
237     $(MAKE) && $(MAKE) install &&
238     $(STRIP) $CONTRIB/lib/libfaac.a
239 }
240 Wget    $(SUBDIR)/faac.tar.gz   : $(SUBDIR)/version_faac.txt ;
241 LibFaac $(SUBDIR)/lib/libfaac.a : $(SUBDIR)/faac.tar.gz ;
242
243 # libmp3lame
244 rule LibMp3Lame
245 {
246     Depends $(<) : $(>) ;
247     Depends lib  : $(<) ;
248 }
249 actions LibMp3Lame
250 {
251     cd `dirname $(>)` && CONTRIB=`pwd` &&
252     rm -rf lame && (gzip -dc lame.tar.gz | tar xf - ) && cd lame &&
253     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
254     $(MAKE) && $(MAKE) install &&
255     $(STRIP) $CONTRIB/lib/libmp3lame.a
256 }
257 Wget       $(SUBDIR)/lame.tar.gz      : $(SUBDIR)/version_lame.txt ;
258 LibMp3Lame $(SUBDIR)/lib/libmp3lame.a : $(SUBDIR)/lame.tar.gz ;
259
260 # libmp4v2
261 rule LibMp4v2
262 {
263     LIBMP4V2_PATCH = "" ;
264     if $(OS) = CYGWIN
265     {
266         LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch_mpeg4ip_cygwin.patch && " ;
267     }
268     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip.patch && " ;
269     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-nasm-2.00-configure.patch && " ;
270     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-ac3.patch && " ;
271     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-colr.patch && " ;
272     Depends $(<) : $(>) ;
273     Depends lib  : $(<) ;
274 }
275 actions LibMp4v2
276 {
277     cd `dirname $(>)` && CONTRIB=`pwd` &&
278     rm -rf mpeg4ip && (gzip -dc mpeg4ip.tar.gz | tar xf - ) &&
279     cd mpeg4ip && $(LIBMP4V2_PATCH)
280     ./bootstrap --cache-file=$CONTRIB/config.cache --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
281     $(MAKE) -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
282     cp mpeg4ip_config.h include/mpeg4ip.h include/mpeg4ip_version.h \
283         include/mpeg4ip_win32.h lib/mp4v2/*.h $CONTRIB/include &&
284     $(STRIP) $CONTRIB/lib/libmp4v2.a
285 }
286 Wget     $(SUBDIR)/mpeg4ip.tar.gz : $(SUBDIR)/version_mpeg4ip.txt ;
287 LibMp4v2 $(SUBDIR)/lib/libmp4v2.a : $(SUBDIR)/mpeg4ip.tar.gz ;
288
289 rule LibMkv
290 {
291     Depends $(<) : $(>) ;
292     Depends lib  : $(<) ;
293 }
294 actions LibMkv
295 {
296     cd `dirname $(>)` && CONTRIB=`pwd` &&
297     rm -rf libmkv && (gzip -dc libmkv.tar.gz | tar xf - ) && 
298     cd libmkv &&
299     ./configure --disable-shared --enable-static --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache &&
300     $(MAKE) && $(MAKE) install &&
301     $(STRIP) $CONTRIB/lib/libmkv.a
302 }
303 Wget    $(SUBDIR)/libmkv.tar.gz : $(SUBDIR)/version_libmkv.txt ;
304 LibMkv  $(SUBDIR)/lib/libmkv.a  : $(SUBDIR)/libmkv.tar.gz ;
305
306 # libmpeg2
307 rule LibMpeg2
308 {
309     Depends $(<) : $(>) ;
310     Depends lib  : $(<) ;
311 }
312 actions LibMpeg2
313 {
314     cd `dirname $(>)` && CONTRIB=`pwd` &&
315     rm -rf mpeg2dec && (gzip -dc mpeg2dec.tar.gz | tar xf - ) && 
316     cd mpeg2dec &&
317     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --disable-sdl --without-x &&
318     $(MAKE) && $(MAKE) install &&
319     $(STRIP) $CONTRIB/lib/libmpeg2.a
320 }
321 Wget     $(SUBDIR)/mpeg2dec.tar.gz : $(SUBDIR)/version_mpeg2dec.txt ;
322 LibMpeg2 $(SUBDIR)/lib/libmpeg2.a  : $(SUBDIR)/mpeg2dec.tar.gz ;
323
324 # libogg
325 rule LibOgg
326 {
327     Depends $(<) : $(>) ;
328     Depends lib  : $(<) ;
329 }
330 actions LibOgg
331 {
332     cd `dirname $(>)` && CONTRIB=`pwd` &&
333     rm -rf libogg && (gzip -dc libogg.tar.gz | tar xf - ) && 
334     cd libogg &&
335     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
336     $(MAKE) && $(MAKE) install &&
337     $(STRIP) $CONTRIB/lib/libogg.a
338 }
339 Wget   $(SUBDIR)/libogg.tar.gz : $(SUBDIR)/version_libogg.txt ;
340 LibOgg $(SUBDIR)/lib/libogg.a  : $(SUBDIR)/libogg.tar.gz ;
341
342 # libsamplerate
343 rule LibSampleRate
344 {
345     Depends $(<) : $(>) ;
346     Depends lib  : $(<) ;
347 }
348 actions LibSampleRate
349 {
350     cd `dirname $(>)` && CONTRIB=`pwd` &&
351     rm -rf libsamplerate && (gzip -dc libsamplerate.tar.gz | tar xf - ) && 
352     cd libsamplerate &&
353     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
354     $(MAKE) && $(MAKE) install &&
355     $(STRIP) $CONTRIB/lib/libsamplerate.a
356 }
357 Wget          $(SUBDIR)/libsamplerate.tar.gz : $(SUBDIR)/version_libsamplerate.txt ;
358 LibSampleRate $(SUBDIR)/lib/libsamplerate.a  : $(SUBDIR)/libsamplerate.tar.gz ;
359
360 # libvorbis
361 rule LibVorbis
362 {
363     Depends $(<) : $(>) ;
364     Depends lib  : $(<) ;
365 }
366 actions LibVorbis
367 {
368     cd `dirname $(>)` && CONTRIB=`pwd` &&
369     rm -rf libvorbis && (gzip -dc libvorbis.tar.gz | tar xf - ) &&
370     cd libvorbis &&
371     ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
372     $(MAKE) && $(MAKE) install &&
373     $(STRIP) $CONTRIB/lib/libvorbis.a
374 }
375 Wget      $(SUBDIR)/libvorbis.tar.gz : $(SUBDIR)/version_libvorbis.txt ;
376 LibVorbis $(SUBDIR)/lib/libvorbis.a  : $(SUBDIR)/libvorbis.tar.gz ;
377
378 rule LibVorbisEnc
379 {
380     Depends $(<) : $(>) ;
381     Depends lib  : $(<) ;
382 }
383 actions LibVorbisEnc
384 {
385     $(STRIP) $(<)
386 }
387 LibVorbisEnc $(SUBDIR)/lib/libvorbisenc.a : $(SUBDIR)/lib/libvorbis.a ;
388
389 # libtheora
390 rule LibTheora
391 {
392     Depends $(<) : $(>) ;
393     Depends lib  : $(<) ;
394 }
395 actions LibTheora
396 {
397     cd `dirname $(>)` && CONTRIB=`pwd` && rm -rf libtheora &&
398     (gzip -dc libtheora.tar.gz | tar xf - ) && cd libtheora &&
399     HAVE_PKG_CONFIG="no" && export HAVE_PKG_CONFIG &&
400     ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --with-vorbis=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared \
401             --disable-oggtest --disable-vorbistest --disable-sdltest --disable-examples &&
402     $(MAKE) && $(MAKE) install &&
403     $(STRIP) $CONTRIB/lib/libtheora.a
404 }
405 Wget      $(SUBDIR)/libtheora.tar.gz : $(SUBDIR)/version_libtheora.txt ;
406 LibTheora $(SUBDIR)/lib/libtheora.a  : $(SUBDIR)/libtheora.tar.gz ;
407
408 # libx264
409 rule LibX264
410 {
411     LIBX264_PATCH = "" ;
412     if $(OS) = CYGWIN
413     {
414         LIBX264_PATCH += "$(PATCH) -p1 < ../patch-x264-cygwin.patch && " ;
415     }
416     else if $(OS) = SOLARIS
417     {
418         LIBX264_PATCH += " $(PATCH) -p1 < ../patch-x264-solaris.patch && " ;
419     }
420     LIBX264_PATCH += "$(PATCH) -p0 < ../patch-x264-idr.patch && " ;
421         Depends $(<) : $(>) ;
422     Depends lib  : $(<) ;
423 }
424 actions LibX264
425 {
426     cd `dirname $(>)` && CONTRIB=`pwd` &&
427     rm -rf x264 && (gzip -dc x264.tar.gz | tar xf - ) && 
428     cd x264 && $(LIBX264_PATCH)
429     bash ./configure --prefix=$CONTRIB --enable-pthread &&
430     $(MAKE) libx264.a && cp libx264.a $CONTRIB/lib/ && cp x264.h $CONTRIB/include/ && $(STRIP) $CONTRIB/lib/libx264.a
431 }
432 Wget    $(SUBDIR)/x264.tar.gz   : $(SUBDIR)/version_x264.txt ;
433 LibX264 $(SUBDIR)/lib/libx264.a : $(SUBDIR)/x264.tar.gz ;
434
435 # libxvidcore
436 rule LibXvidCore
437 {
438     LIBXVIDCORE_PATCH = "" ;
439     if $(OS) = MACOSX
440     {
441         LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-macosx.patch && " ;
442     }
443     else if $(OS) = CYGWIN
444     {
445         LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-cygwin.patch && " ;
446     }
447     LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-nasm-2.00-configure.patch && " ;
448     LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-fdct.patch && " ;
449     Depends $(<) : $(>) ;
450     Depends lib  : $(<) ;
451 }
452 actions LibXvidCore
453 {
454     cd `dirname $(>)` && CONTRIB=`pwd` &&
455     rm -rf xvidcore && (gzip -dc xvidcore.tar.gz | tar xf - ) &&
456     cd xvidcore && $(LIBXVIDCORE_PATCH)
457     cd build/generic/ && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) libxvidcore.a &&
458     cp ./=build/libxvidcore.a $CONTRIB/lib/ &&
459     cp ../../src/xvid.h $CONTRIB/include/ &&
460     $(STRIP) $CONTRIB/lib/libxvidcore.a
461 }
462 Wget        $(SUBDIR)/xvidcore.tar.gz   : $(SUBDIR)/version_xvidcore.txt ;
463 LibXvidCore $(SUBDIR)/lib/libxvidcore.a : $(SUBDIR)/xvidcore.tar.gz ;
464
465 # zlib
466 if $(OS) = CYGWIN
467 {
468     rule Zlib
469     {
470         Depends $(<) : $(>) ;
471         Depends lib  : $(<) ;
472     }
473     actions Zlib
474     {
475         cd `dirname $(>)` && CONTRIB=`pwd` &&
476         rm -rf zlib && (gzip -dc zlib.tar.gz | tar xf - ) &&
477         cd zlib && ./configure --prefix=$CONTRIB &&
478         $(MAKE) && $(MAKE) install && touch $CONTRIB/.contrib &&
479         $(STRIP) $CONTRIB/lib/libz.a
480     }
481     Wget  $(SUBDIR)/zlib.tar.gz : $(SUBDIR)/version_zlib.txt ;
482     Zlib  $(SUBDIR)/lib/libz.a  : $(SUBDIR)/zlib.tar.gz ;
483 }
484
485 # bzip2
486 if $(OS) = CYGWIN
487 {
488     rule BZip2
489     {
490         Depends $(<) : $(>) ;
491         Depends lib  : $(<) ;
492     }
493     actions BZip2
494     {
495         cd `dirname $(>)` && CONTRIB=`pwd` &&
496         rm -rf bzip2 && (gzip -dc bzip2.tar.gz | tar xf - ) &&
497         cd bzip2 && $(MAKE) && $(MAKE) install && cp libbz2.a $CONTRIB/lib/ &&
498         $(STRIP) $CONTRIB/lib/libbz2.a
499     }
500     Wget  $(SUBDIR)/bzip2.tar.gz : $(SUBDIR)/version_bzip2.txt ;
501     BZip2  $(SUBDIR)/lib/libbz2.a  : $(SUBDIR)/bzip2.tar.gz ;
502 }