* cleanup patches
* fix polyseed patch
* Fix iOS builds
* fix polyseed dependencies
* fix polyseed patch for macOS
* update ledger patch
* update wownero patches and version
* update checksums
* wip"
* update gitmodules
* update boost build script
* update build_single.sh
* vix verbosey_copy
* fix __clear_cache bug on wownero
* update randomwow
* migrate build system
* fix cross compilation issues
* some more build issue
* update polyseed
* cleanup cmakelists
* fix toolchain.cmake.in
* add ssp
* another attempt at building windows on CI
* fix package name
* migrate mirror to my own hosting
* change download mirror priority (fallback first)
* link ssp in monero module as well by using CMAKE_{C,CXX}_FLAGS
* fix android builds
* update polyseed source
* 13 -> trixie
* fix package name conflicts, update runner to sid
* update boost to 1_84_0, disable patch that's no longer needed
* switch to ubuntu:24.04
* add POLYSEED_STATIC to toolchain.cmake.in in order to properly link
* drop patches
* fixes to darwin
* link missing wowner-seed library
* a litte bit more of experiments
* build locale only on windows
* update iconv
* update definitions
* update ci builds
* update my progress
* ios fix, update depends, ci
* multithread build system
* fix android, mingw and linux build issues
* remove dependency check
* update Dockerfile to include pigz
* show a message when pigz is missing
* fix devcontainer mingw setup (missing ENV)
* update android build runner
* sailfishos dropped (you better go behave yourself and run actual linux programs)
* fiz pigz issues
* install llvm-ranlib for android
* fix iOS build issues
* fix dummy ledger patch
* fix macos and darwin
* fix macos ci
* fix macos build command
* install autoconf
* add automake
* add libtool
* macos fixes, wownero fixes, idk what else, please help me
* fix wownero iOS build
* Cleanup patches
* add try-catch into monero code
* fix error handling
* update checksums
241 lines
8.7 KiB
Makefile
241 lines
8.7 KiB
Makefile
.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
|
|
# 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),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
|
|
|
|
build_id_string:=$(BUILD_ID_SALT)
|
|
build_id_string+=$(shell $(build_CC) --version 2>/dev/null)
|
|
build_id_string+=$(shell $(build_AR) --version 2>/dev/null)
|
|
build_id_string+=$(shell $(build_CXX) --version 2>/dev/null)
|
|
build_id_string+=$(shell $(build_RANLIB) --version 2>/dev/null)
|
|
build_id_string+=$(shell $(build_STRIP) --version 2>/dev/null)
|
|
|
|
$(host_arch)_$(host_os)_id_string:=$(HOST_ID_SALT)
|
|
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CC) --version 2>/dev/null)
|
|
$(host_arch)_$(host_os)_id_string+=$(shell $(host_AR) --version 2>/dev/null)
|
|
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CXX) --version 2>/dev/null)
|
|
$(host_arch)_$(host_os)_id_string+=$(shell $(host_RANLIB) --version 2>/dev/null)
|
|
$(host_arch)_$(host_os)_id_string+=$(shell $(host_STRIP) --version 2>/dev/null)
|
|
|
|
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); \
|
|
if test -f "$($(package)_cached)"; then echo "Checksum mismatch for $(package). Forcing rebuild.."; rm -f $($(package)_cached_checksum) $($(package)_cached); 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
|