pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/lang/ghc80
Module Name: pkgsrc
Committed By: pho
Date: Fri Jan 3 15:24:08 UTC 2020
Added Files:
pkgsrc/lang/ghc80: BOOTSTRAP.txt DEINSTALL DESCR INSTALL Makefile
bootstrap.mk buildlink3.mk distinfo
pkgsrc/lang/ghc80/files: bootstrap.build.mk
pkgsrc/lang/ghc80/patches: patch-iserv_ghc.mk
patch-libraries_base_GHC_Event_KQueue.hsc
patch-libraries_base_System_Environment.hs
patch-libraries_time_lib_Data_Time_Clock_CTimespec.hsc
patch-libraries_time_lib_Data_Time_Clock_CTimeval.hs
patch-libraries_unix_System_Posix_Env.hsc
patch-libraries_unix_System_Posix_Env_ByteString.hsc
patch-libraries_unix_System_Posix_Files_Common.hsc
patch-libraries_unix_System_Posix_Signals.hsc
patch-libraries_unix_include_execvpe.h patch-rts_PosixSource.h
Log Message:
Import GHC 8.0.2
GHC: The Glasgow Haskell Compiler.
The Glasgow Haskell Compiler is a robust, fully-featured, optimising
compiler for the functional programming language Haskell 98
(http://www.haskell.org). GHC compiles Haskell to either native code
or C. It implements numerous experimental language extensions to
Haskell, including concurrency, a foreign language interface, several
type-system extensions, exceptions, and so on. GHC comes with a
generational garbage collector, a space and time profiler, and a
comprehensive set of libraries.
This package provides the 8.0.x release series, which is the last
version that can bootstrap with 7.10.3. It will probably be removed
once we make a separate package for GHC 8.4.x and get enough bootstrap
kits for it.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/ghc80/BOOTSTRAP.txt \
pkgsrc/lang/ghc80/DEINSTALL pkgsrc/lang/ghc80/DESCR \
pkgsrc/lang/ghc80/INSTALL pkgsrc/lang/ghc80/Makefile \
pkgsrc/lang/ghc80/bootstrap.mk pkgsrc/lang/ghc80/buildlink3.mk \
pkgsrc/lang/ghc80/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/ghc80/files/bootstrap.build.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/ghc80/patches/patch-iserv_ghc.mk \
pkgsrc/lang/ghc80/patches/patch-libraries_base_GHC_Event_KQueue.hsc \
pkgsrc/lang/ghc80/patches/patch-libraries_base_System_Environment.hs \
pkgsrc/lang/ghc80/patches/patch-libraries_time_lib_Data_Time_Clock_CTimespec.hsc \
pkgsrc/lang/ghc80/patches/patch-libraries_time_lib_Data_Time_Clock_CTimeval.hs \
pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Env.hsc \
pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Env_ByteString.hsc \
pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Files_Common.hsc \
pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Signals.hsc \
pkgsrc/lang/ghc80/patches/patch-libraries_unix_include_execvpe.h \
pkgsrc/lang/ghc80/patches/patch-rts_PosixSource.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Added files:
Index: pkgsrc/lang/ghc80/BOOTSTRAP.txt
diff -u /dev/null pkgsrc/lang/ghc80/BOOTSTRAP.txt:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/BOOTSTRAP.txt Fri Jan 3 15:24:08 2020
@@ -0,0 +1,20 @@
+GHC requires itself to build, and unfortunately the only way to get a
+working GHC for a foreign target is to do a cross-compilation.
+
+In order to build a bootkit for a new platform, you need to manually
+set up a cross-building C compiler and binutils, libc, libterminfo,
+and libiconv for the target. Then you can follow instructions in
+https://gitlab.haskell.org/ghc/ghc/wikis/building/cross-compiling
+
+Once you get a working GHC for the target platform, install it
+somewhere in your PATH, run "cd lang/ghc80; make clean; make bootstrap"
+on the target platform and you'll have a bootkit for the target.
+
+--
+
+GHC in fact has never supported bootstrapping only with a C compiler.
+Prior to GHC 7, it had a thing called "HC source", which was a set of
+C source files compiled from Haskell source, but it wasn't actually
+cross-platform. It was because HC files were generated with many
+assumptions about the platform, such as the layout of libc structs,
+the size of off_t and time_t, byte-order, word size, etc.
Index: pkgsrc/lang/ghc80/DEINSTALL
diff -u /dev/null pkgsrc/lang/ghc80/DEINSTALL:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/DEINSTALL Fri Jan 3 15:24:08 2020
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+GHC_VERSION="@GHC_VERSION@"
+
+case ${STAGE} in
+ DEINSTALL)
+ ${RM} -f ${PKG_PREFIX}/lib/${PKGBASE}-${GHC_VERSION}/package.conf.d/package.cache
+ ;;
+esac
Index: pkgsrc/lang/ghc80/DESCR
diff -u /dev/null pkgsrc/lang/ghc80/DESCR:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/DESCR Fri Jan 3 15:24:08 2020
@@ -0,0 +1,15 @@
+GHC: The Glasgow Haskell Compiler.
+
+The Glasgow Haskell Compiler is a robust, fully-featured, optimising
+compiler for the functional programming language Haskell 98
+(http://www.haskell.org). GHC compiles Haskell to either native code
+or C. It implements numerous experimental language extensions to
+Haskell, including concurrency, a foreign language interface, several
+type-system extensions, exceptions, and so on. GHC comes with a
+generational garbage collector, a space and time profiler, and a
+comprehensive set of libraries.
+
+This package provides the 8.0.x release series, which is the last
+version that can bootstrap with 7.10.3. It will probably be removed
+once we make a separate package for GHC 8.4.x and get enough bootstrap
+kits for it.
Index: pkgsrc/lang/ghc80/INSTALL
diff -u /dev/null pkgsrc/lang/ghc80/INSTALL:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/INSTALL Fri Jan 3 15:24:08 2020
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+
+case ${STAGE} in
+ POST-INSTALL)
+ ${PKG_PREFIX}/bin/ghc-pkg recache
+ ;;
+esac
Index: pkgsrc/lang/ghc80/Makefile
diff -u /dev/null pkgsrc/lang/ghc80/Makefile:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/Makefile Fri Jan 3 15:24:08 2020
@@ -0,0 +1,200 @@
+# $NetBSD: Makefile,v 1.1 2020/01/03 15:24:08 pho Exp $
+# -----------------------------------------------------------------------------
+# Package metadata
+#
+DISTNAME= ghc-8.0.2-src
+PKGNAME= ${DISTNAME:S/-src$//}
+CATEGORIES= lang
+MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
+EXTRACT_SUFX= .tar.xz
+
+MAINTAINER= pho%cielonegro.org@localhost
+HOMEPAGE= https://www.haskell.org/ghc/
+COMMENT= Compiler for the functional language Haskell - 8.0 Release Series
+LICENSE= modified-bsd
+
+# TODO: We should be using the alternatives framework.
+CONFLICTS+= ghc-[0-9]*
+
+# GHC requires GHC to build itself. Formerly we could work around this
+# bootstrapping problem by creating a special archive containing C
+# sources compiled from Haskell sources, but that's no longer
+# possible. So we have to prepare stripped-down binaries sufficient to
+# bootstrap compilers for each platforms. If you want to build them
+# yourself, follow instructions in BOOTSTRAP.txt and ./bootstrap.mk
+#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet
+#BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386 # Not available yet
+BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
+#BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-i386 # Not available yet
+#BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 # Not available yet
+
+
+# -----------------------------------------------------------------------------
+# Distfiles
+#
+DISTFILES= ${DEFAULT_DISTFILES}
+WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
+
+# We don't want to extract all of the DISTFILEs.
+EXTRACT_ONLY= ${DEFAULT_DISTFILES}
+
+
+# -----------------------------------------------------------------------------
+# Tools
+#
+# The runtime dependency on perl is due to the evil splitter
+# (lib/${PKGNAME_NOREV}/ghc-split).
+USE_TOOLS+= autoconf gmake gzip perl:run
+GNU_CONFIGURE= yes
+USE_GNU_CONFIGURE_HOST= no
+USE_LIBTOOL= yes
+
+CONFIGURE_ARGS.common= \
+ --with-gcc=${CC:Q} \
+ --with-ld=${LD:Q} \
+ --with-curses-libraries=${BUILDLINK_PREFIX.curses:Q}/${BUILDLINK_LIBDIRS.curses:Q} \
+ --with-gmp-includes=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_INCDIRS.gmp:Q} \
+ --with-gmp-libraries=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_LIBDIRS.gmp:Q} \
+ --with-iconv-includes=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_INCDIRS.iconv:Q} \
+ --with-iconv-libraries=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_LIBDIRS.iconv:Q} \
+ --with-system-libffi \
+ --with-ffi-includes=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_INCDIRS.libffi:Q} \
+ --with-ffi-libraries=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_LIBDIRS.libffi:Q}
+
+CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
+
+CONFIGURE_ENV+= \
+ ac_cv_path_fp_prog_ar=${AR:Q} \
+ PerlCmd=${PERL5:Q}
+
+# LDFLAGS is currently not honored by "./configure". Since LDFLAGS
+# contains rpath flags it's very important to force GHC to honor
+# it. Otherwise neither GHC itself nor executables it produces will
+# have any rpaths so users will have to put "${PREFIX}/lib" into their
+# "/etc/ld-elf.so.conf". See
+# http://hackage.haskell.org/trac/ghc/ticket/2933
+.for stage in 0 1 2
+CONFIGURE_ENV+= \
+ CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:Q}
+# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for
+# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
+# does more harm than good because our ${LDFLAGS} contains -Wl,*
+# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them
+# but those flags will also be baked into the compiler (see
+# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
+# the buildlink.
+.endfor
+
+# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT
+# because it needs to generate various kinds of code at run time. The
+# RTS linker, whose job is to load *static* objects at run time,
+# doesn't play nice with ASLR either. This means most executables
+# produced by GHC need them to be disabled. Perhaps we should patch
+# rts/sm/Storage.c so that it uses ffi_closure_alloc(3) on every
+# platform, not just Linux, and also drop support for static library
+# loading and switch to dynamic libraries entirely.
+.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc
+NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
+NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
+.endfor
+
+
+# -----------------------------------------------------------------------------
+# Build hooks
+#
+
+# We patch configure.ac in some directories.
+post-patch:
+ @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
+ ${RUN} cd ${WRKSRC:Q}/libraries/base && autoconf
+ ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf
+
+# Define the target "pre-configure" and non-standard "bootstrap".
+.include "../../lang/ghc80/bootstrap.mk"
+
+# Our pre-configure phase installs a bindist of bootstrapping compiler
+# directly into TOOLS_DIR so that ./configure can find it.
+
+# Here we generate mk/build.mk dynamically.
+post-configure:
+ ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk
+
+# If there is HsColour in the PATH, GHC's build system tries to use it
+# without even checking if it really works. That's not what we
+# appreciate.
+ ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC:Q}/mk/build.mk
+
+# Don't even think of PDF.
+ ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC:Q}/mk/build.mk
+
+
+# -----------------------------------------------------------------------------
+# Installation/removal hooks
+#
+
+# Substitutions for INSTALL and DEINSTALL that handles package.cache.
+FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
+
+# We don't want package.cache to be in the PLIST.
+post-install:
+ ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache
+
+
+# -----------------------------------------------------------------------------
+# PLIST
+#
+# We can't use static PLIST because the package installs files with a
+# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
+# [2019-12-27; pho].
+GENERATE_PLIST+= \
+ cd ${DESTDIR:Q}${PREFIX:Q} && \
+ ${FIND} * \( -type f -o -type l \) | ${SORT};
+
+
+# -----------------------------------------------------------------------------
+# Sanity checks
+#
+
+# There is an unused script which don't pass the portability test.
+CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
+
+# Dynamically linked Haskell executables and libraries have rpaths to
+# dependent Haskell libraries, but the problem is that they are
+# specified with $ORIGIN, which isn't currently supported by
+# ../../mk/check/check-shlibs-elf.awk.
+CHECK_SHLIBS_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
+.for f in ghc ghc-iserv-dyn ghc-pkg haddock hpc hsc2hs runghc
+CHECK_SHLIBS_SKIP+= lib/${PKGNAME_NOREV}/bin/${f}
+.endfor
+
+# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
+CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
+
+# ld: fatal: relocation error ... relocation requires reference symbol
+STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
+
+
+# -----------------------------------------------------------------------------
+# Dependencies
+#
+BUILDLINK_DEPMETHOD.python:= build
+.include "../../lang/python/pyversion.mk"
+BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
+
+# NetBSD 9.x have libcurses with a newer major version than the
+# bootstrap kit is linked against. For now, work around this with
+# compat80.
+.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*)
+BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
+# In a sandboxed build environment, we have to reach over to the
+# installed libraries themselves, since the symlinks compat80 adds
+# to the /usr tree can't be applied.
+MAKE_ENV+= LD_LIBRARY_PATH=${PREFIX:Q}/emul/netbsd/usr/lib
+.endif
+
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../devel/libffi/buildlink3.mk"
+.include "../../devel/gmp/buildlink3.mk"
+.include "../../mk/curses.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/lang/ghc80/bootstrap.mk
diff -u /dev/null pkgsrc/lang/ghc80/bootstrap.mk:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/bootstrap.mk Fri Jan 3 15:24:08 2020
@@ -0,0 +1,278 @@
+# $NetBSD: bootstrap.mk,v 1.1 2020/01/03 15:24:08 pho Exp $
+# -----------------------------------------------------------------------------
+# Select a bindist of bootstrapping compiler on a per-platform basis.
+#
+# BOOT_ARCHIVE
+# This variable is set to the name of compressed archive file of a
+# bootstrapping compiler for the current platform.
+#
+# BOOT_VERSION
+# Version of the bootstrapping compiler to use. This can be
+# overriden for specific platforms.
+#
+.include "../../mk/bsd.prefs.mk"
+
+# Notes on version dependencies:
+# * GHC 8.8.1 requires 8.4 or later to bootstrap.
+# * GHC 8.4.4 requires 8.0 or later to bootstrap.
+# * GHC 8.0.2 requires 7.8 or later to bootstrap.
+# * GHC 7.10.3 requires 7.6 or later to bootstrap.
+
+.if !empty(MACHINE_PLATFORM:MDarwin-*-powerpc) || make(distinfo) || make (makesum) || make(mdi)
+#BOOT_VERSION:= 7.10.3
+#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-powerpc-apple-darwin.tar.xz
+#DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
+.endif
+
+.if !empty(MACHINE_PLATFORM:MFreeBSD-*-i386) || make(distinfo) || make (makesum) || make(mdi)
+#BOOT_VERSION:= 7.10.3
+#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-i386-unknown-freebsd.tar.xz
+#DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
+.endif
+
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
+BOOT_VERSION:= 8.0.2
+BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-x86_64-unknown-netbsd.tar.xz
+DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
+.endif
+
+.if !empty(MACHINE_PLATFORM:MSunOS-*-i386) || make(distinfo) || make (makesum) || make(mdi)
+#BOOT_VERSION:= 7.10.3
+#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-i386-unknown-solaris2.tar.xz
+#DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
+.endif
+
+.if !empty(MACHINE_PLATFORM:MSunOS-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
+#BOOT_VERSION:= 7.10.3
+#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-x86_64-unknown-solaris2.tar.xz
+#DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
+.endif
+
+.if empty(BOOT_ARCHIVE)
+BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-unknown.tar.xz
+PKG_FAIL_REASON+= "internal error: unsupported platform"
+.endif
+
+# For package developers, please do not upload any bootkits unsafely
+# built. That is, machines shared with someone or on a cloud hosting
+# service should be avoided for building bootkits.
+.for i in ${DISTFILES:M*-boot-*}
+SITES.${i}?= ${MASTER_SITE_LOCAL}
+.endfor
+
+# Existence of libelf makes LeadingUnderscore being "NO", which is
+# incorrect for this platform. See ${WRKSRC}/aclocal.m4
+# (FP_LEADING_UNDERSCORE)
+.if ${OPSYS} == "Darwin"
+CONFLICTS+= libelf-[0-9]*
+.endif
+
+# FreeBSD < 10 surprisingly doesn't have a native iconv so we need to
+# use pkgsrc libiconv for this OPSYS. And if a bootkit depends on
+# pkgsrc libiconv, the "normal" build must do the same because GHC
+# always needs to link executables with libiconv, just like libgmp
+# when integer-gmp is used. For this reason it might be desirable to
+# create two separate bootkits, one for < 10 and another for >= 10.
+.if ${OPSYS} == "FreeBSD"
+USE_BUILTIN.iconv= no
+.endif
+
+# current bootstrap binary kit for SmartOS is built with ncurses5
+.if !empty(MACHINE_PLATFORM:MSunOS-*) && !empty(OS_VARIANT:U:MSmartOS)
+BUILD_DEPENDS+= ncurses>=5.0:../../devel/ncurses
+.endif
+
+
+# -----------------------------------------------------------------------------
+# The "pre-configure" hook
+#
+# Install a bootstrapping compiler directly into TOOLS_DIR so that
+# ./configure can find it.
+#
+USE_TOOLS+= gmake xzcat xz gtar
+
+pre-configure:
+ ${RUN}${TEST} -f ${DISTDIR:Q}/${DIST_SUBDIR:Q}/${BOOT_ARCHIVE} || \
+ ${FAIL_MSG} "Put your trusted bootstrap archive as ${DISTDIR}/${DIST_SUBDIR}/${BOOT_ARCHIVE}"
+
+ @${PHASE_MSG} "Extracting bootstrapping compiler for ${PKGNAME}"
+ ${RUN}${MKDIR} ${WRKDIR:Q}/build-extract
+ ${RUN}cd ${WRKDIR:Q}/build-extract && \
+ ${XZCAT} ${DISTDIR:Q}/${DIST_SUBDIR:Q}/${BOOT_ARCHIVE} | \
+ ${GTAR} -xf -
+
+# It is important to install the stage-0 compiler with our rpath flags
+# configured, otherwise it will produce executables with no rpath and
+# fail at the configure phase.
+ @${PHASE_MSG} "Preparing bootstrapping compiler for ${PKGNAME}"
+ ${RUN}cd ${WRKDIR:Q}/build-extract/${PKGNAME_NOREV}-boot && \
+ ${PKGSRC_SETENV} ${CONFIGURE_ENV} ${SH} ./configure \
+ --prefix=${TOOLS_DIR:Q} && \
+ ${MAKE_PROGRAM} install
+
+
+# -----------------------------------------------------------------------------
+# An unusual target "bootstrap"
+#
+# Build a bootstrapping compiler using an already installed GHC. This
+# can certainly be impossible if you don't have one. It's absolutely
+# important to build it with the fewest possible run-time
+# dependencies, otherwise the resulting binary can easily get
+# unusable.
+
+# We don't want our bootkits to have a run-time dependency on
+# libgcc. In fact GHC's implementation of Haskell exception handling
+# does not depend on libgcc's facilities so it is attractive to do the
+# same for "normal" build... but we can't. This is because Haskell
+# programs may call C functions via FFI, and those C functions may
+# call C++ functions in turn, possibly in a different shared library.
+.include "../../mk/compiler.mk"
+.if make(bootstrap) && !empty(CC_VERSION:Mgcc-*)
+# But on some platforms, gcc automagically inserts a dependency on a
+# shared libgcc when -lpthread is given, which is seemingly
+# unavoidable.
+LDFLAGS+= -static-libgcc
+.endif
+
+# Gather information about packages on which bootkit depends. It will
+# be used in the post-bootstrap phase.
+BOOT_GHC_DEPS:= curses iconv
+BOOT_GHC_PKGSRC_DEPS:= # empty
+.for pkg in ${BOOT_GHC_DEPS}
+
+# NOTE: pkglint(1) complains for including these builtin.mk files,
+# telling that we must include buildlink3.mk instead. But then how do
+# we get variables like USE_BUILTIN.${pkg} defined before including
+# ../../mk/bsd.pkg.mk, given that ../../mk/bsd.buildlink3.mk isn't
+# protected against multiple inclusion?
+CHECK_BUILTIN.${pkg}:= yes
+. if ${pkg} == "curses"
+. include "../../mk/curses.builtin.mk"
+. elif ${pkg} == "iconv"
+. include "../../converters/libiconv/builtin.mk"
+. endif
+CHECK_BUILTIN.${pkg}:= no
+
+# BOOT_GHC_PKGSRC_DEPS is a list of packages whose pkgsrc version is
+# preferred over native one, either by user or ../../mk/platform
+. if ${PREFER.${pkg}} == "pkgsrc"
+BOOT_GHC_PKGSRC_DEPS+= ${pkg}
+. endif
+.endfor
+
+# Compiler wrappers must not remove -I/-L flags for the installed
+# GHC's libdir, otherwise the GHC we are going to use for building our
+# bootstraping kit will not work at all. Ideally it should be added to
+# BUILDLINK_PASSTHRU_DIRS only .if make(bootstrap), but then running
+# "${MAKE} wrapper" before "${MAKE} bootstrap" will result in a
+# cryptic error which we can't easily catch.
+BOOT_GHC_LIBDIR_CMD= ghc --print-libdir
+.if !defined(BOOT_GHC_LIBDIR)
+BOOT_GHC_LIBDIR!= (${BOOT_GHC_LIBDIR_CMD}) 2>/dev/null || ${ECHO}
+.endif
+MAKEVARS+= BOOT_GHC_LIBDIR
+BUILDLINK_PASSTHRU_DIRS+= ${BOOT_GHC_LIBDIR}
+
+# Default values for BUILDLINK_INCDIRS.<pkg> are only generated in the
+# barrier. See ../../mk/buildlink3/bsd.buildlink3.mk and
+# ../../mk/bsd.pkg.barrier.mk
+.PHONY: bootstrap
+BOOT_ARCHIVE.new= ${BOOT_ARCHIVE:S/-${BOOT_VERSION}-/-${PKGVERSION_NOREV}-/}
+.if make(bootstrap)
+_BARRIER_CMDLINE_TARGETS+= bootstrap
+.endif
+.if !defined(_PKGSRC_BARRIER)
+bootstrap: barrier
+.else
+bootstrap: pre-bootstrap .WAIT ${WRKDIR}/stamp-dist-boot .WAIT post-bootstrap
+.endif
+
+# For normal build we use pkgsrc libffi, but for bootkits we can't do
+# that because that would mean bootkits have run-time dependency on
+# it. So we build the bundled one and statically link with it.
+CONFIGURE_ARGS.boot= ${CONFIGURE_ARGS.common}
+CONFIGURE_ARGS.boot+= --without-system-libffi
+
+.PHONY: pre-bootstrap
+pre-bootstrap: wrapper
+.if empty(BOOT_GHC_LIBDIR)
+ ${RUN}if ${BOOT_GHC_LIBDIR_CMD} 2>/dev/null 1>&2; then \
+ ${ERROR_MSG} "Running \"${BOOT_GHC_LIBDIR_CMD}\" has failed during wrapper phase."; \
+ ${FAIL_MSG} "Please run \"${MAKE} clean\" and try again."; \
+ else \
+ ${ERROR_MSG} "Failed to run \"${BOOT_GHC_LIBDIR_CMD}\":"; \
+ ${BOOT_GHC_LIBDIR_CMD}; \
+ ${ERROR_MSG} "You don't seem to have a working GHC in your PATH."; \
+ ${FAIL_MSG} "Please install one and then run \"${MAKE} clean bootstrap\"."; \
+ fi
+.endif
+# ${_COOKIE.configure} is not defined yet so we can't use .if here.
+ ${RUN}if ${TEST} -f ${_COOKIE.configure}; then \
+ ${ERROR_MSG} "You have already configured the package in a way\
+ that building bootstrapping compiler is impossible."; \
+ ${FAIL_MSG} "Please run \"${MAKE} clean\" first."; \
+ fi
+
+${WRKDIR}/lndir:
+ @${PHASE_MSG} "Building lndir(1) to duplicate the source tree."
+ cd ${WRKSRC:Q}/utils/lndir && \
+ ${PKG_CC:Q} lndir.c -o ${.TARGET}
+
+${WRKDIR}/stamp-lndir-boot: ${WRKDIR}/lndir
+ @${PHASE_MSG} "Duplicating the source tree for bootstrapping ${PKGNAME_NOREV}"
+ ${MKDIR} ${WRKDIR:Q}/build-boot
+ cd ${WRKDIR:Q}/build-boot && \
+ ${WRKDIR}/lndir -silent ../${PKGNAME_NOREV:Q}
+ ${TOUCH} ${.TARGET}
+
+${WRKDIR}/stamp-configure-boot: ${WRKDIR}/stamp-lndir-boot
+ @${PHASE_MSG} "Configuring bootstrapping compiler ${PKGNAME_NOREV}"
+ ${MKDIR} ${WRKDIR:Q}/build-boot
+ cd ${WRKDIR:Q}/build-boot && \
+ ${PKGSRC_SETENV} ${CONFIGURE_ENV} ${SH} ./configure ${CONFIGURE_ARGS.boot} && \
+ ${CP} -f ${FILESDIR:Q}/bootstrap.build.mk mk/build.mk
+ ${TOUCH} ${.TARGET}
+
+${WRKDIR}/stamp-build-boot: ${WRKDIR}/stamp-configure-boot
+ @${PHASE_MSG} "Building bootstrapping compiler ${PKGNAME_NOREV}"
+ ${RUN}cd ${WRKDIR:Q}/build-boot && ${BUILD_MAKE_CMD}
+ ${TOUCH} ${.TARGET}
+
+${WRKDIR}/stamp-dist-boot: ${WRKDIR}/stamp-build-boot
+ @${PHASE_MSG} "Creating binary distribution of bootstrapping ${PKGNAME_NOREV}"
+ ${RUN}cd ${WRKDIR:Q}/build-boot && ${BUILD_MAKE_CMD} binary-dist
+ ${MV} -f ${WRKDIR:Q}/build-boot/${BOOT_ARCHIVE.new} ${WRKDIR:Q}/${BOOT_ARCHIVE.new}
+
+.PHONY: post-bootstrap
+post-bootstrap:
+ @${ECHO} "=========================================================================="
+ @${ECHO} "Done creating ${BOOT_ARCHIVE.new}"
+ @${ECHO} " in ${WRKDIR}"
+ @${ECHO}
+ @${ECHO} "Now you can copy it into ${DISTDIR}/${DIST_SUBDIR} to use it as your"
+ @${ECHO} "bootstrap kit. You may want to take a backup in case \"lintpkgsrc -r\""
+ @${ECHO} "removes it."
+ @${ECHO}
+ @${ECHO} "Your bootstrap kit has the following run-time dependencies:"
+.for pkg in ${BOOT_GHC_DEPS}
+ @${PRINTF} " * %-8s" "${pkg}:"
+. if !empty(USE_BUILTIN.${pkg}:M[nN][oO])
+ @${ECHO_N} " pkgsrc ${BUILDLINK_PKGNAME.${pkg}}"
+. else
+ @${ECHO_N} " native"
+. if empty(BUILTIN_PKG.${pkg})
+ @${ECHO_N} " (version/variant unknown)"
+. else
+ @${ECHO_N} " ${BUILTIN_PKG.${pkg}}"
+. endif
+. endif
+ @${ECHO}
+.endfor
+.if !empty(BOOT_GHC_PKGSRC_DEPS)
+ @${ECHO}
+ @${ECHO} "Please note that it is generally not a good idea for a bootkit to depend"
+ @${ECHO} "on pkgsrc packages, as pkgsrc tends to move faster than operating systems"
+ @${ECHO} "so your bootkit may bitrot more quickly. You may want to rebuild it"
+ @${ECHO} "without setting PREFER_PKGSRC to \"yes\"."
+.endif
+ @${ECHO} "=========================================================================="
Index: pkgsrc/lang/ghc80/buildlink3.mk
diff -u /dev/null pkgsrc/lang/ghc80/buildlink3.mk:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/buildlink3.mk Fri Jan 3 15:24:08 2020
@@ -0,0 +1,24 @@
+# $NetBSD: buildlink3.mk,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+BUILDLINK_TREE+= ghc
+
+.if !defined(GHC_BUILDLINK3_MK)
+GHC_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.ghc+= ghc>=8.0.2
+BUILDLINK_ABI_DEPENDS.ghc+= ghc>=8.0.2
+BUILDLINK_PKGSRCDIR.ghc?= ../../lang/ghc80
+
+# On FreeBSD we need pkgsrc libiconv. See bootstrap.mk for details.
+.include "../../mk/bsd.fast.prefs.mk"
+.if ${OPSYS} == "FreeBSD"
+USE_BUILTIN.iconv= no
+.endif
+
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../devel/libffi/buildlink3.mk"
+.include "../../devel/gmp/buildlink3.mk"
+.include "../../mk/curses.buildlink3.mk"
+.endif # GHC_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -ghc
Index: pkgsrc/lang/ghc80/distinfo
diff -u /dev/null pkgsrc/lang/ghc80/distinfo:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/distinfo Fri Jan 3 15:24:08 2020
@@ -0,0 +1,21 @@
+$NetBSD: distinfo,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+SHA1 (ghc-8.0.2-boot-x86_64-unknown-netbsd.tar.xz) = 739ff0e666e5b3bb6e31d5c9b95ad01ab1225105
+RMD160 (ghc-8.0.2-boot-x86_64-unknown-netbsd.tar.xz) = 29f162e0547c686274eb8389c30e8a76b53a51eb
+SHA512 (ghc-8.0.2-boot-x86_64-unknown-netbsd.tar.xz) = 829ac54c9cf5031d93e994424a70093da38a612281ad2e8422a0dbd1e5beb34deecca042ae82706c97c3e4b9ab745140c796e3a6a16903cb04adfac52b8d83da
+Size (ghc-8.0.2-boot-x86_64-unknown-netbsd.tar.xz) = 50132904 bytes
+SHA1 (ghc-8.0.2-src.tar.xz) = 0e0ae6d5ba119c10f3c7b807d35166e7c06b9b35
+RMD160 (ghc-8.0.2-src.tar.xz) = 56b74f65e17bcab2ff9d5b8dbced3f9694d531cc
+SHA512 (ghc-8.0.2-src.tar.xz) = 58ea3853cd93b556ecdc4abd0be079b2621171b8491f59004ea4e036a4cba4470aaafe6591b942e0a50a64bdc47540e01fe6900212a1ef7087850112d9bfc5ef
+Size (ghc-8.0.2-src.tar.xz) = 10687760 bytes
+SHA1 (patch-iserv_ghc.mk) = 6d1d79100b4a7b5d8b0c6f25318eaa8b4e20e43d
+SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00
+SHA1 (patch-libraries_base_System_Environment.hs) = ec3dfd916593f600a397e5b594672e6d3564f042
+SHA1 (patch-libraries_time_lib_Data_Time_Clock_CTimespec.hsc) = 758502590ac746990ffcc7fd08dda441ca003532
+SHA1 (patch-libraries_time_lib_Data_Time_Clock_CTimeval.hs) = 8961cbf704b29c5e06ec6a95b9a9c9d0db69760a
+SHA1 (patch-libraries_unix_System_Posix_Env.hsc) = e94936c139ca15d45cac4a7feb74a601567913ab
+SHA1 (patch-libraries_unix_System_Posix_Env_ByteString.hsc) = 3f675fc5d6bf5cc59a2d5ccffeb9ccd51521645a
+SHA1 (patch-libraries_unix_System_Posix_Files_Common.hsc) = 6efef280832d376915a8987e4e8aac283408f607
+SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b
+SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00
+SHA1 (patch-rts_PosixSource.h) = 604608791f33245d9305dcbd6d9d5979fe162f21
Index: pkgsrc/lang/ghc80/files/bootstrap.build.mk
diff -u /dev/null pkgsrc/lang/ghc80/files/bootstrap.build.mk:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/files/bootstrap.build.mk Fri Jan 3 15:24:08 2020
@@ -0,0 +1,40 @@
+# -*- makefile-gmake -*-
+#
+# This is a build conf for bootstrapping compilers.
+#
+
+# We don't want any docs.
+HADDOCK_DOCS = NO
+BUILD_MAN = NO
+BUILD_SPHINX_HTML = NO
+BUILD_SPHINX_PDF = NO
+
+# Enabling evil-splitter reduces bindist size, which is good. However
+# it introduces a run-time dependency on perl, which is unacceptable.
+SplitObjs = NO
+
+# We only want vanilla libraries and rts. No profiling, no shared
+# libraries, no debugging, no event logging.
+GhcLibWays = v
+GhcRTSWays =
+
+# I'm not sure disabling GHCi significantly reduces the bindist size,
+# but we don't need it anyway.
+GhcWithInterpreter = NO
+
+# We don't want in-place GMP to be statically linked as it increases
+# the bindist size. Dynamic linkage is even worse.
+INTEGER_LIBRARY = integer-simple
+
+# We'd like to distinguish bootstrapping bindists from normal ones.
+BIN_DIST_NAME = ghc-$(ProjectVersion)-boot
+
+# Don't build or use dynamic Haskell libraries.
+DYNAMIC_GHC_PROGRAMS = NO
+
+# We want our bootkits to be as small as possible, even though `xz
+# -9e' is very slow and consumes about 680 MiB of memory.
+TAR_COMP = xz
+TAR_COMP_CMD = $(XZ_CMD)
+TAR_COMP_EXT = xz
+XZ_CMD = xz --verbose -9 --extreme
Index: pkgsrc/lang/ghc80/patches/patch-iserv_ghc.mk
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-iserv_ghc.mk:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-iserv_ghc.mk Fri Jan 3 15:24:08 2020
@@ -0,0 +1,20 @@
+$NetBSD: patch-iserv_ghc.mk,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Do not build threaded iserv if threaded RTS isn't being built. That is
+impossible to do.
+
+--- iserv/ghc.mk.orig 2020-01-03 10:45:07.879183648 +0000
++++ iserv/ghc.mk
+@@ -19,9 +19,9 @@ iserv_stage2_p_MORE_HC_OPTS += -debug
+ iserv_stage2_dyn_MORE_HC_OPTS += -debug
+ endif
+
+-iserv_stage2_MORE_HC_OPTS += -threaded
+-iserv_stage2_p_MORE_HC_OPTS += -threaded
+-iserv_stage2_dyn_MORE_HC_OPTS += -threaded
++iserv_stage2_MORE_HC_OPTS += $(if $(findstring thr,$(GhcRTSWays)),-threaded)
++iserv_stage2_p_MORE_HC_OPTS += $(if $(findstring thr,$(GhcRTSWays)),-threaded)
++iserv_stage2_dyn_MORE_HC_OPTS += $(if $(findstring thr,$(GhcRTSWays)),-threaded)
+
+ # Override the default way, because we want a specific version of this
+ # program for each way. Note that it's important to do this even for
Index: pkgsrc/lang/ghc80/patches/patch-libraries_base_GHC_Event_KQueue.hsc
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_base_GHC_Event_KQueue.hsc:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_base_GHC_Event_KQueue.hsc Fri Jan 3 15:24:08 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-libraries_base_GHC_Event_KQueue.hsc,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Suppress linker warnings about compatibility syscall wrappers by using
+"capi" instead of "ccall".
+
+--- libraries/base/GHC/Event/KQueue.hsc.orig 2019-12-26 18:05:56.276488590 +0000
++++ libraries/base/GHC/Event/KQueue.hsc
+@@ -284,7 +284,7 @@ foreign import capi safe "sys/event.h ke
+ c_kevent :: KQueueFd -> Ptr Event -> CInt -> Ptr Event -> CInt
+ -> Ptr TimeSpec -> IO CInt
+
+-foreign import ccall unsafe "kevent"
++foreign import capi unsafe "sys/event.h kevent"
+ c_kevent_unsafe :: KQueueFd -> Ptr Event -> CInt -> Ptr Event -> CInt
+ -> Ptr TimeSpec -> IO CInt
+ #else
Index: pkgsrc/lang/ghc80/patches/patch-libraries_base_System_Environment.hs
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_base_System_Environment.hs:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_base_System_Environment.hs Fri Jan 3 15:24:08 2020
@@ -0,0 +1,23 @@
+$NetBSD: patch-libraries_base_System_Environment.hs,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Suppress linker warnings about compatibility syscall wrappers by using
+"capi" instead of "ccall".
+
+--- libraries/base/System/Environment.hs.orig 2017-01-03 15:59:18.000000000 +0000
++++ libraries/base/System/Environment.hs
+@@ -1,5 +1,6 @@
+ {-# LANGUAGE Safe #-}
+ {-# LANGUAGE CPP #-}
++{-# LANGUAGE CApiFFI #-}
+
+ -----------------------------------------------------------------------------
+ -- |
+@@ -304,7 +305,7 @@ putEnv keyvalue = do
+ -- environment.
+ throwErrnoIf_ (/= 0) "putenv" (c_putenv s)
+
+-foreign import ccall unsafe "putenv" c_putenv :: CString -> IO CInt
++foreign import capi unsafe "stdlib.h putenv" c_putenv :: CString -> IO CInt
+ #endif
+
+ -- | @unSet name@ removes the specified environment variable from the
Index: pkgsrc/lang/ghc80/patches/patch-libraries_time_lib_Data_Time_Clock_CTimespec.hsc
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_time_lib_Data_Time_Clock_CTimespec.hsc:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_time_lib_Data_Time_Clock_CTimespec.hsc Fri Jan 3 15:24:08 2020
@@ -0,0 +1,21 @@
+$NetBSD: patch-libraries_time_lib_Data_Time_Clock_CTimespec.hsc,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Suppress linker warnings about compatibility symbols.
+
+--- libraries/time/lib/Data/Time/Clock/CTimespec.hsc.orig 2020-01-03 10:48:43.269574197 +0000
++++ libraries/time/lib/Data/Time/Clock/CTimespec.hsc
+@@ -1,4 +1,5 @@
+ -- #hide
++{-# LANGUAGE CApiFFI #-}
+ module Data.Time.Clock.CTimespec where
+
+ #include "HsTimeConfig.h"
+@@ -27,7 +28,7 @@ instance Storable CTimespec where
+ #{poke struct timespec, tv_sec } p s
+ #{poke struct timespec, tv_nsec} p ns
+
+-foreign import ccall unsafe "time.h clock_gettime"
++foreign import capi unsafe "time.h clock_gettime"
+ clock_gettime :: #{type clockid_t} -> Ptr CTimespec -> IO CInt
+
+ -- | Get the current POSIX time from the system clock.
Index: pkgsrc/lang/ghc80/patches/patch-libraries_time_lib_Data_Time_Clock_CTimeval.hs
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_time_lib_Data_Time_Clock_CTimeval.hs:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_time_lib_Data_Time_Clock_CTimeval.hs Fri Jan 3 15:24:08 2020
@@ -0,0 +1,33 @@
+$NetBSD: patch-libraries_time_lib_Data_Time_Clock_CTimeval.hs,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Suppress linker warnings about compatibility syscall wrappers by using
+"capi" instead of "ccall". In Haskell FFI, "ccall" is actually an
+interface to C ABI rather than C API. That is, GHC generates direct
+references to the symbol even if it's actually defined as a cpp macro
+or something like that, because GHC knows nothing about those macros
+in foreign headers. Hence the following warnings:
+
+ .../libHStime-1.4.0.1.a(CTimeval.o): In function `s1Kp_info':
+ (.text+0x2f): warning: warning: reference to compatibility
+ gettimeofday(); include <sys/time.h> to generate correct reference
+
+In other words, you can safely use "ccall" only when you are sure the
+symbol you want to import is actually a symbol in the ABI sense, which
+is not always the case for the POSIX API.
+
+--- libraries/time/lib/Data/Time/Clock/CTimeval.hs.orig 2015-12-28 14:43:48.000000000 +0000
++++ libraries/time/lib/Data/Time/Clock/CTimeval.hs
+@@ -1,3 +1,4 @@
++{-# LANGUAGE CApiFFI #-}
+ -- #hide
+ module Data.Time.Clock.CTimeval where
+
+@@ -24,7 +25,7 @@ instance Storable CTimeval where
+ pokeElemOff (castPtr p) 0 s
+ pokeElemOff (castPtr p) 1 mus
+
+-foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt
++foreign import capi unsafe "sys/time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt
+
+ -- | Get the current POSIX time from the system clock.
+ getCTimeval :: IO CTimeval
Index: pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Env.hsc
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Env.hsc:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Env.hsc Fri Jan 3 15:24:08 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-libraries_unix_System_Posix_Env.hsc,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Suppress linker warnings about compatibility symbols by using "capi"
+instead of "ccall".
+
+--- libraries/unix/System/Posix/Env.hsc.orig 2016-11-17 22:08:50.000000000 +0000
++++ libraries/unix/System/Posix/Env.hsc
+@@ -156,7 +156,7 @@ putEnv keyvalue = do s <- newFilePath ke
+ newFilePath fp = getFileSystemEncoding >>= \enc -> GHC.newCString enc fp
+ #endif
+
+-foreign import ccall unsafe "putenv"
++foreign import capi unsafe "stdlib.h putenv"
+ c_putenv :: CString -> IO CInt
+
+ {- |The 'setEnv' function inserts or resets the environment variable name in
Index: pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Env_ByteString.hsc
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Env_ByteString.hsc:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Env_ByteString.hsc Fri Jan 3 15:24:08 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-libraries_unix_System_Posix_Env_ByteString.hsc,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Suppress linker warnings about compatibility symbols by using "capi"
+instead of "ccall".
+
+--- libraries/unix/System/Posix/Env/ByteString.hsc.orig 2016-11-17 22:08:50.000000000 +0000
++++ libraries/unix/System/Posix/Env/ByteString.hsc
+@@ -130,7 +130,7 @@ putEnv :: ByteString {- ^ "key=value" -}
+ putEnv keyvalue = B.useAsCString keyvalue $ \s ->
+ throwErrnoIfMinus1_ "putenv" (c_putenv s)
+
+-foreign import ccall unsafe "putenv"
++foreign import capi unsafe "stdlib.h putenv"
+ c_putenv :: CString -> IO CInt
+
+ {- |The 'setEnv' function inserts or resets the environment variable name in
Index: pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Files_Common.hsc
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Files_Common.hsc:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Files_Common.hsc Fri Jan 3 15:24:08 2020
@@ -0,0 +1,33 @@
+$NetBSD: patch-libraries_unix_System_Posix_Files_Common.hsc,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Suppress linker warnings about compatibility syscall wrappers by using
+"capi" instead of "ccall".
+
+--- libraries/unix/System/Posix/Files/Common.hsc.orig 2016-04-20 10:08:26.000000000 +0000
++++ libraries/unix/System/Posix/Files/Common.hsc
+@@ -1,4 +1,5 @@
+ {-# LANGUAGE Trustworthy #-}
++{-# LANGUAGE CApiFFI #-}
+
+ -----------------------------------------------------------------------------
+ -- |
+@@ -448,16 +449,16 @@ toCTimeVal t = CTimeVal sec (truncate $
+ (sec, frac) = if (frac' < 0) then (sec' - 1, frac' + 1) else (sec', frac')
+ (sec', frac') = properFraction $ toRational t
+
+-foreign import ccall unsafe "utimes"
++foreign import capi unsafe "sys/time.h utimes"
+ c_utimes :: CString -> Ptr CTimeVal -> IO CInt
+
+ #ifdef HAVE_LUTIMES
+-foreign import ccall unsafe "lutimes"
++foreign import capi unsafe "sys/time.h lutimes"
+ c_lutimes :: CString -> Ptr CTimeVal -> IO CInt
+ #endif
+
+ #if HAVE_FUTIMES
+-foreign import ccall unsafe "futimes"
++foreign import capi unsafe "sys/time.h futimes"
+ c_futimes :: CInt -> Ptr CTimeVal -> IO CInt
+ #endif
+
Index: pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Signals.hsc
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Signals.hsc:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_unix_System_Posix_Signals.hsc Fri Jan 3 15:24:08 2020
@@ -0,0 +1,22 @@
+$NetBSD: patch-libraries_unix_System_Posix_Signals.hsc,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Suppress linker warnings about compatibility symbols.
+
+--- libraries/unix/System/Posix/Signals.hsc.orig 2016-04-20 10:08:26.000000000 +0000
++++ libraries/unix/System/Posix/Signals.hsc
+@@ -590,7 +590,7 @@ awaitSignal maybe_sigset = do
+ -- XXX My manpage says it can also return EFAULT. And why is ignoring
+ -- EINTR the right thing to do?
+
+-foreign import ccall unsafe "sigsuspend"
++foreign import capi unsafe "signal.h sigsuspend"
+ c_sigsuspend :: Ptr CSigset -> IO CInt
+
+ #if defined(darwin_HOST_OS) && __GLASGOW_HASKELL__ < 706
+@@ -615,5 +615,5 @@ foreign import capi unsafe "signal.h sig
+ c_sigismember :: Ptr CSigset -> CInt -> IO CInt
+ #endif
+
+-foreign import ccall unsafe "sigpending"
++foreign import capi unsafe "signal.h sigpending"
+ c_sigpending :: Ptr CSigset -> IO CInt
Index: pkgsrc/lang/ghc80/patches/patch-libraries_unix_include_execvpe.h
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-libraries_unix_include_execvpe.h:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-libraries_unix_include_execvpe.h Fri Jan 3 15:24:08 2020
@@ -0,0 +1,17 @@
+$NetBSD: patch-libraries_unix_include_execvpe.h,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Don't conflict with builtin execvpe(3).
+
+--- libraries/unix/include/execvpe.h.orig 2016-02-04 16:16:38.000000000 +0000
++++ libraries/unix/include/execvpe.h
+@@ -15,8 +15,10 @@ __hsunix_execvpe(const char *name, char
+ #include "HsUnixConfig.h"
+ #if HAVE_EXECVPE
+ # include <unistd.h>
++# if !defined(execvpe) && !HAVE_DECL_EXECVPE
+ extern int
+ execvpe(const char *name, char *const argv[], char *const envp[]);
++# endif
+ #else
+ # define execvpe(name,argv,envp) __hsunix_execvpe(name,argv,envp)
+ #endif
Index: pkgsrc/lang/ghc80/patches/patch-rts_PosixSource.h
diff -u /dev/null pkgsrc/lang/ghc80/patches/patch-rts_PosixSource.h:1.1
--- /dev/null Fri Jan 3 15:24:08 2020
+++ pkgsrc/lang/ghc80/patches/patch-rts_PosixSource.h Fri Jan 3 15:24:08 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-rts_PosixSource.h,v 1.1 2020/01/03 15:24:08 pho Exp $
+
+Set _XOPEN_SOURCE correctly on SunOS. Fixed in later versions.
+
+--- rts/PosixSource.h.orig 2013-04-18 21:22:46.000000000 +0000
++++ rts/PosixSource.h
+@@ -11,7 +11,7 @@
+
+ #include <ghcplatform.h>
+
+-#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)
++#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || (defined(__sun) && __STDC_VERSION__-0 >= 199901L)
+ #define _POSIX_C_SOURCE 200112L
+ #define _XOPEN_SOURCE 600
+ #else
Home |
Main Index |
Thread Index |
Old Index