Commit 2bed93ef authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

contrib: rethink package dependencies

'make fetch' has to fetch sources for all the built packages,
including dependency packages. Conversely, 'make fetch' should not
fetch sources of distro-provided packages, not even dependencies.
This should fix that.

As an minor bonus, 'make .foo' should now work even if foo is
provided by the distro, and conditional build rules should be cleaner.
parent 0b6bd5e1
......@@ -13,7 +13,9 @@ libass: libass-$(ASS_VERSION).tar.gz .sum-ass
$(UNPACK)
$(MOVE)
.ass: libass .freetype2 .fontconfig
DEPS_ass = freetype2 $(DEPS_freetype2) fontconfig $(DEPS_fontconfig)
.ass: libass
#$(RECONF)
cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) -O3" ./configure $(HOSTCONF) --disable-png --disable-enca
cd $< && $(MAKE) install
......
......@@ -5,7 +5,6 @@ FFMPEG_URL=$(SF)/ffmpeg/ffmpeg-$(FFMPEG_VERSION).tar.gz
FFMPEG_SVN=svn://svn.ffmpeg.org/ffmpeg/trunk
FFMPEG_SVN_REV=26400
FFMPEGCONF = --cc="$(CC)" \
--disable-doc \
--disable-decoder=libvpx \
......@@ -20,29 +19,27 @@ FFMPEGCONF = --cc="$(CC)" \
--disable-protocols \
--disable-avfilter \
--disable-network
DEPS_ffmpeg = zlib
# Optional dependencies
ifdef BUILD_ENCODERS
# TODO:
#FFMPEGCONF+= --enable-libmp3lame
#.ffmpeg: .lame
#PKGS += lame
#FFMPEGCONF += --enable-libmp3lame
#DEPS_ffmpeg += lame $(DEPS_lame)
else
FFMPEGCONF += --disable-encoders --disable-muxers
# XXX: REVISIT --enable-small ?
endif
#FFMPEGCONF+= --enable-libgsm
#.ffmpeg: .gsm
#PKGS += gsm
#FFMPEGCONF += --enable-libgsm
#DEPS_ffmpeg += gsm $(DEPS_gsm)
#FFMPEGCONF += --enable-libvpx
#.ffmpeg: .vpx
#PKGS += vpx
#DEPS_ffmpeg += vpx $(DEPS_vpx)
# XXX: REVISIT
#ifndef HAVE_FPU
#FFMPEGCONF+= --disable-mpegaudio-hp
#FFMPEGCONF += --disable-mpegaudio-hp
#endif
ifdef HAVE_CROSS_COMPILE
......@@ -66,8 +63,7 @@ endif
ifeq ($(ARCH),x86_64)
FFMPEGCONF += --cpu=core2
endif
.ffmpeg: .yasm
PKGS += yasm
DEPS_ffmpeg += yasm $(DEPS_yasm)
endif
# Linux
......@@ -88,8 +84,7 @@ FFMPEGCONF += --disable-dxva2
FFMPEGCONF += --cpu=athlon64 --arch=x86_64
else # !WIN64
FFMPEGCONF += --enable-dxva2
.ffmpeg: .directx
PKGS += directx
DEPS_ffmpeg += directx
FFMPEGCONF+= --cpu=i686 --arch=x86
endif
......@@ -136,7 +131,6 @@ endif
$(MOVE)
.ffmpeg: ffmpeg
# TODO: .zlib
cd $< && $(HOSTVARS) ./configure \
--extra-cflags="$(FFMPEG_CFLAGS) -DHAVE_STDINT_H" \
--extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
......
......@@ -32,7 +32,9 @@ FLAC_DISABLE_FLAGS += --disable-asm-optimizations
endif
endif
.flac: flac .ogg
DEPS_flac = ogg $(DEPS_ogg)
.flac: flac
cd $< && $(HOSTVARS) ./configure $(FLACCONF)
cd $</src && $(MAKE) -C libFLAC install
cd $< && $(MAKE) -C include install
......
......@@ -37,7 +37,9 @@ FONTCONFIG_ENV-$(ENABLED) = $(HOSTCC) LIBXML2_CFLAGS=`$(PREFIX)/bin/xml2
FONTCONFIG_ENV-$(HAVE_MACOSX) = $(HOSTCC) LIBXML2_CFLAGS=`xml2-config --cflags` LIBXML2_LIBS=`xml2-config --libs`
FONTCONFIG_ENV-$(HAVE_WIN32) = $(HOSTCC)
.fontconfig: fontconfig .freetype2 .libxml2
DEPS_fontconfig = freetype2 $(DEPS_freetype2) libxml2 $(DEPS_libxml2)
.fontconfig: fontconfig
ifdef HAVE_WIN32
$(RECONF)
endif
......
......@@ -3,7 +3,10 @@
FREETYPE2_VERSION := 2.4.5
FREETYPE2_URL := $(SF)/freetype/freetype-$(FREETYPE2_VERSION).tar.gz
NEED_FREETYPE2 := $(call need_pkg,"freetype2")
PKGS += freetype2
ifeq ($(call need_pkg,"freetype2"),)
PKGS_FOUND += freetype2
endif
$(TARBALLS)/freetype-$(FREETYPE2_VERSION).tar.gz:
$(call download,$(FREETYPE2_URL))
......@@ -14,13 +17,7 @@ freetype: freetype-$(FREETYPE2_VERSION).tar.gz .sum-freetype2
$(UNPACK)
$(MOVE)
ifeq ($(NEED_FREETYPE2),)
.freetype2:
else
PKGS += freetype2
.freetype2: freetype
cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
cd $< && $(MAKE) install
endif
touch $@
......@@ -14,7 +14,7 @@ fribidi: fribidi-$(FRIBIDI_VERSION).tar.gz .sum-fribidi
$(APPLY) $(SRC)/fribidi/fribidi.patch
$(MOVE)
# fixme .iconv
# FIXME: DEPS_fribidi = iconv $(DEPS_iconv)
.fribidi: fribidi
cd $< && rm -f configure && ./bootstrap
cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
......
......@@ -14,7 +14,9 @@ libkate: libkate-$(KATE_VERSION).tar.gz .sum-kate
$(UNPACK)
$(MOVE)
.kate: libkate .ogg
DEPS_kate = ogg $(DEPS_ogg)
.kate: libkate
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) \
--disable-valgrind \
--disable-doc
......
......@@ -3,7 +3,10 @@
LIBXML2_VERSION := 2.7.8
LIBXML2_URL := http://xmlsoft.org/sources/libxml2-$(LIBXML2_VERSION).tar.gz
NEED_XML2 := $(call need_pkg,"libxml-2.0")
PKGS += libxml2
ifeq ($(call need_pkg,"libxml-2.0"),)
PKGS_FOUND += libxml2
endif
$(TARBALLS)/libxml2-$(LIBXML2_VERSION).tar.gz:
$(call download,$(LIBXML2_URL))
......@@ -16,15 +19,9 @@ libxml2: libxml2-$(LIBXML2_VERSION).tar.gz .sum-libxml2
$(UNPACK)
$(MOVE)
ifeq ($(NEED_XML2),)
.libxml2:
else
PKGS += libxml2
.libxml2: libxml2
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) CFLAGS="-DLIBXML_STATIC" $(XMLCONF)
ifndef HAVE_MACOSX
cd $< && $(MAKE) install
endif
endif
touch $@
......@@ -5,7 +5,7 @@
all: install
ALL_PKGS := $(patsubst ../src/%/rules.mak,%,$(wildcard ../src/*/rules.mak))
PKGS_ALL := $(patsubst ../src/%/rules.mak,%,$(wildcard ../src/*/rules.mak))
SRC := ../src
TARBALLS := ../tarballs
DATE := $(shell date +%Y%m%d)
......@@ -192,6 +192,7 @@ CMAKE = cmake . -DCMAKE_TOOLCHAIN_FILE=$(abspath toolchain.cmake) \
#
# Per-package build rules
#
PKGS_FOUND :=
include ../src/*/rules.mak
#
......@@ -200,14 +201,20 @@ include ../src/*/rules.mak
ifneq ($(filter $(PKGS_DISABLE),$(PKGS_ENABLE)),)
$(error Same package(s) disabled and enabled at the same time)
endif
PKGS := $(filter-out $(PKGS_DISABLE),$(PKGS)) $(PKGS_ENABLE)
# Apply automatic selection (= remove distro packages):
PKGS_AUTOMATIC := $(filter-out $(PKGS_FOUND),$(PKGS))
# Apply manual selection (from bootstrap):
PKGS_MANUAL := $(sort $(PKGS_ENABLE) $(filter-out $(PKGS_DISABLE),$(PKGS_AUTOMATIC)))
# Resolve dependencies:
PKGS_DEPS := $(filter-out $(PKGS_FOUND) $(PKGS_MANUAL),$(sort $(foreach p,$(PKGS_MANUAL),$(DEPS_$(p)))))
PKGS := $(sort $(PKGS_MANUAL) $(PKGS_DEPS))
fetch: $(PKGS:%=.sum-%)
fetch-all: $(ALL_PKGS:%=.sum-%)
fetch-all: $(PKGS_ALL:%=.sum-%)
install: $(PKGS:%=.%)
mostlyclean:
-$(RM) $(ALL_PKGS:%=.%) $(ALL_PKGS:%=.sum-%)
-$(RM) $(foreach p,$(PKGS_ALL),.$(p) .sum-$(p) .dep-$(p))
-$(RM) toolchain.cmake
-$(RM) -R "$(PREFIX)"
-find -maxdepth 1 -type d '!' -name . -exec $(RM) -R '{}' ';'
......@@ -243,8 +250,6 @@ endif
echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> $@
echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> $@
#.SECONDEXPANSION:
# Default pattern rules
.sum-%: $(SRC)/%/SHA512SUMS
$(CHECK_SHA512)
......@@ -253,4 +258,17 @@ endif
.sum-%:
$(error Download and check target not defined for $*)
# Dummy dependency on found packages
$(patsubst %,.dep-%,$(PKGS_FOUND)): .dep-%:
touch $@
# Real dependency on missing packages
$(patsubst %,.dep-%,$(filter-out $(PKGS_FOUND),$(PKGS_ALL))): .dep-%: .%
touch -r $< $@
.SECONDEXPANSION:
# Dependency propagation (convert 'DEPS_foo = bar' to '.foo: .bar')
$(foreach p,$(PKGS_ALL),.$(p)): .%: $$(foreach d,$$(DEPS_$$*),.dep-$$(d))
.DELETE_ON_ERROR:
......@@ -5,6 +5,7 @@ MATROSKA_URL := http://dl.matroska.org/downloads/libmatroska/libmatroska-$(MATRO
#MATROSKA_URL := $(CONTRIB_VIDEOLAN)/libmatroska-$(MATROSKA_VERSION).tar.bz2
PKGS += matroska
DEPS_matroska = ebml $(DEPS_ebml)
$(TARBALLS)/libmatroska-$(MATROSKA_VERSION).tar.bz2:
$(call download,$(MATROSKA_URL))
......@@ -15,7 +16,7 @@ libmatroska: libmatroska-$(MATROSKA_VERSION).tar.bz2 .sum-matroska
$(UNPACK)
$(MOVE)
.matroska: libmatroska .ebml
.matroska: libmatroska
ifdef HAVE_WIN32
cd $< && $(MAKE) -C make/mingw32 prefix="$(PREFIX)" $(HOSTVARS) SHARED=no EBML_DLL=no libmatroska.a
else
......
......@@ -6,7 +6,10 @@ OGG_URL := http://downloads.xiph.org/releases/ogg/libogg-$(OGG_VERSION).tar.xz
#OGG_URL := $(CONTRIB_VIDEOLAN)/libogg-$(OGG_VERSION).tar.xz
OGG_CVSROOT := :pserver:anoncvs@xiph.org:/usr/local/cvsroot
NEED_OGG = $(call need_pkg,"ogg >= 1.0")
PKGS += ogg
ifeq ($(call need_pkg,"ogg >= 1.0"),)
PKGS_FOUND += ogg
endif
$(TARBALLS)/libogg-$(OGG_VERSION).tar.xz:
$(call download,$(OGG_URL))
......@@ -21,14 +24,8 @@ ifdef HAVE_WINCE
endif
$(MOVE)
ifeq ($(NEED_OGG),)
.ogg:
else
PKGS += ogg
.ogg: libogg
#$(RECONF)
cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
cd $< && $(MAKE) install
endif
touch $@
......@@ -4,7 +4,9 @@ ORC_VERSION := 0.4.14
ORC_URL := http://code.entropywave.com/download/orc/orc-$(ORC_VERSION).tar.gz
NEED_ORC = $(call need_pkg,"orc-0.4")
ifeq ($(call need_pkg,"orc-0.4"),)
PKGS_FOUND += orc
endif
$(TARBALLS)/orc-$(ORC_VERSION).tar.gz:
$(call download,$(ORC_URL))
......@@ -16,14 +18,8 @@ orc: orc-$(ORC_VERSION).tar.gz .sum-orc
$(APPLY) $(SRC)/orc/orc-stdint.patch
$(MOVE)
ifeq ($(NEED_ORC),)
.orc:
else
PKGS += orc
.orc: orc
#$(RECONF)
cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
cd $< && $(MAKE) install
endif
touch $@
......@@ -13,7 +13,9 @@ png: libpng-$(PNG_VERSION).tar.bz2 .sum-png
$(UNPACK)
$(MOVE)
.png: png .zlib
DEPS_png = zlib $(DEPS_zlib)
.png: png
$(RECONF)
cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
cd $< && $(MAKE) install
......
......@@ -4,7 +4,9 @@ SCHROEDINGER_VERSION := 1.0.10
SCHROEDINGER_URL := http://diracvideo.org/download/schroedinger/schroedinger-$(SCHROEDINGER_VERSION).tar.gz
NEED_SCHROEDINGER = $(call need_pkg,"schroedinger-1.0")
ifeq ($(call need_pkg,"schroedinger-1.0"),)
PKGS_FOUND += schroedinger
endif
$(TARBALLS)/schroedinger-$(SCHROEDINGER_VERSION).tar.gz:
$(call download,$(SCHROEDINGER_URL))
......@@ -16,14 +18,10 @@ schroedinger: schroedinger-$(SCHROEDINGER_VERSION).tar.gz .sum-schroedinger
$(APPLY) $(SRC)/schroedinger/schroedinger-notests.patch
$(MOVE)
ifeq ($(NEED_SCHROEDINGER),)
.schroedinger:
else
PKGS += schroedinger
DEPS_schroedinger = orc $(DEPS_orc)
.schroedinger: schroedinger
$(RECONF)
cd $< && $(HOSTVARS) ./configure --with-thread=none --disable-gtk-doc $(HOSTCONF)
cd $< && $(MAKE) install
endif
touch $@
......@@ -16,13 +16,14 @@ libshout: libshout-$(SHOUT_VERSION).tar.gz .sum-shout
$(APPLY) $(SRC)/shout/libshout-win32.patch
$(MOVE)
DEPS_shout = ogg $(DEPS_ogg) theora $(DEPS_theora) speex $(DEPS_speex)
ifdef HAVE_FPU
.shout: .vorbis
DEPS_shout += vorbis $(DEPS_vorbis)
else
.shout: .tremor
DEPS_shout += tremor $(DEPS_tremor)
endif
.shout: libshout .theora .ogg .speex
.shout: libshout
cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
cd $< && $(MAKE) install
touch $@
......@@ -37,7 +37,9 @@ ifdef HAVE_WIN64
THEORACONF += --disable-asm
endif
.theora: libtheora .ogg
DEPS_theora = ogg $(DEPS_ogg)
.theora: libtheora
ifdef HAVE_WIN32
$(RECONF)
endif
......
......@@ -17,7 +17,9 @@ libtiger: libtiger-$(TIGER_VERSION).tar.gz .sum-tiger
$(UNPACK)
$(MOVE)
.tiger: libtiger .kate
DEPS_tiger = kate $(DEPS_kate)
.tiger: libtiger
$(RECONF)
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --disable-doc
cd $< && $(MAKE) install
......
......@@ -22,7 +22,9 @@ tremor: tremor-svn.tar.xz .sum-tremor
echo '#include <ogg/os_types.h>' > tremor-svn/os_types.h
$(MOVE)
.tremor: tremor .ogg
DEPS_tremor = ogg $(DEPS_ogg)
.tremor: tremor
# Stuff that depends on libogg
$(RECONF)
cd $< && \
......
......@@ -7,6 +7,7 @@ VORBIS_URL := http://downloads.xiph.org/releases/vorbis/libvorbis-$(VORBIS_VERSI
ifndef HAVE_FPU
PKGS += vorbis
endif
PKGS_ALL += vorbisenc
ifdef BUILD_ENCODERS
PKGS += vorbisenc
endif
......@@ -20,7 +21,9 @@ libvorbis: libvorbis-$(VORBIS_VERSION).tar.xz .sum-vorbis
$(UNPACK)
$(MOVE)
.vorbis: libvorbis .ogg
DEPS_vorbis = ogg $(DEPS_ogg)
.vorbis: libvorbis
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --disable-docs --disable-examples --disable-oggtest
cd $< && $(MAKE) install
touch $@
......@@ -28,5 +31,7 @@ libvorbis: libvorbis-$(VORBIS_VERSION).tar.xz .sum-vorbis
.sum-vorbisenc: .sum-vorbis
touch $@
.vorbisenc: .vorbis
DEPS_vorbisenc = vorbis $(DEPS_vorbis)
.vorbisenc:
touch $@
......@@ -7,6 +7,7 @@ X264_GITURL := git://git.videolan.org/x264.git
ifdef BUILD_ENCODERS
PKGS += x264
endif
DEPS_x264 =
X264CONF = --prefix="$(PREFIX)" --host="$(HOST)" \
--enable-static \
......@@ -22,8 +23,7 @@ endif
ifdef HAVE_MACOSX
ifneq ($(findstring $(ARCH),i386 x86_64),)
PKGS += yasm
.x264: .yasm
DEPS_x264 += yasm
endif
endif
......
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