Add cabal flag 'export-dynamic'
Default behavior is to include all symbols in the dynamic symbol table,
as this makes it possible to load dynamic lua libraries.  However, it is
sometimes desirable to disable, e.g., when compiling a fully static
binary.
See jgm/pandoc#3986.
@@ -53,6 +53,12 @@ flag allow-unsafe-gc
with extreme care.
default: True
+flag export-dynamic
+ description: Add all symbols to dynamic symbol table; disabling this
+ will make it possible to create fully static binaries,
+ but renders loading of dynamic C libraries impossible.
+ default: True
+
flag luajit
description: Link with LuaJIT. This implies flag system-lua as well.
default: False
@@ -166,6 +172,7 @@ library
if os(linux)
cc-options: "-DLUA_USE_LINUX"
+ if flag(export-dynamic)
ld-options: "-Wl,-E"
if os(darwin)
@@ -173,6 +180,7 @@ library
if os(freebsd)
cc-options: "-DLUA_USE_POSIX"
+ if flag(export-dynamic)
ld-options: "-Wl,-E"
if flag(lua_32bits)
