Setup.hs: Stop installing man pages, desktop files, and the git-annex-shell and git...
authorJoey Hess <joeyh@joeyh.name>
Tue, 1 Aug 2023 19:08:56 +0000 (15:08 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 1 Aug 2023 19:08:56 +0000 (15:08 -0400)
Anything still relying on that, eg via cabal v1-install will need to
change to using make install-home. Which was added back in 2019 in
6491b626140a9e5cc8e99fff4a1434d7c0e9bc39 because cabal new-build
(now the default) already didn't use Setup in a way that let its
installation of those things work.

Notably this means Setup does not need to depend on unix-compat, which is
useful because in 0.7 it removed System.PosixCompat.User, which Setup
needed to determine where to install the desktop files. See
https://github.com/haskell-pkg-janitors/unix-compat/issues/3

CHANGELOG
Setup.hs
git-annex.cabal

index 3845b4dd8ee2ffc30efb78b3c51d30c5f4ecf064..4500c650112af9beafb77168e5465451ef9ebf55 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -30,6 +30,10 @@ git-annex (10.20230627) UNRELEASED; urgency=medium
   * dropunused: Support --jobs
   * Support "onlyingroup=" in preferred content expressions.
   * Support --onlyingroup= matching option.
+  * Setup.hs: Stop installing man pages, desktop files, and the
+    git-annex-shell and git-remote-tor-annex symlinks.
+    Anything still relying on that, eg via cabal v1-install will need to
+    change to using make install-home.
 
  -- Joey Hess <id@joeyh.name>  Mon, 26 Jun 2023 13:10:40 -0400
 
index 57efd86e0c27fa4c67320f6acd90e8c0858557aa..a92d784b44c2cfc16b22d5cd15bdff576a22a3ff 100644 (file)
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,72 +1,13 @@
-{-# LANGUAGE NamedFieldPuns #-}
 {-# OPTIONS_GHC -fno-warn-tabs #-}
 
 {- cabal setup file -}
 
 import Distribution.Simple
-import Distribution.Simple.LocalBuildInfo
-import Distribution.Simple.Setup
-import Distribution.Simple.Utils (installOrdinaryFiles, rawSystemExit)
-import Distribution.PackageDescription (PackageDescription(..))
-import Distribution.Verbosity (Verbosity)
-import System.FilePath
-import Control.Applicative
-import Control.Monad
-import System.Directory
-import Data.List
-import Data.Maybe
-import Control.Exception
-import qualified System.Info
-
-import qualified Build.DesktopFile as DesktopFile
 import qualified Build.Configure as Configure
-import Build.Mans (buildMans)
-import Utility.SafeCommand
 
 main :: IO ()
 main = defaultMainWithHooks simpleUserHooks
        { preConf = \_ _ -> do
                Configure.run Configure.tests
                return (Nothing, [])    
-       , postCopy = myPostCopy
        }
-
-myPostCopy :: Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO ()
-myPostCopy _ flags pkg lbi = when (System.Info.os /= "mingw32") $ do
-       installGitAnnexLinks dest verbosity pkg lbi
-       installManpages      dest verbosity pkg lbi
-       installDesktopFile   dest verbosity pkg lbi
-  where
-       dest      = fromFlag $ copyDest flags
-       verbosity = fromFlag $ copyVerbosity flags
-
-installGitAnnexLinks :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
-installGitAnnexLinks copyDest verbosity pkg lbi = do
-       rawSystemExit verbosity "ln"
-               ["-sf", "git-annex", dstBinDir </> "git-annex-shell"]
-       rawSystemExit verbosity "ln"
-               ["-sf", "git-annex", dstBinDir </> "git-remote-tor-annex"]
-  where
-       dstBinDir = bindir $ absoluteInstallDirs pkg lbi copyDest
-
-{- See http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Installing_manpages -}
-installManpages :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
-installManpages copyDest verbosity pkg lbi =
-       installOrdinaryFiles verbosity dstManDir =<< srcManpages
-  where
-       dstManDir   = mandir (absoluteInstallDirs pkg lbi copyDest) </> "man1"
-       -- If mdwn2man fails, perhaps because perl is not available,
-       -- we just skip installing man pages.
-       srcManpages = zip (repeat "man") . map takeFileName . catMaybes
-               <$> buildMans
-
-installDesktopFile :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
-installDesktopFile copyDest _verbosity pkg lbi
-       | progfile copyDest == progfile NoCopyDest =
-               DesktopFile.installUser (progfile copyDest)
-                       `catch` installerror
-       | otherwise = return ()
-  where
-       progfile cd = bindir (absoluteInstallDirs pkg lbi cd) </> "git-annex"
-       installerror :: SomeException -> IO ()
-       installerror e = putStrLn ("Warning: Installation of desktop integration files did not succeed (" ++ show e ++ "); skipping.")
index 72a4c0f4f5f2f96ce78ed0f15ca7aa7b86d1cc4f..b0659496535ef2f1871bb8c7efa561e1096359e7 100644 (file)
@@ -299,13 +299,13 @@ source-repository head
   location: git://git-annex.branchable.com/
 
 custom-setup
-  Setup-Depends: base (>= 4.11.1.0 && < 5.0), split, unix-compat (< 0.7), 
-    filepath, exceptions, bytestring, IfElse, data-default,
+  Setup-Depends: base (>= 4.11.1.0 && < 5.0), split,
+    filepath, exceptions, bytestring,
     filepath-bytestring (>= 1.4.2.1.4),
     process (>= 1.6.3),
     time (>= 1.5.0),
     directory (>= 1.2.7.0),
-    async, utf8-string, transformers, Cabal (< 4.0)
+    async, Cabal (< 4.0)
 
 Executable git-annex
   Main-Is: git-annex.hs