[arch-haskell] ghc-7.0.3 & haskell-platform

Magnus Therning magnus at therning.org
Sat Oct 12 07:39:26 UTC 2013


On Thu, Jun 23, 2011 at 07:36:39PM +0200, Rémy Oudompheng wrote:
> On 2011/6/23 Vesa Kaihlavirta <vpkaihla at gmail.com> wrote:
> > Rémy was doing some work on automating the whole rebuild process
> > (which is currently about 20-30 separate build & install steps when
> > doing manually), but I don't know how that went.
> 
> Actually I did not find the time to do that. I was planning to use a
> simplified version of the arch-haskell scripts. I can really do the
> rebuilds by hand in the meanwhile, there are not so many GHC releases
> and I have enough patience to help.

I've attached a script I use for [h4a].  Maybe you'll find it useful.
It doesn't try to work out dependencies, but instead you need to
provide a good build order.  It sounds like that shouldn't be too much
of a problem for a rather static set of 20 or so packages though.

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus

I invented the term Object-Oriented, and I can tell you I did not have
C++ in mind.
     -- Alan Kay
-------------- next part --------------
#! /bin/zsh

source $(dirname $0)/funcs

set -eu

# default values
arch=$(uname -m)
chrootdir=.
pristine_chrootdir=root
build_chrootdir=build
habs_dir=.
clean_build_first=0
update_pristine_first=0

usage() {
    cat << EOF
Usage $0 [options] -- [packages]

Run this script in your HABS dir to build the named packages inside a
chroot.

The chroot dir consists of two dirs, a pristine chroot (root), and a build
chroot (build).  This script handles both of them.

Options:
-h          This help
-c          Clean the build chroot before building
-x          Update the pristine chroot first (implies -c)
-l <dir>    Location of chroot (default .)
-a <arch>   Architecture to build for i686 or x86_64 (default is local arch)
-b <dir>    Location of your HABS dir (default .)
EOF
}

buildpkg() {
    if [[ -z "$(ls|grep .pkg.tar.xz)" ]]; then
        msg "Building in $PWD"
        sudo setarch ${arch} makechrootpkg -u -d -l ${build_chrootdir} -r ${CHROOT_DIR} -- -i
    else
        msg "Skipping build in $PWD"
    fi
}

while getopts hcxa:l:b: opt; do
    case "${opt}" in
        h) usage; exit 0;;
        c) clean_build_first=1;;
        x) update_pristine_first=1;;
        a) arch=${OPTARG};;
        l) chrootdir="${OPTARG}";;
        b) habs_dir="${OPTARG}";;
    esac
done
shift $((OPTIND - 1))

CHROOT_DIR=$(readlink -f ${chrootdir}/${arch}-chroot)
CHROOT_ROOTDIR=${CHROOT_DIR}/${pristine_chrootdir}
CHROOT_BUILDDIR=${CHROOT_DIR}/${build_chrootdir}

if [ ! -d ${CHROOT_ROOTDIR} ]; then
    msg "Creating the pristine chroot ${CHROOT_DIR} ..."
    mkdir -p "${CHROOT_DIR}" || die "Couldn't create ${CHROOT_DIR}"

    pacman_conf=$(mktemp "/tmp/pacman-habs.XXXXXXXX.conf")
    trap 'rm -f "${pacman_conf}"' 0
    cat > "${pacman_conf}" << EOF
[options]
HoldPkg = pacman libc
SyncFirst = pacman
Architecture = auto

[repo]
Server = file:///repo

[h4a]
Server = http://www.kiwilight.com/~magnus/\$repo

[core]
Include = /etc/pacman.d/mirrorlist

[extra]
Include = /etc/pacman.d/mirrorlist

[community]
Include = /etc/pacman.d/mirrorlist
EOF

    sudo setarch ${arch} mkarchroot -f -C ${pacman_conf} \
        -M /usr/share/devtools/makepkg-${arch}.conf ${CHROOT_ROOTDIR} \
        util-linux-ng pacman sudo wget file grep base-devel ghc
    # are there more packages that should be installed in the pristine?

    # no point in updating the newly built pristine
    update_pristine_first=0
    msg "Done"
fi

if [[ "${update_pristine_first}" == "1" ]]; then
    msg "Updating the the pristine chroot..."
    sudo setarch ${arch} mkarchroot -u ${CHROOT_ROOTDIR}
    clean_build_first=1
    msg " Done"
fi

if [[ "${clean_build_first}" == "1" ]]; ;then
    msg "Cleaning up the build chroot..."
    sudo rsync -a --delete -q -W -x "${CHROOT_ROOTDIR}/" "${CHROOT_BUILDDIR}"
    msg " Done"
fi

for pkg0 in $@; do
    #pkg1=$(print $pkg0 | tr 'A-Z' 'a-z')
    pkg1=${(L)pkg0}
    [ -d ${habs_dir}/${pkg1} ] && pkg=${pkg1}
    [ -d ${habs_dir}/haskell-${pkg1} ] && pkg=haskell-${pkg1}
    if [[ "x${pkg}" != "x" ]]; then
        (cd ${habs_dir}/$pkg; buildpkg )
    else
        die "No such package: $pkg0" 
    fi
    pkg=
done
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/arch-haskell/attachments/20131012/0b2862c1/attachment.sig>


More information about the arch-haskell mailing list