Set zlib as pie to fix libz-sys

This commit is contained in:
Wildan M 2026-06-06 10:21:29 +02:00
parent 9c25e638cd
commit 4c4a712ab5

View File

@ -5,14 +5,11 @@ blake3 = "ec1abc6f672a7a6ee6f49ba544cc9529f73121b478310473be44fee22a140ebf"
[build] [build]
template = "custom" template = "custom"
script = """ script = """
DYNAMIC_INIT DYNAMIC_STATIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(--prefix="/usr") COOKBOOK_CONFIGURE_FLAGS=(--prefix="/usr" --shared --static)
if [ "${COOKBOOK_DYNAMIC}" == "1" ] # TODO: fPIC is the default on linux but not on redox and
then # required by libz-sys as zlib statically linked there
COOKBOOK_CONFIGURE_FLAGS+=(--shared) export CFLAGS="$CFLAGS -fPIC"
else
COOKBOOK_CONFIGURE_FLAGS+=(--static)
fi
# See https://stackoverflow.com/questions/21396988/zlib-build-not-configuring-properly-with-cross-compiler-ignores-ar. # See https://stackoverflow.com/questions/21396988/zlib-build-not-configuring-properly-with-cross-compiler-ignores-ar.
env CHOST="${TARGET}" "${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" env CHOST="${TARGET}" "${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}"
"${COOKBOOK_MAKE}" -j "$(nproc)" "${COOKBOOK_MAKE}" -j "$(nproc)"
@ -22,4 +19,4 @@ if [ -e "${solib}" ]
then then
patchelf --set-soname 'libz.so.1.3' "${solib}" patchelf --set-soname 'libz.so.1.3' "${solib}"
fi fi
""" """