include libmagic in windows installer

This is from https://raw.githubusercontent.com/datalad/datalad-extensions/master/resources/git-annex-magicBundle.patch
which was written by John Thorvald Wodder II.

I have converted line endings from windows, and fixed indentation to use
tabs.
This commit is contained in:
Joey Hess 2020-10-26 13:24:37 -04:00
parent f3070d2d7d
commit a7d11aa3ab
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 20 additions and 3 deletions

View file

@ -87,3 +87,17 @@ preferredBundledPrograms = catMaybes
ifset True s = Just s
ifset False _ = Nothing
#endif
magicDLLs :: [FilePath]
#ifdef mingw32_HOST_OS
magicDLLs = ["libmagic-1.dll", "libgnurx-0.dll"]
#else
magicDLLs = []
#endif
magicShare :: [FilePath]
#ifdef mingw32_HOST_OS
magicShare = ["magic.mgc"]
#else
magicShare = []
#endif

View file

@ -42,6 +42,7 @@ main = do
withTmpDir "nsis-build" $ \tmpdir -> do
let gitannex = tmpdir </> gitannexprogram
mustSucceed "ln" [File "git-annex.exe", File gitannex]
mapM_ (\f -> mustSucceed "ln" [File f, File (tmpdir </> f)]) (magicDLLs ++ magicShare)
let license = tmpdir </> licensefile
mustSucceed "sh" [Param "-c", Param $ "zcat standalone/licences.gz > '" ++ license ++ "'"]
webappscript <- vbsLauncher tmpdir "git-annex-webapp" "git annex webapp"
@ -51,7 +52,7 @@ main = do
let gitannexcmd = tmpdir </> "git-annex.cmd"
writeFile gitannexcmd "git annex %*"
writeFile nsifile $ makeInstaller
gitannex gitannexcmd license htmlhelp winPrograms
gitannex gitannexcmd license htmlhelp (winPrograms ++ magicDLLs) magicShare
[ webappscript, autostartscript ]
mustSucceed "makensis" [File nsifile]
removeFile nsifile -- left behind if makensis fails
@ -117,8 +118,8 @@ needGit = strConcat
, fromString "You can install git from http:////git-scm.com//"
]
makeInstaller :: FilePath -> FilePath -> FilePath -> FilePath -> [FilePath] -> [FilePath] -> String
makeInstaller gitannex gitannexcmd license htmlhelp extrabins launchers = nsis $ do
makeInstaller :: FilePath -> FilePath -> FilePath -> FilePath -> [FilePath] -> [FilePath] -> [FilePath] -> String
makeInstaller gitannex gitannexcmd license htmlhelp extrabins sharefiles launchers = nsis $ do
name "git-annex"
outFile $ str installer
{- Installing into the same directory as git avoids needing to modify
@ -163,6 +164,8 @@ makeInstaller gitannex gitannexcmd license htmlhelp extrabins launchers = nsis $
-- there.
setOutPath "$INSTDIR\\usr\\bin"
mapM_ addfile (gitannex:extrabins)
setOutPath "$INSTDIR\\usr\\share\\misc"
mapM_ addfile sharefiles
-- 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