aboutsummaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/NullSoftInstaller.hs65
1 files changed, 32 insertions, 33 deletions
diff --git a/Build/NullSoftInstaller.hs b/Build/NullSoftInstaller.hs
index 7726fdcbc..c7cd44ea7 100644
--- a/Build/NullSoftInstaller.hs
+++ b/Build/NullSoftInstaller.hs
@@ -1,8 +1,4 @@
{- Generates a NullSoft installer program for git-annex on Windows.
- -
- - To build the installer, git-annex should already be built by cabal,
- - and the necessary utility programs already installed
- - from cygwin.
-
- This uses the Haskell nsis package (cabal install nsis)
- to generate a .nsi file, which is then used to produce
@@ -12,6 +8,10 @@
- exception of git and some utilities that are bundled with git.
- The user needs to install git separately, and the installer checks
- for that.
+ -
+ - To build the installer, git-annex should already be built by cabal,
+ - and the necessary utility programs (rsync and wget) already installed
+ - in PATH from msys32.
-
- Copyright 2013-2015 Joey Hess <id@joeyh.name>
-
@@ -44,19 +44,14 @@ main = do
mustSucceed "ln" [File "dist/build/git-annex/git-annex.exe", File gitannex]
let license = tmpdir </> licensefile
mustSucceed "sh" [Param "-c", Param $ "zcat standalone/licences.gz > '" ++ license ++ "'"]
- extrabins <- forM (winPrograms) $ \f -> do
- p <- searchPath f
- when (isNothing p) $
- print ("unable to find in PATH", f)
- return p
- dlls <- forM (catMaybes extrabins) findCygLibs
- dllpaths <- mapM searchPath (nub (concat dlls))
- webappscript <- vbsLauncher tmpdir "git-annex-webapp" "git-annex webapp"
+ webappscript <- vbsLauncher tmpdir "git-annex-webapp" "git annex webapp"
autostartscript <- vbsLauncher tmpdir "git-annex-autostart" "git annex assistant --autostart"
let htmlhelp = tmpdir </> "git-annex.html"
writeFile htmlhelp htmlHelpText
- writeFile nsifile $ makeInstaller gitannex license htmlhelp
- (catMaybes (extrabins ++ dllpaths))
+ let gitannexcmd = tmpdir </> "git-annex.cmd"
+ writeFile gitannexcmd "git annex %*"
+ writeFile nsifile $ makeInstaller
+ gitannex gitannexcmd license htmlhelp winPrograms
[ webappscript, autostartscript ]
mustSucceed "makensis" [File nsifile]
removeFile nsifile -- left behind if makensis fails
@@ -115,8 +110,8 @@ needGit = strConcat
, fromString "You can install git from http:////git-scm.com//"
]
-makeInstaller :: FilePath -> FilePath -> FilePath -> [FilePath] -> [FilePath] -> String
-makeInstaller gitannex license htmlhelp extrabins launchers = nsis $ do
+makeInstaller :: FilePath -> FilePath -> FilePath -> FilePath -> [FilePath] -> [FilePath] -> String
+makeInstaller gitannex gitannexcmd license htmlhelp extrabins launchers = nsis $ do
name "git-annex"
outFile $ str installer
{- Installing into the same directory as git avoids needing to modify
@@ -138,7 +133,7 @@ makeInstaller gitannex license htmlhelp extrabins launchers = nsis $ do
[ Target "wscript.exe"
, Parameters "\"$INSTDIR/git-annex-webapp.vbs\""
, StartOptions "SW_SHOWNORMAL"
- , IconFile "$INSTDIR/cmd/git-annex.exe"
+ , IconFile "$INSTDIR/usr/bin/git-annex.exe"
, IconIndex 2
, Description "Git Annex (Webapp)"
]
@@ -147,15 +142,30 @@ makeInstaller gitannex license htmlhelp extrabins launchers = nsis $ do
[ Target "wscript.exe"
, Parameters "\"$INSTDIR/git-annex-autostart.vbs\""
, StartOptions "SW_SHOWNORMAL"
- , IconFile "$INSTDIR/cmd/git-annex.exe"
+ , IconFile "$INSTDIR/usr/bin/git-annex.exe"
, IconIndex 2
, Description "git-annex autostart"
]
section "cmd" [] $ do
- setOutPath "$INSTDIR\\cmd"
+ -- Remove old files no longer installed in the cmd
+ -- directory.
+ removefilesFrom "$INSTDIR/cmd" (gitannex:extrabins)
+ -- Install everything to the same location git puts its
+ -- bins. This makes "git annex" work in the git bash
+ -- shell, since git expects to find the git-annex binary
+ -- there.
+ setOutPath "$INSTDIR\\usr\\bin"
mapM_ addfile (gitannex:extrabins)
+ -- This little wrapper is installed in the cmd directory,
+ -- so that "git-annex" works (as well as "git annex"),
+ -- when only that directory is in PATH (ie, in a ms-dos
+ -- prompt window).
+ setOutPath "$INSTDIR\\cmd"
+ addfile gitannexcmd
section "meta" [] $ do
- setOutPath "$INSTDIR\\doc\\git\\html"
+ -- git opens this file when git annex --help is run.
+ -- (Program Files/Git/mingw32/share/doc/git-doc/git-annex.html)
+ setOutPath "$INSTDIR\\mingw32\\share\\doc\\git-doc"
addfile htmlhelp
setOutPath "$INSTDIR"
addfile license
@@ -164,7 +174,8 @@ makeInstaller gitannex license htmlhelp extrabins launchers = nsis $ do
uninstall $ do
delete [RebootOK] $ startMenuItem
delete [RebootOK] $ autoStartItem
- removefilesFrom "$INSTDIR/cmd" (gitannex:extrabins)
+ removefilesFrom "$INSTDIR/usr/bin" (gitannex:extrabins)
+ removefilesFrom "$INSTDIR/cmd" gitannexcmd
removefilesFrom "$INSTDIR\\doc\\git\\html" [htmlhelp]
removefilesFrom "$INSTDIR" $
launchers ++
@@ -178,8 +189,6 @@ makeInstaller gitannex license htmlhelp extrabins launchers = nsis $ do
winPrograms :: [FilePath]
winPrograms = map (\p -> p ++ ".exe") bundledPrograms
--- git opens Program Files/Git/doc/git/html/git-annex.html
--- when git annex --help is run.
htmlHelpText :: String
htmlHelpText = unlines
[ "<html>"
@@ -190,13 +199,3 @@ htmlHelpText = unlines
, "</body>"
, "</html"
]
-
--- Find cygwin libraries used by the specified executable.
-findCygLibs :: FilePath -> IO [FilePath]
-findCygLibs p = filter iscyg . mapMaybe parse . lines
- <$> catchDefaultIO "" (readProcess "ldd" [p])
- where
- parse l = case words (dropWhile isSpace l) of
- (dll:"=>":_dllpath:_offset:[]) -> Just dll
- _ -> Nothing
- iscyg f = "cyg" `isPrefixOf` f || "lib" `isPrefixOf` f