Skip to content

Wip/cabal install v3.10.3.0 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 206 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
b32aea3
elim warning spam from 8500
gbaz Jan 24, 2023
22a0257
Merge pull request #8698 from haskell/mergify/bp/3.10/pr-8697
mergify[bot] Jan 24, 2023
0dad9e3
testuite: doctest: move to ghc recommended
ulysses4ever Oct 26, 2022
ebfb302
Merge pull request #8731 from haskell/mergify/bp/3.10/pr-8710
mergify[bot] Feb 4, 2023
9eed20d
Hack around CI problems by sudo chown and disabling cache for Windows…
Mikolaj Feb 8, 2023
1b0c8bc
Merge pull request #8758 from haskell/mergify/bp/3.10/pr-8739
mergify[bot] Feb 13, 2023
aac50e9
Work around ghcup cache woes also in our tiny CI scripts (#8743)
Mikolaj Feb 8, 2023
647d863
Merge pull request #8759 from haskell/mergify/bp/3.10/pr-8743
mergify[bot] Feb 13, 2023
b0bda36
Work around ghcup cache woes also in our dogfooding CI scripts
Mikolaj Feb 9, 2023
80f7029
Merge pull request #8760 from haskell/mergify/bp/3.10/pr-8749
mergify[bot] Feb 13, 2023
e98b1b1
Ensure js-sources are used only with JavaScript arch
wismill Feb 9, 2023
f97c4bb
Add test
wismill Feb 9, 2023
ec5cb9a
Merge pull request #8761 from haskell/mergify/bp/3.10/pr-8748
mergify[bot] Feb 13, 2023
7a619e6
Fix repl discarding --build-depends (#8732)
wismill Feb 11, 2023
05b0630
Merge pull request #8762 from haskell/mergify/bp/3.10/pr-8732
mergify[bot] Feb 13, 2023
cc75891
cabal-install: check: Whitelist doc file extensions (#8747)
wismill Feb 12, 2023
b4d3ca1
Merge pull request #8766 from haskell/mergify/bp/3.10/pr-8747
mergify[bot] Feb 14, 2023
00537e3
Revert "Fix project-local build flags being ignored."
Mikolaj Feb 8, 2023
0ef9285
Mark the test we are retaining as expected broken
Mikolaj Feb 8, 2023
280a7a7
Merge pull request #8768 from haskell/mergify/bp/3.10/pr-8744
mergify[bot] Feb 14, 2023
b1b0e33
don't auto-download in hash validation phase
gbaz Feb 15, 2023
0888913
Merge pull request #8777 from haskell/mergify/bp/3.10/pr-8769
mergify[bot] Feb 17, 2023
c206d1e
Update © year (#8775)
ffaf1 Feb 19, 2023
9e7c6f2
Merge pull request #8786 from haskell/mergify/bp/3.10/pr-8775
mergify[bot] Feb 20, 2023
cd3113b
Bump cabal-bootstrap-gen to GHC 9.4.4 ecosystem
nmeum Feb 1, 2023
f5430a9
Merge pull request #8774 from haskell/mergify/bp/3.10/pr-8720
mergify[bot] Feb 21, 2023
964049b
Disallow GHC <8.0 for Cabal{,-syntax} & cabal-install-solver (#8794)
Kleidukos Feb 23, 2023
105196f
Merge pull request #8798 from haskell/mergify/bp/3.10/pr-8794
mergify[bot] Feb 23, 2023
44a53dd
Bump cabal version numbers and bounds to 3.10 for release
Mikolaj Feb 23, 2023
8315ea7
Update boostrap files temporarily, for CI to pass
Mikolaj Feb 23, 2023
7de5460
Merge pull request #8799 from Mikolaj/version-bumps-for-3.10
mergify[bot] Feb 23, 2023
6149c64
doctests: switch to the preffered method of calling the tool
ulysses4ever Feb 4, 2023
14550da
Merge pull request #8804 from haskell/mergify/bp/3.10/pr-8735
mergify[bot] Feb 24, 2023
faa0be3
GHC 9.6 compatibility
ulysses4ever Feb 12, 2023
50c4240
CI: update actions/cache to v3
ulysses4ever Feb 22, 2023
4acdf8a
CI: add validation against GHC pre-release (currently: 9.6alpha3)
ulysses4ever Feb 22, 2023
bc7a1f1
Merge pull request #8806 from haskell/mergify/bp/3.10/pr-8805
mergify[bot] Feb 24, 2023
e72a225
Apply command line flags to install packages (#8637) (#8779)
patrickdoc Feb 24, 2023
b3b206e
Merge pull request #8811 from haskell/mergify/bp/3.10/pr-8779
mergify[bot] Feb 24, 2023
f7b791c
Doc: rm `-none` from constraint section, make `installed` prominent
andreasabel Feb 20, 2023
d677e2b
Build user's guide: bump to Python 3.10
andreasabel Feb 20, 2023
2ae57c4
Bump Sphinx to 5.3.0 and force certifi >= 2022.12.7
andreasabel Feb 24, 2023
db03fe1
Merge pull request #8812 from haskell/mergify/bp/3.10/pr-8789
mergify[bot] Feb 25, 2023
65f13c7
Fix #8756: doc: `extra-source-files` are tracked by `cabal build` (#8…
andreasabel Feb 25, 2023
3986ee1
Merge pull request #8814 from haskell/mergify/bp/3.10/pr-8765
mergify[bot] Feb 25, 2023
d186bc2
Update GitLab CI (#8818)
chreekat Mar 2, 2023
d570547
Merge pull request #8827 from haskell/mergify/bp/3.10/pr-8818
mergify[bot] Mar 2, 2023
d2aeedf
Add 3.10.1.0 changelogs and remove the used up tiny changlog files
Mikolaj Mar 6, 2023
3699fa5
Merge pull request #8834 from Mikolaj/changelogs-of-3.10.1.0
mergify[bot] Mar 8, 2023
eb0b028
Stabilize use of brew
chreekat Mar 9, 2023
4e7f673
Cache brew and the things it installs
chreekat Mar 9, 2023
6c95f3f
Merge pull request #8837 from haskell/mergify/bp/3.10/pr-8836
mergify[bot] Mar 9, 2023
59229c2
Split PLATFORM into ARCH and OS
chreekat Mar 14, 2023
7dfcdd8
Add aarch64-linux jobs
chreekat Mar 14, 2023
3c67da2
Improve name of Linux matrix build
chreekat Mar 14, 2023
8c3c34b
CI: disable prerelease validation
ulysses4ever Mar 14, 2023
8b17e2d
Merge pull request #8868 from haskell/mergify/bp/3.10/pr-8852
mergify[bot] Mar 21, 2023
2467d33
Merge pull request #8867 from haskell/mergify/bp/3.10/pr-8851
mergify[bot] Mar 21, 2023
7c74d6e
docs: cabal repl fresh-up
ulysses4ever Apr 17, 2023
44c5604
Merge pull request #8911 from haskell/mergify/bp/3.10/pr-8907
mergify[bot] Apr 20, 2023
022f4a7
Regenerate Lexer.hs with latest Alex (fix #8892)
hsyl20 Apr 4, 2023
3103b87
Lexer: report indentation warnings at column 1
hsyl20 Apr 17, 2023
4bfd6a0
Merge pull request #8921 from haskell/mergify/bp/3.10/pr-8896
mergify[bot] Apr 26, 2023
8e71243
add base to cabal install --lib default env file (#8903)
gbaz May 7, 2023
da41393
Merge pull request #8941 from haskell/mergify/bp/3.10/pr-8903
mergify[bot] May 8, 2023
dd429ff
Fix default Nix configuration option in generated ~/.cabal/config fil…
erinclemmer May 18, 2023
1799728
Instead of giving empty string on error, give the whole file
erinclemmer May 18, 2023
f59feb7
Remove options associated with #8839
erinclemmer May 18, 2023
b26a1bf
Remove option associated with #8788
erinclemmer May 18, 2023
5a83705
Merge pull request #8955 from haskell/mergify/bp/3.10/pr-8878
mergify[bot] May 19, 2023
ef8b2ec
Ignore ~/.cabal if $XDG_CONFIG_HOME/cabal/config exists. (#8877)
athas May 24, 2023
ac912f8
Merge pull request #8971 from haskell/mergify/bp/3.10/pr-8877
mergify[bot] May 24, 2023
cb3fe49
Put back docs for code-generators (fix #8887)
ulysses4ever May 24, 2023
8b365fa
Merge pull request #8973 from haskell/mergify/bp/3.10/pr-8969
mergify[bot] May 27, 2023
21a68a3
allow building with ghc-9.6
juhp May 22, 2023
6baf1e4
Shorten script-builds paths (backport #8898) (#8970)
mergify[bot] May 30, 2023
ad8279f
Do not check PVP on internal targets (#9004)
Kleidukos Jun 12, 2023
584fc87
Fix import and style
Kleidukos Jun 12, 2023
b71d7a3
Merge pull request #9013 from Kleidukos/backport-no-check-pvp-interna…
mergify[bot] Jun 17, 2023
f9339e7
Revert workaround to filter JavaScriptFFI out on GHC versions where G…
JoshMeredith Jun 2, 2023
bbed869
fix conflict
Kleidukos Jun 17, 2023
0466138
Add `Distribution.Client.Main`
sol Feb 21, 2023
199852e
Renamed cabal-install/driver/Main.hs to cabal-install/main/Main.hs
sol Feb 24, 2023
9f9c84a
Return empty default when git fails
BasLaa Feb 12, 2023
84d0103
Fix switched name and email guess
BasLaa Mar 1, 2023
7cd58a5
use with compiler flags in key of cached project config (#8819)
gbaz May 19, 2023
2edb879
Merge pull request #9031 from haskell/mergify/bp/3.10/pr-8793
mergify[bot] Jun 17, 2023
b3a8632
Merge pull request #9029 from haskell/mergify/bp/3.10/pr-8979
mergify[bot] Jun 17, 2023
d01a51b
Merge pull request #9027 from haskell/mergify/bp/3.10/pr-8819
mergify[bot] Jun 17, 2023
7de6ac2
Merge pull request #9032 from haskell/mergify/bp/3.10/pr-8755
mergify[bot] Jun 18, 2023
c97e487
Update SPDX license Ids & exceptions to 3.20 (#9028)
Kleidukos Jun 20, 2023
14f66da
Update Cabal{,-install,-syntax} to 3.10.2.0 (#9033)
Kleidukos Jun 23, 2023
9accc33
check: allow "haiku" as a valid OS string. (#9048)
jessicah Jun 28, 2023
08e94a7
Do not always pass `--quickjump` to haddock (backport #9049) (#9073)
mergify[bot] Jun 30, 2023
c7915c2
Document the pkg: prefix for package targets (backport #9015) (#9079)
mergify[bot] Jul 1, 2023
7b53e65
cabal-install: update resolv to 0.2.0.2
jessicah Jun 22, 2023
3b34367
Merge pull request #9083 from haskell/mergify/bp/3.10/pr-9069
mergify[bot] Jul 5, 2023
9c223f6
Bump deepseq bounds to allow 1.5
bgamari Jun 30, 2023
79ffd51
Merge pull request #9093 from haskell/mergify/bp/3.10/pr-9078
mergify[bot] Jul 9, 2023
2722e81
Avoid dodgy Rep (..) import in Cabal-syntax (backport #9071) (#9077)
ulysses4ever Jul 12, 2023
4bc59df
Merge pull request #9077 from haskell/mergify/bp/3.10/pr-9071
mergify[bot] Jul 12, 2023
b4ee369
Add new root keys (backport #9068) (#9080)
ulysses4ever Jul 12, 2023
f247c0b
Don't add `extra-prog-path` to `~/.config/cabal/config` (#8951) (back…
Kleidukos Jul 12, 2023
9b011a4
Merge pull request #9080 from haskell/mergify/bp/3.10/pr-9068
mergify[bot] Jul 12, 2023
5d86771
Merge pull request #9050 from haskell/mergify/bp/3.10/pr-8952
mergify[bot] Jul 13, 2023
2c16e65
Remove v2-prefix from Quickstart guide (backport #9087) (#9124)
ulysses4ever Jul 14, 2023
e08b465
Fix parsing of password-command option (#6268)
frasertweedale Jun 5, 2023
36a7f2f
Merge pull request #9124 from haskell/mergify/bp/3.10/pr-9087
mergify[bot] Jul 14, 2023
9939338
fix conflicts
ulysses4ever Jul 14, 2023
529f850
Merge pull request #9125 from haskell/mergify/bp/3.10/pr-9002
mergify[bot] Jul 14, 2023
8078074
cabal-install: Fix non-reinstallable package set (backport #9092) (#9…
Kleidukos Jul 20, 2023
3dd0f33
Fix build
Kleidukos Jul 20, 2023
a989f6a
remove duplicates in the code
Kleidukos Jul 20, 2023
bcabe6f
Merge pull request #9141 from haskell/mergify/bp/3.10/pr-9092
mergify[bot] Jul 26, 2023
9faa4db
Add the ExtendedLiterals extension (backport of #8992)
Kleidukos Aug 20, 2023
47eb77b
Filter out files that are not ending in .c from c-sources (#9200)
Kleidukos Aug 24, 2023
dcfdc9c
cleanup and document a global repo flag
gbaz Jun 28, 2023
ec86ddc
cleanup and document a global repo flag
gbaz Jun 28, 2023
483350b
Add changelogs for 3.10.2.0 (#9207)
Kleidukos Aug 26, 2023
97567fb
bump the version of cabal-install-solver
Kleidukos Aug 26, 2023
459c75e
haddock-packages fixes (#9213)
coot Aug 27, 2023
852d255
Bump the version in cabal-install
Kleidukos Aug 29, 2023
87882fe
Fix `prefer-oldest` documentation
ffaf1 Apr 14, 2023
1714b07
Merge pull request #8913 from haskell/mergify/bp/3.10/pr-8904
mergify[bot] Sep 4, 2023
3b74b68
Support GHC 9.8 in cabal 3.10.2.0 (#9225)
Kleidukos Sep 5, 2023
9093f32
PD check: do not treat library names as package names (#9132)
fgaz Jul 24, 2023
29e80e9
Merge pull request #9145 from haskell/mergify/bp/3.10/pr-9132
fgaz Sep 6, 2023
628e2db
Support text-2.1 in Cabal and Cabal-syntax (backport #9242) (#9243)
mergify[bot] Sep 11, 2023
390dc1c
Allow bytestring-0.12 (backport #9241) (#9257)
mergify[bot] Sep 14, 2023
720b6b1
Future-proof against potential Prelude.foldl' (backport #8960) (#9265)
mergify[bot] Sep 18, 2023
a1095e3
Revert "Update SPDX license Ids & exceptions to 3.20" (#9259)
Kleidukos Sep 19, 2023
4712f85
Revert "Add the ExtendedLiterals extension (backport of #8992)" (#9260)
Kleidukos Sep 20, 2023
de8a79f
Remove ExtendedLiterals from changelog for 3.10.2.0 (#9279)
Kleidukos Sep 20, 2023
15a0010
Fix overzealous warnOnTwoConfigs (backport #9278) (#9283)
mergify[bot] Sep 22, 2023
e2cc066
Relax extension `.c` requirement for c-sources (#9285)
hamishmack Oct 4, 2023
0f2350c
Bump base in cabal-dev-scripts.cabal (backport #9303) (#9311)
mergify[bot] Oct 5, 2023
ef03eec
Release CI: fixes and improvements (backport #9348) (#9349)
mergify[bot] Oct 18, 2023
e10b778
Release Cabal-3.10.2.1 (#9350)
Kleidukos Oct 18, 2023
066ddd8
Amend version number in the 3.10.2.1 changelog
Kleidukos Oct 18, 2023
fdbaf1c
Fix markdown syntax in changelog
Kleidukos Oct 30, 2023
e29e9e7
Bump to latest dependencies for GHC 9.8.1
andreasabel Oct 25, 2023
30f57fa
cabal.project: clean out obsolete `allow-newer`s
andreasabel Oct 31, 2023
b17d6f2
Bump cabal-install{-solver,} to 3.10.2.1 for GHC 9.8 compat (#9416)
Kleidukos Nov 7, 2023
5d97fcf
Use Paths_cabal_install for cabal-install version number (backport #9…
mergify[bot] Nov 22, 2023
25f972d
Make `check` recognise `TypeAbstractions`
ffaf1 Dec 8, 2023
3f51173
Merge pull request #9504 from ffaf1/add-extension-3.10
mergify[bot] Dec 9, 2023
5f8cdfa
Revert #3639 (Don't pass -package-db and -package flags to --abi-hash…
andreabedini Nov 4, 2023
83ecb5c
Merge pull request #9503 from haskell/mergify/bp/3.10/pr-9384
mergify[bot] Dec 15, 2023
c21eef4
cabal-install-solver: fix pkgconf 1.9 --modversion regression
juhp Nov 3, 2023
204948f
Merge pull request #9520 from haskell/mergify/bp/3.10/pr-9391
mergify[bot] Dec 15, 2023
8a35837
Use Base16 hash for script path.
jasagredo Nov 18, 2023
ebf64c5
Merge pull request #9483 from haskell/mergify/bp/3.10/pr-9459
mergify[bot] Dec 15, 2023
61d3c18
Migrate to haskell-actions/setup
andreabedini Nov 22, 2023
7553f8a
Merge pull request #9485 from haskell/mergify/bp/3.10/pr-9463
mergify[bot] Dec 16, 2023
96fa406
Relax upper bounds on filepath
hasufell Dec 15, 2023
b14a01d
Merge pull request #9532 from haskell/mergify/bp/3.10/pr-9523
mergify[bot] Dec 17, 2023
5fefcf5
`check`: add PackageInfo warning (#9525) (#9525)
ffaf1 Dec 21, 2023
8af26e3
Set `PKG_CONFIG_ALLOW_SYSTEM_(CFLAGS|LIBS)` by default
jasagredo Sep 18, 2023
d09cd57
Merge pull request #9550 from haskell/mergify/bp/3.10/pr-9134
mergify[bot] Dec 22, 2023
68159bc
Relax `tar` upper bound
ffaf1 Dec 23, 2023
f1a168a
Merge pull request #9597 from ffaf1/tar-backport
ffaf1 Jan 8, 2024
c805ff1
Account for .buildinfo in repl when build-type: Configure (backport #…
mergify[bot] Jan 12, 2024
5b2f3f7
update jinja2 per CVE-2024-22195
geekosaur Jan 16, 2024
8fa3eae
fix conflicts
geekosaur Jan 18, 2024
767973d
Merge pull request #9630 from haskell/mergify/bp/3.10/pr-9619
mergify[bot] Jan 20, 2024
2c0ab5b
Fix extra-prog-path propagation in the codebase.
jasagredo Dec 15, 2023
e2b045f
Honor build-tool-depends in CmdRun
xsebek Oct 21, 2023
f8be891
Resolve backporting conflicts
jasagredo Jan 18, 2024
1ced344
Merge pull request #9629 from haskell/mergify/bp/3.10/pr-9527
mergify[bot] Jan 22, 2024
db41660
Allow containers-0.7
geekosaur Jan 24, 2024
5807b8d
Merge pull request #9652 from haskell/mergify/bp/3.10/pr-9297
mergify[bot] Jan 24, 2024
53e8c38
Relax `containers` upper bound
ffaf1 Jan 22, 2024
e5a204d
Merge pull request #9653 from haskell/mergify/bp/3.10/pr-9643
mergify[bot] Jan 24, 2024
d4dff63
Ignore invalid Unicode in pkg-config descriptions (#9609)
tomsmeding Jan 25, 2024
9f9b5bd
Merge pull request #9658 from haskell/mergify/bp/3.10/pr-9609
mergify[bot] Jan 25, 2024
40f9073
Add extraLibDirs to runtime lib search paths of library
alt-romes Nov 15, 2023
6af97ba
Merge pull request #9639 from haskell/mergify/bp/3.10/pr-9554
mergify[bot] Jan 25, 2024
1972a17
Generate changelogs for 3.10.3.0 (#9661)
Kleidukos Jan 31, 2024
5ba05c2
Cabal: Allow Win32-2.14
bgamari Jan 31, 2024
eba45a3
Merge pull request #9685 from haskell/mergify/bp/3.10/pr-9679
Mikolaj Feb 8, 2024
098036b
Bump a number of dependencies
ffaf1 Feb 1, 2024
a386599
Merge pull request #9698 from haskell/mergify/bp/3.10/pr-9686
Mikolaj Feb 8, 2024
1666013
Allow zlib-0.7 (backport #9703) (#9709)
mergify[bot] Feb 13, 2024
34b7558
Bump version numbers to 3.10.3.0
Kleidukos Feb 20, 2024
3d88dab
Revert "Bump version numbers to 3.10.3.0"
Kleidukos Feb 20, 2024
1da02f1
Bump version numbers to 3.10.3.0 (#9728)
Kleidukos Feb 21, 2024
b333a7e
Update .cabal files
ffaf1 Mar 1, 2024
3f82401
Merge pull request #9780 from haskell/mergify/bp/3.10/pr-9761
mergify[bot] Mar 5, 2024
ce72f63
backport: Find build-tool installed programs before programs in path …
alt-romes Mar 11, 2024
256f85d
Backport of #9443 "Use linker capability detection to improve linker …
Kleidukos Mar 12, 2024
38499c6
Migrate release CI back to github
hasufell Nov 13, 2023
d955fc6
Use cabal 3.6.2.0-p1 since the armv7 binary is better
hasufell Jan 4, 2024
086b810
Use GHC 9.2.1 on alpine 32bit, because 9.2.8 bindist doesn't install
hasufell Jan 4, 2024
16c7866
Remove void musl
hasufell Jan 4, 2024
372ecee
Install tar on void
hasufell Jan 4, 2024
a50e354
Fix yaml snippet script
hasufell Jan 4, 2024
b7c7cab
Set constraints to fix bugs in dependencies
hasufell Mar 19, 2024
18c4cab
Update actions and docker images
hasufell Mar 19, 2024
b271394
Updates/fixes
hasufell Mar 19, 2024
f270d8d
Fixes
hasufell Mar 19, 2024
546537f
Build against recent deps
hasufell Mar 19, 2024
85ae7ec
Fix zlib
hasufell Mar 19, 2024
6aade43
Update validate pipeline
hasufell Mar 19, 2024
0ed0328
Add FreeBSD
hasufell Mar 19, 2024
589a066
Update release scripts
hasufell Mar 19, 2024
05fe812
Fixes
hasufell Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
31 changes: 31 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# release CI for FreeBSD
compute_engine_instance:
image_project: freebsd-org-cloud-dev
image: family/freebsd-13-2
platform: freebsd
disk: 100 # Gb

build_task:
timeout_in: 120m
only_if: $CIRRUS_TAG != ''
env:
ADD_CABAL_ARGS: "--enable-split-sections"
ARCH: 64
ARTIFACT: "x86_64-portbld-freebsd"
CIRRUS_CLONE_SUBMODULES: true
DISTRO: na
GHC_VERSION: 9.2.8
GITHUB_WORKSPACE: ${CIRRUS_WORKING_DIR}
RUNNER_OS: FreeBSD
TARBALL_EXT: tar.xz
TZ: Asia/Singapore
install_script:
- sed -i.bak -e 's/quarterly/latest/' /etc/pkg/FreeBSD.conf
- pkg install -y ghc hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake llvm14 patchelf tree gmp libiconv
script:
- tzsetup Etc/GMT
- adjkerntz -a
- bash .github/scripts/build.sh
binaries_artifacts:
path: "out/*"

17 changes: 17 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -57,6 +57,23 @@ pull_request_rules:
- label=merge me
- base!=master
- body~=backport
- label=merge delay passed
- '#approved-reviews-by>=1'

# merge+squash strategy for backports: require 1 approver instead of 2
- actions:
queue:
name: default
method: squash
# both update methods get absorbed by the squash, so we use the most
# reliable
update_method: merge
name: Put pull requests in the squash+merge queue
conditions:
- label=merge me
- base!=master
- body~=backport
- label=merge delay passed
- '#approved-reviews-by>=1'

# backports should be labeled as such
28 changes: 28 additions & 0 deletions .github/scripts/brew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

set -eux

# shellcheck disable=SC1091
. .github/scripts/env.sh

if [ -e "$HOME/.brew" ] ; then
(
cd "$HOME/.brew"
git fetch --depth 1
git reset --hard origin/master
)
else
git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.brew"
fi
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"

mkdir -p "$CI_PROJECT_DIR/.brew_cache"
export HOMEBREW_CACHE="$CI_PROJECT_DIR/.brew_cache"
mkdir -p "$CI_PROJECT_DIR/.brew_logs"
export HOMEBREW_LOGS="$CI_PROJECT_DIR/.brew_logs"
mkdir -p /private/tmp/.brew_tmp
export HOMEBREW_TEMP=/private/tmp/.brew_tmp

#brew update
brew install ${1+"$@"}

66 changes: 66 additions & 0 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

set -eux

# shellcheck disable=SC1091
. .github/scripts/env.sh
# shellcheck disable=SC1091
. .github/scripts/common.sh

uname -a
uname -p
uname
pwd
env

# ensure ghcup
install_ghcup

# build
ghcup install ghc "${GHC_VERSION}"
ghcup set ghc "${GHC_VERSION}"
sed -i.bak -e '/DELETE MARKER FOR CI/,/END DELETE/d' cabal.project # see comment in cabal.project
ecabal update
ecabal user-config diff
ecabal user-config init -f
"ghc-${GHC_VERSION}" --info
"ghc" --info

# https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
if [ "$(getconf LONG_BIT)" == "32" ] || [ "${DISTRO}" == "CentOS" ] ; then
echo 'constraints: lukko -ofd-locking' >> cabal.project.release.local
fi

# shellcheck disable=SC2206
args=(
-w "ghc-$GHC_VERSION"
--disable-profiling
--enable-executable-stripping
--project-file=cabal.project.release
${ADD_CABAL_ARGS}
)

run cabal v2-build "${args[@]}" cabal-install

mkdir -p "$CI_PROJECT_DIR/out"
# shellcheck disable=SC2154
cp "$(cabal list-bin "${args[@]}" cabal-install:exe:cabal)" "$CI_PROJECT_DIR/out/cabal$ext"
cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json"
cd "$CI_PROJECT_DIR/out/"

# create tarball/zip
TARBALL_PREFIX="cabal-install-$("$CI_PROJECT_DIR/out/cabal" --numeric-version)"
case "${TARBALL_EXT}" in
zip)
zip "${TARBALL_PREFIX}-${ARTIFACT}.${TARBALL_EXT}" "cabal${ext}" plan.json
;;
tar.xz)
tar caf "${TARBALL_PREFIX}-${ARTIFACT}.${TARBALL_EXT}" "cabal${ext}" plan.json
;;
*)
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}"
;;
esac

rm cabal plan.json

110 changes: 110 additions & 0 deletions .github/scripts/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/bin/bash

# shellcheck disable=SC1091
. .github/scripts/env.sh

# Colors
RED="0;31"
LT_BROWN="1;33"
LT_BLUE="1;34"

ecabal() {
cabal "$@"
}

nonfatal() {
"$@" || "$* failed"
}

sha_sum() {
if [ "${RUNNER_OS}" = "FreeBSD" ] ; then
sha256 "$@"
else
sha256sum "$@"
fi
}

git_describe() {
git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*"
git describe --always
}

install_ghcup() {
# find "$GHCUP_INSTALL_BASE_PREFIX"
mkdir -p "$GHCUP_BIN"
mkdir -p "$GHCUP_BIN"/../cache

if [ "${RUNNER_OS}" = "FreeBSD" ] ; then
curl -o ghcup https://downloads.haskell.org/ghcup/tmp/x86_64-portbld-freebsd-ghcup-0.1.18.1
chmod +x ghcup
mv ghcup "$HOME/.local/bin/ghcup"
else
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_MINIMAL=1 sh
source "$(dirname "${GHCUP_BIN}")/env"
ghcup install cabal --set "${BOOTSTRAP_HASKELL_CABAL_VERSION}"
fi
}

strip_binary() {
(
set -e
local binary=$1
case "$(uname -s)" in
"Darwin"|"darwin")
;;
MSYS_*|MINGW*)
;;
*)
strip -s "${binary}"
;;
esac
)
}

# GitLab Pipelines log section delimiters
# https://gitlab.com/gitlab-org/gitlab-foss/issues/14664
start_section() {
name="$1"
echo -e "section_start:$(date +%s):$name\015\033[0K"
}

end_section() {
name="$1"
echo -e "section_end:$(date +%s):$name\015\033[0K"
}

echo_color() {
local color="$1"
local msg="$2"
echo -e "\033[${color}m${msg}\033[0m"
}

error() { echo_color "${RED}" "$1"; }
warn() { echo_color "${LT_BROWN}" "$1"; }
info() { echo_color "${LT_BLUE}" "$1"; }

fail() { error "error: $1"; exit 1; }

run() {
info "Running $*..."
"$@" || ( error "$* failed"; return 1; )
}

emake() {
if command -v gmake >/dev/null 2>&1 ; then
gmake "$@"
else
make "$@"
fi
}

mktempdir() {
case "$(uname -s)" in
"Darwin"|"darwin")
mktemp -d -t cabal_ci.XXXXXXX
;;
*)
mktemp -d
;;
esac
}
42 changes: 42 additions & 0 deletions .github/scripts/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

mkdir -p "$HOME"/.local/bin

if [ "${RUNNER_OS}" = "Windows" ] ; then
ext=".exe"
else
# shellcheck disable=SC2034
ext=''
fi

export PATH="$HOME/.local/bin:$PATH"

export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
export BOOTSTRAP_HASKELL_CABAL_VERSION="${CABAL_VER:-3.6.2.0-p1}"
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=no
export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes
export BOOTSTRAP_HASKELL_ADJUST_BASHRC=1

if [ "${RUNNER_OS}" = "freebsd" ] ; then
export RUNNER_OS=FreeBSD
fi

if [ "${RUNNER_OS}" = "Windows" ] ; then
# on windows use pwd to get unix style path
CI_PROJECT_DIR="$(pwd)"
export CI_PROJECT_DIR
export GHCUP_INSTALL_BASE_PREFIX="/c"
export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin"
export PATH="$GHCUP_BIN:$PATH"
export CABAL_DIR="C:\\Users\\runneradmin\\AppData\\Roaming\\cabal"
else
export CI_PROJECT_DIR="${GITHUB_WORKSPACE}"
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin"
export PATH="$GHCUP_BIN:$PATH"
export CABAL_DIR="$CI_PROJECT_DIR/cabal"
export CABAL_CACHE="$CI_PROJECT_DIR/cabal-cache"
fi

export DEBIAN_FRONTEND=noninteractive
export TZ=Asia/Singapore
15 changes: 13 additions & 2 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -19,10 +19,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
ghc: ["8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.3"]
ghc: ["8.10.7", "9.0.2", "9.2.8", "9.4.8"]
include:
- os: macos-latest
ghc: "9.2.3"
ghc: "9.2.8"
name: Bootstrap ${{ matrix.os }} ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
steps:
@@ -35,9 +35,20 @@ jobs:
restore-keys: bootstrap-${{ runner.os }}-${{ matrix.ghc }}-20221115-

- uses: actions/checkout@v3
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: bootstrap.py
run: |
GHC_VERSION=${{ matrix.ghc }}
ghcup --version
ghcup config set cache true
ghcup install ghc $GHC_VERSION
10 changes: 9 additions & 1 deletion .github/workflows/changelogs.yml
Original file line number Diff line number Diff line change
@@ -29,10 +29,18 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: linux-store-changelogs
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo mkdir -p /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: ghcup
run: |
ghcup config set cache true
49 changes: 29 additions & 20 deletions .github/workflows/quick-jobs.yml
Original file line number Diff line number Diff line change
@@ -24,19 +24,30 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: linux-store-meta
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: ghcup
run: |
ghcup --version
ghcup config set cache true
ghcup install ghc recommended
ghcup set ghc recommended
- name: Update Hackage index
run: cabal v2-update
- name: Install alex
run: cabal v2-install alex --constraint='alex ==3.2.6'
run: cabal v2-install alex --constraint='alex ==3.2.7.3'
- uses: actions/checkout@v3
- name: Regenerate files
run: |
@@ -54,32 +65,30 @@ jobs:
- name: Set PATH
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- name: Install cabal-env
run: |
mkdir -p $HOME/.cabal/bin
curl -sL https://github.com/phadej/cabal-extras/releases/download/preview-20191225/cabal-env-snapshot-20191225-x86_64-linux.xz > cabal-env.xz
echo "1b567d529c5f627fd8c956e57ae8f0d9f11ee66d6db34b7fb0cb1c370b4edf01 cabal-env.xz" | sha256sum -c -
xz -d < cabal-env.xz > $HOME/.cabal/bin/cabal-env
rm -f cabal-env.xz
chmod a+x $HOME/.cabal/bin/cabal-env
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: linux-store-doctest
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: ghcup
run: |
ghcup --version
ghcup config set cache true
ghcup install ghc 8.10.7
ghcup set ghc 8.10.7
ghcup install ghc --set recommended
ghcup install cabal --set latest
- name: Update Hackage index
run: cabal v2-update
- name: Install doctest
run: cabal v2-install doctest
- name: Install libraries
run: |
cabal-env --transitive QuickCheck
cabal-env array bytestring containers deepseq directory filepath pretty process time binary unix text parsec mtl
cat $HOME/.ghc/*/environments/default
- uses: actions/checkout@v3
- name: Install doctest
run: make doctest-install
- name: Doctest
run: make doctest
433 changes: 433 additions & 0 deletions .github/workflows/release.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/users-guide.yml
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
224 changes: 138 additions & 86 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -6,11 +6,6 @@ defaults:
run:
shell: bash

# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

on:
push:
branches:
@@ -19,14 +14,15 @@ on:
release:
types:
- created
workflow_dispatch:

env:
# We choose a stable ghc version across all os's
# which will be used to do the next release
GHC_FOR_RELEASE: '9.2.3'
GHC_FOR_RELEASE: '9.2.8'
# Ideally we should use the version about to be released for hackage tests and benchmarks
GHC_FOR_SOLVER_BENCHMARKS: '9.2.3'
GHC_FOR_COMPLETE_HACKAGE_TESTS: '9.2.3'
GHC_FOR_SOLVER_BENCHMARKS: '9.2.8'
GHC_FOR_COMPLETE_HACKAGE_TESTS: '9.2.8'
COMMON_FLAGS: '-j 2 -v'

jobs:
@@ -38,34 +34,34 @@ jobs:
strategy:
matrix:
os: ["ubuntu-20.04", "macos-latest", "windows-latest"]
ghc: ["9.4.2", "9.2.3", "9.0.2", "8.10.7", "8.8.4", "8.6.5", "8.4.4"]
exclude:
# corrupts GHA cache or the fabric of reality itself, see https://github.com/haskell/cabal/issues/8356
- os: "windows-latest"
ghc: "8.10.7"
# lot of segfaults caused by ghc bugs
- os: "windows-latest"
ghc: "8.8.4"
# it also throws segfaults randomly
- os: "windows-latest"
ghc: "8.4.4"
# it often randomly does "C:\Users\RUNNER~1\AppData\Local\Temp\ghcFEDE.c: DeleteFile "\\\\?\\C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\ghcFEDE.c": permission denied (Access is denied.)"
- os: "windows-latest"
ghc: "8.6.5"
ghc: ["9.2.8"]

steps:

- uses: actions/checkout@v3

- uses: haskell/actions/setup@v2
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.8.1.0'
cabal-version: '3.10.1.0'

# See the following link for a breakdown of the following step
# https://github.com/haskell/actions/issues/7#issuecomment-745697160
- uses: actions/cache@v2
#
# See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded
- if: ${{ runner.os != 'Windows' }}
uses: actions/cache@v3
with:
# validate.sh uses a special build dir
path: |
@@ -174,74 +170,136 @@ jobs:
if: matrix.cli != 'false'
run: sh validate.sh $FLAGS -s cli-suite

validate-old-ghcs:
name: Validate old ghcs ${{ matrix.extra-ghc }}
runs-on: ubuntu-20.04
needs: validate
# This job needs an older ubuntu (16.04) cause
# the required old ghcs using the `-dyn` flavour
# are not installable from ppa/hvr in newer ones
# see https://github.com/haskell/cabal/issues/8011
container:
image: phadej/ghc:8.8.4-xenial

# The job below is a copy-paste of validate with the necessary tweaks
# to make all work with an upcoming GHC. Those tweaks include:
# - ghcup needs the prerelease channel activated
# - allow-newer for base libraries and Cabal* libraries
# - (sometimes) disabling some parts on Windows because it's hard to figure
# out why they fail
validate-prerelease:
# TODO: reenable when the next GHC prerelease appears
if: false

name: Validate ${{ matrix.os }} ghc-prerelease
runs-on: ${{ matrix.os }}
outputs:
GHC_FOR_RELEASE: ${{ format('["{0}"]', env.GHC_FOR_RELEASE) }}
strategy:
matrix:
# Newer ghc versions than 8.8.4 have to be installed with ghcup cause
# they are not available in ppa/hvr. The ghcup installation
# needs `sudo` which is not available in the xenial container
ghc: ["8.8.4"]
extra-ghc: ["7.10.3", "7.8.4", "7.6.3", "7.4.2", "7.2.2", "7.0.4"]
os: ["ubuntu-20.04", "macos-latest", "windows-latest"]

steps:

# We can't use actions/checkout with the xenial docker container
# cause it does not work with the git version included in it, see:
# https://github.com/actions/checkout/issues/170
# https://github.com/actions/checkout/issues/295
# - uses: actions/checkout@v3
- name: Checkout
run: |
echo $GITHUB_REF $GITHUB_SHA
git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git .
git fetch origin $GITHUB_SHA:temporary-ci-branch
git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA)
- uses: actions/checkout@v3

- name: Install extra compiler
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
apt-get update
apt-get install -y ghc-${{ matrix.extra-ghc }}-dyn
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.8.1.0'
- name: ghcup
run: |
ghcup --version
ghcup config set cache true
ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml
ghcup install ghc --set 9.6.0.20230210
ghcup install cabal --set latest
ghc --version
cabal update
# As we are reusing the cached build dir from the previous step
# the generated artifacts are available here,
# including the cabal executable and the test suite
- uses: actions/cache@v2
# See the following link for a breakdown of the following step
# https://github.com/haskell/actions/issues/7#issuecomment-745697160
#
# See https://github.com/haskell/cabal/pull/8739 for why Windows is excluded
- if: ${{ runner.os != 'Windows' }}
uses: actions/cache@v3
with:
# validate.sh uses a special build dir
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-*
key: ${{ runner.os }}-${{ matrix.ghc }}-20220419-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-20220419-

- name: Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546)
run: |
git config --global protocol.file.allow always
# The '+exe' constraint below is important, otherwise cabal-install
# might decide to build the library but not the executable which is
# what we need.
- name: Install cabal-plan
run: |
cd $(mktemp -d)
cabal install cabal-plan --constraint='cabal-plan +exe'
cabal install cabal-plan --constraint='cabal-plan +exe' --allow-newer
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
# The tool is not essential to the rest of the test suite. If
# hackage-repo-tool is not present, any test that requires it will
# be skipped.
# We want to keep this in the loop but we don't want to fail if
# hackage-repo-tool breaks or fails to support a newer GHC version.
- name: Install hackage-repo-tool
continue-on-error: true
run: |
cd $(mktemp -d)
cabal install hackage-repo-tool
# Needed by cabal-testsuite/PackageTests/Configure/setup.test.hs
- name: Install Autotools
if: runner.os == 'macOS'
run: |
brew install automake
- name: Allow newer boot libraries
run: |
echo "allow-newer: base, template-haskell, ghc-prim, Cabal-syntax, Cabal-described, Cabal, cabal-install-solver, cabal-install" >> cabal.project.validate
- name: Set validate inputs
run: |
FLAGS="${{ env.COMMON_FLAGS }}"
if [[ "${{ matrix.cli }}" == "false" ]]; then
FLAGS="$FLAGS --lib-only"
fi
echo "FLAGS=$FLAGS" >> $GITHUB_ENV
- name: Validate print-config
run: sh validate.sh $FLAGS -s print-config

- name: Validate print-tool-versions
run: sh validate.sh $FLAGS -s print-tool-versions

- name: Validate build
run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build
run: sh validate.sh $FLAGS -s build

- name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}"
- name: Validate lib-tests
env:
EXTRA_GHC: "/opt/ghc/${{ matrix.extra-ghc }}/bin/ghc-${{ matrix.extra-ghc }}"
run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc ${{ env.EXTRA_GHC }}
# `rawSystemStdInOut reports text decoding errors`
# test does not find ghc without the full path in windows
GHCPATH: ${{ steps.setup-haskell.outputs.ghc-exe }}
run: sh validate.sh $FLAGS -s lib-tests

- name: Validate lib-suite
# see https://github.com/haskell/cabal/pull/8754#issuecomment-1435025848
# for discussion about the trouble on Windows
if: ${{ runner.os != 'Windows' }}
run: sh validate.sh $FLAGS -s lib-suite

- name: Validate cli-tests
if: matrix.cli != 'false'
run: sh validate.sh $FLAGS -s cli-tests

- name: Validate cli-suite
# see https://github.com/haskell/cabal/pull/8754#issuecomment-1435025848
# for discussion about the trouble on Windows
if: ( runner.os != 'Windows' ) && ( matrix.cli != 'false' )
run: sh validate.sh $FLAGS -s cli-suite

# The previous jobs use a released version of cabal to build cabal HEAD itself
# This one uses the cabal HEAD generated executable in the previous step
@@ -261,7 +319,17 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: haskell/actions/setup@v2
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
@@ -290,19 +358,3 @@ jobs:
- name: Build using cabal HEAD
run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s build

# We use this job as a summary of the workflow
# It will fail if any of the previous jobs does it
# This way we can use it exclusively in branch protection rules
# and abstract away the concrete jobs of the workflow, including their names
validate-post-job:
if: always()
name: Validate post job
runs-on: ubuntu-20.04
# IMPORTANT! Any job added to the workflow should be added here too
needs: [validate, validate-old-ghcs, dogfooding]

steps:
- run: |
echo "jobs info: ${{ toJSON(needs) }}"
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
11 changes: 10 additions & 1 deletion .github/workflows/whitespace.yml
Original file line number Diff line number Diff line change
@@ -31,6 +31,15 @@ jobs:
path: "~/.local/bin"
key: fix-whitespace-${{ env.fix-whitespace-ver }}

# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo mkdir -p /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- uses: haskell/actions/setup@v2
if: ${{ !steps.cache.outputs.cache-hit }}
with:
@@ -40,7 +49,7 @@ jobs:
- name: Install fix-whitespace
if: ${{ !steps.cache.outputs.cache-hit }}
run: |
cabal install --ignore-project --install-method=copy --installdir=$HOME/.local/bin fix-whitespace-${{ env.fix-whitespace-ver }}
cabal install --constraint=aeson==2.1.2.1 --ignore-project --install-method=copy --installdir=$HOME/.local/bin fix-whitespace-${{ env.fix-whitespace-ver }}
strip $HOME/.local/bin/fix-whitespace
- name: Check the whitespace issue
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@ register.sh
# windows test artifacts
cabal-testsuite/**/*.exe
cabal-testsuite/**/*.bat
cabal-testsuite/**/haddocks

# python artifacts from documentation builds
*.pyc
113 changes: 44 additions & 69 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
stages:
- build

# Used for ci setup in the gitlab mirror of the project:
# https://gitlab.haskell.org/haskell/haskell-language-server/-/pipelines
variables:
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: "9e4c540d9e4972a36291dfdf81f079f37d748890"
DOCKER_REV: "572353e0644044fe3a5465bba4342a9a0b0eb60e"

GHC_VERSION: 9.2.3
CABAL_INSTALL_VERSION: 3.6.2.0
@@ -28,87 +26,59 @@ workflow:
paths:
- out/*

build-aarch64-linux-deb10:
build-linux:
extends: .build
parallel:
matrix:
- ARCH: i386
TAG: x86_64-linux
OS:
- deb9
- ARCH: x86_64
TAG: x86_64-linux
OS:
- centos7
- deb9
- fedora33
- rocky8
- ubuntu18_04
- ubuntu20_04
- deb10
- deb11
- ARCH: aarch64
TAG: aarch64-linux
OS:
- deb10
- deb11
tags:
- aarch64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb10:$DOCKER_REV"
- $TAG
image: "registry.gitlab.haskell.org/ghc/ci-images/$PLATFORM:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: aarch64-linux-deb10
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""

build-armv7-linux-deb10:
extends: .build
tags:
- armv7-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb10:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: armv7-linux-deb1
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""
# temp, because 3.6.2.0 is broken
CABAL_INSTALL_VERSION: 3.4.0.0
retry: 2

build-x86_64-linux:
extends: .build
tags:
- x86_64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-linux-deb10
PLATFORM: "${ARCH}-linux-${OS}"
TARBALL_ARCHIVE_SUFFIX: $PLATFORM
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections"

build-x86_64-linux-deb11:
extends: .build
tags:
- x86_64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb11:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-linux-deb11
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections"

build-x86_64-linux-alpine:
build-linux-alpine:
extends: .build
parallel:
matrix:
- ARCH: i386
OS: [alpine3_12]
GHC_VERSION: 9.0.2
- ARCH: x86_64
OS: [alpine3_12]
tags:
- x86_64-linux
before_script:
# for cabal build
- sudo apk add --no-cache zlib zlib-dev zlib-static
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-linux-alpine
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"

build-i386-linux-alpine:
extends: .build
tags:
- x86_64-linux
image: "i386/alpine:3.12"
before_script:
# for GHC
- apk add --no-cache bash curl gcc g++ binutils binutils-gold bsd-compat-headers gmp-dev ncurses-dev libffi-dev make xz tar perl
# for cabal build
- apk add --no-cache zlib zlib-dev zlib-static
image: "registry.gitlab.haskell.org/ghc/ci-images/$PLATFORM:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: i386-linux-alpine
PLATFORM: "${ARCH}-linux-${OS}"
TARBALL_ARCHIVE_SUFFIX: $PLATFORM
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"
# temp, because 3.6.2.0 is broken
CABAL_INSTALL_VERSION: 3.4.0.0

build-x86_64-freebsd12:
extends: .build
tags:
- x86_64-freebsd12
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-freebsd12
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections"

build-x86_64-darwin:
extends: .build
@@ -143,10 +113,15 @@ build-aarch64-darwin:
TARBALL_ARCHIVE_SUFFIX: aarch64-darwin
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""
# Update periodically.
BREW_VERSION: 4.0.5
artifacts:
expire_in: 2 week
paths:
- out/*
cache:
paths:
- .brew

build-x86_64-windows:
extends: .build
14 changes: 11 additions & 3 deletions .gitlab/brew.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/usr/bin/env bash

set -Eeuxo pipefail
set -Eeuo pipefail

# Install brew locally in the project dir. Packages will also be installed here.
[ -e "$CI_PROJECT_DIR/.brew" ] || git clone --depth=1 https://github.com/Homebrew/brew $CI_PROJECT_DIR/.brew
export PATH="$CI_PROJECT_DIR/.brew/bin:$CI_PROJECT_DIR/.brew/sbin:$PATH"
# FIXME: Use brew in supported way. See
# https://docs.brew.sh/Installation#untar-anywhere-unsupported
brew_dir="${CI_PROJECT_DIR}/.brew"

if [ ! -e "${brew_dir}" ]; then
mkdir -p "${brew_dir}"
curl -L "https://github.com/Homebrew/brew/archive/refs/tags/${BREW_VERSION}.tar.gz" | tar xz --strip 1 -C "${brew_dir}"
fi

export PATH="${brew_dir}/bin:${brew_dir}/sbin:$PATH"

# make sure to not pollute the machine with temp files etc
mkdir -p $CI_PROJECT_DIR/.brew_cache
12 changes: 9 additions & 3 deletions .gitlab/ci.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -Eeuxo pipefail
set -Eeuo pipefail

source "$CI_PROJECT_DIR/.gitlab/common.sh"

@@ -26,8 +26,9 @@ export PATH="$GHCUP_BINDIR:$PATH"
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION
export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_INSTALL_VERSION
export BOOTSTRAP_HASKELL_VERBOSE=1
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes
# We don't use stack, and it isn't available on i386-deb9
export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes

# for some reason the subshell doesn't pick up the arm64 environment on darwin
# and starts installing x86_64 GHC
@@ -48,7 +49,11 @@ case "$(uname -s)" in
esac

# https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
if [ "$(getconf LONG_BIT)" == "32" ] ; then
# and
# https://github.com/haskellari/lukko/issues/17
#
# $PLATFORM comes from CI.
if [ "$(getconf LONG_BIT)" = "32" -o "${PLATFORM:=xxx}" = "x86_64-linux-centos7" ] ; then
echo 'constraints: lukko -ofd-locking' >> cabal.project.release.local
fi

@@ -60,6 +65,7 @@ args=(
${ADD_CABAL_ARGS}
)

run cabal update hackage.haskell.org,HEAD
run cabal v2-build ${args[@]} cabal-install

mkdir "$CI_PROJECT_DIR/out"
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,11 @@ version: 2
sphinx:
configuration: doc/conf.py

build:
os: "ubuntu-22.04"
tools:
python: "3.8"

python:
version: 3.7
install:
- requirements: doc/requirements.txt
6 changes: 3 additions & 3 deletions Cabal-QuickCheck/Cabal-QuickCheck.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: Cabal-QuickCheck
version: 3.9.0.0
version: 3.10.1.0
synopsis: QuickCheck instances for types in Cabal
category: Testing
description:
@@ -13,8 +13,8 @@ library
build-depends:
, base
, bytestring
, Cabal ^>=3.9.0.0
, Cabal-syntax ^>=3.9.0.0
, Cabal ^>=3.10.0.0
, Cabal-syntax ^>=3.10.0.0
, QuickCheck ^>=2.13.2 || ^>=2.14

exposed-modules:
6 changes: 3 additions & 3 deletions Cabal-described/Cabal-described.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: Cabal-described
version: 3.9.0.0
version: 3.10.1.0
synopsis: Described functionality for types in Cabal
category: Testing, Parsec
description: Provides rere bindings
@@ -11,8 +11,8 @@ library
ghc-options: -Wall
build-depends:
, base
, Cabal ^>=3.9.0.0
, Cabal-syntax ^>=3.9.0.0
, Cabal ^>=3.10.0.0
, Cabal-syntax ^>=3.10.0.0
, containers
, pretty
, QuickCheck
18 changes: 9 additions & 9 deletions Cabal-syntax/Cabal-syntax.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 2.2
name: Cabal-syntax
version: 3.9.0.0
copyright: 2003-2022, Cabal Development Team (see AUTHORS file)
version: 3.10.3.0
copyright: 2003-2023, Cabal Development Team (see AUTHORS file)
license: BSD-3-Clause
license-file: LICENSE
author: Cabal Development Team <cabal-devel@haskell.org>
@@ -15,7 +15,7 @@ description:
category: Distribution
build-type: Simple

extra-source-files:
extra-doc-files:
README.md ChangeLog.md

source-repository head
@@ -29,17 +29,17 @@ library

build-depends:
array >= 0.4.0.1 && < 0.6,
base >= 4.6 && < 5,
base >= 4.9 && < 5,
binary >= 0.7 && < 0.9,
bytestring >= 0.10.0.0 && < 0.12,
containers >= 0.5.0.0 && < 0.7,
deepseq >= 1.3.0.1 && < 1.5,
bytestring >= 0.10.0.0 && < 0.13,
containers >= 0.5.0.0 && < 0.8,
deepseq >= 1.3.0.1 && < 1.6,
directory >= 1.2 && < 1.4,
filepath >= 1.3.0.1 && < 1.5,
filepath >= 1.3.0.1 && < 1.6,
mtl >= 2.1 && < 2.4,
parsec >= 3.1.13.0 && < 3.2,
pretty >= 1.1.1 && < 1.2,
text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.1),
text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.2),
time >= 1.4.0.1 && < 1.13,
-- transformers-0.4.0.0 doesn't have record syntax e.g. for Identity
-- See also https://github.com/ekmett/transformers-compat/issues/35
2 changes: 1 addition & 1 deletion Cabal-syntax/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Please see https://hackage.haskell.org/package/Cabal/changelog
Please see See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.3.0.md
2 changes: 1 addition & 1 deletion Cabal-syntax/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2003-2022, Cabal Development Team.
Copyright (c) 2003-2023, Cabal Development Team.
See the AUTHORS file for the full list of copyright holders.

See */LICENSE for the copyright holders of the subcomponents.
1 change: 1 addition & 0 deletions Cabal-syntax/src/Distribution/CabalSpecVersion.hs
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ data CabalSpecVersion
| CabalSpecV3_4
| CabalSpecV3_6
| CabalSpecV3_8
-- 3.10: no changes
deriving (Eq, Ord, Show, Read, Enum, Bounded, Typeable, Data, Generic)

instance Binary CabalSpecVersion
8 changes: 4 additions & 4 deletions Cabal-syntax/src/Distribution/Compat/Prelude.hs
Original file line number Diff line number Diff line change
@@ -130,10 +130,9 @@ module Distribution.Compat.Prelude (

-- We also could hide few partial function
import Prelude as BasePrelude hiding
( mapM, mapM_, sequence, null, length, foldr, any, all, head, tail, last, init
( mapM, mapM_, sequence, any, all, head, tail, last, init
-- partial functions
, read
, foldr1, foldl1
#if MINVER_base_411
-- As of base 4.11.0.0 Prelude exports part of Semigroup(..).
-- Hide this so we instead rely on Distribution.Compat.Semigroup.
@@ -142,8 +141,9 @@ import Prelude as BasePrelude hiding
, Word
-- We hide them, as we import only some members
, Traversable, traverse, sequenceA
, Foldable, foldMap
, Foldable(..)
)
import Data.Foldable as BasePrelude (foldl, elem, sum, product, maximum, minimum)

-- AMP
import Data.Foldable
@@ -186,7 +186,7 @@ import Data.Word (Word, Word16, Word32, Word64, Word8)
import Distribution.Compat.Binary (Binary (..))
import Distribution.Compat.Semigroup (Semigroup (..), gmappend, gmempty)
import Distribution.Compat.Typeable (TypeRep, Typeable, typeRep)
import GHC.Generics ((:*:) ((:*:)), (:+:) (L1, R1), Generic, K1 (unK1), M1 (unM1), Rep (..), U1 (U1), V1)
import GHC.Generics (Generic (..), K1 (unK1), M1 (unM1), U1 (U1), V1, (:*:) ((:*:)), (:+:) (L1, R1))
import System.Exit (ExitCode (..), exitFailure, exitSuccess, exitWith)
import Text.Read (readMaybe)

321 changes: 207 additions & 114 deletions Cabal-syntax/src/Distribution/Fields/Lexer.hs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Cabal-syntax/src/Distribution/Fields/LexerMonad.hs
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ module Distribution.Fields.LexerMonad (
LexWarning(..),
LexWarningType(..),
addWarning,
addWarningAt,
toPWarnings,

) where
@@ -153,3 +154,8 @@ setStartCode c = Lex $ \s -> LexResult s{ curCode = c } ()
addWarning :: LexWarningType -> Lex ()
addWarning wt = Lex $ \s@LexState{ curPos = pos, warnings = ws } ->
LexResult s{ warnings = LexWarning wt pos : ws } ()

-- | Add warning at specific position
addWarningAt :: Position -> LexWarningType -> Lex ()
addWarningAt pos wt = Lex $ \s@LexState{ warnings = ws } ->
LexResult s{ warnings = LexWarning wt pos : ws } ()
3 changes: 3 additions & 0 deletions Cabal-syntax/src/Distribution/Fields/Parser.hs
Original file line number Diff line number Diff line change
@@ -47,6 +47,9 @@ import qualified Data.Text.Encoding as T
import qualified Data.Text.Encoding.Error as T
#endif

-- $setup
-- >>> import Data.Either (isLeft)

-- | The 'LexState'' (with a prime) is an instance of parsec's 'Stream'
-- wrapped around lexer's 'LexState' (without a prime)
data LexState' = LexState' !LexState (LToken, LexState')
5 changes: 1 addition & 4 deletions Cabal-syntax/src/Distribution/InstalledPackageInfo.hs
Original file line number Diff line number Diff line change
@@ -62,9 +62,6 @@ import qualified Text.PrettyPrint as Disp
import Distribution.Types.InstalledPackageInfo
import Distribution.Types.InstalledPackageInfo.FieldGrammar

-- $setup
-- >>> :set -XOverloadedStrings

installedComponentId :: InstalledPackageInfo -> ComponentId
installedComponentId ipi =
case unComponentId (installedComponentId_ ipi) of
@@ -127,7 +124,7 @@ showFullInstalledPackageInfo = P.showFields (const NoComment) . prettyFieldGramm

-- |
--
-- >>> let ipi = emptyInstalledPackageInfo { maintainer = "Tester" }
-- >>> let ipi = emptyInstalledPackageInfo { maintainer = fromString "Tester" }
-- >>> fmap ($ ipi) $ showInstalledPackageInfoField "maintainer"
-- Just "maintainer: Tester"
showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String)
8 changes: 4 additions & 4 deletions Cabal-syntax/src/Distribution/Types/Dependency.hs
Original file line number Diff line number Diff line change
@@ -77,16 +77,16 @@ instance NFData Dependency where rnf = genericRnf

-- |
--
-- >>> prettyShow $ Dependency "pkg" anyVersion mainLibSet
-- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion mainLibSet
-- "pkg"
--
-- >>> prettyShow $ Dependency "pkg" anyVersion $ NES.insert (LSubLibName "sublib") mainLibSet
-- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib") mainLibSet
-- "pkg:{pkg, sublib}"
--
-- >>> prettyShow $ Dependency "pkg" anyVersion $ NES.singleton (LSubLibName "sublib")
-- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib")
-- "pkg:sublib"
--
-- >>> prettyShow $ Dependency "pkg" anyVersion $ NES.insert (LSubLibName "sublib-b") $ NES.singleton (LSubLibName "sublib-a")
-- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib-b") $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib-a")
-- "pkg:{sublib-a, sublib-b}"
--
instance Pretty Dependency where
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Distribution.Types.GenericPackageDescription (
@@ -86,15 +85,14 @@ instance L.HasBuildInfos GenericPackageDescription where
<*> (traverse . L._2 . traverseCondTreeBuildInfo) f x4
<*> (traverse . L._2 . traverseCondTreeBuildInfo) f x5
<*> (traverse . L._2 . traverseCondTreeBuildInfo) f x6
where

-- We use this traversal to keep [Dependency] field in CondTree up to date.
traverseCondTreeBuildInfo
:: forall f comp v. (Applicative f, L.HasBuildInfo comp)
=> LensLike' f (CondTree v [Dependency] comp) L.BuildInfo
traverseCondTreeBuildInfo g = node where
mkCondNode :: comp -> [CondBranch v [Dependency] comp] -> CondTree v [Dependency] comp
mkCondNode comp branches = CondNode comp (view L.targetBuildDepends comp) branches
mkCondNode comp = CondNode comp (view L.targetBuildDepends comp)

node (CondNode comp _ branches) = mkCondNode
<$> L.buildInfo g comp
1 change: 0 additions & 1 deletion Cabal-syntax/src/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeInType #-}
-- |
--
-- Copyright: (c) 2019 Oleg Grenrus
36 changes: 18 additions & 18 deletions Cabal-tests/Cabal-tests.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 2.2
name: Cabal-tests
version: 3
copyright: 2003-2022, Cabal Development Team (see AUTHORS file)
copyright: 2003-2023, Cabal Development Team (see AUTHORS file)
license: BSD-3-Clause
license-file: LICENSE
author: Cabal Development Team <cabal-devel@haskell.org>
@@ -51,7 +51,7 @@ test-suite unit-tests
build-depends:
array
, async >=2.2.2 && <2.3
, base >=0 && <5
, base >=4.9 && <5
, binary
, bytestring
, Cabal
@@ -60,15 +60,15 @@ test-suite unit-tests
, Cabal-QuickCheck
, containers
, deepseq
, Diff >=0.4 && <0.5
, Diff >=0.4 && <0.6
, directory
, filepath
, integer-logarithms >=1.0.2 && <1.1
, pretty
, QuickCheck >=2.14 && <2.15
, rere >=0.1 && <0.3
, tagged
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-hunit
, tasty-quickcheck
, temporary
@@ -84,18 +84,18 @@ test-suite parser-tests
main-is: ParserTests.hs
build-depends:
base
, base-compat >=0.11.0 && <0.13
, base-compat >=0.11.0 && <0.14
, bytestring
, Cabal-syntax
, Cabal-tree-diff
, Diff >=0.4 && <0.5
, Diff >=0.4 && <0.6
, directory
, filepath
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-golden >=2.3.1.1 && <2.4
, tasty-hunit
, tasty-quickcheck
, tree-diff >=0.1 && <0.3
, tree-diff >=0.1 && <0.4

ghc-options: -Wall
default-language: Haskell2010
@@ -109,10 +109,10 @@ test-suite check-tests
, bytestring
, Cabal
, Cabal-syntax
, Diff >=0.4 && <0.5
, Diff >=0.4 && <0.6
, directory
, filepath
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-expected-failure
, tasty-golden >=2.3.1.1 && <2.4

@@ -155,13 +155,13 @@ test-suite hackage-tests
, filepath

build-depends:
base-compat >=0.11.0 && <0.13
, base-orphans >=0.6 && <0.9
base-compat >=0.11.0 && <0.14
, base-orphans >=0.6 && <0.10
, clock >=0.8 && <0.9
, optparse-applicative >=0.13.2.0 && <0.17
, optparse-applicative >=0.13.2.0 && <0.19
, stm >=2.4.5.0 && <2.6
, tar >=0.5.0.3 && <0.6
, tree-diff >=0.1 && <0.3
, tar >=0.5.0.3 && <0.7
, tree-diff >=0.1 && <0.4

ghc-options: -Wall -rtsopts -threaded
default-extensions: CPP
@@ -178,7 +178,7 @@ test-suite rpmvercmp

build-depends:
QuickCheck
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-hunit
, tasty-quickcheck

@@ -197,10 +197,10 @@ test-suite no-thunks-test
base
, bytestring
, Cabal-syntax
, tasty >=1.2.3 && <1.5
, tasty >=1.2.3 && <1.6
, tasty-hunit

-- this is test is buildable on old GHCs
-- but it doesn't do anything.
if impl(ghc >=8.6)
build-depends: nothunks >=0.1.1.0 && <0.2
build-depends: nothunks >=0.1.1.0 && <0.3
2 changes: 1 addition & 1 deletion Cabal-tests/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2003-2022, Cabal Development Team.
Copyright (c) 2003-2023, Cabal Development Team.
See the AUTHORS file for the full list of copyright holders.

See */LICENSE for the copyright holders of the subcomponents.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Octree-0.5.cabal:39:3: Non breaking spaces at 39:3, 41:3, 43:3
Octree-0.5.cabal:39:1: Non breaking spaces at 39:1, 41:1, 43:1
cabal-version: >=1.8
name: Octree
version: 0.5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
monad-param.cabal:19:3: Tabs used as indentation at 19:3, 20:3
monad-param.cabal:19:1: Tabs used as indentation at 19:1, 20:1
name: monad-param
version: 0.0.1
license: BSD3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
th-lift-instances.cabal:15:9: Tabs used as indentation at 15:9
th-lift-instances.cabal:15:1: Tabs used as indentation at 15:1
cabal-version: >=1.10
name: th-lift-instances
version: 0.1.4
3 changes: 2 additions & 1 deletion Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs
Original file line number Diff line number Diff line change
@@ -5,8 +5,9 @@
#endif
module UnitTests.Distribution.Utils.CharSet where

import Prelude hiding (Foldable(..))
import Data.Char (isAlpha, isAlphaNum)
import Data.List (foldl')
import Data.Foldable (foldl')
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.HUnit (testCase, (@?=))

8 changes: 4 additions & 4 deletions Cabal-tree-diff/Cabal-tree-diff.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: Cabal-tree-diff
version: 3.9.0.0
version: 3.10.1.0
synopsis: QuickCheck instances for types in Cabal
category: Testing
description: Provides tree-diff ToExpr instances for some types in Cabal
@@ -11,9 +11,9 @@ library
ghc-options: -Wall
build-depends:
, base
, Cabal-syntax ^>=3.9.0.0
, Cabal ^>=3.9.0.0
, tree-diff ^>=0.1 || ^>=0.2
, Cabal-syntax ^>=3.10.0.0
, Cabal ^>=3.10.0.0
, tree-diff ^>=0.1 || ^>=0.2 || ^>=0.3

exposed-modules: Data.TreeDiff.Instances.Cabal
other-modules:
22 changes: 11 additions & 11 deletions Cabal/Cabal.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 2.2
name: Cabal
version: 3.9.0.0
copyright: 2003-2022, Cabal Development Team (see AUTHORS file)
version: 3.10.3.0
copyright: 2003-2023, Cabal Development Team (see AUTHORS file)
license: BSD-3-Clause
license-file: LICENSE
author: Cabal Development Team <cabal-devel@haskell.org>
@@ -21,7 +21,7 @@ build-type: Simple
-- If we use a new Cabal feature, this needs to be changed to Custom so
-- we can bootstrap.

extra-source-files:
extra-doc-files:
README.md ChangeLog.md

source-repository head
@@ -34,20 +34,20 @@ library
hs-source-dirs: src

build-depends:
Cabal-syntax ^>= 3.9,
Cabal-syntax ^>= 3.10,
array >= 0.4.0.1 && < 0.6,
base >= 4.6 && < 5,
bytestring >= 0.10.0.0 && < 0.12,
containers >= 0.5.0.0 && < 0.7,
deepseq >= 1.3.0.1 && < 1.5,
base >= 4.9 && < 5,
bytestring >= 0.10.0.0 && < 0.13,
containers >= 0.5.0.0 && < 0.8,
deepseq >= 1.3.0.1 && < 1.6,
directory >= 1.2 && < 1.4,
filepath >= 1.3.0.1 && < 1.5,
filepath >= 1.3.0.1 && < 1.6,
pretty >= 1.1.1 && < 1.2,
process >= 1.2.1.0 && < 1.7,
time >= 1.4.0.1 && < 1.13

if os(windows)
build-depends: Win32 >= 2.3.0.0 && < 2.14
build-depends: Win32 >= 2.3.0.0 && < 2.15
else
build-depends: unix >= 2.6.0.0 && < 2.9

@@ -302,7 +302,7 @@ library
-- See also https://github.com/ekmett/transformers-compat/issues/35
transformers (>= 0.3 && < 0.4) || (>=0.4.1.0 && <0.7),
mtl >= 2.1 && < 2.4,
text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.1),
text (>= 1.2.3.0 && < 1.3) || (>= 2.0 && < 2.2),
parsec >= 3.1.13.0 && < 3.2

other-modules:
12 changes: 12 additions & 0 deletions Cabal/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 3.10.3.0 [Hécate](mailto:hecate+github@glitchbra.in) January 2024
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.3.0.md

# 3.10.2.1 [Hécate](mailto:hecate+github@glitchbra.in) October 2023
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.2.1.md

# 3.10.2.0 [Hécate](mailto:hecate+github@glitchbra.in) August 2023
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.2.0.md

# 3.10.1.0 [Mikolaj Konarski](mailto:mikolaj@well-typed.com) March 2023
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.1.0.md

# 3.8.1.0 [Mikolaj Konarski](mailto:mikolaj@well-typed.com) August 2022
* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.8.1.0.md

2 changes: 1 addition & 1 deletion Cabal/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2003-2022, Cabal Development Team.
Copyright (c) 2003-2023, Cabal Development Team.
See the AUTHORS file for the full list of copyright holders.

See */LICENSE for the copyright holders of the subcomponents.
2 changes: 1 addition & 1 deletion Cabal/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=3.9.0.0
VERSION=3.10.3.0

#KIND=devel
KIND=rc
55 changes: 39 additions & 16 deletions Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
@@ -70,6 +70,7 @@ import System.FilePath

import qualified Data.ByteString.Lazy as BS
import qualified Data.Map as Map
import qualified Control.Monad as CM
import qualified Distribution.Compat.DList as DList
import qualified Distribution.SPDX as SPDX
import qualified System.Directory as System
@@ -223,6 +224,7 @@ data CheckExplanation =
| CVExpliticDepsCustomSetup
| CVAutogenPaths
| CVAutogenPackageInfo
| CVAutogenPackageInfoGuard
| GlobNoMatch String String
| GlobExactMatch String String FilePath
| GlobNoDir String String FilePath
@@ -663,6 +665,11 @@ ppExplanation CVAutogenPackageInfo =
++ "the module does not come with the package and is generated on "
++ "setup. Modules built with a custom Setup.hs script also go here "
++ "to ensure that commands like sdist don't fail."
ppExplanation CVAutogenPackageInfoGuard =
"To use the autogenerated module PackageInfo_* you need to specify "
++ "`cabal-version: 3.12` or higher. This is not possible in `cabal "
++ "3.10`. To use this feature and be able to upload your package to "
++ "Hackage, download `cabal 3.12`!"
ppExplanation (GlobNoMatch field glob) =
"In '" ++ field ++ "': the pattern '" ++ glob ++ "' does not"
++ " match any files."
@@ -1192,9 +1199,10 @@ checkFields pkg =
unknownCompilers = [ name | (OtherCompiler name, _) <- testedWith pkg ]
unknownLanguages = [ name | bi <- allBuildInfo pkg
, UnknownLanguage name <- allLanguages bi ]
unknownExtensions = [ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `notElem` map prettyShow knownLanguages ]
unknownExtensions = filter (/= "TypeAbstractions")
[ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `notElem` map prettyShow knownLanguages ]
ourDeprecatedExtensions = nub $ catMaybes
[ find ((==ext) . fst) deprecatedExtensions
| bi <- allBuildInfo pkg
@@ -1209,17 +1217,13 @@ checkFields pkg =
| (compiler, vr) <- testedWith pkg
, isNoVersion vr ]

internalLibraries =
map (maybe (packageName pkg) unqualComponentNameToPackageName . libraryNameString . libName)
(allLibraries pkg)

internalExecutables = map exeName $ executables pkg

internalLibDeps =
[ dep
| bi <- allBuildInfo pkg
, dep@(Dependency name _ _) <- targetBuildDepends bi
, name `elem` internalLibraries
, name == packageName pkg
]

internalExeDeps =
@@ -1385,7 +1389,7 @@ checkGhcOptions fieldName getOptions pkg =
, checkFlags ["-prof"] $
PackageBuildWarning (OptProf fieldName)

, checkFlags ["-o"] $
, unlessScript . checkFlags ["-o"] $
PackageBuildWarning (OptO fieldName)

, checkFlags ["-hide-package"] $
@@ -1478,6 +1482,10 @@ checkGhcOptions fieldName getOptions pkg =
checkFlags :: [String] -> PackageCheck -> Maybe PackageCheck
checkFlags flags = check (any (`elem` flags) all_ghc_options)

unlessScript :: Maybe PackageCheck -> Maybe PackageCheck
unlessScript pc | packageId pkg == fakePackageId = Nothing
| otherwise = pc

checkTestAndBenchmarkFlags :: [String] -> PackageCheck -> Maybe PackageCheck
checkTestAndBenchmarkFlags flags = check (any (`elem` flags) test_and_benchmark_ghc_options)

@@ -1812,6 +1820,9 @@ checkCabalVersion pkg =
&& not (elem (autogenPackageInfoModuleName pkg) allModuleNamesAutogen) ) $
PackageDistInexcusable CVAutogenPackageInfo

, check
(elem (autogenPackageInfoModuleName pkg) allModuleNames)
(PackageDistInexcusable CVAutogenPackageInfoGuard)
]
where
-- Perform a check on packages that use a version of the spec less than
@@ -1895,14 +1906,24 @@ checkPackageVersions pkg =
baseErrors
where
baseErrors = PackageDistInexcusable BaseNoUpperBounds <$ bases
deps = toDependencyVersionsMap allBuildDepends pkg
deps = toDependencyVersionsMap allNonInternalBuildDepends pkg
-- base gets special treatment (it's more critical)
(bases, others) = partition (("base" ==) . unPackageName) $
[ name
| (name, vr) <- Map.toList deps
, not (hasUpperBound vr)
]

-- Get the combined build-depends entries of all components.
allNonInternalBuildDepends :: PackageDescription -> [Dependency]
allNonInternalBuildDepends = targetBuildDepends CM.<=< allNonInternalBuildInfo

allNonInternalBuildInfo :: PackageDescription -> [BuildInfo]
allNonInternalBuildInfo pkg_descr =
[bi | lib <- allLibraries pkg_descr, let bi = libBuildInfo lib]
++ [bi | flib <- foreignLibs pkg_descr, let bi = foreignLibBuildInfo flib]
++ [bi | exe <- executables pkg_descr, let bi = buildInfo exe]

checkConditionals :: GenericPackageDescription -> [PackageCheck]
checkConditionals pkg =
catMaybes [
@@ -1917,7 +1938,7 @@ checkConditionals pkg =
PackageDistInexcusable (UnknownCompiler unknownImpls)
]
where
unknownOSs = [ os | OS (OtherOS os) <- conditions ]
unknownOSs = [ os | OS (OtherOS os) <- conditions, os /= "haiku" ]
unknownArches = [ arch | Arch (OtherArch arch) <- conditions ]
unknownImpls = [ impl | Impl (OtherCompiler impl) _ <- conditions ]
conditions = concatMap fvs (maybeToList (condLibrary pkg))
@@ -2545,19 +2566,21 @@ checkGlobFiles verbosity pkg root = do
)

-- Predicate for desirable documentation file on Hackage server
isDesirableExtraDocFile :: [FilePath] -> FilePath -> Bool
isDesirableExtraDocFile paths path = map toLower basename `elem` paths
isDesirableExtraDocFile :: ([FilePath], [FilePath]) -> FilePath -> Bool
isDesirableExtraDocFile (basenames, extensions) path =
basename `elem` basenames && ext `elem` extensions
where
(basename, _ext) = splitExtension path
(basename, ext) = splitExtension (map toLower path)

-- Changelog patterns
-- Changelog patterns (basenames & extensions)
-- Source: hackage-server/src/Distribution/Server/Packages/ChangeLog.hs
desirableChangeLog =
[ "news"
, "changelog"
, "change_log"
, "changes"
]
desirableChangeLogExtensions = ["", ".txt", ".md", ".markdown", ".rst"]
-- [TODO] Check readme. Observations:
-- • Readme is not necessary if package description is good.
-- • Some readmes exists only for repository browsing.
@@ -2567,7 +2590,7 @@ checkGlobFiles verbosity pkg root = do
-- -- Readme patterns
-- -- Source: hackage-server/src/Distribution/Server/Packages/Readme.hs
-- desirableReadme = ["readme"]
desirableDocFiles = desirableChangeLog
desirableDocFiles = (desirableChangeLog, desirableChangeLogExtensions)

-- If there's a missing directory in play, since our globs don't
-- (currently) support disjunction, that will always mean there are no
10 changes: 6 additions & 4 deletions Cabal/src/Distribution/Simple.hs
Original file line number Diff line number Diff line change
@@ -576,8 +576,7 @@ simpleUserHooks =
--
-- * 'postConf' runs @.\/configure@, if present.
--
-- * the pre-hooks 'preBuild', 'preClean', 'preCopy', 'preInst',
-- 'preReg' and 'preUnreg' read additional build information from
-- * the pre-hooks, except for pre-conf, read additional build information from
-- /package/@.buildinfo@, if present.
--
-- Thus @configure@ can use local system information to generate
@@ -588,14 +587,17 @@ autoconfUserHooks
= simpleUserHooks
{
postConf = defaultPostConf,
preBuild = readHookWithArgs buildVerbosity buildDistPref, -- buildCabalFilePath,
preBuild = readHookWithArgs buildVerbosity buildDistPref,
preRepl = readHookWithArgs replVerbosity replDistPref,
preCopy = readHookWithArgs copyVerbosity copyDistPref,
preClean = readHook cleanVerbosity cleanDistPref,
preInst = readHook installVerbosity installDistPref,
preHscolour = readHook hscolourVerbosity hscolourDistPref,
preHaddock = readHookWithArgs haddockVerbosity haddockDistPref,
preReg = readHook regVerbosity regDistPref,
preUnreg = readHook regVerbosity regDistPref
preUnreg = readHook regVerbosity regDistPref,
preTest = readHookWithArgs testVerbosity testDistPref,
preBench = readHookWithArgs benchmarkVerbosity benchmarkDistPref
}
where defaultPostConf :: Args -> ConfigFlags -> PackageDescription
-> LocalBuildInfo -> IO ()
98 changes: 53 additions & 45 deletions Cabal/src/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
@@ -76,12 +76,13 @@ import Distribution.Simple.Program
import Distribution.Simple.Setup as Setup
import Distribution.Simple.BuildTarget
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Program.Db (appendProgramSearchPath, modifyProgramSearchPath, lookupProgramByName)
import Distribution.Simple.Utils
import Distribution.System
import Distribution.Types.PackageVersionConstraint
import Distribution.Types.LocalBuildInfo
import Distribution.Types.ComponentRequestedSpec
import Distribution.Types.GivenComponent
import Distribution.Simple.Utils
import Distribution.System
import Distribution.Version
import Distribution.Verbosity
import qualified Distribution.Compat.Graph as Graph
@@ -101,7 +102,8 @@ import qualified Distribution.Simple.HaskellSuite as HaskellSuite
import Control.Exception
( try )
import Distribution.Utils.Structured ( structuredDecodeOrFailIO, structuredEncode )
import Distribution.Compat.Directory ( listDirectory )
import Distribution.Compat.Directory
( listDirectory, doesPathExist )
import Data.ByteString.Lazy ( ByteString )
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy.Char8 as BLC8
@@ -114,8 +116,6 @@ import System.Directory
, getTemporaryDirectory, removeFile)
import System.FilePath
( (</>), isAbsolute, takeDirectory )
import Distribution.Compat.Directory
( doesPathExist )
import qualified System.Info
( compilerName, compilerVersion )
import System.IO
@@ -367,18 +367,19 @@ configure (pkg_descr0, pbi) cfg = do
(fromFlag (configUserInstall cfg))
(configPackageDBs cfg)

programDbPre <- mkProgramDb cfg (configPrograms cfg)
-- comp: the compiler we're building with
-- compPlatform: the platform we're building for
-- programDb: location and args of all programs we're
-- building with
(comp :: Compiler,
(comp :: Compiler,
compPlatform :: Platform,
programDb :: ProgramDb)
programDb :: ProgramDb)
<- configCompilerEx
(flagToMaybe (configHcFlavor cfg))
(flagToMaybe (configHcPath cfg))
(flagToMaybe (configHcPkg cfg))
(mkProgramDb cfg (configPrograms cfg))
programDbPre
(lessVerbose verbosity)

-- The InstalledPackageIndex of all installed packages
@@ -637,21 +638,16 @@ configure (pkg_descr0, pbi) cfg = do
"--enable-split-objs; ignoring")
return False

let compilerSupportsGhciLibs :: Bool
compilerSupportsGhciLibs =
case compilerId comp of
CompilerId GHC version
| version > mkVersion [9,3] && windows ->
False
CompilerId GHC _ ->
True
CompilerId GHCJS _ ->
True
_ -> False
where
windows = case compPlatform of
Platform _ Windows -> True
Platform _ _ -> False
-- Basically yes/no/unknown.
let linkerSupportsRelocations :: Maybe Bool
linkerSupportsRelocations =
case lookupProgramByName "ld" programDb'' of
Nothing -> Nothing
Just ld ->
case Map.lookup "Supports relocatable output" $ programProperties ld of
Just "YES" -> Just True
Just "NO" -> Just False
_other -> Nothing

let ghciLibByDefault =
case compilerId comp of
@@ -671,10 +667,12 @@ configure (pkg_descr0, pbi) cfg = do

withGHCiLib_ <-
case fromFlagOrDefault ghciLibByDefault (configGHCiLib cfg) of
True | not compilerSupportsGhciLibs -> do
-- NOTE: If linkerSupportsRelocations is Nothing this may still fail if the
-- linker does not support -r.
True | not (fromMaybe True linkerSupportsRelocations) -> do
warn verbosity $
"--enable-library-for-ghci is no longer supported on Windows with"
++ " GHC 9.4 and later; ignoring..."
"--enable-library-for-ghci is not supported with the current"
++ " linker; ignoring..."
return False
v -> return v

@@ -843,16 +841,27 @@ configure (pkg_descr0, pbi) cfg = do
where
verbosity = fromFlag (configVerbosity cfg)

mkProgramDb :: ConfigFlags -> ProgramDb -> ProgramDb
mkProgramDb cfg initialProgramDb = programDb
-- | Adds the extra program paths from the flags provided to @configure@ as
-- well as specified locations for certain known programs and their default
-- arguments.
mkProgramDb :: ConfigFlags -> ProgramDb -> IO ProgramDb
mkProgramDb cfg initialProgramDb = do
programDb <-
modifyProgramSearchPath (getProgramSearchPath initialProgramDb ++)
<$> appendProgramSearchPath (fromFlagOrDefault normal (configVerbosity cfg)) searchpath initialProgramDb
pure
. userSpecifyArgss (configProgramArgs cfg)
. userSpecifyPaths (configProgramPaths cfg)
$ programDb
where
programDb = userSpecifyArgss (configProgramArgs cfg)
. userSpecifyPaths (configProgramPaths cfg)
. setProgramSearchPath searchpath
$ initialProgramDb
searchpath = map ProgramSearchPathDir
(fromNubList $ configProgramPathExtra cfg)
++ getProgramSearchPath initialProgramDb
searchpath = fromNubList $ configProgramPathExtra cfg

-- Note. We try as much as possible to _prepend_ rather than postpend the extra-prog-path
-- so that we can override the system path. However, in a v2-build, at this point, the "system" path
-- has already been extended by both the built-tools-depends paths, as well as the program-path-extra
-- so for v2 builds adding it again is entirely unnecessary. However, it needs to get added again _anyway_
-- so as to take effect for v1 builds or standalone calls to Setup.hs
-- In this instance, the lesser evil is to not allow it to override the system path.

-- -----------------------------------------------------------------------------
-- Helper functions for configure
@@ -938,11 +947,11 @@ dependencySatisfiable
then internalDepSatisfiable
else
-- Backward compatibility for the old sublibrary syntax
(sublibs == mainLibSet
sublibs == mainLibSet
&& Map.member
(pn, CLibName $ LSubLibName $
packageNameToUnqualComponentName depName)
requiredDepsMap)
requiredDepsMap

|| all visible sublibs

@@ -969,7 +978,7 @@ dependencySatisfiable
internalDepSatisfiable =
Set.isSubsetOf (NES.toSet sublibs) packageLibraries
internalDepSatisfiableExternally =
all (\ln -> not $ null $ PackageIndex.lookupInternalDependency installedPackageSet pn vr ln) sublibs
all (not . null . PackageIndex.lookupInternalDependency installedPackageSet pn vr) sublibs

-- Check whether a library exists and is visible.
-- We don't disambiguate between dependency on non-existent or private
@@ -1438,8 +1447,7 @@ getInstalledPackagesMonitorFiles verbosity comp packageDBs progdb platform =
-- flag into a single package db stack.
--
interpretPackageDbFlags :: Bool -> [Maybe PackageDB] -> PackageDBStack
interpretPackageDbFlags userInstall specificDBs =
extra initialStack specificDBs
interpretPackageDbFlags userInstall = extra initialStack
where
initialStack | userInstall = [GlobalPackageDB, UserPackageDB]
| otherwise = [GlobalPackageDB]
@@ -1685,8 +1693,8 @@ ccLdOptionsBuildInfo cflags ldflags ldflags_static =
let (includeDirs', cflags') = partition ("-I" `isPrefixOf`) cflags
(extraLibs', ldflags') = partition ("-l" `isPrefixOf`) ldflags
(extraLibDirs', ldflags'') = partition ("-L" `isPrefixOf`) ldflags'
(extraLibsStatic') = filter ("-l" `isPrefixOf`) ldflags_static
(extraLibDirsStatic') = filter ("-L" `isPrefixOf`) ldflags_static
extraLibsStatic' = filter ("-l" `isPrefixOf`) ldflags_static
extraLibDirsStatic' = filter ("-L" `isPrefixOf`) ldflags_static
in mempty {
includeDirs = map (drop 2) includeDirs',
extraLibs = map (drop 2) extraLibs',
@@ -1702,13 +1710,13 @@ ccLdOptionsBuildInfo cflags ldflags ldflags_static =

configCompilerAuxEx :: ConfigFlags
-> IO (Compiler, Platform, ProgramDb)
configCompilerAuxEx cfg = configCompilerEx (flagToMaybe $ configHcFlavor cfg)
configCompilerAuxEx cfg = do
programDb <- mkProgramDb cfg defaultProgramDb
configCompilerEx (flagToMaybe $ configHcFlavor cfg)
(flagToMaybe $ configHcPath cfg)
(flagToMaybe $ configHcPkg cfg)
programDb
(fromFlag (configVerbosity cfg))
where
programDb = mkProgramDb cfg defaultProgramDb

configCompilerEx :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath
-> ProgramDb -> Verbosity
5 changes: 2 additions & 3 deletions Cabal/src/Distribution/Simple/ConfigureScript.hs
Original file line number Diff line number Diff line change
@@ -137,10 +137,9 @@ runConfigureScript verbosity flags lbi = do
maybeHostFlag = if hp == buildPlatform then [] else ["--host=" ++ show (pretty hp)]
args' = configureFile':args ++ ["CC=" ++ ccProgShort] ++ maybeHostFlag
shProg = simpleProgram "sh"
progDb = modifyProgramSearchPath
(\p -> map ProgramSearchPathDir extraPath ++ p) emptyProgramDb
progDb <- appendProgramSearchPath verbosity extraPath emptyProgramDb
shConfiguredProg <- lookupProgram shProg
`fmap` configureProgram verbosity shProg progDb
`fmap` configureProgram verbosity shProg progDb
case shConfiguredProg of
Just sh -> runProgramInvocation verbosity $
(programInvocation (sh {programOverrideEnv = overEnv}) args')
174 changes: 100 additions & 74 deletions Cabal/src/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
@@ -140,12 +140,12 @@ configure verbosity hcPath hcPkgPath conf0 = do
(userMaybeSpecifyPath "ghc" hcPath conf0)
let implInfo = ghcVersionImplInfo ghcVersion

-- Cabal currently supports ghc >= 7.0.1 && < 9.8
-- Cabal currently supports ghc >= 7.0.1 && < 9.10
-- ... and the following odd development version
unless (ghcVersion < mkVersion [9,8]) $
unless (ghcVersion < mkVersion [9,10]) $
warn verbosity $
"Unknown/unsupported 'ghc' version detected "
++ "(Cabal " ++ prettyShow cabalVersion ++ " supports 'ghc' version < 9.8): "
++ "(Cabal " ++ prettyShow cabalVersion ++ " supports 'ghc' version < 9.10): "
++ programPath ghcProg ++ " is version " ++ prettyShow ghcVersion

-- This is slightly tricky, we have to configure ghc first, then we use the
@@ -185,10 +185,13 @@ configure verbosity hcPath hcPkgPath conf0 = do

ghcInfo <- Internal.getGhcInfo verbosity implInfo ghcProg
let ghcInfoMap = Map.fromList ghcInfo
extensions = -- workaround https://gitlab.haskell.org/ghc/ghc/-/issues/11214
filterExt JavaScriptFFI $
-- see 'filterExtTH' comment below
filterExtTH $ extensions0
filterJS = if ghcVersion < mkVersion [9, 8] then filterExt JavaScriptFFI else id
extensions =
-- workaround https://gitlab.haskell.org/ghc/ghc/-/issues/11214
filterJS $
-- see 'filterExtTH' comment below
filterExtTH $
extensions0

-- starting with GHC 8.0, `TemplateHaskell` will be omitted from
-- `--supported-extensions` when it's not available.
@@ -523,7 +526,8 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
comp = compiler lbi
ghcVersion = compilerVersion comp
implInfo = getImplInfo comp
platform@(Platform _hostArch hostOS) = hostPlatform lbi
platform@(Platform hostArch hostOS) = hostPlatform lbi
hasJsSupport = hostArch == JavaScript
has_code = not (componentIsIndefinite clbi)

relLibTargetDir <- makeRelativeToCurrentDirectory libTargetDir
@@ -567,11 +571,13 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
, toNubListR (cxxSources libBi)
, toNubListR (cmmSources libBi)
, toNubListR (asmSources libBi)
, toNubListR (jsSources libBi)
, if hasJsSupport
-- JS files are C-like with GHC's JS backend: they are
-- "compiled" into `.o` files (renamed with a header).
-- This is a difference from GHCJS, for which we only
-- pass the JS files at link time.
then toNubListR (jsSources libBi)
else mempty
]
cLikeObjs = map (`replaceExtension` objExtension) cLikeSources
baseOpts = componentGhcOptions verbosity lbi libBi clbi libTargetDir
@@ -699,38 +705,41 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
| filename <- cxxSources libBi]

-- build any C sources
unless (not has_code || null (cSources libBi)) $ do
let libraryName = case libName lib of
LMainLibName -> "the main library"
LSubLibName name -> "library " <> prettyShow name
cSrcs' <- checkCSources verbosity libraryName (cSources libBi)
unless (not has_code || null cSrcs') $ do
info verbosity "Building C Sources..."
sequence_
[ do let baseCcOpts = Internal.componentCcGhcOptions verbosity implInfo
lbi libBi clbi relLibTargetDir filename
vanillaCcOpts = if isGhcDynamic
-- Dynamic GHC requires C sources to be built
-- with -fPIC for REPL to work. See #2207.
then baseCcOpts { ghcOptFPic = toFlag True }
else baseCcOpts
profCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptProfilingMode = toFlag True,
ghcOptObjSuffix = toFlag "p_o"
}
sharedCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptFPic = toFlag True,
ghcOptDynLinkMode = toFlag GhcDynamicOnly,
ghcOptObjSuffix = toFlag "dyn_o"
}
odir = fromFlag (ghcOptObjDir vanillaCcOpts)
createDirectoryIfMissingVerbose verbosity True odir
let runGhcProgIfNeeded ccOpts = do
needsRecomp <- checkNeedsRecompilation filename ccOpts
when needsRecomp $ runGhcProg ccOpts
runGhcProgIfNeeded vanillaCcOpts
unless forRepl $
whenSharedLib forceSharedLib (runGhcProgIfNeeded sharedCcOpts)
unless forRepl $ whenProfLib (runGhcProgIfNeeded profCcOpts)
| filename <- cSources libBi]
forM_ cSrcs' $ \filename -> do
let baseCcOpts = Internal.componentCcGhcOptions verbosity implInfo
lbi libBi clbi relLibTargetDir filename
vanillaCcOpts = if isGhcDynamic
-- Dynamic GHC requires C sources to be built
-- with -fPIC for REPL to work. See #2207.
then baseCcOpts { ghcOptFPic = toFlag True }
else baseCcOpts
profCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptProfilingMode = toFlag True,
ghcOptObjSuffix = toFlag "p_o"
}
sharedCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptFPic = toFlag True,
ghcOptDynLinkMode = toFlag GhcDynamicOnly,
ghcOptObjSuffix = toFlag "dyn_o"
}
odir = fromFlag (ghcOptObjDir vanillaCcOpts)
createDirectoryIfMissingVerbose verbosity True odir
let runGhcProgIfNeeded ccOpts = do
needsRecomp <- checkNeedsRecompilation filename ccOpts
when needsRecomp $ runGhcProg ccOpts
runGhcProgIfNeeded vanillaCcOpts
unless forRepl $
whenSharedLib forceSharedLib (runGhcProgIfNeeded sharedCcOpts)
unless forRepl $ whenProfLib (runGhcProgIfNeeded profCcOpts)

-- build any JS sources
unless (not has_code || null (jsSources libBi)) $ do
unless (not has_code || not hasJsSupport || null (jsSources libBi)) $ do
info verbosity "Building JS Sources..."
sequence_
[ do let vanillaJsOpts = Internal.componentJsGhcOptions verbosity implInfo
@@ -926,7 +935,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi,
ghcOptLinkFrameworkDirs =
toNubListR $ PD.extraFrameworkDirs libBi,
ghcOptRPaths = rpaths
ghcOptRPaths = rpaths <> toNubListR (extraLibDirs libBi)
}
ghcStaticLinkArgs =
mempty {
@@ -1427,7 +1436,7 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do
[tmpDir </> x | x <- cLikeObjs ++ cxxObjs]
}
dynLinkerOpts = mempty {
ghcOptRPaths = rpaths,
ghcOptRPaths = rpaths <> toNubListR (extraLibDirs bnfo),
ghcOptInputFiles = toNubListR
[tmpDir </> x | x <- cLikeObjs ++ cxxObjs]
}
@@ -1521,32 +1530,32 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do
| filename <- cxxSrcs ]

-- build any C sources
unless (null cSrcs) $ do
info verbosity "Building C Sources..."
sequence_
[ do let baseCcOpts = Internal.componentCcGhcOptions verbosity implInfo
cSrcs' <- checkCSources verbosity (gbuildName bm) cSrcs
unless (null cSrcs') $ do
info verbosity "Building C Sources..."
forM_ cSrcs' $ \filename -> do
let baseCcOpts = Internal.componentCcGhcOptions verbosity implInfo
lbi bnfo clbi tmpDir filename
vanillaCcOpts = if isGhcDynamic
-- Dynamic GHC requires C sources to be built
-- with -fPIC for REPL to work. See #2207.
then baseCcOpts { ghcOptFPic = toFlag True }
else baseCcOpts
profCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptProfilingMode = toFlag True
}
sharedCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptFPic = toFlag True,
ghcOptDynLinkMode = toFlag GhcDynamicOnly
}
opts | needProfiling = profCcOpts
| needDynamic = sharedCcOpts
| otherwise = vanillaCcOpts
odir = fromFlag (ghcOptObjDir opts)
createDirectoryIfMissingVerbose verbosity True odir
needsRecomp <- checkNeedsRecompilation filename opts
when needsRecomp $
runGhcProg opts
| filename <- cSrcs ]
let vanillaCcOpts = if isGhcDynamic
-- Dynamic GHC requires C sources to be built
-- with -fPIC for REPL to work. See #2207.
then baseCcOpts { ghcOptFPic = toFlag True }
else baseCcOpts
let profCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptProfilingMode = toFlag True
}
let sharedCcOpts = vanillaCcOpts `mappend` mempty {
ghcOptFPic = toFlag True,
ghcOptDynLinkMode = toFlag GhcDynamicOnly
}
let opts | needProfiling = profCcOpts
| needDynamic = sharedCcOpts
| otherwise = vanillaCcOpts
let odir = fromFlag (ghcOptObjDir opts)
createDirectoryIfMissingVerbose verbosity True odir
needsRecomp <- checkNeedsRecompilation filename opts
when needsRecomp $
runGhcProg opts

-- TODO: problem here is we need the .c files built first, so we can load them
-- with ghci, but .c files can depend on .h files generated by ghc by ffi
@@ -1852,18 +1861,12 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do
libBi = libBuildInfo lib
comp = compiler lbi
platform = hostPlatform lbi
vanillaArgs0 =
vanillaArgs =
(componentGhcOptions verbosity lbi libBi clbi (componentBuildDir lbi clbi))
`mappend` mempty {
ghcOptMode = toFlag GhcModeAbiHash,
ghcOptInputModules = toNubListR $ exposedModules lib
}
vanillaArgs =
-- Package DBs unnecessary, and break ghc-cabal. See #3633
-- BUT, put at least the global database so that 7.4 doesn't
-- break.
vanillaArgs0 { ghcOptPackageDBs = [GlobalPackageDB]
, ghcOptPackages = mempty }
sharedArgs = vanillaArgs `mappend` mempty {
ghcOptDynLinkMode = toFlag GhcDynamicOnly,
ghcOptFPic = toFlag True,
@@ -1887,7 +1890,7 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do

(ghcProg, _) <- requireProgram verbosity ghcProgram (withPrograms lbi)
hash <- getProgramInvocationOutput verbosity
(ghcInvocation ghcProg comp platform ghcArgs)
=<< ghcInvocation verbosity ghcProg comp platform ghcArgs
return (takeWhile (not . isSpace) hash)

componentGhcOptions :: Verbosity -> LocalBuildInfo
@@ -2087,7 +2090,10 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do
&& null (cxxSources (libBuildInfo lib))
&& null (cmmSources (libBuildInfo lib))
&& null (asmSources (libBuildInfo lib))
&& null (jsSources (libBuildInfo lib))
&& (null (jsSources (libBuildInfo lib)) || not hasJsSupport)
hasJsSupport = case hostPlatform lbi of
Platform JavaScript _ -> True
_ -> False
has_code = not (componentIsIndefinite clbi)
whenHasCode = when has_code
whenVanilla = when (hasLib && withVanillaLib lbi)
@@ -2157,3 +2163,23 @@ supportsDynamicToo = Internal.ghcLookupProperty "Support dynamic-too"

withExt :: FilePath -> String -> FilePath
withExt fp ext = fp <.> if takeExtension fp /= ('.':ext) then ext else ""

checkCSources :: Verbosity -> String -> [String] -> IO [String]
checkCSources verbosity name cSrcs = do
let (headers, cSrcs') = partition (\filepath -> ".h" `isSuffixOf` filepath) cSrcs
others = filter (\filepath -> not (".c" `isSuffixOf` filepath)) cSrcs'
unless (null headers) $ do
let files = intercalate ", " headers
warn verbosity $ unlines
[ "The following header files listed in " <> name <> "'s c-sources will not be used: " <> files <> "."
, "Header files should be in the 'include' or 'install-include' stanza."
, "See https://cabal.readthedocs.io/en/3.10/cabal-package.html#pkg-field-includes"
]
unless (null others) $ do
let files = intercalate ", " others
warn verbosity $ unlines
[ "The following files listed in " <> name <> "'s c-sources do not have the expected '.c' extension " <> files <> "."
, "C++ files should be in the 'cxx-sources' stanza."
, "See https://cabal.readthedocs.io/en/3.10/cabal-package.html#pkg-field-cxx-sources"
]
return cSrcs'
4 changes: 3 additions & 1 deletion Cabal/src/Distribution/Simple/GHC/Internal.hs
Original file line number Diff line number Diff line change
@@ -101,7 +101,9 @@ configureToolchain _implInfo ghcProg ghcInfo =
}
. addKnownProgram ldProgram {
programFindLocation = findProg ldProgramName extraLdPath,
programPostConf = configureLd
programPostConf = \v cp ->
-- Call any existing configuration first and then add any new configuration
configureLd v =<< programPostConf ldProgram v cp
}
. addKnownProgram arProgram {
programFindLocation = findProg arProgramName extraArPath
10 changes: 2 additions & 8 deletions Cabal/src/Distribution/Simple/GHCJS.hs
Original file line number Diff line number Diff line change
@@ -1573,18 +1573,12 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do
libBi = libBuildInfo lib
comp = compiler lbi
platform = hostPlatform lbi
vanillaArgs0 =
vanillaArgs =
(componentGhcOptions verbosity lbi libBi clbi (componentBuildDir lbi clbi))
`mappend` mempty {
ghcOptMode = toFlag GhcModeAbiHash,
ghcOptInputModules = toNubListR $ exposedModules lib
}
vanillaArgs =
-- Package DBs unnecessary, and break ghc-cabal. See #3633
-- BUT, put at least the global database so that 7.4 doesn't
-- break.
vanillaArgs0 { ghcOptPackageDBs = [GlobalPackageDB]
, ghcOptPackages = mempty }
sharedArgs = vanillaArgs `mappend` mempty {
ghcOptDynLinkMode = toFlag GhcDynamicOnly,
ghcOptFPic = toFlag True,
@@ -1608,7 +1602,7 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do

(ghcjsProg, _) <- requireProgram verbosity ghcjsProgram (withPrograms lbi)
hash <- getProgramInvocationOutput verbosity
(ghcInvocation ghcjsProg comp platform ghcArgs)
=<< ghcInvocation verbose ghcjsProg comp platform ghcArgs
return (takeWhile (not . isSpace) hash)

componentGhcOptions :: Verbosity -> LocalBuildInfo
19 changes: 12 additions & 7 deletions Cabal/src/Distribution/Simple/Haddock.hs
Original file line number Diff line number Diff line change
@@ -360,7 +360,7 @@ createHaddockIndex :: Verbosity
createHaddockIndex verbosity programDb comp platform flags = do
let args = fromHaddockProjectFlags flags
(haddockProg, _version) <-
getHaddockProg verbosity programDb comp args (haddockProjectQuickJump flags)
getHaddockProg verbosity programDb comp args (Flag True)
runHaddock verbosity defaultTempFileOptions comp platform haddockProg False args

-- ------------------------------------------------------------------------------
@@ -405,12 +405,12 @@ fromHaddockProjectFlags :: HaddockProjectFlags -> HaddockArgs
fromHaddockProjectFlags flags =
mempty
{ argOutputDir = Dir (fromFlag $ haddockProjectDir flags)
, argQuickJump = haddockProjectQuickJump flags
, argGenContents = haddockProjectGenContents flags
, argGenIndex = haddockProjectGenIndex flags
, argQuickJump = Flag True
, argGenContents = Flag True
, argGenIndex = Flag True
, argPrologueFile = haddockProjectPrologue flags
, argInterfaces = fromFlagOrDefault [] (haddockProjectInterfaces flags)
, argLinkedSource = haddockProjectLinkedSource flags
, argLinkedSource = Flag True
, argLib = haddockProjectLib flags
}

@@ -684,7 +684,12 @@ renderArgs verbosity tmpFileOpts version comp platform args k = do
result = intercalate ", "
. map (\o -> outputDir </>
case o of
Html -> "index.html"
Html
| fromFlagOrDefault False (argGenIndex args) ->
"index.html"
Html
| otherwise ->
mempty
Hoogle -> pkgstr <.> "txt")
. fromFlagOrDefault [Html]
. argOutput
@@ -709,7 +714,7 @@ renderPureArgs version comp platform args = concat
, [ "--since-qual=external" | isVersion 2 20 ]

, [ "--quickjump" | isVersion 2 19
, _ <- flagToList . argQuickJump $ args ]
, True <- flagToList . argQuickJump $ args ]

, [ "--hyperlinked-source" | isVersion 2 17
, True <- flagToList . argLinkedSource $ args ]
58 changes: 51 additions & 7 deletions Cabal/src/Distribution/Simple/Program/Builtin.hs
Original file line number Diff line number Diff line change
@@ -256,8 +256,7 @@ arProgram = simpleProgram "ar"

stripProgram :: Program
stripProgram = (simpleProgram "strip") {
programFindVersion = \verbosity ->
findProgramVersion "--version" stripExtractVersion (lessVerbose verbosity)
programFindVersion = findProgramVersion "--version" stripExtractVersion . lessVerbose
}

hsc2hsProgram :: Program
@@ -322,7 +321,44 @@ greencardProgram :: Program
greencardProgram = simpleProgram "greencard"

ldProgram :: Program
ldProgram = simpleProgram "ld"
ldProgram = (simpleProgram "ld")
{ programPostConf = \verbosity ldProg -> do
-- The `lld` linker cannot create merge (relocatable) objects so we
-- want to detect this.
-- If the linker does support relocatable objects, we want to use that
-- to create partially pre-linked objects for GHCi, so we get much
-- faster loading as we do not have to do the separate loading and
-- in-memory linking the static linker in GHC does, but can offload
-- parts of this process to a pre-linking step.
-- However this requires the linker to support this features. Not all
-- linkers do, and notably as of this writing `lld` which is a popular
-- choice for windows linking does not support this feature. However
-- if using binutils ld or another linker that supports --relocatable,
-- we should still be good to generate pre-linked objects.
ldHelpOutput <-
getProgramInvocationOutput
verbosity
(programInvocation ldProg ["--help"])
-- In case the linker does not support '--help'. Eg the LLVM linker,
-- `lld` only accepts `-help`.
`catchIO` (\_ -> return "")
let k = "Supports relocatable output"
-- Standard GNU `ld` uses `--relocatable` while `ld.gold` uses
-- `-relocatable` (single `-`).
v
| "-relocatable" `isInfixOf` ldHelpOutput = "YES"
-- ld64 on macOS has this lovely response for "--help"
--
-- ld64: For information on command line options please use 'man ld'.
--
-- it does however support -r, if you read the manpage
-- (e.g. https://www.manpagez.com/man/1/ld64/)
| "ld64:" `isPrefixOf` ldHelpOutput = "YES"
| otherwise = "NO"

m = Map.insert k v (programProperties ldProg)
return $ ldProg{programProperties = m}
}

tarProgram :: Program
tarProgram = (simpleProgram "tar") {
@@ -334,7 +370,7 @@ tarProgram = (simpleProgram "tar") {
-- Some versions of tar don't support '--help'.
`catchIO` (\_ -> return "")
let k = "Supports --format"
v = if ("--format" `isInfixOf` tarHelpOutput) then "YES" else "NO"
v = if "--format" `isInfixOf` tarHelpOutput then "YES" else "NO"
m = Map.insert k v (programProperties tarProg)
return $ tarProg { programProperties = m }
}
@@ -343,6 +379,14 @@ cppProgram :: Program
cppProgram = simpleProgram "cpp"

pkgConfigProgram :: Program
pkgConfigProgram = (simpleProgram "pkg-config") {
programFindVersion = findProgramVersion "--version" id
}
pkgConfigProgram =
(simpleProgram "pkg-config")
{ programFindVersion = findProgramVersion "--version" id
, programPostConf = \_ pkgConfProg ->
let programOverrideEnv' =
programOverrideEnv pkgConfProg
++ [ ("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS", Just "1")
, ("PKG_CONFIG_ALLOW_SYSTEM_LIBS", Just "1")
]
in pure $ pkgConfProg{programOverrideEnv = programOverrideEnv'}
}
22 changes: 21 additions & 1 deletion Cabal/src/Distribution/Simple/Program/Db.hs
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ module Distribution.Simple.Program.Db (
-- ** Query and manipulate the program db
addKnownProgram,
addKnownPrograms,
appendProgramSearchPath,
lookupKnownProgram,
knownPrograms,
getProgramSearchPath,
@@ -46,6 +47,7 @@ module Distribution.Simple.Program.Db (
userSpecifyArgss,
userSpecifiedArgs,
lookupProgram,
lookupProgramByName,
updateProgram,
configuredPrograms,

@@ -222,6 +224,21 @@ modifyProgramSearchPath :: (ProgramSearchPath -> ProgramSearchPath)
modifyProgramSearchPath f db =
setProgramSearchPath (f $ getProgramSearchPath db) db

-- | Modify the current 'ProgramSearchPath' used by the 'ProgramDb'
-- by appending the provided extra paths. Also logs the added paths
-- in info verbosity.
appendProgramSearchPath
:: Verbosity
-> [FilePath]
-> ProgramDb
-> IO ProgramDb
appendProgramSearchPath verbosity extraPaths db =
if not $ null extraPaths
then do
logExtraProgramSearchPath verbosity extraPaths
pure $ modifyProgramSearchPath (map ProgramSearchPathDir extraPaths ++) db
else pure db

-- |User-specify this path. Basically override any path information
-- for this program in the configuration. If it's not a known
-- program ignore it.
@@ -293,8 +310,11 @@ userSpecifiedArgs prog =

-- | Try to find a configured program
lookupProgram :: Program -> ProgramDb -> Maybe ConfiguredProgram
lookupProgram prog = Map.lookup (programName prog) . configuredProgs
lookupProgram = lookupProgramByName . programName

-- | Try to find a configured program
lookupProgramByName :: String -> ProgramDb -> Maybe ConfiguredProgram
lookupProgramByName name = Map.lookup name . configuredProgs

-- | Update a configured program in the database.
updateProgram :: ConfiguredProgram -> ProgramDb
69 changes: 48 additions & 21 deletions Cabal/src/Distribution/Simple/Program/Find.hs
Original file line number Diff line number Diff line change
@@ -32,13 +32,17 @@ module Distribution.Simple.Program.Find (
defaultProgramSearchPath,
findProgramOnSearchPath,
programSearchPathAsPATHVar,
logExtraProgramSearchPath,
getSystemSearchPath,
getExtraPathEnv,
simpleProgram
) where

import Prelude ()
import Distribution.Compat.Prelude

import Distribution.Verbosity
import Distribution.Simple.Program.Types
import Distribution.Simple.Utils
import Distribution.System
import Distribution.Compat.Environment
@@ -52,30 +56,18 @@ import System.FilePath as FilePath
import qualified System.Win32 as Win32
#endif

-- | A search path to use when locating executables. This is analogous
-- to the unix @$PATH@ or win32 @%PATH%@ but with the ability to use
-- the system default method for finding executables ('findExecutable' which
-- on unix is simply looking on the @$PATH@ but on win32 is a bit more
-- complicated).
--
-- The default to use is @[ProgSearchPathDefault]@ but you can add extra dirs
-- either before, after or instead of the default, e.g. here we add an extra
-- dir to search after the usual ones.
--
-- > ['ProgramSearchPathDefault', 'ProgramSearchPathDir' dir]
--
type ProgramSearchPath = [ProgramSearchPathEntry]
data ProgramSearchPathEntry =
ProgramSearchPathDir FilePath -- ^ A specific dir
| ProgramSearchPathDefault -- ^ The system default
deriving (Eq, Generic, Typeable)

instance Binary ProgramSearchPathEntry
instance Structured ProgramSearchPathEntry

defaultProgramSearchPath :: ProgramSearchPath
defaultProgramSearchPath = [ProgramSearchPathDefault]

logExtraProgramSearchPath
:: Verbosity
-> [FilePath]
-> IO ()
logExtraProgramSearchPath verbosity extraPaths =
info verbosity . unlines $
"Including the following directories in PATH:"
: map ("- " ++) extraPaths

findProgramOnSearchPath :: Verbosity -> ProgramSearchPath
-> FilePath -> IO (Maybe (FilePath, [FilePath]))
findProgramOnSearchPath verbosity searchpath prog = do
@@ -141,6 +133,25 @@ findProgramOnSearchPath verbosity searchpath prog = do
Just _ -> return a
Nothing -> firstJustM mas

-- | Adds some paths to the "PATH" entry in the key-value environment provided
-- or if there is none, looks up @$PATH@ in the real environment.
getExtraPathEnv
:: Verbosity
-> [(String, Maybe String)]
-> [FilePath]
-> IO [(String, Maybe String)]
getExtraPathEnv _ _ [] = return []
getExtraPathEnv verbosity env extras = do
mb_path <- case lookup "PATH" env of
Just x -> return x
Nothing -> lookupEnv "PATH"
logExtraProgramSearchPath verbosity extras
let extra = intercalate [searchPathSeparator] extras
path' = case mb_path of
Nothing -> extra
Just path -> extra ++ searchPathSeparator : path
return [("PATH", Just path')]

-- | Interpret a 'ProgramSearchPath' to construct a new @$PATH@ env var.
-- Note that this is close but not perfect because on Windows the search
-- algorithm looks at more than just the @%PATH%@.
@@ -196,3 +207,19 @@ findExecutable prog = do
_ -> return mExe
#endif


-- | Make a simple named program.
--
-- By default we'll just search for it in the path and not try to find the
-- version name. You can override these behaviours if necessary, eg:
--
-- > (simpleProgram "foo") { programFindLocation = ... , programFindVersion ... }
--
simpleProgram :: String -> Program
simpleProgram name = Program {
programName = name,
programFindLocation = \v p -> findProgramOnSearchPath v p name,
programFindVersion = \_ _ -> return Nothing,
programPostConf = \_ p -> return p,
programNormaliseArgs = \_ _ -> id
}
25 changes: 15 additions & 10 deletions Cabal/src/Distribution/Simple/Program/GHC.hs
Original file line number Diff line number Diff line change
@@ -31,8 +31,9 @@ import Distribution.PackageDescription
import Distribution.ModuleName
import Distribution.Simple.Compiler
import Distribution.Simple.Flag
import Distribution.Simple.Program.Types
import Distribution.Simple.Program.Find (getExtraPathEnv)
import Distribution.Simple.Program.Run
import Distribution.Simple.Program.Types
import Distribution.System
import Distribution.Pretty
import Distribution.Types.ComponentId
@@ -569,15 +570,19 @@ data GhcProfAuto = GhcProfAutoAll -- ^ @-fprof-auto@
runGHC :: Verbosity -> ConfiguredProgram -> Compiler -> Platform -> GhcOptions
-> IO ()
runGHC verbosity ghcProg comp platform opts = do
runProgramInvocation verbosity (ghcInvocation ghcProg comp platform opts)


ghcInvocation :: ConfiguredProgram -> Compiler -> Platform -> GhcOptions
-> ProgramInvocation
ghcInvocation prog comp platform opts =
(programInvocation prog (renderGhcOptions comp platform opts)) {
progInvokePathEnv = fromNubListR (ghcOptExtraPath opts)
}
runProgramInvocation verbosity =<< ghcInvocation verbosity ghcProg comp platform opts

ghcInvocation :: Verbosity -> ConfiguredProgram -> Compiler -> Platform -> GhcOptions
-> IO ProgramInvocation
ghcInvocation verbosity ghcProg comp platform opts = do
-- NOTE: GHC is the only program whose path we modify with more values than
-- the standard @extra-prog-path@, namely the folders of the executables in
-- the components, see @componentGhcOptions@.
let envOverrides = programOverrideEnv ghcProg
extraPath <- getExtraPathEnv verbosity envOverrides (fromNubListR (ghcOptExtraPath opts))
let ghcProg' = ghcProg{programOverrideEnv = envOverrides ++ extraPath}

pure $ programInvocation ghcProg' (renderGhcOptions comp platform opts)

renderGhcOptions :: Compiler -> Platform -> GhcOptions -> [String]
renderGhcOptions comp _platform@(Platform _arch os) opts
64 changes: 23 additions & 41 deletions Cabal/src/Distribution/Simple/Program/Run.hs
Original file line number Diff line number Diff line change
@@ -13,20 +13,19 @@
-- This module provides a data type for program invocations and functions to
-- run them.

module Distribution.Simple.Program.Run (
ProgramInvocation(..),
IOEncoding(..),
emptyProgramInvocation,
simpleProgramInvocation,
programInvocation,
multiStageProgramInvocation,

runProgramInvocation,
getProgramInvocationOutput,
getProgramInvocationLBS,
getProgramInvocationOutputAndErrors,

getEffectiveEnvironment,
module Distribution.Simple.Program.Run
( ProgramInvocation (..)
, IOEncoding (..)
, emptyProgramInvocation
, simpleProgramInvocation
, programInvocation
, multiStageProgramInvocation
, runProgramInvocation
, getProgramInvocationOutput
, getProgramInvocationLBS
, getProgramInvocationOutputAndErrors
, getProgramInvocationLBSAndErrors
, getEffectiveEnvironment
) where

import Distribution.Compat.Prelude
@@ -38,8 +37,6 @@ import Distribution.Simple.Utils
import Distribution.Utils.Generic
import Distribution.Verbosity

import System.FilePath (searchPathSeparator)

import qualified Data.ByteString.Lazy as LBS
import qualified Data.Map as Map

@@ -54,8 +51,6 @@ data ProgramInvocation = ProgramInvocation {
progInvokePath :: FilePath,
progInvokeArgs :: [String],
progInvokeEnv :: [(String, Maybe String)],
-- Extra paths to add to PATH
progInvokePathEnv :: [FilePath],
progInvokeCwd :: Maybe FilePath,
progInvokeInput :: Maybe IOData,
progInvokeInputEncoding :: IOEncoding, -- ^ TODO: remove this, make user decide when constructing 'progInvokeInput'.
@@ -76,7 +71,6 @@ emptyProgramInvocation =
progInvokePath = "",
progInvokeArgs = [],
progInvokeEnv = [],
progInvokePathEnv = [],
progInvokeCwd = Nothing,
progInvokeInput = Nothing,
progInvokeInputEncoding = IOEncodingText,
@@ -107,7 +101,6 @@ runProgramInvocation verbosity
progInvokePath = path,
progInvokeArgs = args,
progInvokeEnv = [],
progInvokePathEnv = [],
progInvokeCwd = Nothing,
progInvokeInput = Nothing
} =
@@ -118,12 +111,10 @@ runProgramInvocation verbosity
progInvokePath = path,
progInvokeArgs = args,
progInvokeEnv = envOverrides,
progInvokePathEnv = extraPath,
progInvokeCwd = mcwd,
progInvokeInput = Nothing
} = do
pathOverride <- getExtraPathEnv envOverrides extraPath
menv <- getEffectiveEnvironment (envOverrides ++ pathOverride)
menv <- getEffectiveEnvironment envOverrides
maybeExit $ rawSystemIOWithEnv verbosity
path args
mcwd menv
@@ -134,13 +125,11 @@ runProgramInvocation verbosity
progInvokePath = path,
progInvokeArgs = args,
progInvokeEnv = envOverrides,
progInvokePathEnv = extraPath,
progInvokeCwd = mcwd,
progInvokeInput = Just inputStr,
progInvokeInputEncoding = encoding
} = do
pathOverride <- getExtraPathEnv envOverrides extraPath
menv <- getEffectiveEnvironment (envOverrides ++ pathOverride)
menv <- getEffectiveEnvironment envOverrides
(_, errors, exitCode) <- rawSystemStdInOut verbosity
path args
mcwd menv
@@ -174,6 +163,13 @@ getProgramInvocationOutputAndErrors verbosity inv = case progInvokeOutputEncodin
(output', errors, exitCode) <- getProgramInvocationIODataAndErrors verbosity inv IODataModeBinary
return (normaliseLineEndings (fromUTF8LBS output'), errors, exitCode)

getProgramInvocationLBSAndErrors
:: Verbosity
-> ProgramInvocation
-> IO (LBS.ByteString, String, ExitCode)
getProgramInvocationLBSAndErrors verbosity inv =
getProgramInvocationIODataAndErrors verbosity inv IODataModeBinary

getProgramInvocationIODataAndErrors
:: KnownIODataMode mode => Verbosity -> ProgramInvocation -> IODataMode mode
-> IO (mode, String, ExitCode)
@@ -183,30 +179,16 @@ getProgramInvocationIODataAndErrors
{ progInvokePath = path
, progInvokeArgs = args
, progInvokeEnv = envOverrides
, progInvokePathEnv = extraPath
, progInvokeCwd = mcwd
, progInvokeInput = minputStr
, progInvokeInputEncoding = encoding
}
mode = do
pathOverride <- getExtraPathEnv envOverrides extraPath
menv <- getEffectiveEnvironment (envOverrides ++ pathOverride)
menv <- getEffectiveEnvironment envOverrides
rawSystemStdInOut verbosity path args mcwd menv input mode
where
input = encodeToIOData encoding <$> minputStr

getExtraPathEnv :: [(String, Maybe String)] -> [FilePath] -> IO [(String, Maybe String)]
getExtraPathEnv _ [] = return []
getExtraPathEnv env extras = do
mb_path <- case lookup "PATH" env of
Just x -> return x
Nothing -> lookupEnv "PATH"
let extra = intercalate [searchPathSeparator] extras
path' = case mb_path of
Nothing -> extra
Just path -> extra ++ searchPathSeparator : path
return [("PATH", Just path')]

-- | Return the current environment extended with the given overrides.
-- If an entry is specified twice in @overrides@, the second entry takes
-- precedence.
48 changes: 30 additions & 18 deletions Cabal/src/Distribution/Simple/Program/Types.hs
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@ module Distribution.Simple.Program.Types (
Program(..),
ProgramSearchPath,
ProgramSearchPathEntry(..),
simpleProgram,

-- * Configured program and related functions
ConfiguredProgram(..),
@@ -40,7 +39,6 @@ import Prelude ()
import Distribution.Compat.Prelude

import Distribution.PackageDescription
import Distribution.Simple.Program.Find
import Distribution.Version
import Distribution.Verbosity

@@ -87,6 +85,36 @@ instance Show Program where

type ProgArg = String

-- | A search path to use when locating executables. This is analogous
-- to the unix @$PATH@ or win32 @%PATH%@ but with the ability to use
-- the system default method for finding executables ('findExecutable' which
-- on unix is simply looking on the @$PATH@ but on win32 is a bit more
-- complicated).
--
-- The default to use is @[ProgSearchPathDefault]@ but you can add extra dirs
-- either before, after or instead of the default, e.g. here we add an extra
-- dir to search after the usual ones.
--
-- > ['ProgramSearchPathDefault', 'ProgramSearchPathDir' dir]
--
-- We also use this path to set the environment when running child processes.
--
-- The @ProgramDb@ is created with a @ProgramSearchPath@ to which we
-- @appendProgramSearchPath@ to add the ones that come from cli flags and from
-- configurations. Then each of the programs that are configured in the db
-- inherits the same path as part of @configureProgram@.
type ProgramSearchPath = [ProgramSearchPathEntry]

data ProgramSearchPathEntry
= -- | A specific dir
ProgramSearchPathDir FilePath
| -- | The system default
ProgramSearchPathDefault
deriving (Eq, Generic, Typeable)

instance Binary ProgramSearchPathEntry
instance Structured ProgramSearchPathEntry

-- | Represents a program which has been configured and is thus ready to be run.
--
-- These are usually made by configuring a 'Program', but if you have to
@@ -157,22 +185,6 @@ programPath = locationPath . programLocation
suppressOverrideArgs :: ConfiguredProgram -> ConfiguredProgram
suppressOverrideArgs prog = prog { programOverrideArgs = [] }

-- | Make a simple named program.
--
-- By default we'll just search for it in the path and not try to find the
-- version name. You can override these behaviours if necessary, eg:
--
-- > (simpleProgram "foo") { programFindLocation = ... , programFindVersion ... }
--
simpleProgram :: String -> Program
simpleProgram name = Program {
programName = name,
programFindLocation = \v p -> findProgramOnSearchPath v p name,
programFindVersion = \_ _ -> return Nothing,
programPostConf = \_ p -> return p,
programNormaliseArgs = \_ _ -> id
}

-- | Make a simple 'ConfiguredProgram'.
--
-- > simpleConfiguredProgram "foo" (FoundOnSystem path)
5 changes: 4 additions & 1 deletion Cabal/src/Distribution/Simple/Register.hs
Original file line number Diff line number Diff line change
@@ -466,8 +466,11 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
|| not (null (asmSources bi))
|| not (null (cmmSources bi))
|| not (null (cxxSources bi))
|| not (null (jsSources bi)))
|| (not (null (jsSources bi)) && hasJsSupport))
&& not (componentIsIndefinite clbi)
hasJsSupport = case hostPlatform lbi of
Platform JavaScript _ -> True
_ -> False
libdirsStatic
| hasLibrary = libdir installDirs : extraLibDirsStaticOrFallback
| otherwise = extraLibDirsStaticOrFallback
Loading