summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-09-11 12:32:00 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-09-11 12:44:27 -0400
commitaede78869b2d9daa0c5e5d3f01824824e8d28ae4 (patch)
tree0af07682e60e948787b55962b1e63ae5b5476825 /Build
parent2aedcb351349cd2b5c65fff0c7207e5f510798ba (diff)
get git-annex working even if user doesn't add git to path
This is pretty complicated, but I have both "git-annex" and "git annex" working both in the git bash shell even with git not added to path. And, when git's added to path, both work from MS-DOS prompt window too. I think that the webapp startup does still need git in path, so instructions will keep saying to do that. But, users often disregard them, and hopefully this will reduce support traffic. Also, switched the wget from the cygwin one to the msys2 one, avoiding the complication of needing to bundle any cygwin dlls.
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