summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-26 11:54:15 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-26 11:54:15 -0400
commit8ee9733ff3dd8b9ff7cf1552f7eebf96b4ade7bb (patch)
tree38d4219ac8410d96bdfc937c98ca963fce4fc0d2
parentd419c190914ea4c5a9959bb585df02ae79d7d41b (diff)
Include magic database in the linux and OSX standalone builds.
-rw-r--r--Annex/FileMatcher.hs8
-rw-r--r--Makefile8
-rw-r--r--debian/changelog1
-rw-r--r--standalone/licences.gzbin55832 -> 55882 bytes
-rwxr-xr-xstandalone/osx/git-annex.app/Contents/MacOS/runshell6
5 files changed, 21 insertions, 2 deletions
diff --git a/Annex/FileMatcher.hs b/Annex/FileMatcher.hs
index 5167a5e02..fa46e64b1 100644
--- a/Annex/FileMatcher.hs
+++ b/Annex/FileMatcher.hs
@@ -33,6 +33,7 @@ import Git.CheckAttr (unspecifiedAttr)
#ifdef WITH_MAGICMIME
import Magic
+import Utility.Env
#endif
import Data.Either
@@ -131,7 +132,12 @@ mkLargeFilesParser = do
#ifdef WITH_MAGICMIME
magicmime <- liftIO $ catchMaybeIO $ do
m <- magicOpen [MagicMimeType]
- liftIO $ magicLoadDefault m
+ liftIO $ do
+ md <- getEnv "GIT_ANNEX_DIR"
+ case md of
+ Nothing -> magicLoadDefault m
+ Just d -> magicLoad m
+ (d </> "magic" </> "magic.mgc")
return m
#endif
let parse = parseToken $ commonTokens
diff --git a/Makefile b/Makefile
index d8894966f..cdf443632 100644
--- a/Makefile
+++ b/Makefile
@@ -147,6 +147,8 @@ linuxstandalone-nobuild: Build/Standalone Build/LinuxMkLibs
install -d "$(LINUXSTANDALONE_DEST)/git-core"
(cd "$(shell git --exec-path)" && tar c .) | (cd "$(LINUXSTANDALONE_DEST)"/git-core && tar x)
install -d "$(LINUXSTANDALONE_DEST)/templates"
+ install -d "$(LINUXSTANDALONE_DEST)/magic"
+ cp /usr/share/file/magic.mgc "$(LINUXSTANDALONE_DEST)/magic"
./Build/LinuxMkLibs "$(LINUXSTANDALONE_DEST)"
@@ -199,6 +201,12 @@ osxapp: Build/Standalone Build/OSXMkLibs
(cd "$(shell git --exec-path)" && tar c .) | (cd "$(OSXAPP_BASE)" && tar x)
install -d "$(OSXAPP_BASE)/templates"
+ install -d "$(OSXAPP_BASE)/magic"
+ if [ -e "$(OSX_MAGIC_FILE)" ]; then \
+ cp "$(OSX_MAGIC_FILE)" "$(OSXAPP_BASE)/magic/magic.mgc"; \
+ else \
+ echo "** OSX_MAGIC_FILE not set; not including it" >&2; \
+ endif
# OSX looks in man dir nearby the bin
$(MAKE) install-mans DESTDIR="$(OSXAPP_BASE)/.." SHAREDIR="" PREFIX=""
diff --git a/debian/changelog b/debian/changelog
index 0184c13ff..f59df474f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ git-annex (6.20160218) UNRELEASED; urgency=medium
so any system gpg will be preferred over it.
* Avoid crashing when built with MagicMime support, but when the magic
database cannot be loaded.
+ * Include magic database in the linux and OSX standalone builds.
-- Joey Hess <id@joeyh.name> Thu, 18 Feb 2016 13:09:21 -0400
diff --git a/standalone/licences.gz b/standalone/licences.gz
index e85b038fb..b126f88c0 100644
--- a/standalone/licences.gz
+++ b/standalone/licences.gz
Binary files differ
diff --git a/standalone/osx/git-annex.app/Contents/MacOS/runshell b/standalone/osx/git-annex.app/Contents/MacOS/runshell
index 56fc77f38..17c95698c 100755
--- a/standalone/osx/git-annex.app/Contents/MacOS/runshell
+++ b/standalone/osx/git-annex.app/Contents/MacOS/runshell
@@ -77,7 +77,11 @@ export ORIG_GIT_TEMPLATE_DIR
GIT_TEMPLATE_DIR="$bundle/templates"
export GIT_TEMPLATE_DIR
-# Indicate which variables were exported above.
+GIT_ANNEX_DIR="$bundle"
+export GIT_ANNEX_DIR
+
+# Indicate which variables were exported above and should be cleaned
+# when running non-bundled programs.
GIT_ANNEX_STANDLONE_ENV="PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR"
export GIT_ANNEX_STANDLONE_ENV