Skip to content

haskellPackages.mkDerivation: make work in pkgsCross.ghcjs#209043

Merged
maralorn merged 6 commits intoNixOS:haskell-updatesfrom
sternenseemann:ghc-head-js-backend-try-1
Jan 5, 2023
Merged

haskellPackages.mkDerivation: make work in pkgsCross.ghcjs#209043
maralorn merged 6 commits intoNixOS:haskell-updatesfrom
sternenseemann:ghc-head-js-backend-try-1

Conversation

@sternenseemann
Copy link
Member

@sternenseemann sternenseemann commented Jan 4, 2023

Description of changes

Just need to account for some quirks of that particular cross set, so it works as expected.

  • Tested pkgsCross.ghcjs.haskell.packages.ghcHEAD.hello.
  • pkgsCross.aarch64-multiplatform
  • pkgsStatic
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: haskell General-purpose, statically typed, purely functional programming language label Jan 4, 2023
@sternenseemann sternenseemann marked this pull request as draft January 4, 2023 14:35
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jan 4, 2023
Previously, we would try to calculate the name of
buildPackages.stdenv.cc and then just hope that it is in PATH somehow.
This definitely doesn't work in all cases.

The new approach is to add buildPackages.stdenv.cc to depsBuildBuild
which also populates CC_FOR_BUILD which we can directly re-use.
This line may look odd, but we should not set ghc.isGhcjs if we are
using the JavaScript backend. It is a normal cross backend and no
special code is required to make it work, i.e. everything will be named
as it would be normally. Additionally, passing --ghcjs to Cabal will
make it do the wrong thing.

We need to, of course, stop strip from being thrown at the JS objects in
both cases.
The JavaScript backend emits `#!/usr/bin/env node` shebangs we need to
take care off using patchShebangs in fixupPhase.
@sternenseemann sternenseemann force-pushed the ghc-head-js-backend-try-1 branch from 31998d8 to d9591db Compare January 4, 2023 14:50
@sternenseemann sternenseemann marked this pull request as ready for review January 5, 2023 14:24
It should be just below the current output limit, but we'll see. If it
doesn't fit, we may have to disable profiling objects.
@sternenseemann
Copy link
Member Author

Should be good to go, worked out all the kinks I could find.

@maralorn
Copy link
Member

maralorn commented Jan 5, 2023

Does it make sense to call the cross target also ghcjs? Won‘t that confuse people? Should we maybe call it "js" "javascript" or something?

@sternenseemann
Copy link
Member Author

The cross target is literally called js-unknown-ghcjs upstream, so it is already named. I think since GHCJS will just go away now (it's already hard to get to work), it's not going to be very confusing.

@maralorn maralorn merged commit bd2b543 into NixOS:haskell-updates Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: haskell General-purpose, statically typed, purely functional programming language 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants