From ca5ba8cdaddffa113b9b4a8bf35bd83b6c8d2733 Mon Sep 17 00:00:00 2001 From: PHO Date: Sat, 30 Oct 2010 16:24:08 +0900 Subject: [PATCH] HC package construction guide --- Makefile | 3 ++ TODO | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 TODO diff --git a/Makefile b/Makefile index b44037c..794adbf 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,9 @@ PKG_DESTDIR_SUPPORT= user-destdir # these packages are built with integer-simple, not integer-gmp, to # reduce some complexity by not depending on the GMP. The resulting # registerised GHC uses integer-gmp so this won't be a problem. +# +# If you want to build HC packages yourself, follow instructions in +# the ./TODO file. ONLY_FOR_PLATFORM= NetBSD-*-i386 FreeBSD-*-i386 Darwin-*-powerpc # We must provide the real pass to gcc to the ./configure script, diff --git a/TODO b/TODO new file mode 100644 index 0000000..1bdf6bf --- /dev/null +++ b/TODO @@ -0,0 +1,97 @@ +.. -*- rst -*- + +============ +wip/ghc TODO +============ + +* Build more bootstrapping HC archives to support more platforms. + + +-------------------------- +How to build an HC archive +-------------------------- + +It's basically the same as the `Porting Guide +`_, plus +some minor tweaks. + +Extract the source archive and duplicate the source tree, one for +``-target`` and one for ``-host``:: + + $ tar jxf ghc-{VERSION}-src.tar.bz2 + $ cp -r ghc-{VERSION} ghc-{VERSION}-target + $ mv ghc-{VERSION} ghc-{VERSION}-host + +Build some configuration files:: + + $ cd ghc-{VERSION}-target + $ ln -s /bin/pwd utils/ghc-pwd/ghc-pwd + $ ./configure --enable-hc-boot + $ echo "INTEGER_LIBRARY = integer-simple" > mk/build.mk + $ gmake bootstrapping-files + $ cd .. + +Run ``./configure`` on the host tree:: + + $ cd ghc-{VERSION}-host + $ ./configure + +Then create ``ghc-{VERSION}-host/mk/build.mk`` with the following +contents:: + + PORTING_HOST = YES + GhcUnregisterised = YES + GhcLibHcOpts = -O -fvia-C -keep-hc-files + GhcRtsHcOpts = -keep-hc-files + GhcLibWays = v + GhcRTSWays = + SplitObjs = NO + GhcWithNativeCodeGen = NO + GhcWithInterpreter = NO + GhcStage1HcOpts = -O + GhcStage2HcOpts = -O -fvia-C -keep-hc-files + SRC_HC_OPTS += -H32m + GhcWithSMP = NO + utils/ghc-pkg_dist-install_v_HC_OPTS += -keep-hc-files + + INTEGER_LIBRARY = integer-simple + +Build it:: + + $ gmake + +Create an intermediate tarball:: + + $ rm -f list mkfiles boot.tar.gz + $ find . -name "*.hi" >> list + $ find . -name "*.hc" >> list + $ find . -name "*_stub.c" >> list + $ find . -name "*_stub.h" >> list + $ find . -name package-data.mk >> list + $ find . -name package.conf.d >> list + $ find . -name package.conf.inplace >> list + $ echo compiler/main/Config.hs >> list + $ echo compiler/prelude/primops.txt >> list + $ ls compiler/primop-*.hs-incl >> list + $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles + $ find . -name .depend | sed "s/^/touch /" >> mkfiles + $ echo mkfiles >> list + $ tar -zcf boot.tar.gz -T list + +Then extract it again, in a different directory:: + + $ mkdir ghc-{VERSION} + $ cd ghc-{VERSION} + $ tar zxf ../boot.tar.gz + +Modify hard-coded paths in inplace ``.conf`` files, and then +re-archive the HC tree:: + + $ sed -i.bak -e 's#'`dirname \`pwd\``'#[[GHC_SOURCE_PATH]]#g' \ + inplace/lib/package.conf.d/*.conf \ + */*/package-data.mk \ + */*/*/package-data.mk + $ cd .. + $ tar jcf ghc-{VERSION}-boot-{PLATFORM}.tar.bz2 + +Done. Upload the archive to some host and add it to the ``Makefile``. -- 2.40.0