1+ commit 45e5473fcd5707af93646d9a116867a4d4e3e9c9
2+ Author: Andreas Källberg <
[email protected] >
3+ Date: Mon Oct 10 14:57:12 2022 +0200
4+
5+ Revert "workaround for the Nix madness"
6+
7+ This reverts commit 1294269cd60f3db7b056135104615625baeb528c.
8+
9+ There are easier workarounds, like using
10+
11+ cabal v1-build
12+
13+ etc. instead of just `cabal build`
14+
15+ These changes also broke a whole bunch of other stuff
16+
17+ diff --git a/README.md b/README.md
18+ index ba35795a4..79e6ab68f 100644
19+ --- a/README.md
20+ +++ b/README.md
21+ @@ -38,21 +38,6 @@ or:
22+ ```
23+ stack install
24+ ```
25+ - Note that if you are unlucky to have Cabal 3.0 or later, then it uses
26+ - the so-called Nix style commands. Using those for GF development is
27+ - a pain. Every time when you change something in the source code, Cabal
28+ - will generate a new folder for GF to look for the GF libraries and
29+ - the GF cloud. Either reinstall everything with every change in the
30+ - compiler, or be sane and stop using cabal-install. Instead you can do:
31+ - ```
32+ - runghc Setup.hs configure
33+ - runghc Setup.hs build
34+ - sudo runghc Setup.hs install
35+ - ```
36+ - The script will install the GF dependencies globally. The only solution
37+ - to the Nix madness that I found is radical:
38+ -
39+ - "No person, no problem" (Нет человека – нет проблемы).
40+
41+ For more information, including links to precompiled binaries, see the [download page](https://www.grammaticalframework.org/download/index.html).
42+
43+ diff --git a/Setup.hs b/Setup.hs
44+ index 58dc3e0c6..f8309cc00 100644
45+ --- a/Setup.hs
46+ +++ b/Setup.hs
47+ @@ -4,68 +4,42 @@ import Distribution.Simple.LocalBuildInfo(LocalBuildInfo(..),absoluteInstallDirs
48+ import Distribution.Simple.Setup(BuildFlags(..),Flag(..),InstallFlags(..),CopyDest(..),CopyFlags(..),SDistFlags(..))
49+ import Distribution.PackageDescription(PackageDescription(..),emptyHookedBuildInfo)
50+ import Distribution.Simple.BuildPaths(exeExtension)
51+ - import System.Directory
52+ import System.FilePath((</>),(<.>))
53+ - import System.Process
54+ - import Control.Monad(forM_,unless)
55+ - import Control.Exception(bracket_)
56+ - import Data.Char(isSpace)
57+
58+ import WebSetup
59+
60+ + -- | Notice about RGL not built anymore
61+ + noRGLmsg :: IO ()
62+ + noRGLmsg = putStrLn "Notice: the RGL is not built as part of GF anymore. See https://github.com/GrammaticalFramework/gf-rgl"
63+ +
64+ main :: IO ()
65+ main = defaultMainWithHooks simpleUserHooks
66+ - { preConf = gfPreConf
67+ - , preBuild = gfPreBuild
68+ + { preBuild = gfPreBuild
69+ , postBuild = gfPostBuild
70+ , preInst = gfPreInst
71+ , postInst = gfPostInst
72+ , postCopy = gfPostCopy
73+ }
74+ where
75+ - gfPreConf args flags = do
76+ - pkgs <- fmap (map (dropWhile isSpace) . tail . lines)
77+ - (readProcess "ghc-pkg" ["list"] "")
78+ - forM_ dependencies $ \pkg -> do
79+ - let name = takeWhile (/='/') (drop 36 pkg)
80+ - unless (name `elem` pkgs) $ do
81+ - let fname = name <.> ".tar.gz"
82+ - callProcess "wget" [pkg,"-O",fname]
83+ - callProcess "tar" ["-xzf",fname]
84+ - removeFile fname
85+ - bracket_ (setCurrentDirectory name) (setCurrentDirectory ".." >> removeDirectoryRecursive name) $ do
86+ - exists <- doesFileExist "Setup.hs"
87+ - unless exists $ do
88+ - writeFile "Setup.hs" (unlines [
89+ - "import Distribution.Simple",
90+ - "main = defaultMain"
91+ - ])
92+ - let to_descr = reverse .
93+ - (++) (reverse ".cabal") .
94+ - drop 1 .
95+ - dropWhile (/='-') .
96+ - reverse
97+ - callProcess "wget" [to_descr pkg, "-O", to_descr name]
98+ - callProcess "runghc" ["Setup.hs","configure"]
99+ - callProcess "runghc" ["Setup.hs","build"]
100+ - callProcess "sudo" ["runghc","Setup.hs","install"]
101+ -
102+ - preConf simpleUserHooks args flags
103+ -
104+ - gfPreBuild args = gfPre args . buildDistPref
105+ - gfPreInst args = gfPre args . installDistPref
106+ + gfPreBuild args = gfPre args . buildDistPref
107+ + gfPreInst args = gfPre args . installDistPref
108+
109+ gfPre args distFlag = do
110+ return emptyHookedBuildInfo
111+
112+ gfPostBuild args flags pkg lbi = do
113+ + -- noRGLmsg
114+ let gf = default_gf lbi
115+ buildWeb gf flags (pkg,lbi)
116+
117+ gfPostInst args flags pkg lbi = do
118+ + -- noRGLmsg
119+ + saveInstallPath args flags (pkg,lbi)
120+ installWeb (pkg,lbi)
121+
122+ gfPostCopy args flags pkg lbi = do
123+ + -- noRGLmsg
124+ + saveCopyPath args flags (pkg,lbi)
125+ copyWeb flags (pkg,lbi)
126+
127+ -- `cabal sdist` will not make a proper dist archive, for that see `make sdist`
128+ @@ -73,16 +47,27 @@ main = defaultMainWithHooks simpleUserHooks
129+ gfSDist pkg lbi hooks flags = do
130+ return ()
131+
132+ - dependencies = [
133+ - "https://hackage.haskell.org/package/utf8-string-1.0.2/utf8-string-1.0.2.tar.gz",
134+ - "https://hackage.haskell.org/package/json-0.10/json-0.10.tar.gz",
135+ - "https://hackage.haskell.org/package/network-bsd-2.8.1.0/network-bsd-2.8.1.0.tar.gz",
136+ - "https://hackage.haskell.org/package/httpd-shed-0.4.1.1/httpd-shed-0.4.1.1.tar.gz",
137+ - "https://hackage.haskell.org/package/exceptions-0.10.5/exceptions-0.10.5.tar.gz",
138+ - "https://hackage.haskell.org/package/stringsearch-0.3.6.6/stringsearch-0.3.6.6.tar.gz",
139+ - "https://hackage.haskell.org/package/multipart-0.2.1/multipart-0.2.1.tar.gz",
140+ - "https://hackage.haskell.org/package/cgi-3001.5.0.0/cgi-3001.5.0.0.tar.gz"
141+ - ]
142+ + saveInstallPath :: [String] -> InstallFlags -> (PackageDescription, LocalBuildInfo) -> IO ()
143+ + saveInstallPath args flags bi = do
144+ + let
145+ + dest = NoCopyDest
146+ + dir = datadir (uncurry absoluteInstallDirs bi dest)
147+ + writeFile dataDirFile dir
148+ +
149+ + saveCopyPath :: [String] -> CopyFlags -> (PackageDescription, LocalBuildInfo) -> IO ()
150+ + saveCopyPath args flags bi = do
151+ + let
152+ + dest = case copyDest flags of
153+ + NoFlag -> NoCopyDest
154+ + Flag d -> d
155+ + dir = datadir (uncurry absoluteInstallDirs bi dest)
156+ + writeFile dataDirFile dir
157+ +
158+ + -- | Name of file where installation's data directory is recording
159+ + -- This is a last-resort way in which the seprate RGL build script
160+ + -- can determine where to put the compiled RGL files
161+ + dataDirFile :: String
162+ + dataDirFile = "DATA_DIR"
163+
164+ -- | Get path to locally-built gf
165+ default_gf :: LocalBuildInfo -> FilePath
166+ diff --git a/gf.cabal b/gf.cabal
167+ index a055b86be..d00a5b935 100644
168+ --- a/gf.cabal
169+ +++ b/gf.cabal
170+ @@ -2,7 +2,7 @@ name: gf
171+ version: 3.11.0-git
172+
173+ cabal-version: 1.22
174+ - build-type: Simple
175+ + build-type: Custom
176+ license: OtherLicense
177+ license-file: LICENSE
178+ category: Natural Language Processing, Compiler
179+ @@ -44,6 +44,14 @@ data-files:
180+ www/translator/*.css
181+ www/translator/*.js
182+
183+ + custom-setup
184+ + setup-depends:
185+ + base >= 4.9.1 && < 4.16,
186+ + Cabal >= 1.22.0.0,
187+ + directory >= 1.3.0 && < 1.4,
188+ + filepath >= 1.4.1 && < 1.5,
189+ + process >= 1.0.1.1 && < 1.7
190+ +
191+ source-repository head
192+ type: git
193+ location: https://github.com/GrammaticalFramework/gf-core.git
0 commit comments