On i386, the ocaml runtime causes text relocations. Pass the -znotext

linker option to everything that links with the ocaml library.
This commit is contained in:
naddy 2018-12-15 16:25:25 +00:00
parent 4947645f4b
commit 2d6377da3e
3 changed files with 24 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.8 2017/09/16 09:03:15 jasper Exp $
# $OpenBSD: Makefile,v 1.9 2018/12/15 16:25:25 naddy Exp $
MULTI_PACKAGES = -ocaml -main
@ -11,6 +11,7 @@ VERSION = 0.9
DISTNAME = cudf-${VERSION}
PKGNAME-ocaml = ocaml-cudf-${VERSION}
PKGNAME-main = libcudf-${VERSION}
REVISION = 0
MASTER_SITES = https://gforge.inria.fr/frs/download.php/file/36602/
@ -44,6 +45,10 @@ TEST_TARGET = test
ALL_TARGET += opt c-lib-opt
.endif
.if ${MACHINE_ARCH} == "i386"
MAKE_ENV += LDFLAGS="-Wl,-znotext"
.endif
TEST_TARGET += c-lib-test
docdir = ${PREFIX}/share/doc/cudf/

View File

@ -1,17 +1,20 @@
$OpenBSD: patch-c-lib_Makefile,v 1.2 2017/09/16 09:03:15 jasper Exp $
$OpenBSD: patch-c-lib_Makefile,v 1.3 2018/12/15 16:25:25 naddy Exp $
- OpenBSD doesn't need libdl
- use pkg-config to find glib libs
- make sure libcamlrun.a is writable after copying it from system libs
- don't attempt to overwrite an optimized library with a non-existant one
- fix .pc datarootdir
- allow for additional linker flags
Index: c-lib/Makefile
--- c-lib/Makefile.orig
+++ c-lib/Makefile
@@ -13,7 +13,7 @@ PROG_CFLAGS = -Wall
@@ -12,8 +12,8 @@ CFLAGS = -Wall -DG_LOG_DOMAIN=\"libCUDF\"
PROG_CFLAGS = -Wall
OCAML_LIBDIR := $(shell ocamlc -where)
INCLUDES = -I . -I $(OCAML_LIBDIR) $(shell pkg-config --cflags glib-2.0)
CUDF_LDFLAGS = -L$(OCAML_LIBDIR) -L$(CURDIR)
-CUDF_LDFLAGS = -L$(OCAML_LIBDIR) -L$(CURDIR)
-CUDF_CLIBS = -lcudf -lm -ldl -lunix -lncurses -lglib-2.0
+CUDF_LDFLAGS = -L$(OCAML_LIBDIR) -L$(CURDIR) $(LDFLAGS)
+CUDF_CLIBS = -lcudf -lm -lunix -lncurses $(shell pkg-config --libs glib-2.0)
OCAMLC = ocamlfind ocamlc -package unix,extlib
OCAMLOPT = ocamlfind ocamlopt -package unix,extlib
@ -28,15 +31,16 @@ Index: c-lib/Makefile
ar r $@ $^
../_build/%:
@@ -53,6 +55,7 @@ cudf.pc: cudf.pc.in
@@ -53,6 +55,8 @@ cudf.pc: cudf.pc.in
-e "s,@VERSION@,$(VERSION),g" \
-e "s,@LIBDIR@,$(LIBDIR),g" \
-e "s,@INCDIR@,$(INCDIR),g" \
+ -e "s,@DATAROOTDIR@,$(PREFIX),g" \
+ -e "s:@LDFLAGS@:$(LDFLAGS):g" \
> $@
%.o: %.c
@@ -72,7 +75,6 @@ install: cudf.pc
@@ -72,7 +76,6 @@ install: cudf.pc
else \
cp libcudf.a $(DESTDIR)$(LIBDIR)/libcudf.a ; \
fi

View File

@ -1,18 +1,21 @@
$OpenBSD: patch-c-lib_cudf_pc_in,v 1.1.1.1 2014/10/25 12:50:29 chrisz Exp $
$OpenBSD: patch-c-lib_cudf_pc_in,v 1.2 2018/12/15 16:25:25 naddy Exp $
- fix datarootdir
--- c-lib/cudf.pc.in.orig Fri Aug 3 12:44:51 2012
+++ c-lib/cudf.pc.in Sat Apr 13 15:37:06 2013
@@ -1,6 +1,6 @@
- allow for additional linker flags
Index: c-lib/cudf.pc.in
--- c-lib/cudf.pc.in.orig
+++ c-lib/cudf.pc.in
@@ -1,11 +1,12 @@
libdir=@LIBDIR@
includedir=@INCDIR@
-datarootdir=/usr/share
+datarootdir=@DATAROOTDIR@
datadir=${datarootdir}
ocaml_libdir=@OCAMLLIBDIR@
+ldflags=@LDFLAGS@
@@ -8,4 +8,4 @@ Name: CUDF
Name: CUDF
Description: access descriptions of package upgrade problems
Version: @VERSION@
Requires: glib-2.0
-Libs: -L${libdir} -L${ocaml_libdir} -lcudf -lm -ldl -lunix -lncurses
+Libs: -L${libdir} -L${ocaml_libdir} -lcudf -lm -lunix -lncurses
+Libs: -L${libdir} -L${ocaml_libdir} ${ldflags} -lcudf -lm -lunix -lncurses