From fa7e002c63b11a88e35ef4160b4bc9b6e3bdb34e Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Tue, 19 Jun 2007 12:51:50 +0200 Subject: added cabal support darcs-hash:20070619105150-d6583-4351c7ea0a1eb1aa45f752f69a9e50d89af64ac3.gz --- Setup.lhs | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ xmobar.cabal | 16 ++++++++++++ xmobar.hs | 2 +- 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100755 Setup.lhs create mode 100644 xmobar.cabal diff --git a/Setup.lhs b/Setup.lhs new file mode 100755 index 0000000..d7acc7f --- /dev/null +++ b/Setup.lhs @@ -0,0 +1,80 @@ +#!/usr/bin/env runhaskell + +> import Distribution.Simple +> import Distribution.PackageDescription +> import Distribution.Setup +> import Distribution.Simple.Utils +> import Distribution.Simple.LocalBuildInfo +> import Distribution.Program +> import Distribution.PreProcess + +> import System.FilePath.Posix +> import System.Directory +> import Data.List + + +> main = defaultMainWithHooks defaultUserHooks {haddockHook = xmonadHaddock} + +> -- a different implementation of haddock hook from +> -- from Distribution.Simple: will use synopsis and description for +> -- building executables' documentation. + +> xmonadHaddock pkg_descr lbi hooks (HaddockFlags hoogle verbose) = do +> confHaddock <- do let programConf = withPrograms lbi +> haddockName = programName haddockProgram +> mHaddock <- lookupProgram haddockName programConf +> maybe (die "haddock command not found") return mHaddock + +> let tmpDir = (buildDir lbi) "tmp" +> createDirectoryIfMissing True tmpDir +> createDirectoryIfMissing True haddockPref +> preprocessSources pkg_descr lbi verbose (allSuffixHandlers hooks) +> setupMessage "Running Haddock for" pkg_descr + +> let outputFlag = if hoogle then "--hoogle" else "--html" +> showPkg = showPackageId (package pkg_descr) +> showDepPkgs = map showPackageId (packageDeps lbi) + +> withExe pkg_descr $ \exe -> do +> let bi = buildInfo exe +> inFiles <- getModulePaths bi (otherModules bi) +> srcMainPath <- findFile (hsSourceDirs bi) (modulePath exe) + +> let prologName = showPkg ++ "-haddock-prolog.txt" +> writeFile prologName (description pkg_descr ++ "\n") + +> let exeTargetDir = haddockPref exeName exe +> outFiles = srcMainPath : inFiles +> haddockFile = exeTargetDir (haddockName pkg_descr) + +> createDirectoryIfMissing True exeTargetDir +> rawSystemProgram verbose confHaddock +> ([outputFlag, +> "--odir=" ++ exeTargetDir, +> "--title=" ++ showPkg ++ ": " ++ synopsis pkg_descr, +> "--package=" ++ showPkg, +> "--dump-interface=" ++ haddockFile, +> "--prologue=" ++ prologName +> ] +> ++ map ("--use-package=" ++) showDepPkgs +> ++ programArgs confHaddock +> ++ (if verbose > 4 then ["--verbose"] else []) +> ++ outFiles +> ) +> removeFile prologName + +> getModulePaths :: BuildInfo -> [String] -> IO [FilePath] +> getModulePaths bi = +> fmap concat . +> mapM (flip (moduleToFilePath (hsSourceDirs bi)) ["hs", "lhs"]) + + +> allSuffixHandlers :: Maybe UserHooks +> -> [PPSuffixHandler] +> allSuffixHandlers hooks +> = maybe knownSuffixHandlers +> (\h -> overridesPP (hookedPreProcessors h) knownSuffixHandlers) +> hooks +> where +> overridesPP :: [PPSuffixHandler] -> [PPSuffixHandler] -> [PPSuffixHandler] +> overridesPP = unionBy (\x y -> fst x == fst y) diff --git a/xmobar.cabal b/xmobar.cabal new file mode 100644 index 0000000..5ad58ba --- /dev/null +++ b/xmobar.cabal @@ -0,0 +1,16 @@ +name: xmobar +version: 0.1 +homepage: http://gorgias.mine.nu/repos/xmobar/ +synopsis: A Statusbar for the XMonad Window Manager +description: A Statusbar for the XMonad Window Manager +category: System +license: BSD3 +license-file: LICENSE +author: Andrea Rossato +maintainer: andrea.rossato@unibz.it +build-depends: base>=2.0, X11>=1.2.1, mtl>=1.0, unix>=1.0, parsec>=2.0 + +executable: xmobar +main-is: xmobar.hs +ghc-options: -funbox-strict-fields -O2 -fasm -Wall -optl-Wl,-s +ghc-prof-options: -prof -auto-all diff --git a/xmobar.hs b/xmobar.hs index 5da326f..681419d 100644 --- a/xmobar.hs +++ b/xmobar.hs @@ -2,7 +2,7 @@ -- | -- Module : XMobar -- Copyright : (c) Andrea Rossato --- License : BSD-style (see xmonad/LICENSE) +-- License : BSD-style (see LICENSE) -- -- Maintainer : Andrea Rossato -- Stability : unstable -- cgit v1.2.3