bamse-0.9.1: templates/ComPkg.hs
--
-- (c) 2007, Galois, Inc.
--
-- To create a package, you need to define a module
-- which exports information and functions that together
-- define the functionality (and contents) of your package.
--
-- [Having Haskell as the only 'specification language' for packages
-- is not a goal. ]
module ComPkg where
import Util.Dir
import Util.Path
import Bamse.Package
import Bamse.PackageUtils
import Debug.Trace
versionNumber = "0.30"
libVersion = "comlib-" ++ versionNumber
defaultOutFile = toMsiFileName libVersion
packageName="comLib"
pkg :: Package
pkg = Package
{ name = "comlib"
, title = "COM support library for GHC-" ++ forGhcVersion
, productVersion = "1.0.0.0"
, author = "Sigbjorn Finne"
, comment = "Version: " ++ versionNumber
}
webSite :: String
webSite = "http://haskell.org/hdirect"
bannerBitmap :: InstallEnv -> Maybe FilePath
bannerBitmap ienv = Just (lFile (toolDir ienv) "art/banner.bmp")
bgroundBitmap :: InstallEnv -> Maybe FilePath
bgroundBitmap _ienv = Nothing
registry :: [RegEntry]
registry = []
features :: [Tree Feature]
features = [ Leaf baseFeature ]
baseFeatureName :: String
baseFeatureName = "comlib"
baseFeature :: Feature
baseFeature = (baseFeatureName, "COM library for GHC")
startMenu :: InstallEnv -> (String, [Shortcut])
startMenu ienv = ("GHC/packages/"++packageName, entries)
where
entries :: [Shortcut]
entries =
[ Shortcut "Documentation (HTML)"
(lFile (srcDir ienv) "doc\\index.html")
""
"Library documentation"
(Just (lFile iconDir "html.exe"))
1
"[TARGETDIR]"
]
iconDir = toolDir ienv ++ "\\icons"
desktopShortcuts :: InstallEnv -> [Shortcut]
desktopShortcuts _ienv = []
extensions :: InstallEnv -> [ Extension ]
extensions _ienv = [ ]
verbs :: [ ( String -- extension
, String -- verb
, String -- label
, String -- arguments
)
]
verbs = []
dirTree :: InstallEnv -> IO DirTree
dirTree ienv = findFiles ofInterest' (srcDir ienv)
where
ofInterest' f =
if ofInterest f
then trace ("including:" ++ f) True
else trace ("excluding:" ++ f ++ show (dirname f)) False
-- Note: 'path' is prefixed by 'topDir'.
ofInterest path
= path == srcDir ienv
-- || ("System" `elem` splitPath path && not ("tmp" `elem` splitPath path))
|| baseName path `elem` ["com.pkg", "HScom.o", "doc", "include", "cbits"]
|| baseName path == "doc" || baseName (dirname path) == "doc"
|| baseName path == "build" || baseName (dirname path) == "build"
|| fileSuffix path `elem` [{-"",-} "a", "hi", "h", "hs"]
|| not (emacsCVSMeta path || fileSuffix path `elem` ["raw-hs"])
-- By leaving out "", we won't recurse into subdirs. We specially
-- check for the toplevel directory, as it needs to be present.
-- (fileSuffix file `elem` [""{-directory-}, "dll", "hs", "lhs", "idl", "h", "pkg"])
emacsCVSMeta f =
case baseName f of
'#':_ -> True
'.':'#':_ -> True
"CVS" -> True
".cvsignore" -> True
_ -> not (null f) && last f == '~'
distFileMap :: Maybe (FilePath -> Maybe FilePath)
distFileMap = Nothing
featureMap :: Maybe (FilePath -> FeatureName)
featureMap = Nothing
license :: InstallEnv -> Maybe FilePath
license _ienv = Nothing
userRegistration :: Bool
userRegistration = False
defaultInstallFolder :: Maybe String
defaultInstallFolder = Just $ "[WindowsVolume]ghc\\packages\\ghc-"++forGhcVersion ++ "\\" ++ packageName ++ "\\"
forGhcVersion :: String
forGhcVersion = "6.6.1"
finalMessage :: Maybe String
finalMessage = Nothing
userInstall :: Bool
userInstall = False
services :: [Service]
services = []
ghcPackageInfo :: Maybe GhcPackage
ghcPackageInfo = Just $
GhcPackage { ghc_packageName = "Com"
-- ToDo: allow 'most-recent' compiler to be used.
, ghc_forVersion = forGhcVersion
, ghc_packageFile = Just "com.pkg"
, ghc_pkgCmdLine = Just (unwords [ def "hd_lib" ""
, def "hd_imp" "build"
, def "hd_inc" "include"
])
}
where
tgt "" = "\"[TARGETDIR]build\""
tgt s = "\"[TARGETDIR]" ++ s ++ "\""
def s v = '-':'D':s ++ '=':tgt v
nestedInstalls = []