Skip to content

Commit

Permalink
Configure for ghc-9.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed May 20, 2024
1 parent 501ba62 commit cfaa918
Show file tree
Hide file tree
Showing 11 changed files with 3,079 additions and 0 deletions.
4 changes: 4 additions & 0 deletions project-dhall/ghc-9.0.2/constraints.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ { dep = "dhall", ver = "1.41.1" }
, { dep = "dhall-json", ver = "1.7.10" }
, { dep = "hpack", ver = "0.35.0" }
]
4 changes: 4 additions & 0 deletions project-dhall/ghc-9.0.2/text-templates/cabal-snippet.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
''

program-options
ghc-options: -fhide-source-paths''
35 changes: 35 additions & 0 deletions project-dhall/ghc-9.0.2/text-templates/dhall2cabal.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
let TYPES = ./../../../updo/types.dhall

let empty-constraints = ./../../../updo/empty/constraints.dhall

let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall

let null = https://prelude.dhall-lang.org/List/null

in \(pkgs-done : List Text) ->
\(stackage-resolver : Text) ->
let pkgs-todo = ../../pkgs-upgrade-todo.dhall

let pkg-config =
{ constraints = ./../constraints.dhall ? empty-constraints
, source-pkgs =
{ deps-external = ./../deps-external.dhall ? empty-source-pkgs
, deps-internal = ./../deps-internal.dhall ? empty-source-pkgs
, forks-external = ./../forks-external.dhall ? empty-source-pkgs
, forks-internal = ./../forks-internal.dhall ? empty-source-pkgs
}
}

in ''
${../../../updo/text-templates/dhall2cabal.dhall
TYPES.Verbosity.Quiet
TYPES.Stackage.StackageLocal
stackage-resolver
( if null Text pkgs-todo
then TYPES.PkgSet.AllPkgs pkgs-done
else TYPES.PkgSet.PkgUpgrade
{ todo = pkgs-todo, done = pkgs-done }
)
pkg-config}
${./cabal-snippet.dhall}
''
34 changes: 34 additions & 0 deletions project-dhall/ghc-9.0.2/text-templates/dhall2stack.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
let TYPES = ./../../../updo/types.dhall

let empty-constraints = ./../../../updo/empty/constraints.dhall

let empty-source-pkgs = ./../../../updo/empty/source-pkgs.dhall

let null = https://prelude.dhall-lang.org/List/null

in \(pkgs-done : List Text) ->
\(stackage-resolver : Text) ->
let pkgs-todo = ../../pkgs-upgrade-todo.dhall

let pkg-config =
{ constraints = ./../constraints.dhall ? empty-constraints
, source-pkgs =
{ deps-external = ./../deps-external.dhall ? empty-source-pkgs
, deps-internal = ./../deps-internal.dhall ? empty-source-pkgs
, forks-external = ./../forks-external.dhall ? empty-source-pkgs
, forks-internal = ./../forks-internal.dhall ? empty-source-pkgs
}
}

in ''
${./stack-snippet.dhall (None Text)}
${../../../updo/text-templates/dhall2stack.dhall
TYPES.Verbosity.Quiet
stackage-resolver
( if null Text pkgs-todo
then TYPES.PkgSet.AllPkgs pkgs-done
else TYPES.PkgSet.PkgUpgrade
{ todo = pkgs-todo, done = pkgs-done }
)
pkg-config}
''
4 changes: 4 additions & 0 deletions project-dhall/ghc-9.0.2/text-templates/stack-snippet.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
\(_stackage-resolver : Optional Text) ->
''
user-message: "WARNING: This stack project is generated."
''
1 change: 1 addition & 0 deletions project-dhall/pkg-groups.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ "hpack-dhall" ]
1 change: 1 addition & 0 deletions project-dhall/pkgs-upgrade-todo.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[] : List Text
1 change: 1 addition & 0 deletions project-dhall/pkgs/hpack-dhall.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ "." ]
56 changes: 56 additions & 0 deletions project-files.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
CABAL_VIA ?= dhall2cabal

# How to generate project-nix/ghc-$(GHC_VERSION)/sha256map.nix?
# This is copied from ghc-$(GHC_VERSION).sha256map.nix.
# - false to generate from *.dhall inputs via sha256map.hs.
# - true to generate from stack.yaml via sha256map.py.
SHA256MAP_VIA_PYTHON ?= false

# To use installed executables instead of *.hs scripts, set these to true.
SHA256MAP_HS_EXE ?= false
PKG_GROUPS_HS_EXE ?= false
PKGS_SORTED_HS_EXE ?= false
PKGS_UPGRADE_DONE_HS_EXE ?= false

include project-versions.mk
include updo/Makefile

project-nix/ghc-%/sha256map.nix: ghc-%.sha256map.nix
mkdir -p $(@D) && cp $^ $@

.PHONY: all
all: \
projects \
project-nix/ghc-$(GHC_VERSION)/sha256map.nix \
project-versions.nix

# To make stack.yaml or cabal.project and no other, mark the file we copy from
# as intermediate. This is all we want when not doing a GHC upgrade.
#
# Comment out these .INTERMEDIATE targets to allow these files to be kept.
.INTERMEDIATE: ghc-$(GHC_VERSION).$(CABAL_VIA).project
.INTERMEDIATE: ghc-$(GHC_UPGRADE).$(CABAL_VIA).project
.INTERMEDIATE: ghc-$(GHC_VERSION).$(STACK_VIA).yaml
.INTERMEDIATE: ghc-$(GHC_UPGRADE).$(STACK_VIA).yaml
.INTERMEDIATE: ghc-$(GHC_VERSION).sha256map.nix
.INTERMEDIATE: ghc-$(GHC_UPGRADE).sha256map.nix

# If true, generate the sha256map from the stack.yaml with python,
# overriding the recipe for this target.
ifeq ($(SHA256MAP_VIA_PYTHON), true)
ghc-$(GHC_VERSION).sha256map.nix: stack.yaml
updo/project-nix/sha256map.py <$^ >$@
ghc-$(GHC_UPGRADE).sha256map.nix: stack.upgrade.yaml
updo/project-nix/sha256map.py <$^ >$@
endif

.DEFAULT_GOAL := all

UPDO_VERSION ?= a86c165687b2b5e8251265418a9c4181c6a651a0
UPDO_URL := https://github.com/cabalism/updo/archive/${UPDO_VERSION}.tar.gz

updo/Makefile:
rm -rf updo
curl -sSL ${UPDO_URL} | tar -xz
mv updo-* updo
chmod +x $$(grep -RIl '^#!' updo)
Loading

0 comments on commit cfaa918

Please sign in to comment.