Tue Feb 9 13:16:24 2021 UTC ()
lang/ghc810: import ghc-8.10.4
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.10.x release series.
(ryoon)
diff -r0 -r1.1 pkgsrc/lang/ghc810/BOOTSTRAP.txt
diff -r0 -r1.1 pkgsrc/lang/ghc810/DEINSTALL
diff -r0 -r1.1 pkgsrc/lang/ghc810/DESCR
diff -r0 -r1.1 pkgsrc/lang/ghc810/INSTALL
diff -r0 -r1.1 pkgsrc/lang/ghc810/Makefile
diff -r0 -r1.1 pkgsrc/lang/ghc810/bootstrap.mk
diff -r0 -r1.1 pkgsrc/lang/ghc810/buildlink3.mk
diff -r0 -r1.1 pkgsrc/lang/ghc810/distinfo
diff -r0 -r1.1 pkgsrc/lang/ghc810/files/bootstrap.build.mk
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-aclocal.m4
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-configure.ac
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_Cabal_Cabal_Distribution_Simple_GHC.hs
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_base_GHC_Event_KQueue.hsc
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_base_System_CPUTime_Posix_Times.hsc
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_base_System_Environment.hs
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_base_configure
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_time_lib_Data_Time_Clock_Internal_CTimespec.hsc
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_time_lib_Data_Time_Clock_Internal_CTimeval.hs
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_unix_System_Posix_Env.hsc
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_unix_System_Posix_Env_ByteString.hsc
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_unix_System_Posix_Files_Common.hsc
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_unix_System_Posix_Signals.hsc
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-libraries_unix_include_execvpe.h
diff -r0 -r1.1 pkgsrc/lang/ghc810/patches/patch-rts_StgCRun.c
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/ghc88; 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.
#!/bin/sh
#
GHC_VERSION="@GHC_VERSION@"
case ${STAGE} in
DEINSTALL)
${RM} -f ${PKG_PREFIX}/lib/${PKGBASE}-${GHC_VERSION}/package.conf.d/package.cache
;;
esac
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.10.x release series.
#!/bin/sh
#
case ${STAGE} in
POST-INSTALL)
${PKG_PREFIX}/bin/ghc-pkg recache
;;
esac
# $NetBSD: Makefile,v 1.1 2021/02/09 13:16:24 ryoon Exp $
# -----------------------------------------------------------------------------
# Package metadata
#
DISTNAME= ghc-8.10.4-src
PKGNAME= ${DISTNAME:S/-src$//}
CATEGORIES= lang
MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
EXTRACT_SUFX= .tar.xz
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://www.haskell.org/ghc/
COMMENT= Compiler for the functional language Haskell - 8.8 Release Series
LICENSE= modified-bsd
UNLIMIT_RESOURCES= datasize virtualsize
# TODO: We should be using the alternatives framework.
CONFLICTS+= ghc-[0-9]*
# GHC requires GHC to build itself. 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+= Darwin-*-x86_64
BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
# -----------------------------------------------------------------------------
# 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 perl:run
GNU_CONFIGURE= yes
USE_GNU_CONFIGURE_HOST= no
USE_LIBTOOL= yes
# TODO: Disable the splitter entirely so that we can drop the runtime
# dependency on perl. The purpose of the splitter is to perform a dead
# code elimination by breaking .o files into many pieces. This only
# makes sense when linking executables statically, which is rarely
# done these days.
# -----------------------------------------------------------------------------
# Configuration
#
CONFIGURE_ARGS.common= \
--with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \
--with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \
--with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \
--with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \
--with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \
--with-system-libffi \
--with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \
--with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q}
CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
# We must pass non-wrapper tools to ./configure because they will be
# embedded in the compiler (actually ${WRKSRC}/settings).
CONFIGURE_ENV+= \
ac_cv_prog_fp_prog_ar=${AR:Q} \
ac_cv_prog_LIBTOOL=libtool \
PerlCmd=${PERL5:Q} \
CC=${CC:Q} \
LD=${LD: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:M*: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
# -----------------------------------------------------------------------------
# Security
#
# 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 because it relies on
# mmap(MAP_FIXED). 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. (Partially done:
# https://gitlab.haskell.org/ghc/ghc/merge_requests/2498)
.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
# Additional note: Now that DYNAMIC_GHC_PROGRAMS is enabled by
# default, we no longer need to disable PaX ASLR because the RTS
# linker is not used... except for ghc-iserv. The program is launched
# when ghci is started with -fexternal-interpreter without
# -dynamic. Its purpose is to run non-PIC code from a dynamically
# linked ghci, and therefore still uses RTS linker. Also note that RTS
# linker requires PaX mprotect to be disabled too. This means that
# once the merge request mentioned above is merged to the upstream, we
# can at least enable PaX mprotect and PaX ASLR for all the
# executables except ghc-iserv and ghc-iserv-prof.
# -----------------------------------------------------------------------------
# Build hooks
#
# We patch configure.ac in some directories.
post-patch:
@${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
${RUN} cd ${WRKSRC} && autoconf
# Define the target "pre-configure" and non-standard "bootstrap".
.include "../../lang/ghc810/bootstrap.mk"
# Our pre-configure phase installs a bindist of bootstrapping compiler
# directly into TOOLS_DIR so that ./configure can find it.
# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too
# loose, and building docs/users_guide rarely succeeds. We don't know
# which version is actually required for it.
.include "../../mk/bsd.prefs.mk"
BUILD_SPHINX_HTML?= no
# Here we generate mk/build.mk dynamically.
post-configure:
${RUN} ${RM} -f ${WRKSRC}/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}/mk/build.mk
.if ${BUILD_SPHINX_HTML} == "no"
${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk
.endif
# Don't even think of PDF.
${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk
# https://gitlab.haskell.org/ghc/ghc/issues/13542
.if ${OPSYS} == "SunOS"
${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk
.endif
# -----------------------------------------------------------------------------
# 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}${PREFIX}/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}${PREFIX} && \
${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.
#
# Note that arguments like "-Wl,-rpath,$ORIGIN/.." are usually dropped
# by the "cleanup" phase of wrappers. This is not the case in GHC
# because GHC uses @file syntax while linking objects, and our
# wrappers does nothing about it.
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
#
.if ${BUILD_SPHINX_HTML} != "no"
BUILDLINK_DEPMETHOD.python:= build
.include "../../lang/python/pyversion.mk"
BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
.endif
# 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.
ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib:${FILESDIR}
.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"
# $NetBSD: bootstrap.mk,v 1.1 2021/02/09 13:16:24 ryoon 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.
########################################################################
# Please note that GHC 8.8.1 fails to build itself due to this bug: #
# https://gitlab.haskell.org/ghc/ghc/issues/17146 #
# #
# It is expected to be fixed in 8.8.2 but until that we must bootstrap #
# it with 8.4.4. WE MUST NOT REMOVE lang/ghc84 UNTIL THAT. #
########################################################################
.if !empty(MACHINE_PLATFORM:MDarwin-*-powerpc) || make(distinfo) || make (makesum) || make(mdi)
#BOOT_VERSION:= 8.4.4
#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-powerpc-apple-darwin.tar.xz
#DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
.endif
#.if !empty(MACHINE_PLATFORM:MDarwin-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
#BOOT_VERSION:= 8.4.4
#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-x86_64-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:= 8.4.4
#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-i386-unknown-freebsd.tar.xz
#DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
#.endif
#.if !empty(MACHINE_PLATFORM:MFreeBSD-*-x86_64) || make(distinfo) || make(makesum) || make(mdi)
#BOOT_VERSION:= 8.4.4
#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-x86_64-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.8.4
BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-x86_64-unknown-netbsd.tar.xz
DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE} # Available in LOCAL_PORTS
. if !empty(MACHINE_PLATFORM:MNetBSD-9.99*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
DISTFILES+= netbsd-9.0-amd64-libterminfo.tar.gz
EXTRACT_ONLY+= netbsd-9.0-amd64-libterminfo.tar.gz
. endif
.endif
#.if !empty(MACHINE_PLATFORM:MSunOS-*-i386) || make(distinfo) || make (makesum) || make(mdi)
#BOOT_VERSION:= 8.4.4
#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:= 8.4.4
#BOOT_ARCHIVE:= ghc-${BOOT_VERSION}-boot-x86_64-unknown-solaris2.tar.xz
#SITES.${BOOT_ARCHIVE}= https://us-east.manta.joyent.com/pkgsrc/public/pkg-bootstraps/
#DISTFILES:= ${DISTFILES} ${BOOT_ARCHIVE}
#.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
# current bootstrap binary kit for SmartOS is built with ncurses5
.if !empty(MACHINE_PLATFORM:MSunOS-*) && ${OS_VARIANT:U} == "SmartOS"
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}/${DIST_SUBDIR}/${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}/build-extract
${RUN}cd ${WRKDIR}/build-extract && \
${XZCAT} ${DISTDIR}/${DIST_SUBDIR}/${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}/build-extract/ghc-${BOOT_VERSION}-boot && \
${PKGSRC_SETENV} ${CONFIGURE_ENV} ${SH} ./configure \
--prefix=${TOOLS_DIR:Q} && \
${PKGSRC_SETENV} ${MAKE_ENV} ${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 stage-0 GHC (which we are going to use
# for building our bootstraping kit) will not work. 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}/utils/lndir && \
${PKG_CC:Q} lndir.c -I../fs ../fs/fs.c -o ${.TARGET}
${WRKDIR}/stamp-lndir-boot: ${WRKDIR}/lndir
@${PHASE_MSG} "Duplicating the source tree for bootstrapping ${PKGNAME_NOREV}"
${MKDIR} ${WRKDIR}/build-boot
cd ${WRKDIR}/build-boot && \
${WRKDIR}/lndir -silent ../${PKGNAME_NOREV}
${TOUCH} ${.TARGET}
${WRKDIR}/stamp-configure-boot: ${WRKDIR}/stamp-lndir-boot
@${PHASE_MSG} "Configuring bootstrapping compiler ${PKGNAME_NOREV}"
${MKDIR} ${WRKDIR}/build-boot
cd ${WRKDIR}/build-boot && \
${PKGSRC_SETENV} ${CONFIGURE_ENV} ${SH} ./configure ${CONFIGURE_ARGS.boot} && \
${CP} -f ${FILESDIR}/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}/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}/build-boot && ${BUILD_MAKE_CMD} binary-dist
${MV} -f ${WRKDIR}/build-boot/${BOOT_ARCHIVE.new} ${WRKDIR}/${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 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} "=========================================================================="
# $NetBSD: buildlink3.mk,v 1.1 2021/02/09 13:16:24 ryoon Exp $
BUILDLINK_TREE+= ghc
.if !defined(GHC_BUILDLINK3_MK)
GHC_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.ghc+= ghc>=8.8.1
BUILDLINK_ABI_DEPENDS.ghc+= ghc>=8.8.1nb2
BUILDLINK_PKGSRCDIR.ghc?= ../../lang/ghc88
.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
$NetBSD: distinfo,v 1.1 2021/02/09 13:16:24 ryoon Exp $
SHA1 (ghc-8.10.4-src.tar.xz) = 41f242d2bb2509c63bedbd6751b2b142ae65ba3e
RMD160 (ghc-8.10.4-src.tar.xz) = 9b7ab19c21229f0c565c19e851323529c4184f4b
SHA512 (ghc-8.10.4-src.tar.xz) = 9bb078cb72535a352243b83b671c871392564efd09e478549f27ae58fc6f46e337a0782f5500d26d5704ad96eace22e77bb36031a1fe9b7e175f265b0b9c028b
Size (ghc-8.10.4-src.tar.xz) = 19818108 bytes
SHA1 (ghc-8.8.4-boot-x86_64-unknown-netbsd.tar.xz) = 49974bf7f3b8dc4387f9ebbd148a7f32b26783d2
RMD160 (ghc-8.8.4-boot-x86_64-unknown-netbsd.tar.xz) = 5e7011aec3f0c02ebbe274e2424a1d482e9ddd90
SHA512 (ghc-8.8.4-boot-x86_64-unknown-netbsd.tar.xz) = 3f68f15e106cfd6bd833dddc0c2c07fe3d1bae6db0f2e3680b69d18b07778e0d70be9c75285ad2d4faf0369b8b2142ce62cee6ae5ceb6aa4ca8d014525140927
Size (ghc-8.8.4-boot-x86_64-unknown-netbsd.tar.xz) = 47574408 bytes
SHA1 (patch-aclocal.m4) = 16ac8899a7d87cf93a6139edba9e5222eb4c5c66
SHA1 (patch-configure.ac) = 5d33ac8e1a9ab2f729bf5580eddfd87c9fed386a
SHA1 (patch-libraries_Cabal_Cabal_Distribution_Simple_GHC.hs) = a4c82b1282c0580a7945be8c3b9d38bc760db99f
SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00
SHA1 (patch-libraries_base_System_CPUTime_Posix_Times.hsc) = 2bfb779d534d12073287274ce5e90b99e457a860
SHA1 (patch-libraries_base_System_Environment.hs) = 7d79a91f295915b4408d5f41d5405739d7189215
SHA1 (patch-libraries_base_configure) = f06a961a6507f635aafe50dab3ff4396c012bdec
SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimespec.hsc) = 588270767f8a9cbde0648fc99807891fef65d721
SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimeval.hs) = b2811ec4a845e6b2b44414e940b6108178b597c5
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_StgCRun.c) = 121c7bd714725d5b14a3cbb03d81b1c769848824
# -*- 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
ghc_stage1_CONFIGURE_OPTS += -f-threaded
ghc_stage2_CONFIGURE_OPTS += -f-threaded
ghc_stage3_CONFIGURE_OPTS += -f-threaded
# 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_OPTS)
TAR_COMP_EXT = xz
TAR_COMP_OPTS = --verbose -9 --extreme
$NetBSD: patch-aclocal.m4,v 1.1 2021/02/09 13:16:24 ryoon Exp $
Hunk #1:
Remove _AC_PROG_CC_C99 macro that is removed in autoconf-2.71
to fix build failure.
Hunk #2:
Support SunOS/x86_64.
Hunk #3:
Canonicalize OS name netbsd* to "netbsd":
https://gitlab.haskell.org/ghc/ghc/merge_requests/2496
--- aclocal.m4.orig 2020-07-08 16:43:03.000000000 +0000
+++ aclocal.m4
@@ -611,17 +611,6 @@ AC_DEFUN([FP_SET_CFLAGS_C99],
CC="$$1"
CFLAGS="$$2"
CPPFLAGS="$$3"
- unset ac_cv_prog_cc_c99
- dnl perform detection
- _AC_PROG_CC_C99
- fp_cc_c99="$ac_cv_prog_cc_c99"
- case "x$ac_cv_prog_cc_c99" in
- x) ;; # noop
- xno) AC_MSG_ERROR([C99-compatible compiler needed]) ;;
- *) $2="$$2 $ac_cv_prog_cc_c99"
- $3="$$3 $ac_cv_prog_cc_c99"
- ;;
- esac
dnl restore saved state
FP_COPY_SHELLVAR([fp_save_CC],[CC])
FP_COPY_SHELLVAR([fp_save_CFLAGS],[CFLAGS])
@@ -661,7 +650,7 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
x86_64-unknown-solaris2)
$2="$$2 -m64"
$3="$$3 -m64"
- $4="$$4 -m64"
+ $4="$$4 -64"
$5="$$5 -m64"
;;
alpha-*)
@@ -2047,6 +2036,9 @@ AC_DEFUN([GHC_CONVERT_OS],[
openbsd*)
$3="openbsd"
;;
+ netbsd*)
+ $3="netbsd"
+ ;;
# As far as I'm aware, none of these have relevant variants
freebsd|netbsd|dragonfly|hpux|linuxaout|kfreebsdgnu|freebsd2|mingw32|darwin|nextstep2|nextstep3|sunos4|ultrix|haiku)
$3="$1"
$NetBSD: patch-configure.ac,v 1.1 2021/02/09 13:16:24 ryoon Exp $
Don't use non-portable operator ==:
https://gitlab.haskell.org/ghc/ghc/merge_requests/2497
--- configure.ac.orig 2021-02-04 05:28:14.000000000 +0000
+++ configure.ac
@@ -848,7 +848,7 @@ if test "x$EnableDtrace" = "xyes"; then
if test -n "$DtraceCmd"; then
if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" \
-o "x$TargetOS_CPP-$TargetVendor_CPP" = "xfreebsd-portbld" \
- -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then
+ ; then
HaveDtrace=YES
fi
fi
@@ -967,7 +967,7 @@ FP_CHECK_SIZEOF_AND_ALIGNMENT(uint64_t)
dnl for use in settings file
TargetWordSize=$ac_cv_sizeof_void_p
-if test "x$TargetWordSize" == 8; then
+if test "x$TargetWordSize" = 8; then
AC_SUBST([Cabal64bit],[True])
else
AC_SUBST([Cabal64bit],[False])
$NetBSD: patch-libraries_Cabal_Cabal_Distribution_Simple_GHC.hs,v 1.1 2021/02/09 13:16:24 ryoon Exp $
Enable Cabal's rpath overriding functionality on all the platforms
known to use ELF.
When a Cabal package which defins both a library and an executable is
to be built, GHC by default embeds an rpath to the *build* directory
into the executable. This may sound like a bug in GHC but is actually
not, because GHC doesn't know the fact that the said library is going
to be installed elsewhere. To overcome this issue, Cabal has a
functionality to disable the default rpath handling of GHC and
construct the correct set of rpaths... but only on certain platforms
for some reason.
--- libraries/Cabal/Cabal/Distribution/Simple/GHC.hs.orig 2020-01-16 22:47:21.132921936 +0000
+++ libraries/Cabal/Cabal/Distribution/Simple/GHC.hs
@@ -1725,10 +1725,10 @@ getRPaths lbi clbi | supportRPaths hostO
case compid of
CompilerId GHC ver | ver >= mkVersion [7,10,2] -> True
_ -> False
- supportRPaths OpenBSD = False
- supportRPaths NetBSD = False
- supportRPaths DragonFly = False
- supportRPaths Solaris = False
+ supportRPaths OpenBSD = True
+ supportRPaths NetBSD = True
+ supportRPaths DragonFly = True
+ supportRPaths Solaris = True
supportRPaths AIX = False
supportRPaths HPUX = False
supportRPaths IRIX = False
$NetBSD: patch-libraries_base_GHC_Event_KQueue.hsc,v 1.1 2021/02/09 13:16:24 ryoon 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
$NetBSD: patch-libraries_base_System_CPUTime_Posix_Times.hsc,v 1.1 2021/02/09 13:16:24 ryoon Exp $
Suppress linker warnings about compatibility syscall wrappers by using
"capi" instead of "ccall".
--- libraries/base/System/CPUTime/Posix/Times.hsc.orig 2020-01-04 12:08:39.515726533 +0000
+++ libraries/base/System/CPUTime/Posix/Times.hsc
@@ -27,7 +27,7 @@ getCPUTime = allocaBytes (#const sizeof(
`div` fromIntegral clockTicks)
type CTms = ()
-foreign import ccall unsafe times :: Ptr CTms -> IO CClock
+foreign import capi unsafe "sys/times.h times" times :: Ptr CTms -> IO CClock
getCpuTimePrecision :: IO Integer
getCpuTimePrecision =
$NetBSD: patch-libraries_base_System_Environment.hs,v 1.1 2021/02/09 13:16:24 ryoon Exp $
Suppress linker warnings about compatibility syscall wrappers by using
"capi" instead of "ccall".
--- libraries/base/System/Environment.hs.orig 2018-02-25 20:02:28.000000000 +0000
+++ libraries/base/System/Environment.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE Safe #-}
{-# LANGUAGE CPP #-}
+{-# LANGUAGE CApiFFI #-}
-----------------------------------------------------------------------------
-- |
@@ -246,7 +247,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
-- | @unsetEnv name@ removes the specified environment variable from the
$NetBSD: patch-libraries_base_configure,v 1.1 2021/02/09 13:16:24 ryoon Exp $
Ensure libiconv can be found at runtime.
--- libraries/base/configure.orig 2020-09-15 12:39:44.549328929 +0000
+++ libraries/base/configure
@@ -4459,7 +4459,7 @@ fi
# Check whether --with-iconv-libraries was given.
if test "${with_iconv_libraries+set}" = set; then :
- withval=$with_iconv_libraries; ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval $LDFLAGS"
+ withval=$with_iconv_libraries; ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval ${COMPILER_RPATH_FLAG}$withval $LDFLAGS"
else
ICONV_LIB_DIRS=
fi
$NetBSD: patch-libraries_time_lib_Data_Time_Clock_Internal_CTimespec.hsc,v 1.1 2021/02/09 13:16:24 ryoon Exp $
Suppress linker warnings about compatibility symbols.
--- libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc.orig 2020-01-04 02:21:30.506303962 +0000
+++ libraries/time/lib/Data/Time/Clock/Internal/CTimespec.hsc
@@ -1,3 +1,4 @@
+{-# LANGUAGE CApiFFI #-}
module Data.Time.Clock.Internal.CTimespec where
#include "HsTimeConfig.h"
@@ -29,9 +30,9 @@ 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 :: ClockID -> Ptr CTimespec -> IO CInt
-foreign import ccall unsafe "time.h clock_getres"
+foreign import capi unsafe "time.h clock_getres"
clock_getres :: ClockID -> Ptr CTimespec -> IO CInt
-- | Get the resolution of the given clock.
$NetBSD: patch-libraries_time_lib_Data_Time_Clock_Internal_CTimeval.hs,v 1.1 2021/02/09 13:16:24 ryoon 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/Internal/CTimeval.hs.orig 2020-01-04 06:13:10.008205366 +0000
+++ libraries/time/lib/Data/Time/Clock/Internal/CTimeval.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CApiFFI #-}
module Data.Time.Clock.Internal.CTimeval where
#ifndef mingw32_HOST_OS
@@ -23,7 +24,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
$NetBSD: patch-libraries_unix_System_Posix_Env.hsc,v 1.1 2021/02/09 13:16:24 ryoon 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
$NetBSD: patch-libraries_unix_System_Posix_Env_ByteString.hsc,v 1.1 2021/02/09 13:16:24 ryoon 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
$NetBSD: patch-libraries_unix_System_Posix_Files_Common.hsc,v 1.1 2021/02/09 13:16:24 ryoon 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
$NetBSD: patch-libraries_unix_System_Posix_Signals.hsc,v 1.1 2021/02/09 13:16:24 ryoon 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
$NetBSD: patch-libraries_unix_include_execvpe.h,v 1.1 2021/02/09 13:16:24 ryoon 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
$NetBSD: patch-rts_StgCRun.c,v 1.1 2021/02/09 13:16:24 ryoon Exp $
https://gitlab.haskell.org/ghc/ghc/merge_requests/2607/diffs
--- rts/StgCRun.c.orig 2019-08-25 04:26:28.000000000 +0000
+++ rts/StgCRun.c
@@ -405,7 +405,7 @@ StgRunIsImplementedInAssembler(void)
"movq %%xmm15,136(%%rax)\n\t"
#endif
-#if !defined(darwin_HOST_OS)
+#if !defined(darwin_HOST_OS) && !defined(solaris2_HOST_OS)
/*
* Let the unwinder know where we saved the registers
* See Note [Unwinding foreign exports on x86-64].
@@ -519,7 +519,7 @@ StgRunIsImplementedInAssembler(void)
"i"(RESERVED_C_STACK_BYTES + STG_RUN_STACK_FRAME_SIZE
/* rip relative to cfa */)
-#if !defined(darwin_HOST_OS)
+#if !defined(darwin_HOST_OS) && !defined(solaris2_HOST_OS)
, "i"((RSP_DELTA & 127) | (128 * ((RSP_DELTA >> 7) > 0)))
/* signed LEB128-encoded delta from rsp - byte 1 */
#if (RSP_DELTA >> 7) > 0