Skip to content

Commit f311522

Browse files
committed
guix: x86_64-unknown-freebsd builds
1 parent 866674d commit f311522

File tree

11 files changed

+106
-17
lines changed

11 files changed

+106
-17
lines changed

contrib/depends/funcs.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ $(1)_build_env+=$($(1)_build_env_$(host_arch)) $($(1)_build_env_$(host_arch)_$(r
146146
$(1)_build_env+=$($(1)_build_env_$(host_os)) $($(1)_build_env_$(host_os)_$(release_type))
147147
$(1)_build_env+=$($(1)_build_env_$(host_arch)_$(host_os)) $($(1)_build_env_$(host_arch)_$(host_os)_$(release_type))
148148

149+
$(1)_stage_env+=$$($(1)_stage_env_$(release_type))
150+
$(1)_stage_env+=$($(1)_stage_env_$(host_arch)) $($(1)_stage_env_$(host_arch)_$(release_type))
151+
$(1)_stage_env+=$($(1)_stage_env_$(host_os)) $($(1)_stage_env_$(host_os)_$(release_type))
152+
$(1)_stage_env+=$($(1)_stage_env_$(host_arch)_$(host_os)) $($(1)_stage_env_$(host_arch)_$(host_os)_$(release_type))
153+
149154
$(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig
150155
$(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig
151156
$(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)"

contrib/depends/hosts/freebsd.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
33

44
freebsd_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
55
-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
6+
-u LIBRARY_PATH $(clang_prog) --target=$(host) --sysroot=$(host_prefix)/native/toolchain -iwithsysroot/usr/include
77
freebsd_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
88
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
9-
-u LIBRARY_PATH $(clangxx_prog) --target=$(host) -stdlib=libc++ --sysroot=$(host_prefix)/native \
9+
-u LIBRARY_PATH $(clangxx_prog) --target=$(host) -stdlib=libc++ --sysroot=$(host_prefix)/native/toolchain \
1010
-iwithsysroot/usr/include/c++/v1 -iwithsysroot/usr/include
1111

1212
freebsd_AR=ar
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package=fcmp_pp_rust
2+
$(package)_version=0.0.0
3+
$(package)_download_path=
4+
$(package)_file_name=fcmp_pp_rust.tar.gz
5+
$(package)_sha256_hash=1fd2eaab44b4f7363df8a18897f17ce4728506b8c52c5590f9d634a9000a83fe
6+
$(package)_dependencies=fcmp_pp_rust_deps rustc
7+
$(package)_patches=cargo.config
8+
9+
# TODO: Unused, exists for testing purposes, delete later.
10+
11+
define $(package)_config_cmds
12+
mkdir -p /home/user/.cargo && \
13+
cp $($(package)_patch_dir)/cargo.config /home/user/.cargo/config && \
14+
sed -i "s/TARGET/${HOST}/g" /home/user/.cargo/config
15+
endef
16+
17+
define $(package)_build_cmds
18+
RUSTC="/monero/contrib/depends/${HOST}/native/bin/rustc" cargo build --target ${RUST_TARGET} --release
19+
endef
20+
21+
define $(package)_stage_cmds
22+
mkdir -p $($(package)_staging_prefix_dir)/lib/ && \
23+
cp ./target/${RUST_TARGET}/release/libfcmp_pp_rust.* $($(package)_staging_prefix_dir)/lib/
24+
endef
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
package=freebsd_base
2-
$(package)_version=11.3
3-
$(package)_download_path=https://download.freebsd.org/ftp/releases/amd64/$($(package)_version)-RELEASE/
4-
$(package)_download_file=base.txz
2+
$(package)_version=12.3
3+
$(package)_download_path=https://ci-mirrors.rust-lang.org/rustc
4+
$(package)_download_file=2022-05-06-freebsd-$($(package)_version)-amd64-base.txz
55
$(package)_file_name=freebsd-base-$($(package)_version).txz
6-
$(package)_sha256_hash=4599023ac136325b86f2fddeec64c1624daa83657e40b00b2ef944c81463a4ff
6+
$(package)_sha256_hash=e85b256930a2fbc04b80334106afecba0f11e52e32ffa197a88d7319cf059840
7+
$(package)_patches=setup.sh
78

89
define $(package)_extract_cmds
910
echo $($(package)_sha256_hash) $($(1)_source_dir)/$($(package)_file_name) | sha256sum -c &&\
1011
tar xf $($(1)_source_dir)/$($(package)_file_name) ./lib/ ./usr/lib/ ./usr/include/
1112
endef
1213

14+
define $(package)_config_cmds
15+
env host_prefix="$(host_prefix)" bash $($(package)_patch_dir)/setup.sh
16+
endef
17+
1318
define $(package)_stage_cmds
14-
mkdir $($(package)_staging_dir)/$(host_prefix)/native &&\
19+
mkdir -p $($(package)_staging_dir)/$(host_prefix)/native/toolchain &&\
1520
rm -rf usr/include/openssl &&\
16-
mv lib usr $($(package)_staging_dir)/$(host_prefix)/native
21+
mv lib usr $($(package)_staging_dir)/$(host_prefix)/native/toolchain &&\
22+
mv bin $($(package)_staging_dir)/$(host_prefix)/native/
1723
endef
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package=native_binutils
2+
$(package)_version=2.40
3+
$(package)_download_path=https://ftp.gnu.org/gnu/binutils
4+
$(package)_file_name=binutils-$($(package)_version).tar.bz2
5+
$(package)_sha256_hash=f8298eb153a4b37d112e945aa5cb2850040bcf26a3ea65b5a715c83afe05e48a
6+
7+
define $(package)_config_cmds
8+
$($(package)_autoconf) --target="x86_64-unknown-freebsd11" --with-sysroot="$(host_prefix)/native/toolchain"
9+
endef
10+
11+
define $(package)_build_cmds
12+
$(MAKE)
13+
endef
14+
15+
define $(package)_stage_cmds
16+
$(MAKE) DESTDIR=$($(package)_staging_dir) install
17+
endef

contrib/depends/packages/packages.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ darwin_native_packages = $(hardware_native_packages)
1111
darwin_packages = ncurses readline $(hardware_packages)
1212

1313
# not really native...
14-
freebsd_native_packages = freebsd_base $(hardware_native_packages)
14+
freebsd_native_packages = native_binutils freebsd_base $(hardware_native_packages)
1515
freebsd_packages = ncurses readline protobuf libusb
1616

1717
linux_packages = eudev ncurses readline $(hardware_packages)

contrib/depends/packages/rustc.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ $(package)_download_path=https://static.rust-lang.org/dist
44
$(package)_file_name=rustc-$($(package)_version)-src.tar.gz
55
$(package)_sha256_hash=ee106e4c569f52dba3b5b282b105820f86bd8f6b3d09c06b8dce82fb1bb3a4a1
66
$(package)_patches=config.toml
7+
$(package)_freebsd_dependencies=freebsd_base native_binutils
78

89
define $(package)_set_vars
10+
$(package)_stage_env_freebsd=AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-ar
11+
$(package)_stage_env_freebsd+=CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-clang
12+
$(package)_stage_env_freebsd+=CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-clang++
913
endef
1014

1115
define $(package)_config_cmds
@@ -26,10 +30,6 @@ define $(package)_preprocess_cmds
2630
sed -i "s#PREFIX#$($(package)_staging_prefix_dir)#g" config.toml
2731
endef
2832

29-
define $(package)_build_cmd
30-
python3 ./x.py build
31-
endef
32-
3333
define $(package)_stage_cmds
3434
python3 ./x.py install
3535
endef
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[source.crates-io]
2+
replace-with = "vendored-sources"
3+
4+
[source."git+https://github.com/kayabaNerve/crypto-bigint?branch=c-repr"]
5+
git = "https://github.com/kayabaNerve/crypto-bigint"
6+
branch = "c-repr"
7+
replace-with = "vendored-sources"
8+
9+
[source."git+https://github.com/kayabaNerve/fcmp-plus-plus"]
10+
git = "https://github.com/kayabaNerve/fcmp-plus-plus"
11+
replace-with = "vendored-sources"
12+
13+
[source.vendored-sources]
14+
directory = "/monero/contrib/depends/TARGET/native/cargo"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
mkdir bin
4+
5+
triple=x86_64-unknown-freebsd11
6+
7+
for tool in clang clang++; do
8+
tool_path=bin/${triple}-${tool}
9+
cat > "$tool_path" <<EOF
10+
#!/bin/sh
11+
exec env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
12+
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
13+
-u LIBRARY_PATH \
14+
$tool --sysroot=${host_prefix}/native/toolchain --prefix=${host_prefix}/native/toolchain/bin "\$@" --target=${triple}
15+
EOF
16+
chmod +x "$tool_path"
17+
done

contrib/guix/libexec/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ target = [ "x86_64-unknown-linux-gnu", "TARGET"]
99
cargo = "/home/user/.guix-profile/bin/cargo"
1010
rustc = "/home/user/.guix-profile/bin/rustc"
1111

12+
compiler-docs = false
13+
1214
optimized-compiler-builtins = false
1315

1416
docs = false

0 commit comments

Comments
 (0)