upgpkg: wordpress 6.2.1-1
[ArchLinux/community.git] / ghc / trunk / print-provides-replaces.sh
blobfd1b003c03dc24bbfb1164b3d4e25a57356bc8cc
1 #!/bin/bash
3 . PKGBUILD
5 if [[ ! -d src/ghc-${pkgver}/libraries ]]; then
6 echo "error: no directory src/ghc-${pkgver}/libraries: You must extract the source tarball under src/"
7 exit 1
8 fi
10 declare -A exclude
11 # no Win32 cause we're not building on windows
12 exclude['Win32']=1
13 # no integer-simple because we use integer-gmp
14 exclude['integer-simple']=1
15 # extract excluded libraries from ghc.mk
16 for exclude_pkg in $(sed 's/PKGS_THAT_ARE_INTREE_ONLY := //p' -n src/ghc-${pkgver}/ghc.mk); do
17 exclude[${exclude_pkg}]=1
18 done
20 cd src/ghc-${pkgver}
22 # $1 is the name of the field
23 # $2 is the string for the test, either '=' or '<'
24 # ..$@ are the files to search
25 print_var() {
26 field=$1
27 output_version=$2
28 shift
29 shift
31 printf " $field=("
32 for path in $(ls $@); do
33 dirname=$(echo $path | awk -F '/' '{ print $2 }')
34 cabalfile=$(echo $path | awk -F '/' '{ print $3 }')
35 cabalname=$(basename $cabalfile .cabal)
36 [[ ${exclude[${dirname}]} ]] && continue
37 version=$(awk 'tolower($0) ~ /^version:/ {print $2 }' $path)
38 printf "'haskell-${cabalname,,}"
39 [[ -n "$output_version" ]] && printf "$output_version$version"
40 printf "'\n "
41 done
42 printf "\033[1A'haskell-${cabalname,,}"
43 [[ -n "$output_version" ]] && printf "$output_version$version"
44 printf "')\n"
47 # For ghc-libs
48 print_var 'provides' '=' libraries/*/*.cabal libraries/{containers/containers,Cabal/Cabal}/*.cabal utils/ghc-pkg/*.cabal
49 print_var 'replaces' '' libraries/*/*.cabal libraries/{containers/containers,Cabal/Cabal}/*.cabal utils/ghc-pkg/*.cabal
51 # For ghc
52 print_var 'provides' '=' utils/{hpc,hsc2hs,haddock*,hp2ps}/*.cabal
53 print_var 'replaces' '' utils/{hpc,hsc2hs,haddock*,hp2ps}/*.cabal