diff options
| author | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2026-02-19 18:05:04 +0100 |
|---|---|---|
| committer | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2026-02-19 22:22:31 +0100 |
| commit | 520c9aa929e2aa095114c3f7998de1132825facc (patch) | |
| tree | 999df06487393113dc9f46b4835b9e41b2472f1e /contrib/depends/Makefile | |
| parent | 411e8a1cdb3f4c2812d83f28c335d2a4eb18bd29 (diff) | |
reproducibility
Diffstat (limited to 'contrib/depends/Makefile')
| -rw-r--r-- | contrib/depends/Makefile | 294 |
1 files changed, 25 insertions, 269 deletions
diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile index 7e9f0f4..eaa5c9a 100644 --- a/contrib/depends/Makefile +++ b/contrib/depends/Makefile @@ -1,269 +1,25 @@ -.NOTPARALLEL : - -SOURCES_PATH ?= $(BASEDIR)/sources -BASE_CACHE ?= $(BASEDIR)/built -FALLBACK_DOWNLOAD_PATH ?= https://static.mrcyjanek.net/download_mirror/ - -BUILD = $(shell ./config.guess) -HOST ?= $(BUILD) -PATCHES_PATH = $(BASEDIR)/patches -BASEDIR = $(CURDIR) -HASH_LENGTH:=11 -DOWNLOAD_CONNECT_TIMEOUT:=30 -DOWNLOAD_RETRIES:=5 -HOST_ID_SALT ?= salt -BUILD_ID_SALT ?= salt - -DEPENDS_UNTRUSTED_FAST_BUILDS ?= -PREBUILT_BASE_URL ?= https://static.mrcyjanek.net/lfs/depends/contrib/depends/built -ifneq ($(DEPENDS_UNTRUSTED_FAST_BUILDS),) -ifneq ($(DEPENDS_UNTRUSTED_FAST_BUILDS),yes) -ifneq ($(DEPENDS_UNTRUSTED_FAST_BUILDS),forced) -$(error DEPENDS_UNTRUSTED_FAST_BUILDS must be empty, "yes", or "forced", got "$(DEPENDS_UNTRUSTED_FAST_BUILDS)") -endif -endif -endif - -# Detect the number of CPU cores -ifeq ($(shell uname), Darwin) - NUM_CORES := $(shell sysctl -n hw.ncpu) -else ifeq ($(shell uname), Linux) - NUM_CORES := $(shell nproc) -else - NUM_CORES := 1 # Default if the OS is not detected -endif - -host:=$(BUILD) -ifneq ($(HOST),) -host:=$(HOST) -host_toolchain:=$(HOST)- -endif - -ifneq ($(DEBUG),) -release_type=Debug -else -release_type=Release -endif - -ifneq ($(TESTS),) -build_tests=ON -release_type=Debug -else -build_tests=OFF -endif - -base_build_dir=$(BASEDIR)/work/build -base_staging_dir=$(BASEDIR)/work/staging -base_download_dir=$(BASEDIR)/work/download -canonical_host:=$(shell ./config.sub $(HOST)) -build:=$(shell ./config.sub $(BUILD)) - -build_arch =$(firstword $(subst -, ,$(build))) -build_vendor=$(word 2,$(subst -, ,$(build))) -full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build)) -build_os:=$(findstring linux,$(full_build_os)) -build_os+=$(findstring darwin,$(full_build_os)) -build_os:=$(strip $(build_os)) -ifeq ($(build_os),) -build_os=$(full_build_os) -endif - -host_arch=$(firstword $(subst -, ,$(canonical_host))) -host_vendor=$(word 2,$(subst -, ,$(canonical_host))) -full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host)) -host_os:=$(findstring android,$(full_host_os)) -ifeq ($(host_os),) -host_os:=$(findstring linux,$(full_host_os)) -endif -host_os+=$(findstring darwin,$(full_host_os)) -host_os+=$(findstring freebsd,$(full_host_os)) -host_os+=$(findstring mingw32,$(full_host_os)) -host_os:=$(strip $(host_os)) -ifeq ($(host_os),) -host_os=$(full_host_os) -endif - -$(host_arch)_$(host_os)_prefix=$(BASEDIR)/$(host) -$(host_arch)_$(host_os)_host=$(host) -host_prefix=$($(host_arch)_$(host_os)_prefix) -build_prefix=$(host_prefix)/native -ifeq ($(host_os),mingw32) -host_cmake=Windows -endif -ifeq ($(host_os),linux) -host_cmake=Linux -endif -ifeq ($(host_os),freebsd) -host_cmake=FreeBSD -endif -ifeq ($(host_os),darwin) -host_cmake=Darwin -endif -ifeq ($(host_os),ios) -host_cmake=iOS -endif -ifeq ($(host_os),iossimulator) -host_cmake=iOS -endif -ifeq ($(host_os),android) -host_cmake=Android -endif - -AT_$(V):= -AT_:=@ -AT:=$(AT_$(V)) - -all: install - -include hosts/$(host_os).mk -include hosts/default.mk -include builders/$(build_os).mk -include builders/default.mk -include packages/packages.mk - -# Legacy build ID strings (kept for debugging info) -build_id_string_legacy:=$(BUILD_ID_SALT) -build_id_string_legacy+=$(shell $(build_CC) --version 2>/dev/null) -build_id_string_legacy+=$(shell $(build_AR) --version 2>/dev/null) -build_id_string_legacy+=$(shell $(build_CXX) --version 2>/dev/null) -build_id_string_legacy+=$(shell $(build_RANLIB) --version 2>/dev/null) -build_id_string_legacy+=$(shell $(build_STRIP) --version 2>/dev/null) - -$(host_arch)_$(host_os)_id_string_legacy:=$(HOST_ID_SALT) -$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_CC) --version 2>/dev/null) -$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_AR) --version 2>/dev/null) -$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_CXX) --version 2>/dev/null) -$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_RANLIB) --version 2>/dev/null) -$(host_arch)_$(host_os)_id_string_legacy+=$(shell $(host_STRIP) --version 2>/dev/null) - -build_id_string:=$(BUILD_ID_SALT) -build_id_string+=$(shell basename $(build_CC) 2>/dev/null || echo "unknown") -build_id_string+=$(shell basename $(build_AR) 2>/dev/null || echo "unknown") -build_id_string+=$(shell basename $(build_CXX) 2>/dev/null || echo "unknown") -build_id_string+=$(shell basename $(build_RANLIB) 2>/dev/null || echo "unknown") -build_id_string+=$(shell basename $(build_STRIP) 2>/dev/null || echo "unknown") - -$(host_arch)_$(host_os)_id_string:=$(HOST_ID_SALT) -$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_CC) 2>/dev/null || echo "unknown") -$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_AR) 2>/dev/null || echo "unknown") -$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_CXX) 2>/dev/null || echo "unknown") -$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_RANLIB) 2>/dev/null || echo "unknown") -$(host_arch)_$(host_os)_id_string+=$(shell basename $(host_STRIP) 2>/dev/null || echo "unknown") - -packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) -native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) - -all_packages = $(packages) $(native_packages) - -meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk - -$(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain) - -include funcs.mk - -CONF_PKGS := cmake-conf mxe-conf - -build-only-$(1)_$(3): CMAKE_RUNRESULT_FILE = $(PREFIX)/share/cmake/modules/TryRunResults.cmake -build-only-$(1)_$(3): CMAKE_TOOLCHAIN_FILE = $(PREFIX)/$(3)/share/cmake/mxe-conf.cmake -build-only-$(1)_$(3): CMAKE_TOOLCHAIN_DIR = $(PREFIX)/$(3)/share/cmake/mxe-conf.d -build-only-$(1)_$(3): CMAKE_STATIC_BOOL = $(if $(findstring shared,$(3)),OFF,ON) -build-only-$(1)_$(3): CMAKE_SHARED_BOOL = $(if $(findstring shared,$(3)),ON,OFF) - - -toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin) -final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in) -final_build_id_long+=$(shell $(build_SHA256SUM) toolchain.cmake.in) -final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)) -$(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages) - $(AT)rm -rf $(@D) - $(AT)mkdir -p $(@D) - $(AT)echo copying packages: $^ - $(AT)echo to: $(@D) - $(AT)cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); ) - $(AT)touch $@ - -$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id) - $(AT)@mkdir -p $(@D) - $(AT)sed -e 's|@HOST@|$(host)|' \ - -e 's|@CC@|$(toolchain_path)$(host_CC)|' \ - -e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \ - -e 's|@AR@|$(toolchain_path)$(host_AR)|' \ - -e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \ - -e 's|@NM@|$(toolchain_path)$(host_NM)|' \ - -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \ - -e 's|@build_os@|$(build_os)|' \ - -e 's|@host_os@|$(host_os)|' \ - -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \ - -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \ - -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ - -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ - -e 's|@allow_host_packages@|$(ALLOW_HOST_PACKAGES)|' \ - -e 's|@debug@|$(DEBUG)|' \ - $< > $@ - $(AT)touch $@ - -$(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id) - $(AT)@mkdir -p $(@D) - $(AT)sed -e 's|@HOST@|$(host)|' \ - -e 's|@CC@|$(toolchain_path)$(host_CC)|' \ - -e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \ - -e 's|@AR@|$(toolchain_path)$(host_AR)|' \ - -e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \ - -e 's|@NM@|$(toolchain_path)$(host_NM)|' \ - -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \ - -e 's|@build_os@|$(build_os)|' \ - -e 's|@host_os@|$(host_os)|' \ - -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \ - -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \ - -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ - -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ - -e 's|@allow_host_packages@|$(ALLOW_HOST_PACKAGES)|' \ - -e 's|@debug@|$(DEBUG)|' \ - -e 's|@release_type@|$(release_type)|' \ - -e 's|@build_tests@|$(build_tests)|' \ - -e 's|@depends@|$(host_cmake)|' \ - -e 's|@prefix@|$($(host_arch)_$(host_os)_prefix)|'\ - -e 's|@arch@|$(host_arch)|'\ - $< > $@ - $(AT)touch $@ - -define check_or_remove_cached - mkdir -p $(BASE_CACHE)/$(host)/$(package) && cd $(BASE_CACHE)/$(host)/$(package); \ - $(build_SHA256SUM) -c $($(package)_cached_checksum) >/dev/null 2>/dev/null || \ - ( rm -f $($(package)_cached_checksum) $($(package)_cached_buildinfo); \ - if test -f "$($(package)_cached)"; then echo "Checksum mismatch for $(package). Forcing rebuild.."; rm -f $($(package)_cached_checksum) $($(package)_cached) $($(package)_cached_buildinfo); fi ) -endef - -define check_or_remove_sources - mkdir -p $($(package)_source_dir); cd $($(package)_source_dir); \ - test -f $($(package)_fetched) && ( $(build_SHA256SUM) -c $($(package)_fetched) >/dev/null 2>/dev/null || \ - ( echo "Checksum missing or mismatched for $(package) source. Forcing re-download."; \ - rm -f $($(package)_all_sources) $($(1)_fetched))) || true -endef - -check-packages: - @$(foreach package,$(all_packages),$(call check_or_remove_cached,$(package));) -check-sources: - @$(foreach package,$(all_packages),$(call check_or_remove_sources,$(package));) - -$(host_prefix)/share/config.site: check-packages -$(host_prefix)/share/toolchain.cmake: check-packages - -check-packages: check-sources - -install: $(host_prefix)/share/config.site check-packages -install: $(host_prefix)/share/toolchain.cmake check-packages - -download-one: check-sources $(all_sources) - -download-osx: - @$(MAKE) -s HOST=x86_64-apple-darwin11 download-one -download-linux: - @$(MAKE) -s HOST=x86_64-unknown-linux-gnu download-one -download-win: - @$(MAKE) -s HOST=x86_64-w64-mingw32 download-one -download: download-osx download-linux download-win - - $(foreach package,$(all_packages),$(eval $(call ext_add_stages,$(package)))) - -.PHONY: install cached download-one download-osx download-linux download-win download check-packages check-sources +HOST ?= + +PACKAGES = native/cmake,native/python@3.14,native/git,native/_,boost,zeromq,zlib,unbound,sodium,openssl +SIMPLYBS_HASH = 61ccf85b404afd86b968b4fb469052ef1ae050e2 + +all: simplybs $(if $(HOST),sbs-build-$(HOST),) + @if [ -z "$(HOST)" ]; then \ + echo "ERROR: HOST is not set"; \ + exit 1; \ + fi + +.PHONY: simplybs sbs-build-% + +simplybs: + git clone https://github.com/mrcyjanek/simplybs || true + cd simplybs && git fetch -a + cd simplybs && git checkout $(SIMPLYBS_HASH) --force + cd simplybs && git reset --hard + +sbs-build-%: + # cd simplybs && env SIMPLYBS_ENV_DIR=$(PWD)/$* go run . -cleanup + cd simplybs && env SIMPLYBS_ENV_DIR=$(PWD)/$* go run . -host $* -package $(PACKAGES) -build + cd simplybs && rm -rf $(PWD)/$* + cd simplybs && env SIMPLYBS_ENV_DIR=$(PWD)/$* go run . -host $* -package $(PACKAGES) -extract + env HOST=$* ./gen_toolchain.cmake.sh $*/share/toolchain.cmake |
