ocaml: Fix ocamlmklib wrapper script for ld options.

Tested by wiz for relro.
This commit is contained in:
jperkin 2021-01-12 11:19:17 +00:00
parent c252fe075f
commit d3bdd1a46f

View file

@ -1,6 +1,6 @@
#!@SH@
#
# $NetBSD: wrapper.sh,v 1.4 2021/01/10 11:13:33 jperkin Exp $
# $NetBSD: wrapper.sh,v 1.5 2021/01/12 11:19:17 jperkin Exp $
CFLAGS='@CFLAGS@'
LDFLAGS='@LDFLAGS@'
@ -10,13 +10,20 @@ for flag in ${CFLAGS}; do
cflags="${cflags} -ccopt ${flag}"
done
for flag in ${LDFLAGS}; do
ldflags="${ldflags} -ccopt ${flag}"
cldflags="${cldflags} -ccopt ${flag}"
ldflags="${ldflags} -ldopt ${flag}"
done
if echo "$@" | grep ' -c ' >/dev/null; then
MLFLAGS="${cflags}"
else
case "${WRAPPEE} $@" in
ocamlmklib*)
MLFLAGS="${cflags} ${ldflags}"
fi
;;
*" -c "*)
MLFLAGS="${cflags}"
;;
*)
MLFLAGS="${cflags} ${cldflags}"
;;
esac
exec "@OCAML_PREFIX@/bin/${WRAPPEE}" ${MLFLAGS} "$@"