OSDN Git Service

Don't allow theora to use pkg-config and use system versions of ogg and vorbis
[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 }
188 if $(CSS) = 1 # Include CSS support in libdvdread if requested
189 {
190     actions LibDvdRead
191     {
192         cd `dirname $(>)` && CONTRIB=`pwd` &&
193         rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) && 
194         cd libdvdread &&
195         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --with-libdvdcss=$CONTRIB &&
196         $(MAKE) && $(MAKE) install &&
197         $(STRIP) $CONTRIB/lib/libdvdread.a
198     }
199 }
200 else {
201     # Cygwin/Windows doesn't use CSS as of now, so don't include it on the
202     # configure line.
203     # MacOSX uses a dylib for CSS, so it doesn't need including there either.
204     actions LibDvdRead
205     {
206         cd `dirname $(>)` && CONTRIB=`pwd` &&
207         rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) &&
208         cd libdvdread && $(DVDREAD_PATCH)
209         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
210         $(MAKE) && $(MAKE) install &&
211         $(STRIP) $CONTRIB/lib/libdvdread.a
212     }
213 }
214 Wget       $(SUBDIR)/libdvdread.tar.gz : $(SUBDIR)/version_libdvdread.txt ;
215 LibDvdRead $(SUBDIR)/lib/libdvdread.a  : $(SUBDIR)/libdvdread.tar.gz ;
216
217 # libfaac
218 rule LibFaac
219 {
220     Depends $(<) : $(>) ;
221     Depends lib  : $(<) ;
222         if $(OS) = CYGWIN
223     {
224         CYGWIN_PATCH = "$(PATCH) -p1 < ../patch-faac-cygwin.patch &&" ;
225     }
226 }
227 actions LibFaac
228 {
229     cd `dirname $(>)` && CONTRIB=`pwd` &&
230     rm -rf faac && (gzip -dc faac.tar.gz | tar xf - ) && cd faac && $(CYGWIN_PATCH) ./bootstrap &&
231     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --enable-static --without-mp4v2 &&
232     $(MAKE) && $(MAKE) install &&
233     $(STRIP) $CONTRIB/lib/libfaac.a
234 }
235 Wget    $(SUBDIR)/faac.tar.gz   : $(SUBDIR)/version_faac.txt ;
236 LibFaac $(SUBDIR)/lib/libfaac.a : $(SUBDIR)/faac.tar.gz ;
237
238 # libmp3lame
239 rule LibMp3Lame
240 {
241     Depends $(<) : $(>) ;
242     Depends lib  : $(<) ;
243 }
244 actions LibMp3Lame
245 {
246     cd `dirname $(>)` && CONTRIB=`pwd` &&
247     rm -rf lame && (gzip -dc lame.tar.gz | tar xf - ) && cd lame &&
248     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
249     $(MAKE) && $(MAKE) install &&
250     $(STRIP) $CONTRIB/lib/libmp3lame.a
251 }
252 Wget       $(SUBDIR)/lame.tar.gz      : $(SUBDIR)/version_lame.txt ;
253 LibMp3Lame $(SUBDIR)/lib/libmp3lame.a : $(SUBDIR)/lame.tar.gz ;
254
255 # libmp4v2
256 rule LibMp4v2
257 {
258     LIBMP4V2_PATCH = "" ;
259     if $(OS) = CYGWIN
260     {
261         LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch_mpeg4ip_cygwin.patch && " ;
262     }
263     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip.patch && " ;
264     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-nasm-2.00-configure.patch && " ;
265     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-ac3.patch && " ;
266     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-colr.patch && " ;
267     Depends $(<) : $(>) ;
268     Depends lib  : $(<) ;
269 }
270 actions LibMp4v2
271 {
272     cd `dirname $(>)` && CONTRIB=`pwd` &&
273     rm -rf mpeg4ip && (gzip -dc mpeg4ip.tar.gz | tar xf - ) &&
274     cd mpeg4ip && $(LIBMP4V2_PATCH)
275     ./bootstrap --cache-file=$CONTRIB/config.cache --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
276     $(MAKE) -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
277     cp mpeg4ip_config.h include/mpeg4ip.h include/mpeg4ip_version.h \
278         include/mpeg4ip_win32.h lib/mp4v2/*.h $CONTRIB/include &&
279     $(STRIP) $CONTRIB/lib/libmp4v2.a
280 }
281 Wget     $(SUBDIR)/mpeg4ip.tar.gz : $(SUBDIR)/version_mpeg4ip.txt ;
282 LibMp4v2 $(SUBDIR)/lib/libmp4v2.a : $(SUBDIR)/mpeg4ip.tar.gz ;
283
284 rule LibMkv
285 {
286     Depends $(<) : $(>) ;
287     Depends lib  : $(<) ;
288 }
289 actions LibMkv
290 {
291     cd `dirname $(>)` && CONTRIB=`pwd` &&
292     rm -rf libmkv && (gzip -dc libmkv.tar.gz | tar xf - ) && 
293     cd libmkv &&
294     ./configure --disable-shared --enable-static --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache &&
295     $(MAKE) && $(MAKE) install &&
296     $(STRIP) $CONTRIB/lib/libmkv.a
297 }
298 Wget    $(SUBDIR)/libmkv.tar.gz : $(SUBDIR)/version_libmkv.txt ;
299 LibMkv  $(SUBDIR)/lib/libmkv.a  : $(SUBDIR)/libmkv.tar.gz ;
300
301 # libmpeg2
302 rule LibMpeg2
303 {
304     Depends $(<) : $(>) ;
305     Depends lib  : $(<) ;
306 }
307 actions LibMpeg2
308 {
309     cd `dirname $(>)` && CONTRIB=`pwd` &&
310     rm -rf mpeg2dec && (gzip -dc mpeg2dec.tar.gz | tar xf - ) && 
311     cd mpeg2dec &&
312     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --disable-sdl --without-x &&
313     $(MAKE) && $(MAKE) install &&
314     $(STRIP) $CONTRIB/lib/libmpeg2.a
315 }
316 Wget     $(SUBDIR)/mpeg2dec.tar.gz : $(SUBDIR)/version_mpeg2dec.txt ;
317 LibMpeg2 $(SUBDIR)/lib/libmpeg2.a  : $(SUBDIR)/mpeg2dec.tar.gz ;
318
319 # libogg
320 rule LibOgg
321 {
322     Depends $(<) : $(>) ;
323     Depends lib  : $(<) ;
324 }
325 actions LibOgg
326 {
327     cd `dirname $(>)` && CONTRIB=`pwd` &&
328     rm -rf libogg && (gzip -dc libogg.tar.gz | tar xf - ) && 
329     cd libogg &&
330     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
331     $(MAKE) && $(MAKE) install &&
332     $(STRIP) $CONTRIB/lib/libogg.a
333 }
334 Wget   $(SUBDIR)/libogg.tar.gz : $(SUBDIR)/version_libogg.txt ;
335 LibOgg $(SUBDIR)/lib/libogg.a  : $(SUBDIR)/libogg.tar.gz ;
336
337 # libsamplerate
338 rule LibSampleRate
339 {
340     Depends $(<) : $(>) ;
341     Depends lib  : $(<) ;
342 }
343 actions LibSampleRate
344 {
345     cd `dirname $(>)` && CONTRIB=`pwd` &&
346     rm -rf libsamplerate && (gzip -dc libsamplerate.tar.gz | tar xf - ) && 
347     cd libsamplerate &&
348     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
349     $(MAKE) && $(MAKE) install &&
350     $(STRIP) $CONTRIB/lib/libsamplerate.a
351 }
352 Wget          $(SUBDIR)/libsamplerate.tar.gz : $(SUBDIR)/version_libsamplerate.txt ;
353 LibSampleRate $(SUBDIR)/lib/libsamplerate.a  : $(SUBDIR)/libsamplerate.tar.gz ;
354
355 # libvorbis
356 rule LibVorbis
357 {
358     Depends $(<) : $(>) ;
359     Depends lib  : $(<) ;
360 }
361 actions LibVorbis
362 {
363     cd `dirname $(>)` && CONTRIB=`pwd` &&
364     rm -rf libvorbis && (gzip -dc libvorbis.tar.gz | tar xf - ) &&
365     cd libvorbis &&
366     ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
367     $(MAKE) && $(MAKE) install &&
368     $(STRIP) $CONTRIB/lib/libvorbis.a
369 }
370 Wget      $(SUBDIR)/libvorbis.tar.gz : $(SUBDIR)/version_libvorbis.txt ;
371 LibVorbis $(SUBDIR)/lib/libvorbis.a  : $(SUBDIR)/libvorbis.tar.gz ;
372
373 rule LibVorbisEnc
374 {
375     Depends $(<) : $(>) ;
376     Depends lib  : $(<) ;
377 }
378 actions LibVorbisEnc
379 {
380     $(STRIP) $(<)
381 }
382 LibVorbisEnc $(SUBDIR)/lib/libvorbisenc.a : $(SUBDIR)/lib/libvorbis.a ;
383
384 # libtheora
385 rule LibTheora
386 {
387     Depends $(<) : $(>) ;
388     Depends lib  : $(<) ;
389 }
390 actions LibTheora
391 {
392     cd `dirname $(>)` && CONTRIB=`pwd` && rm -rf libtheora &&
393     (gzip -dc libtheora.tar.gz | tar xf - ) && cd libtheora &&
394     export HAVE_PKG_CONFIG="no" &&
395     ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --with-vorbis=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared \
396             --disable-oggtest --disable-vorbistest --disable-sdltest --disable-examples &&
397     $(MAKE) && $(MAKE) install &&
398     $(STRIP) $CONTRIB/lib/libtheora.a
399 }
400 Wget      $(SUBDIR)/libtheora.tar.gz : $(SUBDIR)/version_libtheora.txt ;
401 LibTheora $(SUBDIR)/lib/libtheora.a  : $(SUBDIR)/libtheora.tar.gz ;
402
403 # libx264
404 rule LibX264
405 {
406     LIBX264_PATCH = "" ;
407     if $(OS) = CYGWIN
408     {
409         LIBX264_PATCH += "$(PATCH) -p1 < ../patch-x264-cygwin.patch && " ;
410     }
411     else if $(OS) = SOLARIS
412     {
413         LIBX264_PATCH += " $(PATCH) -p1 < ../patch-x264-solaris.patch && " ;
414     }
415     LIBX264_PATCH += "$(PATCH) -p0 < ../patch-x264-idr.patch && " ;
416         Depends $(<) : $(>) ;
417     Depends lib  : $(<) ;
418 }
419 actions LibX264
420 {
421     cd `dirname $(>)` && CONTRIB=`pwd` &&
422     rm -rf x264 && (gzip -dc x264.tar.gz | tar xf - ) && 
423     cd x264 && $(LIBX264_PATCH)
424     bash ./configure --prefix=$CONTRIB --enable-pthread &&
425     $(MAKE) libx264.a && cp libx264.a $CONTRIB/lib/ && cp x264.h $CONTRIB/include/ && $(STRIP) $CONTRIB/lib/libx264.a
426 }
427 Wget    $(SUBDIR)/x264.tar.gz   : $(SUBDIR)/version_x264.txt ;
428 LibX264 $(SUBDIR)/lib/libx264.a : $(SUBDIR)/x264.tar.gz ;
429
430 # libxvidcore
431 rule LibXvidCore
432 {
433     LIBXVIDCORE_PATCH = "" ;
434     if $(OS) = MACOSX
435     {
436         LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-macosx.patch && " ;
437     }
438     else if $(OS) = CYGWIN
439     {
440         LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-cygwin.patch && " ;
441     }
442     LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-nasm-2.00-configure.patch && " ;
443     LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-fdct.patch && " ;
444     Depends $(<) : $(>) ;
445     Depends lib  : $(<) ;
446 }
447 actions LibXvidCore
448 {
449     cd `dirname $(>)` && CONTRIB=`pwd` &&
450     rm -rf xvidcore && (gzip -dc xvidcore.tar.gz | tar xf - ) &&
451     cd xvidcore && $(LIBXVIDCORE_PATCH)
452     cd build/generic/ && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) libxvidcore.a &&
453     cp ./=build/libxvidcore.a $CONTRIB/lib/ &&
454     cp ../../src/xvid.h $CONTRIB/include/ &&
455     $(STRIP) $CONTRIB/lib/libxvidcore.a
456 }
457 Wget        $(SUBDIR)/xvidcore.tar.gz   : $(SUBDIR)/version_xvidcore.txt ;
458 LibXvidCore $(SUBDIR)/lib/libxvidcore.a : $(SUBDIR)/xvidcore.tar.gz ;
459
460 # zlib
461 if $(OS) = CYGWIN
462 {
463     rule Zlib
464     {
465         Depends $(<) : $(>) ;
466         Depends lib  : $(<) ;
467     }
468     actions Zlib
469     {
470         cd `dirname $(>)` && CONTRIB=`pwd` &&
471         rm -rf zlib && (gzip -dc zlib.tar.gz | tar xf - ) &&
472         cd zlib && ./configure --prefix=$CONTRIB &&
473         $(MAKE) && $(MAKE) install && touch $CONTRIB/.contrib &&
474         $(STRIP) $CONTRIB/lib/libz.a
475     }
476     Wget  $(SUBDIR)/zlib.tar.gz : $(SUBDIR)/version_zlib.txt ;
477     Zlib  $(SUBDIR)/lib/libz.a  : $(SUBDIR)/zlib.tar.gz ;
478 }