summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2017-05-27 12:09:22 +0000
committerkib <kib@FreeBSD.org>2017-05-27 12:09:22 +0000
commit4f979b0380fb706f9b3a3740cf9c39f52e6c8a3c (patch)
tree57f7c6c2a8450ab9979fa004f0d516fa352011f8
parent73489f5c62c59fdad87b9b0b3f43cff74ba2f3b5 (diff)
downloadFreeBSD-ports-4f979b0380fb706f9b3a3740cf9c39f52e6c8a3c.zip
FreeBSD-ports-4f979b0380fb706f9b3a3740cf9c39f52e6c8a3c.tar.gz
Fix lang/ghc after ino64 src commit.
Approved by: bapt, pgj Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D10798
-rw-r--r--lang/ghc/Makefile11
-rw-r--r--lang/ghc/files/wrap.c55
2 files changed, 66 insertions, 0 deletions
diff --git a/lang/ghc/Makefile b/lang/ghc/Makefile
index 0e35445..a260be9 100644
--- a/lang/ghc/Makefile
+++ b/lang/ghc/Makefile
@@ -239,6 +239,9 @@ post-extract:
@${REINPLACE_CMD} -e 's|@SettingsCCompilerFlags@|& -Qunused-arguments|' ${BOOT_DIR}/settings.in
.endif
.endif
+.if empty(PORT_OPTIONS:MBOOT) && ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200031
+ @${REINPLACE_CMD} -e 's|@SettingsCCompilerLinkFlags@|& -Wl,--wrap=readdir_r,--wrap=stat,--wrap=lstat,--wrap=fstat,--wrap=mknod|' ${BOOT_DIR}/settings.in
+.endif
post-install-script:
@${FIND} -ds ${GHC_LIBDIR} -type f -print | ${SED} -E -e \
@@ -269,6 +272,14 @@ post-patch:
pre-configure:
@${MKDIR} ${TMPDIR}
+.if empty(PORT_OPTIONS:MBOOTH) && ${OPSYS} == FreeBSD && \
+ ${OSVERSION} >= 1200031
+ ${CC} ${CFLAGS} -c -o ${BOOT_DIR}/wrap.o ${PATCHDIR}/wrap.c
+ for x in ${BOOT_DIR}/rts/dist/build/libCffi*.a; do \
+ ${AR} q $$x ${BOOT_DIR}/wrap.o; ${RANLIB} $$x; \
+ done
+ rm ${BOOT_DIR}/wrap.o
+.endif # Do not merge, prev condition need to grow OSVER check.
.if empty(PORT_OPTIONS:MBOOT)
@(cd ${BOOT_DIR} && ${CONFIGURE_ENV} ${CONFIGURE_CMD} ${CONFIGURE_ARGS_BOOT})
@(cd ${BOOT_DIR} && PACKAGES='' ${MAKE_CMD} install)
diff --git a/lang/ghc/files/wrap.c b/lang/ghc/files/wrap.c
new file mode 100644
index 0000000..d818d9a
--- /dev/null
+++ b/lang/ghc/files/wrap.c
@@ -0,0 +1,55 @@
+/* -*- ugly-hack-mode -*- */
+/* $FreeBSD$ */
+
+#include <sys/stat.h>
+
+struct old_dirent;
+struct old_stat;
+
+__asm(".symver old_readdir_r, readdir_r@FBSD_1.0");
+int old_readdir_r(void *dirp, struct old_dirent *entry,
+ struct old_dirent **result);
+__asm(".symver old_stat, stat@FBSD_1.0");
+int old_stat(const char * restrict path, struct old_stat * restrict sb);
+__asm(".symver old_lstat, lstat@FBSD_1.0");
+int old_lstat(const char * restrict path, struct old_stat * restrict sb);
+__asm(".symver old_fstat, fstat@FBSD_1.0");
+int old_fstat(int fd, struct old_stat *sb);
+__asm(".symver old_mknod, mknod@FBSD_1.0");
+int old_mknod(const char *path, mode_t mode, uint32_t dev);
+
+int
+__wrap_readdir_r(void *dirp, struct old_dirent *entry,
+ struct old_dirent **result)
+{
+
+ return (old_readdir_r(dirp, entry, result));
+}
+
+int
+__wrap_stat(const char * restrict path, struct old_stat * restrict sb)
+{
+
+ return (old_stat(path, sb));
+}
+
+int
+__wrap_lstat(const char * restrict path, struct old_stat * restrict sb)
+{
+
+ return (old_lstat(path, sb));
+}
+
+int
+__wrap_fstat(int fd, struct old_stat *sb)
+{
+
+ return (old_fstat(fd, sb));
+}
+
+int
+__wrap_mknod(const char *path, mode_t mode, uint32_t dev)
+{
+
+ return (old_mknod(path, mode, dev));
+}
OpenPOWER on IntegriCloud