@@ -4,21 +4,31 @@ class Agda < Formula
44 # agda2hs.cabal specifies BSD-3-Clause but it installs an MIT LICENSE file.
55 # Everything else specifies MIT license and installs corresponding file.
66 license all_of : [ "MIT" , "BSD-3-Clause" ]
7- revision 2
87
98 stable do
10- url "https://github.com/agda/agda/archive/refs/tags/v2.6.4.3-r1.tar.gz"
11- sha256 "15a0ebf08b71ebda0510c8cad04b053beeec653ed26e2c537614a80de8b2e132"
12- version "2.6.4.3"
9+ url "https://github.com/agda/agda/archive/refs/tags/v2.7.0.1.tar.gz"
10+ sha256 "4a2c0a76c55368e1b70b157b3d35a82e073a0df8f587efa1e9aa8be3f89235be"
1311
1412 resource "stdlib" do
15- url "https://github.com/agda/agda-stdlib/archive/refs/tags/v2.1.tar.gz"
16- sha256 "72ca3ea25094efa0439e106f0d949330414232ec4cc5c3c3316e7e70dd06d431"
13+ url "https://github.com/agda/agda-stdlib/archive/refs/tags/v2.2.tar.gz"
14+ sha256 "588f94af7fedd5aa1a6a1f0afdfb602d3e4615c7a17e6a0ae9dff326583b7a12"
15+
16+ # Backport support for building with GHC 9.12
17+ patch do
18+ url "https://github.com/agda/agda-stdlib/commit/a78700653de116b1043ce5d80bbe99482a705ecc.patch?full_index=1"
19+ sha256 "547af4793368a7b37d7b707cc25d0b87bab674233ed69d38d4d685c28e574a58"
20+ end
1721 end
1822
1923 resource "cubical" do
2024 url "https://github.com/agda/cubical/archive/refs/tags/v0.7.tar.gz"
2125 sha256 "25a0d1a0a01ba81888a74dfe864883547dbc1b06fa89ac842db13796b7389641"
26+
27+ # Bump Agda compat
28+ patch do
29+ url "https://github.com/agda/cubical/commit/6220641fc7c297a84c5e2c49614fae518cf6307d.patch?full_index=1"
30+ sha256 "c6919e394ac9dc6efa016fa6b4e9163ce58142d48f7100b6bc354678fc982986"
31+ end
2232 end
2333
2434 resource "categories" do
@@ -35,8 +45,8 @@ class Agda < Formula
3545 end
3646
3747 resource "agda2hs" do
38- url "https://github.com/agda/agda2hs/archive/refs/tags/v1.2 .tar.gz"
39- sha256 "e80ffc90ff2ccb3933bf89a39ab16d920a6c7a7461a6d182faa0fb6c0446dbb8 "
48+ url "https://github.com/agda/agda2hs/archive/refs/tags/v1.3 .tar.gz"
49+ sha256 "0e2c11eae0af459d4c78c24efadb9a4725d12c951f9d94da4adda5a0bcb1b6f6 "
4050 end
4151 end
4252
@@ -86,37 +96,30 @@ class Agda < Formula
8696
8797 def install
8898 agda2hs = buildpath /"agda2hs"
89- agdalib = lib / "agda"
99+ agdalib = pkgshare # for write permissions needed to re-generate .agdai when using different options
90100 cubicallib = agdalib /"cubical"
91101 categorieslib = agdalib /"categories"
92102
103+ # Add a backwards compatibility symlink. Can consider removing in a future release
104+ lib . install_symlink pkgshare
105+
93106 resource ( "agda2hs" ) . stage agda2hs
94107 resource ( "stdlib" ) . stage agdalib
95108 resource ( "cubical" ) . stage cubicallib
96109 resource ( "categories" ) . stage categorieslib
97110
98- # Backport part of https://github.com/agda/agda- stdlib/commit/a78700653de116b1043ce5d80bbe99482a705ecc
99- inreplace agdalib /"agda-stdlib-utils.cabal " , /( base .*) < 4 \. 21 $/ , "\\ 1 < 4.22" if build . stable?
111+ # Remove strict stdlib version check in categories
112+ inreplace categorieslib /"agda-categories.agda-lib " , /(standard-library)-2 \. 1 $/ , "\\ 1" , audit_result : build . stable?
100113
101114 ( buildpath /"cabal.project.local" ) . write <<~HASKELL
102115 packages: . #{ agda2hs }
103116 package Agda
104117 flags: +optimise-heavily
118+ -- Workaround for GHC 9.12 until official supported, https://github.com/agda/agda/issues/7574
119+ allow-newer: Agda:base, agda2hs:base, agda2hs:filepath
105120 HASKELL
106121
107- cabal_args = std_cabal_v2_args
108- # Workaround for GHC 9.12 until official support is available
109- # Issue ref: https://github.com/agda/agda/issues/7574
110- cabal_args += %w[
111- --allow-newer=Agda:base
112- --allow-newer=agda2hs:base
113- --allow-newer=agda2hs:filepath
114- ]
115- # Workaround for https://github.com/agda/agda/commit/e11ae9875470aab7b68b98d9d9574e736dbcaddd
116- if build . stable?
117- odie "Remove allow-newer hashable workaround!" if version > "2.6.4.3"
118- cabal_args << "--allow-newer=Agda:hashable"
119- end
122+ cabal_args = std_cabal_v2_args . map { |s | s . sub "=copy" , "=symlink" }
120123 # Reduce install size by dynamically linking to shared libraries in store-dir
121124 # TODO: Linux support, related issue https://github.com/haskell/cabal/issues/9784
122125 cabal_args += %w[ --enable-executable-dynamic --enable-shared ] if OS . mac?
@@ -161,12 +164,12 @@ module Everything where
161164
162165 # write out the example libraries and defaults files for users to copy
163166 ( agdalib /"example-libraries" ) . write <<~TEXT
164- #{ opt_lib } /agda /standard-library.agda-lib
165- #{ opt_lib } /agda /doc/standard-library-doc.agda-lib
166- #{ opt_lib } /agda /tests/standard-library-tests.agda-lib
167- #{ opt_lib } /agda /cubical/cubical.agda-lib
168- #{ opt_lib } /agda /categories/agda-categories.agda-lib
169- #{ opt_lib } /agda /agda2hs/agda2hs.agda-lib
167+ #{ opt_pkgshare } /standard-library.agda-lib
168+ #{ opt_pkgshare } /doc/standard-library-doc.agda-lib
169+ #{ opt_pkgshare } /tests/standard-library-tests.agda-lib
170+ #{ opt_pkgshare } /cubical/cubical.agda-lib
171+ #{ opt_pkgshare } /categories/agda-categories.agda-lib
172+ #{ opt_pkgshare } /agda2hs/agda2hs.agda-lib
170173 TEXT
171174 ( agdalib /"example-defaults" ) . write <<~TEXT
172175 standard-library
@@ -181,20 +184,20 @@ def caveats
181184 To use the installed Agda libraries, execute the following commands:
182185
183186 mkdir -p $HOME/.config/agda
184- cp #{ opt_lib } /agda /example-libraries $HOME/.config/agda/libraries
185- cp #{ opt_lib } /agda /example-defaults $HOME/.config/agda/defaults
187+ cp #{ opt_pkgshare } /example-libraries $HOME/.config/agda/libraries
188+ cp #{ opt_pkgshare } /example-defaults $HOME/.config/agda/defaults
186189
187190 You can then inspect the copied files and customize them as needed.
188191 EOS
189192 end
190193
191194 test do
192- Pathname ( "#{ Dir . home } /.config/agda" ) . install_symlink opt_lib / "agda/ example-libraries" => "libraries"
193- Pathname ( "#{ Dir . home } /.config/agda" ) . install_symlink opt_lib / "agda/ example-defaults" => "defaults"
195+ Pathname ( "#{ Dir . home } /.config/agda" ) . install_symlink opt_pkgshare / " example-libraries" => "libraries"
196+ Pathname ( "#{ Dir . home } /.config/agda" ) . install_symlink opt_pkgshare / " example-defaults" => "defaults"
194197
195198 simpletest = testpath /"SimpleTest.agda"
196199 simpletest . write <<~AGDA
197- {-# OPTIONS --safe --without-K #-}
200+ {-# OPTIONS --safe --cubical-compatible #-}
198201 module SimpleTest where
199202
200203 infix 4 _≡_
@@ -266,6 +269,7 @@ module IOTest where
266269 agda2hstest = testpath /"Agda2HsTest.agda"
267270 agda2hstest . write <<~AGDA
268271 {-# OPTIONS --erasure #-}
272+ module Agda2HsTest where
269273 open import Haskell.Prelude
270274
271275 _≤_ : {{Ord a}} → a → a → Set
@@ -302,9 +306,8 @@ module Agda2HsTest where
302306 # compile a simple module using the JS backend
303307 system bin /"agda" , "--js" , simpletest
304308
305- # test the GHC backend;
306- # compile and run a simple program
307- system bin /"agda" , "--ghc-flag=-fno-warn-star-is-type" , "--compile" , iotest
309+ # test the GHC backend; compile and run a simple program
310+ system bin /"agda" , "--compile" , iotest
308311 assert_empty shell_output ( testpath /"IOTest" )
309312
310313 # translate a simple file via agda2hs
0 commit comments