summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Kolmodin <kolmodin@gentoo.org>2007-08-17 16:16:55 +0000
committerLennart Kolmodin <kolmodin@gentoo.org>2007-08-17 16:16:55 +0000
commita479bbd712197ca48dfc382aa76dd215bb005be2 (patch)
treed4be0ab60107715ee644a7319203223097db7cad /dev-lang/ghc
parentStable on amd64 wrt bug #188716 (diff)
downloadgentoo-2-a479bbd712197ca48dfc382aa76dd215bb005be2.tar.gz
gentoo-2-a479bbd712197ca48dfc382aa76dd215bb005be2.tar.bz2
gentoo-2-a479bbd712197ca48dfc382aa76dd215bb005be2.zip
Fixes to ghc 6.6.1; remove leftover files upon uninstall, optinal bash completion, tweak mk/build.mk.
(Portage version: 2.1.3.1)
Diffstat (limited to 'dev-lang/ghc')
-rw-r--r--dev-lang/ghc/ChangeLog10
-rw-r--r--dev-lang/ghc/files/ghc-bash-completion218
-rw-r--r--dev-lang/ghc/ghc-6.6.1.ebuild40
3 files changed, 257 insertions, 11 deletions
diff --git a/dev-lang/ghc/ChangeLog b/dev-lang/ghc/ChangeLog
index 4b4d101c69db..26959d5ab8d6 100644
--- a/dev-lang/ghc/ChangeLog
+++ b/dev-lang/ghc/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for dev-lang/ghc
# Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.132 2007/08/08 15:57:56 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ChangeLog,v 1.133 2007/08/17 16:16:55 kolmodin Exp $
+
+ 17 Aug 2007; Lennart Kolmodin <kolmodin@gentoo.org>
+ +files/ghc-bash-completion, ghc-6.6.1.ebuild:
+ Add optional bash completion support for ghc-pkg.
+ Fixes to properly remove the leftover package.conf{,.old} files upon
+ uninstall of this package.
+ Tweaking mk/build.mk regarding arches we don't yet support for this GHC
+ version.
08 Aug 2007; Lennart Kolmodin <kolmodin@gentoo.org> ghc-6.6.ebuild:
Set SplitObjs=NO if >=gcc-4.2 is used.
diff --git a/dev-lang/ghc/files/ghc-bash-completion b/dev-lang/ghc/files/ghc-bash-completion
new file mode 100644
index 000000000000..0ee2149cd81b
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-bash-completion
@@ -0,0 +1,218 @@
+# ghc-pkg command line completion for bash
+#
+# Copyright 2006-2007 Lennart Kolmodin <kolmodin@dtek.chalmers.se>
+
+_ghc-pkg-get-ghc-pkg()
+{
+ echo ghc-pkg
+}
+
+_ghc-pkg-pkg-fields()
+{
+ # usage: _ghc-pkg-pkg-fields pkg-id
+ #
+ # list all fields of the pkg-id
+
+ # same fields for all packages but different in different versions of
+ # ghc-pkg? this can probably be done better/faster
+
+ if [[ -z "$1" ]]; then
+ echo "usage: _ghc-pkg-pkg-fields pkg-id"
+ return 1
+ fi
+
+ local fields
+
+ fields="$( $(_ghc-pkg-get-ghc-pkg) describe $1 )"
+
+ #if [[ fields != *"cannot find package"* ]]; then
+ echo "$fields" | grep ".*:.*" | sed "s/^\(.*\):.*\$/\1/"
+ #fi
+}
+
+_ghc-pkg-pkg-ids()
+{
+ # usage: _ghc-pkg-pkg-ids
+ #
+ # simply lists all package ids known by ghc-pkg.
+ $(_ghc-pkg-get-ghc-pkg) list --simple-output
+}
+
+_ghc-pkg-pkgs()
+{
+ # usage: _ghc-pkg-pkgs [include-pkgs] [include-ids]
+ #
+ # with optional parameter include-pkgs it will list all packages known
+ # to ghc-pkg.
+ # with optional parameter include-ids it will list all package-ids known
+ # to ghc-pkg.
+ local pkgs
+ local result
+ pkgs=( $( _ghc-pkg-pkg-ids ) )
+ result=( )
+
+ local withPkgs="no" withIds="no"
+ while [[ -n "$1" ]]; do
+ case "$1" in
+ include-pkgs)
+ withPkgs="yes" ;;
+ include-ids)
+ withIds="yes" ;;
+ *)
+ echo "unknown parameter '$1' to _ghc-pkg-pkgs"
+ return 1 ;;
+ esac
+ shift
+ done
+
+ # user must supply either include-pkgs, include-ids or both
+ if [[ $withPkgs != "yes" && $withIds != "yes" ]]; then
+ echo "usage: _ghc-pkg-pkgs [include-pkgs] [include-ids]"
+ return 1
+ fi
+
+ # find all packages if the user requested them
+ if [[ $withPkgs == "yes" ]]; then
+ # O(n^2) algorithm to exclude duplicates
+ for p in ${pkgs[*]}; do
+ p="${p//-[0-9.]*/}"
+ for existing in ${result[*]}; do
+ if [[ "$existing" == "$p" ]]; then
+ continue 2
+ fi
+ done
+ result=( "${result[@]}" "${p}" )
+ done
+ fi
+
+ # include all pkg-ids if requested
+ if [[ $withIds == "yes" ]]; then
+ result=( "${result[@]}" "${pkgs[@]}" )
+ fi
+
+ # we are finished, echo the result
+ echo "${result[*]}"
+
+ # happy ending
+ return 0
+}
+
+_ghc-pkg()
+{
+ local cur
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ COMPREPLY=()
+
+ local actions flags
+ actions='register update unregister expose hide list latest describe field'
+ dbflags="--user \
+ --global \
+ -f --package-conf= \
+ --global-conf="
+ registerflags="--force \
+ -g --auto-ghci-libs \
+ -D --define-name="
+ listflags="--simple-output"
+ flags="$dbflags \
+ $registerflags \
+ $listflags \
+ -? --help \
+ -V --version"
+
+ # if it's the users first word; complete it and return
+ if (($COMP_CWORD == 1)); then
+ COMPREPLY=( $( compgen -W "$actions $flags" -- $cur ) )
+ return 0
+ fi
+
+ # now we know we have at least one word written
+
+ local action="unknown" \
+ prev numwords \
+ cword act
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+ numwords=${#COMP_WORDS[@]}
+
+ # find the action with O(n*m) algorithm
+ # where n = ${#COMP_WORDS[*]}
+ # m = number of actions
+ for cword in ${COMP_WORDS[*]}; do
+ for act in $actions; do
+ if [[ "$cword" == "$act" ]]; then
+ action=$cword
+ fi
+ done
+ done
+
+ case $action in
+ register|update)
+ # we want to complete both flags and paths, how?
+ # we do it by checking if the user has started to write a flag
+ # or a path, and then decide what to complete.
+ # that is, to complete a flag, the user must start to write a '-'
+ if [[ "$cur" == -* ]]; then
+ # (we assume) it's the start of a flag
+ # set COMPREPLY to flags relevant to these actions
+ COMPREPLY=( $( compgen -W "$dbflags $registerflags" -- $cur ) )
+ fi
+ ;;
+ unregister|expose|hide|list|describe)
+ # all these actions can be completed with exactly one argument,
+ # a pkg-id.
+ COMPREPLY=( $( compgen -W "$dbflags" -- $cur ) )
+
+ # add special flags for some actions
+ if [[ "$action" == "list" ]]; then
+ COMPREPLY+=( $( compgen -W "$listflags" -- $cur ) )
+ fi
+
+ COMPREPLY+=( $( compgen -W "$( _ghc-pkg-pkgs include-ids )" -- $cur ) )
+ ;;
+ latest)
+ # complete only packages, not package ids
+ COMPREPLY=( $( compgen -W "$( _ghc-pkg-pkgs include-pkgs )" -- $cur ) )
+ ;;
+ field)
+ # we should always complete on the flags...
+ COMPREPLY=( $( compgen -W "$dbflags" -- $cur ) )
+
+ # then, we should either complete the package name or the field
+ # lets find out which one
+
+ # find the number of words in COMP_WORDS before COMP_CWORD that
+ # isn't flags. it should be 2 or 3 for us to complete it,
+ # exactly 2 if we should complete the package name
+ # exactly 3 if we should complete the field name
+ # otherwise, don't do any additional completion except the
+ # flags
+
+ # count the number of non flags up till the current word
+ local numnonflags=0 lastword i
+ for (( i=0 ; $i < $COMP_CWORD ; i++ )); do
+ if [[ ${COMP_WORDS[$i]} != -* ]]; then
+ lastword=${COMP_WORDS[$i]}
+ numnonflags=$(( ++numnonflags ))
+ fi
+ done
+
+ case $numnonflags in
+ 2)
+ # complete on pkg-ids
+ COMPREPLY+=( $( compgen -W "$( _ghc-pkg-pkgs include-ids )" -- $cur ) ) ;;
+ 3)
+ # complete on fields
+ COMPREPLY+=( $( compgen -W "$( _ghc-pkg-pkg-fields $lastword )" -- $cur ) ) ;;
+ esac
+ ;;
+ *)
+ # unknown action, not yet given by the user
+ # return all possible completions
+ COMPREPLY=( $( compgen -W "$actions $flags" -- $cur ) )
+ ;;
+ esac
+}
+
+complete -F _ghc-pkg -o default ghc-pkg
+
+# vim: set ft=sh tw=80 sw=4 et :
diff --git a/dev-lang/ghc/ghc-6.6.1.ebuild b/dev-lang/ghc/ghc-6.6.1.ebuild
index e91299ac76ec..c8f880f99f73 100644
--- a/dev-lang/ghc/ghc-6.6.1.ebuild
+++ b/dev-lang/ghc/ghc-6.6.1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.6.1.ebuild,v 1.7 2007/07/28 13:36:16 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.6.1.ebuild,v 1.8 2007/08/17 16:16:55 kolmodin Exp $
# Brief explanation of the bootstrap logic:
#
@@ -28,7 +28,7 @@
# re-emerge ghc (or ghc-bin). People using vanilla gcc can switch between
# gcc-3.x and 4.x with no problems.
-inherit base eutils flag-o-matic toolchain-funcs ghc-package versionator
+inherit base bash-completion eutils flag-o-matic toolchain-funcs ghc-package versionator
DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="http://www.haskell.org/ghc/"
@@ -72,7 +72,11 @@ DEPEND="${RDEPEND}
# In the ghcbootstrap case we rely on the developer having
# >=ghc-5.04.3 on their $PATH already
-PDEPEND=">=dev-haskell/cabal-1.1.6.2"
+PDEPEND=">=dev-haskell/cabal-1.1.6.2
+ >=dev-haskell/filepath-1.0
+ >=dev-haskell/regex-base-0.72
+ >=dev-haskell/regex-posix-0.71
+ >=dev-haskell/regex-compat-0.71"
append-ghc-cflags() {
local flag compile assemble link
@@ -139,6 +143,12 @@ pkg_setup() {
die "Could not find a ghc to bootstrap with."
fi
+ set_config
+}
+
+set_config() {
+ # make this a separate function and call it several times as portage doesn't
+ # remember the variables properly between the fuctions.
use binary && GHC_PREFIX="/opt/ghc" || GHC_PREFIX="/usr"
}
@@ -232,11 +242,13 @@ src_compile() {
echo "SRC_HC_OPTS+=-fno-warn-deprecations" >> mk/build.mk
# GHC build system knows to build unregisterised on alpha and hppa,
- # but we have to tell it to build unregisterised on some other arches
- if use ppc64 || use sparc; then
+ # but we have to tell it to build unregisterised on some arches
+ if use alpha || use hppa || use ppc64; then
echo "GhcUnregisterised=YES" >> mk/build.mk
- echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
echo "GhcWithInterpreter=NO" >> mk/build.mk
+ fi
+ if use alpha || use hppa || use ppc64 || use sparc; then
+ echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
echo "SplitObjs=NO" >> mk/build.mk
echo "GhcRTSWays := debug" >> mk/build.mk
echo "GhcNotThreaded=YES" >> mk/build.mk
@@ -272,6 +284,11 @@ src_install() {
|| die "could not remove docs (P vs PF revision mismatch?)"
fi
+ # TODO: this will not be necessary after version 6.6.1 since the .tbz2
+ # packages will have been regenerated with package.conf.shipped files.
+ cp -p "${D}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"{,.shipped} \
+ || die "failed to copy package.conf"
+
doenvd "${FILESDIR}/10ghc"
else
local insttarget="install"
@@ -302,6 +319,8 @@ src_install() {
dosbin ${FILESDIR}/ghc-updater
+ dobashcompletion "${FILESDIR}/ghc-bash-completion"
+
cp -p "${D}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"{,.shipped} \
|| die "failed to copy package.conf"
fi
@@ -309,9 +328,6 @@ src_install() {
pkg_postinst() {
ghc-reregister
- elog "If you have dev-lang/ghc-bin installed, you might"
- elog "want to unmerge it. It is no longer needed."
- elog
if use binary; then
elog "The envirenment has been set to use the binary distribution of"
@@ -330,15 +346,19 @@ pkg_postinst() {
ewarn " /usr/sbin/ghc-updater"
fi
ewarn "to re-merge all ghc-based Haskell libraries."
+
+ bash-completion_pkg_postinst
}
pkg_prerm() {
# Overwrite the (potentially) modified package.conf with a copy of the
# original one, so that it will be removed during uninstall.
+ set_config # load GHC_PREFIX
+
PKG="${ROOT}/${GHC_PREFIX}/$(get_libdir)/${P}/package.conf"
cp -p "${PKG}"{.shipped,}
- [ -f ${PKG}.old ] && rm "${PKG}.old"
+ [[ -f ${PKG}.old ]] && rm "${PKG}.old"
}