OSDN Git Service

Fix Solaris builds
[handbrake-jp/handbrake-jp-git.git] / contrib / Jamfile
index 1cdc379..9bd4148 100644 (file)
@@ -4,13 +4,29 @@ SubDir TOP contrib ;
 # is installed for all other systems
 if $(OS) = MACOSX
 {
-    WGET = curl -o ;
+    WGET = curl -L -o ;
 }
 else
 {
     WGET = wget -O ;
 }
 
+if $(OS) = UNKNOWN
+{
+    OS = CYGWIN ;
+}
+
+if $(OS) = SOLARIS
+{
+    PATCH = gpatch ;
+    STRIP = echo ;
+}
+else
+{
+    PATCH = patch ;
+    STRIP = strip -S ;
+}
+
 # Wget rule: downloads $(<) from the link in $(>)
 rule Wget
 {
@@ -31,38 +47,75 @@ rule LibA52
 }
 actions LibA52
 {
+
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf a52dec && tar xzf a52dec.tar.gz && cd a52dec &&
-    ./configure --prefix=$CONTRIB && make && make install &&
-    strip -S $CONTRIB/lib/liba52.a
+    rm -rf a52dec && (gzip -dc a52dec.tar.gz | tar xf -) && 
+    cd a52dec && $(PATCH) -p1 < ../patch-a52dec.patch &&
+    ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/liba52.a
 }
 Wget   $(SUBDIR)/a52dec.tar.gz : $(SUBDIR)/version_a52dec.txt ;
 LibA52 $(SUBDIR)/lib/liba52.a  : $(SUBDIR)/a52dec.tar.gz ;
 
+# FAAD2
+rule LibFaad2
+{
+    Depends $(<) : $(>) ;
+    Depends lib  : $(<) ;
+}
+
+actions LibFaad2
+{
+    cd `dirname $(>)` && CONTRIB=`pwd` &&
+    rm -rf faad2 && (gzip -dc faad2.tar.gz | tar xf -) &&
+    cd faad2 && $(PATCH) -p1 < ../patch-faad2-libtool22.patch &&
+    ./bootstrap && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared && $(MAKE) && $(MAKE) install
+}
+Wget     $(SUBDIR)/faad2.tar.gz    : $(SUBDIR)/version_faad2.txt ;
+LibFaad2 $(SUBDIR)/lib/libfaad.a : $(SUBDIR)/faad2.tar.gz ;
+
 # libavcodec
 rule LibAvCodec
 {
-    FFMPEG_PATCH = "patch -p1 < ../patch-ffmpeg.patch" ;
-    if $(OS) = MACOSX && $(OSPLAT) = X86
+    FFMPEG_PATCH = "$(PATCH) -p0 < ../patch-ffmpeg.patch" ;
+    FFMPEG_PATCH += " && $(PATCH) -p0 < ../patch-ffmpeg-latm.patch " ;
+    FFMPEG_PATCH += " && $(PATCH) -p0 < ../patch-ffmpeg-mpegleak.patch " ;
+    if $(OS) = CYGWIN
     {
-       FFMPEG_OPTIONS  = --enable-memalign-hack ;
-       FFMPEG_PATCH   += " && patch -p1 < ../patch-ffmpeg-macintel.patch" ;
+        FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-cygwin.patch " ;
     }
-    else if $(OS) = CYGWIN
+    else if $(OS) = SOLARIS
     {
-        FFMPEG_PATCH += " && patch -p1 < ../patch-ffmpeg-cygwin.patch " ;
+        FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-solaris.patch " ;
+    } 
+
+    if $(OS) = SOLARIS
+    {
+       #
+       # Not all of ffmpeg works on Solaris - disable the bits that
+       # don't. When we get new versions of FFMPEG we can try enabling
+       # then again.
+       #
+       FFMPEG_EXTRA_OPTIONS = "--disable-vis --disable-demuxer=mpc8 --disable-vhook" ;
     }
+
     Depends $(<) : $(>) ;
     Depends lib  : $(<) ;
 }
 actions LibAvCodec
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf ffmpeg && tar xzf ffmpeg.tar.gz &&
+    rm -rf ffmpeg && (gzip -dc ffmpeg.tar.gz | tar xf -) &&
     cd ffmpeg && $(FFMPEG_PATCH) &&
-    ./configure --prefix=$CONTRIB $(FFMPEG_OPTIONS) --enable-gpl --disable-audio-beos &&
-    make lib && make install-libs install-headers &&
-    strip -S $CONTRIB/lib/libavcodec.a
+    ./configure --prefix=$CONTRIB --enable-gpl --enable-pthreads --enable-swscale \
+        --disable-shared --enable-static --disable-encoders \
+        --enable-encoder=mpeg4 --enable-encoder=ac3 --enable-encoder=snow \
+        --enable-libfaad --disable-ffmpeg --disable-ffserver \
+        --disable-muxers --enable-muxer=ipod --disable-bsfs \
+        --extra-cflags="-I$CONTRIB/include" \
+        --extra-ldflags="-L$CONTRIB/lib" $(FFMPEG_EXTRA_OPTIONS) &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libavcodec.a
 }
 Wget       $(SUBDIR)/ffmpeg.tar.gz    : $(SUBDIR)/version_ffmpeg.txt ;
 LibAvCodec $(SUBDIR)/lib/libavcodec.a : $(SUBDIR)/ffmpeg.tar.gz ;
@@ -74,13 +127,15 @@ rule LibAvUtil
 }
 actions LibAvUtil
 {
-    strip -S $(<)
+    $(STRIP) $(<)
 }
 LibAvUtil $(SUBDIR)/lib/libavutil.a : $(SUBDIR)/lib/libavcodec.a ;
 LibAvUtil $(SUBDIR)/lib/libavformat.a : $(SUBDIR)/lib/libavcodec.a ;
+LibAvUtil $(SUBDIR)/lib/libswscale.a : $(SUBDIR)/lib/libavcodec.a ;
 
-# CSS doesn't work on Cygwin/Windows as of now, so don't use it.
-if $(OS) != CYGWIN
+# HandBrake does not include a DVD decrypting library,
+# so if a user requests it, let them download and compile it from a 3rd party
+if $(CSS) = 1
 {
     # libdvdcss
     # We need libdvdcss.so for libdvdread's configure to work...
@@ -92,44 +147,68 @@ if $(OS) != CYGWIN
     actions LibDvdCss
     {
         cd `dirname $(>)` && CONTRIB=`pwd` &&
-            rm -rf libdvdcss && tar xzf libdvdcss.tar.gz && cd libdvdcss &&
-            ./configure --prefix=$CONTRIB && make && make install &&
-            strip -S $CONTRIB/lib/libdvdcss.a
+        rm -rf libdvdcss-1.2.9 && (gzip -dc libdvdcss.tar.gz | tar xf - ) && 
+        cd libdvdcss-1.2.9 &&
+        ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
+        $(STRIP) $CONTRIB/lib/libdvdcss.a
     }
     Wget      $(SUBDIR)/libdvdcss.tar.gz : $(SUBDIR)/version_libdvdcss.txt ;
     LibDvdCss $(SUBDIR)/lib/libdvdcss.a  : $(SUBDIR)/libdvdcss.tar.gz ;
 }
 
+# libdca
+rule LibDCA
+{
+    Depends $(<) : $(>) ;
+    Depends lib  : $(<) ;
+}
+actions LibDCA
+{
+    cd `dirname $(>)` && CONTRIB=`pwd` &&
+    rm -rf libdca && (gzip -dc libdca.tar.gz | tar xf - ) && 
+    cd libdca && $(PATCH) -p1 < ../patch-libdca.patch &&
+    ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libdca.a
+}
+Wget   $(SUBDIR)/libdca.tar.gz : $(SUBDIR)/version_libdca.txt ;
+LibDCA $(SUBDIR)/lib/libdca.a  : $(SUBDIR)/libdca.tar.gz ;
+
 # libdvdread
 rule LibDvdRead
 {
-    LIBDVDREAD_PATCH = "patch -p1 < ../patch-libdvdread.patch" ;
     Depends $(<) : $(>) ;
     Depends lib  : $(<) ;
+    
+    if $(OS) = MACOSX
+    {
+        DVDREAD_PATCH = "$(PATCH) -p0 < ../patch-libdvdread-css-vlc-dylib.patch &&" ;
+    }
+    
 }
-if $(OS) != CYGWIN
+if $(CSS) = 1 # Include CSS support in libdvdread if requested
 {
     actions LibDvdRead
     {
         cd `dirname $(>)` && CONTRIB=`pwd` &&
-            rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
-            $(LIBDVDREAD_PATCH) &&
-            ./configure --prefix=$CONTRIB --disable-shared --with-libdvdcss=$CONTRIB &&
-            make && make install &&
-            strip -S $CONTRIB/lib/libdvdread.a
+        rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) && 
+        cd libdvdread &&
+        ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --with-libdvdcss=$CONTRIB &&
+        $(MAKE) && $(MAKE) install &&
+        $(STRIP) $CONTRIB/lib/libdvdread.a
     }
 }
 else {
     # Cygwin/Windows doesn't use CSS as of now, so don't include it on the
     # configure line.
+    # MacOSX uses a dylib for CSS, so it doesn't need including there either.
     actions LibDvdRead
     {
         cd `dirname $(>)` && CONTRIB=`pwd` &&
-            rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread &&
-            $(LIBDVDREAD_PATCH) &&
-            ./configure --prefix=$CONTRIB --disable-shared &&
-            make && make install &&
-            strip -S $CONTRIB/lib/libdvdread.a
+        rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) &&
+        cd libdvdread && $(DVDREAD_PATCH)
+        ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+        $(MAKE) && $(MAKE) install &&
+        $(STRIP) $CONTRIB/lib/libdvdread.a
     }
 }
 Wget       $(SUBDIR)/libdvdread.tar.gz : $(SUBDIR)/version_libdvdread.txt ;
@@ -140,14 +219,18 @@ rule LibFaac
 {
     Depends $(<) : $(>) ;
     Depends lib  : $(<) ;
+       if $(OS) = CYGWIN
+    {
+        CYGWIN_PATCH = "$(PATCH) -p1 < ../patch-faac-cygwin.patch &&" ;
+    }
 }
 actions LibFaac
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf faac && tar xzf faac.tar.gz && cd faac &&
-    ./configure --prefix=$CONTRIB --disable-shared &&
-    make && make install &&
-    strip -S $CONTRIB/lib/libfaac.a
+    rm -rf faac && (gzip -dc faac.tar.gz | tar xf - ) && cd faac && $(CYGWIN_PATCH) ./bootstrap &&
+    ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --enable-static --without-mp4v2 &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libfaac.a
 }
 Wget    $(SUBDIR)/faac.tar.gz   : $(SUBDIR)/version_faac.txt ;
 LibFaac $(SUBDIR)/lib/libfaac.a : $(SUBDIR)/faac.tar.gz ;
@@ -161,14 +244,60 @@ rule LibMp3Lame
 actions LibMp3Lame
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf lame && tar xzf lame.tar.gz && cd lame &&
-    ./configure --prefix=$CONTRIB --disable-shared &&
-    make && make install &&
-    strip -S $CONTRIB/lib/libmp3lame.a
+    rm -rf lame && (gzip -dc lame.tar.gz | tar xf - ) && cd lame &&
+    ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libmp3lame.a
 }
 Wget       $(SUBDIR)/lame.tar.gz      : $(SUBDIR)/version_lame.txt ;
 LibMp3Lame $(SUBDIR)/lib/libmp3lame.a : $(SUBDIR)/lame.tar.gz ;
 
+# libmp4v2
+rule LibMp4v2
+{
+    LIBMP4V2_PATCH = "" ;
+    if $(OS) = CYGWIN
+    {
+        LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch_mpeg4ip_cygwin.patch && " ;
+    }
+    LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip.patch && " ;
+    LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-nasm-2.00-configure.patch && " ;
+    LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-ac3.patch && " ;
+    LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-colr.patch && " ;
+    Depends $(<) : $(>) ;
+    Depends lib  : $(<) ;
+}
+actions LibMp4v2
+{
+    cd `dirname $(>)` && CONTRIB=`pwd` &&
+    rm -rf mpeg4ip && (gzip -dc mpeg4ip.tar.gz | tar xf - ) &&
+    cd mpeg4ip && $(LIBMP4V2_PATCH)
+    ./bootstrap --cache-file=$CONTRIB/config.cache --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
+    $(MAKE) -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
+    cp mpeg4ip_config.h include/mpeg4ip.h include/mpeg4ip_version.h \
+        include/mpeg4ip_win32.h lib/mp4v2/*.h $CONTRIB/include &&
+    $(STRIP) $CONTRIB/lib/libmp4v2.a
+}
+Wget     $(SUBDIR)/mpeg4ip.tar.gz : $(SUBDIR)/version_mpeg4ip.txt ;
+LibMp4v2 $(SUBDIR)/lib/libmp4v2.a : $(SUBDIR)/mpeg4ip.tar.gz ;
+
+rule LibMkv
+{
+    Depends $(<) : $(>) ;
+    Depends lib  : $(<) ;
+}
+actions LibMkv
+{
+    cd `dirname $(>)` && CONTRIB=`pwd` &&
+    rm -rf libmkv && (gzip -dc libmkv.tar.gz | tar xf - ) && 
+    cd libmkv &&
+    ./configure --disable-shared --enable-static --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libmkv.a
+}
+Wget    $(SUBDIR)/libmkv.tar.gz : $(SUBDIR)/version_libmkv.txt ;
+LibMkv  $(SUBDIR)/lib/libmkv.a  : $(SUBDIR)/libmkv.tar.gz ;
+
 # libmpeg2
 rule LibMpeg2
 {
@@ -178,10 +307,11 @@ rule LibMpeg2
 actions LibMpeg2
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf mpeg2dec && tar xzf mpeg2dec.tar.gz && cd mpeg2dec &&
-    ./configure --prefix=$CONTRIB --disable-shared &&
-    make && make install &&
-    strip -S $CONTRIB/lib/libmpeg2.a
+    rm -rf mpeg2dec && (gzip -dc mpeg2dec.tar.gz | tar xf - ) && 
+    cd mpeg2dec &&
+    ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --disable-sdl --without-x &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libmpeg2.a
 }
 Wget     $(SUBDIR)/mpeg2dec.tar.gz : $(SUBDIR)/version_mpeg2dec.txt ;
 LibMpeg2 $(SUBDIR)/lib/libmpeg2.a  : $(SUBDIR)/mpeg2dec.tar.gz ;
@@ -195,10 +325,11 @@ rule LibOgg
 actions LibOgg
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf libogg && tar xzf libogg.tar.gz && cd libogg &&
-    ./configure --prefix=$CONTRIB --disable-shared &&
-    make && make install &&
-    strip -S $CONTRIB/lib/libogg.a
+    rm -rf libogg && (gzip -dc libogg.tar.gz | tar xf - ) && 
+    cd libogg &&
+    ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libogg.a
 }
 Wget   $(SUBDIR)/libogg.tar.gz : $(SUBDIR)/version_libogg.txt ;
 LibOgg $(SUBDIR)/lib/libogg.a  : $(SUBDIR)/libogg.tar.gz ;
@@ -212,10 +343,11 @@ rule LibSampleRate
 actions LibSampleRate
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf libsamplerate && tar xzf libsamplerate.tar.gz && cd libsamplerate &&
-    ./configure --prefix=$CONTRIB --disable-shared &&
-    make && make install &&
-    strip -S $CONTRIB/lib/libsamplerate.a
+    rm -rf libsamplerate && (gzip -dc libsamplerate.tar.gz | tar xf - ) && 
+    cd libsamplerate &&
+    ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libsamplerate.a
 }
 Wget          $(SUBDIR)/libsamplerate.tar.gz : $(SUBDIR)/version_libsamplerate.txt ;
 LibSampleRate $(SUBDIR)/lib/libsamplerate.a  : $(SUBDIR)/libsamplerate.tar.gz ;
@@ -229,10 +361,11 @@ rule LibVorbis
 actions LibVorbis
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf libvorbis && tar xzf libvorbis.tar.gz && cd libvorbis &&
-    ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --disable-shared &&
-    make && make install &&
-    strip -S $CONTRIB/lib/libvorbis.a
+    rm -rf libvorbis && (gzip -dc libvorbis.tar.gz | tar xf - ) &&
+    cd libvorbis &&
+    ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libvorbis.a
 }
 Wget      $(SUBDIR)/libvorbis.tar.gz : $(SUBDIR)/version_libvorbis.txt ;
 LibVorbis $(SUBDIR)/lib/libvorbis.a  : $(SUBDIR)/libvorbis.tar.gz ;
@@ -244,32 +377,52 @@ rule LibVorbisEnc
 }
 actions LibVorbisEnc
 {
-    strip -S $(<)
+    $(STRIP) $(<)
 }
 LibVorbisEnc $(SUBDIR)/lib/libvorbisenc.a : $(SUBDIR)/lib/libvorbis.a ;
 
+# libtheora
+rule LibTheora
+{
+    Depends $(<) : $(>) ;
+    Depends lib  : $(<) ;
+}
+actions LibTheora
+{
+    cd `dirname $(>)` && CONTRIB=`pwd` && rm -rf libtheora &&
+    (gzip -dc libtheora.tar.gz | tar xf - ) && cd libtheora &&
+    HAVE_PKG_CONFIG="no" && export HAVE_PKG_CONFIG &&
+    ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --with-vorbis=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared \
+            --disable-oggtest --disable-vorbistest --disable-sdltest --disable-examples &&
+    $(MAKE) && $(MAKE) install &&
+    $(STRIP) $CONTRIB/lib/libtheora.a
+}
+Wget      $(SUBDIR)/libtheora.tar.gz : $(SUBDIR)/version_libtheora.txt ;
+LibTheora $(SUBDIR)/lib/libtheora.a  : $(SUBDIR)/libtheora.tar.gz ;
+
 # libx264
 rule LibX264
 {
     LIBX264_PATCH = "" ;
-    if $(OS) = MACOSX && $(OSPLAT) = X86
+    if $(OS) = CYGWIN
     {
-        LIBX264_PATCH = " patch -p1 < ../patch-x264-macintel.patch && " ;
+        LIBX264_PATCH += "$(PATCH) -p1 < ../patch-x264-cygwin.patch && " ;
     }
-    else if $(OS) = CYGWIN
+    else if $(OS) = SOLARIS
     {
-        LIBX264_PATCH = " patch -p1 < ../patch-x264-cygwin.patch && " ;
+        LIBX264_PATCH += " $(PATCH) -p1 < ../patch-x264-solaris.patch && " ;
     }
-    Depends $(<) : $(>) ;
+    LIBX264_PATCH += "$(PATCH) -p0 < ../patch-x264-idr.patch && " ;
+       Depends $(<) : $(>) ;
     Depends lib  : $(<) ;
 }
 actions LibX264
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf x264 && tar xzf x264.tar.gz && cd x264 && $(LIBX264_PATCH)
-    ./configure --prefix=$CONTRIB --enable-pthread && make &&
-    make install &&
-    strip -S $CONTRIB/lib/libx264.a
+    rm -rf x264 && (gzip -dc x264.tar.gz | tar xf - ) && 
+    cd x264 && $(LIBX264_PATCH)
+    bash ./configure --prefix=$CONTRIB --enable-pthread &&
+    $(MAKE) libx264.a && cp libx264.a $CONTRIB/lib/ && cp x264.h $CONTRIB/include/ && $(STRIP) $CONTRIB/lib/libx264.a
 }
 Wget    $(SUBDIR)/x264.tar.gz   : $(SUBDIR)/version_x264.txt ;
 LibX264 $(SUBDIR)/lib/libx264.a : $(SUBDIR)/x264.tar.gz ;
@@ -280,24 +433,46 @@ rule LibXvidCore
     LIBXVIDCORE_PATCH = "" ;
     if $(OS) = MACOSX
     {
-        LIBXVIDCORE_PATCH = " patch -p1 < ../patch-xvidcore-macosx.patch && " ;
+        LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-macosx.patch && " ;
     }
     else if $(OS) = CYGWIN
     {
-        LIBXVIDCORE_PATCH = " patch -p1 < ../patch-xvidcore-cygwin.patch && " ;
+        LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-cygwin.patch && " ;
     }
+    LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-nasm-2.00-configure.patch && " ;
+    LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-fdct.patch && " ;
     Depends $(<) : $(>) ;
     Depends lib  : $(<) ;
 }
 actions LibXvidCore
 {
     cd `dirname $(>)` && CONTRIB=`pwd` &&
-    rm -rf xvidcore && tar xzf xvidcore.tar.gz &&
+    rm -rf xvidcore && (gzip -dc xvidcore.tar.gz | tar xf - ) &&
     cd xvidcore && $(LIBXVIDCORE_PATCH)
-    cd build/generic/ && ./configure && make libxvidcore.a &&
+    cd build/generic/ && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) libxvidcore.a &&
     cp ./=build/libxvidcore.a $CONTRIB/lib/ &&
     cp ../../src/xvid.h $CONTRIB/include/ &&
-    strip -S $CONTRIB/lib/libxvidcore.a
+    $(STRIP) $CONTRIB/lib/libxvidcore.a
 }
 Wget        $(SUBDIR)/xvidcore.tar.gz   : $(SUBDIR)/version_xvidcore.txt ;
 LibXvidCore $(SUBDIR)/lib/libxvidcore.a : $(SUBDIR)/xvidcore.tar.gz ;
+
+# zlib
+if $(OS) = CYGWIN
+{
+    rule Zlib
+    {
+        Depends $(<) : $(>) ;
+        Depends lib  : $(<) ;
+    }
+    actions Zlib
+    {
+        cd `dirname $(>)` && CONTRIB=`pwd` &&
+        rm -rf zlib && (gzip -dc zlib.tar.gz | tar xf - ) &&
+        cd zlib && ./configure --prefix=$CONTRIB &&
+        $(MAKE) && $(MAKE) install && touch $CONTRIB/.contrib &&
+        $(STRIP) $CONTRIB/lib/libz.a
+    }
+    Wget  $(SUBDIR)/zlib.tar.gz : $(SUBDIR)/version_zlib.txt ;
+    Zlib  $(SUBDIR)/lib/libz.a  : $(SUBDIR)/zlib.tar.gz ;
+}