Skip to content
Snippets Groups Projects
Commit 6fa37b57 authored by Luke Shumaker's avatar Luke Shumaker Committed by Guillaume Roguez
Browse files

contrib: recursive dependency tracking


Let's say we're building gnutls (since the system version is too new).
gnutls depends on nettle.
Let's say we're using the system nettle (naturally in FOUND_PKGS).
nettle depends on gmp.

With the old (non-recursive) dependency tracking, we would end up building
gmp just for nettle, even though we aren't even building nettle!

Change-Id: I24e6f59416839ea202e0aceafe101432fe9c2646
Reviewed-by: default avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 25f7464d
Branches
No related tags found
No related merge requests found
...@@ -92,18 +92,12 @@ Dependencies ...@@ -92,18 +92,12 @@ Dependencies
If package bar depends on package foo, the special DEPS_bar variable If package bar depends on package foo, the special DEPS_bar variable
should be defined as follow: should be defined as follow:
DEPS_bar = foo $(DEPS_foo) DEPS_bar = foo
Note that dependency resolution is unfortunately _not_ recursive. Dependency resolution is recursive (unlike in previous versions); the
Therefore $(DEPS_foo) really should be specified explicitly as shown above will cause bar to also depend on the dependencies of foo. It is
above. (In practice, this will not make any difference insofar as there illegal to have a dependency cycle, and an error will be emitted if
are no pure second-level nested dependencies. For instance, libass one is created.
depends on FontConfig, which depends on FreeType, but libass depends
directly on FreeType anyway.)
Also note that DEPS_bar is set "recursively" with =, rather than
"immediately" with :=. This is so that $(DEPS_foo) is expanded
correctly, even if DEPS_foo it is defined after DEPS_bar.
Implementation note: Implementation note:
......
...@@ -11,7 +11,7 @@ ifeq ($(call need_pkg,"libavutil >= 55.75.100 libavcodec >= 57.106.101 libavform ...@@ -11,7 +11,7 @@ ifeq ($(call need_pkg,"libavutil >= 55.75.100 libavcodec >= 57.106.101 libavform
PKGS_FOUND += ffmpeg PKGS_FOUND += ffmpeg
endif endif
DEPS_ffmpeg = iconv zlib x264 vpx opus speex $(DEPS_vpx) DEPS_ffmpeg = iconv zlib x264 vpx opus speex
FFMPEGCONF = \ FFMPEGCONF = \
--cc="$(CC)" \ --cc="$(CC)" \
......
...@@ -47,7 +47,7 @@ FLACCONF += --disable-asm-optimizations ...@@ -47,7 +47,7 @@ FLACCONF += --disable-asm-optimizations
endif endif
endif endif
DEPS_flac = ogg $(DEPS_ogg) DEPS_flac = ogg
.flac: flac .flac: flac
cd $< && $(HOSTVARS) ./configure $(FLACCONF) cd $< && $(HOSTVARS) ./configure $(FLACCONF)
......
...@@ -60,7 +60,7 @@ ifdef HAVE_IOS ...@@ -60,7 +60,7 @@ ifdef HAVE_IOS
GNUTLS_CONF += --disable-hardware-acceleration GNUTLS_CONF += --disable-hardware-acceleration
endif endif
DEPS_gnutls = nettle $(DEPS_nettle) iconv $(DEPS_iconv) DEPS_gnutls = nettle iconv
#Workaround for localtime_r function #Workaround for localtime_r function
......
...@@ -391,7 +391,10 @@ PKGS_AUTOMATIC := $(filter-out $(PKGS_FOUND),$(PKGS)) ...@@ -391,7 +391,10 @@ PKGS_AUTOMATIC := $(filter-out $(PKGS_FOUND),$(PKGS))
# Apply manual selection (from bootstrap): # Apply manual selection (from bootstrap):
PKGS_MANUAL := $(sort $(PKGS_ENABLE) $(filter-out $(PKGS_DISABLE),$(PKGS_AUTOMATIC))) PKGS_MANUAL := $(sort $(PKGS_ENABLE) $(filter-out $(PKGS_DISABLE),$(PKGS_AUTOMATIC)))
# Resolve dependencies: # Resolve dependencies:
PKGS_DEPS := $(filter-out $(PKGS_FOUND) $(PKGS_MANUAL),$(sort $(foreach p,$(PKGS_MANUAL),$(DEPS_$(p))))) dep_on = $(if $(filter $1,$2),\
$(error Dependency cycle detected: $(patsubst %,% ->,$2) $(filter $1,$2)),\
$(sort $(foreach p,$(filter-out $(PKGS_FOUND),$(1)),$(p) $(call dep_on,$(DEPS_$(p)),$2 $(p)))))
PKGS_DEPS := $(call dep_on,$(PKGS_MANUAL))
PKGS := $(sort $(PKGS_MANUAL) $(PKGS_DEPS)) PKGS := $(sort $(PKGS_MANUAL) $(PKGS_DEPS))
convert-static: convert-static:
......
...@@ -19,7 +19,7 @@ nettle: nettle-$(NETTLE_VERSION).tar.gz .sum-nettle ...@@ -19,7 +19,7 @@ nettle: nettle-$(NETTLE_VERSION).tar.gz .sum-nettle
$(UPDATE_AUTOCONFIG) $(UPDATE_AUTOCONFIG)
$(MOVE) $(MOVE)
DEPS_nettle = gmp $(DEPS_gmp) DEPS_nettle = gmp
.nettle: nettle .nettle: nettle
ifdef HAVE_IOS ifdef HAVE_IOS
......
...@@ -15,7 +15,7 @@ ifneq ($(call need_pkg,"libargon2"),) ...@@ -15,7 +15,7 @@ ifneq ($(call need_pkg,"libargon2"),)
DEPS_opendht += argon2 DEPS_opendht += argon2
endif endif
ifneq ($(call need_pkg,"gnutls >= 3.3.0"),) ifneq ($(call need_pkg,"gnutls >= 3.3.0"),)
DEPS_opendht += gnutls $(DEPS_gnutls) DEPS_opendht += gnutls
endif endif
$(TARBALLS)/opendht-$(OPENDHT_VERSION).tar.gz: $(TARBALLS)/opendht-$(OPENDHT_VERSION).tar.gz:
......
...@@ -7,7 +7,7 @@ PKGS += secp256k1 ...@@ -7,7 +7,7 @@ PKGS += secp256k1
ifeq ($(call need_pkg,"libsecp256k1"),) ifeq ($(call need_pkg,"libsecp256k1"),)
PKGS_FOUND += secp256k1 PKGS_FOUND += secp256k1
endif endif
DEPS_secp256k1 = gmp $(DEPS_gmp) DEPS_secp256k1 = gmp
$(TARBALLS)/secp256k1-$(SECP256K1_VERSION).tar.gz: $(TARBALLS)/secp256k1-$(SECP256K1_VERSION).tar.gz:
$(call download,$(SECP256K1_URL)) $(call download,$(SECP256K1_URL))
......
...@@ -36,7 +36,7 @@ endif ...@@ -36,7 +36,7 @@ endif
$(UPDATE_AUTOCONFIG) $(UPDATE_AUTOCONFIG)
$(MOVE) $(MOVE)
DEPS_vorbis = ogg $(DEPS_ogg) DEPS_vorbis = ogg
.vorbis: vorbis .vorbis: vorbis
$(RECONF) -Im4 $(RECONF) -Im4
...@@ -47,7 +47,7 @@ DEPS_vorbis = ogg $(DEPS_ogg) ...@@ -47,7 +47,7 @@ DEPS_vorbis = ogg $(DEPS_ogg)
.sum-vorbisenc: .sum-vorbis .sum-vorbisenc: .sum-vorbis
touch $@ touch $@
DEPS_vorbisenc = vorbis $(DEPS_vorbis) DEPS_vorbisenc = vorbis
.vorbisenc: .vorbisenc:
touch $@ touch $@
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment