From e53ccaf3bb3a9f28d8b05be8cb9ae264d0f51e7e Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Tue, 4 Jan 2022 13:46:00 -0500
Subject: [PATCH 1/5] Fix cabal project syntax

---
 cabal.project | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cabal.project b/cabal.project
index fc138fe..c0f585f 100644
--- a/cabal.project
+++ b/cabal.project
@@ -1,6 +1,6 @@
 allow-newer:
     -- for pipes-text
-    pipes-safe
+    pipes-safe,
     profunctors
 
 packages:
-- 
GitLab


From a56f513cb821d98e33465797b5e980138dbab679 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Tue, 4 Jan 2022 13:46:11 -0500
Subject: [PATCH 2/5] ci: Rework

---
 .gitlab-ci.yml | 69 +++++++++++++++++++++-----------------------------
 1 file changed, 29 insertions(+), 40 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6353f4e..e21bdc8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,3 @@
-image: registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine
 stages:
   - build
   - test
@@ -25,29 +24,44 @@ nix-build:
     - nix-build . -A env --cores 1 -j $THREADS | cachix push trec-car-tools
     - nix-store --export $(nix-store -qR ./result) > ./cache.nar
   cache:
+    key: nix
     paths:
       - ./cache.nar
 
-static-trec-car-dump:
+.build-static:
+  image: alpine:3.15
+  variables:
+    EXEC_NAME: TODO
   stage: build
   before_script:
+    - apk add curl xz xz-dev icu icu-dev icu-static zlib-static zlib-dev
+        binutils-gold curl gcc gmp-dev libc-dev libffi-dev make
+        musl-dev ncurses-dev perl tar xz git
+    - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
+    - source /root/.ghcup/env
     - ghc --version
-  script:
-    - sudo apk add xz xz-dev icu icu-dev icu-static zlib-static
     - cabal update
     - rm -Rf out
     - rm -Rf result
+  script:
+    - |
+      cat >cabal.project.local <<EOF
+      store-dir: /trec-car-tools-haskell/.cabal-store
+      package *
+        ghc-options: -optl=-static
+        executable-static: True
+        executable-dynamic: False
+        shared: False
+        static: True
+      EOF
+    - cabal build ${EXEC_NAME/#/exe:}
+    - rm -Rf result; mkdir -p result
     - |
-      cabal --store-dir=$(pwd)/.cabal-store \
-        v2-install \
-        --disable-shared --enable-static --enable-executable-static \
-        -fstatic --ghc-options='-optl=-static' \
-        --installdir=out --overwrite-policy=always \
-        exe:trec-car-dump exe:trec-car-build-toc exe:trec-car-trec-run-filter exe:trec-car-trec-run-modify exe:trec-car-qrels-modify exe:trec-car-cat
-    - rm -Rf result; mkdir -p result; cp -Lr out/trec-car-dump result/
+      for i in $EXEC_NAME; do
+        cp $(cabal list --store-dir=$(pwd)/.cabal-store exe:$i) result
+      done
     - ls -lh result
     - ls -lh out 
-
   cache:
     paths:
       - .cabal-store
@@ -56,32 +70,7 @@ static-trec-car-dump:
     paths:
       - result
 
-
-
 static-trec-car-build-toc:
-  stage: build
-  before_script:
-    - ghc --version
-  script:
-    - sudo apk add xz xz-dev icu icu-dev icu-static zlib-static
-    - cabal update
-    - rm -Rf out
-    - rm -Rf result
-    - |
-      cabal --store-dir=$(pwd)/.cabal-store \
-        v2-install \
-        --disable-shared --enable-static --enable-executable-static \
-        -fstatic --ghc-options='-optl=-static' \
-        --installdir=out --overwrite-policy=always \
-        exe:trec-car-dump exe:trec-car-build-toc exe:trec-car-trec-run-filter exe:trec-car-trec-run-modify exe:trec-car-qrels-modify exe:trec-car-cat
-    - rm -Rf result; mkdir -p result; cp -Lr out/trec-car-build-toc result/
-    - ls -lh result
-    - ls -lh out 
-
-  cache:
-    paths:
-      - .cabal-store
-  artifacts:
-    expire_in: 8 weeks
-    paths:
-      - result
+  extends: .build-static
+  variables:
+    EXEC_NAME: trec-car-dump trec-car-build-toc trec-car-trec-run-filter trec-car-trec-run-modify trec-car-qrels-modify trec-car-cat
-- 
GitLab


From ade26919bc10a7d5e8453ad33bc9c78cf0bc80d4 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Tue, 4 Jan 2022 20:53:46 -0500
Subject: [PATCH 3/5] Allow use of GHC 9.2

---
 simplir                             | 2 +-
 trec-car-types/trec-car-types.cabal | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/simplir b/simplir
index dc49b27..98168ae 160000
--- a/simplir
+++ b/simplir
@@ -1 +1 @@
-Subproject commit dc49b27218aefe9724a02a5bbc47da9eb3ae49c0
+Subproject commit 98168aedfe4e65eb8e417f2036c1a04150997ef6
diff --git a/trec-car-types/trec-car-types.cabal b/trec-car-types/trec-car-types.cabal
index 0929a75..67647fb 100644
--- a/trec-car-types/trec-car-types.cabal
+++ b/trec-car-types/trec-car-types.cabal
@@ -41,7 +41,7 @@ library
                        network-uri >=2.6 && <2.8,
                        base16-bytestring >=1.0 && <1.1,
                        vector >=0.12 && <0.13,
-                       lens >=4.17 && <4.20,
+                       lens >=4.17 && <5.2,
                        aeson >= 1.0,
                        dlist,
                        mmap,
-- 
GitLab


From 0bcb8dfc67b64aafbb107b81e38aca96cfbf3b6a Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Tue, 4 Jan 2022 20:54:09 -0500
Subject: [PATCH 4/5] Add cabal project file for GHC 9.2

---
 cabal.project.local.ghc-9.2 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 cabal.project.local.ghc-9.2

diff --git a/cabal.project.local.ghc-9.2 b/cabal.project.local.ghc-9.2
new file mode 100644
index 0000000..ae4c9f5
--- /dev/null
+++ b/cabal.project.local.ghc-9.2
@@ -0,0 +1,22 @@
+constraints:
+  containers >= 0.6,
+  streaming-commons >= 0.2.2.3,
+  attoparsec >= 0.14,
+  bytestring >= 0.11
+
+packages: ./pipes-lzma
+
+allow-newer: base, pipes-safe, ghc-prim, template-haskell, bytestring
+
+with-compiler: /nix/store/xhxc17xj4c7pr3pcaycvmq1drjldlg93-ghc-9.2.1/bin/ghc-9.2.1
+
+
+repository head.hackage.ghc.haskell.org
+   url: https://ghc.gitlab.haskell.org/head.hackage/
+   secure: True
+   key-threshold: 3
+   root-keys:
+       f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
+       26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
+       7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
+    
-- 
GitLab


From d985456b03ce740a9361e46a1b1ba8a85371b9cb Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Tue, 4 Jan 2022 20:55:30 -0500
Subject: [PATCH 5/5] ci: Try to fix static jobs

---
 .gitlab-ci.yml              | 6 +++++-
 cabal.project.local.ghc-9.2 | 7 ++-----
 simplir                     | 2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e21bdc8..9f4a201 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,22 +30,26 @@ nix-build:
 
 .build-static:
   image: alpine:3.15
+  allow_failure: true
   variables:
     EXEC_NAME: TODO
+    BOOTSTRAP_HASKELL_GHC_VERSION: 9.2.1
   stage: build
   before_script:
     - apk add curl xz xz-dev icu icu-dev icu-static zlib-static zlib-dev
         binutils-gold curl gcc gmp-dev libc-dev libffi-dev make
         musl-dev ncurses-dev perl tar xz git
+        leveldb leveldb-dev kyotocabinet kyotocabinet-dev bzip2 bzip2-dev
     - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
     - source /root/.ghcup/env
     - ghc --version
+    - cp cabal.project.local.ghc-9.2 cabal.project.local
     - cabal update
     - rm -Rf out
     - rm -Rf result
   script:
     - |
-      cat >cabal.project.local <<EOF
+      cat >>cabal.project.local <<EOF
       store-dir: /trec-car-tools-haskell/.cabal-store
       package *
         ghc-options: -optl=-static
diff --git a/cabal.project.local.ghc-9.2 b/cabal.project.local.ghc-9.2
index ae4c9f5..2945b64 100644
--- a/cabal.project.local.ghc-9.2
+++ b/cabal.project.local.ghc-9.2
@@ -1,16 +1,13 @@
+with-compiler: ghc-9.2.1
+
 constraints:
   containers >= 0.6,
   streaming-commons >= 0.2.2.3,
   attoparsec >= 0.14,
   bytestring >= 0.11
 
-packages: ./pipes-lzma
-
 allow-newer: base, pipes-safe, ghc-prim, template-haskell, bytestring
 
-with-compiler: /nix/store/xhxc17xj4c7pr3pcaycvmq1drjldlg93-ghc-9.2.1/bin/ghc-9.2.1
-
-
 repository head.hackage.ghc.haskell.org
    url: https://ghc.gitlab.haskell.org/head.hackage/
    secure: True
diff --git a/simplir b/simplir
index 98168ae..7a27d2e 160000
--- a/simplir
+++ b/simplir
@@ -1 +1 @@
-Subproject commit 98168aedfe4e65eb8e417f2036c1a04150997ef6
+Subproject commit 7a27d2ead959ad7347043d9599e288ab35c1f131
-- 
GitLab