one working function in so

This commit is contained in:
Paul Driver 2020-07-30 13:07:13 -07:00
parent d7287d2114
commit 74d06deb1b
5 changed files with 16 additions and 32 deletions

View File

@ -1,12 +0,0 @@
{ env_name, env, deps }:
env.make_derivation rec {
name = "urcrypt";
builder = ./release.sh;
src = ../../../pkg/urcrypt;
cross_inputs = [ deps.ed25519 deps.ge-additions ];
CC = "${env.host}-gcc";
AR = "${env.host}-ar";
}

View File

@ -5,5 +5,5 @@ pkgs.stdenv.mkDerivation rec {
builder = ./builder.sh;
src = ../../../pkg/urcrypt;
nativeBuildInputs = [ ed25519 ge-additions ];
buildInputs = [ ed25519 ge-additions ];
}

View File

@ -1,13 +0,0 @@
source $setup
cp -r $src ./src
chmod -R u+w ./src
cd ./src
for dep in $cross_inputs; do
export CFLAGS="${CFLAGS-} -I$dep/include"
export LDFLAGS="${LDFLAGS-} -L$dep/lib"
done
PREFIX=$out make install

View File

@ -19,9 +19,6 @@ let
ge-additions = env:
import ./pkgs/ge-additions/cross.nix env;
urcrypt = env:
import ./pkgs/urcrypt/cross.nix env;
libaes_siv = env:
import ./pkgs/libaes_siv/cross.nix env;

View File

@ -6,14 +6,26 @@ PREFIX ?= ./out
.PHONY: all test install clean
all: urcrypt.c urcrypt.h
$(CC) $(CFLAGS) -O3 -Wall -Werror -pedantic -std=gnu99 -c urcrypt.c
$(AR) rcs liburcrypt.a urcrypt.o
CFLAGS := $(CFLAGS) -O3 -Wall -Werror -pedantic -std=gnu99
SOURCES = urcrypt.c urcrypt.h
liburcrypt.a: $(SOURCES)
$(CC) $(CFLAGS) -c urcrypt.c -o urcrypt-static.o
$(AR) rcs liburcrypt.a urcrypt-static.o
liburcrypt.so: $(SOURCES)
$(CC) $(CFLAGS) -fPIC -c urcrypt.c -o urcrypt-shared.o
$(CC) -shared urcrypt-shared.o -o liburcrypt.so \
-led25519 -lge-additions \
-Wl,--no-undefined
all: liburcrypt.a liburcrypt.so
install: all
@mkdir -p $(PREFIX)/lib/
@mkdir -p $(PREFIX)/include/
cp liburcrypt.a $(PREFIX)/lib/
cp liburcrypt.so $(PREFIX)/lib/
cp urcrypt.h $(PREFIX)/include/
clean: