diff options
author | Will Thompson <will@willthompson.co.uk> | 2014-01-30 07:10:42 +0000 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2014-01-30 07:10:42 +0000 |
commit | ceb284fdff997c69b3fb9a80402b128f05e05227 (patch) | |
tree | 796217f1103b635ce9bac7306a68d445bca97559 | |
parent | decd2e4c57675aeb84bba71763bf6bed6e5a60b1 (diff) |
Ship translations in binary tarballs
For some reason, hgettext uses the install hook, not the copy hook.
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | Setup.hs | 18 | ||||
-rwxr-xr-x | bustle.sh | 3 |
3 files changed, 19 insertions, 6 deletions
@@ -71,10 +71,8 @@ TARBALL_FULL_DIR := $(TARBALL_PARENT_DIR)/$(TARBALL_DIR) TARBALL := $(TARBALL_DIR).tar.bz2 maintainer-binary-tarball: all mkdir -p $(TARBALL_FULL_DIR) - cabal-dev configure --prefix=$(TOP)/$(TARBALL_FULL_DIR) \ + cabal-dev install --prefix=$(TOP)/$(TARBALL_FULL_DIR) \ --datadir=$(TOP)/$(TARBALL_FULL_DIR) --datasubdir=. - cabal-dev build - cabal-dev copy cp bustle.sh README $(TARBALL_FULL_DIR) perl -pi -e 's{^ bustle-pcap}{ ./bustle-pcap};' \ -e 's{^ bustle} { ./bustle.sh};' \ @@ -53,7 +53,11 @@ writeGetTextConstantsFile pkg lbi flags = do getTextConstantsModuleName :: PackageDescription -> ModuleName getTextConstantsModuleName pkg_descr = ModuleName.fromString $ - "GetText_" ++ map fixchar (display (packageName pkg_descr)) + "GetText_" ++ fixedPackageName pkg_descr + +-- Cargo-culted from two separate places in Cabal! +fixedPackageName :: PackageDescription -> String +fixedPackageName = map fixchar . display . packageName where fixchar '-' = '_' fixchar c = c @@ -68,14 +72,22 @@ generateModule pkg lbi = " getMessageCatalogDomain,\n" ++ " getMessageCatalogDir\n" ++ ") where\n"++ - "\n" + "\n" ++ + "import qualified Control.Exception as Exception\n" ++ + "import System.Environment (getEnv)\n" body = + "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n" ++ + "catchIO = Exception.catch\n" ++ + "\n" ++ "getMessageCatalogDomain :: IO String\n" ++ "getMessageCatalogDomain = return " ++ show dom ++ "\n" ++ "\n" ++ + "messageCatalogDir :: String\n" ++ + "messageCatalogDir = " ++ show tar ++ "\n" ++ + "\n" ++ "getMessageCatalogDir :: IO FilePath\n" ++ - "getMessageCatalogDir = return " ++ show tar ++ "\n" + "getMessageCatalogDir = catchIO (getEnv \"" ++ fixedPackageName pkg ++ "_localedir\") (\\_ -> return messageCatalogDir)\n" sMap = customFieldsPD (localPkgDescr lbi) dom = getDomainNameDefault sMap (getPackageName lbi) @@ -6,6 +6,9 @@ root="$(dirname $(readlink -f ${0}))" bustle_datadir="${root}" export bustle_datadir +bustle_localedir="${root}/locale" +export bustle_localedir + LD_LIBRARY_PATH="${root}/lib:${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH |