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