packages/libei.nix
λlib, stdenv, erlang?, otpSrc?, otpVersion?, openssl, zlib
| lib | |
| stdenv | |
| erlang | default null |
| otpSrc | default erlang.src |
| otpVersion | default erlang.version |
| openssl | |
| zlib |
let
lib.versionAtLeastotpVersion "27"
in
stdenv.mkDerivation
"libei"
"source/lib/erl_interface"
true
true
chmod -R u+w "$NIX_BUILD_TOP/source"
runHook preConfigure
export ERL_TOP="$NIX_BUILD_TOP/source"
export OTP_HOST="$("$ERL_TOP/make/autoconf/config.guess")"
configureFlags=(
--build="$OTP_HOST"
--host="$OTP_HOST"
)
${lib.optionalStringsupportsDynamicLib ''
configureFlags+=(--enable-ei-dynamic-lib)
''}
# The standalone erl_interface configure does not generate the OTP
# verbosity include that its generated Makefile expects.
substitute "$ERL_TOP/make/output.mk.in" "$ERL_TOP/make/output.mk" \
--replace-fail "@DEFAULT_VERBOSITY@" "0"
./configure "''${configureFlags[@]}"
runHook postConfigure
runHook preBuild
# Force this empty so GNU ld never interprets OTP's "-Wl,-R" runtime-path
# setting as "--just-symbols=<first-object>" when building shared libei.
# Older OTP releases that do not build shared libei simply ignore it.
make -C src -f "$OTP_HOST/Makefile" \
ERL_TOP="$ERL_TOP" \
LIB_LD_FLAG_RUNTIME_LIBRARY_PATH= \
opt
runHook postBuild
runHook preInstall
install -Dm644 include/*.h -t "$out/include"
install -Dm644 "obj/$OTP_HOST/libei.a" "$out/lib/libei.a"
install -Dm644 "obj/$OTP_HOST/libei_st.a" "$out/lib/libei_st.a"
if [ -f "lib/$OTP_HOST/libei.so" ]; then
install -Dm755 "lib/$OTP_HOST/libei.so" "$out/lib/libei.so"
install -Dm755 "lib/$OTP_HOST/libei_st.so" "$out/lib/libei_st.so"
fi
install -Dm755 "bin/$OTP_HOST/erl_call" "$out/bin/erl_call"
runHook postInstall