cpkg 0.1.1.1 → 0.1.2.1
raw patch · 12 files changed
+103/−53 lines, 12 filesdep −composition-preludedep ~libarchive
Dependencies removed: composition-prelude
Dependency ranges changed: libarchive
Files
- CHANGELOG.md +8/−0
- README.md +5/−5
- app/Main.hs +8/−4
- cabal.project +2/−0
- cpkg.cabal +1/−2
- pkgs/pkg-set.dhall +42/−16
- src/CPkgPrelude.hs +0/−3
- src/Package/C.hs +1/−0
- src/Package/C/Build.hs +8/−6
- src/Package/C/Build/Tree.hs +9/−8
- src/Package/C/Db/Register.hs +18/−9
- src/Package/C/Db/Type.hs +1/−0
CHANGELOG.md view
@@ -1,5 +1,13 @@ # cpkg +## 0.1.2.1++ * Add `--global` flag++## 0.1.2.0++ * Export `Dep`+ ## 0.1.1.1 * Stream using `libarchive` lazily
README.md view
@@ -257,12 +257,12 @@ ------------------------------------------------------------------------------- Bash 3 43 35 3 5 Cabal 1 154 140 0 14- Cabal Project 1 2 2 0 0- Dhall 3 4541 4080 0 461- Haskell 31 1706 1394 29 283- Markdown 3 468 396 0 72+ Cabal Project 1 4 3 0 1+ Dhall 3 4551 4089 0 462+ Haskell 31 1707 1395 29 283+ Markdown 3 474 400 0 74 YAML 4 156 141 0 15 -------------------------------------------------------------------------------- Total 46 7070 6188 32 850+ Total 46 7089 6203 32 854 ------------------------------------------------------------------------------- ```
app/Main.hs view
@@ -5,7 +5,7 @@ import qualified Data.Text as T import qualified Data.Version as V import Options.Applicative hiding (auto)-import Package.C hiding (Command)+import Package.C hiding (Command, name) import qualified Paths_cpkg as P import System.Directory (doesDirectoryExist, removeDirectoryRecursive) @@ -18,7 +18,7 @@ | IncludePath { _pkgGet :: String } | LibPath { _pkgGet :: String } -data Command = Install { _pkgName :: String, _verbosity :: Verbosity, _target :: Maybe Platform, _static :: Bool, _packageSet :: Maybe String }+data Command = Install { _pkgName :: String, _verbosity :: Verbosity, _target :: Maybe Platform, _static :: Bool, _global :: Bool, _packageSet :: Maybe String } | Check { _dhallFile :: String, _verbosity :: Verbosity } | CheckSet { _dhallFile :: String, _verbosity :: Verbosity } | Dump { _dumpTarget :: DumpTarget, _host :: Maybe Platform }@@ -86,6 +86,10 @@ <*> verbosity <*> target <*> static'+ <*> switch+ (long "global"+ <> short 'g'+ <> help "Install globally") <*> packageSet packageSet :: Parser (Maybe String)@@ -143,9 +147,9 @@ ) run :: Command -> IO ()-run (Install pkId v host' sta pkSet) = do+run (Install pkId v host' sta glob pkSet) = do parsedHost <- parseHostIO host'- runPkgM v $ buildByName (T.pack pkId) parsedHost pkSet sta+ runPkgM v $ buildByName (T.pack pkId) parsedHost pkSet sta glob run (Check file' v) = void $ getCPkg v file' run (CheckSet file' v) = void $ getPkgs v file' run (Dump (Linker name) host) = runPkgM Normal $ printLinkerFlags name host
cabal.project view
@@ -1,2 +1,4 @@ packages: ./ constraints: cpkg +development++max-backjumps: 40000
cpkg.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: cpkg-version: 0.1.1.1+version: 0.1.2.1 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018-2019 Vanessa McHale@@ -89,7 +89,6 @@ hashable -any, binary -any, microlens -any,- composition-prelude -any, recursion >=2.2.3.0, filemanip -any, network-uri -any,
pkgs/pkg-set.dhall view
@@ -2,6 +2,9 @@ let concatMapSep = https://raw.githubusercontent.com/dhall-lang/dhall-lang/0a7f596d03b3ea760a96a8e03935f4baa64274e1/Prelude/Text/concatMapSep in +let not = https://raw.githubusercontent.com/dhall-lang/dhall-lang/master/Prelude/Bool/not+in+ {- cpkg prelude imports -} let types = ../dhall/cpkg-types.dhall in@@ -1400,6 +1403,18 @@ λ(cfg : types.BuildVars) → let libDir = "lib/${prelude.printArch cfg.buildArch}-${prelude.printOS cfg.buildOS}-gnu" in+ let noCross =+ if not cfg.isCross+ then+ [ prelude.symlink "${libDir}/libglib-2.0.so" "lib/libglib-2.0.so"+ , prelude.symlink "${libDir}/libglib-2.0.so.0" "lib/libglib-2.0.so.0"+ , prelude.symlink "${libDir}/libgio-2.0.so" "lib/libgio-2.0.so"+ , prelude.symlink "${libDir}/libgthread-2.0.so" "lib/libgthread-2.0.so"+ , prelude.symlink "${libDir}/libgobject-2.0.so" "lib/libgobject-2.0.so"+ , prelude.symlink "${libDir}/libgmodule-2.0.so" "lib/libgmodule-2.0.so"+ ]+ else [] : List types.Command+ in prelude.ninjaInstallWithPkgConfig (prelude.mesonMoves [ "glib-2.0.pc" , "gobject-2.0.pc"@@ -1410,14 +1425,8 @@ , "gmodule-2.0.pc" , "gthread-2.0.pc" ]) cfg-- # [ prelude.symlink "${libDir}/libglib-2.0.so" "lib/libglib-2.0.so"- , prelude.symlink "${libDir}/libglib-2.0.so.0" "lib/libglib-2.0.so.0"- , prelude.symlink "${libDir}/libgio-2.0.so" "lib/libgio-2.0.so"- , prelude.symlink "${libDir}/libgthread-2.0.so" "lib/libgthread-2.0.so"- , prelude.symlink "${libDir}/libgobject-2.0.so" "lib/libgobject-2.0.so"- , prelude.symlink "${libDir}/libgmodule-2.0.so" "lib/libgmodule-2.0.so"- , prelude.symlink "include/glib-2.0/glib" "include/glib"+ # noCross+ # [ prelude.symlink "include/glib-2.0/glib" "include/glib" , prelude.symlink "include/glib-2.0/gobject" "include/gobject" , prelude.symlink "include/glib-2.0/glib.h" "include/glib.h" , prelude.symlink "include/glib-2.0/glib-object.h" "include/glib-object.h"@@ -1854,7 +1863,7 @@ λ(v : List Natural) → prelude.simplePackage { name = "bzip2", version = v } ⫽- { pkgUrl = "https://cytranet.dl.sourceforge.net/project/bzip2/bzip2-${prelude.showVersion v}.tar.gz"+ { pkgUrl = "https://www.sourceware.org/pub/bzip2/bzip2-${prelude.showVersion v}.tar.gz" , configureCommand = prelude.doNothing , buildCommand = prelude.doNothing , installCommand = bzipInstall@@ -2182,7 +2191,12 @@ let libarchive = λ(v : List Natural) → prelude.simplePackage { name = "libarchive", version = v } ⫽- { pkgUrl = "https://www.libarchive.org/downloads/libarchive-${prelude.showVersion v}.tar.gz" }+ { pkgUrl = "https://www.libarchive.org/downloads/libarchive-${prelude.showVersion v}.tar.gz"+ , pkgDeps = [ prelude.unbounded "xz"+ , prelude.unbounded "bzip2"+ , prelude.unbounded "zlib"+ ]+ } in let pygobject =@@ -3035,6 +3049,16 @@ } in +let pari =+ λ(v : List Natural) →+ prelude.simplePackage { name = "pari", version = v } ⫽+ { pkgUrl = "http://pari.math.u-bordeaux.fr/pub/pari/unix/pari-${prelude.showVersion v}.tar.gz"+ , configureCommand = prelude.generalConfigure prelude.configSome "Configure" ([] : List Text) ([] : List Text)+ , pkgStream = False+ }+in++-- https://versaweb.dl.sourceforge.net/project/schilytools/schily-2019-03-29.tar.bz2 [ autoconf [2,69] , automake [1,16,1] , at-spi-atk { version = [2,30], patch = 0 }@@ -3093,14 +3117,14 @@ , gtk2 { version = [2,24], patch = 32 } , gtk3 { version = [3,24], patch = 4 } , gzip [1,9]-, harfbuzz [2,3,1]+, harfbuzz [2,4,0] , htop [2,2,0] , imageMagick [7,0,8] , imlib2 [1,5,1] , inputproto [2,3,2] , intltool [0,51,0] , itstool [2,0,5]-, jemalloc [5,1,0]+, jemalloc [5,2,0] , joe [4,6] , json-c { version = [0,13,1], dateStr = "20180305" } , kbproto [1,0,7]@@ -3132,9 +3156,9 @@ , libnettle [3,4,1] , libpciaccess [0,14] , libpng [1,6,35]-, libpsl [0,20,2]+, libpsl [0,21,0] , libpthread-stubs [0,4]-, libopenjpeg [2,3,0]+, libopenjpeg [2,3,1] , libotf [0,9,16] , libselinux [2,8] , libsepol [2,8]@@ -3180,7 +3204,7 @@ , markupSafe [1,0] , memcached [1,5,12] , mesa [18,3,1]-, meson [0,50,0]+, meson [0,50,1] , mpfr [4,0,2] , mosh [1,3,2] , motif [2,3,8]@@ -3191,12 +3215,14 @@ , nginx [1,15,7] , ninja [1,9,0] , node [10,15,1]+, node [8,15,1] ⫽ { pkgName = "node8" } , npth [1,6] , nspr [4,20] , openssh [7,9] , openssl [1,1,1] , p11kit [0,23,15] , pango { version = [1,43], patch = 0 }+, pari [2,11,1] , pcre [8,42] , pcre2 [10,32] , perl5 [5,28,1]@@ -3204,7 +3230,7 @@ , pkg-config [0,29,2] , postgresql [11,1] , protobuf [3,7,1]-, pycairo [1,18,0]+, pycairo [1,18,1] , pygobject { version = [2,28], patch = 7 } , pygtk { version = [2,24], patch = 0 } , python [2,7,16]
src/CPkgPrelude.hs view
@@ -17,8 +17,6 @@ , Interpret -- * hashable reëxports , Hashable- -- * Exports from "Control.Composition"- , (.**) -- * Exports from "Data.Binary" , Binary -- prettyprinter reëxports@@ -35,7 +33,6 @@ , getAppUserDataDirectory ) where -import Control.Composition ((.**)) import Control.Monad import Control.Monad.IO.Class (MonadIO (..)) import Data.Binary (Binary)
src/Package/C.hs view
@@ -16,6 +16,7 @@ , MonadDb , PkgM , Platform+ , Dep (..) -- * Functions , buildCPkg , runPkgM
src/Package/C/Build.hs view
@@ -106,23 +106,24 @@ buildCPkg :: CPkg -> Maybe TargetTriple -> Bool -- ^ Should we build static libraries?+ -> Bool -- ^ Should we install globally? -> [FilePath] -- ^ Shared data directories -> [FilePath] -- ^ Library directories -> [FilePath] -- ^ Include directories -> [FilePath] -- ^ Directories to add to @PATH@ -> PkgM ()-buildCPkg cpkg host sta shr libs incls bins = do+buildCPkg cpkg host sta glob shr libs incls bins = do buildVars <- getVars host sta shr libs incls bins -- TODO: use a real database- installed <- packageInstalled cpkg host buildVars+ installed <- packageInstalled cpkg host glob buildVars when installed $ putDiagnostic ("Package " ++ pkgName cpkg ++ " already installed, skipping.") unless installed $- forceBuildCPkg cpkg host buildVars+ forceBuildCPkg cpkg host glob buildVars getPreloads :: [ FilePath ] -> IO [ FilePath ] getPreloads =@@ -151,11 +152,12 @@ -- Basically nix-style builds for C libraries forceBuildCPkg :: CPkg -> Maybe TargetTriple+ -> Bool -> BuildVars -> PkgM ()-forceBuildCPkg cpkg host buildVars = do+forceBuildCPkg cpkg host glob buildVars = do - pkgDir <- cPkgToDir cpkg host buildVars+ pkgDir <- cPkgToDir cpkg host glob buildVars liftIO $ createDirectoryIfMissing True pkgDir @@ -177,4 +179,4 @@ installInDir cpkg buildConfigured p' pkgDir - registerPkg cpkg host buildVars -- not configured+ registerPkg cpkg host glob buildVars -- not configured
src/Package/C/Build/Tree.hs view
@@ -46,15 +46,16 @@ buildWithContext :: DepTree CPkg -> Maybe TargetTriple -> Bool -- ^ Should we build static libraries?+ -> Bool -- ^ Install globally -> PkgM ()-buildWithContext cTree host sta = zygoM' dirAlg buildAlg cTree+buildWithContext cTree host sta glob = zygoM' dirAlg buildAlg cTree where buildAlg :: DepTreeF CPkg (BuildDirs, ()) -> PkgM () buildAlg (DepNodeF c preBds) =- buildCPkg c host sta ds (immoralFilter host ls) is (filterCross host bs)+ buildCPkg c host sta glob ds (immoralFilter host ls) is (filterCross host bs) where (BuildDirs ls ds is bs) = getAll (fst <$> preBds) buildAlg (BldDepNodeF c preBds) =- buildCPkg c Nothing False ds ls is bs -- don't use static libraries for build dependencies+ buildCPkg c Nothing False glob ds ls is bs -- don't use static libraries for build dependencies where (BuildDirs ls ds is bs) = getAll (fst <$> preBds) mkBuildDirs :: MonadIO m => FilePath -> BuildDirs -> m BuildDirs@@ -83,7 +84,7 @@ buildVars <- getVars host sta ds (immoralFilter host ls) is (filterCross host bs) - pkgDir <- cPkgToDir c host buildVars+ pkgDir <- cPkgToDir c host glob buildVars mkBuildDirs pkgDir bldDirs @@ -93,12 +94,12 @@ buildVars <- getVars Nothing False ds ls is bs - pkgDir <- cPkgToDir c Nothing buildVars+ pkgDir <- cPkgToDir c Nothing False buildVars mkBuildDirs pkgDir bldDirs -- TODO: should this parse a string into a TargetTriple instead?-buildByName :: PackId -> Maybe TargetTriple -> Maybe String -> Bool -> PkgM ()-buildByName pkId host pkSet sta = do+buildByName :: PackId -> Maybe TargetTriple -> Maybe String -> Bool -> Bool -> PkgM ()+buildByName pkId host pkSet sta glob = do allPkgs <- liftIO (pkgsM pkId pkSet)- buildWithContext allPkgs host sta+ buildWithContext allPkgs host sta glob
src/Package/C/Db/Register.hs view
@@ -109,13 +109,14 @@ packageInstalled :: (MonadIO m, MonadDb m) => CPkg -> Maybe TargetTriple+ -> Bool -> BuildVars -> m Bool-packageInstalled pkg host b = do+packageInstalled pkg host glob b = do indexContents <- memIndex - pure (pkgToBuildCfg pkg host b `S.member` _installedPackages indexContents)+ pure (pkgToBuildCfg pkg host glob b `S.member` _installedPackages indexContents) lookupPackage :: (MonadIO m, MonadDb m) => String -> Maybe TargetTriple -> m (Maybe BuildCfg) lookupPackage name host = do@@ -130,16 +131,17 @@ registerPkg :: (MonadIO m, MonadDb m, MonadReader Verbosity m) => CPkg -> Maybe TargetTriple+ -> Bool -> BuildVars -> m ()-registerPkg cpkg host b = do+registerPkg cpkg host glob b = do putDiagnostic ("Registering package " ++ pkgName cpkg ++ "...") indexFile <- pkgIndex indexContents <- memIndex - let buildCfg = pkgToBuildCfg cpkg host b+ let buildCfg = pkgToBuildCfg cpkg host glob b modIndex = over installedPackages (S.insert buildCfg) newIndex = modIndex indexContents @@ -149,10 +151,11 @@ pkgToBuildCfg :: CPkg -> Maybe TargetTriple+ -> Bool -> BuildVars -> BuildCfg-pkgToBuildCfg (CPkg n v _ _ _ _ _ cCmd bCmd iCmd) host bVar =- BuildCfg n v mempty mempty host (cCmd bVar) (bCmd bVar) (iCmd bVar) -- TODO: fix pinned build deps &c.+pkgToBuildCfg (CPkg n v _ _ _ _ _ cCmd bCmd iCmd) host glob bVar =+ BuildCfg n v mempty mempty host glob (cCmd bVar) (bCmd bVar) (iCmd bVar) -- TODO: fix pinned build deps &c. platformString :: Maybe TargetTriple -> (FilePath -> FilePath -> FilePath) platformString Nothing = (</>)@@ -160,14 +163,20 @@ buildCfgToDir :: MonadIO m => BuildCfg -> m FilePath buildCfgToDir buildCfg = do- global <- globalPkgDir+ global' <- globalPkgDir let hashed = showHex (abs (hash buildCfg)) mempty (<?>) = platformString (targetArch buildCfg)- pure (global <?> buildName buildCfg ++ "-" ++ showVersion (buildVersion buildCfg) ++ "-" ++ hashed)+ pure (global' <?> buildName buildCfg ++ "-" ++ showVersion (buildVersion buildCfg) ++ "-" ++ hashed) +globDir :: Maybe TargetTriple -> FilePath+globDir Nothing = "/usr/local"+globDir (Just arch') = "/usr" </> show arch'+ cPkgToDir :: MonadIO m => CPkg -> Maybe TargetTriple+ -> Bool -> BuildVars -> m FilePath-cPkgToDir = buildCfgToDir .** pkgToBuildCfg+cPkgToDir pk host False bv = buildCfgToDir (pkgToBuildCfg pk host False bv)+cPkgToDir _ host _ _ = pure (globDir host)
src/Package/C/Db/Type.hs view
@@ -28,6 +28,7 @@ , pinnedBuildDeps :: [(T.Text, Version)] , pinnedDeps :: [(T.Text, Version)] , targetArch :: Maybe TargetTriple+ , global :: Bool , configureCmds :: [ Command ] , buildCmds :: [ Command ] , installCmds :: [ Command ]