Commit 47f1b032 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

contrib: add two macros to simplify patching and unpacking

parent ec603642
...@@ -41,7 +41,7 @@ source code is fully ready. Otherwise Makefile dependencies will break ...@@ -41,7 +41,7 @@ source code is fully ready. Otherwise Makefile dependencies will break
$(UNPACK) # to libfoo-$(FOO_VERSION) $(UNPACK) # to libfoo-$(FOO_VERSION)
### apply patches here ### ### apply patches here ###
# last command: make the target directory # last command: make the target directory
mv libfoo-$(FOO_VERSION) libfoo $(MOVE)
.foo: libfoo .foo: libfoo
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
......
...@@ -13,10 +13,9 @@ $(TARBALLS)/a52dec-$(A52DEC_VERSION).tar.gz: ...@@ -13,10 +13,9 @@ $(TARBALLS)/a52dec-$(A52DEC_VERSION).tar.gz:
a52dec: a52dec-$(A52DEC_VERSION).tar.gz .sum-a52 a52dec: a52dec-$(A52DEC_VERSION).tar.gz .sum-a52
$(UNPACK) $(UNPACK)
ifndef HAVE_FPU ifndef HAVE_FPU
(cd $@-$(A52DEC_VERSION) && patch -p0) < $(SRC)/a52/liba52-fixed.diff $(APPLY) $(SRC)/a52/liba52-fixed.diff
endif endif
mv $@-$(A52DEC_VERSION) $@ $(MOVE)
touch $@
.a52: a52dec .a52: a52dec
ifdef HAVE_WIN64 ifdef HAVE_WIN64
......
...@@ -14,9 +14,8 @@ $(TARBALLS)/libdca-$(DCA_VERSION).tar.bz2: ...@@ -14,9 +14,8 @@ $(TARBALLS)/libdca-$(DCA_VERSION).tar.bz2:
libdca: libdca-$(DCA_VERSION).tar.bz2 .sum-dca libdca: libdca-$(DCA_VERSION).tar.bz2 .sum-dca
$(UNPACK) $(UNPACK)
#(cd $@-$(DCA_VERSION) && patch -p1) < $(SRC)/dca/libdca-llvm-gcc.patch #$(APPLY) $(SRC)/dca/libdca-llvm-gcc.patch
mv $@-$(DCA_VERSION) $@ $(MOVE)
touch $@
.dca: libdca .dca: libdca
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
......
...@@ -12,9 +12,8 @@ $(TARBALLS)/libdvbpsi-$(DVBPSI_VERSION).tar.bz2: ...@@ -12,9 +12,8 @@ $(TARBALLS)/libdvbpsi-$(DVBPSI_VERSION).tar.bz2:
libdvbpsi: libdvbpsi-$(DVBPSI_VERSION).tar.bz2 .sum-dvbpsi libdvbpsi: libdvbpsi-$(DVBPSI_VERSION).tar.bz2 .sum-dvbpsi
$(UNPACK) $(UNPACK)
(cd $@-$(DVBPSI_VERSION) && patch -p1) < $(SRC)/dvbpsi/libdvbpsi-example.patch $(APPLY) $(SRC)/dvbpsi/libdvbpsi-example.patch
mv $@-$(DVBPSI_VERSION) $@ $(MOVE)
touch $@
.dvbpsi: libdvbpsi .dvbpsi: libdvbpsi
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --enable-release cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --enable-release
......
...@@ -11,8 +11,7 @@ $(TARBALLS)/libebml-$(EBML_VERSION).tar.bz2: ...@@ -11,8 +11,7 @@ $(TARBALLS)/libebml-$(EBML_VERSION).tar.bz2:
libebml: libebml-$(EBML_VERSION).tar.bz2 .sum-ebml libebml: libebml-$(EBML_VERSION).tar.bz2 .sum-ebml
$(UNPACK) $(UNPACK)
mv $@-$(EBML_VERSION) $@ $(MOVE)
touch $@
.ebml: libebml .ebml: libebml
ifdef HAVE_WIN32 ifdef HAVE_WIN32
......
...@@ -16,11 +16,10 @@ $(TARBALLS)/faad2-$(FAAD2_VERSION).tar.gz: ...@@ -16,11 +16,10 @@ $(TARBALLS)/faad2-$(FAAD2_VERSION).tar.gz:
faad2: faad2-$(FAAD2_VERSION).tar.gz .sum-faad2 faad2: faad2-$(FAAD2_VERSION).tar.gz .sum-faad2
$(UNPACK) $(UNPACK)
ifndef HAVE_FPU ifndef HAVE_FPU
(cd $@-$(FAAD2_VERSION) && patch -p1) < $(SRC)/faad2/faad2-fixed.patch $(APPLY) $(SRC)/faad2/faad2-fixed.patch
endif endif
(cd $@-$(FAAD2_VERSION) && $(CC) -iquote . -E - </dev/null || sed -i 's/-iquote /-I/' libfaad/Makefile.am) cd $(UNPACK_DIR) && $(CC) -iquote . -E - </dev/null || sed -i 's/-iquote /-I/' libfaad/Makefile.am
mv $@-$(FAAD2_VERSION) $@ $(MOVE)
touch $@
.faad2: faad2 .faad2: faad2
cd $< && autoreconf -fiv cd $< && autoreconf -fiv
......
...@@ -127,14 +127,13 @@ FFMPEG_VERSION := svn ...@@ -127,14 +127,13 @@ FFMPEG_VERSION := svn
ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
$(UNPACK) $(UNPACK)
ifdef HAVE_WIN64 ifdef HAVE_WIN64
(cd $@-$(FFMPEG_VERSION)/libswscale && patch -p0) < $(SRC)/ffmpeg/ffmpeg-win64.patch $(APPLY) $(SRC)/ffmpeg/ffmpeg-win64.patch
endif endif
ifdef HAVE_WIN32 ifdef HAVE_WIN32
sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
endif endif
(cd $@-$(FFMPEG_VERSION) && patch -p1) < $(SRC)/ffmpeg/libavformat-ape.c.patch $(APPLY) $(SRC)/ffmpeg/libavformat-ape.c.patch
mv $@-$(FFMPEG_VERSION) $@ $(MOVE)
touch $@
.ffmpeg: ffmpeg .ffmpeg: ffmpeg
# TODO: .zlib # TODO: .zlib
......
...@@ -12,13 +12,12 @@ $(TARBALLS)/flac-$(FLAC_VERSION).tar.gz: ...@@ -12,13 +12,12 @@ $(TARBALLS)/flac-$(FLAC_VERSION).tar.gz:
flac: flac-$(FLAC_VERSION).tar.gz .sum-flac flac: flac-$(FLAC_VERSION).tar.gz .sum-flac
$(UNPACK) $(UNPACK)
(cd $@-$(FLAC_VERSION) && patch -p1) < $(SRC)/flac/flac-win32.patch $(APPLY) $(SRC)/flac/flac-win32.patch
(cd $@-$(FLAC_VERSION) && patch -p1) < $(SRC)/flac/libFLAC-pc.patch $(APPLY) $(SRC)/flac/libFLAC-pc.patch
ifdef HAVE_MACOSX ifdef HAVE_MACOSX
cd $<-$(FLAC_VERSION) && sed -e 's,-dynamiclib,-dynamiclib -arch $(ARCH),' -i.orig configure cd $(UNPACK_DIR) && sed -e 's,-dynamiclib,-dynamiclib -arch $(ARCH),' -i.orig configure
endif endif
mv $@-$(FLAC_VERSION) $@ $(MOVE)
touch $@
FLACCONF := $(HOSTCONF) \ FLACCONF := $(HOSTCONF) \
--disable--thorough-tests \ --disable--thorough-tests \
......
...@@ -12,8 +12,7 @@ $(TARBALLS)/freetype-$(FREETYPE2_VERSION).tar.gz: ...@@ -12,8 +12,7 @@ $(TARBALLS)/freetype-$(FREETYPE2_VERSION).tar.gz:
freetype: freetype-$(FREETYPE2_VERSION).tar.gz .sum-freetype2 freetype: freetype-$(FREETYPE2_VERSION).tar.gz .sum-freetype2
$(UNPACK) $(UNPACK)
mv $@-$(FREETYPE2_VERSION) $@ $(MOVE)
touch $@
ifeq ($(NEED_FREETYPE2),) ifeq ($(NEED_FREETYPE2),)
.freetype2: .freetype2:
......
...@@ -14,8 +14,7 @@ XMLCONF = --with-minimal --with-catalog --with-reader --with-tree --with-push -- ...@@ -14,8 +14,7 @@ XMLCONF = --with-minimal --with-catalog --with-reader --with-tree --with-push --
libxml2: libxml2-$(LIBXML2_VERSION).tar.gz .sum-libxml2 libxml2: libxml2-$(LIBXML2_VERSION).tar.gz .sum-libxml2
$(UNPACK) $(UNPACK)
mv $@-$(LIBXML2_VERSION) $@ $(MOVE)
touch $@
ifeq ($(NEED_XML2),) ifeq ($(NEED_XML2),)
.libxml2: .libxml2:
......
...@@ -28,23 +28,22 @@ $(TARBALLS)/lua-$(LUA_VERSION).tar.gz: ...@@ -28,23 +28,22 @@ $(TARBALLS)/lua-$(LUA_VERSION).tar.gz:
lua: lua-$(LUA_VERSION).tar.gz .sum-lua lua: lua-$(LUA_VERSION).tar.gz .sum-lua
$(UNPACK) $(UNPACK)
(cd $@-$(LUA_VERSION) && patch -p1) < $(SRC)/lua/lua-noreadline.patch $(APPLY) $(SRC)/lua/lua-noreadline.patch
ifdef HAVE_MACOSX ifdef HAVE_MACOSX
(cd $@-$(LUA_VERSION) && \ (cd $(UNPACK_DIR) && \
sed -e 's%gcc%$(CC)%' \ sed -e 's%gcc%$(CC)%' \
-e 's%LDFLAGS=%LDFLAGS=$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' \ -e 's%LDFLAGS=%LDFLAGS=$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)%' \
-i.orig src/Makefile) -i.orig src/Makefile)
endif endif
ifdef HAVE_WIN32 ifdef HAVE_WIN32
cd $@-$(LUA_VERSION) && sed -i.orig -e 's/lua luac/lua.exe/' Makefile cd $(UNPACK_DIR) && sed -i.orig -e 's/lua luac/lua.exe/' Makefile
endif endif
cd $@-$(LUA_VERSION)/src && sed -i.orig \ cd $(UNPACK_DIR)/src && sed -i.orig \
-e 's/CC=/#CC=/' \ -e 's/CC=/#CC=/' \
-e 's/= *strip/=$(STRIP)/' \ -e 's/= *strip/=$(STRIP)/' \
-e 's/= *ranlib/= $(RANLIB)/' \ -e 's/= *ranlib/= $(RANLIB)/' \
Makefile Makefile
mv $@-$(LUA_VERSION) $@ $(MOVE)
touch $@
.lua: lua .lua: lua
cd $< && $(HOSTVARS) $(MAKE) $(LUA_TARGET) cd $< && $(HOSTVARS) $(MAKE) $(LUA_TARGET)
......
...@@ -18,8 +18,7 @@ ifdef HAVE_MACOSX ...@@ -18,8 +18,7 @@ ifdef HAVE_MACOSX
-e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' \ -e 's%-dynamiclib%-dynamiclib -arch $(ARCH)%' \
-i.orig configure -i.orig configure
endif endif
mv $@-$(MAD_VERSION) $@ $(MOVE)
touch $@
.mad: libmad .mad: libmad
cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) -O3 $(NOTHUMB)" ./configure $(HOSTCONF) cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) -O3 $(NOTHUMB)" ./configure $(HOSTCONF)
......
...@@ -177,6 +177,9 @@ UNPACK = $(RM) -R $@ \ ...@@ -177,6 +177,9 @@ UNPACK = $(RM) -R $@ \
$(foreach f,$(filter %.tar.bz2,$^), && tar xvjf $(f)) \ $(foreach f,$(filter %.tar.bz2,$^), && tar xvjf $(f)) \
$(foreach f,$(filter %.tar.xz,$^), && tar xvJf $(f)) \ $(foreach f,$(filter %.tar.xz,$^), && tar xvJf $(f)) \
$(foreach f,$(filter %.zip,$^), && unzip $(f)) $(foreach f,$(filter %.zip,$^), && unzip $(f))
UNPACK_DIR = $(basename $(basename $(notdir $<)))
APPLY = (cd $(UNPACK_DIR) && patch -p1) <
MOVE = mv $(UNPACK_DIR) $@ && touch $@
# #
# Per-package build rules # Per-package build rules
......
...@@ -13,8 +13,7 @@ $(TARBALLS)/libmatroska-$(MATROSKA_VERSION).tar.bz2: ...@@ -13,8 +13,7 @@ $(TARBALLS)/libmatroska-$(MATROSKA_VERSION).tar.bz2:
libmatroska: libmatroska-$(MATROSKA_VERSION).tar.bz2 .sum-matroska libmatroska: libmatroska-$(MATROSKA_VERSION).tar.bz2 .sum-matroska
$(UNPACK) $(UNPACK)
mv $@-$(MATROSKA_VERSION) $@ $(MOVE)
touch $@
.matroska: libmatroska .ebml .matroska: libmatroska .ebml
ifdef HAVE_WIN32 ifdef HAVE_WIN32
......
...@@ -12,8 +12,7 @@ $(TARBALLS)/libmodplug-$(MODPLUG_VERSION).tar.gz: ...@@ -12,8 +12,7 @@ $(TARBALLS)/libmodplug-$(MODPLUG_VERSION).tar.gz:
libmodplug: libmodplug-$(MODPLUG_VERSION).tar.gz .sum-modplug libmodplug: libmodplug-$(MODPLUG_VERSION).tar.gz .sum-modplug
$(UNPACK) $(UNPACK)
mv $@-$(MODPLUG_VERSION) $@ $(MOVE)
touch $@
.modplug: libmodplug .modplug: libmodplug
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
......
...@@ -15,12 +15,11 @@ $(TARBALLS)/libogg-$(OGG_VERSION).tar.xz: ...@@ -15,12 +15,11 @@ $(TARBALLS)/libogg-$(OGG_VERSION).tar.xz:
libogg: libogg-$(OGG_VERSION).tar.xz .sum-ogg libogg: libogg-$(OGG_VERSION).tar.xz .sum-ogg
$(UNPACK) $(UNPACK)
(cd $@-$(OGG_VERSION) && patch -p1) < $(SRC)/ogg/libogg-1.1.patch $(APPLY) $(SRC)/ogg/libogg-1.1.patch
ifdef HAVE_WINCE ifdef HAVE_WINCE
(cd $@-$(OGG_VERSION) && patch -p1) < $(SRC)/ogg/libogg-wince.patch $(APPLY) $(SRC)/ogg/libogg-wince.patch
endif endif
mv $@-$(OGG_VERSION) $@ $(MOVE)
touch $@
ifeq ($(NEED_OGG),) ifeq ($(NEED_OGG),)
.ogg: .ogg:
......
...@@ -13,9 +13,8 @@ $(TARBALLS)/libshout-$(SHOUT_VERSION).tar.gz: ...@@ -13,9 +13,8 @@ $(TARBALLS)/libshout-$(SHOUT_VERSION).tar.gz:
# TODO: fix socket stuff on POSIX and Linux # TODO: fix socket stuff on POSIX and Linux
libshout: libshout-$(SHOUT_VERSION).tar.gz .sum-shout libshout: libshout-$(SHOUT_VERSION).tar.gz .sum-shout
$(UNPACK) $(UNPACK)
(cd $@-$(SHOUT_VERSION) && patch -p1) < $(SRC)/shout/libshout-win32.patch $(APPLY) $(SRC)/shout/libshout-win32.patch
mv libshout-$(SHOUT_VERSION) $@ $(MOVE)
touch $@
ifdef HAVE_FPU ifdef HAVE_FPU
.shout: .vorbis .shout: .vorbis
......
...@@ -12,8 +12,7 @@ $(TARBALLS)/speex-$(SPEEX_VERSION).tar.gz: ...@@ -12,8 +12,7 @@ $(TARBALLS)/speex-$(SPEEX_VERSION).tar.gz:
speex: speex-$(SPEEX_VERSION).tar.gz .sum-speex speex: speex-$(SPEEX_VERSION).tar.gz .sum-speex
$(UNPACK) $(UNPACK)
mv $@-$(SPEEX_VERSION) $@ $(MOVE)
touch $@
# TODO: fixed point and ASM opts # TODO: fixed point and ASM opts
......
...@@ -13,12 +13,11 @@ $(TARBALLS)/libtheora-$(THEORA_VERSION).tar.xz: ...@@ -13,12 +13,11 @@ $(TARBALLS)/libtheora-$(THEORA_VERSION).tar.xz:
libtheora: libtheora-$(THEORA_VERSION).tar.xz .sum-theora libtheora: libtheora-$(THEORA_VERSION).tar.xz .sum-theora
$(UNPACK) $(UNPACK)
(cd $@-$(THEORA_VERSION) && patch -p1) < $(SRC)/theora/libtheora-includes.patch $(APPLY) $(SRC)/theora/libtheora-includes.patch
ifdef HAVE_WIN64 ifdef HAVE_WIN64
cd $@ && autoreconf -fi -I m4 cd $(UNPACK_DIR) && autoreconf -fi -I m4
endif endif
mv $@-$(THEORA_VERSION) $@ $(MOVE)
touch $@
THEORACONF := $(HOSTCONF) \ THEORACONF := $(HOSTCONF) \
--disable-spec \ --disable-spec \
......
...@@ -16,11 +16,11 @@ $(TARBALLS)/tremor-svn.tar.xz: ...@@ -16,11 +16,11 @@ $(TARBALLS)/tremor-svn.tar.xz:
tremor: tremor-svn.tar.xz .sum-tremor tremor: tremor-svn.tar.xz .sum-tremor
# Stuff that does not depend on libogg # Stuff that does not depend on libogg
$(UNPACK) $(UNPACK)
(cd tremor-svn && patch -p0) < $(SRC)/tremor/tremor.patch $(APPLY) $(SRC)/tremor/tremor.patch
rm -f tremor-svn/ogg.h tremor-svn/os_types.h rm -f tremor-svn/ogg.h tremor-svn/os_types.h
echo '#include <ogg/ogg.h>' > tremor-svn/ogg.h echo '#include <ogg/ogg.h>' > tremor-svn/ogg.h
echo '#include <ogg/os_types.h>' > tremor-svn/os_types.h echo '#include <ogg/os_types.h>' > tremor-svn/os_types.h
mv tremor-svn tremor $(MOVE)
.tremor: tremor .ogg .tremor: tremor .ogg
# Stuff that depends on libogg # Stuff that depends on libogg
......
...@@ -20,8 +20,7 @@ twolame: twolame-$(TWOLAME_VERSION).tar.gz twolame-winutil.h .sum-twolame ...@@ -20,8 +20,7 @@ twolame: twolame-$(TWOLAME_VERSION).tar.gz twolame-winutil.h .sum-twolame
ifdef HAVE_WIN32 ifdef HAVE_WIN32
cp -f $(filter %winutil.h,$^) $@-$(TWOLAME_VERSION)/win32/winutil.h cp -f $(filter %winutil.h,$^) $@-$(TWOLAME_VERSION)/win32/winutil.h
endif endif
mv $@-$(TWOLAME_VERSION) $@ $(MOVE)
touch $@
.twolame: twolame .twolame: twolame
cd $< && $(HOSTVARS) CFLAGS="${CFLAGS} -DLIBTWOLAME_STATIC" ./configure $(HOSTCONF) cd $< && $(HOSTVARS) CFLAGS="${CFLAGS} -DLIBTWOLAME_STATIC" ./configure $(HOSTCONF)
......
...@@ -18,8 +18,7 @@ $(TARBALLS)/libvorbis-$(VORBIS_VERSION).tar.xz: ...@@ -18,8 +18,7 @@ $(TARBALLS)/libvorbis-$(VORBIS_VERSION).tar.xz:
libvorbis: libvorbis-$(VORBIS_VERSION).tar.xz .sum-vorbis libvorbis: libvorbis-$(VORBIS_VERSION).tar.xz .sum-vorbis
$(UNPACK) $(UNPACK)
mv $@-$(VORBIS_VERSION) $@ $(MOVE)
touch $@
.vorbis: libvorbis .ogg .vorbis: libvorbis .ogg
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --disable-docs --disable-examples --disable-oggtest cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --disable-docs --disable-examples --disable-oggtest
......
...@@ -41,10 +41,9 @@ X264_VERSION := git ...@@ -41,10 +41,9 @@ X264_VERSION := git
x264: x264-$(X264_VERSION).tar.xz .sum-x264 x264: x264-$(X264_VERSION).tar.xz .sum-x264
$(UNPACK) $(UNPACK)
ifdef HAVE_WIN64 ifdef HAVE_WIN64
(cd $@-$(X264_VERSION) && patch -p1) < $(SRC)/x264/x264-svn-win64.patch $(APPLY) < $(SRC)/x264/x264-svn-win64.patch
endif endif
mv $@-$(X264_VERSION) $@ $(MOVE)
touch $@
.x264: x264 .x264: x264
cd $< && $(HOSTVARS) ./configure $(X264CONF) cd $< && $(HOSTVARS) ./configure $(X264CONF)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment