Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Bootstrappable FCMP++ #9440

Draft
wants to merge 129 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
d7dcfa3
rough fcmp++ tree impl (lots of work remaining to clean it up and fix)
j-berman May 17, 2024
5eae425
remove whitespaces
j-berman May 17, 2024
264da8c
test validates lowest layer in tree
j-berman May 17, 2024
c91cbc8
fix c1 c2 layer indexing issue in test helper get_last_chunk
j-berman May 18, 2024
6891097
actual indexing fix, tests now passing
j-berman May 18, 2024
ddae8bd
Cleaner file organization
j-berman May 20, 2024
b9bcf4b
template all curve_trees types & funcs, rename tower_cycle_types to t…
j-berman May 21, 2024
5ca330c
Implement CurveTrees & CurveTreesUnitTest classes to simplify callers
j-berman May 21, 2024
8a4e169
Add Curve class, and Helios & Selene classes that derive from Curve
j-berman May 22, 2024
af5a427
Use widths from fcmp++ repo test & align tests with width
j-berman May 22, 2024
694a0bf
slight simplification to CurveTrees::hash_layer
j-berman May 22, 2024
70b904a
Consolidate hash_leaf_layer into hash_layer
j-berman May 23, 2024
8b59b45
Move curve_trees.h implementations into curve_trees.cpp file
j-berman May 23, 2024
0bd3299
Cleaner template usage, moved static functions out of CurveTrees class
j-berman May 23, 2024
27751b3
small cleanup
j-berman May 23, 2024
31278ab
start LMDB grow_tree
j-berman May 24, 2024
f1c3827
Remove cxx and expose scalars/points directly
kayabaNerve May 24, 2024
0e1ac07
fmt, clippy
kayabaNerve May 24, 2024
6c91192
Use statics on the Rust side for generators
kayabaNerve May 24, 2024
276ef8a
Only pass a single prior child
kayabaNerve May 24, 2024
506a2cc
don't want to expose generator lengths in ffi
j-berman May 24, 2024
ed110c0
explicit type response to hash_grow 's
j-berman May 24, 2024
fea7727
Remove reference from m_hash_init_point
kayabaNerve May 24, 2024
bbc69ab
Simplify edge case handling in hash_layer
j-berman May 25, 2024
f62080b
Implement get_tree_last_chunks in db, can now extend tree in db
j-berman May 25, 2024
9082fd4
implement db->audit_tree, and flesh out db test to init/extend tree
j-berman May 27, 2024
45d92df
cleaner lmdb test structure for curve trees
j-berman May 27, 2024
53516d0
CurveTreesUnitTest -> CurveTreesGlobalTree class
j-berman May 27, 2024
cf7c435
Set up trim_tree_in_memory test
j-berman Jun 4, 2024
06f9102
expose and test hash_trim from rust lib
j-berman Jun 6, 2024
38a599c
implement trim_tree_in_memory
j-berman Jun 7, 2024
ce930d4
faster trim_tree tests
j-berman Jun 7, 2024
5428c69
Fix grow_tree, restructure it, and clean the approach
j-berman Jun 28, 2024
88d5c1f
Implement and test trim_tree algo in memory
j-berman Jul 9, 2024
1ae6b22
whitespace fixes
j-berman Jul 9, 2024
bf4354a
Better tests for hash_trim
j-berman Jul 9, 2024
0d5f034
Better organization
j-berman Jul 9, 2024
08dafc5
trim_tree db impl + db test + some housekeeping
j-berman Jul 10, 2024
3393139
lmdb migration to init curve trees tree from existing outputs
j-berman Jul 18, 2024
8b423e5
Implemented growing the tree on sync + lots of cleaning
j-berman Jul 24, 2024
e5568b8
Guarantee insertion order into the tree using global output ID
j-berman Jul 25, 2024
ed418a9
Match output unlock time (fix off by 1)
j-berman Jul 25, 2024
4865087
Remove leaves from locked leaves table upon insertion to tree
j-berman Jul 25, 2024
122c513
Remove copy in get_tree_extension and better named funcs
j-berman Jul 25, 2024
20c3c60
Use a pointer for the value in CResult
kayabaNerve May 25, 2024
b9f38b4
use void * to try to fix CResult
j-berman May 25, 2024
b6bbf11
Rust cross compilation
kayabaNerve May 25, 2024
fa05ae8
Correct path to the staticlib
kayabaNerve May 25, 2024
a6ffc64
Increase misc discrepancies in ARM ARCH spec which we support
kayabaNerve May 25, 2024
1ac5720
i386 -> i686, riscv64 -> riscv64gc
kayabaNerve May 25, 2024
d4c071c
Further match off RUST_ARCH, not ARCH_ID
kayabaNerve May 26, 2024
555276f
Install Rust when doing the Windows build
kayabaNerve May 26, 2024
9dcbba0
Use the armv7 HF Rust toolchain
kayabaNerve May 26, 2024
ae35635
Cross-compile from Ubuntu 22.04
kayabaNerve May 26, 2024
47c5259
Ubuntu 20.04, Rust 1.72
kayabaNerve May 26, 2024
a81616f
Normalize x86-64 to x86_64
kayabaNerve May 26, 2024
a02d5c7
Rust 1.69
kayabaNerve May 26, 2024
aca23ff
LTO off
kayabaNerve May 26, 2024
5da6196
Correct typo in MATCHES statement
kayabaNerve May 26, 2024
3edfd1c
Correct in-tree code to Rust 1.69
kayabaNerve May 26, 2024
64f4859
Link additional libs on Windows
kayabaNerve May 26, 2024
b7a3fcc
Abort on panic, fix 32-bit Windows undefined reference
kayabaNerve May 26, 2024
15d899a
Only provide dummy _Unwind_Resume on x86 Windows
kayabaNerve May 26, 2024
8b6f426
Link additional libs on Windows (yet actually adding the relevant cha…
kayabaNerve May 26, 2024
afb807b
Use a single target_link_libraries call
kayabaNerve May 26, 2024
90f915b
Touch up merge for cross-compilation fixes
j-berman Jul 26, 2024
24a68cd
Resolve cross-compile errors
j-berman Jul 26, 2024
fbdb96d
resolve rebase to master issues
j-berman Jul 26, 2024
4754425
Instantiate m_curve_trees on BlockchainLMDB class in c'tor
j-berman Jul 26, 2024
6520e37
include fcmp/curve_trees.h in db_lmdb.h
j-berman Jul 26, 2024
0a4b05c
Add * point from bytes
kayabaNerve Jul 27, 2024
b965059
fcmp++: add support for new fcmp types in cryptonote::transaction
j-berman Aug 1, 2024
930f881
fix json tagging in fcmp_pp serialization
j-berman Aug 1, 2024
d1a6e2c
Use explicit code instead of macro in custom fcmp_pp serialization
j-berman Aug 1, 2024
36507f5
Store points in the tree in compressed encoding (32 bytes)
j-berman Aug 1, 2024
21e5e14
Store {O,C} for each leaf tuple instead of {O.x,I.x,C.x}
j-berman Aug 2, 2024
d4e6f8c
Optimize conversion from output to leaf tuple
j-berman Aug 3, 2024
ab85646
Don't copy when flattening leaves
j-berman Aug 3, 2024
14e5c42
cleaner crypto for converting output to leaf tuple
j-berman Aug 3, 2024
3b1782a
fcmp++: Restart migration from where it leaves off
j-berman Aug 8, 2024
000128d
fcmp++: compilation fixes + misc. cleanup
j-berman Aug 8, 2024
89863ce
32-bit platform compatibility in Rust FFI (untested)
j-berman Aug 8, 2024
d1a2714
Revert DELETE_DB macro to original spot
j-berman Aug 8, 2024
3556379
Rename everything from fcmp* to fcmp_pp
j-berman Aug 8, 2024
0757712
fix clang compile errors
j-berman Aug 8, 2024
41273c7
fcmp++: implement iterative audit_tree function
j-berman Aug 9, 2024
1e4c574
fcmp++: store {output pubkey, commitment} in db, pre-torsion clear
j-berman Aug 9, 2024
de07924
link correct cncrypto and ringct_basic libs
j-berman Aug 9, 2024
d0203d2
Remove ringct dep in fcmp_pp, impl in fcmp_pp_crypto
j-berman Aug 9, 2024
f7c1374
add missing files
j-berman Aug 9, 2024
71d9f37
Don't store output_id in locked_outpust table, table stays ordered
j-berman Aug 10, 2024
a03a670
Clean lmbd impl
j-berman Aug 10, 2024
31b98c9
lmdb touchup && OutputsByUnlockBlock map -> unordered_map
j-berman Aug 13, 2024
0759785
new_leaf_tuples -> new_outputs
j-berman Aug 13, 2024
dfaf3d1
fcmp++: proof len from inputs *AND merkle tree depth
j-berman Aug 14, 2024
5211960
Fix compile on arm-linux-androideabi (32-bit) using a newer NDK
j-berman Sep 3, 2024
9edfb7b
fcmp++: trim tree when removing a block
j-berman Sep 4, 2024
8ddb268
fcmp++: Enable trimming to empty tree
j-berman Sep 5, 2024
bd297ab
fcmp++ LMDB: use dummy key optimization on leaves table
j-berman Sep 5, 2024
82d0075
fcmp++: LMDB touchups
j-berman Sep 6, 2024
483e0a2
fcmp++: tests now test trimming to empty tree
j-berman Sep 6, 2024
4db2f7d
fcmp++: add test to trim the tree then grow again after trimming
j-berman Sep 6, 2024
348964c
fcmp++: better test names
j-berman Sep 6, 2024
71becc7
Use macro to de-dupe curve trees test logic
j-berman Sep 6, 2024
7cdc02b
fcmp++ tests: init tree once in memory and grow copy
j-berman Sep 8, 2024
4677b71
fcmp++ tests: init tree in db once, then copy db for tests
j-berman Sep 9, 2024
c0a4952
fix ubuntu 20 compile
j-berman Sep 9, 2024
46358e1
fcmp++: multithreaded hashing children chunks into tree
j-berman Sep 10, 2024
3955f5f
fcmp++: multithreaded convert valid outputs into leaf tuples
j-berman Sep 10, 2024
884e5f1
fcmp++: output may not be present in locked outputs table on remove
j-berman Sep 11, 2024
a6c2837
fcmp++ lmdb: migration touchups
j-berman Sep 12, 2024
ff35fcb
fcmp++: key image migration
j-berman Sep 12, 2024
fc0536a
fcmp++: fix build errs for ki_context_t hash specialization
j-berman Sep 12, 2024
7b9127e
crypto: fe_batch_invert using Montgomery's trick
j-berman Sep 16, 2024
0cd6bd8
fcmp++: use batch inversion when converting outputs to leaf tupels
j-berman Sep 16, 2024
fe6fe59
Fix build errs + warnings
j-berman Sep 17, 2024
e705a42
fcmp++: use fe * instead of vector<fe> + clean up
j-berman Sep 17, 2024
6a1350a
small touchups
j-berman Sep 17, 2024
d415a80
crypto: test more batch inversions
j-berman Sep 17, 2024
bf83f8d
fcmp++: rename "PreWeiX" -> "EdYDerivatives" + small touchups
j-berman Sep 17, 2024
55035bd
missing ref
j-berman Sep 17, 2024
625f88f
fcmp++ tests: set up test for prove
j-berman Sep 18, 2024
6f608eb
fcmp++: fix trim_tree get_trim_layer_instructions logic err
j-berman Oct 7, 2024
c7b9a64
fcmp++: fix migration batching to resize db as needed
j-berman Oct 21, 2024
e0ca4ed
Bootstrappable Builds
tobtoht Jul 2, 2023
c25f2dc
depends: freebsd_base: update to 12.3
tobtoht Aug 25, 2024
bade043
guix: bump time-machine to 9d09b0cf841fb657a1aec12e9bab68e00c2b493c
tobtoht Sep 1, 2024
8a7cdda
build: drop support for 32-bit windows target
tobtoht Aug 17, 2024
6b7869a
Bootstrappable FCMP++
tobtoht Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- uses: msys2/setup-msys2@v2
with:
update: true
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf mingw-w64-x86_64-libusb mingw-w64-x86_64-unbound git pkg-config
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf mingw-w64-x86_64-libusb mingw-w64-x86_64-unbound mingw-w64-x86_64-rust git pkg-config
- name: build
run: |
${{env.CCACHE_SETTINGS}}
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,43 @@ jobs:
toolchain:
- name: "RISCV 64bit"
host: "riscv64-linux-gnu"
rust_host: "riscv64gc-unknown-linux-gnu"
packages: "python3 gperf g++-riscv64-linux-gnu"
- name: "ARM v7"
host: "arm-linux-gnueabihf"
rust_host: "armv7-unknown-linux-gnueabihf"
packages: "python3 gperf g++-arm-linux-gnueabihf"
- name: "ARM v8"
host: "aarch64-linux-gnu"
rust_host: "aarch64-unknown-linux-gnu"
packages: "python3 gperf g++-aarch64-linux-gnu"
- name: "i686 Win"
host: "i686-w64-mingw32"
packages: "python3 g++-mingw-w64-i686"
- name: "i686 Linux"
host: "i686-pc-linux-gnu"
rust_host: "i686-unknown-linux-gnu"
packages: "gperf cmake g++-multilib python3-zmq"
- name: "Win64"
host: "x86_64-w64-mingw32"
rust_host: "x86_64-pc-windows-gnu"
packages: "cmake python3 g++-mingw-w64-x86-64"
- name: "x86_64 Linux"
host: "x86_64-unknown-linux-gnu"
rust_host: "x86_64-unknown-linux-gnu"
packages: "gperf cmake python3-zmq libdbus-1-dev libharfbuzz-dev"
- name: "Cross-Mac x86_64"
host: "x86_64-apple-darwin"
rust_host: "x86_64-apple-darwin"
packages: "cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev python3-setuptools-git"
- name: "Cross-Mac aarch64"
host: "aarch64-apple-darwin"
rust_host: "aarch64-apple-darwin"
packages: "cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev python3-setuptools-git"
- name: "x86_64 Freebsd"
host: "x86_64-unknown-freebsd"
rust_host: "x86_64-unknown-freebsd"
packages: "clang-8 gperf cmake python3-zmq libdbus-1-dev libharfbuzz-dev"
- name: "ARMv8 Android"
host: "aarch64-linux-android"
rust_host: "aarch64-linux-android"
packages: "gperf cmake python3"
name: ${{ matrix.toolchain.name }}
steps:
Expand Down Expand Up @@ -95,8 +102,13 @@ jobs:
run: ${{env.APT_SET_CONF}}
- name: install dependencies
run: sudo apt update; sudo apt -y install build-essential libtool cmake autotools-dev automake pkg-config bsdmainutils curl git ca-certificates ccache ${{ matrix.toolchain.packages }}
- name: install rust target
# We can't use the latest Rust due to LLVM 17 not working with old `ld`s (such as in Ubuntu 20.04) for RISC-V
# We could update ld (a pain), update Ubuntu (requires a large amount of changes), or downgrade Rust
# We can't use Rust 1.70 due to LLVM 16 requiring ld >= 2.40 when building for Windows
run: rustup toolchain install 1.69; rustup default 1.69; rustup target add ${{ matrix.toolchain.rust_host }}
- name: prepare w64-mingw32
if: ${{ matrix.toolchain.host == 'x86_64-w64-mingw32' || matrix.toolchain.host == 'i686-w64-mingw32' }}
if: ${{ matrix.toolchain.host == 'x86_64-w64-mingw32' }}
run: |
sudo update-alternatives --set ${{ matrix.toolchain.host }}-g++ $(which ${{ matrix.toolchain.host }}-g++-posix)
sudo update-alternatives --set ${{ matrix.toolchain.host }}-gcc $(which ${{ matrix.toolchain.host }}-gcc-posix)
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/gitian.yml

This file was deleted.

104 changes: 104 additions & 0 deletions .github/workflows/guix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: ci/gh-actions/guix

on:
push:
paths:
- 'contrib/depends/**'
- 'contrib/guix/**'
- '!contrib/**.md'
- '.github/workflows/guix.yml'
pull_request:
paths:
- 'contrib/depends/**'
- 'contrib/guix/**'
- '!contrib/**.md'
- '.github/workflows/guix.yml'

jobs:
cache-sources:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: depends sources cache
id: cache
uses: actions/cache@v4
with:
path: contrib/depends/sources
key: sources-${{ hashFiles('contrib/depends/packages/*') }}
- name: download depends sources
if: steps.cache.outputs.cache-hit != 'true'
run: make -C contrib/depends download

build-guix:
runs-on: ubuntu-24.04
needs: [cache-sources]
strategy:
fail-fast: false
matrix:
toolchain:
- target: "x86_64-linux-gnu"
- target: "aarch64-linux-gnu"
- target: "arm-linux-gnueabihf"
- target: "riscv64-linux-gnu"
- target: "i686-linux-gnu"
- target: "x86_64-w64-mingw32"
- target: "x86_64-unknown-freebsd"
- target: "x86_64-apple-darwin"
- target: "aarch64-apple-darwin"
- target: "aarch64-linux-android"
- target: "arm-linux-androideabi"

name: ${{ matrix.toolchain.target }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: remove bundled packages
# This is faster than rm -rf
run: |
sudo mkdir /empty
sudo rsync -a --delete /empty/ /usr/local
- name: depends sources cache
uses: actions/cache/restore@v4
with:
path: contrib/depends/sources
key: sources-${{ hashFiles('contrib/depends/packages/*') }}
- name: install dependencies
run: sudo apt update; sudo apt -y install guix git ca-certificates
- name: apparmor workaround
# https://bugs.launchpad.net/ubuntu/+source/guix/+bug/2064115
run: |
sudo tee /etc/apparmor.d/guix << EOF
abi <abi/4.0>,
include <tunables/global>
profile guix /usr/bin/guix flags=(unconfined) {
userns,
include if exists <local/guix>
}
EOF
sudo /etc/init.d/apparmor reload
sudo aa-enforce guix || true
sudo apt purge apparmor
- name: build
run: ADDITIONAL_GUIX_TIMEMACHINE_FLAGS="--disable-authentication" SUBSTITUTE_URLS='http://bordeaux.guix.gnu.org' HOSTS="${{ matrix.toolchain.target }}" ./contrib/guix/guix-build
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.toolchain.target }}
path: |
guix/guix-build-*/output/${{ matrix.toolchain.target }}/*
guix/guix-build-*/logs/${{ matrix.toolchain.target }}/*

bundle-logs:
runs-on: ubuntu-24.04
needs: [build-guix]
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- uses: actions/upload-artifact@v4
with:
name: "logs"
path: '**/logs/**'
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ miniupnpcstrings.h
version/
ClangBuildAnalyzerSession.txt

# gitian
contrib/gitian/builder/
contrib/gitian/docker/
contrib/gitian/sigs/
# guix
/guix

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

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ if(MINGW)
elseif(APPLE OR OPENBSD OR ANDROID)
set(EXTRA_LIBRARIES "")
elseif(FREEBSD)
set(EXTRA_LIBRARIES execinfo)
set(EXTRA_LIBRARIES execinfo elf)
elseif(DRAGONFLY)
find_library(COMPAT compat)
set(EXTRA_LIBRARIES execinfo ${COMPAT})
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Portions Copyright (c) 2012-2013 The Cryptonote developers.
- [Release staging schedule and protocol](#release-staging-schedule-and-protocol)
- [Compiling Monero from source](#compiling-monero-from-source)
- [Dependencies](#dependencies)
- [Gitian builds](#gitian-builds)
- [Guix builds](#guix-builds)
- [Internationalization](#Internationalization)
- [Using Tor](#using-tor)
- [Pruning](#Pruning)
Expand Down Expand Up @@ -597,9 +597,9 @@ USE_DEVICE_TREZOR=OFF make release

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

### Gitian builds
### Guix builds

See [contrib/gitian/README.md](contrib/gitian/README.md).
See [contrib/guix/README.md](contrib/guix/README.md).

## Installing Monero from a package

Expand Down
11 changes: 8 additions & 3 deletions contrib/depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ include builders/$(build_os).mk
include builders/default.mk
include packages/packages.mk

ifeq ($(GUIX_ENVIRONMENT),)
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)
Expand All @@ -98,6 +99,10 @@ $(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)
else
build_id_string:=$(realpath $(GUIX_ENVIRONMENT))
$(host_arch)_$(host_os)_id_string:=$(realpath $(GUIX_ENVIRONMENT))
endif

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

toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin)
final_build_id_long+=$(shell $(build_SHA256SUM) toolchain.cmake.in)
final_build_id_long+=:[sha256sum]:$(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)
Expand All @@ -124,8 +129,8 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
$(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|@CC@|$(host_CC)|' \
-e 's|@CXX@|$(host_CXX)|' \
-e 's|@AR@|$(toolchain_path)$(host_AR)|' \
-e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \
-e 's|@NM@|$(toolchain_path)$(host_NM)|' \
Expand Down
38 changes: 23 additions & 15 deletions contrib/depends/funcs.mk
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
define int_vars
#Set defaults for vars which may be overridden per-package
$(1)_cc=$($($(1)_type)_CC)
$(1)_cxx=$($($(1)_type)_CXX)
$(1)_objc=$($($(1)_type)_OBJC)
$(1)_objcxx=$($($(1)_type)_OBJCXX)
$(1)_ar=$($($(1)_type)_AR)
$(1)_ranlib=$($($(1)_type)_RANLIB)
$(1)_libtool=$($($(1)_type)_LIBTOOL)
$(1)_nm=$($($(1)_type)_NM)
$(1)_cflags=$($($(1)_type)_CFLAGS) $($($(1)_type)_$(release_type)_CFLAGS)
$(1)_cxxflags=$($($(1)_type)_CXXFLAGS) $($($(1)_type)_$(release_type)_CXXFLAGS)
$(1)_arflags=$($($(1)_type)_ARFLAGS) $($($(1)_type)_$(release_type)_ARFLAGS)
$(1)_ldflags=$($($(1)_type)_LDFLAGS) $($($(1)_type)_$(release_type)_LDFLAGS) -L$($($(1)_type)_prefix)/lib
$(1)_cppflags=$($($(1)_type)_CPPFLAGS) $($($(1)_type)_$(release_type)_CPPFLAGS) -I$($($(1)_type)_prefix)/include
$(1)_cc=$$($$($(1)_type)_CC)
$(1)_cxx=$$($$($(1)_type)_CXX)
$(1)_objc=$$($$($(1)_type)_OBJC)
$(1)_objcxx=$$($$($(1)_type)_OBJCXX)
$(1)_ar=$$($$($(1)_type)_AR)
$(1)_ranlib=$$($$($(1)_type)_RANLIB)
$(1)_libtool=$$($$($(1)_type)_LIBTOOL)
$(1)_nm=$$($$($(1)_type)_NM)
$(1)_cflags=$$($$($(1)_type)_CFLAGS) \
$$($$($(1)_type)_$$(release_type)_CFLAGS)
$(1)_cxxflags=$$($$($(1)_type)_CXXFLAGS) \
$$($$($(1)_type)_$$(release_type)_CXXFLAGS)
$(1)_arflags=$$($$($(1)_type)_ARFLAGS) \
$$($$($(1)_type)_$(release_type)_ARFLAGS)
$(1)_ldflags=$$($$($(1)_type)_LDFLAGS) \
$$($$($(1)_type)_$$(release_type)_LDFLAGS) \
-L$$($($(1)_type)_prefix)/lib
$(1)_cppflags=$$($$($(1)_type)_CPPFLAGS) \
$$($$($(1)_type)_$$(release_type)_CPPFLAGS) \
-I$$($$($(1)_type)_prefix)/include
$(1)_recipe_hash:=
endef

Expand All @@ -37,6 +44,7 @@ endef

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

Expand All @@ -46,7 +54,7 @@ $(eval $(1)_all_dependencies:=$(call int_get_all_dependencies,$(1),$($($(1)_type
$(foreach dep,$($(1)_all_dependencies),$(eval $(1)_build_id_deps+=$(dep)-$($(dep)_version)-$($(dep)_recipe_hash)))
$(eval $(1)_build_id_long:=$(1)-$($(1)_version)-$($(1)_recipe_hash)-$(release_type) $($(1)_build_id_deps) $($($(1)_type)_id_string))
$(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)))
final_build_id_long+=$($(package)_build_id_long)
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):

#compute package-specific paths
$(1)_build_subdir?=.
Expand Down Expand Up @@ -267,4 +275,4 @@ $(foreach package,$(all_packages),$(eval $(call int_config_attach_build_config,$
$(foreach package,$(all_packages),$(eval $(call int_add_cmds,$(package))))

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