packages feed

cabal-macosx 0.2.3.5 → 0.2.4.0

raw patch · 5 files changed

+45/−49 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Distribution.MacOSX: appBundleCopyHook :: [MacApp] -> Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()

Files

Distribution/MacOSX.hs view
@@ -18,6 +18,7 @@ module Distribution.MacOSX (   appBundleBuildHook,   appBundleInstallHook,+  appBundleCopyHook,   makeAppBundle,   MacApp(..),   ChaseDeps(..),@@ -41,9 +42,9 @@ import Distribution.Simple import Distribution.Simple.InstallDirs (bindir, prefix, CopyDest(NoCopyDest)) import Distribution.Simple.LocalBuildInfo (absoluteInstallDirs, LocalBuildInfo(..))-import Distribution.Simple.Setup (BuildFlags, InstallFlags, fromFlagOrDefault, installVerbosity)+import Distribution.Simple.Setup (BuildFlags, InstallFlags, CopyFlags, fromFlagOrDefault, installVerbosity, copyVerbosity) import Distribution.Simple.Utils (installDirectoryContents, installExecutableFile)-import Distribution.Verbosity (normal)+import Distribution.Verbosity (normal, Verbosity)  import Distribution.MacOSX.Internal import Distribution.MacOSX.AppBuildInfo@@ -77,8 +78,35 @@   -> Args -- ^ All other parameters as per           -- 'Distribution.Simple.postInstall'.   -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()-appBundleInstallHook apps _ iflags pkg localb = when isMacOS $ do-  let verbosity = fromFlagOrDefault normal (installVerbosity iflags)+appBundleInstallHook apps _ iflags =+	appBundleInstallOrCopyHook apps+	    (fromFlagOrDefault normal (installVerbosity iflags))+{-# DEPRECATED appBundleInstallHook "Use appBundleCopyHook instead" #-}++-- | Post-copy hook for OS X application bundles.  Copies the+-- application bundle (assuming you are also using the appBundleBuildHook)+-- to @$prefix/Applications@+-- Does nothing if called on another O/S.+-- Use this instead of appBundleInstallHook (do not hook+-- both postInst and postCopy).+appBundleCopyHook ::+  [MacApp] -- ^ List of applications to build; if empty, an+           -- application is built for each executable in the package,+           -- with no icon or plist, and no dependency-chasing.+  -> Args -- ^ All other parameters as per+          -- 'Distribution.Simple.postCopy'.+  -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()+appBundleCopyHook apps _ cflags =+	appBundleInstallOrCopyHook apps+	    (fromFlagOrDefault normal (copyVerbosity cflags))++appBundleInstallOrCopyHook ::+  [MacApp] -- ^ List of applications to build; if empty, an+           -- application is built for each executable in the package,+           -- with no icon or plist, and no dependency-chasing.+  -> Verbosity+  -> PackageDescription -> LocalBuildInfo -> IO ()+appBundleInstallOrCopyHook apps verbosity pkg localb = when isMacOS $ do   libraryHaskell  <- flip fmap getHomeDirectory $ (</> "Library/Haskell")   let standardPrefix = (libraryHaskell ++ "/") `isPrefixOf` prefix installDir   let applicationsDir = if standardPrefix
Distribution/MacOSX/Dependencies.hs view
@@ -213,10 +213,17 @@ updateDependency appPath app src tgt =   do putStrLn $ "Updating " ++ newLib ++ "'s dependency on " ++ tgt ++                    " to " ++ tgt'+     -- Ensure we have write permissions while editing the library. Notably,+     -- Homebrew removes write permissions from installed files.+     perm <- getPermissions newLib+     setPermissions newLib perm { writable = True }      let cmd = iTool ++ " -change " ++ show tgt ++ " " ++ show tgt' ++                    " " ++ show newLib-     --putStrLn cmd-     ExitSuccess <- system cmd+     exitCode <- system cmd+     setPermissions newLib perm+     when (exitCode /= ExitSuccess) $+       error $ "Failed to update library dependencies on " ++ show newLib +++        " with command: " ++ cmd      return ()   where tgt' = "@executable_path/../Frameworks/" </> makeRelative "/" tgt         newLib = appPath </> pathInApp app src
Distribution/MacOSX/Internal.hs view
@@ -56,32 +56,5 @@   FilePath -- ^ Path to application bundle root.   -> MacApp -> IO () osxIncantations appPath app =-  do dtools <- developerTools-     runCommand $ dtools </> "Rez Carbon.r -o " ++ appPath </> pathInApp app (appName app)-     writeFile (appPath </> "PkgInfo") "APPL????"-     runCommand $ dtools </> "SetFile -a C " ++ appPath </> "Contents" -- Tell Finder about the icon.+  do writeFile (appPath </> "PkgInfo") "APPL????"      return ()--runCommand :: String -> IO ()-runCommand commandExec =-  do putStrLn $ "Running: " ++ commandExec-     exitValue <- system commandExec-     case exitValue of-        ExitSuccess -> return ()-        _ -> do putStrLn $ "Warning - Could not run the command \""-                           ++ commandExec ++ "\". Please check your local `XCode` configuration."-                exitFailure---- | Path to the developer tools directory, if one exists-developerTools :: IO FilePath-developerTools =-   do ds <- filterM doesDirectoryExist cands-      case ds of-        [] -> do putStrLn $ "Can't find the developer tools directory. Have you installed the Developer tools?\n"-                            ++ "I tried looking for:\n" ++ unlines (map ("* " ++) cands)-                 exitWith (ExitFailure 1)-        (d:_) -> return d-  where-    cands = [ "/Applications/XCode.app/Contents/Developer/Tools"-            , "/Developer/Tools"-            ]
cabal-macosx.cabal view
@@ -1,5 +1,5 @@ Name:                   cabal-macosx-Version:                0.2.3.5+Version:                0.2.4.0 Stability:              Alpha Synopsis:               Cabal support for creating Mac OSX application bundles. Description:
tests/Distribution/MacOSX/Internal/Tests.hs view
@@ -1,21 +1,18 @@ module Distribution.MacOSX.Internal.Tests where -import System.IO.Temp (withSystemTempDirectory)-import Control.Exception (SomeException, catch) import Prelude hiding (catch) import Test.HUnit (Assertion, assertEqual) import Test.Framework (Test, mutuallyExclusive, testGroup) import Test.Framework.Providers.HUnit (testCase) import Distribution.PackageDescription (BuildInfo(..), Executable(..), emptyBuildInfo) -import Distribution.MacOSX.Internal (osxIncantations, getMacAppsForBuildableExecutors)+import Distribution.MacOSX.Internal (getMacAppsForBuildableExecutors) import Distribution.MacOSX.Common  macosxInternalTests :: Test macosxInternalTests = testGroup "Distribution.MacOSX.Internal"     [ mutuallyExclusive $ testGroup "MacOSX Internal"-        [ testCase "should exit with an exit-failure as Xcode's Carbon Tools fail to run" testCarbonTools,-          -- I should consider to use QuickCheck maybe... :)+        [ -- I should consider to use QuickCheck maybe... :)           testCase "given nothing then should not try to build any mac-app" testBuildMacApp_noInput,           testCase "given no executables then should not try to build any mac-app" testBuildMacApp_noExecutables,           testCase "given only two executables then should try to build two mac-apps" testBuildMacApp_twoBuildableExecutables,@@ -23,15 +20,6 @@           testCase "given two executables and one not executable and two apps then should try to build one mac-app" testBuildMacApp_twoAppsAndTwoExecutablesOneBuildableOneNot         ]     ]--testCarbonTools :: Assertion-testCarbonTools = do-    let macApp = MacApp "DummyApp" Nothing Nothing [] [] DoNotChase--    withSystemTempDirectory "DummyAppPath" $ \tmpDir-        -> osxIncantations tmpDir macApp -- some problems here to add `assertFailure` after-             `catch`-                 (\e -> putStrLn $ "Catched: " ++ show (e :: SomeException))  testBuildMacApp_noInput :: Assertion testBuildMacApp_noInput = do