Add a ghc-bootstrap package for making ghc binary bootstrap kits.

This is a ghc 6.8.3 package based on lang/ghc.

As of ghc 7.something, the old system of bootstrapping ghc from
generated C sources has been deprecated. While in theory we could move
pkgsrc up to that point using C bootstrap kits like the one currently
used by lang/ghc, there are several reasons not to: (1) it's a dead
end; (2) there is no available infrastructure for building such kits,
as in the past it was done by hand by the package maintainer; (3)
building ghc from C sources wasn't ever really fully supported anyway
and usually requires fiddling to make it work.

For this reason, by the power invested in me as one of the few people
who actually uses ghc for something nontrivial (much as I perhaps
regret doing so)... we will switch to binary bootstrap kits now.

The bootstrap kits generated here are just installable ghc packages
under a different name. This package depends on lang/ghc and uses the
installed ghc to build another copy; then that copy becomes the
bootstrap kit. That is, the bootstrap kit is the pkgsrc package you
get by doing 'make package' in this directory.

I have a (tested and working) patch to switch lang/ghc to use a new
bootstrap kit generated here, but I am intentionally holding off on
committing it until after 2013q4 is branched. That way anyone who
wants a bootstrap kit for a platform currently supported by lang/ghc
can get one by checking out 2013q4, building ghc, and then building
ghc-bootstrap.

Note that these bootstrap kits cannot be used with the wip/ghc
package; it uses a built but not installed ghc source tree as the
bootstrap kit. You can capture one of these from here if you really
want to by doing 'make' and then tarring up work/ghc-6.8.3... I think.
I haven't tested that, and for now it won't work anyway as wip/ghc is
too many versions ahead for such a build to be supported.

Because ghc can only be built with a recent ghc, updating lang/ghc to
a recent version will require a ping/pong process with ghc and
ghc-bootstrap. This is the chief reason to have a separate
ghc-bootstrap package; it should be perfectly possible to build
lang/ghc with a lang/ghc package as the bootstrap too.
This commit is contained in:
dholland 2013-12-15 02:00:07 +00:00
parent 1f9b5eb378
commit beed0c4b0d
15 changed files with 1324 additions and 0 deletions

5
lang/ghc-bootstrap/DESCR Normal file
View file

@ -0,0 +1,5 @@
GHC: The Glasgow Haskell Compiler.
This is a package for generating binary bootstrap kits for GHC. The
main GHC package is lang/ghc; that is all you need unless you are
working on the GHC package.

View file

@ -0,0 +1,59 @@
# $NetBSD: Makefile,v 1.1 2013/12/15 02:00:07 dholland Exp $
DISTNAME= ghc-6.8.3
PKGNAME= ghc-bootstrap-6.8.3
CATEGORIES= lang
MASTER_SITES= http://www.haskell.org/ghc/dist/6.8.3/
DISTFILES= ghc-6.8.3-src.tar.bz2
OWNER= dholland@NetBSD.org
HOMEPAGE= http://www.haskell.org/ghc/
COMMENT= Bootstrap kit generator for the GHC Haskell compiler
CONFLICTS+= ghc-[0-9]*
# Disable this (at least for now) so bootstrap kits get built by autobuilds.
#NOT_FOR_BULK_PLATFORM= *-*-* # Package is useful only for maintainers.
CHECK_PORTABILITY_SKIP= distrib/prep-bin-dist-mingw
# += in a shell script, but in embedded AWK code, so it's ok.
CHECK_PORTABILITY_SKIP+= libraries/base/cbits/ubconfc
GNU_CONFIGURE= yes
#CONFIGURE_ARGS+= --with-ghc=${WRKDIR}/ghc-6.4.2/ghc/compiler/ghc-inplace
CONFIGURE_ARGS+= --with-ghc=${BUILDLINK_PREFIX.ghc}/bin/ghc
CONFIGURE_ENV+= PerlCmd=${PERL5:Q}
#USE_TOOLS+= gmake perl:run
USE_TOOLS+= gmake perl
SUBST_CLASSES+= prefix
SUBST_STAGE.prefix= pre-configure
SUBST_FILES.prefix+= mk/bootstrap.mk
SUBST_FILES.prefix+= libraries/readline/configure
SUBST_FILES.prefix+= libraries/readline/readline.cabal
SUBST_FILES.prefix+= rts/package.conf.in
SUBST_SED.prefix= -e 's,@PREFIX@,${PREFIX},g'
# The ghc compiler normally splits the generated C files into small
# parts before sending them to gcc, to enable the linker to eliminate
# unused parts. This does however not play nice with the pkgsrc
# framework, and the result is that the build takes more than 5 times
# as long than when the files are not split. See
# http://mail-index.netbsd.org/tech-pkg/2006/07/30/0005.html
# for a description of the problem.
# Disable file splitting until pkgsrc has been improved.
#
# Also, for the bootstrap kit, at least for the time being, do a
# fast build. This should probably be tinkered with in the future
# so as to provide the smallest/fastest bootstrap kit that can
# still compile GHC.
pre-configure:
${ECHO} "SplitObjs=NO" > ${WRKSRC}/mk/build.mk
${ECHO} "BuildFlavour=quickest" >> ${WRKSRC}/mk/build.mk
# uses the UNDO_ constants
.include "../../devel/readline/buildlink3.mk"
.include "../../devel/gmp/buildlink3.mk"
.include "../../lang/ghc/buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

1033
lang/ghc-bootstrap/PLIST Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
$NetBSD: distinfo,v 1.1 2013/12/15 02:00:07 dholland Exp $
SHA1 (ghc-6.8.3-src.tar.bz2) = f908b0e0293014dde587abd8c7912eb490f9b3d2
RMD160 (ghc-6.8.3-src.tar.bz2) = 415cd144f0641a0c5887ad7325e2e775e93044f0
Size (ghc-6.8.3-src.tar.bz2) = 7092076 bytes
SHA1 (patch-ac) = 65ba6ec7a78d938af965ebc07aa65fc00fb6b5ce
SHA1 (patch-ad) = 3d1e88785651dedf582b53e54e4aac6dcf278a2e
SHA1 (patch-aj) = 26019891c21907c9c26a7bc21d655172528cfbaa
SHA1 (patch-ak) = 62cc2e4541e12c57d20d60d99ecda5646ca8c58a
SHA1 (patch-al) = 3a66b0bf57772c34234fde5713dc02037c476eb2
SHA1 (patch-am) = 10758ef014647c864c9eb1156121f0091120fcaf
SHA1 (patch-an) = 3267a1ff00ae74b337e4dbd8f4e1c85cdb1aeed7
SHA1 (patch-ao) = ba3c218d3a6fc70986d159bbae9e41e37f4e0d79
SHA1 (patch-ar) = 0cc6fedc5ee6304b201da79b7cc0104a804501cd
SHA1 (patch-as) = cebeefbeada25b1d52a528c4d83d66b7a2766e1a
SHA1 (patch-mk_bootstrap.mk) = fdb9e57bc3aed50d2d3b34360255c0a84dcf3eca

View file

@ -0,0 +1,13 @@
$NetBSD: patch-ac,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- rts/package.conf.in.orig 2007-12-10 16:11:32.000000000 -0200
+++ rts/package.conf.in
@@ -73,7 +73,7 @@ depends:
hugs-options:
cc-options:
-ld-options:
+ld-options: "-Wl,-R@PREFIX@/lib","-L@PREFIX@/lib",
#ifdef LEADING_UNDERSCORE
"-u", "_base_GHCziBase_Izh_static_info"
, "-u", "_base_GHCziBase_Czh_static_info"

View file

@ -0,0 +1,9 @@
$NetBSD: patch-ad,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- libraries/readline/readline.cabal.orig 2007-12-10 16:20:29.000000000 -0200
+++ libraries/readline/readline.cabal
@@ -32,3 +32,4 @@ library
includes: HsReadline.h
install-includes: HsReadline.h HsReadlineConfig.h
c-sources: HsReadline_cbits.c
+ ld-options: "-Wl,-R@PREFIX@/lib","-L@PREFIX@/lib"

View file

@ -0,0 +1,15 @@
$NetBSD: patch-aj,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- libraries/readline/configure.orig 2008-02-21 09:32:21.000000000 -0300
+++ libraries/readline/configure
@@ -1300,6 +1300,10 @@ else
readline_libraries=NONE
fi;
+# Force readline paths.
+readline_includes="@PREFIX@/include"
+readline_libraries="@PREFIX@/lib"
+
if test "$enable_readline" = no; then
BUILD_PACKAGE_BOOL=False

View file

@ -0,0 +1,37 @@
$NetBSD: patch-ak,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- libraries/base/include/HsBase.h.orig 2008-06-16 19:42:53.000000000 +0200
+++ libraries/base/include/HsBase.h 2008-07-19 19:57:32.000000000 +0200
@@ -21,7 +21,9 @@
/* Needed to get the macro version of errno on some OSs (eg. Solaris).
We must do this, because these libs are only compiled once, but
must work in both single-threaded and multi-threaded programs. */
+#ifndef _REENTRANT
#define _REENTRANT 1
+#endif
#include "HsFFI.h"
@@ -254,6 +256,11 @@
INLINE int
__hscore_sigismember( sigset_t * set, int s )
{ return sigismember(set,s); }
+
+INLINE int
+__hscore_sigprocmask( int how, const sigset_t * set, sigset_t * oset )
+{ return sigprocmask(how,set,oset); }
+
#endif
INLINE void *
@@ -665,6 +672,10 @@
#endif
}
+INLINE DIR* __hscore_opendir (const char *filename) {
+ return opendir(filename);
+}
+
// These are wrapped because on some OSs (eg. Linux) they are
// macros which redirect to the 64-bit-off_t versions when large file
// support is enabled.

View file

@ -0,0 +1,22 @@
$NetBSD: patch-al,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- libraries/base/System/Posix/Internals.hs.orig 2007-12-10 19:16:54.000000000 +0100
+++ libraries/base/System/Posix/Internals.hs 2008-07-07 13:11:44.000000000 +0200
@@ -354,7 +354,7 @@
foreign import ccall unsafe "HsBase.h __hscore_open"
c_open :: CString -> CInt -> CMode -> IO CInt
-foreign import ccall unsafe "HsBase.h opendir"
+foreign import ccall unsafe "HsBase.h __hscore_opendir"
c_opendir :: CString -> IO (Ptr CDir)
foreign import ccall unsafe "HsBase.h __hscore_mkdir"
@@ -418,7 +418,7 @@
foreign import ccall unsafe "HsBase.h __hscore_sigaddset"
c_sigaddset :: Ptr CSigset -> CInt -> IO CInt
-foreign import ccall unsafe "HsBase.h sigprocmask"
+foreign import ccall unsafe "HsBase.h __hscore_sigprocmask"
c_sigprocmask :: CInt -> Ptr CSigset -> Ptr CSigset -> IO CInt
foreign import ccall unsafe "HsBase.h tcgetattr"

View file

@ -0,0 +1,33 @@
$NetBSD: patch-am,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- libraries/unix/include/HsUnix.h.orig 2008-06-16 19:48:44.000000000 +0200
+++ libraries/unix/include/HsUnix.h 2008-07-19 20:06:49.000000000 +0200
@@ -140,6 +140,28 @@
return mknod(pathname,mode,dev);
}
+#ifdef HAVE_UNSETENV
+INLINE int __hsunix_unsetenv(const char *name)
+{
+ return unsetenv(name);
+}
+#endif
+
+INLINE clock_t __hsunix_times(struct tms *tp)
+{
+ return times(tp);
+}
+
+INLINE int __hsunix_sigpending(sigset_t *set)
+{
+ return sigpending(set);
+}
+
+INLINE int __hsunix_sigsuspend(const sigset_t *sigmask)
+{
+ return sigsuspend(sigmask);
+}
+
#ifdef HAVE_PTSNAME
// I cannot figure out how to make the definitions of the following
// functions visible in <stdlib.h> on Linux. But these definitions

View file

@ -0,0 +1,13 @@
$NetBSD: patch-an,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- libraries/unix/System/Posix/Env.hsc.orig 2008-03-24 17:09:39.000000000 +0100
+++ libraries/unix/System/Posix/Env.hsc 2008-03-24 17:10:41.000000000 +0100
@@ -81,7 +81,7 @@
unsetEnv name = withCString name c_unsetenv
-foreign import ccall unsafe "unsetenv"
+foreign import ccall unsafe "__hsunix_unsetenv"
c_unsetenv :: CString -> IO ()
#else
unsetEnv name = putEnv (name ++ "=")

View file

@ -0,0 +1,13 @@
$NetBSD: patch-ao,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- libraries/unix/System/Posix/Process.hsc.orig 2008-03-24 17:10:54.000000000 +0100
+++ libraries/unix/System/Posix/Process.hsc 2008-03-24 17:11:30.000000000 +0100
@@ -177,7 +177,7 @@
type CTms = ()
-foreign import ccall unsafe "times"
+foreign import ccall unsafe "__hsunix_times"
c_times :: Ptr CTms -> IO CClock
-- -----------------------------------------------------------------------------

View file

@ -0,0 +1,22 @@
$NetBSD: patch-ar,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- rts/Linker.c.orig 2008-07-19 19:54:17.000000000 +0200
+++ rts/Linker.c 2008-07-19 19:55:39.000000000 +0200
@@ -2612,10 +2612,16 @@
#define Elf_Sym Elf64_Sym
#define Elf_Rel Elf64_Rel
#define Elf_Rela Elf64_Rela
-#if !defined(freebsd_HOST_OS)
+#ifndef ELF_ST_TYPE
#define ELF_ST_TYPE ELF64_ST_TYPE
+#endif
+#ifndef ELF_ST_BIND
#define ELF_ST_BIND ELF64_ST_BIND
+#endif
+#ifndef ELF_R_TYPE
#define ELF_R_TYPE ELF64_R_TYPE
+#endif
+#ifndef ELF_R_SYM
#define ELF_R_SYM ELF64_R_SYM
#endif
#else

View file

@ -0,0 +1,21 @@
$NetBSD: patch-as,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- libraries/unix/System/Posix/Signals.hs.orig 2008-07-19 19:59:17.000000000 +0200
+++ libraries/unix/System/Posix/Signals.hs 2008-07-19 20:00:49.000000000 +0200
@@ -502,7 +502,7 @@
-- ignore the return value; according to the docs it can only ever be
-- (-1) with errno set to EINTR.
-foreign import ccall unsafe "sigsuspend"
+foreign import ccall unsafe "__hsunix_sigsuspend"
c_sigsuspend :: Ptr CSigset -> IO CInt
#endif
@@ -526,6 +526,6 @@
c_sigismember :: Ptr CSigset -> CInt -> IO CInt
#endif /* __HUGS__ */
-foreign import ccall unsafe "sigpending"
+foreign import ccall unsafe "__hsunix_sigpending"
c_sigpending :: Ptr CSigset -> IO CInt

View file

@ -0,0 +1,13 @@
$NetBSD: patch-mk_bootstrap.mk,v 1.1 2013/12/15 02:00:07 dholland Exp $
--- mk/bootstrap.mk~ 2008-06-16 17:27:16.000000000 +0000
+++ mk/bootstrap.mk
@@ -145,7 +145,7 @@ ifeq "$(GhcWithInterpreter)" "YES"
HC_BOOT_LIBS += -lHSreadline -lHStemplate-haskell -lHSunix -lHSunix_cbits
endif
-HC_BOOT_LIBS += -lHSregex-compat -lHSregex-posix -lHSregex-base -lHSCabal -lHShaskell98 -lHSbase -lHSbase_cbits -lHSparsec -lHSrts -lgmp -lm -lrt $(EXTRA_HC_BOOT_LIBS)
+HC_BOOT_LIBS += -lHSregex-compat -lHSregex-posix -lHSregex-base -lHSCabal -lHShaskell98 -lHSbase -lHSbase_cbits -lHSparsec -lHSrts -Wl,-R@PREFIX@/lib -L@PREFIX@/lib -lgmp -lm -lrt $(EXTRA_HC_BOOT_LIBS)
ifeq "$(GhcLibsWithReadline)" "YES"
HC_BOOT_LIBS += $(patsubst %, -l%, $(LibsReadline))