Hi,
this is mainly for getting rid of overriding things via CONFIGURE_ENV
and CFLAGS in favor of patching aclocal.m4 and configure.ac (and
running autoconf), which may help getting this merged upstream.
It also kills some left-over -fno-pie which came from
patches/patch-configure.
I decided to drop the clang-specific
-Wno-unused-command-line-argument -Wno-expansion-to-defined
for now, because the warnings, although a little bit annoying, are
harmless, and because this should be fixed elsewhere -- it's not
specific to OpenBSD.
Tested on amd64 *and* i386 this time, by building all the hs ports
and also by giving ghci a quick try.
Does this make sense?
Ciao,
Kili
Index: Makefile
===
RCS file: /cvs/ports/lang/ghc/Makefile,v
retrieving revision 1.173
diff -u -p -r1.173 Makefile
--- Makefile17 May 2020 18:06:07 - 1.173
+++ Makefile29 May 2020 21:40:37 -
@@ -12,7 +12,7 @@ COMMENT = compiler for the functional l
NO_CCACHE =Yes
DISTNAME = ghc-${MODGHC_VER}
-REVISION = 3
+REVISION = 4
CATEGORIES = lang devel
HOMEPAGE = https://www.haskell.org/ghc/
@@ -43,7 +43,7 @@ BUILD_DEPENDS = archivers/bzip2 \
textproc/py-sphinx${MODPY_FLAVOR}
RUN_DEPENDS =
-# GHC build uses -Wl,-z,wxneeded on OpenBSD for amd64.
+# GHC build uses -Wl,-z,wxneeded on OpenBSD.
# XXX: wxneeded is a hack. Fix rts/Linker.c, mmapForLinker() and
# loadObj_() instead.
USE_WXNEEDED = special
@@ -106,14 +106,8 @@ SUBST_VARS += ${_i}_VER
USE_GMAKE =Yes
USE_GROFF =Yes
-.if ${MACHINE_ARCH} == "i386"
-CFLAGS += -Wl,-znotext
-# On i386, we still have to explicitely set -Wl,-z,wxneeded (in
-# addition to -Wl,-znotext).
-GHC_CC_OPTS = -Wl,-znotext -Wl,-z,wxneeded
-.endif
-
-CONFIGURE_STYLE = gnu
+AUTOCONF_VERSION = 2.69
+CONFIGURE_STYLE = gnu autoconf no-autoheader
CONFIGURE_ARGS += --with-ffi-includes=${LOCALBASE}/include \
--with-ffi-libraries=${LOCALBASE}/lib \
--with-gmp-includes=${LOCALBASE}/include \
@@ -127,13 +121,6 @@ CONFIGURE_ARGS += --with-ffi-includes=${
# with /usr/bin/ld.lld: error: cannot preempt symbol: memcpy
CONFIGURE_ARGS += --disable-ld-override
-CONFIGURE_ENV += CONF_CC_OPTS_STAGE0="${GHC_CC_OPTS}" \
- CONF_CC_OPTS_STAGE1="${GHC_CC_OPTS}" \
- CONF_CC_OPTS_STAGE2="${GHC_CC_OPTS}" \
- CONF_GCC_LINKER_OPTS_STAGE0="${GHC_CC_OPTS}" \
- CONF_GCC_LINKER_OPTS_STAGE1="${GHC_CC_OPTS}" \
- CONF_GCC_LINKER_OPTS_STAGE2="${GHC_CC_OPTS}"
-
CONFIGURE_ENV +=
SPHINXBUILD=${LOCALBASE}/bin/sphinx-build${MODPY_BIN_SUFFIX}
# Do not pick up gpatch
@@ -170,6 +157,11 @@ post-patch:
LD_LIBRARY_PATH=${BOOTSTRAP_SHLIBS} \
${MAKE_PROGRAM} install
rm -rf ${WRKDIR}/ghc-${BIN_VER}
+ # HACK for i386 until we have new bootstrappers. This is needed
+ # to let the bootstrapper use -Wl,-znotext building things like
+ # utils/hsc2hs.
+ sed -ie '/"C compiler flags"/s/-U__i686/-Wl,-znotext &/' \
+ ${WRKDIR}/bootstrap/lib/ghc/settings
# - Create some wrapper scripts setting LD_LIBRARY_PATH
cd ${WRKDIR}/bin && \
for f in $$(ls ../bootstrap/bin); do \
@@ -248,12 +240,3 @@ _bootstrap_finish:
pax -wzf ghc-${MODGHC_VER}.${BOOTSTRAP_DATE}-shlibs-$$(arch
-s){.tar.gz,}
.include
-
-# Silence clang when used by ghc to process assembler files and gets
-# flags chat don't make sense for assembly mode. Also, silence warnings
-# about macro expansions producing 'defined' (occuring in
-# includes/rts/storage/ClosureMacros.h, which has already been fixed
-# upstream)
-.if ${PROPERTIES:Mclang}
-GHC_CC_OPTS += -Wno-unused-command-line-argument -Wno-expansion-to-defined
-.endif
Index: patches/patch-aclocal_m4
===
RCS file: patches/patch-aclocal_m4
diff -N patches/patch-aclocal_m4
--- /dev/null 1 Jan 1970 00:00:00 -
+++ patches/patch-aclocal_m429 May 2020 21:40:37 -
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+Index: aclocal.m4
+--- aclocal.m4.orig
aclocal.m4
+@@ -691,6 +691,13 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
+ $4="$$4 -z wxneeded"
+ ;;
+
++i386-*-openbsd*)
++# On i386, we also need -z notext in addition to -z wxneeded.
++$2="$$2 -Wl,-z,notext"
++$3="$$3 -Wl,-z,wxneeded -Wl,-z,notext"
++$4="$$4 -z wxneeded -z notext"
++;;
++
+ esac
+
+ # If gcc knows about the stack protector, turn it off.
Index: patches/patch-configure
===
RCS file: patches/patch-configure
diff -N patches/patch-configure
---