mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
c681aaad30
978852aad8e295c26801e17f2ee9e58edd4a5703 build: Fix depends build system when working with subtargets (Hennadii Stepanov) Pull request description: On master (f3e0ace8ecd84009a23da6b0de47f01d79c45772), the depends build system does _not_ guarantee that dependencies packages are available for `$(package)_built` target because these dependencies being prepared in `$(host_prefix)` at `$(package)_configured` target can be wiped out during building other package. Please consider: ``` $ cd depends $ make clean $ make fontconfig_configured $ make ... CC fcdir.lo In file included from fcftint.h:26, from fcdir.c:26: ../fontconfig/fcfreetype.h:27:10: fatal error: ft2build.h: No such file or directory 27 | #include <ft2build.h> | ^~~~~~~~~~~~ compilation terminated. make[4]: *** [Makefile:642: fcdir.lo] Error 1 make[4]: *** Waiting for unfinished jobs.... make[4]: Leaving directory '/home/hebasto/GitHub/bitcoin/depends/work/build/x86_64-pc-linux-gnu/fontconfig/2.12.6-7daa5620c94/src' make[3]: *** [Makefile:503: all] Error 2 make[3]: Leaving directory '/home/hebasto/GitHub/bitcoin/depends/work/build/x86_64-pc-linux-gnu/fontconfig/2.12.6-7daa5620c94/src' make[2]: *** [Makefile:581: all-recursive] Error 1 make[2]: Leaving directory '/home/hebasto/GitHub/bitcoin/depends/work/build/x86_64-pc-linux-gnu/fontconfig/2.12.6-7daa5620c94' make[1]: *** [Makefile:465: all] Error 2 make[1]: Leaving directory '/home/hebasto/GitHub/bitcoin/depends/work/build/x86_64-pc-linux-gnu/fontconfig/2.12.6-7daa5620c94' make: *** [funcs.mk:288: /home/hebasto/GitHub/bitcoin/depends/work/build/x86_64-pc-linux-gnu/fontconfig/2.12.6-7daa5620c94/./.stamp_built] Error 2 ``` The following commands: ``` $ cd depends $ make clean $ make qt_configured $ make ``` also fail. The similar issue was reported earlier: #21381. This PR guarantees that dependencies packages are available for `$(package)_built` target. Guix builds: ``` accef9ffccfe280fec1114c0440092ed5d792e9c53d95abc7fe65435aa136656 guix-build-978852aad8e2/output/aarch64-linux-gnu/SHA256SUMS.part a75f1250975525a21d2e213e23f1f0dab516d2b28d0c7d747de292fe5c906013 guix-build-978852aad8e2/output/aarch64-linux-gnu/bitcoin-978852aad8e2-aarch64-linux-gnu-debug.tar.gz d20787af2e7a14a3b7b1d21e0d8784aa6ebad1e916f02aebfa25afe9229ba43c guix-build-978852aad8e2/output/aarch64-linux-gnu/bitcoin-978852aad8e2-aarch64-linux-gnu.tar.gz 11c94a39c084763858c6de31b221868e52554f5500c0dc5589def429bb6b54c8 guix-build-978852aad8e2/output/arm-linux-gnueabihf/SHA256SUMS.part 3935b0e14d78800977dc813a3824215797096b6fb29c84b5996f48338908a65f guix-build-978852aad8e2/output/arm-linux-gnueabihf/bitcoin-978852aad8e2-arm-linux-gnueabihf-debug.tar.gz c828c3f87a453db443a385a266331661f623f8f4684d88eb006290c83bfa8150 guix-build-978852aad8e2/output/arm-linux-gnueabihf/bitcoin-978852aad8e2-arm-linux-gnueabihf.tar.gz b6ff14e1cc36e568fc726b50300f77498560322b3582738eb70e7144784f7e63 guix-build-978852aad8e2/output/arm64-apple-darwin/SHA256SUMS.part 2a3e6ba5843eaf9562e9dcfdb4595024a71738079cea00e391558feca4d5bde1 guix-build-978852aad8e2/output/arm64-apple-darwin/bitcoin-978852aad8e2-arm64-apple-darwin-unsigned.dmg ffd2ad39e8b9f95dd714513ba1e1c77666b0f3cc4b67be4ab763ebd431fe9276 guix-build-978852aad8e2/output/arm64-apple-darwin/bitcoin-978852aad8e2-arm64-apple-darwin-unsigned.tar.gz 5c9f8acd1777effc1e860b64143ba9d06ba5e3d0330e7341529eeae5cc6b3c5e guix-build-978852aad8e2/output/arm64-apple-darwin/bitcoin-978852aad8e2-arm64-apple-darwin.tar.gz e34c693ecef6159c57fdedabff9dc3d69ec20387966083b828532c58e1e6e30b guix-build-978852aad8e2/output/dist-archive/bitcoin-978852aad8e2.tar.gz 8de4681114d96425bf9b0ccc47d49f696293ead514faa3fa83ddcccfdca2eeb2 guix-build-978852aad8e2/output/powerpc64-linux-gnu/SHA256SUMS.part d780330a105931eb4c66a536c332eb09e4b6d8c288832bb5a74b931c4600c0b3 guix-build-978852aad8e2/output/powerpc64-linux-gnu/bitcoin-978852aad8e2-powerpc64-linux-gnu-debug.tar.gz af036a6d714ef362a2facfe4e5c63deaa9dfa391d20542ead9ffb4a43b2b7ca2 guix-build-978852aad8e2/output/powerpc64-linux-gnu/bitcoin-978852aad8e2-powerpc64-linux-gnu.tar.gz dc6b4365632e7de386ead512b1cdcdd3c985623f63cff8b62974bd9ed8c05d5d guix-build-978852aad8e2/output/powerpc64le-linux-gnu/SHA256SUMS.part 5543a6dec58515186b71139a4a5c603d85638672f205e7c9fabb281c98018461 guix-build-978852aad8e2/output/powerpc64le-linux-gnu/bitcoin-978852aad8e2-powerpc64le-linux-gnu-debug.tar.gz dd791be2e61ce6cbd3e14c165ce2f8c2d22881992e0df72bd338423d092cc467 guix-build-978852aad8e2/output/powerpc64le-linux-gnu/bitcoin-978852aad8e2-powerpc64le-linux-gnu.tar.gz 2b740db8e5b9c435be3e7b186c3b4a40885302243326ec990e24fe4ba4f777da guix-build-978852aad8e2/output/riscv64-linux-gnu/SHA256SUMS.part de899c89874d4f34afeca179a6c7c8f49b0a975983ab2b31afd9f2d365674578 guix-build-978852aad8e2/output/riscv64-linux-gnu/bitcoin-978852aad8e2-riscv64-linux-gnu-debug.tar.gz 9052b1db22c56692d99a61c3783b36c6f76537d9aec14f17d87a155beac82532 guix-build-978852aad8e2/output/riscv64-linux-gnu/bitcoin-978852aad8e2-riscv64-linux-gnu.tar.gz 5e79ddf57a94c5978ad819896786107f735d5742bbd042c2c64ae2d0681ce53a guix-build-978852aad8e2/output/x86_64-apple-darwin/SHA256SUMS.part 96443ad839f87c723db1c0a96d8ead0afc69e9d96ad45b5814344866da2dae73 guix-build-978852aad8e2/output/x86_64-apple-darwin/bitcoin-978852aad8e2-x86_64-apple-darwin-unsigned.dmg 14b0a3081772e81a463398a2702aca039d2f276e301dee9f5a0ccffbb09e2749 guix-build-978852aad8e2/output/x86_64-apple-darwin/bitcoin-978852aad8e2-x86_64-apple-darwin-unsigned.tar.gz 6bfb8252524202028308267f5e96bc30f284052f5feaa58ed3697dde27a3130f guix-build-978852aad8e2/output/x86_64-apple-darwin/bitcoin-978852aad8e2-x86_64-apple-darwin.tar.gz 5f8ea6297e246b08ffd806913897cc863feeec6522fcfb4456a59c5f154e0c2d guix-build-978852aad8e2/output/x86_64-linux-gnu/SHA256SUMS.part 40d1bcf491660d54fe20b2db24828ebf61be848eefdc38fba09ed43f6bdba4b1 guix-build-978852aad8e2/output/x86_64-linux-gnu/bitcoin-978852aad8e2-x86_64-linux-gnu-debug.tar.gz 3200e67a4dea115e8e341b4d71d84dc5e8bd2ae35e550cde6aef88d120c65eae guix-build-978852aad8e2/output/x86_64-linux-gnu/bitcoin-978852aad8e2-x86_64-linux-gnu.tar.gz 0b0bf7effc493ecc68398f23fc81647f64fdee115e8ccd7ae91e7881804ec328 guix-build-978852aad8e2/output/x86_64-w64-mingw32/SHA256SUMS.part e2064c9ddeb4af18468f37ba8cf70004062c31e1387b4cc0fe4b445fae518e8d guix-build-978852aad8e2/output/x86_64-w64-mingw32/bitcoin-978852aad8e2-win64-debug.zip be347a901b896e0a1dc2f0f5a7f84614075805cccf1f2af8ec8df678d086fdbc guix-build-978852aad8e2/output/x86_64-w64-mingw32/bitcoin-978852aad8e2-win64-setup-unsigned.exe bab8700e9e266970e8c7cad494902058ad12d1f2a6462e0039daa637b1a0ce0d guix-build-978852aad8e2/output/x86_64-w64-mingw32/bitcoin-978852aad8e2-win64-unsigned.tar.gz c8e55e64b248fd7c9056fe811a1eba992bbb92e44857204e3024416d9ba6307d guix-build-978852aad8e2/output/x86_64-w64-mingw32/bitcoin-978852aad8e2-win64.zip ``` ACKs for top commit: TheCharlatan: tACK 978852aad8e295c26801e17f2ee9e58edd4a5703 Tree-SHA512: c195484274433039e327d44b1949afa296e09e7470a2b138b7a8476c8bf9c1302bc21284cd5436f09aa97824aae9f362b7932ff2937b78f79df0b43e50f3dfaa
298 lines
14 KiB
Makefile
298 lines
14 KiB
Makefile
define int_vars
|
|
#Set defaults for vars which may be overridden per-package
|
|
$(1)_cc=$$($$($(1)_type)_CC)
|
|
$(1)_cxx=$$($$($(1)_type)_CXX)
|
|
$(1)_objc=$$($$($(1)_type)_OBJC)
|
|
$(1)_objcxx=$$($$($(1)_type)_OBJCXX)
|
|
$(1)_ar=$$($$($(1)_type)_AR)
|
|
$(1)_ranlib=$$($$($(1)_type)_RANLIB)
|
|
$(1)_libtool=$$($$($(1)_type)_LIBTOOL)
|
|
$(1)_nm=$$($$($(1)_type)_NM)
|
|
$(1)_cflags=$$($$($(1)_type)_CFLAGS) \
|
|
$$($$($(1)_type)_$$(release_type)_CFLAGS)
|
|
$(1)_cxxflags=$$($$($(1)_type)_CXXFLAGS) \
|
|
$$($$($(1)_type)_$$(release_type)_CXXFLAGS)
|
|
$(1)_ldflags=$$($$($(1)_type)_LDFLAGS) \
|
|
$$($$($(1)_type)_$$(release_type)_LDFLAGS) \
|
|
-L$$($($(1)_type)_prefix)/lib
|
|
$(1)_cppflags=$$($$($(1)_type)_CPPFLAGS) \
|
|
$$($$($(1)_type)_$$(release_type)_CPPFLAGS) \
|
|
-I$$($$($(1)_type)_prefix)/include
|
|
$(1)_recipe_hash:=
|
|
endef
|
|
|
|
define int_get_all_dependencies
|
|
$(sort $(foreach dep,$(2),$(2) $(call int_get_all_dependencies,$(1),$($(dep)_dependencies))))
|
|
endef
|
|
|
|
define fetch_file_inner
|
|
( mkdir -p $$($(1)_download_dir) && echo Fetching $(3) from $(2) && \
|
|
$(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" && \
|
|
echo "$(5) $$($(1)_download_dir)/$(4).temp" > $$($(1)_download_dir)/.$(4).hash && \
|
|
$(build_SHA256SUM) -c $$($(1)_download_dir)/.$(4).hash && \
|
|
mv $$($(1)_download_dir)/$(4).temp $$($(1)_source_dir)/$(4) && \
|
|
rm -rf $$($(1)_download_dir) )
|
|
endef
|
|
|
|
define fetch_file
|
|
( test -f $$($(1)_source_dir)/$(4) || \
|
|
( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \
|
|
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5))))
|
|
endef
|
|
|
|
define int_get_build_recipe_hash
|
|
$(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches)) | cut -d" " -f1))
|
|
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM) | cut -d" " -f1))
|
|
endef
|
|
|
|
define int_get_build_id
|
|
$(eval $(1)_dependencies += $($(1)_$(host_arch)_$(host_os)_dependencies) $($(1)_$(host_os)_dependencies))
|
|
$(eval $(1)_all_dependencies:=$(call int_get_all_dependencies,$(1),$($($(1)_type)_native_toolchain) $($($(1)_type)_native_binutils) $($(1)_dependencies)))
|
|
$(foreach dep,$($(1)_all_dependencies),$(eval $(1)_build_id_deps+=$(dep)-$($(dep)_version)-$($(dep)_recipe_hash)))
|
|
$(eval $(1)_build_id_long:=$(1)-$($(1)_version)-$($(1)_recipe_hash)-$(release_type) $($(1)_build_id_deps) $($($(1)_type)_id))
|
|
$(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)))
|
|
final_build_id_long+=$($(package)_build_id_long)
|
|
|
|
#compute package-specific paths
|
|
$(1)_build_subdir?=.
|
|
$(1)_download_file?=$($(1)_file_name)
|
|
$(1)_source_dir:=$(SOURCES_PATH)
|
|
$(1)_source:=$$($(1)_source_dir)/$($(1)_file_name)
|
|
$(1)_staging_dir=$(base_staging_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)
|
|
$(1)_staging_prefix_dir:=$$($(1)_staging_dir)$($($(1)_type)_prefix)
|
|
$(1)_extract_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)
|
|
$(1)_download_dir:=$(base_download_dir)/$(1)-$($(1)_version)
|
|
$(1)_build_dir:=$$($(1)_extract_dir)/$$($(1)_build_subdir)
|
|
$(1)_cached_checksum:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz.hash
|
|
$(1)_patch_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)/.patches-$($(1)_build_id)
|
|
$(1)_prefixbin:=$($($(1)_type)_prefix)/bin/
|
|
$(1)_cached:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz
|
|
$(1)_build_log:=$(BASEDIR)/$(1)-$($(1)_version)-$($(1)_build_id).log
|
|
$(1)_all_sources=$($(1)_file_name) $($(1)_extra_sources)
|
|
|
|
#stamps
|
|
$(1)_fetched=$(SOURCES_PATH)/download-stamps/.stamp_fetched-$(1)-$($(1)_file_name).hash
|
|
$(1)_extracted=$$($(1)_extract_dir)/.stamp_extracted
|
|
$(1)_preprocessed=$$($(1)_extract_dir)/.stamp_preprocessed
|
|
$(1)_cleaned=$$($(1)_extract_dir)/.stamp_cleaned
|
|
$(1)_built=$$($(1)_build_dir)/.stamp_built
|
|
$(1)_configured=$(host_prefix)/.$(1)_stamp_configured
|
|
$(1)_staged=$$($(1)_staging_dir)/.stamp_staged
|
|
$(1)_postprocessed=$$($(1)_staging_prefix_dir)/.stamp_postprocessed
|
|
$(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
|
|
|
|
|
|
#default commands
|
|
# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior
|
|
$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash))
|
|
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_TAR) --no-same-owner --strip-components=1 -xf $$($(1)_source)
|
|
$(1)_preprocess_cmds ?= true
|
|
$(1)_build_cmds ?= true
|
|
$(1)_config_cmds ?= true
|
|
$(1)_stage_cmds ?= true
|
|
$(1)_set_vars ?=
|
|
|
|
|
|
all_sources+=$$($(1)_fetched)
|
|
endef
|
|
#$(foreach dep_target,$($(1)_all_dependencies),$(eval $(1)_dependency_targets=$($(dep_target)_cached)))
|
|
|
|
|
|
define int_config_attach_build_config
|
|
$(eval $(call $(1)_set_vars,$(1)))
|
|
$(1)_cflags+=$($(1)_cflags_$(release_type))
|
|
$(1)_cflags+=$($(1)_cflags_$(host_arch)) $($(1)_cflags_$(host_arch)_$(release_type))
|
|
$(1)_cflags+=$($(1)_cflags_$(host_os)) $($(1)_cflags_$(host_os)_$(release_type))
|
|
$(1)_cflags+=$($(1)_cflags_$(host_arch)_$(host_os)) $($(1)_cflags_$(host_arch)_$(host_os)_$(release_type))
|
|
|
|
$(1)_cxxflags+=$($(1)_cxxflags_$(release_type))
|
|
$(1)_cxxflags+=$($(1)_cxxflags_$(host_arch)) $($(1)_cxxflags_$(host_arch)_$(release_type))
|
|
$(1)_cxxflags+=$($(1)_cxxflags_$(host_os)) $($(1)_cxxflags_$(host_os)_$(release_type))
|
|
$(1)_cxxflags+=$($(1)_cxxflags_$(host_arch)_$(host_os)) $($(1)_cxxflags_$(host_arch)_$(host_os)_$(release_type))
|
|
|
|
$(1)_cppflags+=$($(1)_cppflags_$(release_type))
|
|
$(1)_cppflags+=$($(1)_cppflags_$(host_arch)) $($(1)_cppflags_$(host_arch)_$(release_type))
|
|
$(1)_cppflags+=$($(1)_cppflags_$(host_os)) $($(1)_cppflags_$(host_os)_$(release_type))
|
|
$(1)_cppflags+=$($(1)_cppflags_$(host_arch)_$(host_os)) $($(1)_cppflags_$(host_arch)_$(host_os)_$(release_type))
|
|
|
|
$(1)_ldflags+=$($(1)_ldflags_$(release_type))
|
|
$(1)_ldflags+=$($(1)_ldflags_$(host_arch)) $($(1)_ldflags_$(host_arch)_$(release_type))
|
|
$(1)_ldflags+=$($(1)_ldflags_$(host_os)) $($(1)_ldflags_$(host_os)_$(release_type))
|
|
$(1)_ldflags+=$($(1)_ldflags_$(host_arch)_$(host_os)) $($(1)_ldflags_$(host_arch)_$(host_os)_$(release_type))
|
|
|
|
$(1)_build_opts+=$$($(1)_build_opts_$(release_type))
|
|
$(1)_build_opts+=$$($(1)_build_opts_$(host_arch)) $$($(1)_build_opts_$(host_arch)_$(release_type))
|
|
$(1)_build_opts+=$$($(1)_build_opts_$(host_os)) $$($(1)_build_opts_$(host_os)_$(release_type))
|
|
$(1)_build_opts+=$$($(1)_build_opts_$(host_arch)_$(host_os)) $$($(1)_build_opts_$(host_arch)_$(host_os)_$(release_type))
|
|
|
|
$(1)_config_opts+=$$($(1)_config_opts_$(release_type))
|
|
$(1)_config_opts+=$$($(1)_config_opts_$(host_arch)) $$($(1)_config_opts_$(host_arch)_$(release_type))
|
|
$(1)_config_opts+=$$($(1)_config_opts_$(host_os)) $$($(1)_config_opts_$(host_os)_$(release_type))
|
|
$(1)_config_opts+=$$($(1)_config_opts_$(host_arch)_$(host_os)) $$($(1)_config_opts_$(host_arch)_$(host_os)_$(release_type))
|
|
|
|
$(1)_config_env+=$$($(1)_config_env_$(release_type))
|
|
$(1)_config_env+=$($(1)_config_env_$(host_arch)) $($(1)_config_env_$(host_arch)_$(release_type))
|
|
$(1)_config_env+=$($(1)_config_env_$(host_os)) $($(1)_config_env_$(host_os)_$(release_type))
|
|
$(1)_config_env+=$($(1)_config_env_$(host_arch)_$(host_os)) $($(1)_config_env_$(host_arch)_$(host_os)_$(release_type))
|
|
|
|
$(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig
|
|
$(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig
|
|
$(1)_config_env+=PKG_CONFIG_SYSROOT_DIR=/
|
|
$(1)_config_env+=CMAKE_MODULE_PATH=$($($(1)_type)_prefix)/lib/cmake
|
|
$(1)_config_env+=PATH=$(build_prefix)/bin:$(PATH)
|
|
$(1)_build_env+=PATH=$(build_prefix)/bin:$(PATH)
|
|
$(1)_stage_env+=PATH=$(build_prefix)/bin:$(PATH)
|
|
|
|
# Setting a --build type that differs from --host will explicitly enable
|
|
# cross-compilation mode. Note that --build defaults to the output of
|
|
# config.guess, which is what we set it too here. This also quells autoconf
|
|
# warnings, "If you wanted to set the --build type, don't use --host.",
|
|
# when using versions older than 2.70.
|
|
$(1)_autoconf=./configure --build=$(BUILD) --host=$($($(1)_type)_host) --prefix=$($($(1)_type)_prefix) --with-pic $$($(1)_config_opts) CC="$$($(1)_cc)" CXX="$$($(1)_cxx)"
|
|
ifneq ($($(1)_nm),)
|
|
$(1)_autoconf += NM="$$($(1)_nm)"
|
|
endif
|
|
ifneq ($($(1)_ranlib),)
|
|
$(1)_autoconf += RANLIB="$$($(1)_ranlib)"
|
|
endif
|
|
ifneq ($($(1)_ar),)
|
|
$(1)_autoconf += AR="$$($(1)_ar)"
|
|
endif
|
|
ifneq ($($(1)_cflags),)
|
|
$(1)_autoconf += CFLAGS="$$($(1)_cflags)"
|
|
endif
|
|
ifneq ($($(1)_cxxflags),)
|
|
$(1)_autoconf += CXXFLAGS="$$($(1)_cxxflags)"
|
|
endif
|
|
ifneq ($($(1)_cppflags),)
|
|
$(1)_autoconf += CPPFLAGS="$$($(1)_cppflags)"
|
|
endif
|
|
ifneq ($($(1)_ldflags),)
|
|
$(1)_autoconf += LDFLAGS="$$($(1)_ldflags)"
|
|
endif
|
|
|
|
# We hardcode the library install path to "lib" to match the PKG_CONFIG_PATH
|
|
# setting in depends/config.site.in, which also hardcodes "lib".
|
|
# Without this setting, CMake by default would use the OS library
|
|
# directory, which might be "lib64" or something else, not "lib", on multiarch systems.
|
|
$(1)_cmake=env CC="$$($(1)_cc)" \
|
|
CFLAGS="$$($(1)_cppflags) $$($(1)_cflags)" \
|
|
CXX="$$($(1)_cxx)" \
|
|
CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \
|
|
LDFLAGS="$$($(1)_ldflags)" \
|
|
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" \
|
|
-DCMAKE_INSTALL_LIBDIR=lib/ \
|
|
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
|
$$($(1)_config_opts)
|
|
ifeq ($($(1)_type),build)
|
|
$(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib"
|
|
else
|
|
ifneq ($(host),$(build))
|
|
$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system)
|
|
$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host)
|
|
$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host)
|
|
endif
|
|
endif
|
|
endef
|
|
|
|
define int_add_cmds
|
|
ifneq ($(LOG),)
|
|
$(1)_logging = >>$$($(1)_build_log) 2>&1 || { if test -f $$($(1)_build_log); then cat $$($(1)_build_log); fi; exit 1; }
|
|
endif
|
|
|
|
$($(1)_fetched):
|
|
mkdir -p $$(@D) $(SOURCES_PATH)
|
|
rm -f $$@
|
|
touch $$@
|
|
cd $$(@D); $($(1)_fetch_cmds)
|
|
cd $($(1)_source_dir); $(foreach source,$($(1)_all_sources),$(build_SHA256SUM) $(source) >> $$(@);)
|
|
touch $$@
|
|
$($(1)_extracted): | $($(1)_fetched)
|
|
echo Extracting $(1)...
|
|
mkdir -p $$(@D)
|
|
cd $$(@D); $($(1)_extract_cmds)
|
|
touch $$@
|
|
$($(1)_preprocessed): | $($(1)_extracted)
|
|
echo Preprocessing $(1)...
|
|
mkdir -p $$(@D) $($(1)_patch_dir)
|
|
$(foreach patch,$($(1)_patches),cd $(PATCHES_PATH)/$(1); cp $(patch) $($(1)_patch_dir) ;)
|
|
{ cd $$(@D); $($(1)_preprocess_cmds); } $$($(1)_logging)
|
|
touch $$@
|
|
$($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed)
|
|
echo Configuring $(1)...
|
|
rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), $(build_TAR) --no-same-owner -xf $($(package)_cached); )
|
|
mkdir -p $$($(1)_build_dir)
|
|
+{ cd $$($(1)_build_dir); export $($(1)_config_env); $($(1)_config_cmds); } $$($(1)_logging)
|
|
touch $$@
|
|
$($(1)_built): | $($(1)_configured)
|
|
echo Building $(1)...
|
|
mkdir -p $$(@D)
|
|
+{ cd $$(@D); export $($(1)_build_env); $($(1)_build_cmds); } $$($(1)_logging)
|
|
touch $$@
|
|
$($(1)_staged): | $($(1)_built)
|
|
echo Staging $(1)...
|
|
mkdir -p $($(1)_staging_dir)/$(host_prefix)
|
|
+{ cd $($(1)_build_dir); export $($(1)_stage_env); $($(1)_stage_cmds); } $$($(1)_logging)
|
|
rm -rf $($(1)_extract_dir)
|
|
touch $$@
|
|
$($(1)_postprocessed): | $($(1)_staged)
|
|
echo Postprocessing $(1)...
|
|
cd $($(1)_staging_prefix_dir); $($(1)_postprocess_cmds)
|
|
touch $$@
|
|
$($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed)
|
|
echo Caching $(1)...
|
|
cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | $(build_TAR) --no-recursion -czf $$($(1)_staging_dir)/$$(@F) -T -
|
|
mkdir -p $$(@D)
|
|
rm -rf $$(@D) && mkdir -p $$(@D)
|
|
mv $$($(1)_staging_dir)/$$(@F) $$(@)
|
|
rm -rf $($(1)_staging_dir)
|
|
if test -f $($(1)_build_log); then mv $($(1)_build_log) $$(@D); fi
|
|
$($(1)_cached_checksum): $($(1)_cached)
|
|
cd $$(@D); $(build_SHA256SUM) $$(<F) > $$(@)
|
|
|
|
.PHONY: $(1)
|
|
$(1): | $($(1)_cached_checksum)
|
|
.SECONDARY: $($(1)_cached) $($(1)_postprocessed) $($(1)_staged) $($(1)_built) $($(1)_configured) $($(1)_preprocessed) $($(1)_extracted) $($(1)_fetched)
|
|
|
|
endef
|
|
|
|
stages = fetched extracted preprocessed configured built staged postprocessed cached cached_checksum
|
|
|
|
define ext_add_stages
|
|
$(foreach stage,$(stages),
|
|
$(1)_$(stage): $($(1)_$(stage))
|
|
.PHONY: $(1)_$(stage))
|
|
endef
|
|
|
|
# These functions create the build targets for each package. They must be
|
|
# broken down into small steps so that each part is done for all packages
|
|
# before moving on to the next step. Otherwise, a package's info
|
|
# (build-id for example) would only be available to another package if it
|
|
# happened to be computed already.
|
|
|
|
#set the type for host/build packages.
|
|
$(foreach native_package,$(native_packages),$(eval $(native_package)_type=build))
|
|
$(foreach package,$(packages),$(eval $(package)_type=$(host_arch)_$(host_os)))
|
|
|
|
#set overridable defaults
|
|
$(foreach package,$(all_packages),$(eval $(call int_vars,$(package))))
|
|
|
|
#include package files
|
|
$(foreach native_package,$(native_packages),$(eval include packages/$(native_package).mk))
|
|
$(foreach package,$(packages),$(eval include packages/$(package).mk))
|
|
|
|
#compute a hash of all files that comprise this package's build recipe
|
|
$(foreach package,$(all_packages),$(eval $(call int_get_build_recipe_hash,$(package))))
|
|
|
|
#generate a unique id for this package, incorporating its dependencies as well
|
|
$(foreach package,$(all_packages),$(eval $(call int_get_build_id,$(package))))
|
|
|
|
#compute final vars after reading package vars
|
|
$(foreach package,$(all_packages),$(eval $(call int_config_attach_build_config,$(package))))
|
|
|
|
#create build targets
|
|
$(foreach package,$(all_packages),$(eval $(call int_add_cmds,$(package))))
|
|
|
|
#special exception: if a toolchain package exists, all non-native packages depend on it
|
|
$(foreach package,$(packages),$(eval $($(package)_extracted): |$($($(host_arch)_$(host_os)_native_toolchain)_cached) $($($(host_arch)_$(host_os)_native_binutils)_cached) ))
|