-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Statically linked binary releases
This patch modifies the Docker workflow to build a statically linked portable binary of Alt-Ergo, following [1]. Building the Linux binaries is fairly quick and hence performed on push/pull_request. It can also be manually requested. [1] : https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml/
- Loading branch information
1 parent
adafb41
commit 21a9058
Showing
4 changed files
with
81 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
|
||
set -ue | ||
|
||
LINK_MODE="$1" | ||
OS="$2" | ||
FLAGS= | ||
CCLIB= | ||
|
||
case "$LINK_MODE" in | ||
dynamic) | ||
;; # No extra flags needed | ||
static) | ||
case "$OS" in | ||
linux) | ||
CCLIB="-static -no-pie";; | ||
*) | ||
echo "No known static compilation flags for '$OS'" >&2 | ||
exit 1 | ||
esac;; | ||
mixed) | ||
FLAGS="-noautolink" | ||
CCLIB="-lstdcompat_stubs -lcamlzip -lnums -lzarith -lcamlstr -lunix -lz" | ||
LIBS="gmp" | ||
case "$OS" in | ||
linux) | ||
for lib in $LIBS; do | ||
CCLIB="$CCLIB -l$lib" | ||
done | ||
CCLIB="-Wl,-Bstatic $CCLIB -Wl,-Bdynamic";; | ||
macosx) | ||
for lib in $LIBS; do | ||
if [[ $lib == lib* ]]; then | ||
archive="$lib.a" | ||
else | ||
archive="lib$lib.a" | ||
fi | ||
CCLIB="$CCLIB $(pkg-config $lib --variable libdir)/$archive" | ||
done;; | ||
*) | ||
echo "No known mixed compilation flags for '$OS'" >&2 | ||
exit 1 | ||
esac;; | ||
|
||
*) | ||
echo "Invalid link mode '$LINK_MODE'" >&2 | ||
exit 2 | ||
esac | ||
|
||
echo '(' | ||
echo ' -linkall' | ||
for f in $FLAGS; do echo " $f"; done | ||
for f in $CCLIB; do echo " -cclib $f"; done | ||
echo ')' |