From 338c29154351e859acd524aa13075b96f3861272 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Tue, 21 May 2013 17:22:33 -0400 Subject: [PATCH] Make a 'misc/' folder for odds and ends Move HaddockPaths and vimrc there; add GHC bootstrapping script for safe-keeping. --- Makefile | 2 +- README.md | 1 + {src/Dyna/XXX => misc}/HaddockPaths.hs | 2 +- misc/ghc-bootstrap.sh | 117 +++++++++++++++++++++++++ vimrc => misc/vimrc | 0 5 files changed, 120 insertions(+), 2 deletions(-) rename {src/Dyna/XXX => misc}/HaddockPaths.hs (98%) create mode 100644 misc/ghc-bootstrap.sh rename vimrc => misc/vimrc (100%) diff --git a/Makefile b/Makefile index a74250d..b083392 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ haddock: haddock --html -o dist/alldoc \ --ignore-all-exports -w --optghc=-isrc \ -t "Dyna -- GIT `git describe --always`" \ - `runghc -isrc Dyna.XXX.HaddockPaths "$(HADDOCK_HTML)"` \ + `runghc -imisc HaddockPaths "$(HADDOCK_HTML)"` \ `grep -ie '^\( \|\t\)*main-is:' dyna.cabal | sed -e "s/^.*Is: */src\//"` # If the cabal file doesn't do the right thing, this tries to work through diff --git a/README.md b/README.md index 75524ea..60a9a4f 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ An overview of the source tree * expected/ -- Expected output for self-tests. Named by program and backend, both. * external/ * damsl-k3 -- The DAMSL K3 tree, tracked as a git submodule. +* misc/ -- Pretty much what it says on the tin * src/Dyna/ * Analysis -- The heart of the compiler * Mode -- A re-implementation of the Mercury mode system diff --git a/src/Dyna/XXX/HaddockPaths.hs b/misc/HaddockPaths.hs similarity index 98% rename from src/Dyna/XXX/HaddockPaths.hs rename to misc/HaddockPaths.hs index 62e36b0..e249220 100644 --- a/src/Dyna/XXX/HaddockPaths.hs +++ b/misc/HaddockPaths.hs @@ -10,7 +10,7 @@ -- the same license as Cabal. {-# LANGUAGE ScopedTypeVariables #-} -module Dyna.XXX.HaddockPaths where +module HaddockPaths where import Control.Monad import Data.Either diff --git a/misc/ghc-bootstrap.sh b/misc/ghc-bootstrap.sh new file mode 100644 index 0000000..1162bf2 --- /dev/null +++ b/misc/ghc-bootstrap.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +# This script is useful for bringing up a Haskell world on a machine which +# doesn't have one (use the ghc tarballs) or to bring one up from source. +# Written because I was tracking ghc HEAD for a while, but stuck here +# because it's proven itself useful to bring up a Dyna-capable environment +# on a few machines. + +GHCVER=7.6.3 + +HTMLROOT="../../" + +CABAL_BOOTSTRAP_PKGS="transformers-0.3.0.0 \ + mtl-2.1.2 \ + text-0.11.2.3 \ + zlib-0.5.4.0 \ + parsec-3.1.3 \ + network-2.4.1.0 \ + random-1.0.1.1 \ + HTTP-4000.2.6 \ + cabal-install-1.16.0.2" + +HROOT=$HOME/src/haskell +HPATH=$HROOT/_inst +HBIN=$HPATH/bin +HLIB=$HPATH/lib/ghc-$GHCVER + +export CABALOPTS_BOOTSTRAP="--prefix=$HPATH --global --enable-library-profiling" +export CABALOPTS="--prefix=$HPATH --global --enable-library-profiling \ + --haddock-html --haddock-html-location=${HTMLROOT}/\$pkgid/html/" + +export PATH=$HBIN:$PATH + +# Enable some hackery around library files being misnamed +export LD_LIBRARY_PATH=$HLIB${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + +CMD=$1; +shift; + +case $CMD in + install) + $HBIN/cabal install $CABALOPTS --global $@; + ;; + + buildpwd) + $HBIN/runghc Setup configure $CABALOPTS --global $@ && + $HBIN/runghc Setup build && + $HBIN/runghc Setup install + ;; + + run) + export PREFIX=$HPATH + $@ + ;; + + reinstall) + export PREFIX=$HPATH + cd $HROOT + rm -rf _inst && + (cd ghc-$GHCVER; + (./boot || exit 0) && + ./configure --prefix=$PREFIX && + if [ -x ./boot]; then make -j 12 all; fi ) && + (cd ghc-$GHCVER; make install) && + # Hack around Debian's foolishness + (ln -s /usr/lib/libgmp.so.? _inst/lib/ghc-$GHCVER/libgmp.so) && + # Bootstrap cabal-install + (cd pkgs; for i in $CABAL_BOOTSTRAP_PKGS ; + do (cd $i; $HBIN/runghc Setup configure $CABALOPTS_BOOTSTRAP; + $HBIN/runghc Setup build; + $HBIN/runghc Setup install) + done) && + # Now, reinstall so that we get documentation + (cd pkgs; for i in $CABAL_BOOTSTRAP_PKGS; + do (cd $i; $HBIN/cabal install $CABALOPTS --force-reinstalls); done) && + # And last, build everything else we need out of cabal + $HBIN/cabal update && + # Pull in the packages on which Dyna will depend as well as + $HBIN/cabal install $CABALOPTS -j12 \ + blaze-builder \ + blaze-html \ + charset \ + criterion \ + either \ + fingertree \ + fingertree-psqueue \ + haskeline \ + HUnit \ + keys \ + lens \ + MonadCatchIO-transformers \ + pandoc \ + recursion-schemes \ + reducers \ + 'semigroups>=0.9' \ + tagged \ + terminfo \ + trifecta \ + test-framework \ + test-framework-golden \ + test-framework-hunit \ + test-framework-quickcheck2 \ + test-framework-smallcheck \ + test-framework-th \ + unordered-containers \ + unification-fd \ + utf8-string \ + wl-pprint-extras \ + wl-pprint-terminfo && + # Link in some documentation from the GHC-bundled libraries just so we have a complete list + (cd _inst/share/doc; find ghc/html/libraries/ -maxdepth 1 -type d -exec ln -s {} . \; -exec ln -s . {}/html \;) + ;; + + *) + echo "I'm sorry, Dave?" + ;; +esac diff --git a/vimrc b/misc/vimrc similarity index 100% rename from vimrc rename to misc/vimrc -- 2.50.1