From c2e279b6ce8faaf9064d4027c646dc8f94453e94 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 May 2013 14:19:08 -0400 Subject: [PATCH] don't hardcode path to cygwin stuff, look for it in PATH --- Build/NullSoftInstaller.hs | 24 ++++++++++++++---------- standalone/windows/build.sh | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Build/NullSoftInstaller.hs b/Build/NullSoftInstaller.hs index a2259caa8a..cf01238050 100644 --- a/Build/NullSoftInstaller.hs +++ b/Build/NullSoftInstaller.hs @@ -19,12 +19,14 @@ {-# LANGUAGE OverloadedStrings #-} import Development.NSIS +import System.Directory import System.FilePath import Control.Monad -import System.Directory import Data.String +import Data.Maybe import Utility.Tmp +import Utility.Path import Utility.CopyFile import Utility.SafeCommand import Build.BundledPrograms @@ -35,7 +37,13 @@ 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 ++ "'"] - writeFile nsifile $ makeInstaller gitannex license + extrafiles <- forM (cygwinPrograms ++ cygwinDlls) $ \f -> + p <- searchPath f + when (isNothing p) $ + print ("unable to find in PATH", f) + return p + writeFile nsifile $ makeInstaller gitannex license $ + catMaybes extrafiles mustSucceed "makensis" [File nsifile] removeFile nsifile -- left behind if makensis fails where @@ -70,8 +78,8 @@ needGit = strConcat , fromString "You can install git from http:////git-scm.com//" ] -makeInstaller :: FilePath -> FilePath -> String -makeInstaller gitannex license = nsis $ do +makeInstaller :: FilePath -> FilePath -> [FilePath] -> String +makeInstaller gitannex license extrafiles = nsis $ do name "git-annex" outFile $ str installer {- Installing into the same directory as git avoids needing to modify @@ -88,15 +96,12 @@ makeInstaller gitannex license = nsis $ do page (License license) page InstFiles -- Give a progress bar while installing -- Groups of files to install - section "programs" [] $ do + section "main" [] $ do setOutPath "$INSTDIR" addfile gitannex addfile license - mapM_ addcygfile cygwinPrograms + mapM_ addfile extrafiles writeUninstaller $ str uninstaller - section "libraries" [] $ do - setOutPath "$INSTDIR" - mapM_ addcygfile cygwinDlls uninstall $ mapM_ (\f -> delete [RebootOK] $ fromString $ "$INSTDIR/" ++ f) $ [ gitannexprogram @@ -105,7 +110,6 @@ makeInstaller gitannex license = nsis $ do ] ++ cygwinPrograms ++ cygwinDlls where addfile f = file [] (str f) - addcygfile f = addfile $ "C:\\cygwin\\bin" f cygwinPrograms :: [FilePath] cygwinPrograms = map (\p -> p ++ ".exe") bundledPrograms diff --git a/standalone/windows/build.sh b/standalone/windows/build.sh index f751978f1f..31c40db8de 100644 --- a/standalone/windows/build.sh +++ b/standalone/windows/build.sh @@ -39,4 +39,4 @@ incygwin cabal build # Build the installer cabal install nsis ghc --make Build/NullSoftInstaller.hs -Build/NullSoftInstaller.exe +incygwin Build/NullSoftInstaller.exe