packages feed

cabal-macosx 0.2.4.1 → 0.2.4.2

raw patch · 9 files changed

+87/−50 lines, 9 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Distribution/MacOSX.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE CPP #-}   {- | Cabal support for creating Mac OSX application bundles.    GUI applications on Mac OSX should be run as application /bundles/;@@ -30,10 +31,8 @@ import Prelude hiding ( catch ) import Control.Monad (forM_, when) import Data.List ( isPrefixOf )-import Data.Text ( Text ) import System.Cmd (system) import System.FilePath-import System.Info (os) import System.Directory (copyFile, createDirectoryIfMissing, getHomeDirectory) import qualified Data.Text as T import qualified Data.Text.IO as T@@ -44,12 +43,18 @@ import Distribution.Simple.LocalBuildInfo (absoluteInstallDirs, LocalBuildInfo(..)) import Distribution.Simple.Setup (BuildFlags, InstallFlags, CopyFlags, fromFlagOrDefault, installVerbosity, copyVerbosity) import Distribution.Simple.Utils (installDirectoryContents, installExecutableFile)+#if MIN_VERSION_Cabal(1,18,0)+import Distribution.System (Platform (..), OS (OSX))+#else+import System.Info (os)+#endif import Distribution.Verbosity (normal, Verbosity)  import Distribution.MacOSX.Internal import Distribution.MacOSX.AppBuildInfo import Distribution.MacOSX.Common import Distribution.MacOSX.Dependencies+import Distribution.MacOSX.Templates  -- | Post-build hook for OS X application bundles.  Does nothing if -- called on another O/S.@@ -61,7 +66,11 @@           -- 'Distribution.Simple.postBuild'.   -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO () appBundleBuildHook apps _ _ pkg localb =+#if MIN_VERSION_Cabal(1,18,0)+  if isMacOS localb+#else   if isMacOS+#endif      then do let buildDirLbi = buildDir localb              let macApps = getMacAppsForBuildableExecutors apps (executables pkg)              forM_ macApps (makeAppBundle . createAppBuildInfo buildDirLbi)@@ -106,7 +115,11 @@            -- with no icon or plist, and no dependency-chasing.   -> Verbosity   -> PackageDescription -> LocalBuildInfo -> IO ()+#if MIN_VERSION_Cabal(1,18,0)+appBundleInstallOrCopyHook apps verbosity pkg localb = when (isMacOS localb) $ do+#else appBundleInstallOrCopyHook apps verbosity pkg localb = when isMacOS $ do+#endif   libraryHaskell  <- flip fmap getHomeDirectory $ (</> "Library/Haskell")   let standardPrefix = (libraryHaskell ++ "/") `isPrefixOf` prefix installDir   let applicationsDir = if standardPrefix@@ -176,10 +189,18 @@   where     appInfo    = toAppBuildInfo localb app     appPathSrc = abAppPath appInfo- ++#if MIN_VERSION_Cabal(1,18,0)+isMacOS :: LocalBuildInfo -> Bool+isMacOS localb = case hostPlatform localb of+  Platform _ OSX -> True+  _ -> False+#else isMacOS :: Bool isMacOS = os == "darwin"+#endif + -- | Given a 'MacApp' in context, make an application bundle in the -- build area. (for internal use only) makeAppBundle :: AppBuildInfo -> IO ()@@ -252,40 +273,3 @@          copyFile icPath $                   appPath </> "Contents/Resources" </> takeFileName icPath     Nothing -> return ()---- | Default plist template, based on that in macosx-app from wx (but--- with version stuff removed).-plistTemplate :: Text-plistTemplate = "\-    \<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\-    \<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\">\n\-    \<plist version=\"0.9\">\n\-    \<dict>\n\-            \<key>CFBundleInfoDictionaryVersion</key>\n\-            \<string>6.0</string>\n\-            \<key>CFBundleIdentifier</key>\n\-            \<string>org.haskell.$program</string>\n\-            \<key>CFBundleDevelopmentRegion</key>\n\-            \<string>English</string>\n\-            \<key>CFBundleExecutable</key>\n\-            \<string>$program</string>\n\-            \<key>CFBundleIconFile</key>\n\-            \<string>$iconPath</string>\n\-            \<key>CFBundleName</key>\n\-            \<string>$program</string>\n\-            \<key>CFBundlePackageType</key>\n\-            \<string>APPL</string>\n\-            \<key>CFBundleSignature</key>\n\-            \<string>????</string>\n\-            \<key>CFBundleVersion</key>\n\-            \<string>1.0</string>\n\-            \<key>CFBundleShortVersionString</key>\n\-            \<string>1.0</string>\n\-            \<key>CFBundleGetInfoString</key>\n\-            \<string>$program, bundled by cabal-macosx</string>\n\-            \<key>LSRequiresCarbon</key>\n\-            \<true/>\n\-            \<key>CSResourcesFileMapped</key>\n\-            \<true/>\n\-    \</dict>\n\-    \</plist>"
Distribution/MacOSX/AppBuildInfo.hs view
Distribution/MacOSX/Common.hs view
Distribution/MacOSX/DG.hs view
Distribution/MacOSX/Dependencies.hs view
Distribution/MacOSX/Internal.hs view
@@ -24,6 +24,7 @@ #if MIN_VERSION_Cabal(2,0,0) import Data.String (fromString) import Distribution.Text (display)+import Distribution.Types.UnqualComponentName (unUnqualComponentName) #endif import Prelude hiding ( catch ) import System.Cmd ( system )@@ -46,7 +47,7 @@     xs -> filter buildableApp xs   where -- Make a default MacApp in absence of explicit from Setup.hs #if MIN_VERSION_Cabal(2,0,0)-        mkDefault x = MacApp (display $ exeName x) Nothing Nothing [] [] DoNotChase+        mkDefault x = MacApp (unUnqualComponentName $ exeName x) Nothing Nothing [] [] DoNotChase #else         mkDefault x = MacApp (exeName x) Nothing Nothing [] [] DoNotChase #endif
+ Distribution/MacOSX/Templates.hs view
@@ -0,0 +1,46 @@+{-# LANGUAGE OverloadedStrings #-}++-- | Templates for the bundle.++module Distribution.MacOSX.Templates (+  plistTemplate+) where++import Data.Text ( Text )++-- | Default plist template, based on that in macosx-app from wx (but+-- with version stuff removed).+plistTemplate :: Text+plistTemplate = "\+    \<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\+    \<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\">\n\+    \<plist version=\"0.9\">\n\+    \<dict>\n\+            \<key>CFBundleInfoDictionaryVersion</key>\n\+            \<string>6.0</string>\n\+            \<key>CFBundleIdentifier</key>\n\+            \<string>org.haskell.$program</string>\n\+            \<key>CFBundleDevelopmentRegion</key>\n\+            \<string>English</string>\n\+            \<key>CFBundleExecutable</key>\n\+            \<string>$program</string>\n\+            \<key>CFBundleIconFile</key>\n\+            \<string>$iconPath</string>\n\+            \<key>CFBundleName</key>\n\+            \<string>$program</string>\n\+            \<key>CFBundlePackageType</key>\n\+            \<string>APPL</string>\n\+            \<key>CFBundleSignature</key>\n\+            \<string>????</string>\n\+            \<key>CFBundleVersion</key>\n\+            \<string>1.0</string>\n\+            \<key>CFBundleShortVersionString</key>\n\+            \<string>1.0</string>\n\+            \<key>CFBundleGetInfoString</key>\n\+            \<string>$program, bundled by cabal-macosx</string>\n\+            \<key>LSRequiresCarbon</key>\n\+            \<true/>\n\+            \<key>CSResourcesFileMapped</key>\n\+            \<true/>\n\+    \</dict>\n\+    \</plist>"
cabal-macosx.cabal view
@@ -1,5 +1,5 @@ Name:                   cabal-macosx-Version:                0.2.4.1+Version:                0.2.4.2 Stability:              Alpha Synopsis:               Cabal support for creating Mac OSX application bundles. Description:@@ -46,7 +46,8 @@                     Distribution.MacOSX.Common,                     Distribution.MacOSX.AppBuildInfo,                     Distribution.MacOSX.Dependencies,-                    Distribution.MacOSX.DG+                    Distribution.MacOSX.DG,+                    Distribution.MacOSX.Templates   ghc-options:      -fwarn-tabs -Wall  Executable macosx-app
tests/Distribution/MacOSX/Internal/Tests.hs view
@@ -10,11 +10,16 @@ #if MIN_VERSION_Cabal(2,0,0) import Distribution.Types.ExecutableScope #endif-import Distribution.PackageDescription (BuildInfo(..), Executable(..), emptyBuildInfo)+import Distribution.PackageDescription (BuildInfo(..), Executable(..), emptyBuildInfo, emptyExecutable)  import Distribution.MacOSX.Internal (getMacAppsForBuildableExecutors) import Distribution.MacOSX.Common +#if MIN_VERSION_Cabal(2,0,0)+getExecutableScopeUnknown :: ExecutableScope+getExecutableScopeUnknown = exeScope $ emptyExecutable+#endif+ macosxInternalTests :: Test macosxInternalTests = testGroup "Distribution.MacOSX.Internal"     [ mutuallyExclusive $ testGroup "MacOSX Internal"@@ -43,8 +48,8 @@ testBuildMacApp_twoBuildableExecutables :: Assertion testBuildMacApp_twoBuildableExecutables = do #if MIN_VERSION_Cabal(2,0,0)-    let execs = [ Executable "Dummy One" "/tmp" ExecutableScopeUnknown emptyBuildInfo-                  , Executable "Dummy Two" "/tmp" ExecutableScopeUnknown  emptyBuildInfo ]+    let execs = [ Executable "Dummy One" "/tmp" getExecutableScopeUnknown emptyBuildInfo+                  , Executable "Dummy Two" "/tmp" getExecutableScopeUnknown emptyBuildInfo ] #else     let execs = [ Executable "Dummy One" "/tmp" emptyBuildInfo                   , Executable "Dummy Two" "/tmp" emptyBuildInfo ]@@ -57,8 +62,8 @@ testBuildMacApp_twoExcetuablesOneBuildableAndOneNot :: Assertion testBuildMacApp_twoExcetuablesOneBuildableAndOneNot = do #if MIN_VERSION_Cabal(2,0,0)-    let execs = [ Executable "Dummy One" "/tmp" ExecutableScopeUnknown (emptyBuildInfo { buildable = False })-                  , Executable "Dummy Two" "/tmp" ExecutableScopeUnknown  emptyBuildInfo ]+    let execs = [ Executable "Dummy One" "/tmp" getExecutableScopeUnknown (emptyBuildInfo { buildable = False })+                  , Executable "Dummy Two" "/tmp" getExecutableScopeUnknown  emptyBuildInfo ] #else     let execs = [ Executable "Dummy One" "/tmp" (emptyBuildInfo { buildable = False })                   , Executable "Dummy Two" "/tmp" emptyBuildInfo ]@@ -70,8 +75,8 @@ testBuildMacApp_twoAppsAndTwoExecutablesOneBuildableOneNot :: Assertion testBuildMacApp_twoAppsAndTwoExecutablesOneBuildableOneNot = do #if MIN_VERSION_Cabal(2,0,0)-    let execs = [ Executable "Dummy One" "/tmp" ExecutableScopeUnknown (emptyBuildInfo { buildable = False })-                  , Executable "Dummy Two" "/tmp" ExecutableScopeUnknown  emptyBuildInfo ]+    let execs = [ Executable "Dummy One" "/tmp" getExecutableScopeUnknown (emptyBuildInfo { buildable = False })+                  , Executable "Dummy Two" "/tmp" getExecutableScopeUnknown  emptyBuildInfo ] #else     let execs = [ Executable "Dummy One" "/tmp" (emptyBuildInfo { buildable = False })                   , Executable "Dummy Two" "/tmp" emptyBuildInfo ]