diff --git a/.gitignore b/.gitignore index bedf6ec..605461c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ configure build-aux .deps .dirstamp +.static glorytun build* VERSION diff --git a/Makefile b/Makefile index b843257..ae18752 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,8 @@ CFLAGS ?= -std=c11 -O2 -Wall -fstack-protector-strong FLAGS := $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) FLAGS += -DPACKAGE_NAME=\"$(NAME)\" -DPACKAGE_VERSION=\"$(VERSION)\" -FLAGS += -Ilibsodium-stable/src/libsodium/include -FLAGS += -Llibsodium-stable/src/libsodium/.libs +FLAGS += -I.static/$(CROSS)/libsodium-stable/src/libsodium/include +FLAGS += -L.static/$(CROSS)/libsodium-stable/src/libsodium/.libs SRC := argz/argz.c mud/mud.c $(wildcard src/*.c) diff --git a/sodium.sh b/sodium.sh index 7d7e191..93d9878 100755 --- a/sodium.sh +++ b/sodium.sh @@ -1,7 +1,11 @@ #!/bin/sh +mkdir -p .static +cd .static || exit 1 + file=LATEST.tar.gz url=https://download.libsodium.org/libsodium/releases +dir="$PWD" [ -f "$file" ] || wget -q "$url/$file" -O "$file" [ -f "$file" ] || curl -SsfLO "$url/$file" @@ -10,9 +14,14 @@ url=https://download.libsodium.org/libsodium/releases exit 1 } +if [ "$1" ]; then + mkdir -p "$1" + cd "$1" || exit 1 +fi + rm -rf libsodium-stable -tar zxf "$file" +tar zxf "$dir/$file" cd libsodium-stable || exit 1 -./configure --enable-minimal --disable-dependency-tracking --enable-static --disable-shared +./configure ${1+--host=$1} --enable-minimal --disable-dependency-tracking --enable-static --disable-shared make -j