0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-12 11:19:08 -05:00

depends: Switch libmultiprocess packages to use local git subtree

With newly introduced libmultiprocess subtree, there's no need for depends
system to download and track changes to the upstream repository.

Note that adding the libmultiprocess subtree does not allow dropping
libmultiprocess packages from the depends build, because libmultiprocess
includes a code generation tool called mpgen, and in cross-compiled builds,
bitcoin core's cmake build system doesn't have access to a native toolchain and
can't build mpgen itself, so the depends system (or the native environment if
not using depends) needs to supply it.
This commit is contained in:
Ryan Ofsky 2025-01-25 13:33:44 -05:00
parent f23c3c47ee
commit 19eef973cb
4 changed files with 31 additions and 6 deletions

View file

@ -39,8 +39,19 @@ define fetch_file
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5))))
endef
define fetch_local_dir_sha256
if ! [ -f $($(1)_fetched) ] || ! [ -f $($(1)_source) ] || [ $($(1)_source) -ot $($(1)_local_dir) ]; then \
mkdir -p $(dir $($(1)_fetched)); \
$(build_TAR) -c -f $($(1)_source) -C $($(1)_local_dir) . && \
$(build_SHA256SUM) $($(1)_source) > $($(1)_fetched); \
fi; \
cut -d" " -f1 $($(1)_fetched);
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))
$(if $($(1)_local_dir),$(eval $(1)_sha256_hash:=$(shell $(call fetch_local_dir_sha256,$(1)))))
$(if $($(1)_local_dir),$(eval $(1)_all_file_checksums+=$($(1)_sha256_hash)))
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM) | cut -d" " -f1))
endef
@ -67,7 +78,7 @@ define int_get_build_properties
$(1)_build_subdir?=.
$(1)_download_file?=$($(1)_file_name)
$(1)_source_dir:=$(SOURCES_PATH)
$(1)_source:=$$($(1)_source_dir)/$($(1)_file_name)
$(1)_source:=$$($(1)_source_dir)/$(if $($(1)_local_dir),$(subst $(null) $(null),-,$(strip $(subst ., ,$(subst /, ,$($(1)_local_dir))))).tar,$($(1)_file_name))
$(1)_download_dir:=$(base_download_dir)/$(1)-$($(1)_version)
$(1)_prefixbin:=$($($(1)_type)_prefix)/bin/
$(1)_all_sources=$($(1)_file_name) $($(1)_extra_sources)

View file

@ -11,7 +11,8 @@ General tips:
[below](#secondary-dependencies) for more details.
## Identifiers
Each package is required to define at least these variables:
If package does not define a `$(package)_local_dir` variable, it is required to
define these variables:
$(package)_version:
Version of the upstream library or program. If there is no version, a
@ -28,6 +29,9 @@ Each package is required to define at least these variables:
$(package)_sha256_hash:
The sha256 hash of the upstream file
If a package does define a `$(package)_local_dir` variable, the above variables
are not required and will be ignored.
These variables are optional:
$(package)_build_subdir:
@ -48,6 +52,18 @@ These variables are optional:
Any extra files that will be fetched via $(package)_fetch_cmds. These are
specified so that they can be fetched and verified via 'make download'.
## Local packages
If a package defines a `$(package)_local_dir` variable, the specified directory
will be treated as a download source, and a tarball of its contents will be
saved to `sources/`. A hash of the tarball will also become part of the package
build id, so if the directory contents change, the package and everything
depending on it will be rebuilt. For efficiency, the tarball is cached once it
has been created, but if the local directory is touched, it will be rebuilt.
Local packages can be useful for using git submodules or subtrees to manage
package sources, or for testing local changes that are not available to
download from an external source.
## Build Variables:
After defining the main identifiers, build variables may be added or customized

View file

@ -1,5 +1,6 @@
package=libmultiprocess
$(package)_version=$(native_$(package)_version)
$(package)_local_dir=$(native_$(package)_local_dir)
$(package)_download_path=$(native_$(package)_download_path)
$(package)_file_name=$(native_$(package)_file_name)
$(package)_sha256_hash=$(native_$(package)_sha256_hash)

View file

@ -1,8 +1,5 @@
package=native_libmultiprocess
$(package)_version=07c917f7ca910d66abc6d3873162fc9061704074
$(package)_download_path=https://github.com/chaincodelabs/libmultiprocess/archive
$(package)_file_name=$($(package)_version).tar.gz
$(package)_sha256_hash=ac9db311e3b22aac3c7b7b7b3f6b7fee5cf3043ebb3c3bf412049e8b17166de8
$(package)_local_dir=../src/ipc/libmultiprocess
$(package)_dependencies=native_capnp
define $(package)_config_cmds