pkg-config support for urcrypt, update urbit build

This commit is contained in:
Paul Driver 2020-10-09 13:40:31 -07:00
parent 4ca4082704
commit 988d1fe445
10 changed files with 53 additions and 42 deletions

View File

@ -14,9 +14,8 @@ let
};
urcrypt = import ./urcrypt {
inherit libaes_siv;
inherit (pkgs) stdenv pkgconfig openssl gmp;
inherit (deps) scrypt secp256k1;
inherit pkgs;
inherit deps;
};
mkUrbit = { debug }:

View File

@ -32,7 +32,7 @@ let
inherit name meta;
exename = name;
src = ../../../pkg/urbit;
nativeBuildInputs = deps ++ vendor;
nativeBuildInputs = [ pkgs.pkgconfig ] ++ deps ++ vendor;
configurePhase = ''
bash ./configure

View File

@ -2,6 +2,9 @@ source $stdenv/setup
cp -r $src ./src
chmod -R u+w ./src
cd ./src
cd src
PREFIX=$out make install
./autogen.sh
./configure --prefix=$out $configureFlags
make
make install

View File

@ -1,11 +1,16 @@
{ stdenv, pkgconfig, openssl, gmp, secp256k1, scrypt, libaes_siv }:
{ pkgs, deps }:
stdenv.mkDerivation rec {
pkgs.stdenv.mkDerivation rec {
name = "urcrypt";
builder = ./builder.sh;
src = ../../../pkg/urcrypt;
buildInputs = [
pkgconfig openssl gmp secp256k1 scrypt libaes_siv
];
nativeBuildInputs =
with pkgs;
[ autoconf automake libtool m4 pkgconfig ];
buildInputs =
with pkgs;
with deps;
[ openssl gmp secp256k1 scrypt libaes_siv ];
}

View File

@ -4,8 +4,6 @@ let
in
import ./default.nix {
inherit (pkgs)
stdenv openssl gmp pkgconfig;
inherit (deps)
libaes_siv scrypt secp256k1;
inherit pkgs;
inherit deps;
}

22
pkg/urbit/configure vendored
View File

@ -4,9 +4,11 @@ set -e
URBIT_VERSION="0.10.8"
deps=" \
curl gmp sigsegv argon2 ed25519 ent h2o scrypt uv murmur3 secp256k1 \
softfloat3 ssl crypto z lmdb aes_siv urcrypt pthread \
pkg_config_deps="liburcrypt"
extra_libs="\
urcrypt curl gmp sigsegv ent h2o scrypt uv murmur3 \
softfloat3 ssl z lmdb pthread \
"
headers=" \
@ -65,7 +67,7 @@ case $(tr A-Z a-z <<< $os) in
;;
*freebsd*)
defmacro U3_OS_bsd 1
osdeps="kvm"
extra_libs="${extra_libs} kvm"
;;
*openbsd*)
defmacro U3_OS_bsd 1
@ -76,13 +78,15 @@ case $(tr A-Z a-z <<< $os) in
;;
esac
for dep in ${osdeps-} $deps
do LDFLAGS="${LDFLAGS-} -l$dep"
${PKG_CONFIG-pkg-config} --cflags --libs $dep 2>/dev/null || true
CFLAGS="${CFLAGS-} $(${PKG_CONFIG-pkg-config} --cflags $pkg_config_deps)"
LDFLAGS="${LDFLAGS-} $(${PKG_CONFIG-pkg-config} --libs --static $pkg_config_deps)"
for lib in ${extra_libs}; do
LDFLAGS="${LDFLAGS-} -l$lib"
done
for header in $headers
do LDFLAGS="${LDFLAGS-} -I$header"
for header in $headers; do
CFLAGS="${CFLAGS-} -I$header"
done
cat >config.mk <<EOF

View File

@ -1,17 +0,0 @@
build-aux
libtool
stamp-h1
Makefile
Makefile.in
aclocal.m4
autom4te.cache
config.h*
config.status
config.log
configure
.deps
.libs
.dirstamp
*.lo
*.o
*.la

View File

@ -15,6 +15,8 @@ noinst_HEADERS = ed25519/src/ed25519.h \
argon2/src/blake2/blake2.h
# main library
pkgconfig_DATA = liburcrypt.pc
liburcrypt_la_CPPFLAGS = -I$(srcdir)/ed25519/src \
-I$(srcdir)/ge-additions \
-I$(srcdir)/argon2/include \

View File

@ -17,6 +17,10 @@ AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
AM_PROG_AR
LT_INIT
# Initialize pkgconfig
PKG_PROG_PKG_CONFIG
PKG_INSTALLDIR
# Checks for programs
AC_PROG_CC
@ -66,5 +70,5 @@ AC_TYPE_UINT8_T
AC_CHECK_FUNCS([memset])
# Finish and output
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Makefile liburcrypt.pc])
AC_OUTPUT

View File

@ -0,0 +1,13 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: @PACKAGE_NAME@
Description: cryptography library for urbit
URL: https://github.com/urbit/urcrypt
Version: @PACKAGE_VERSION@
Cflags: -I${includedir}
Requires.private: libcrypto libsecp256k1
Libs: -L${libdir} -lurcrypt
Libs.private: -laes_siv