fix: statically link GMP into leanpkg if STATIC=ON

This commit is contained in:
Sebastian Ullrich 2021-01-25 12:26:27 +01:00
parent 38819ef6ea
commit 5fea8fcba3
2 changed files with 6 additions and 1 deletions

View file

@ -10,12 +10,14 @@
# * `-U LEAN_MULTI_THREAD` can be used to optimize programs not making use of multi-threading
# * `-print-cflags`: print C compiler flags necessary for building against the Lean runtime and abort
# * `-print-ldlags`: print C compiler flags necessary for statically linking against the Lean library and abort
# * Set the `LEANC_GMP` environment variable to a path to `libgmp.a` (or `-l:libgmp.a` on Linux) to link GMP statically.
# Beware of the licensing consequences since GMP is LGPL.
set -e
bindir=$(dirname $0)
cflags=("-I$bindir/../include")
ldflags=("-L$bindir/../lib/lean" "-lgmp" @LEANC_EXTRA_FLAGS@)
ldflags=("-L$bindir/../lib/lean" "${LEANC_GMP:--lgmp}" @LEANC_EXTRA_FLAGS@)
ldflags_ext=(@LEANC_STATIC_LINKER_FLAGS@)
for arg in "$@"; do
# passed -shared ~> switch to shared linker flags

View file

@ -3,6 +3,9 @@ SHELL := /usr/bin/env bash -euo pipefail
# any absolute path to the stdlib breaks the Makefile
LEAN_PATH=
# link GMP statically if STATIC=ON
LEANC_GMP="${GMP_LIBRARIES}"
# LEAN_OPTS: don't use native code (except for primitives) since it is from the previous stage
# MORE_DEPS: rebuild the stdlib whenever the compiler has changed
LEANMAKE_OPTS=\