From ef382a8090644ecbe80fc708bbb1900ee725862f Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Mon, 25 Sep 2023 13:08:49 -0400 Subject: [PATCH] `urcrypt` builds --- .github/workflows/ares-shared.yml | 15 +++++++++++++++ README.md | 7 +++++++ rust/ares/build.rs | 6 +++--- rust/ares/src/urcrypt/.gitignore | 4 ++++ rust/ares/src/urcrypt/build-aux/m4/.gitkeep | 0 rust/ares/src/urcrypt/configure.ac | 13 ++++++++----- 6 files changed, 37 insertions(+), 8 deletions(-) delete mode 100644 rust/ares/src/urcrypt/build-aux/m4/.gitkeep diff --git a/.github/workflows/ares-shared.yml b/.github/workflows/ares-shared.yml index 7c00c57..a865a16 100644 --- a/.github/workflows/ares-shared.yml +++ b/.github/workflows/ares-shared.yml @@ -22,6 +22,21 @@ jobs: - name: Format run: cargo fmt --check + # Install third-party dependencies + # + - name: Install dependencies + run: | + sudo apt-get install -y \ + libcrypto++-dev \ + openssl \ + cmake \ + libsecp256k1-dev && + git clone https://github.com/dfoxfranke/libaes_siv.git && + cd libaes_siv && + cmake . && + make && + sudo make install + # See clippy linter docs: https://github.com/rust-lang/rust-clippy # # First linter is set to fail for all warnings, then ignored warnings are diff --git a/README.md b/README.md index 007e8fd..d0cc2d6 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,10 @@ A redesigned Mars for the Urth/Mars Urbit runtime. Currently WIP. Read the [proposal](docs/proposal/proposal-nock-performance.md) and [hypotheses](docs/proposal/hypotheses.md) for an overview. Before branching or opening a PR please review the [contribution guidelines](CONTRIBUTING.md). + +## Installation + +Dependencies: +* [`libaes_siv`](https://github.com/dfoxfranke/libaes_siv) +* [`openssl`](https://github.com/openssl/openssl) +* [`libsecp256k1`](https://github.com/bitcoin-core/secp256k1) diff --git a/rust/ares/build.rs b/rust/ares/build.rs index 64a2531..196f7d9 100644 --- a/rust/ares/build.rs +++ b/rust/ares/build.rs @@ -1,11 +1,10 @@ -use autotools; - fn main() { use std::env; let profile = env::var("PROFILE").unwrap(); println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=./src/pma"); + println!("cargo:rerun-if-changed=./src/urcrypt"); match profile.as_ref() { "debug" => debug(), @@ -46,8 +45,9 @@ fn debug() { .compile("pma_malloc"); let _urcrypt = autotools::Config::new("./src/urcrypt") + .reconf("-if") + .enable_shared() .disable_static() - .disable_shared() .build(); } diff --git a/rust/ares/src/urcrypt/.gitignore b/rust/ares/src/urcrypt/.gitignore index b464b3f..8361cd4 100644 --- a/rust/ares/src/urcrypt/.gitignore +++ b/rust/ares/src/urcrypt/.gitignore @@ -1,5 +1,6 @@ *.pc config.h +config.log config.status libtool @@ -27,10 +28,12 @@ build-aux/compile /config.cache build-aux/config.guess /config.h.in +/config.h.in~ build-aux/config.log build-aux/config.status build-aux/config.sub /configure +/configure~ /configure.scan build-aux/depcomp build-aux/install-sh @@ -54,3 +57,4 @@ build-aux/m4/lt~obsolete.m4 # can automatically generate from config.status script # (which is called by configure script)) Makefile + diff --git a/rust/ares/src/urcrypt/build-aux/m4/.gitkeep b/rust/ares/src/urcrypt/build-aux/m4/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/rust/ares/src/urcrypt/configure.ac b/rust/ares/src/urcrypt/configure.ac index bdf78c1..002e646 100644 --- a/rust/ares/src/urcrypt/configure.ac +++ b/rust/ares/src/urcrypt/configure.ac @@ -56,18 +56,21 @@ AC_PROG_CC # Checks for pkg-config capable libraries PKG_CHECK_MODULES([LIBSECP256K1], [libsecp256k1]) +ac_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $LIBSECP256K1_CFLAGS" AC_CHECK_HEADER([secp256k1_recovery.h], [], [AC_MSG_ERROR([libsecp256k1 must have recovery enabled.])]) AC_CHECK_HEADER([secp256k1_schnorrsig.h], [], [AC_MSG_ERROR([libsecp256k1 must have Schnorr signatures enabled.])]) +CPPFLAGS=$ac_save_CPPFLAGS PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto]) AS_IF([test "$enable_shared" == "yes"], [# ensure crypto will be shared for shared object (see README.md) - save_LDFLAGS=$LDFLAGS - save_CLAGS=$CFLAGS - LDFLAGS=$LIBCRYPTO_LIBS - CFLAGS=$LIBCRYPTO_CFLAGS + save_LIBS=$LIBS + save_CFLAGS=$CFLAGS + LIBS="$LIBCRYPTO_LIBS $LIBS" + CFLAGS="$LIBCRYPTO_CFLAGS $CFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [[unsigned char sha[32]; SHA256("hello", 5, sha);]])], @@ -79,7 +82,7 @@ AS_IF([test "$enable_shared" == "yes"], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([cannot find shared object for libcrypto.])])], [AC_MSG_ERROR([unable to link libcrypto.])]) - LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS CFLAGS=$save_CFLAGS]) # Checks for non pkg-config libraries