mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
701f785686
735610940c0cac72343ca247eb3062b2e09512a0 build: set --build when configuring packages in depends (fanquake) Pull request description: After reading [#Specifying-Target-Triplets](https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/autoconf.html#Specifying-Target-Triplets) in the autoconf manuel, my understanding is that this change should mostly be a no-op, as `--build` defaults to the output of [`config.guess`](https://github.com/bitcoin/bitcoin/blob/master/depends/config.guess), however, this may be slightly more correct > For historical reasons, whenever you specify --host, be sure to specify --build too; this will be fixed in the future. and will quell some warnings in depends (#16354), i.e: > configure: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used. If anything, this also explicitly enables cross-compilation mode when `--host` differs from `--build`. As for "fixed in the future", this is the case for Autoconf 2.70+. If we don't make this change, I think we should consider closing #16354. We've now got a good handle on our depends configure flags, and we can just leave the last few warnings as they are. It's also unlikely that we are going to add the `xorg-macros` package to depends. Guix builds at 735610940c0cac72343ca247eb3062b2e09512a0: ```bash bash-5.1# find output -type f -name *$(git rev-parse --short HEAD)*.* -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum afabf99650d57abd3df2c7e6253a3281f9814ada77d01c28ffb57c740b14fd8e output/bitcoin-735610940c0c-aarch64-linux-gnu-debug.tar.gz 6e9dedced61489f7734c5387ee05823db68eb4b890fa05f11541c1b966576446 output/bitcoin-735610940c0c-aarch64-linux-gnu.tar.gz 5333a3c5978a61966251e56fedab8e059d9d8a1a7231a0908095bb373204a81f output/bitcoin-735610940c0c-arm-linux-gnueabihf-debug.tar.gz d28e1c166b96e58cf40b3f9801c3050c2785b25eeb261d44eeb31a32a75e134c output/bitcoin-735610940c0c-arm-linux-gnueabihf.tar.gz e00b0149c52e9207be1cfb56ec3b715b55f41691401095f7a7038ac124f08d80 output/bitcoin-735610940c0c-osx-unsigned.dmg ae5052ad1a05916bc6656b034c169097471fd9bdba16b606e2bcb592c9395544 output/bitcoin-735610940c0c-osx-unsigned.tar.gz 8586a9b8b82a8832397fcd0756aa9649adc3e61ae579fb370b99fe406298199f output/bitcoin-735610940c0c-osx64.tar.gz d560a8781bae856b6593e9b731fa99de0a4ad7bd3e03084166dc98904ece9e7b output/bitcoin-735610940c0c-powerpc64-linux-gnu-debug.tar.gz a24cf28b7efd5ebdc892e7e8809a05b3405bb4222f7d2eaa32de265214c78f28 output/bitcoin-735610940c0c-powerpc64-linux-gnu.tar.gz ad29421842dbbe96526eb597a7ff2970f0acae8c3e75dc6c2100716a2ba20606 output/bitcoin-735610940c0c-powerpc64le-linux-gnu-debug.tar.gz ee7a8ccfd68cc2297bb96eaaacf7b3eb939a5e39cecc3c710dbe828518f1bfbd output/bitcoin-735610940c0c-powerpc64le-linux-gnu.tar.gz 185bf4ea3b35072a8dd54aedbafc0892ec1e486c8ebd311f05f0fb47a19058cf output/bitcoin-735610940c0c-riscv64-linux-gnu-debug.tar.gz 803078b15a9bbaa567176827639895e762edbe80844b80400f8a9581e5311d32 output/bitcoin-735610940c0c-riscv64-linux-gnu.tar.gz d920327a32a42a5abadd247f0d3f3ee0ab0488a28892c11838d99bede6456723 output/bitcoin-735610940c0c-win-unsigned.tar.gz 9f1741a37e294af153d57ad4a6dad3e5f1cdf75f1588c86cb467abf0c177ae27 output/bitcoin-735610940c0c-win64-debug.zip 2d1a91552c0dd7bb400ce6c71d2e98de702743a97afe5f4b0945865f251f3aea output/bitcoin-735610940c0c-win64-setup-unsigned.exe 8a70020bb0cb68516acf4b2cc89832d72373f31611bd075826a30a817a071cd2 output/bitcoin-735610940c0c-win64.zip 93b03837679474905538e96c44ba81ee5653795ad333dc00569b92c82dc6ea31 output/bitcoin-735610940c0c-x86_64-linux-gnu-debug.tar.gz 6ccd046a83ef5089667ad426875319beb83e2b2a5fb4d4459d5c5ce8d75f1a31 output/bitcoin-735610940c0c-x86_64-linux-gnu.tar.gz 12771acb17de84cda8e81c59704c00b1d4725ff51fa84c9067dc61a8dc795bdc output/src/bitcoin-735610940c0c.tar.gz ``` Gitian builds: ```bash # macOS: 7d087749f610e5e3eca91c730d41afd4d404808e276242d05cedb89403de247f bitcoin-735610940c0c-osx-unsigned.dmg 96d68b4f0042dc40f5e8e362fa84dcf8e122dcb566889feb48ad8a982847dd8b bitcoin-735610940c0c-osx-unsigned.tar.gz 2dea72cbe5c3e228babd88b516a6f43b0e040e9510ea95b62f07fc0815bf8d22 bitcoin-735610940c0c-osx64.tar.gz 12771acb17de84cda8e81c59704c00b1d4725ff51fa84c9067dc61a8dc795bdc src/bitcoin-735610940c0c.tar.gz 478dbda9d551a8bed985c61c625df3f543afab26989a52bc44d5a4745715af81 bitcoin-core-osx-22-res.yml # Windows: c31a5118dfa21259b9868e2c4858c635becb786c2ee8af92302da7811a1efe9b bitcoin-735610940c0c-win-unsigned.tar.gz 5c171ec3aee830abc8ae843d674d5fe7a57420e782ee765b6992914ae5b7671a bitcoin-735610940c0c-win64-debug.zip ca010ced982f75d111e01f3759b961deb83e7bf511b1ee9c9041f4830570f2a0 bitcoin-735610940c0c-win64-setup-unsigned.exe 62514b01281f81af6057fb12cc5e3813c1d8f6532d0d8ac8f6f2909a595aa1dd bitcoin-735610940c0c-win64.zip 12771acb17de84cda8e81c59704c00b1d4725ff51fa84c9067dc61a8dc795bdc src/bitcoin-735610940c0c.tar.gz e26b55d8302a419f594396db6ff441aaeb5e275e02fde7b1b4eb092270f902e7 bitcoin-core-win-22-res.yml # Linux: e5be4deb91cb372de484468c0575a04f907f982e35a9841659bb213540f770d0 bitcoin-735610940c0c-aarch64-linux-gnu-debug.tar.gz 6169e822679ece2bb6af7027362a6f373eb939eef9d89edc58c21190b4083c7d bitcoin-735610940c0c-aarch64-linux-gnu.tar.gz aee5308767c5c930853a80ab94325b2a4ab3dbe9a7a20c7a9d60d57af2b5383f bitcoin-735610940c0c-arm-linux-gnueabihf-debug.tar.gz a9cf6e56d859fffd5a2b5f1e6360515bc6b06b048776b93cc08954859457a251 bitcoin-735610940c0c-arm-linux-gnueabihf.tar.gz 7617d85c358e6614fd40026a8d346f9edba5b5139e3daade2ec2aec72aed3a1f bitcoin-735610940c0c-powerpc64-linux-gnu-debug.tar.gz f76e46a8b130812541ebcaaba173b4cbe2ec1781e348579b44f96e9244cc2475 bitcoin-735610940c0c-powerpc64-linux-gnu.tar.gz 19ada7abb801422bd7772d7ee559004cab11a46141a747aabd27085e8c3d200d bitcoin-735610940c0c-powerpc64le-linux-gnu-debug.tar.gz f3a6bbefe9f47b3960e3b9eeb3f740ecddf8773ae76961ced6a3cdf82503e37f bitcoin-735610940c0c-powerpc64le-linux-gnu.tar.gz 42ca333e8f82b4ec0b2354efc7c4f1c27ed32d60c35b88e33d26833419f19e69 bitcoin-735610940c0c-riscv64-linux-gnu-debug.tar.gz dde930d9134fb5be1374014db3f6f503b614ae801a1d77f6f4b82a5f11eb2518 bitcoin-735610940c0c-riscv64-linux-gnu.tar.gz 82e1b4cc8aac309a99458cc27fd0285215a8af53780094c4990303ce8948cf0c bitcoin-735610940c0c-x86_64-linux-gnu-debug.tar.gz ee8caad2ccddd8eaf8aa2d19040d859130168183355b09a2a0f77a59a97fcaee bitcoin-735610940c0c-x86_64-linux-gnu.tar.gz 12771acb17de84cda8e81c59704c00b1d4725ff51fa84c9067dc61a8dc795bdc src/bitcoin-735610940c0c.tar.gz d90545b13226a338c994d9e538f468a6fafd694273bf71e14614feeaf5727ad4 bitcoin-core-linux-22-res.yml ``` ACKs for top commit: dongcarl: Code Review ACK 735610940c0cac72343ca247eb3062b2e09512a0 hebasto: ACK 735610940c0cac72343ca247eb3062b2e09512a0, tested on Linux Mint 20.1 (x86_64). Tree-SHA512: 13ce05269309a12d03b81a539ba5585003785f7b1bb7894a9353385a6e9c709f920cc4f79322f28d7a256809754f201e70be6b917915c7b14e1461530075781d
286 lines
13 KiB
Makefile
286 lines
13 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)) || \
|
|
(sleep 5 && $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5))) || \
|
|
(sleep 10 && $(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)_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=$$($(1)_build_dir)/.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 ?=
|
|
$(1)_build_cmds ?=
|
|
$(1)_config_cmds ?=
|
|
$(1)_stage_cmds ?=
|
|
$(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+=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) $$($(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
|
|
|
|
$(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)"
|
|
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
|
|
$($(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)
|
|
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 $$(@D)
|
|
+cd $$(@D); $($(1)_config_env) $($(1)_config_cmds)
|
|
touch $$@
|
|
$($(1)_built): | $($(1)_configured)
|
|
echo Building $(1)...
|
|
mkdir -p $$(@D)
|
|
+cd $$(@D); $($(1)_build_env) $($(1)_build_cmds)
|
|
touch $$@
|
|
$($(1)_staged): | $($(1)_built)
|
|
echo Staging $(1)...
|
|
mkdir -p $($(1)_staging_dir)/$(host_prefix)
|
|
cd $($(1)_build_dir); $($(1)_stage_env) $($(1)_stage_cmds)
|
|
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)
|
|
$($(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) ))
|