diff --git a/Distribution/ArchLinux/CabalTranslation.hs b/Distribution/ArchLinux/CabalTranslation.hs
--- a/Distribution/ArchLinux/CabalTranslation.hs
+++ b/Distribution/ArchLinux/CabalTranslation.hs
@@ -8,7 +8,7 @@
 
 module Distribution.ArchLinux.CabalTranslation (
          preprocessCabal,
-         cabal2pkg,
+         cabal2pkg, cabal2pkg',
          oldCabal2Arch,
          install_hook_name
        ) where
@@ -22,6 +22,7 @@
 import Distribution.System
 -- Archlinux modules
 import Distribution.ArchLinux.PkgBuild
+import Distribution.ArchLinux.SystemProvides
 -- Standard types
 import Distribution.Text
 import Data.Char
@@ -36,20 +37,20 @@
 --
 -- | Configure package for system
 --
-preprocessCabal :: GenericPackageDescription -> Maybe PackageDescription
-preprocessCabal cabalsrc =
+preprocessCabal :: GenericPackageDescription -> SystemProvides -> Maybe PackageDescription
+preprocessCabal cabalsrc systemContext =
      case finalizePackageDescription
         []
         (const True) -- could check against prefered pkgs....
         (Platform X86_64 buildOS) -- linux/x86_64
-        (CompilerId GHC (Version [6,10,3] []))
+        (CompilerId GHC (Version [6,12,3] []))
 
         -- now constrain it to solve in the context of a modern ghc only
-        corePackages
+        (corePackages systemContext)
         cabalsrc
      of
         Left deps     -> trace ("Unresolved dependencies: " ++show deps) Nothing
-        Right (pkg,_) -> Just pkg { buildDepends = removeCoreFrom (buildDepends pkg) }
+        Right (pkg,_) -> Just pkg { buildDepends = removeCoreFrom (buildDepends pkg) systemContext }
 
 -- attempt to filter out core packages we've already satisified
 -- not actuall correct, since it doesn't take any version
@@ -58,122 +59,54 @@
 -- TODO this should use configDependency to find the precise
 -- versions we have available on Arch.
 --
-removeCoreFrom :: [Dependency] -> [Dependency]
-removeCoreFrom []               = []
-removeCoreFrom (x@(Dependency n vr):xs) =
-  case find (\(Dependency k _) -> n == k) corePackages of
+removeCoreFrom :: [Dependency] -> SystemProvides -> [Dependency]
+removeCoreFrom [] _             = []
+removeCoreFrom (x@(Dependency n vr):xs) systemContext =
+  case find (\(Dependency k _) -> n == k) $ corePackages systemContext of
     -- haskell-parsec, haskell-quickcheck
-    Just (Dependency _ (ThisVersion v'))
-        | withinRange v' vr         ->     removeCoreFrom xs
-
     Just (Dependency (PackageName "base") _)
-                                    ->     removeCoreFrom xs
-
-    Just (Dependency _ AnyVersion)  ->     removeCoreFrom xs
-    _                               -> x : removeCoreFrom xs
-
---
--- Core packages and their versions. These come with
--- ghc, so we should be right.
---
--- http://haskell.org/haskellwiki/Libraries_released_with_GHC
---
--- And what Arch Linux thinks GHC provides:
---
--- http://repos.archlinux.org/wsvn/packages/ghc/repos/extra-x86_64/PKGBUILD
---
--- Note: we could just list these directly, and have yaourt solve them.
---
--- NEW POLICY:
---      We rely on all "provides" from the GHC library to be listed explicitly.
---
-corePackages :: [Dependency]
-corePackages =
-    [
-
--- Magic packages we have to remove
-     Dependency (PackageName "base")             (ThisVersion (Version  [4,1,0,0] []))
-    ,Dependency (PackageName "dph-base")           (AnyVersion)
-    ,Dependency (PackageName "dph-par" )           (AnyVersion)
-    ,Dependency (PackageName "dph-prim-interface") (AnyVersion)
-    ,Dependency (PackageName "dph-prim-par"   )    (AnyVersion)
-    ,Dependency (PackageName "dph-prim-seq"   )    (AnyVersion)
-    ,Dependency (PackageName "dph-seq"        )    (AnyVersion)
-    ,Dependency (PackageName "ghc")              (AnyVersion)
-    ,Dependency (PackageName "ghc-prim")         (AnyVersion)
-    ,Dependency (PackageName "integer")         (AnyVersion)
-    ,Dependency (PackageName "integer-gmp")         (AnyVersion)
-    ,Dependency (PackageName "ghc-binary")         (AnyVersion)
-
--- Official Provides: http://repos.archlinux.org/wsvn/packages/ghc/repos/extra-x86_64/PKGBUILD
---  ,Dependency (PackageName "array")            (ThisVersion (Version  [0,3,0,0] []))
---  ,Dependency (PackageName "bytestring")       (ThisVersion (Version  [0,9,1,5] []))
---  ,Dependency (PackageName "Cabal")            (ThisVersion (Version  [1,8,0,2] []))
---  ,Dependency (PackageName "containers")       (ThisVersion (Version  [0,3,0,0] []))
---  ,Dependency (PackageName "directory")        (ThisVersion (Version  [1,0,1,0] []))
---  ,Dependency (PackageName "extensible-exceptions")         (AnyVersion)
---  ,Dependency (PackageName "filepath")         (ThisVersion (Version  [1,1,0,3] []))
---  ,Dependency (PackageName "haskell98")        (ThisVersion (Version  [1,0,1,1] []))
---  ,Dependency (PackageName "hpc")              (ThisVersion (Version  [0,5,0,4] []))
---  ,Dependency (PackageName "old-locale")       (ThisVersion (Version  [1,0,0,2] []))
---  ,Dependency (PackageName "old-time")         (ThisVersion (Version  [1,0,0,1] []))
---  ,Dependency (PackageName "pretty")           (ThisVersion (Version  [1,0,1,1] []))
---  ,Dependency (PackageName "process")          (ThisVersion (Version  [1,0,1,2] []))
---  ,Dependency (PackageName "random")           (ThisVersion (Version  [1,0,0,2] []))
---  ,Dependency (PackageName "syb")              (ThisVersion (Version  [0,1,0,2] []))
---  ,Dependency (PackageName "template-haskell") (ThisVersion (Version  [2,4,0,0] []))
---  ,Dependency (PackageName "time")             (ThisVersion (Version  [1,1,4] []))
---  ,Dependency (PackageName "unix")             (ThisVersion (Version  [2,4,0,0] []))
---  utf8-string
-
-
--- Removed in 6.12.x
---  ,Dependency (PackageName "html")             (ThisVersion (Version  [1,0,1,2] []))
---  ,Dependency (PackageName "integer")          (ThisVersion (Version  [0,1,0,0] []))
---  ,Dependency (PackageName "QuickCheck")       (ThisVersion (Version  [1,2,0,0] []))
---  ,Dependency (PackageName "haskell-src")      (ThisVersion (Version  [1,0,1,3] []))
---  ,Dependency (PackageName "parsec")           (ThisVersion (Version  [2,1,0,0] []))
---  ,Dependency (PackageName "packedstring")     (ThisVersion (Version  [0,1,0,1] []))
---  ,Dependency (PackageName "parallel")         (ThisVersion (Version  [1,1,0,0] []))
---  ,Dependency (PackageName "network")          (ThisVersion (Version  [2,2,0,1] []))
---  ,Dependency (PackageName "mtl")              (ThisVersion (Version  [1,1,0,2] []))
---  ,Dependency (PackageName "stm")              (ThisVersion (Version  [2,1,1,2] []))
---  ,Dependency (PackageName "HUnit")            (ThisVersion (Version  [1,2,0,3] []))
---  ,Dependency (PackageName "xhtml")            (ThisVersion (Version  [3000,2,0,1] []))
---  ,Dependency (PackageName "regex-base")       (ThisVersion (Version  [0,72,0,2] []))
---  ,Dependency (PackageName "regex-compat")     (ThisVersion (Version  [0,71,0,1] []))
---  ,Dependency (PackageName "regex-posix")      (ThisVersion (Version  [0,72,0,2] []))
+                                    ->     removeCoreFrom xs systemContext
 
--- Removed in 6.10.x
---  ,Dependency (PackageName "editline")         (AnyVersion)
---   Dependency (PackageName "ALUT")             (ThisVersion (Version  [2,1,0,0] []))
---  ,Dependency (PackageName "cgi")              (ThisVersion (Version  [3001,1,5,1] []))
---  ,Dependency (PackageName "fgl")              (ThisVersion (Version  [5,4,1,1] [])) -- gone
---  ,Dependency (PackageName "GLUT")             (ThisVersion (Version  [2,1,1,1] []))
---  ,Dependency (PackageName "OpenAL")           (ThisVersion (Version  [1,3,1,1] [])) -- gone
---  ,Dependency (PackageName "readline")         (ThisVersion (Version  [1,0,1,0] []))
+    Just (Dependency _ corevr)
+        | isAnyVersion corevr       ->     removeCoreFrom xs systemContext
+        | isJust isspef && (withinRange (fromJust isspef) vr)
+                                    ->     removeCoreFrom xs systemContext
+       where isspef = isSpecificVersion corevr
 
-    ]
+    _                               -> x : removeCoreFrom xs systemContext
 
 ------------------------------------------------------------------------------------
 
 --
--- | Translate a generic cabal file into a PGKBUILD
+-- | Translate a generic cabal file into a PGKBUILD (using default
+--   values for pkgname and pkgrel).
 --
-cabal2pkg :: PackageDescription -> (PkgBuild, Maybe String)
-cabal2pkg cabal
+cabal2pkg :: PackageDescription -> SystemProvides -> (AnnotatedPkgBuild, Maybe String)
+cabal2pkg cabal systemContext = cabal2pkg' cabal archName 1 systemContext
+  where
+    archName  = map toLower (if isLibrary then "haskell-" ++ display name else display name)
+    name      = pkgName (package cabal)
+    isLibrary = isJust (library cabal) && map toLower (display name) `notElem` shouldNotBeLibraries
 
+--
+-- | Translate a generic cabal file into a PGKBUILD, using the specified
+--   ArchLinux package name and package release.
+--
+cabal2pkg' :: PackageDescription -> String -> Int -> SystemProvides -> (AnnotatedPkgBuild, Maybe String)
+cabal2pkg' cabal archName release systemContext
+
 -- TODO decide if it's a library or an executable,
 -- handle multipackages
 -- extract C dependencies
 
 -- = trace (show cabal) $
-  =
-  (emptyPkgBuild
-    { arch_pkgname = archName
+  = ( emptyPkg {
+      pkgHeader = []
+    , hkgName = display name
+    , pkgBody = stub {
+      arch_pkgname = archName
     , arch_pkgver  = vers
-    , arch_url     = "http://hackage.haskell.org/package/"++display name
- --       else homepage cabal
+    , arch_pkgrel  = release
     , arch_pkgdesc = case synopsis cabal of
                           [] -> take 80 (description cabal)
                           s  -> s
@@ -183,87 +116,45 @@
                 x@GPL {} -> x
                 x@LGPL {} -> x
                 l    -> UnknownLicense ("custom:"++ show l)
-
-    -- All Hackage packages depend on GHC at build time
-    -- All Haskell libraries are prefixed with "haskell-"
-    , arch_makedepends = if not hasLibrary
-            then my_makedepends
-            else ArchList [] -- makedepends should not duplicate depends
-
-    , arch_depends =
-        (if not (isLibrary)
-            then
-                ArchList [ArchDep (Dependency (PackageName "gmp") AnyVersion)]
-                                `mappend`
-                                anyClibraries
-            else ArchList [])
-        `mappend`
-            -- libraries have 'register-time' dependencies on
-            -- their dependent Haskell libraries.
-            --
-           (if hasLibrary then my_makedepends
-                          else ArchList [])
-
-    -- need the dependencies of all flags that are on by default, for all libraries and executables
-
-    -- Hackage programs only need their own source to build
-    , arch_source  = ArchList . return $
-          "http://hackage.haskell.org/packages/archive/"
-       ++ (display name </> display vers </> display name <-> display vers <.> "tar.gz")
-
-    , arch_build =
-        [ "cd ${srcdir}/" </> display name <-> display vers
-        , "runhaskell Setup configure --prefix=/usr --docdir=/usr/share/doc/${pkgname}"
-        , "runhaskell Setup build"
-        ] ++
-
-    -- Only needed for libraries:
-        (if hasLibrary
-           then
-            [ "runhaskell Setup haddock"
-            , "runhaskell Setup register   --gen-script"
-            , "runhaskell Setup unregister --gen-script"
-            ]
-           else [])
-
-    , arch_package =
-        [ "cd ${srcdir}/" </> display name <-> display vers ] ++
-        -- Only needed for libraries:
-        (if hasLibrary
-           then
-            [ "install -D -m744 register.sh   ${pkgdir}/usr/share/haskell/${pkgname}/register.sh"
-            , "install    -m744 unregister.sh ${pkgdir}/usr/share/haskell/${pkgname}/unregister.sh"
-            , "install -d -m755 ${pkgdir}/usr/share/doc/ghc/html/libraries"
-            , "ln -s /usr/share/doc/${pkgname}/html ${pkgdir}/usr/share/doc/ghc/html/libraries/" ++ (display name)
-            ]
-           else [])
-         ++
-         ["runhaskell Setup copy --destdir=${pkgdir}"]
-         ++
+    , arch_package = (arch_package stub) ++
          (if not (null (licenseFile cabal)) && (case license cabal of GPL {} -> False; LGPL {} -> False; _ -> True)
           then
               [ "install -D -m644 " ++ licenseFile cabal ++ " ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
               , "rm -f ${pkgdir}/usr/share/doc/${pkgname}/LICENSE"
               ]
-          else [])
-
-    -- if its a library:
-    , arch_install = if hasLibrary then Just $ install_hook_name archName
-                                   else Nothing
-
+          else []) }
     }, if hasLibrary
           then Just (install_hook archName)
           else Nothing
     )
 
   where
-    archName = map toLower (if isLibrary then "haskell-" ++ display name else display name)
+    stub = if hasLibrary
+               then (stubPackageLibrary $ display name) {
+                 arch_depends = (
+                   if not (isLibrary)
+                   then ArchList [ArchDep (Dependency (PackageName "gmp") anyVersion)]
+                        `mappend` anyClibraries
+            -- libraries have 'register-time' dependencies on
+            -- their dependent Haskell libraries.
+            --
+                   else ArchList []) `mappend` my_makedepends
+                 }
+               else (stubPackageProgram $ display name) {
+                 -- isLibrary = False automatically
+                 arch_makedepends = my_makedepends
+               , arch_depends = ArchList [ArchDep (Dependency (PackageName "gmp") anyVersion)]
+                                `mappend` anyClibraries
+               }
+
     name     = pkgName (package cabal)
     vers     = pkgVersion (package cabal)
 
     -- build time dependencies
     my_makedepends =
-     (arch_makedepends emptyPkgBuild)
+      -- everything depends on ghc and Cabal 1.4.x
+     ArchList
+        [(ArchDep (Dependency (PackageName "ghc") anyVersion))]
         `mappend`
      -- Haskell libraries
      -- TODO: use a real package spec to compute these names
@@ -280,7 +171,7 @@
                           , d@(Dependency n _) <- buildTools b
                           , n /= PackageName "hsc2hs"
                           , let d' | n `elem` gtkTools
-                                        = Dependency (PackageName "gtk2hs-buildtools") AnyVersion
+                                        = Dependency (PackageName "gtk2hs-buildtools") anyVersion
                                    | otherwise        = d
                           ]
 
@@ -295,12 +186,64 @@
     anyClibraries | null libs = ArchList []
                   | otherwise = ArchList libs
        where
-         libs = [ ArchDep (Dependency (PackageName s) AnyVersion) | s <- nub (findCLibs cabal) ]
+         libs = [ ArchDep (Dependency (PackageName s) anyVersion) | s <- nub (findCLibs cabal systemContext) ]
 
 (<->) :: String -> String -> String
 x <-> y = x ++ "-" ++ y
 
 --
+-- | A PKGBUILD skeleton for Haskell libraries (hasLibrary = True)
+--
+stubPackageLibrary :: String -> PkgBuild
+stubPackageLibrary _ = emptyPkgBuild {
+      arch_url     = "http://hackage.haskell.org/package/${_hkgname}"
+    -- All Hackage packages depend on GHC at build time
+    -- All Haskell libraries are prefixed with "haskell-"
+    , arch_makedepends = ArchList [] -- makedepends should not duplicate depends
+    -- Hackage programs only need their own source to build
+    , arch_source  = ArchList . return $
+          "http://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz"
+    , arch_build =
+        [ "cd ${srcdir}/${_hkgname}-${pkgver}"
+        , "runhaskell Setup configure --prefix=/usr --docdir=/usr/share/doc/${pkgname} -O --enable-split-objs"
+        , "runhaskell Setup build"
+        , "runhaskell Setup haddock"
+        , "runhaskell Setup register   --gen-script"
+        , "runhaskell Setup unregister --gen-script"
+        , "sed -i -r -e \"s|ghc-pkg.*unregister[^ ]* |&'--force' |\" unregister.sh"
+        ]
+    , arch_package =
+        [ "cd ${srcdir}/${_hkgname}-${pkgver}"
+        , "install -D -m744 register.sh   ${pkgdir}/usr/share/haskell/${pkgname}/register.sh"
+        , "install    -m744 unregister.sh ${pkgdir}/usr/share/haskell/${pkgname}/unregister.sh"
+        , "install -d -m755 ${pkgdir}/usr/share/doc/ghc/html/libraries"
+        , "ln -s /usr/share/doc/${pkgname}/html ${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}"
+        ,"runhaskell Setup copy --destdir=${pkgdir}"]
+    -- if its a library:
+    , arch_install = Just "${pkgname}.install"
+    }
+
+--
+-- | A PKGBUILD skeleton for Haskell programs (hasLibrary = False)
+--
+stubPackageProgram :: String -> PkgBuild
+stubPackageProgram _ = emptyPkgBuild {
+      arch_url     = "http://hackage.haskell.org/package/${_hkgname}"
+    -- Hackage programs only need their own source to build
+    , arch_source  = ArchList . return $
+          "http://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz"
+    , arch_build =
+        [ "cd ${srcdir}/${_hkgname}-${pkgver}"
+        , "runhaskell Setup configure --prefix=/usr --docdir=/usr/share/doc/${pkgname} -O"
+        , "runhaskell Setup build"
+        ]
+    , arch_package =
+        [ "cd ${srcdir}/${_hkgname}-${pkgver}"
+        , "runhaskell Setup copy --destdir=${pkgdir}"]
+    , arch_install = Nothing
+    }
+
+--
 -- post install, and pre-remove hooks to run, to sync up ghc-pkg
 --
 install_hook_name :: String -> String
@@ -325,13 +268,10 @@
     , "}"
     , "post_remove() {"
     , "  (cd /usr/share/doc/ghc/html/libraries; ./gen_contents_index)"
-    , "}"
-    , "op=$1"
-    , "shift"
-    , "$op $*" ]
+    , "}" ]
 
-findCLibs :: PackageDescription -> [String]
-findCLibs (PackageDescription { library = lib, executables = exe }) =
+findCLibs :: PackageDescription -> SystemProvides -> [String]
+findCLibs (PackageDescription { library = lib, executables = exe }) sysContext =
     -- warn for packages not in list.
     filter (not . null) $ map (canonicalise . map toLower) (some ++ rest)
   where
@@ -345,110 +285,10 @@
                                         else n)
                                         (pkgconfigDepends (libBuildInfo l))
 
-    canonicalise k = case M.lookup k translationTable of
+    canonicalise k = case M.lookup k (translationTable sysContext) of
         Nothing -> trace ("WARNING: this library depends on a C library we do not know the pacman name for (" ++ map toLower k ++ ") . Check the C library names in the generated PKGBUILD File") $ map toLower k
         Just s  -> s
 
-    -- known pacman packages for C libraries we use:
-    translationTable = M.fromList
-        [("Imlib2",     "imlib2")
-        ,("SDL",        "sdl")
-        ,("adns",       "adns")
-        ,("alut",       "freealut")
-        ,("bz2",        "bzip2")
-        ,("cblas",      "blas")
-        ,("crack",      "cracklib")
-        ,("crypto",     "openssl")
-        ,("curl",       "curl")
-        ,("freetype",   "freetype2")
-        ,("glib",       "glib2")
-        ,("wmflite",    "libwmf")
-        ,("il",    "devil")
-
-        ,("jpeg",       "libjpeg")
-        ,("ldap",       "libldap")
-        ,("pcap",       "libpcap")
-        ,("png",        "libpng")
-        ,("x11",        "libx11")
-        ,("xrandr",     "libxrandr")
-        ,("xml2",       "libxml2")
-        ,("exif",       "libexif")
-        ,("tiff",       "libtiff")
-        ,("sndfile",    "libsndfile")
-        ,("gcrypt",     "libgcrypt")
-        ,("fftw3",      "fftw")
-
-        ,("pq",         "postgresql")
-        ,("ssl",        "openssl")
-        ,("wx",         "wxgtk")
-        ,("xenctrl",    "xen")
-        ,("odbc",       "unixodbc")
-        ,("z",          "zlib")
-        ,("curses",     "ncurses")
-        ,("xslt",       "libxslt")
-        ,("csound64",   "csound5")
-        ,("uuid",       "e2fsprogs")
-        ,("doublefann", "fann")
-        ,("ev",         "libev")
-
-        ,("pthread",    "")
-        ,("m",          "")
-        ,("gl",         "")
-        ,("glu",        "")
-        ,("db_cxx",     "")
-        ,("db_cxx",     "")
-        ,("xdamage",    "")
-
-        ,("icui18n",          "icu")
-        ,("icuuc",          "icu")
-        ,("icudata",          "icu")
-
-        ,("netsnmp",        "net-snmp")
-        ,("asound",        "alsa-lib")
-        ,("ffi",        "libffi")
-        ,("ogg",        "libogg")
-        ,("theora",        "libtheora")
-        ,("mtp",        "libmtp")
-        ,("zmq",        "zeromq")
-        ,("cv",        "opencv")
-        ,("highgui",        "opencv")
-        ,("xss",        "libxss")
-        ,("idn",        "libidn")
-        ,("libgsasl",        "gsasl")
-        ,("event",        "libevent")
-        ,("gcc_s",        "gcc-libs")
-
-
-        -- subsumed into glib
-
-        ,("gobject",                "")
-        ,("gmodule",                "glib2")
-        ,("gio",                    "")
-        ,("gthread",                "")
-        ,("gnome-vfs-module",       "")
-        ,("gstreamer-audio",        "")
-        ,("gstreamer-base",         "")
-        ,("gstreamer-controller",   "")
-        ,("gstreamer-dataprotocol", "")
-        ,("gstreamer-net",          "")
-        ,("ogremain",          "")
-        ,("gnutls-extra",      "gnutls")
-        ,("pangocairo",        "pango")
-
-        ,("webkit",      "libwebkit")
-        ,("gtk+",        "gtk")
-        ,("gdk",         "gtk")
-        ,("gdk-x11-2.0", "gtk2")
-        ,("gtk-x11-2.0", "gtk2")
-        ,("xine",        "xine-lib")
-        ,("ncursesw",    "ncurses")
-        ,("panel",       "ncurses")
-
-        ,("gstreamer",   "gstreamer0.10")
-        ,("gstreamer-plugins-base", "gstreamer0.10-base")
-        ]
-        -- atlas
-
 shouldNotBeLibraries :: [String]
 shouldNotBeLibraries =
     ["xmonad"
@@ -504,46 +344,12 @@
         unDep (Dependency n _) = n
 -}
 
----------------------------------------------------------------------------
-
-{-
-# Contributor: Arch Haskell Team <arch-haskell@haskell.org>
-# Package generated by cabal2arch 0.6.1
-pkgname=haskell-pcre-light
-pkgrel=2
-pkgver=0.3.1
-pkgdesc="A small, efficient and portable regex library for Perl 5 compatible regular expressions"
-url="http://hackage.haskell.org/package/pcre-light"
-license=('custom:BSD3')
-arch=('i686' 'x86_64')
-makedepends=()
-depends=('ghc' 'haskell-cabal' 'pcre')
-options=('strip')
-source=(http://hackage.haskell.org/packages/archive/pcre-light/0.3.1/pcre-light-0.3.1.tar.gz)
-install=haskell-pcre-light.install
-md5sums=('14d8d6e2fd200c385b1d63c888794014')
-build() {
-    cd ${srcdir}/pcre-light-0.3.1
-    runhaskell Setup configure --prefix=/usr --docdir=/usr/share/doc/${pkgname} || return 1
-    runhaskell Setup build                   || return 1
-    runhaskell Setup haddock || return 1
-    runhaskell Setup register   --gen-script || return 1
-    runhaskell Setup unregister --gen-script || return 1
-    install -D -m744 register.sh   ${pkgdir}/usr/share/haskell/$pkgname/register.sh
-    install    -m744 unregister.sh ${pkgdir}/usr/share/haskell/$pkgname/unregister.sh
-    install -d -m755 $pkgdir/usr/share/doc/ghc/libraries
-    ln -s /usr/share/doc/${pkgname}/html ${pkgdir}/usr/share/doc/ghc/libraries/pcre-light
-    runhaskell Setup copy --destdir=${pkgdir} || return 1
-    install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE || return 1
-    rm -f ${pkgdir}/usr/share/doc/${pkgname}/LICENSE
-}
-    -}
-
 ------------------------------------------------------------------------
 -- Checker
 --
 
-type Warnings = String
+-- 2010-10-29: This code is unused. Do we still need it?
+-- type Warnings = String
 
 -- Hard code the cabal2arch version
 recentCabal2ArchVersion :: Maybe Version
diff --git a/Distribution/ArchLinux/HackageTranslation.hs b/Distribution/ArchLinux/HackageTranslation.hs
--- a/Distribution/ArchLinux/HackageTranslation.hs
+++ b/Distribution/ArchLinux/HackageTranslation.hs
@@ -7,22 +7,21 @@
 --
 
 module Distribution.ArchLinux.HackageTranslation where
+import Distribution.ArchLinux.CabalTranslation
+import Distribution.ArchLinux.SystemProvides
 -- Cabal modules
 import Distribution.Package
+import Distribution.Version
 import Distribution.PackageDescription
 import Distribution.PackageDescription.Parse
 -- Standard types
 import Distribution.Text
-import Data.Char
---import Data.List
 import qualified Data.Map as M
 import qualified Data.Set as Set
 import Data.Maybe
 -- Read tarballs
 import qualified Codec.Archive.Tar as Tar
 import qualified Data.ByteString.Lazy.Char8 as Bytes
--- Debugging
-import Debug.Trace
 
 --
 -- | Reads a tarball and converts it to a list of PackageDescription's
@@ -33,15 +32,16 @@
         insertThis file list = case getCabalFromEntry file of
           Nothing -> list
           Just pkg -> pkg:list
-        
+
 getCabalFromEntry :: Tar.Entry -> Maybe GenericPackageDescription
 getCabalFromEntry file = case Tar.entryContent file of
   Tar.NormalFile contents _ -> parse2maybe $ parsePackageDescription $ Bytes.unpack contents
-  otherwise -> Nothing
+  _ -> Nothing
 
+parse2maybe :: ParseResult a -> Maybe a
 parse2maybe a = case a of
       ParseOk _ pkg -> Just pkg
-      otherwise -> Nothing
+      _ -> Nothing
 
 --
 -- | Reads a tarball and get cabal files according to a list
@@ -55,16 +55,37 @@
 --
 parsePackageIdentifier :: String -> Maybe PackageIdentifier
 parsePackageIdentifier s = case words s of
-  name:version:_ -> case ver of
-        Nothing -> void
-        Just v -> Just $ PackageIdentifier { pkgName = PackageName name ,
-                                       pkgVersion = v }
-      where ver = simpleParse version
-  otherwise -> void
+  []             -> void
+  "#":_          -> void
+  name:version:_ -> case simpleParse version of
+        Nothing -> err
+        Just v -> Just $ PackageIdentifier { pkgName = PackageName name, pkgVersion = v }
+  _ -> err
  where
-  void = Debug.Trace.trace("Malformed package identifier " ++ s) Nothing
+  void = Nothing
+  err = error ("Malformed package identifier " ++ show s)
 
 getSpecifiedCabals :: [PackageIdentifier] -> [GenericPackageDescription] -> [GenericPackageDescription]
 getSpecifiedCabals list packages = filter wasSpecified packages
   where set = Set.fromList list
         wasSpecified p = Set.member (packageId p) set
+
+--
+-- | Check for inconsistencies in version requirements
+-- returns a list of pairs (package, conflicting dep).
+--
+getVersionConflicts :: [GenericPackageDescription] -> SystemProvides -> [(PackageDescription, Dependency)]
+getVersionConflicts packages sysProvides = concat $ map conflicts cabals
+  where cabals = mapMaybe (\p -> preprocessCabal p sysProvides) packages
+        versions = M.fromList $ map (\p -> (pkgName $ packageId p, pkgVersion $ packageId p)) cabals
+        issatisfied (Dependency pkg range) = case M.lookup pkg versions of
+                                                 Nothing -> True
+                                                 Just v -> v `withinRange` range
+        conflicts p = map (\d -> (p,d)) $ filter (not . issatisfied) (buildDepends p)
+
+--
+-- | Returns the latest versions
+--
+getLatestVersions :: [GenericPackageDescription] -> M.Map PackageName Version
+getLatestVersions packages = M.fromListWith max versions
+  where versions = map (\p -> (pkgName $ packageId p, pkgVersion $ packageId p)) packages
diff --git a/Distribution/ArchLinux/PkgBuild.hs b/Distribution/ArchLinux/PkgBuild.hs
--- a/Distribution/ArchLinux/PkgBuild.hs
+++ b/Distribution/ArchLinux/PkgBuild.hs
@@ -12,6 +12,7 @@
          PkgBuild(..),
          emptyPkgBuild,
          AnnotatedPkgBuild(..),
+         emptyPkg,
          ArchList(..),
          ArchDep(..),
          pkgnameFromArchDep,
@@ -28,13 +29,11 @@
 import Text.PrettyPrint
 import Data.List
 import Data.Monoid
-import Data.Maybe
 import Debug.Trace
 
 import Control.Monad
 import Control.Monad.Instances
 import Data.Char
-import Numeric
 
 
 --
@@ -155,16 +154,8 @@
     , arch_arch        = ArchList [Arch_X86, Arch_X86_64]
     , arch_url         = homepage e
     , arch_license     = ArchList [license e]
-
-    -- everything depends on ghc and Cabal 1.4.x
-    , arch_makedepends = ArchList
-        [(ArchDep (Dependency (PackageName "ghc")    AnyVersion))
-        ,(ArchDep (Dependency (PackageName "haskell-cabal") AnyVersion))
---        ,(ArchDep (Dependency "haskell-cabal" (LaterVersion (Version  [1,4,0,0] []))))
-        ]
-
-        -- makedepends=('ghc>=6.6') ?
     , arch_depends     = ArchList []
+    , arch_makedepends = ArchList []
     , arch_source      = ArchList []
     , arch_md5sum      = ArchList []
         -- sha1sums=('a08670e4c749850714205f425cb460ed5a0a56b2')
@@ -186,39 +177,31 @@
   disp Strip = text "strip"
   parse = undefined
 
--- the PKGBUILD version spec is less expressive than cabal, we can't
--- really handle unions or intersections well yet.
+-- the PKGBUILD version spec is less expressive than cabal, we can
+-- only handle simple intervals like (0,v) or (v,+infty)
+mydisp :: VersionInterval -> Doc
+mydisp (LowerBound v InclusiveBound, NoUpperBound) = if v==zeroVersion then empty else text ">=" <> disp v
+mydisp (LowerBound v ExclusiveBound, NoUpperBound) = text ">" <> disp v
+mydisp (_, UpperBound v boundType) = text symbol <> disp v
+  where symbol = if boundType == InclusiveBound then "<=" else "<"
 
+zeroVersion :: Version
+zeroVersion = Version [0] []
+
 instance Text ArchDep where
   disp (ArchDep (Dependency name ver)) =
-    text (display name) <> mydisp ver
+    disp name <> mydisp2 intervals
    where
+      intervals = asVersionIntervals ver
+      strName = display name
      --  >= (greater than or equal to), <= (less than or
      --  equal to), = (equal to), > (greater than), or <
-      mydisp AnyVersion           = empty
-
-      mydisp (ThisVersion    v)   = text "=" <> disp v
-      mydisp (LaterVersion   v)   = char '>' <> disp v
-      mydisp (EarlierVersion v)   = char '<' <> disp v
-
-      mydisp (UnionVersionRanges (ThisVersion  v1) (LaterVersion v2))
-        | v1 == v2 = text ">=" <> disp v1
-      mydisp (UnionVersionRanges (LaterVersion v2) (ThisVersion  v1))
-        | v1 == v2 = text ">=" <> disp v1
-      mydisp (UnionVersionRanges (ThisVersion v1) (EarlierVersion v2))
-        | v1 == v2 = text "<=" <> disp v1
-      mydisp (UnionVersionRanges (EarlierVersion v2) (ThisVersion v1))
-        | v1 == v2 = text "<=" <> disp v1
-
-{-
-      mydisp (UnionVersionRanges r1 r2)
-        = disp r1 <+> text "||" <+> disp r2
-
-      mydisp (IntersectVersionRanges r1 r2)
-        = disp r1 <+> text "&&" <+> disp r2
--}
-
-      mydisp x = trace ("WARNING: Can't handle this version format yet: " ++ show x ++ "\ncheck the dependencies by hand.")$ empty
+      mydisp2 l | l == []      = trace ("WARNING: version requirement for " ++
+                                   strName ++ " is logically impossible.") empty
+                | tail l == [] = mydisp $ head l
+                -- If there are multiple possible ranges, take only latest versions
+                | otherwise    = trace ("WARNING: multiple version ranges specified for " ++
+                                        strName ++ " using only the last one.") $ mydisp $ last l
 
   parse = undefined
 
@@ -226,7 +209,7 @@
 -- | Extract just the package name from ArchDep
 --
 pkgnameFromArchDep :: ArchDep -> String
-pkgnameFromArchDep (ArchDep (Dependency (PackageName p) v)) = p
+pkgnameFromArchDep (ArchDep (Dependency (PackageName p) _)) = p
 
 --
 -- | Valid linux platforms
@@ -271,6 +254,7 @@
      AnnotatedPkgBuild
         {pkgBuiltWith :: Maybe Version   -- ^ version of cabal2arch used, if any
         ,pkgHeader    :: String          -- ^ header strings
+        ,hkgName      :: String          -- ^ package name on Hackage
         ,pkgBody      :: PkgBuild }      -- ^ contents of pkgbuild file
     deriving (Eq, Show)
 
@@ -279,6 +263,7 @@
 emptyPkg = AnnotatedPkgBuild
     { pkgBuiltWith = Nothing
     , pkgHeader    = []
+    , hkgName      = []
     , pkgBody      = emptyPkgBuild { arch_options = ArchList []
                                 , arch_makedepends = ArchList []
                                 }
@@ -318,12 +303,14 @@
 setInput   :: String -> GetPKG ()
 setInput s  = GetPKG (\_ -> Right ((),s))
 
-(<$>) :: Functor f => (a -> b) -> f a -> f b
-x <$> y = fmap x y
+-- 2010-10-29: This code is unused. Do we still need it?
+-- (<$>) :: Functor f => (a -> b) -> f a -> f b
+-- x <$> y = fmap x y
 
 ------------------------------------------------------------------------
 
 -- read until end of line
+line :: String -> GetPKG String
 line s = case break (== '\n') s of
     (h , _ : rest) -> do
         setInput rest
@@ -336,7 +323,7 @@
   cs <- getInput
 
   case cs of
-    _ | "# Contributor"       `isPrefixOf` cs -> do
+    _ | "# Maintainer"       `isPrefixOf` cs -> do
             h <- line cs
             readPackage st { pkgHeader = h }
 
@@ -348,6 +335,11 @@
                     . reverse $ h
             readPackage st { pkgBuiltWith = v }
 
+      | "_hkgname="  `isPrefixOf` cs -> do
+            h <- line cs
+            let s = drop 9 h
+            readPackage st { hkgName = s }
+
       | "pkgname="  `isPrefixOf` cs -> do
             h <- line cs
             let s = drop 8 h
@@ -440,7 +432,7 @@
 -- TODO : read version spec
 str2archdep :: String -> ArchDep
 str2archdep s = case v of
-    Nothing -> ArchDep (Dependency (PackageName name) AnyVersion)
+    Nothing -> ArchDep (Dependency (PackageName name) anyVersion)
     Just w -> ArchDep (Dependency (PackageName name) w)
   where name = takeWhile (\x -> x `notElem` "<=>") s
         vspec = dropWhile (\x -> x `notElem` "<=>") s
@@ -463,10 +455,10 @@
 rawpkg2doc pkg = vcat
  [ text "pkgname"
     <=> text (arch_pkgname pkg)
- , text "pkgrel"
-    <=> int (arch_pkgrel pkg)
  , text "pkgver"
     <=> disp (arch_pkgver pkg)
+ , text "pkgrel"
+    <=> int (arch_pkgrel pkg)
  , text "pkgdesc"
     <=> text (show (arch_pkgdesc pkg))
  , text "url"
@@ -508,19 +500,19 @@
 instance Text AnnotatedPkgBuild where
   disp AnnotatedPkgBuild {
     pkgBuiltWith = ver,
-    pkgHeader = head,
+    pkgHeader = header,
+    hkgName = hkg,
     pkgBody = pkg
-  } = case ver of
-      Nothing -> empty
-      Just v -> text "# Package generated by cabal2arch" <+> (disp v)
-   $$ text head $$ disp pkg
+  } = vcat [ if null header then empty else text header
+           , text "_hkgname" <=> text hkg
+           , disp pkg ]
   parse = undefined
 
 --
--- Display a full PKGBUILD with contributor name
+-- Display a full PKGBUILD with Maintainer name.
 --
 pkg2doc :: String -> AnnotatedPkgBuild -> Doc
-pkg2doc email pkg = text "# Contributor:" <+> text email $$ disp pkg
+pkg2doc email pkg = text "# Maintainer:" <+> text email $$ disp pkg
 
 --
 -- | A data type to represent a full ArchLinux package
diff --git a/Distribution/ArchLinux/SrcRepo.hs b/Distribution/ArchLinux/SrcRepo.hs
--- a/Distribution/ArchLinux/SrcRepo.hs
+++ b/Distribution/ArchLinux/SrcRepo.hs
@@ -12,9 +12,7 @@
 import Distribution.ArchLinux.PkgBuild as PkgBuild
 
 import Distribution.Package
-import Distribution.Text
 import Distribution.Version
-import Text.PrettyPrint
 
 import Data.List as L
 import Data.Map as M
@@ -32,20 +30,17 @@
         -- The path to the repository
     , repo_contents :: M.Map String PkgBuild
     }
+    deriving (Show)
 
 --
 -- | Reads a directory into a package
 --
-getPkgFromDir :: FilePath -> IO (Maybe PkgBuild)
+getPkgFromDir :: FilePath -> IO PkgBuild
 getPkgFromDir p = do
-  valid <- Dir.doesFileExist (p </> "PKGBUILD")
-  if valid
-    then do
-      pkg <- readFile (p </> "PKGBUILD")
-      case decodePackage pkg of
-        Left _ -> return Nothing
-        Right annot_pkg -> return $ Just (pkgBody annot_pkg)
-    else return Nothing
+  pkg <- readFile (p </> "PKGBUILD")
+  case decodePackage pkg of
+    Left e -> fail ("cannot parse " ++ show p ++ ": " ++ show e)
+    Right annot_pkg -> return (pkgBody annot_pkg)
 
 --
 -- | Reads a specified path into a SrcRepo structure
@@ -55,18 +50,18 @@
   valid <- Dir.doesDirectoryExist path
   if valid
     then do
-      subthings <- Dir.getDirectoryContents path
+      subthings' <- Dir.getDirectoryContents path
+      let subthings = [ path </> x | x <- subthings', head x /= '.' ]
       -- Read PkgBuilds
       contents <- foldM insertpkg M.empty subthings
       let result = SrcRepo { repo_path = path , repo_contents = contents }
       return (Just result)
     else return Nothing
 
+insertpkg :: Map String PkgBuild -> FilePath -> IO (Map String PkgBuild)
 insertpkg m dir = do
   pkg <- getPkgFromDir dir
-  case pkg of
-    Nothing -> return m
-    Just p -> return $ M.insert (takeBaseName dir) p m
+  return $ M.insert (takeBaseName dir) pkg m
 
 ---------------------------------------------------------------------------
 --
@@ -104,7 +99,7 @@
   (name `notMember` m) || (name `elem` archProvidedPkgs)
 
 trueDepends :: PkgBuild -> SrcRepo -> [String]
-trueDepends p repo = L.filter (\p -> not $ isExternalDep p repo) (strDepends p)
+trueDepends p repo = L.filter (\p' -> not $ isExternalDep p' repo) (strDepends p)
 
 ------------------------------------------------------------
 
@@ -133,18 +128,18 @@
                     recDeps = L.map (repo_contents . (\d -> getDependencyRepo d repo)) trueDeps
 
 --
--- | Output reverse dependencies of a package in topological order
+-- | Output reverse dependencies of a list of packages in topological order
 --
-getReverseDependencies :: String -> SrcRepo -> [String]
+getReverseDependencies :: [String] -> SrcRepo -> [String]
 getReverseDependencies pkg repo = dumpContentsTopo $ getReverseDependencyRepo pkg repo
 
 --
--- | Extract reverse dependencies of a package
+-- | Extract reverse dependencies of a list of packages
 --
-getReverseDependencyRepo :: String -> SrcRepo -> SrcRepo
-getReverseDependencyRepo pkg repo = repo { repo_contents = revdeps }
+getReverseDependencyRepo :: [String] -> SrcRepo -> SrcRepo
+getReverseDependencyRepo pkgs repo = repo { repo_contents = revdeps }
   where revdeps = M.filterWithKey (isarevdep) (repo_contents repo)
-        isarevdep k _ = M.member pkg (repo_contents $ getDependencyRepo k repo)
+        isarevdep k _ = or $ L.map (\p -> M.member p (repo_contents $ getDependencyRepo k repo)) pkgs
 
 ----------------------------------------------------------------
 --
@@ -156,12 +151,12 @@
 isConflicting :: SrcRepo -> Bool
 isConflicting repo = and areConflicting
   where listOfPkgs = M.toList $ repo_contents repo
-        areConflicting = L.map (\(k,pkg) -> pkg `isConflictingWith` repo) listOfPkgs
+        areConflicting = L.map (\(_,pkg) -> pkg `isConflictingWith` repo) listOfPkgs
 
 listVersionConflicts :: SrcRepo -> [String]
 listVersionConflicts repo = L.map fst listConflicting
   where listOfPkgs = M.toList $ repo_contents repo
-        listConflicting = L.filter (\(k,pkg) -> pkg `isConflictingWith` repo) listOfPkgs
+        listConflicting = L.filter (\(_,pkg) -> pkg `isConflictingWith` repo) listOfPkgs
 
 --
 -- | Check package dependencies against the repo
diff --git a/Distribution/ArchLinux/SystemProvides.lhs b/Distribution/ArchLinux/SystemProvides.lhs
new file mode 100644
--- /dev/null
+++ b/Distribution/ArchLinux/SystemProvides.lhs
@@ -0,0 +1,70 @@
+Module    : Distribution.ArchLinux.SystemProvides
+Copyright : (c) Rémy Oudompheng 2010
+License   : BSD3
+
+Maintainer: Arch Haskell Team <arch-haskell@haskell.org>
+
+> module Distribution.ArchLinux.SystemProvides where
+
+Cabal modules
+
+> import Distribution.Package
+
+Standard types
+
+> import Distribution.Text
+> import qualified Data.Map as M
+> import Data.Maybe
+> import System.FilePath
+
+> import Paths_archlinux
+
+A big structure holding data about ArchLinux
+
+> data SystemProvides = SystemProvides
+>   { corePackages :: [Dependency]
+>      -- ^
+>      -- A list of Dependencies which are automatically satified
+>      -- when GHC is installed.
+>   , translationTable :: M.Map String String
+>      -- ^
+>      -- A hash-map where keys are library names and values are
+>      -- names of the corresponding ArchLinux package.
+>   }
+
+Get SystemProvides from package-installed files
+
+> getDefaultSystemProvides :: IO SystemProvides
+> getDefaultSystemProvides = do
+>   fnc <- getDataFileName $ "data" </> "ghc-provides.txt"
+>   fnt <- getDataFileName $ "data" </> "library-providers.txt"
+>   getSystemProvidesFromFiles fnc fnt
+
+> getSystemProvidesFromFiles :: FilePath -> FilePath -> IO SystemProvides
+> getSystemProvidesFromFiles filePkg fileTranslation = do
+>   fc <- readFile filePkg
+>   ft <- readFile fileTranslation
+>   return SystemProvides { corePackages = corePackagesFromFile fc
+>                         , translationTable = translationTableFromFile ft }
+
+Extract GHC-provided dependencies from a file
+
+> depstr2hs :: String -> Maybe Dependency
+> depstr2hs s | s == "" || head s == '#' = Nothing
+>             | otherwise = simpleParse s
+
+> corePackagesFromFile :: String -> [Dependency]
+> corePackagesFromFile srcfile1 = mapMaybe depstr2hs $ lines srcfile1
+
+Now we translate the "library-providers" file. Any line beginning with "# "
+or lines with something else than two words are discarded. Lines should have
+the form "libraryname packagename".
+
+> trstr2hs :: String -> Maybe (String, String)
+> trstr2hs s = case words s of
+>   "#":_ -> Nothing
+>   a:b:_ -> Just (a,b)
+>   _ -> Nothing
+
+> translationTableFromFile :: String -> M.Map String String
+> translationTableFromFile srcfile2 = M.fromList $ mapMaybe trstr2hs $ lines srcfile2
diff --git a/archlinux.cabal b/archlinux.cabal
--- a/archlinux.cabal
+++ b/archlinux.cabal
@@ -1,5 +1,5 @@
 name:           archlinux
-version:        0.3.4
+version:        0.3.5
 license:        BSD3
 license-file:   LICENSE
 author:         Don Stewart <dons@galois.com>
@@ -13,6 +13,7 @@
 build-type:     Simple
 stability:      stable
 cabal-version:  >= 1.8
+data-files:     data/*.txt
 
 source-repository head
   type:         git
@@ -33,6 +34,9 @@
         Distribution.ArchLinux.SrcRepo
         Distribution.ArchLinux.CabalTranslation
         Distribution.ArchLinux.HackageTranslation
+        Distribution.ArchLinux.SystemProvides
+    other-modules:
+        Paths_archlinux
 
 executable recdeps
     main-is: scripts/recdeps.hs
diff --git a/data/ghc-provides.txt b/data/ghc-provides.txt
new file mode 100644
--- /dev/null
+++ b/data/ghc-provides.txt
@@ -0,0 +1,77 @@
+##
+## Core packages and their versions. These come with
+## ghc, so we should be right.
+##
+## http://haskell.org/haskellwiki/Libraries_released_with_GHC
+##
+## And what Arch Linux thinks GHC provides:
+##
+## http://repos.archlinux.org/wsvn/packages/ghc/repos/extra-x86_64/PKGBUILD
+##
+## Note: we could just list these directly, and have yaourt solve them.
+##
+## NEW POLICY:
+##      We rely on all "provides" from the GHC library to be listed explicitly.
+##
+
+base==4.1.0.0
+dph-base
+dph-par
+dph-prim-interface
+dph-prim-par
+dph-prim-seq
+dph-seq
+ghc
+ghc-prim
+integer
+integer-gmp
+ghc-binary
+
+## Official Provides: http://repos.archlinux.org/wsvn/packages/ghc/repos/extra-x86_64/PKGBUILD
+#array==0.3.0.1
+#bytestring==0.9.1.7
+#cabal==1.8.0.6
+#containers==0.3.0.0
+#directory==1.0.1.1
+#extensible-exceptions==0.1.1.1
+#filepath==1.1.0.4
+#haskell98==1.0.1.1
+#hpc==0.5.0.5
+#old-locale==1.0.0.2
+#old-time==1.0.0.5
+#pretty==1.0.1.1
+#process==1.0.1.3
+#random==1.0.0.2
+#syb==0.1.0.2
+#template-haskell==2.4.0.1
+#time==1.1.4
+#unix==2.4.0.2
+#haddock==2.6.0
+## utf8-string
+#
+#
+## Removed in 6.12.x
+# html==1.0.1.2
+# integer==0.1.0.0
+# QuickCheck==1.2.0.0
+# haskell-src==1.0.1.3
+# parsec==2.1.0.0
+# packedstring==0.1.0.1
+# parallel==1.1.0.0
+# network==2.2.0.1
+# mtl==1.1.0.2
+# stm==2.1.1.2
+# HUnit==1.2.0.3
+# xhtml==3000.2.0.1
+# regex-base==0.72.0.2
+# regex-compat==0.71.0.1
+# regex-posix==0.72.0.2
+#
+## Removed in 6.10.x
+# editline
+# ALUT==2.1.0.0
+# cgi==3001.1.5.1
+# fgl==5.4.1.1 -- gone
+# GLUT==2.1.1.1
+# OpenAL==1.3.1.1 -- gone
+# readline==1.0.1.0
diff --git a/data/library-providers.txt b/data/library-providers.txt
new file mode 100644
--- /dev/null
+++ b/data/library-providers.txt
@@ -0,0 +1,109 @@
+# This file lists external library dependencies and the ArchLinux
+# packages providing them. For example, if the openssl package
+# provides libssl.so, there should be a line
+#
+# ssl openssl
+#
+
+Imlib2     imlib2
+SDL        sdl
+adns       adns
+alut       freealut
+bz2        bzip2
+cblas      blas
+crack      cracklib
+crypto     openssl
+curl       curl
+freetype   freetype2
+glib       glib2
+wmflite    libwmf
+il         devil
+
+jpeg       libjpeg
+ldap       libldap
+pcap       libpcap
+png        libpng
+x11        libx11
+xrandr     libxrandr
+xml2       libxml2
+exif       libexif
+tiff       libtiff
+sndfile    libsndfile
+gcrypt     libgcrypt
+gnutls     gnutls
+gnutls-extra      gnutls
+fftw3      fftw
+
+pq         postgresql
+ssl        openssl
+wx         wxgtk
+odbc       unixodbc
+z          zlib
+curses     ncurses
+xslt       libxslt
+uuid       e2fsprogs
+ev         libev
+pthread    glibc
+m          glibc
+gl         libgl
+glu        mesa
+glut       freeglut
+db_cxx     db
+sqlite3    sqlite3
+xdamage    libxdamage
+
+icui18n          icu
+icuuc            icu
+icudata          icu
+
+netsnmp        net-snmp
+asound         alsa-lib
+ffi            libffi
+ogg            libogg
+theora         libtheora
+mtp            libmtp
+cv             opencv
+highgui        opencv
+xss            libxss
+idn            libidn
+libgsasl       gsasl
+event          libevent
+gcc_s          gcc-libs
+stdc++         gcc-libs
+
+# subsumed into glib
+
+gobject                glib2
+gmodule                glib2
+gio                    glib2
+gthread                glib
+gnome-vfs-module
+gstreamer-audio        gstreamer0.10-base
+gstreamer-base         gstreamer0.10
+gstreamer-controller   gstreamer0.10
+gstreamer-dataprotocol gstreamer0.10
+gstreamer-net          gstreamer0.10
+ogremain
+
+webkit      libwebkit
+cairo       cairo
+pango       pango
+pangocairo  pango
+gtk+        gtk2
+gdk         gtk
+gdk-x11-2.0 gtk2
+gtk-x11-2.0 gtk2
+vte         vte
+xine        xine-lib
+ncurses     ncurses
+ncursesw    ncurses
+panel       ncurses
+
+gstreamer              gstreamer0.10
+gstreamer-plugins-base gstreamer0.10-base
+
+# Packages from AUR
+xenctrl    xen
+csound64   csound5
+doublefann fann
+zmq        zeromq
