Skip to content

Commit c0e7638

Browse files
committed
Bootstrappable Builds
1 parent cc73fe7 commit c0e7638

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3406
-1565
lines changed

.github/workflows/gitian.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/guix.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: ci/gh-actions/guix
2+
3+
on:
4+
push:
5+
paths:
6+
- 'contrib/depends/**'
7+
- 'contrib/guix/**'
8+
- '!contrib/**.md'
9+
- '.github/workflows/guix.yml'
10+
pull_request:
11+
paths:
12+
- 'contrib/depends/**'
13+
- 'contrib/guix/**'
14+
- '!contrib/**.md'
15+
- '.github/workflows/guix.yml'
16+
17+
jobs:
18+
cache-sources:
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- name: depends sources cache
25+
id: cache
26+
uses: actions/cache@v4
27+
with:
28+
path: contrib/depends/sources
29+
key: sources-${{ hashFiles('contrib/depends/packages/*') }}
30+
- name: download depends sources
31+
if: steps.cache.outputs.cache-hit != 'true'
32+
run: make -C contrib/depends download
33+
34+
build-guix:
35+
runs-on: ubuntu-24.04
36+
needs: [cache-sources]
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
toolchain:
41+
- target: "x86_64-linux-gnu"
42+
- target: "aarch64-linux-gnu"
43+
- target: "arm-linux-gnueabihf"
44+
- target: "riscv64-linux-gnu"
45+
- target: "i686-linux-gnu"
46+
- target: "x86_64-w64-mingw32"
47+
- target: "x86_64-unknown-freebsd"
48+
- target: "x86_64-apple-darwin"
49+
- target: "aarch64-apple-darwin"
50+
- target: "aarch64-linux-android"
51+
- target: "arm-linux-androideabi"
52+
53+
name: ${{ matrix.toolchain.target }}
54+
steps:
55+
- uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
58+
submodules: recursive
59+
- name: remove bundled packages
60+
# This is faster than rm -rf
61+
run: |
62+
sudo mkdir /empty
63+
sudo rsync -a --delete /empty/ /usr/local
64+
- name: depends sources cache
65+
uses: actions/cache/restore@v4
66+
with:
67+
path: contrib/depends/sources
68+
key: sources-${{ hashFiles('contrib/depends/packages/*') }}
69+
- name: install dependencies
70+
run: sudo apt update; sudo apt -y install guix git ca-certificates
71+
- name: apparmor workaround
72+
# https://bugs.launchpad.net/ubuntu/+source/guix/+bug/2064115
73+
run: |
74+
sudo tee /etc/apparmor.d/guix << EOF
75+
abi <abi/4.0>,
76+
include <tunables/global>
77+
profile guix /usr/bin/guix flags=(unconfined) {
78+
userns,
79+
include if exists <local/guix>
80+
}
81+
EOF
82+
sudo /etc/init.d/apparmor reload
83+
sudo aa-enforce guix || true
84+
sudo apt purge apparmor
85+
- name: build
86+
run: SUBSTITUTE_URLS='http://bordeaux.guix.gnu.org' HOSTS="${{ matrix.toolchain.target }}" ./contrib/guix/guix-build
87+
- uses: actions/upload-artifact@v4
88+
with:
89+
name: ${{ matrix.toolchain.target }}
90+
path: |
91+
guix/guix-build-*/output/${{ matrix.toolchain.target }}/*
92+
guix/guix-build-*/logs/${{ matrix.toolchain.target }}/*
93+
94+
bundle-logs:
95+
runs-on: ubuntu-24.04
96+
needs: [build-guix]
97+
steps:
98+
- uses: actions/download-artifact@v4
99+
with:
100+
merge-multiple: true
101+
- uses: actions/upload-artifact@v4
102+
with:
103+
name: "logs"
104+
path: '**/logs/**'

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ miniupnpcstrings.h
2525
version/
2626
ClangBuildAnalyzerSession.txt
2727

28-
# gitian
29-
contrib/gitian/builder/
30-
contrib/gitian/docker/
31-
contrib/gitian/sigs/
28+
# guix
29+
/guix
3230

3331
# Created by https://www.gitignore.io
3432

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ if(MINGW)
11131113
elseif(APPLE OR OPENBSD OR ANDROID)
11141114
set(EXTRA_LIBRARIES "")
11151115
elseif(FREEBSD)
1116-
set(EXTRA_LIBRARIES execinfo)
1116+
set(EXTRA_LIBRARIES execinfo elf)
11171117
elseif(DRAGONFLY)
11181118
find_library(COMPAT compat)
11191119
set(EXTRA_LIBRARIES execinfo ${COMPAT})

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Portions Copyright (c) 2012-2013 The Cryptonote developers.
2020
- [Release staging schedule and protocol](#release-staging-schedule-and-protocol)
2121
- [Compiling Monero from source](#compiling-monero-from-source)
2222
- [Dependencies](#dependencies)
23-
- [Gitian builds](#gitian-builds)
23+
- [Guix builds](#guix-builds)
2424
- [Internationalization](#Internationalization)
2525
- [Using Tor](#using-tor)
2626
- [Pruning](#Pruning)
@@ -599,9 +599,9 @@ USE_DEVICE_TREZOR=OFF make release
599599

600600
For more information, please check out Trezor [src/device_trezor/README.md](src/device_trezor/README.md).
601601

602-
### Gitian builds
602+
### Guix builds
603603

604-
See [contrib/gitian/README.md](contrib/gitian/README.md).
604+
See [contrib/guix/README.md](contrib/guix/README.md).
605605

606606
## Installing Monero from a package
607607

contrib/depends/Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ include builders/$(build_os).mk
8585
include builders/default.mk
8686
include packages/packages.mk
8787

88+
ifeq ($(GUIX_ENVIRONMENT),)
8889
build_id_string:=$(BUILD_ID_SALT)
8990
build_id_string+=$(shell $(build_CC) --version 2>/dev/null)
9091
build_id_string+=$(shell $(build_AR) --version 2>/dev/null)
@@ -98,6 +99,10 @@ $(host_arch)_$(host_os)_id_string+=$(shell $(host_AR) --version 2>/dev/null)
9899
$(host_arch)_$(host_os)_id_string+=$(shell $(host_CXX) --version 2>/dev/null)
99100
$(host_arch)_$(host_os)_id_string+=$(shell $(host_RANLIB) --version 2>/dev/null)
100101
$(host_arch)_$(host_os)_id_string+=$(shell $(host_STRIP) --version 2>/dev/null)
102+
else
103+
build_id_string:=$(realpath $(GUIX_ENVIRONMENT))
104+
$(host_arch)_$(host_os)_id_string:=$(realpath $(GUIX_ENVIRONMENT))
105+
endif
101106

102107
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages)
103108
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
@@ -111,7 +116,7 @@ $(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain)
111116
include funcs.mk
112117

113118
toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin)
114-
final_build_id_long+=$(shell $(build_SHA256SUM) toolchain.cmake.in)
119+
final_build_id_long+=:[sha256sum]:$(shell $(build_SHA256SUM) toolchain.cmake.in)
115120
final_build_id+=$(shell echo -n "$(final_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH))
116121
$(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
117122
$(AT)rm -rf $(@D)
@@ -124,8 +129,8 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
124129
$(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(final_build_id)
125130
$(AT)@mkdir -p $(@D)
126131
$(AT)sed -e 's|@HOST@|$(host)|' \
127-
-e 's|@CC@|$(toolchain_path)$(host_CC)|' \
128-
-e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \
132+
-e 's|@CC@|$(host_CC)|' \
133+
-e 's|@CXX@|$(host_CXX)|' \
129134
-e 's|@AR@|$(toolchain_path)$(host_AR)|' \
130135
-e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \
131136
-e 's|@NM@|$(toolchain_path)$(host_NM)|' \

contrib/depends/funcs.mk

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
define int_vars
22
#Set defaults for vars which may be overridden per-package
3-
$(1)_cc=$($($(1)_type)_CC)
4-
$(1)_cxx=$($($(1)_type)_CXX)
5-
$(1)_objc=$($($(1)_type)_OBJC)
6-
$(1)_objcxx=$($($(1)_type)_OBJCXX)
7-
$(1)_ar=$($($(1)_type)_AR)
8-
$(1)_ranlib=$($($(1)_type)_RANLIB)
9-
$(1)_libtool=$($($(1)_type)_LIBTOOL)
10-
$(1)_nm=$($($(1)_type)_NM)
11-
$(1)_cflags=$($($(1)_type)_CFLAGS) $($($(1)_type)_$(release_type)_CFLAGS)
12-
$(1)_cxxflags=$($($(1)_type)_CXXFLAGS) $($($(1)_type)_$(release_type)_CXXFLAGS)
13-
$(1)_arflags=$($($(1)_type)_ARFLAGS) $($($(1)_type)_$(release_type)_ARFLAGS)
14-
$(1)_ldflags=$($($(1)_type)_LDFLAGS) $($($(1)_type)_$(release_type)_LDFLAGS) -L$($($(1)_type)_prefix)/lib
15-
$(1)_cppflags=$($($(1)_type)_CPPFLAGS) $($($(1)_type)_$(release_type)_CPPFLAGS) -I$($($(1)_type)_prefix)/include
3+
$(1)_cc=$$($$($(1)_type)_CC)
4+
$(1)_cxx=$$($$($(1)_type)_CXX)
5+
$(1)_objc=$$($$($(1)_type)_OBJC)
6+
$(1)_objcxx=$$($$($(1)_type)_OBJCXX)
7+
$(1)_ar=$$($$($(1)_type)_AR)
8+
$(1)_ranlib=$$($$($(1)_type)_RANLIB)
9+
$(1)_libtool=$$($$($(1)_type)_LIBTOOL)
10+
$(1)_nm=$$($$($(1)_type)_NM)
11+
$(1)_cflags=$$($$($(1)_type)_CFLAGS) \
12+
$$($$($(1)_type)_$$(release_type)_CFLAGS)
13+
$(1)_cxxflags=$$($$($(1)_type)_CXXFLAGS) \
14+
$$($$($(1)_type)_$$(release_type)_CXXFLAGS)
15+
$(1)_arflags=$$($$($(1)_type)_ARFLAGS) \
16+
$$($$($(1)_type)_$(release_type)_ARFLAGS)
17+
$(1)_ldflags=$$($$($(1)_type)_LDFLAGS) \
18+
$$($$($(1)_type)_$$(release_type)_LDFLAGS) \
19+
-L$$($($(1)_type)_prefix)/lib
20+
$(1)_cppflags=$$($$($(1)_type)_CPPFLAGS) \
21+
$$($$($(1)_type)_$$(release_type)_CPPFLAGS) \
22+
-I$$($$($(1)_type)_prefix)/include
1623
$(1)_recipe_hash:=
1724
endef
1825

@@ -37,6 +44,7 @@ endef
3744

3845
define int_get_build_recipe_hash
3946
$(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches)) | cut -d" " -f1))
47+
final_build_id_long+=:[$(1)_all_file_checksums]$(foreach checksum,$($(1)_all_file_checksums),$(shell echo ":$(checksum)")):
4048
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM) | cut -d" " -f1))
4149
endef
4250

@@ -46,7 +54,7 @@ $(eval $(1)_all_dependencies:=$(call int_get_all_dependencies,$(1),$($($(1)_type
4654
$(foreach dep,$($(1)_all_dependencies),$(eval $(1)_build_id_deps+=$(dep)-$($(dep)_version)-$($(dep)_recipe_hash)))
4755
$(eval $(1)_build_id_long:=$(1)-$($(1)_version)-$($(1)_recipe_hash)-$(release_type) $($(1)_build_id_deps) $($($(1)_type)_id_string))
4856
$(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)))
49-
final_build_id_long+=$($(package)_build_id_long)
57+
final_build_id_long+=:[recipe]:$(1)-$($(1)_version)-$($(1)_recipe_hash)-$(release_type):[deps]$(foreach dep,$($(1)_build_id_deps),$(shell echo ":$(dep)")):[$($(1)_type)_id]:$($($(1)_type)_id_string):
5058

5159
#compute package-specific paths
5260
$(1)_build_subdir?=.
@@ -267,4 +275,4 @@ $(foreach package,$(all_packages),$(eval $(call int_config_attach_build_config,$
267275
$(foreach package,$(all_packages),$(eval $(call int_add_cmds,$(package))))
268276

269277
#special exception: if a toolchain package exists, all non-native packages depend on it
270-
$(foreach package,$(packages),$(eval $($(package)_unpacked): |$($($(host_arch)_$(host_os)_native_toolchain)_cached) ))
278+
$(foreach package,$(packages),$(eval $($(package)_extracted): |$($($(host_arch)_$(host_os)_native_toolchain)_cached) ))

contrib/depends/hosts/darwin.mk

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,65 @@
11
OSX_MIN_VERSION=10.13
2+
OSX_SDK_VERSION=11.0
3+
XCODE_VERSION=12.2
4+
XCODE_BUILD_ID=12B45b
25
LD64_VERSION=609
3-
ifeq (aarch64, $(host_arch))
4-
CC_target=arm64-apple-$(host_os)
5-
else
6-
CC_target=$(host)
7-
endif
8-
darwin_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -mlinker-version=$(LD64_VERSION) -B$(host_prefix)/native/bin/$(host)-
9-
darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -iwithsysroot/usr/include/c++/v1 -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)-
6+
7+
OSX_SDK=$(host_prefix)/native/SDK
8+
9+
darwin_native_toolchain=darwin_sdk native_cctools
10+
11+
clang_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang")
12+
clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
13+
14+
# Flag explanations:
15+
#
16+
# -mlinker-version
17+
#
18+
# Ensures that modern linker features are enabled. See here for more
19+
# details: https://github.com/bitcoin/bitcoin/pull/19407.
20+
#
21+
# -B$(build_prefix)/bin
22+
#
23+
# Explicitly point to our binaries (e.g. cctools) so that they are
24+
# ensured to be found and preferred over other possibilities.
25+
#
26+
# -isysroot$(OSX_SDK) -nostdlibinc
27+
#
28+
# Disable default include paths built into the compiler as well as
29+
# those normally included for libc and libc++. The only path that
30+
# remains implicitly is the clang resource dir.
31+
#
32+
# -iwithsysroot / -iframeworkwithsysroot
33+
#
34+
# Adds the desired paths from the SDK
35+
#
36+
37+
darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
38+
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
39+
-u LIBRARY_PATH \
40+
$(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
41+
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
42+
-isysroot$(OSX_SDK) \
43+
-isysroot$(OSX_SDK) -nostdlibinc \
44+
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
45+
46+
darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
47+
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
48+
-u LIBRARY_PATH \
49+
$(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
50+
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
51+
-isysroot$(OSX_SDK) -nostdlibinc \
52+
-iwithsysroot/usr/include/c++/v1 \
53+
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
1054

1155
darwin_CFLAGS=-pipe
1256
darwin_CXXFLAGS=$(darwin_CFLAGS)
1357
darwin_ARFLAGS=cr
1458

15-
darwin_release_CFLAGS=-O1
59+
darwin_release_CFLAGS=-O2
1660
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
1761

1862
darwin_debug_CFLAGS=-O1
1963
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
2064

21-
darwin_native_toolchain=native_cctools darwin_sdk
22-
2365
darwin_cmake_system=Darwin

contrib/depends/hosts/freebsd.mk

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
freebsd_CC=clang-8
2-
freebsd_CXX=clang++-8
1+
clang_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang")
2+
clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
3+
4+
freebsd_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
5+
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
6+
-u LIBRARY_PATH $(clang_prog) --target=$(host) --sysroot=$(host_prefix)/native -iwithsysroot/usr/include
7+
freebsd_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
8+
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
9+
-u LIBRARY_PATH $(clangxx_prog) --target=$(host) -stdlib=libc++ --sysroot=$(host_prefix)/native \
10+
-iwithsysroot/usr/include/c++/v1 -iwithsysroot/usr/include
11+
312
freebsd_AR=ar
413
freebsd_RANLIB=ranlib
514
freebsd_NM=nm

0 commit comments

Comments
 (0)