bamse-0.9.4: templates/Bamse.hs
--------------------------------------------------------------------
-- |
-- Module : Bamse
-- Description : Specification/template for the Bamse installer builder.
-- Copyright : (c) Sigbjorn Finne, 2004-2009
-- License : BSD3
--
-- Maintainer : Sigbjorn Finne <sof@forkIO.com>
-- Stability : provisional
-- Portability : portable
--
-- To create your own installer, you need to supply a Haskell module
-- which exports functions and values that together define the
-- functionality (and contents) of your package;
-- see this module (Base.hs) just what those exports are.
--
--------------------------------------------------------------------
module Bamse where
import Bamse.Package
import Bamse.PackageUtils
import Bamse.Util.Dir ( DirTree, findFiles )
import Debug.Trace
import System.FilePath
pkgName, pkgVersion :: String
pkgName = "bamse"
pkgVersion = "1.2"
-- what to output the MSI as if no -o option is given.
defaultOutFile :: FilePath
defaultOutFile = toMsiFileName (pkgName ++ '-':pkgVersion)
-- 'information summary stream' data bundled up together.
pkg :: Package
pkg = Package
{ name = pkgName
, title = pkgName ++ ", version " ++ pkgVersion
, productVersion = "1.0.0.0"
, author = "Galois, Inc."
, comment = unwords [pkgName, "Version", pkgVersion]
}
webSite :: String
webSite = "http://haskell.forkIO.com/"
bannerBitmap :: InstallEnv -> Maybe FilePath
bannerBitmap ienv = Just (lFile (toolDir ienv) "art/banner3.bmp")
bgroundBitmap :: InstallEnv -> Maybe FilePath
bgroundBitmap ienv = Just (lFile (toolDir ienv) "art/bground2.bmp")
registry :: [RegEntry]
registry = []
baseFeatureName :: String
baseFeatureName = pkgName
baseFeature :: Feature
baseFeature = (baseFeatureName, pkgName ++ '-':pkgVersion)
features :: [Tree Feature]
features = [ Leaf baseFeature ]
startMenu :: InstallEnv -> (String, [Shortcut])
startMenu ienv = (pkgName, shortcuts ienv)
shortcuts :: InstallEnv -> [Shortcut]
shortcuts ienv =
[ Shortcut "Bamse installer"
(lFile (srcDir ienv) "doc/index.html")
""
"Bamse installer"
(Just (lFile iconDir "html.exe"))
1
"[TARGETDIR]"
, Shortcut "Using Bamse"
(lFile (srcDir ienv) "doc/using.html")
""
"Using bamse"
(Just (lFile iconDir "html.exe"))
1
"[TARGETDIR]"
, Shortcut "Getting started"
(lFile (srcDir ienv) "doc/howto.html")
""
"Getting started"
(Just (lFile iconDir "html.exe"))
1
"[TARGETDIR]"
]
where
iconDir = lFile (toolDir ienv) "icons"
desktopShortcuts :: InstallEnv -> [Shortcut]
desktopShortcuts _ienv = []
extensions :: InstallEnv -> [ Extension ]
extensions _ienv = []
verbs :: [ ( String -- extension
, String -- verb
, String -- label
, String -- arguments
)
]
verbs = []
license :: InstallEnv -> Maybe FilePath
license ienv = Just (lFile (toolDir ienv) "license.rtf")
userRegistration :: Bool
userRegistration = False
defaultInstallFolder :: Maybe String
defaultInstallFolder = Nothing
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 (takeDirectory f)) False
ofInterest file = {-trace ("considering: " ++ show (takeDirectory fileRel, fileRel)) $ -} not $
emacsCVSMeta fileRel ||
fileRel `elem` [ ".cvsignore", "TODO" ] ||
fileRel `elem` ["out", "output", "packages", "libraries", "soe"] ||
(takeDirectory fileRel == "" && takeExtension fileRel == ".log") ||
(takeDirectory fileRel == "" && takeExtension fileRel == ".msi") ||
(takeDirectory fileRel == "" && takeExtension fileRel == ".exe") ||
(takeDirectory fileRel == "" && takeExtension fileRel == ".a") ||
takeExtension fileRel `elem` [".o", ".obj", ".hi"]
where
fileRel = dropDirPrefix (srcDir ienv) file
emacsCVSMeta f =
case takeFileName f of
'#':_ -> True
'.':'#':_ -> True
"CVS" -> True
_ -> not (null f) && last f == '~'
distFileMap :: Maybe (FilePath -> Maybe FilePath)
distFileMap = Nothing
-- if provided, a mapping from dist tree filename to the
-- the feature it belongs to. If Nothing, all files are
-- mapped to the base feature.
featureMap :: Maybe (FilePath -> FeatureName)
featureMap = Nothing
finalMessage :: Maybe String
finalMessage = Nothing
userInstall :: Bool
userInstall = True
services :: [Service]
services = []
ghcPackageInfo :: Maybe GhcPackage
ghcPackageInfo = Nothing
-- nested installations are supported via sub-storage only.
-- i.e., after having built the Bamse installer, you need
-- to do the following:
--
-- foo$ msidb -d bamse.msi -r com.msi
-- foo$ msidb -d bamse.msi -r galois.msi
--
-- where 'msidb' is the tool that comes with the MS Platform SDK.
--
nestedInstalls :: [(FilePath, Maybe String)]
nestedInstalls = []
{- painful to work with, disable.
[ ("com.msi", Nothing)
, ("galois.msi", Nothing)
]
-}
cabalPackageInfo :: Maybe CabalPackage
cabalPackageInfo = Nothing
assemblies :: [Assembly]
assemblies = []