OSDN Git Service

9e226769acb2ff1069a2126abea5a49b11038beb
[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     if $(OS) = CYGWIN
82     {
83         FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-cygwin.patch " ;
84     }
85     else if $(OS) = SOLARIS
86     {
87         FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-solaris.patch " ;
88     } 
89
90     if $(OS) = SOLARIS
91     {
92        #
93        # Not all of ffmpeg works on Solaris - disable the bits that
94        # don't. When we get new versions of FFMPEG we can try enabling
95        # then again.
96        #
97        FFMPEG_EXTRA_OPTIONS = "--disable-vis --disable-demuxer=mpc8 --disable-vhook" ;
98     }
99
100     Depends $(<) : $(>) ;
101     Depends lib  : $(<) ;
102 }
103 actions LibAvCodec
104 {
105     cd `dirname $(>)` && CONTRIB=`pwd` &&
106     rm -rf ffmpeg && (gzip -dc ffmpeg.tar.gz | tar xf -) &&
107     cd ffmpeg && $(FFMPEG_PATCH) &&
108     ./configure --prefix=$CONTRIB --enable-gpl --enable-pthreads --enable-swscale \
109         --disable-shared --enable-static --disable-encoders \
110         --enable-encoder=mpeg4 --enable-encoder=ac3 --enable-encoder=snow \
111         --enable-libfaad --disable-ffmpeg --disable-ffserver \
112         --disable-muxers --enable-muxer=ipod --disable-bsfs \
113         --extra-cflags="-I$CONTRIB/include" \
114         --extra-ldflags="-L$CONTRIB/lib" $(FFMPEG_EXTRA_OPTIONS) &&
115     $(MAKE) && $(MAKE) install &&
116     $(STRIP) $CONTRIB/lib/libavcodec.a
117 }
118 Wget       $(SUBDIR)/ffmpeg.tar.gz    : $(SUBDIR)/version_ffmpeg.txt ;
119 LibAvCodec $(SUBDIR)/lib/libavcodec.a : $(SUBDIR)/ffmpeg.tar.gz ;
120
121 rule LibAvUtil
122 {
123     Depends $(<) : $(>) ;
124     Depends lib  : $(<) ;
125 }
126 actions LibAvUtil
127 {
128     $(STRIP) $(<)
129 }
130 LibAvUtil $(SUBDIR)/lib/libavutil.a : $(SUBDIR)/lib/libavcodec.a ;
131 LibAvUtil $(SUBDIR)/lib/libavformat.a : $(SUBDIR)/lib/libavcodec.a ;
132 LibAvUtil $(SUBDIR)/lib/libswscale.a : $(SUBDIR)/lib/libavcodec.a ;
133
134 # HandBrake does not include a DVD decrypting library,
135 # so if a user requests it, let them download and compile it from a 3rd party
136 if $(CSS) = 1
137 {
138     # libdvdcss
139     # We need libdvdcss.so for libdvdread's configure to work...
140     rule LibDvdCss
141     {
142         Depends $(<) : $(>) ;
143         Depends lib  : $(<) ;
144     }
145     actions LibDvdCss
146     {
147         cd `dirname $(>)` && CONTRIB=`pwd` &&
148         rm -rf libdvdcss-1.2.9 && (gzip -dc libdvdcss.tar.gz | tar xf - ) && 
149         cd libdvdcss-1.2.9 &&
150         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
151         $(STRIP) $CONTRIB/lib/libdvdcss.a
152     }
153     Wget      $(SUBDIR)/libdvdcss.tar.gz : $(SUBDIR)/version_libdvdcss.txt ;
154     LibDvdCss $(SUBDIR)/lib/libdvdcss.a  : $(SUBDIR)/libdvdcss.tar.gz ;
155 }
156
157 # libdca
158 rule LibDCA
159 {
160     Depends $(<) : $(>) ;
161     Depends lib  : $(<) ;
162 }
163 actions LibDCA
164 {
165     cd `dirname $(>)` && CONTRIB=`pwd` &&
166     rm -rf libdca && (gzip -dc libdca.tar.gz | tar xf - ) && 
167     cd libdca && $(PATCH) -p1 < ../patch-libdca.patch &&
168     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
169     $(STRIP) $CONTRIB/lib/libdca.a
170 }
171 Wget   $(SUBDIR)/libdca.tar.gz : $(SUBDIR)/version_libdca.txt ;
172 LibDCA $(SUBDIR)/lib/libdca.a  : $(SUBDIR)/libdca.tar.gz ;
173
174 # libdvdread
175 rule LibDvdRead
176 {
177     Depends $(<) : $(>) ;
178     Depends lib  : $(<) ;
179     
180     if $(OS) = MACOSX
181     {
182         DVDREAD_PATCH = "$(PATCH) -p0 < ../patch-libdvdread-css-vlc-dylib.patch &&" ;
183     }
184     
185 }
186 if $(CSS) = 1 # Include CSS support in libdvdread if requested
187 {
188     actions LibDvdRead
189     {
190         cd `dirname $(>)` && CONTRIB=`pwd` &&
191         rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) && 
192         cd libdvdread &&
193         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --with-libdvdcss=$CONTRIB &&
194         $(MAKE) && $(MAKE) install &&
195         $(STRIP) $CONTRIB/lib/libdvdread.a
196     }
197 }
198 else {
199     # Cygwin/Windows doesn't use CSS as of now, so don't include it on the
200     # configure line.
201     # MacOSX uses a dylib for CSS, so it doesn't need including there either.
202     actions LibDvdRead
203     {
204         cd `dirname $(>)` && CONTRIB=`pwd` &&
205         rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) &&
206         cd libdvdread && $(DVDREAD_PATCH)
207         ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
208         $(MAKE) && $(MAKE) install &&
209         $(STRIP) $CONTRIB/lib/libdvdread.a
210     }
211 }
212 Wget       $(SUBDIR)/libdvdread.tar.gz : $(SUBDIR)/version_libdvdread.txt ;
213 LibDvdRead $(SUBDIR)/lib/libdvdread.a  : $(SUBDIR)/libdvdread.tar.gz ;
214
215 # libfaac
216 rule LibFaac
217 {
218     Depends $(<) : $(>) ;
219     Depends lib  : $(<) ;
220 }
221 actions LibFaac
222 {
223     cd `dirname $(>)` && CONTRIB=`pwd` &&
224     rm -rf faac && (gzip -dc faac.tar.gz | tar xf - ) && cd faac &&
225     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --enable-static &&
226     $(MAKE) && $(MAKE) install &&
227     $(STRIP) $CONTRIB/lib/libfaac.a
228 }
229 Wget    $(SUBDIR)/faac.tar.gz   : $(SUBDIR)/version_faac.txt ;
230 LibFaac $(SUBDIR)/lib/libfaac.a : $(SUBDIR)/faac.tar.gz ;
231
232 # libmp3lame
233 rule LibMp3Lame
234 {
235     Depends $(<) : $(>) ;
236     Depends lib  : $(<) ;
237 }
238 actions LibMp3Lame
239 {
240     cd `dirname $(>)` && CONTRIB=`pwd` &&
241     rm -rf lame && (gzip -dc lame.tar.gz | tar xf - ) && cd lame &&
242     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
243     $(MAKE) && $(MAKE) install &&
244     $(STRIP) $CONTRIB/lib/libmp3lame.a
245 }
246 Wget       $(SUBDIR)/lame.tar.gz      : $(SUBDIR)/version_lame.txt ;
247 LibMp3Lame $(SUBDIR)/lib/libmp3lame.a : $(SUBDIR)/lame.tar.gz ;
248
249 # libmp4v2
250 rule LibMp4v2
251 {
252     LIBMP4V2_PATCH = "" ;
253     if $(OS) = CYGWIN
254     {
255         LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch_mpeg4ip_cygwin.patch && " ;
256     }
257     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip.patch && " ;
258     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-nasm-2.00-configure.patch && " ;
259     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-ac3.patch && " ;
260     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-colr.patch && " ;
261     Depends $(<) : $(>) ;
262     Depends lib  : $(<) ;
263 }
264 actions LibMp4v2
265 {
266     cd `dirname $(>)` && CONTRIB=`pwd` &&
267     rm -rf mpeg4ip && (gzip -dc mpeg4ip.tar.gz | tar xf - ) &&
268     cd mpeg4ip && $(LIBMP4V2_PATCH)
269     ./bootstrap --cache-file=$CONTRIB/config.cache --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
270     $(MAKE) -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
271     cp mpeg4ip_config.h include/mpeg4ip.h include/mpeg4ip_version.h \
272         include/mpeg4ip_win32.h lib/mp4v2/*.h $CONTRIB/include &&
273     $(STRIP) $CONTRIB/lib/libmp4v2.a
274 }
275 Wget     $(SUBDIR)/mpeg4ip.tar.gz : $(SUBDIR)/version_mpeg4ip.txt ;
276 LibMp4v2 $(SUBDIR)/lib/libmp4v2.a : $(SUBDIR)/mpeg4ip.tar.gz ;
277
278 rule LibMkv
279 {
280     Depends $(<) : $(>) ;
281     Depends lib  : $(<) ;
282 }
283 actions LibMkv
284 {
285     cd `dirname $(>)` && CONTRIB=`pwd` &&
286     rm -rf libmkv && (gzip -dc libmkv.tar.gz | tar xf - ) && 
287     cd libmkv &&
288     ./configure --disable-shared --enable-static --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache &&
289     $(MAKE) && $(MAKE) install &&
290     $(STRIP) $CONTRIB/lib/libmkv.a
291 }
292 Wget    $(SUBDIR)/libmkv.tar.gz : $(SUBDIR)/version_libmkv.txt ;
293 LibMkv  $(SUBDIR)/lib/libmkv.a  : $(SUBDIR)/libmkv.tar.gz ;
294
295 # libmpeg2
296 rule LibMpeg2
297 {
298     Depends $(<) : $(>) ;
299     Depends lib  : $(<) ;
300 }
301 actions LibMpeg2
302 {
303     cd `dirname $(>)` && CONTRIB=`pwd` &&
304     rm -rf mpeg2dec && (gzip -dc mpeg2dec.tar.gz | tar xf - ) && 
305     cd mpeg2dec && $(PATCH) -p1 < ../patch-libmpeg2.patch &&
306     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --disable-sdl --without-x &&
307     $(MAKE) && $(MAKE) install &&
308     $(STRIP) $CONTRIB/lib/libmpeg2.a
309 }
310 Wget     $(SUBDIR)/mpeg2dec.tar.gz : $(SUBDIR)/version_mpeg2dec.txt ;
311 LibMpeg2 $(SUBDIR)/lib/libmpeg2.a  : $(SUBDIR)/mpeg2dec.tar.gz ;
312
313 # libogg
314 rule LibOgg
315 {
316     Depends $(<) : $(>) ;
317     Depends lib  : $(<) ;
318 }
319 actions LibOgg
320 {
321     cd `dirname $(>)` && CONTRIB=`pwd` &&
322     rm -rf libogg && (gzip -dc libogg.tar.gz | tar xf - ) && 
323     cd libogg &&
324     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
325     $(MAKE) && $(MAKE) install &&
326     $(STRIP) $CONTRIB/lib/libogg.a
327 }
328 Wget   $(SUBDIR)/libogg.tar.gz : $(SUBDIR)/version_libogg.txt ;
329 LibOgg $(SUBDIR)/lib/libogg.a  : $(SUBDIR)/libogg.tar.gz ;
330
331 # libsamplerate
332 rule LibSampleRate
333 {
334     Depends $(<) : $(>) ;
335     Depends lib  : $(<) ;
336 }
337 actions LibSampleRate
338 {
339     cd `dirname $(>)` && CONTRIB=`pwd` &&
340     rm -rf libsamplerate && (gzip -dc libsamplerate.tar.gz | tar xf - ) && 
341     cd libsamplerate &&
342     ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
343     $(MAKE) && $(MAKE) install &&
344     $(STRIP) $CONTRIB/lib/libsamplerate.a
345 }
346 Wget          $(SUBDIR)/libsamplerate.tar.gz : $(SUBDIR)/version_libsamplerate.txt ;
347 LibSampleRate $(SUBDIR)/lib/libsamplerate.a  : $(SUBDIR)/libsamplerate.tar.gz ;
348
349 # libvorbis
350 rule LibVorbis
351 {
352     Depends $(<) : $(>) ;
353     Depends lib  : $(<) ;
354 }
355 actions LibVorbis
356 {
357     cd `dirname $(>)` && CONTRIB=`pwd` &&
358     rm -rf libvorbis && (gzip -dc libvorbis.tar.gz | tar xf - ) &&
359     cd libvorbis &&
360     ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
361     $(MAKE) && $(MAKE) install &&
362     $(STRIP) $CONTRIB/lib/libvorbis.a
363 }
364 Wget      $(SUBDIR)/libvorbis.tar.gz : $(SUBDIR)/version_libvorbis.txt ;
365 LibVorbis $(SUBDIR)/lib/libvorbis.a  : $(SUBDIR)/libvorbis.tar.gz ;
366
367 rule LibVorbisEnc
368 {
369     Depends $(<) : $(>) ;
370     Depends lib  : $(<) ;
371 }
372 actions LibVorbisEnc
373 {
374     $(STRIP) $(<)
375 }
376 LibVorbisEnc $(SUBDIR)/lib/libvorbisenc.a : $(SUBDIR)/lib/libvorbis.a ;
377
378 # libtheora
379 rule LibTheora
380 {
381     Depends $(<) : $(>) ;
382     Depends lib  : $(<) ;
383 }
384 actions LibTheora
385 {
386     cd `dirname $(>)` && CONTRIB=`pwd` && rm -rf libtheora &&
387     (gzip -dc libtheora.tar.gz | tar xf - ) && cd libtheora &&
388     ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --with-vorbis=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared \
389             --disable-oggtest --disable-vorbistest --disable-sdltest --disable-examples &&
390     $(MAKE) && $(MAKE) install &&
391     $(STRIP) $CONTRIB/lib/libtheora.a
392 }
393 Wget      $(SUBDIR)/libtheora.tar.gz : $(SUBDIR)/version_libtheora.txt ;
394 LibTheora $(SUBDIR)/lib/libtheora.a  : $(SUBDIR)/libtheora.tar.gz ;
395
396 # libx264
397 rule LibX264
398 {
399     LIBX264_PATCH = "" ;
400     if $(OS) = CYGWIN
401     {
402         LIBX264_PATCH += "$(PATCH) -p1 < ../patch-x264-cygwin.patch && " ;
403     }
404     else if $(OS) = SOLARIS
405     {
406         LIBX264_PATCH += " $(PATCH) -p1 < ../patch-x264-solaris.patch && " ;
407     }
408     LIBX264_PATCH += "$(PATCH) -p0 < ../patch-x264-idr.patch && " ;
409         Depends $(<) : $(>) ;
410     Depends lib  : $(<) ;
411 }
412 actions LibX264
413 {
414     cd `dirname $(>)` && CONTRIB=`pwd` &&
415     rm -rf x264 && (gzip -dc x264.tar.gz | tar xf - ) && 
416     cd x264 && $(LIBX264_PATCH)
417     bash ./configure --prefix=$CONTRIB --enable-pthread &&
418     $(MAKE) libx264.a && cp libx264.a $CONTRIB/lib/ && cp x264.h $CONTRIB/include/ && $(STRIP) $CONTRIB/lib/libx264.a
419 }
420 Wget    $(SUBDIR)/x264.tar.gz   : $(SUBDIR)/version_x264.txt ;
421 LibX264 $(SUBDIR)/lib/libx264.a : $(SUBDIR)/x264.tar.gz ;
422
423 # libxvidcore
424 rule LibXvidCore
425 {
426     LIBXVIDCORE_PATCH = "" ;
427     if $(OS) = MACOSX
428     {
429         LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-macosx.patch && " ;
430     }
431     else if $(OS) = CYGWIN
432     {
433         LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-cygwin.patch && " ;
434     }
435     LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-nasm-2.00-configure.patch && " ;
436     LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-fdct.patch && " ;
437     Depends $(<) : $(>) ;
438     Depends lib  : $(<) ;
439 }
440 actions LibXvidCore
441 {
442     cd `dirname $(>)` && CONTRIB=`pwd` &&
443     rm -rf xvidcore && (gzip -dc xvidcore.tar.gz | tar xf - ) &&
444     cd xvidcore && $(LIBXVIDCORE_PATCH)
445     cd build/generic/ && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) libxvidcore.a &&
446     cp ./=build/libxvidcore.a $CONTRIB/lib/ &&
447     cp ../../src/xvid.h $CONTRIB/include/ &&
448     $(STRIP) $CONTRIB/lib/libxvidcore.a
449 }
450 Wget        $(SUBDIR)/xvidcore.tar.gz   : $(SUBDIR)/version_xvidcore.txt ;
451 LibXvidCore $(SUBDIR)/lib/libxvidcore.a : $(SUBDIR)/xvidcore.tar.gz ;
452
453 # zlib
454 if $(OS) = CYGWIN
455 {
456     rule Zlib
457     {
458         Depends $(<) : $(>) ;
459         Depends lib  : $(<) ;
460     }
461     actions Zlib
462     {
463         cd `dirname $(>)` && CONTRIB=`pwd` &&
464         rm -rf zlib && (gzip -dc zlib.tar.gz | tar xf - ) &&
465         cd zlib && ./configure --prefix=$CONTRIB &&
466         $(MAKE) && $(MAKE) install && touch $CONTRIB/.contrib &&
467         $(STRIP) $CONTRIB/lib/libz.a
468     }
469     Wget  $(SUBDIR)/zlib.tar.gz : $(SUBDIR)/version_zlib.txt ;
470     Zlib  $(SUBDIR)/lib/libz.a  : $(SUBDIR)/zlib.tar.gz ;
471 }