From 2d6377da3ef1731259c5106d6b0813389c7b576c Mon Sep 17 00:00:00 2001 From: naddy Date: Sat, 15 Dec 2018 16:25:25 +0000 Subject: [PATCH] On i386, the ocaml runtime causes text relocations. Pass the -znotext linker option to everything that links with the ocaml library. --- devel/cudf/Makefile | 7 ++++++- devel/cudf/patches/patch-c-lib_Makefile | 14 +++++++++----- devel/cudf/patches/patch-c-lib_cudf_pc_in | 15 +++++++++------ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/devel/cudf/Makefile b/devel/cudf/Makefile index 0e3002f6bd4..05684b51a91 100644 --- a/devel/cudf/Makefile +++ b/devel/cudf/Makefile @@ -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/ diff --git a/devel/cudf/patches/patch-c-lib_Makefile b/devel/cudf/patches/patch-c-lib_Makefile index a2dfda70a80..78067fb1f87 100644 --- a/devel/cudf/patches/patch-c-lib_Makefile +++ b/devel/cudf/patches/patch-c-lib_Makefile @@ -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 diff --git a/devel/cudf/patches/patch-c-lib_cudf_pc_in b/devel/cudf/patches/patch-c-lib_cudf_pc_in index d952df7d99d..85bfb3ade5e 100644 --- a/devel/cudf/patches/patch-c-lib_cudf_pc_in +++ b/devel/cudf/patches/patch-c-lib_cudf_pc_in @@ -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