OSDN Git Service

Changes to make HandBrake build on Windows using the Cygwin environment:
[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 -o ;
8 }
9 else
10 {
11     WGET = wget -O ;
12 }
13
14 # Wget rule: downloads $(<) from the link in $(>)
15 rule Wget
16 {
17     Depends $(<) : $(>) ;
18 }
19 actions Wget
20 {
21     $(RM) $(<) &&
22     $(WGET) $(<) `cat $(>)` &&
23     ( touch $(<) || true )
24 }
25
26 # liba52
27 rule LibA52
28 {
29     Depends $(<) : $(>) ;
30     Depends lib  : $(<) ;
31 }
32 actions LibA52
33 {
34     cd `dirname $(>)` && CONTRIB=`pwd` &&
35     rm -rf a52dec && tar xzf a52dec.tar.gz && cd a52dec &&
36     ./configure --prefix=$CONTRIB && make && make install &&
37     strip -S $CONTRIB/lib/liba52.a
38 }
39 Wget   $(SUBDIR)/a52dec.tar.gz : $(SUBDIR)/version_a52dec.txt ;
40 LibA52 $(SUBDIR)/lib/liba52.a  : $(SUBDIR)/a52dec.tar.gz ;
41
42 # libavcodec
43 rule LibAvCodec
44 {
45     FFMPEG_PATCH = "patch -p1 < ../patch-ffmpeg.patch" ;
46     if $(OS) = MACOSX && $(OSPLAT) = X86
47     {
48        FFMPEG_OPTIONS  = --enable-memalign-hack ;
49        FFMPEG_PATCH   += " && patch -p1 < ../patch-ffmpeg-macintel.patch" ;
50     }
51     else if $(OS) = CYGWIN
52     {
53         FFMPEG_PATCH += " && patch -p1 < ../patch-ffmpeg-cygwin.patch " ;
54     }
55     Depends $(<) : $(>) ;
56     Depends lib  : $(<) ;
57 }
58 actions LibAvCodec
59 {
60     cd `dirname $(>)` && CONTRIB=`pwd` &&
61     rm -rf ffmpeg && tar xzf ffmpeg.tar.gz &&
62     cd ffmpeg && $(FFMPEG_PATCH) &&
63     ./configure --prefix=$CONTRIB $(FFMPEG_OPTIONS) --enable-gpl --disable-audio-beos &&
64     make lib && make install-libs install-headers &&
65     strip -S $CONTRIB/lib/libavcodec.a
66 }
67 Wget       $(SUBDIR)/ffmpeg.tar.gz    : $(SUBDIR)/version_ffmpeg.txt ;
68 LibAvCodec $(SUBDIR)/lib/libavcodec.a : $(SUBDIR)/ffmpeg.tar.gz ;
69
70 rule LibAvUtil
71 {
72     Depends $(<) : $(>) ;
73     Depends lib  : $(<) ;
74 }
75 actions LibAvUtil
76 {
77     strip -S $(<)
78 }
79 LibAvUtil $(SUBDIR)/lib/libavutil.a : $(SUBDIR)/lib/libavcodec.a ;
80 LibAvUtil $(SUBDIR)/lib/libavformat.a : $(SUBDIR)/lib/libavcodec.a ;
81
82 # CSS doesn't work on Cygwin/Windows as of now, so don't use it.
83 if $(OS) != CYGWIN
84 {
85     # libdvdcss
86     # We need libdvdcss.so for libdvdread's configure to work...
87     rule LibDvdCss
88     {
89         Depends $(<) : $(>) ;
90         Depends lib  : $(<) ;
91     }
92     actions LibDvdCss
93     {
94         cd `dirname $(>)` && CONTRIB=`pwd` &&
95             rm -rf libdvdcss && tar xzf libdvdcss.tar.gz && cd libdvdcss &&
96             ./configure --prefix=$CONTRIB && make && make install &&
97             strip -S $CONTRIB/lib/libdvdcss.a
98     }
99     Wget      $(SUBDIR)/libdvdcss.tar.gz : $(SUBDIR)/version_libdvdcss.txt ;
100     LibDvdCss $(SUBDIR)/lib/libdvdcss.a  : $(SUBDIR)/libdvdcss.tar.gz ;
101 }
102
103 # libdvdread
104 rule LibDvdRead
105 {
106     LIBDVDREAD_PATCH = "patch -p1 < ../patch-libdvdread.patch" ;
107     Depends $(<) : $(>) ;
108     Depends lib  : $(<) ;
109 }
110 if $(OS) != CYGWIN
111 {
112     actions LibDvdRead
113     {
114         cd `dirname $(>)` && CONTRIB=`pwd` &&
115             rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
116             $(LIBDVDREAD_PATCH) &&
117             ./configure --prefix=$CONTRIB --disable-shared --with-libdvdcss=$CONTRIB &&
118             make && make install &&
119             strip -S $CONTRIB/lib/libdvdread.a
120     }
121 }
122 else {
123     # Cygwin/Windows doesn't use CSS as of now, so don't include it on the
124     # configure line.
125     actions LibDvdRead
126     {
127         cd `dirname $(>)` && CONTRIB=`pwd` &&
128             rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
129             $(LIBDVDREAD_PATCH) &&
130             ./configure --prefix=$CONTRIB --disable-shared &&
131             make && make install &&
132             strip -S $CONTRIB/lib/libdvdread.a
133     }
134 }
135 Wget       $(SUBDIR)/libdvdread.tar.gz : $(SUBDIR)/version_libdvdread.txt ;
136 LibDvdRead $(SUBDIR)/lib/libdvdread.a  : $(SUBDIR)/libdvdread.tar.gz ;
137
138 # libfaac
139 rule LibFaac
140 {
141     Depends $(<) : $(>) ;
142     Depends lib  : $(<) ;
143 }
144 actions LibFaac
145 {
146     cd `dirname $(>)` && CONTRIB=`pwd` &&
147     rm -rf faac && tar xzf faac.tar.gz && cd faac &&
148     ./configure --prefix=$CONTRIB --disable-shared &&
149     make && make install &&
150     strip -S $CONTRIB/lib/libfaac.a
151 }
152 Wget    $(SUBDIR)/faac.tar.gz   : $(SUBDIR)/version_faac.txt ;
153 LibFaac $(SUBDIR)/lib/libfaac.a : $(SUBDIR)/faac.tar.gz ;
154
155 # libmp3lame
156 rule LibMp3Lame
157 {
158     Depends $(<) : $(>) ;
159     Depends lib  : $(<) ;
160 }
161 actions LibMp3Lame
162 {
163     cd `dirname $(>)` && CONTRIB=`pwd` &&
164     rm -rf lame && tar xzf lame.tar.gz && cd lame &&
165     ./configure --prefix=$CONTRIB --disable-shared &&
166     make && make install &&
167     strip -S $CONTRIB/lib/libmp3lame.a
168 }
169 Wget       $(SUBDIR)/lame.tar.gz      : $(SUBDIR)/version_lame.txt ;
170 LibMp3Lame $(SUBDIR)/lib/libmp3lame.a : $(SUBDIR)/lame.tar.gz ;
171
172 # libmpeg2
173 rule LibMpeg2
174 {
175     Depends $(<) : $(>) ;
176     Depends lib  : $(<) ;
177 }
178 actions LibMpeg2
179 {
180     cd `dirname $(>)` && CONTRIB=`pwd` &&
181     rm -rf mpeg2dec && tar xzf mpeg2dec.tar.gz && cd mpeg2dec &&
182     ./configure --prefix=$CONTRIB --disable-shared &&
183     make && make install &&
184     strip -S $CONTRIB/lib/libmpeg2.a
185 }
186 Wget     $(SUBDIR)/mpeg2dec.tar.gz : $(SUBDIR)/version_mpeg2dec.txt ;
187 LibMpeg2 $(SUBDIR)/lib/libmpeg2.a  : $(SUBDIR)/mpeg2dec.tar.gz ;
188
189 # libogg
190 rule LibOgg
191 {
192     Depends $(<) : $(>) ;
193     Depends lib  : $(<) ;
194 }
195 actions LibOgg
196 {
197     cd `dirname $(>)` && CONTRIB=`pwd` &&
198     rm -rf libogg && tar xzf libogg.tar.gz && cd libogg &&
199     ./configure --prefix=$CONTRIB --disable-shared &&
200     make && make install &&
201     strip -S $CONTRIB/lib/libogg.a
202 }
203 Wget   $(SUBDIR)/libogg.tar.gz : $(SUBDIR)/version_libogg.txt ;
204 LibOgg $(SUBDIR)/lib/libogg.a  : $(SUBDIR)/libogg.tar.gz ;
205
206 # libsamplerate
207 rule LibSampleRate
208 {
209     Depends $(<) : $(>) ;
210     Depends lib  : $(<) ;
211 }
212 actions LibSampleRate
213 {
214     cd `dirname $(>)` && CONTRIB=`pwd` &&
215     rm -rf libsamplerate && tar xzf libsamplerate.tar.gz && cd libsamplerate &&
216     ./configure --prefix=$CONTRIB --disable-shared &&
217     make && make install &&
218     strip -S $CONTRIB/lib/libsamplerate.a
219 }
220 Wget          $(SUBDIR)/libsamplerate.tar.gz : $(SUBDIR)/version_libsamplerate.txt ;
221 LibSampleRate $(SUBDIR)/lib/libsamplerate.a  : $(SUBDIR)/libsamplerate.tar.gz ;
222
223 # libvorbis
224 rule LibVorbis
225 {
226     Depends $(<) : $(>) ;
227     Depends lib  : $(<) ;
228 }
229 actions LibVorbis
230 {
231     cd `dirname $(>)` && CONTRIB=`pwd` &&
232     rm -rf libvorbis && tar xzf libvorbis.tar.gz && cd libvorbis &&
233     ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --disable-shared &&
234     make && make install &&
235     strip -S $CONTRIB/lib/libvorbis.a
236 }
237 Wget      $(SUBDIR)/libvorbis.tar.gz : $(SUBDIR)/version_libvorbis.txt ;
238 LibVorbis $(SUBDIR)/lib/libvorbis.a  : $(SUBDIR)/libvorbis.tar.gz ;
239
240 rule LibVorbisEnc
241 {
242     Depends $(<) : $(>) ;
243     Depends lib  : $(<) ;
244 }
245 actions LibVorbisEnc
246 {
247     strip -S $(<)
248 }
249 LibVorbisEnc $(SUBDIR)/lib/libvorbisenc.a : $(SUBDIR)/lib/libvorbis.a ;
250
251 # libx264
252 rule LibX264
253 {
254     LIBX264_PATCH = "" ;
255     if $(OS) = MACOSX && $(OSPLAT) = X86
256     {
257         LIBX264_PATCH = " patch -p1 < ../patch-x264-macintel.patch && " ;
258     }
259     else if $(OS) = CYGWIN
260     {
261         LIBX264_PATCH = " patch -p1 < ../patch-x264-cygwin.patch && " ;
262     }
263     Depends $(<) : $(>) ;
264     Depends lib  : $(<) ;
265 }
266 actions LibX264
267 {
268     cd `dirname $(>)` && CONTRIB=`pwd` &&
269     rm -rf x264 && tar xzf x264.tar.gz && cd x264 && $(LIBX264_PATCH)
270     ./configure --prefix=$CONTRIB --enable-pthread && make &&
271     make install &&
272     strip -S $CONTRIB/lib/libx264.a
273 }
274 Wget    $(SUBDIR)/x264.tar.gz   : $(SUBDIR)/version_x264.txt ;
275 LibX264 $(SUBDIR)/lib/libx264.a : $(SUBDIR)/x264.tar.gz ;
276
277 # libxvidcore
278 rule LibXvidCore
279 {
280     LIBXVIDCORE_PATCH = "" ;
281     if $(OS) = MACOSX
282     {
283         LIBXVIDCORE_PATCH = " patch -p1 < ../patch-xvidcore-macosx.patch && " ;
284     }
285     else if $(OS) = CYGWIN
286     {
287         LIBXVIDCORE_PATCH = " patch -p1 < ../patch-xvidcore-cygwin.patch && " ;
288     }
289     Depends $(<) : $(>) ;
290     Depends lib  : $(<) ;
291 }
292 actions LibXvidCore
293 {
294     cd `dirname $(>)` && CONTRIB=`pwd` &&
295     rm -rf xvidcore && tar xzf xvidcore.tar.gz &&
296     cd xvidcore && $(LIBXVIDCORE_PATCH)
297     cd build/generic/ && ./configure && make libxvidcore.a &&
298     cp ./=build/libxvidcore.a $CONTRIB/lib/ &&
299     cp ../../src/xvid.h $CONTRIB/include/ &&
300     strip -S $CONTRIB/lib/libxvidcore.a
301 }
302 Wget        $(SUBDIR)/xvidcore.tar.gz   : $(SUBDIR)/version_xvidcore.txt ;
303 LibXvidCore $(SUBDIR)/lib/libxvidcore.a : $(SUBDIR)/xvidcore.tar.gz ;