Skip to content

Commit

Permalink
let cargo.sh vendor deps for now
Browse files Browse the repository at this point in the history
  • Loading branch information
tobtoht committed Dec 9, 2024
1 parent 3832577 commit 175acbc
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 21 deletions.
2 changes: 1 addition & 1 deletion contrib/depends/packages/packages.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
native_packages:=fcmp_pp_rust_deps rust_src
native_packages:=rust_src
packages:=boost openssl zeromq expat unbound sodium

hardware_packages := hidapi protobuf libusb
Expand Down
16 changes: 8 additions & 8 deletions contrib/guix/guix-build
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@ EOF
# TODO: use depends to fetch and clean rustc source

# Fetch cargo dependencies
# time-machine environment --manifest="${PWD}/contrib/guix/cargo.scm" \
# --container \
# --pure \
# --network \
# --no-cwd \
# --user="user" \
# --share="$PWD"=/monero \
# -- bash -c "cd /monero && bash contrib/guix/libexec/cargo.sh"
time-machine environment --manifest="${PWD}/contrib/guix/cargo.scm" \
--container \
--pure \
--network \
--no-cwd \
--user="user" \
--share="$PWD"=/monero \
-- bash -c "cd /monero && bash contrib/guix/libexec/cargo.sh"
#
# exit 1

Expand Down
33 changes: 33 additions & 0 deletions contrib/guix/libexec/allowed_deps.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,55 @@
addr2line
adler
ahash
allocator-api2
base16ct
base64ct
bitvec
blake2
block-buffer
byteorder
cc
cfg-if
ciphersuite
compiler_builtins
const-oid
cpufeatures
crypto-bigint
crypto-common
curve25519-dalek
curve25519-dalek-derive
dalek-ff-group
der
digest
dlmalloc
ec-divisors
ecdsa
elliptic-curve
ff
fiat-crypto
flexible-transcript
fortanix-sgx-abi
full-chain-membership-proofs
funty
generalized-bulletproofs
generalized-bulletproofs-circuit-abstraction
generalized-bulletproofs-ec-gadgets
generalized-schnorr
generic-array
getopts
getrandom
gimli
group
hashbrown
helioselene
hermit-abi
hex
k256
keccak
libc
memchr
merlin
minimal-ed448
miniz_oxide
monero-fcmp-plus-plus
monero-generators
Expand All @@ -41,25 +58,41 @@ monero-primitives
multiexp
object
once_cell
p256
pkcs8
primeorder
proc-macro2
quote
radium
rand
rand_core
rand_xorshift
r-efi
r-efi-alloc
rustc-demangle
rustc_version
rustversion
sec1
semver
sha2
sha3
signature
spin
spki
std-shims
subtle
syn
tap
typenum
unicode-ident
unicode-width
unwinding
version_check
wasi
windows-sys
windows-targets
wyz
zerocopy
zerocopy-derive
zeroize
zeroize_derive
2 changes: 1 addition & 1 deletion contrib/guix/libexec/cargo.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ git = "https://github.com/kayabaNerve/fcmp-plus-plus"
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "/monero/contrib/depends/TARGET/native/cargo"
directory = "/monero/vendor"
26 changes: 15 additions & 11 deletions contrib/guix/libexec/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,32 @@ export TZ="UTC"

allowed_pattern=$(awk '{print "^./" $1 "$" }' /monero/contrib/guix/libexec/allowed_deps.txt | paste -sd '|' -)

cd /
wget --no-check-certificate https://static.rust-lang.org/dist/rustc-1.82.0-src.tar.gz
rm -rf /monero/vendor

cd /monero
if [ ! -e "rustc-1.82.0-src.tar.gz" ]; then
wget --no-check-certificate https://static.rust-lang.org/dist/rustc-1.82.0-src.tar.gz
fi

echo "7c53f4509eda184e174efa6ba7d5eeb586585686ce8edefc781a2b11a7cf512a rustc-1.82.0-src.tar.gz" | sha256sum -c
tar xf rustc-1.82.0-src.tar.gz
cp rustc-1.82.0-src/Cargo.lock rustc-1.82.0-src/library/std/

# Vendor fcmp_pp_rust deps
cd /monero/src/fcmp_pp/fcmp_pp_rust
RUSTC_BOOTSTRAP=1 cargo vendor --locked --sync /rustc-1.82.0-src/library/std/Cargo.toml /vendor
RUSTC_BOOTSTRAP=1 cargo vendor --locked --sync /monero/rustc-1.82.0-src/library/Cargo.toml /vendor

# Create deterministic dependency archive
cd /vendor

#find . -mindepth 1 -maxdepth 1 -type d | grep -Ev "($allowed_pattern)" | xargs rm -rf
find . -mindepth 1 -maxdepth 1 -type d | grep -Ev "($allowed_pattern)" | xargs rm -rf

#find . -type f -regex ".*\.\(a\|dll\|exe\|lib\)$" -delete
find . -type f -regex ".*\.\(a\|dll\|exe\|lib\)$" -delete
#find . -type f -name ".cargo-checksum.json" -print0 | xargs -0 -I% sh -c 'echo "{\"package\":null,\"files\":{}}" > "%"'
#find . -type f -name "Cargo.lock" -delete

find . -print0 \
| sort --zero-terminated \
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
| gzip -9n > "/fcmp_pp_rust-0.0.0-deps.tar.gz"
#find . -print0 \
# | sort --zero-terminated \
# | tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
# | gzip -9n > "/fcmp_pp_rust-0.0.0-deps.tar.gz"

mv /fcmp_pp_rust-0.0.0-deps.tar.gz /monero/
mv /vendor /monero/

0 comments on commit 175acbc

Please sign in to comment.