From f24f96e0186a61ef5940ce97de2713413989b63c Mon Sep 17 00:00:00 2001
From: Joey Hess <joeyh@joeyh.name>
Date: Thu, 23 Feb 2023 10:35:19 -0400
Subject: [PATCH] move webapp build deps under Assistant build flag

git-annex.cabal: Move webapp build deps under the Assistant build flag so
git-annex can be built again without yesod etc installed.

Commit 78440ca37d75039d5eadd52eafbcd1751daba70a got rid of the webapp build
flag to work around what was apparently a cabal bug. It moved the webapp
build deps to the main build-depends list. But that prevents building
git-annex when yesod etc are not installed.

Putting them under the Assistant build flag seems to not tickle that cabal
bug, and lets git-annex build automatically with the assistant disabled
when the webapp build deps are not installed.

I hypotehesize that the problem may have involved build-depends nested
behind two build flags. Also, cabal clean may need to be run in order
for cabal to find the right solution after this change, when building in
a directory where cabal configure had been run before.

Also moved 3 modules that are needed to build git-annex w/o the assistant
out from under the Assistant build flag.

Sponsored-by: Brock Spratlen on Patreon
---
 CHANGELOG       |  2 ++
 git-annex.cabal | 37 +++++++++++++++++++------------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index a9dfdf469b..b833a04e23 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,8 @@ git-annex (10.20230215) UNRELEASED; urgency=medium
   * info: Fix reversion in last release involving handling of unsupported
     input by continuing to handle any other inputs, before exiting nonzero
     at the end.
+  * git-annex.cabal: Move webapp build deps under the Assistant build flag
+    so git-annex can be built again without yesod etc installed.
 
  -- Joey Hess <id@joeyh.name>  Tue, 14 Feb 2023 14:11:11 -0400
 
diff --git a/git-annex.cabal b/git-annex.cabal
index d3e0193005..349bda66bb 100644
--- a/git-annex.cabal
+++ b/git-annex.cabal
@@ -377,21 +377,7 @@ Executable git-annex
    aws (>= 0.20),
    DAV (>= 1.0),
    network (>= 3.0.0.0),
-   network-bsd,
-   mountpoints,
-   yesod (>= 1.4.3), 
-   yesod-static (>= 1.5.1),
-   yesod-form (>= 1.4.8),
-   yesod-core (>= 1.6.0),
-   path-pieces (>= 0.2.1),
-   warp (>= 3.2.8),
-   warp-tls (>= 3.2.2),
-   wai,
-   wai-extra,
-   blaze-builder,
-   clientsession,
-   template-haskell,
-   shakespeare (>= 2.0.11)
+   network-bsd
   CC-Options: -Wall
   GHC-Options: -Wall -fno-warn-tabs  -Wincomplete-uni-patterns
   Default-Language: Haskell2010
@@ -432,6 +418,21 @@ Executable git-annex
   
   if flag(Assistant) && ! os(solaris) && ! os(gnu)
     CPP-Options: -DWITH_ASSISTANT -DWITH_WEBAPP
+    Build-Depends:
+      mountpoints,
+      yesod (>= 1.4.3), 
+      yesod-static (>= 1.5.1),
+      yesod-form (>= 1.4.8),
+      yesod-core (>= 1.6.0),
+      path-pieces (>= 0.2.1),
+      warp (>= 3.2.8),
+      warp-tls (>= 3.2.2),
+      wai,
+      wai-extra,
+      blaze-builder,
+      clientsession,
+      template-haskell,
+      shakespeare (>= 2.0.11)
     Other-Modules:
       Assistant
       Assistant.Alert
@@ -447,8 +448,6 @@ Executable git-annex
       Assistant.Fsck
       Assistant.Gpg
       Assistant.Install
-      Assistant.Install.AutoStart
-      Assistant.Install.Menu
       Assistant.MakeRemote
       Assistant.MakeRepo
       Assistant.Monad
@@ -540,7 +539,6 @@ Executable git-annex
       Command.Watch
       Command.WebApp
       Utility.Mounts
-      Utility.OSX
       Utility.Yesod
       Utility.WebApp
     
@@ -673,6 +671,8 @@ Executable git-annex
     Annex.WorkerPool
     Annex.WorkTree
     Annex.YoutubeDl
+    Assistant.Install.AutoStart
+    Assistant.Install.Menu
     Backend
     Backend.External
     Backend.Hash
@@ -1115,6 +1115,7 @@ Executable git-annex
     Utility.Network
     Utility.NotificationBroadcaster
     Utility.OptParse
+    Utility.OSX
     Utility.PID
     Utility.PartialPrelude
     Utility.Path