Allow static compilation w/o installed deps - pee - Pee a password manager;Pee - because you have to...
(HTM) git clone git://vernunftzentrum.de/pee.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 7a88e2804ae2cd6fdce70ecf46d257df4454e9f1
(DIR) parent 5090a86785a73a89d30da9ef24aa32bcb85a2873
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
Date: Sun, 21 Aug 2016 19:15:09 +0200
Allow static compilation w/o installed deps
This will setup a local private repo, install the dependencies into that
so that import libraries will be found.
Before this patch compilation would have worked only when some deps have
been available in the system wide CHICKEN repo.
Diffstat:
compile.sh | 78 ++++++++++++++++++++-----------
1 file changed, 51 insertions(+), 27 deletions(-)
---
(DIR) diff --git a/compile.sh b/compile.sh
@@ -1,41 +1,65 @@
#!/bin/sh
set -e
+#to debug change this
+DEVNULL=/dev/null
+
+# order matters
+DEPS="\
+fmt \
+matchable \
+string-utils \
+check-errors \
+blob-utils \
+foreigners \
+getopt-long \
+stty \
+tweetnacl \
+"
+
+echo "Getting version info from git"
echo -n '(define-constant commit-id "'\
$(git show -q | grep ^commit| awk '{print $2 }') '")' > hash
echo -n '(define-constant program-version "' $(git tag | sort -nr | head -1) '")' > tag
-chicken-install -r blob-utils >/dev/null || echo Fetching blob-utils has failed.
-chicken-install -r check-errors >/dev/null || echo Fetching check-errors has failed.
-chicken-install -r foreigners >/dev/null || echo Fetching foreigners has failed.
-chicken-install -r getopt-long >/dev/null || echo Fetching getopt-long has failed.
-chicken-install -r matchable >/dev/null || echo Fetching matchable has failed.
-chicken-install -r string-utils >/dev/null || echo Fetching string-utils has failed.
-chicken-install -r stty >/dev/null || echo Fetching stty has failed.
-chicken-install -r tweetnacl >/dev/null || echo Fetching tweetnacl has failed.
-chicken-install -r fmt > /dev/null || echo Fetching fmt has failed.
+echo "Creating local repo"
+chicken-install -i ./repo > $DEVNULL
+export CHICKEN_REPOSITORY=$(pwd)/repo
+CSC_OPTION="-r ./repo"
+
+echo -n "Downloading dependencies: "
+for d in $DEPS
+do
+ echo -n "$d "
+ chicken-install -r $d 2>&1 >$DEVNULL || (echo "Fetching $d has failed." && exit 1)
+ cd $d && (chicken-install) 2>&1 >$DEVNULL && echo -n "(inst), " && cd - > $DEVNULL
+done
+echo "done."
+echo
+echo -n "Building static pee program... "
cd fmt
-csc -unit fmt -emit-import-library fmt -uses ports,srfi-1,srfi-69,srfi-13,extras,data-structures -c fmt-chicken.scm -o fmt.o && mv fmt.o fmt.import.scm ..
+csc -unit fmt -emit-import-library fmt -uses ports,srfi-1,srfi-69,srfi-13,extras,data-structures -c fmt-chicken.scm -o fmt.o && mv fmt.o fmt.import.scm .. 2>&1 >$DEVNULL
cd ..
cd matchable
-csc -unit matchable -emit-import-library matchable -c matchable.scm -o matchable.o
+csc -unit matchable -emit-import-library matchable -c matchable.scm -o matchable.o 2>&1 >$DEVNULL
mv matchable.o matchable.import.scm ..; cd ..
-csc -unit to-hex -emit-import-library to-hex -c string-utils/to-hex.scm -o to-hex.o
-csc -unit type-errors -J -c ./check-errors/type-errors.scm -o type-errors.o
-csc -unit type-checks -uses type-errors -J -c ./check-errors/type-checks.scm -o type-checks.o
-csc -unit blob-hexadecimal -uses type-checks -uses to-hex -emit-import-library blob-hexadecimal -c blob-utils/blob-hexadecimal.scm -o blob-hexadecimal.o
-csc -unit crypto-helper -uses blob-hexadecimal -emit-import-library crypto-helper -c crypto-helper.scm -c blake2s-ref.c -o crypto-helper.o -C --std=c99
-csc -unit foreigners -uses matchable -emit-import-library foreigners -emit-import-library renaming -c foreigners/foreigners.scm -o foreigners.o
-csc -unit getopt-long -uses srfi-13 -uses srfi-14 -uses data-structures -uses matchable -Jc getopt-long/getopt-long.scm -o getopt-long.o
-csc -unit tweetnacl -emit-import-library tweetnacl -c tweetnacl/tweetnacl.scm -c tweetnacl/tweetnacl.impl.c -C -I./tweetnacl -o tweetnacl.o
-csc -uses matchable -uses foreigners -c stty/stty.scm -emit-import-library stty -unit stty -o stty.o
-csc -uses srfi-1,srfi-4,srfi-13,srfi-14,utils,stty,crypto-helper,tweetnacl,getopt-long,fmt,matchable -c pee.scm -o pee.o
-csc -static *o ./tweetnacl/tweetnacl.impl.o -o pee
-
-strip ./pee
-
-rm -r matchable blob-utils check-errors foreigners getopt-long string-utils stty tweetnacl hash tag fmt
-rm *.o *.import.*
+csc -unit to-hex -emit-import-library to-hex -c string-utils/to-hex.scm -o to-hex.o 2>&1 >$DEVNULL
+csc -unit type-errors -J -c ./check-errors/type-errors.scm -o type-errors.o 2>&1 >$DEVNULL
+csc -unit type-checks -uses type-errors -J -c ./check-errors/type-checks.scm -o type-checks.o 2>&1 >$DEVNULL
+csc -unit blob-hexadecimal -uses type-checks -uses to-hex -emit-import-library blob-hexadecimal -c blob-utils/blob-hexadecimal.scm -o blob-hexadecimal.o 2>&1 >$DEVNULL
+csc -unit crypto-helper -uses blob-hexadecimal -emit-import-library crypto-helper -c crypto-helper.scm -c blake2s-ref.c -o crypto-helper.o -C --std=c99 2>&1 >$DEVNULL
+csc -unit foreigners -uses matchable -emit-import-library foreigners -emit-import-library renaming -c foreigners/foreigners.scm -o foreigners.o 2>&1 >$DEVNULL
+csc -unit getopt-long -uses srfi-13 -uses srfi-14 -uses data-structures -uses matchable -Jc getopt-long/getopt-long.scm -o getopt-long.o 2>&1 >$DEVNULL
+csc -unit tweetnacl -emit-import-library tweetnacl -c tweetnacl/tweetnacl.scm -c tweetnacl/tweetnacl.impl.c -C -I./tweetnacl -o tweetnacl.o 2>&1 >$DEVNULL
+csc -uses matchable -uses foreigners -c stty/stty.scm -emit-import-library stty -unit stty -o stty.o 2>&1 >$DEVNULL
+csc -uses srfi-1,srfi-4,srfi-13,srfi-14,utils,stty,crypto-helper,tweetnacl,getopt-long,fmt,matchable -c pee.scm -o pee-unit.o 2>&1 >$DEVNULL
+csc -strip -static *.o ./tweetnacl/tweetnacl.impl.o -o pee 2>&1 >$DEVNULL
+echo "done."
+
+echo "Cleaning up."
+rm -r $DEPS repo
+rm -f *.o *.import.* pee.c
+echo "Build done."