OSDN Git Service

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