Merge master into staging-next
This commit is contained in:
@@ -602,6 +602,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
|
||||
- `buildDubPackage` can now be used to build Programs written in [D](https://dlang.org/) using the `dub` build system and package manager.
|
||||
See the [D section](https://nixos.org/manual/nixpkgs/unstable#dlang) in the manual for more information.
|
||||
|
||||
- `stalwart-mail` service uses the legacy version 0.6.X as default because newer `stalwart-mail` versions require a [manual upgrade process](https://github.com/stalwartlabs/mail-server/blob/main/UPGRADING.md). Change [`services.stalwart-mail.package`](#opt-services.stalwart-mail.package) to `pkgs.stalwart-mail` if you wish to switch to the new version.
|
||||
|
||||
- [`portunus`](https://github.com/majewsky/portunus) has been updated to major version 2.
|
||||
This version of Portunus supports strong password hashes, but the legacy hash SHA-256 is also still supported to ensure a smooth migration of existing user accounts.
|
||||
After upgrading, follow the instructions on the [upstream release notes](https://github.com/majewsky/portunus/releases/tag/v2.0.0) to upgrade all user accounts to strong password hashes.
|
||||
|
||||
@@ -1328,6 +1328,7 @@
|
||||
./services/web-apps/akkoma.nix
|
||||
./services/web-apps/alps.nix
|
||||
./services/web-apps/anuko-time-tracker.nix
|
||||
./services/web-apps/artalk.nix
|
||||
./services/web-apps/atlassian/confluence.nix
|
||||
./services/web-apps/atlassian/crowd.nix
|
||||
./services/web-apps/atlassian/jira.nix
|
||||
|
||||
@@ -6,19 +6,25 @@ in {
|
||||
meta = { maintainers = with lib.maintainers; [ numkem ]; };
|
||||
|
||||
options = {
|
||||
services.espanso = { enable = options.mkEnableOption "Espanso"; };
|
||||
services.espanso = {
|
||||
enable = mkEnableOption "Espanso";
|
||||
package = mkPackageOption pkgs "espanso" {
|
||||
example = "pkgs.espanso-wayland";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.espanso.package = mkIf cfg.wayland pkgs.espanso-wayland;
|
||||
systemd.user.services.espanso = {
|
||||
description = "Espanso daemon";
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.espanso}/bin/espanso daemon";
|
||||
ExecStart = "${lib.getExe cfg.package} daemon";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
wantedBy = [ "default.target" ];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.espanso ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -66,7 +66,14 @@ let
|
||||
HideShells = "/run/current-system/sw/bin/nologin";
|
||||
};
|
||||
|
||||
X11 = optionalAttrs xcfg.enable {
|
||||
Wayland = {
|
||||
EnableHiDPI = cfg.enableHidpi;
|
||||
SessionDir = "${dmcfg.sessionData.desktops}/share/wayland-sessions";
|
||||
CompositorCommand = lib.optionalString cfg.wayland.enable cfg.wayland.compositorCommand;
|
||||
};
|
||||
|
||||
} // optionalAttrs xcfg.enable {
|
||||
X11 = {
|
||||
MinimumVT = if xcfg.tty != null then xcfg.tty else 7;
|
||||
ServerPath = toString xserverWrapper;
|
||||
XephyrPath = "${pkgs.xorg.xorgserver.out}/bin/Xephyr";
|
||||
@@ -77,12 +84,6 @@ let
|
||||
DisplayStopCommand = toString Xstop;
|
||||
EnableHiDPI = cfg.enableHidpi;
|
||||
};
|
||||
|
||||
Wayland = {
|
||||
EnableHiDPI = cfg.enableHidpi;
|
||||
SessionDir = "${dmcfg.sessionData.desktops}/share/wayland-sessions";
|
||||
CompositorCommand = lib.optionalString cfg.wayland.enable cfg.wayland.compositorCommand;
|
||||
};
|
||||
} // optionalAttrs dmcfg.autoLogin.enable {
|
||||
Autologin = {
|
||||
User = dmcfg.autoLogin.user;
|
||||
|
||||
@@ -7,11 +7,28 @@ let
|
||||
configFormat = pkgs.formats.toml { };
|
||||
configFile = configFormat.generate "stalwart-mail.toml" cfg.settings;
|
||||
dataDir = "/var/lib/stalwart-mail";
|
||||
stalwartAtLeast = versionAtLeast cfg.package.version;
|
||||
|
||||
in {
|
||||
options.services.stalwart-mail = {
|
||||
enable = mkEnableOption "the Stalwart all-in-one email server";
|
||||
package = mkPackageOption pkgs "stalwart-mail" { };
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = ''
|
||||
Which package to use for the Stalwart mail server.
|
||||
|
||||
::: {.note}
|
||||
Upgrading from version 0.6.0 to version 0.7.0 or higher requires manual
|
||||
intervention. See <https://github.com/stalwartlabs/mail-server/blob/main/UPGRADING.md>
|
||||
for upgrade instructions.
|
||||
:::
|
||||
'';
|
||||
default = pkgs.stalwart-mail_0_6;
|
||||
defaultText = lib.literalExpression "pkgs.stalwart-mail_0_6";
|
||||
example = lib.literalExpression "pkgs.stalwart-mail";
|
||||
relatedPackages = [ "stalwart-mail_0_6" "stalwart-mail" ];
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
inherit (configFormat) type;
|
||||
@@ -26,6 +43,18 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
warnings = lib.optionals (!stalwartAtLeast "0.7.0") [
|
||||
''
|
||||
Versions of stalwart-mail < 0.7.0 will get deprecated in NixOS 24.11.
|
||||
Please set services.stalwart-mail.package to pkgs.stalwart-mail to
|
||||
upgrade to the latest version.
|
||||
Please note that upgrading to version >= 0.7 requires manual
|
||||
intervention, see <https://github.com/stalwartlabs/mail-server/blob/main/UPGRADING.md>
|
||||
for upgrade instructions.
|
||||
''
|
||||
];
|
||||
|
||||
# Default config: all local
|
||||
services.stalwart-mail.settings = {
|
||||
global.tracing.method = mkDefault "stdout";
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.artalk;
|
||||
settingsFormat = pkgs.formats.json { };
|
||||
in
|
||||
{
|
||||
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [ moraxyc ];
|
||||
};
|
||||
|
||||
options = {
|
||||
services.artalk = {
|
||||
enable = lib.mkEnableOption "artalk, a comment system";
|
||||
configFile = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/etc/artalk/config.yml";
|
||||
description = "Artalk config file path. If it is not exist, Artalk will generate one.";
|
||||
};
|
||||
allowModify = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "allow Artalk store the settings to config file persistently";
|
||||
};
|
||||
workdir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/var/lib/artalk";
|
||||
description = "Artalk working directory";
|
||||
};
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "artalk";
|
||||
description = "Artalk user name.";
|
||||
};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "artalk";
|
||||
description = "Artalk group name.";
|
||||
};
|
||||
|
||||
package = lib.mkPackageOption pkgs "artalk" { };
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
freeformType = settingsFormat.type;
|
||||
options = {
|
||||
host = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "0.0.0.0";
|
||||
description = ''
|
||||
Artalk server listen host
|
||||
'';
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 23366;
|
||||
description = ''
|
||||
Artalk server listen port
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = ''
|
||||
The artalk configuration.
|
||||
|
||||
If you set allowModify to true, Artalk will be able to store the settings in the config file persistently. This section's content will update in the config file after the service restarts.
|
||||
|
||||
Options containing secret data should be set to an attribute set
|
||||
containing the attribute `_secret` - a string pointing to a file
|
||||
containing the value the option should be set to.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users.artalk = lib.optionalAttrs (cfg.user == "artalk") {
|
||||
description = "artalk user";
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
};
|
||||
users.groups.artalk = lib.optionalAttrs (cfg.group == "artalk") { };
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
systemd.services.artalk = {
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart =
|
||||
''
|
||||
umask 0077
|
||||
${utils.genJqSecretsReplacementSnippet cfg.settings "/run/artalk/new"}
|
||||
''
|
||||
+ (
|
||||
if cfg.allowModify then
|
||||
''
|
||||
[ -e "${cfg.configFile}" ] || ${lib.getExe cfg.package} gen config "${cfg.configFile}"
|
||||
cat "${cfg.configFile}" | ${lib.getExe pkgs.yj} > "/run/artalk/old"
|
||||
${lib.getExe pkgs.jq} -s '.[0] * .[1]' "/run/artalk/old" "/run/artalk/new" > "/run/artalk/result"
|
||||
cat "/run/artalk/result" | ${lib.getExe pkgs.yj} -r > "${cfg.configFile}"
|
||||
rm /run/artalk/{old,new,result}
|
||||
''
|
||||
else
|
||||
''
|
||||
cat /run/artalk/new | ${lib.getExe pkgs.yj} -r > "${cfg.configFile}"
|
||||
rm /run/artalk/new
|
||||
''
|
||||
);
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
Type = "simple";
|
||||
ExecStart = "${lib.getExe cfg.package} server --config ${cfg.configFile} --workdir ${cfg.workdir} --host ${cfg.settings.host} --port ${builtins.toString cfg.settings.port}";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
ConfigurationDirectory = [ "artalk" ];
|
||||
StateDirectory = [ "artalk" ];
|
||||
RuntimeDirectory = [ "artalk" ];
|
||||
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
|
||||
ProtectHome = "yes";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -130,6 +130,7 @@ in {
|
||||
apparmor = handleTest ./apparmor.nix {};
|
||||
archi = handleTest ./archi.nix {};
|
||||
armagetronad = handleTest ./armagetronad.nix {};
|
||||
artalk = handleTest ./artalk.nix {};
|
||||
atd = handleTest ./atd.nix {};
|
||||
atop = handleTest ./atop.nix {};
|
||||
atuin = handleTest ./atuin.nix {};
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import ./make-test-python.nix (
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
|
||||
name = "artalk";
|
||||
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [ moraxyc ];
|
||||
};
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.curl ];
|
||||
services.artalk = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("artalk.service")
|
||||
|
||||
machine.wait_for_open_port(23366)
|
||||
|
||||
machine.succeed("curl --fail --max-time 10 http://127.0.0.1:23366/")
|
||||
'';
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
lib,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
artalk,
|
||||
testers,
|
||||
fetchurl,
|
||||
}:
|
||||
buildGoModule rec {
|
||||
pname = "artalk";
|
||||
version = "2.8.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ArtalkJS";
|
||||
repo = "artalk";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-ya/by1PaWdYS/Fsbu6wDKuUcPy55/2F5hJEqko4K57o=";
|
||||
};
|
||||
web = fetchurl {
|
||||
url = "https://github.com/${src.owner}/${src.repo}/releases/download/v${version}/artalk_ui.tar.gz";
|
||||
hash = "sha256-3Rg5mCFigLkZ+X8Fxe6A16THd9j6hcTYMEAKU1SrLMw=";
|
||||
};
|
||||
|
||||
CGO_ENABLED = 1;
|
||||
|
||||
vendorHash = "sha256-R4/keVGCpCZfLrb2OrK9vdK+N+VKFLAvFXEOA1feqKo=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X github.com/ArtalkJS/Artalk/internal/config.Version=${version}"
|
||||
"-X github.com/ArtalkJS/Artalk/internal/config.CommitHash=${version}"
|
||||
];
|
||||
preBuild = ''
|
||||
tar -xzf ${web}
|
||||
cp -r ./artalk_ui/* ./public
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
version = testers.testVersion { package = artalk; };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A self-hosted comment system";
|
||||
homepage = "https://github.com/ArtalkJS/Artalk";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ moraxyc ];
|
||||
mainProgram = "Artalk";
|
||||
};
|
||||
}
|
||||
@@ -107,7 +107,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
mit
|
||||
unfree
|
||||
];
|
||||
maintainers = with lib.maintainers; [ syedahkam ];
|
||||
maintainers = with lib.maintainers; [ syedahkam coffeeispower ];
|
||||
mainProgram = "bombsquad";
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, flutter
|
||||
, flutterPackages
|
||||
, corrosion
|
||||
, rustPlatform
|
||||
, cargo
|
||||
@@ -9,7 +9,7 @@
|
||||
, copyDesktopItems
|
||||
, makeDesktopItem
|
||||
}:
|
||||
flutter.buildFlutterApplication rec {
|
||||
flutterPackages.v3_19.buildFlutterApplication rec {
|
||||
pname = "intiface-central";
|
||||
version = "2.5.6";
|
||||
src = fetchFromGitHub {
|
||||
|
||||
@@ -11,12 +11,18 @@
|
||||
, darwin
|
||||
, nix-update-script
|
||||
, nixosTests
|
||||
, rocksdb_8_3
|
||||
, rocksdb_8_11
|
||||
}:
|
||||
|
||||
let
|
||||
version = "0.6.0";
|
||||
rocksdb = rocksdb_8_3;
|
||||
# Stalwart depends on rocksdb crate:
|
||||
# https://github.com/stalwartlabs/mail-server/blob/v0.8.0/crates/store/Cargo.toml#L10
|
||||
# which expects a specific rocksdb versions:
|
||||
# https://github.com/rust-rocksdb/rust-rocksdb/blob/v0.22.0/librocksdb-sys/Cargo.toml#L3
|
||||
# See upstream issue for rocksdb 9.X support
|
||||
# https://github.com/stalwartlabs/mail-server/issues/407
|
||||
rocksdb = rocksdb_8_11;
|
||||
version = "0.8.0";
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "stalwart-mail";
|
||||
@@ -26,13 +32,11 @@ rustPlatform.buildRustPackage {
|
||||
owner = "stalwartlabs";
|
||||
repo = "mail-server";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-OHwUWSUW6ovLQTxnuUrolQGhxbhp4YqKSH+ZTpe2WXc=";
|
||||
hash = "sha256-V6Gl59938AplFW7pbrbGWB42+zRQBEaTUSW0+TMBo8I=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
cargoHash = "sha256-LWA08GNCrDlSwcSAlAi58OkoLs41fL6J5DPCsacozsM=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"commit": "9e419b038d7108160caf4efc41ebd5dfc4d51821",
|
||||
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/9e419b038d7108160caf4efc41ebd5dfc4d51821.tar.gz",
|
||||
"sha256": "1vqsxznsq6s1hfb3b7ghs0fqa1rapqccjcz5jy3h9w3dq4v3gfqz",
|
||||
"msg": "Update from Hackage at 2024-04-27T10:57:54Z"
|
||||
"commit": "88d42dc0129b0e3f4f702149a58667c66add9262",
|
||||
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/88d42dc0129b0e3f4f702149a58667c66add9262.tar.gz",
|
||||
"sha256": "0imff76qbg1hsvsdds6dc2wfip0prdsa0bixd5b575jr6yjlkirh",
|
||||
"msg": "Update from Hackage at 2024-05-15T11:29:34Z"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{ callPackage }:
|
||||
{ callPackage, flutterPackages }:
|
||||
{
|
||||
calculator = callPackage ./calculator {};
|
||||
file-manager = callPackage ./file-manager {};
|
||||
calculator = callPackage ./calculator {
|
||||
flutter = flutterPackages.v3_19;
|
||||
};
|
||||
|
||||
file-manager = callPackage ./file-manager {
|
||||
flutter = flutterPackages.v3_19;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -141,7 +141,9 @@ let
|
||||
homepage = "https://flutter.dev";
|
||||
license = licenses.bsd3;
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
maintainers = with maintainers; [ babariviere ericdallo FlafyDev hacker1024 ];
|
||||
maintainers = teams.flutter.members ++ (with maintainers; [
|
||||
babariviere ericdallo
|
||||
]);
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+13
@@ -0,0 +1,13 @@
|
||||
diff --git a/bin/internal/shared.sh b/bin/internal/shared.sh
|
||||
index 75d9d3013e..657ad3cb78 100644
|
||||
--- a/bin/internal/shared.sh
|
||||
+++ b/bin/internal/shared.sh
|
||||
@@ -245,7 +245,7 @@ function shared::execute() {
|
||||
# and will corrupt each others' downloads.
|
||||
#
|
||||
# SHARED_NAME itself is prepared by the caller script.
|
||||
- upgrade_flutter 7< "$SHARED_NAME"
|
||||
+ # upgrade_flutter 7< "$SHARED_NAME"
|
||||
|
||||
BIN_NAME="$(basename "$PROG_NAME")"
|
||||
case "$BIN_NAME" in
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
This patch introduces an intermediate Gradle build step to alter the behavior
|
||||
of flutter_tools' Gradle project, specifically moving the creation of `build`
|
||||
and `.gradle` directories from within the Nix Store to somewhere in `$HOME/.cache/flutter/nix-flutter-tools-gradle/$engineShortRev`.
|
||||
|
||||
Without this patch, flutter_tools' Gradle project tries to generate `build` and `.gradle`
|
||||
directories within the Nix Store. Resulting in read-only errors when trying to build a
|
||||
Flutter Android app at runtime.
|
||||
|
||||
This patch takes advantage of the fact settings.gradle takes priority over settings.gradle.kts to build the intermediate Gradle project
|
||||
when a Flutter app runs `includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")`
|
||||
|
||||
`rootProject.buildFileName = "/dev/null"` so that the intermediate project doesn't use `build.gradle.kts` that's in the same directory.
|
||||
|
||||
The intermediate project makes a `settings.gradle` file in `$HOME/.cache/flutter/nix-flutter-tools-gradle/<short engine rev>/` and `includeBuild`s it.
|
||||
This Gradle project will build the actual `packages/flutter_tools/gradle` project by setting
|
||||
`rootProject.projectDir = new File("$settingsDir")` and `apply from: new File("$settingsDir/settings.gradle.kts")`.
|
||||
|
||||
Now the `.gradle` will be built in `$HOME/.cache/flutter/nix-flutter-tools-gradle/<short engine rev>/`, but `build` doesn't.
|
||||
To move `build` to `$HOME/.cache/flutter/nix-flutter-tools-gradle/<short engine rev>/` as well, we need to set `buildDirectory`.
|
||||
diff --git a/packages/flutter_tools/gradle/settings.gradle b/packages/flutter_tools/gradle/settings.gradle
|
||||
new file mode 100644
|
||||
index 0000000000..b2485c94b4
|
||||
--- /dev/null
|
||||
+++ b/packages/flutter_tools/gradle/settings.gradle
|
||||
@@ -0,0 +1,19 @@
|
||||
+rootProject.buildFileName = "/dev/null"
|
||||
+
|
||||
+def engineShortRev = (new File("$settingsDir/../../../bin/internal/engine.version")).text.take(10)
|
||||
+def dir = new File("$System.env.HOME/.cache/flutter/nix-flutter-tools-gradle/$engineShortRev")
|
||||
+dir.mkdirs()
|
||||
+def file = new File(dir, "settings.gradle")
|
||||
+
|
||||
+file.text = """
|
||||
+rootProject.projectDir = new File("$settingsDir")
|
||||
+apply from: new File("$settingsDir/settings.gradle.kts")
|
||||
+
|
||||
+gradle.allprojects { project ->
|
||||
+ project.beforeEvaluate {
|
||||
+ project.layout.buildDirectory = new File("$dir/build")
|
||||
+ }
|
||||
+}
|
||||
+"""
|
||||
+
|
||||
+includeBuild(dir)
|
||||
@@ -1,393 +1,4 @@
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
, autoconf, automake, coreutils, fetchurl, perl, python3, m4, sphinx, xattr
|
||||
, autoSignDarwinBinariesHook
|
||||
, bash
|
||||
, fetchpatch
|
||||
|
||||
, libiconv ? null, ncurses
|
||||
, glibcLocales ? null
|
||||
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc)
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
buildTargetLlvmPackages, llvmPackages
|
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slightly slower native
|
||||
# bignum backend instead of the faster but GPLed gmp backend.
|
||||
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
|
||||
&& lib.meta.availableOn stdenv.targetPlatform gmp)
|
||||
, gmp
|
||||
|
||||
, # If enabled, use -fPIC when compiling static libs.
|
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
|
||||
|
||||
, enableProfiledLibs ? true
|
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg")
|
||||
|
||||
, # Whether to build sphinx documentation.
|
||||
enableDocs ? (
|
||||
# Docs disabled if we are building on musl because it's a large task to keep
|
||||
# all `sphinx` dependencies building in this environment.
|
||||
!stdenv.buildPlatform.isMusl
|
||||
)
|
||||
|
||||
, enableHaddockProgram ?
|
||||
# Disabled for cross; see note [HADDOCK_DOCS].
|
||||
(stdenv.targetPlatform == stdenv.hostPlatform)
|
||||
|
||||
, # Whether to disable the large address space allocator
|
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
|
||||
}:
|
||||
|
||||
assert !enableNativeBignum -> gmp != null;
|
||||
|
||||
# Cross cannot currently build the `haddock` program for silly reasons,
|
||||
# see note [HADDOCK_DOCS].
|
||||
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
inherit (bootPkgs) ghc;
|
||||
|
||||
# TODO(@Ericson2314) Make unconditional
|
||||
targetPrefix = lib.optionalString
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
# program is built (which we generally always want to have a complete GHC install)
|
||||
# and whether it is run on the GHC sources to generate hyperlinked source code
|
||||
# (which is impossible for cross-compilation); see:
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
|
||||
# This implies that currently a cross-compiled GHC will never have a `haddock`
|
||||
# program, so it can never generate haddocks for any packages.
|
||||
# If this is solved in the future, we'd like to unconditionally
|
||||
# build the haddock program (removing the `enableHaddockProgram` option).
|
||||
''
|
||||
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
|
||||
# Build haddocks for boot packages with hyperlinking
|
||||
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
|
||||
'' + lib.optionalString (targetPlatform != hostPlatform) ''
|
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
|
||||
CrossCompilePrefix = ${targetPrefix}
|
||||
'' + lib.optionalString (!enableProfiledLibs) ''
|
||||
BUILD_PROF_LIBS = NO
|
||||
'' +
|
||||
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
|
||||
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
|
||||
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
|
||||
lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
EXTRA_CC_OPTS += -std=gnu99
|
||||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: lib.optional enableTerminfo ncurses
|
||||
++ [libffi]
|
||||
++ lib.optional (!enableNativeBignum) gmp
|
||||
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
|
||||
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
|
||||
# GHC doesn't seem to have {LLC,OPT}_HOST
|
||||
toolsForTarget = [
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
|
||||
# derivation for certain tools depending on the platform.
|
||||
bintoolsFor = {
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
};
|
||||
|
||||
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
|
||||
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
|
||||
# see #84670 and #49071 for more background.
|
||||
useLdGold = targetPlatform.linker == "gold" ||
|
||||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
|
||||
|
||||
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
|
||||
variantSuffix = lib.concatStrings [
|
||||
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
|
||||
(lib.optionalString enableNativeBignum "-native-bignum")
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
# C compiler, bintools and LLVM are used at build time, but will also leak into
|
||||
# the resulting GHC's settings file and used at runtime. This means that we are
|
||||
# currently only able to build GHC if hostPlatform == buildPlatform.
|
||||
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
|
||||
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.0.2";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "140e42b96346322d1a39eb17602bcdc76e292028ad4a69286b230bab188a9197";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
|
||||
(fetchpatch {
|
||||
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
|
||||
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
|
||||
extraPrefix = "utils/haddock/";
|
||||
stripLen = 1;
|
||||
})
|
||||
|
||||
# Add flag that fixes C++ exception handling; opt-in. Merged in 9.4 and 9.2.2.
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7423
|
||||
(fetchpatch {
|
||||
name = "ghc-9.0.2-fcompact-unwind.patch";
|
||||
# Note that the test suite is not packaged.
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/c6132c782d974a7701e7f6447bdcd2bf6db4299a.patch?merge_request_iid=7423";
|
||||
sha256 = "sha256-b4feGZIaKDj/UKjWTNY6/jH4s2iate0wAgMxG3rAbZI=";
|
||||
})
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-3.2-3.4-paths-fix-cycle-aarch64-darwin.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC needs the locale configured during the Haddock phase.
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
|
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
|
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
|
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
|
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
|
||||
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
|
||||
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
|
||||
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
|
||||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
'' + lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
|
||||
'' + lib.optionalString targetPlatform.isMusl ''
|
||||
echo "patching llvm-targets for musl targets..."
|
||||
echo "Cloning these existing '*-linux-gnu*' targets:"
|
||||
grep linux-gnu llvm-targets | sed 's/^/ /'
|
||||
echo "(go go gadget sed)"
|
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
|
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:"
|
||||
grep linux-musl llvm-targets | sed 's/^/ /'
|
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
|
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
|
||||
for x in configure aclocal.m4; do
|
||||
substituteInPlace $x \
|
||||
--replace '*-android*|*-gnueabi*)' \
|
||||
'*-android*|*-gnueabi*|*-musleabi*)'
|
||||
done
|
||||
'';
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (targetPlatform != hostPlatform) "target";
|
||||
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
|
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
|
||||
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
"--with-iconv-includes=${libiconv}/include"
|
||||
"--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ lib.optionals (targetPlatform != hostPlatform) [
|
||||
"--enable-bootstrap-with-devel-snapshot"
|
||||
] ++ lib.optionals useLdGold [
|
||||
"CFLAGS=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||
] ++ lib.optionals (disableLargeAddressSpace) [
|
||||
"--disable-large-address-space"
|
||||
];
|
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatibility.
|
||||
strictDeps = true;
|
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
|
||||
dontAddExtraLibs = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
|
||||
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
# TODO(@sternenseemann): backport addition of XATTR env var like
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6447
|
||||
xattr
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
|
||||
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
|
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
hardeningDisable =
|
||||
[ "format" ]
|
||||
# In nixpkgs, musl based builds currently enable `pie` hardening by default
|
||||
# (see `defaultHardeningFlags` in `make-derivation.nix`).
|
||||
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
|
||||
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
|
||||
# See:
|
||||
# * https://github.com/NixOS/nixpkgs/issues/129247
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
|
||||
++ lib.optional stdenv.targetPlatform.isMusl "pie";
|
||||
|
||||
# big-parallel allows us to build with more than 2 cores on
|
||||
# Hydra which already warrants a significant speedup
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
postInstall = ''
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
inherit enableShared;
|
||||
|
||||
# This is used by the haskell builder to query
|
||||
# the presence of the haddock program.
|
||||
hasHaddock = enableHaddockProgram;
|
||||
|
||||
# Our Cabal compiler name
|
||||
haskellCompilerName = "ghc-${version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://haskell.org/ghc";
|
||||
description = "The Glasgow Haskell Compiler";
|
||||
maintainers = with lib.maintainers; [
|
||||
guibou
|
||||
] ++ lib.teams.haskell.members;
|
||||
timeout = 24 * 3600;
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
sha256 = "140e42b96346322d1a39eb17602bcdc76e292028ad4a69286b230bab188a9197";
|
||||
}
|
||||
|
||||
@@ -1,389 +1,4 @@
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
|
||||
, xattr, autoSignDarwinBinariesHook
|
||||
, bash
|
||||
|
||||
, libiconv ? null, ncurses
|
||||
, glibcLocales ? null
|
||||
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc
|
||||
|| stdenv.targetPlatform.isAarch64)
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
buildTargetLlvmPackages, llvmPackages
|
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slightly slower native
|
||||
# bignum backend instead of the faster but GPLed gmp backend.
|
||||
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
|
||||
&& lib.meta.availableOn stdenv.targetPlatform gmp)
|
||||
, gmp
|
||||
|
||||
, # If enabled, use -fPIC when compiling static libs.
|
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
|
||||
|
||||
, enableProfiledLibs ? true
|
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg")
|
||||
|
||||
, # Whether to build sphinx documentation.
|
||||
enableDocs ? (
|
||||
# Docs disabled if we are building on musl because it's a large task to keep
|
||||
# all `sphinx` dependencies building in this environment.
|
||||
!stdenv.buildPlatform.isMusl
|
||||
)
|
||||
|
||||
, enableHaddockProgram ?
|
||||
# Disabled for cross; see note [HADDOCK_DOCS].
|
||||
(stdenv.targetPlatform == stdenv.hostPlatform)
|
||||
|
||||
, # Whether to disable the large address space allocator
|
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
|
||||
}:
|
||||
|
||||
assert !enableNativeBignum -> gmp != null;
|
||||
|
||||
# Cross cannot currently build the `haddock` program for silly reasons,
|
||||
# see note [HADDOCK_DOCS].
|
||||
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
inherit (bootPkgs) ghc;
|
||||
|
||||
# TODO(@Ericson2314) Make unconditional
|
||||
targetPrefix = lib.optionalString
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
# program is built (which we generally always want to have a complete GHC install)
|
||||
# and whether it is run on the GHC sources to generate hyperlinked source code
|
||||
# (which is impossible for cross-compilation); see:
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
|
||||
# This implies that currently a cross-compiled GHC will never have a `haddock`
|
||||
# program, so it can never generate haddocks for any packages.
|
||||
# If this is solved in the future, we'd like to unconditionally
|
||||
# build the haddock program (removing the `enableHaddockProgram` option).
|
||||
''
|
||||
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
|
||||
# Build haddocks for boot packages with hyperlinking
|
||||
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
|
||||
'' + lib.optionalString (targetPlatform != hostPlatform) ''
|
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
|
||||
CrossCompilePrefix = ${targetPrefix}
|
||||
'' + lib.optionalString (!enableProfiledLibs) ''
|
||||
BUILD_PROF_LIBS = NO
|
||||
'' +
|
||||
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
|
||||
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
|
||||
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
|
||||
lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
EXTRA_CC_OPTS += -std=gnu99
|
||||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: lib.optional enableTerminfo ncurses
|
||||
++ [libffi]
|
||||
++ lib.optional (!enableNativeBignum) gmp
|
||||
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
|
||||
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
|
||||
# GHC doesn't seem to have {LLC,OPT}_HOST
|
||||
toolsForTarget = [
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
|
||||
# derivation for certain tools depending on the platform.
|
||||
bintoolsFor = {
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
};
|
||||
|
||||
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
|
||||
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
|
||||
# see #84670 and #49071 for more background.
|
||||
useLdGold = targetPlatform.linker == "gold" ||
|
||||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
|
||||
|
||||
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
|
||||
variantSuffix = lib.concatStrings [
|
||||
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
|
||||
(lib.optionalString enableNativeBignum "-native-bignum")
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
# C compiler, bintools and LLVM are used at build time, but will also leak into
|
||||
# the resulting GHC's settings file and used at runtime. This means that we are
|
||||
# currently only able to build GHC if hostPlatform == buildPlatform.
|
||||
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
|
||||
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.2.5";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "0606797d1b38e2d88ee2243f38ec6b9a1aa93e9b578e95f0de9a9c0a4144021c";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
|
||||
(fetchpatch {
|
||||
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
|
||||
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
|
||||
extraPrefix = "utils/haddock/";
|
||||
stripLen = 1;
|
||||
})
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC needs the locale configured during the Haddock phase.
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
|
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
|
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
|
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
|
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
|
||||
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
|
||||
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
|
||||
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
|
||||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
'' + lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
|
||||
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
|
||||
export XATTR=${lib.getBin xattr}/bin/xattr
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
|
||||
'' + lib.optionalString targetPlatform.isMusl ''
|
||||
echo "patching llvm-targets for musl targets..."
|
||||
echo "Cloning these existing '*-linux-gnu*' targets:"
|
||||
grep linux-gnu llvm-targets | sed 's/^/ /'
|
||||
echo "(go go gadget sed)"
|
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
|
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:"
|
||||
grep linux-musl llvm-targets | sed 's/^/ /'
|
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
|
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
|
||||
for x in configure aclocal.m4; do
|
||||
substituteInPlace $x \
|
||||
--replace '*-android*|*-gnueabi*)' \
|
||||
'*-android*|*-gnueabi*|*-musleabi*)'
|
||||
done
|
||||
'';
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (targetPlatform != hostPlatform) "target";
|
||||
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
|
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
|
||||
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
"--with-iconv-includes=${libiconv}/include"
|
||||
"--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ lib.optionals (targetPlatform != hostPlatform) [
|
||||
"--enable-bootstrap-with-devel-snapshot"
|
||||
] ++ lib.optionals useLdGold [
|
||||
"CFLAGS=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||
] ++ lib.optionals (disableLargeAddressSpace) [
|
||||
"--disable-large-address-space"
|
||||
];
|
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatibility.
|
||||
strictDeps = true;
|
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
|
||||
dontAddExtraLibs = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
|
||||
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
|
||||
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
|
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
hardeningDisable =
|
||||
[ "format" ]
|
||||
# In nixpkgs, musl based builds currently enable `pie` hardening by default
|
||||
# (see `defaultHardeningFlags` in `make-derivation.nix`).
|
||||
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
|
||||
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
|
||||
# See:
|
||||
# * https://github.com/NixOS/nixpkgs/issues/129247
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
|
||||
++ lib.optional stdenv.targetPlatform.isMusl "pie";
|
||||
|
||||
# big-parallel allows us to build with more than 2 cores on
|
||||
# Hydra which already warrants a significant speedup
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
postInstall = ''
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
inherit enableShared;
|
||||
|
||||
# This is used by the haskell builder to query
|
||||
# the presence of the haddock program.
|
||||
hasHaddock = enableHaddockProgram;
|
||||
|
||||
# Our Cabal compiler name
|
||||
haskellCompilerName = "ghc-${version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://haskell.org/ghc";
|
||||
description = "The Glasgow Haskell Compiler";
|
||||
maintainers = with lib.maintainers; [
|
||||
guibou
|
||||
] ++ lib.teams.haskell.members;
|
||||
timeout = 24 * 3600;
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
sha256 = "0606797d1b38e2d88ee2243f38ec6b9a1aa93e9b578e95f0de9a9c0a4144021c";
|
||||
}
|
||||
|
||||
@@ -1,389 +1,4 @@
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
|
||||
, xattr, autoSignDarwinBinariesHook
|
||||
, bash
|
||||
|
||||
, libiconv ? null, ncurses
|
||||
, glibcLocales ? null
|
||||
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc
|
||||
|| stdenv.targetPlatform.isAarch64)
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
buildTargetLlvmPackages, llvmPackages
|
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slightly slower native
|
||||
# bignum backend instead of the faster but GPLed gmp backend.
|
||||
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
|
||||
&& lib.meta.availableOn stdenv.targetPlatform gmp)
|
||||
, gmp
|
||||
|
||||
, # If enabled, use -fPIC when compiling static libs.
|
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
|
||||
|
||||
, enableProfiledLibs ? true
|
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg")
|
||||
|
||||
, # Whether to build sphinx documentation.
|
||||
enableDocs ? (
|
||||
# Docs disabled if we are building on musl because it's a large task to keep
|
||||
# all `sphinx` dependencies building in this environment.
|
||||
!stdenv.buildPlatform.isMusl
|
||||
)
|
||||
|
||||
, enableHaddockProgram ?
|
||||
# Disabled for cross; see note [HADDOCK_DOCS].
|
||||
(stdenv.targetPlatform == stdenv.hostPlatform)
|
||||
|
||||
, # Whether to disable the large address space allocator
|
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
|
||||
}:
|
||||
|
||||
assert !enableNativeBignum -> gmp != null;
|
||||
|
||||
# Cross cannot currently build the `haddock` program for silly reasons,
|
||||
# see note [HADDOCK_DOCS].
|
||||
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
inherit (bootPkgs) ghc;
|
||||
|
||||
# TODO(@Ericson2314) Make unconditional
|
||||
targetPrefix = lib.optionalString
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
# program is built (which we generally always want to have a complete GHC install)
|
||||
# and whether it is run on the GHC sources to generate hyperlinked source code
|
||||
# (which is impossible for cross-compilation); see:
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
|
||||
# This implies that currently a cross-compiled GHC will never have a `haddock`
|
||||
# program, so it can never generate haddocks for any packages.
|
||||
# If this is solved in the future, we'd like to unconditionally
|
||||
# build the haddock program (removing the `enableHaddockProgram` option).
|
||||
''
|
||||
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
|
||||
# Build haddocks for boot packages with hyperlinking
|
||||
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
|
||||
'' + lib.optionalString (targetPlatform != hostPlatform) ''
|
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
|
||||
CrossCompilePrefix = ${targetPrefix}
|
||||
'' + lib.optionalString (!enableProfiledLibs) ''
|
||||
BUILD_PROF_LIBS = NO
|
||||
'' +
|
||||
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
|
||||
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
|
||||
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
|
||||
lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
EXTRA_CC_OPTS += -std=gnu99
|
||||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: lib.optional enableTerminfo ncurses
|
||||
++ [libffi]
|
||||
++ lib.optional (!enableNativeBignum) gmp
|
||||
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
|
||||
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
|
||||
# GHC doesn't seem to have {LLC,OPT}_HOST
|
||||
toolsForTarget = [
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
|
||||
# derivation for certain tools depending on the platform.
|
||||
bintoolsFor = {
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
};
|
||||
|
||||
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
|
||||
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
|
||||
# see #84670 and #49071 for more background.
|
||||
useLdGold = targetPlatform.linker == "gold" ||
|
||||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
|
||||
|
||||
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
|
||||
variantSuffix = lib.concatStrings [
|
||||
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
|
||||
(lib.optionalString enableNativeBignum "-native-bignum")
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
# C compiler, bintools and LLVM are used at build time, but will also leak into
|
||||
# the resulting GHC's settings file and used at runtime. This means that we are
|
||||
# currently only able to build GHC if hostPlatform == buildPlatform.
|
||||
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
|
||||
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.2.6";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "7a54cf0398ad488b4ed219e15d1d1e64c0b6876c43a0564550dd11f0540d7305";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
|
||||
(fetchpatch {
|
||||
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
|
||||
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
|
||||
extraPrefix = "utils/haddock/";
|
||||
stripLen = 1;
|
||||
})
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC needs the locale configured during the Haddock phase.
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
|
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
|
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
|
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
|
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
|
||||
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
|
||||
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
|
||||
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
|
||||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
'' + lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
|
||||
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
|
||||
export XATTR=${lib.getBin xattr}/bin/xattr
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
|
||||
'' + lib.optionalString targetPlatform.isMusl ''
|
||||
echo "patching llvm-targets for musl targets..."
|
||||
echo "Cloning these existing '*-linux-gnu*' targets:"
|
||||
grep linux-gnu llvm-targets | sed 's/^/ /'
|
||||
echo "(go go gadget sed)"
|
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
|
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:"
|
||||
grep linux-musl llvm-targets | sed 's/^/ /'
|
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
|
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
|
||||
for x in configure aclocal.m4; do
|
||||
substituteInPlace $x \
|
||||
--replace '*-android*|*-gnueabi*)' \
|
||||
'*-android*|*-gnueabi*|*-musleabi*)'
|
||||
done
|
||||
'';
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (targetPlatform != hostPlatform) "target";
|
||||
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
|
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
|
||||
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
"--with-iconv-includes=${libiconv}/include"
|
||||
"--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ lib.optionals (targetPlatform != hostPlatform) [
|
||||
"--enable-bootstrap-with-devel-snapshot"
|
||||
] ++ lib.optionals useLdGold [
|
||||
"CFLAGS=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||
] ++ lib.optionals (disableLargeAddressSpace) [
|
||||
"--disable-large-address-space"
|
||||
];
|
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatibility.
|
||||
strictDeps = true;
|
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
|
||||
dontAddExtraLibs = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
|
||||
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
|
||||
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
|
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
hardeningDisable =
|
||||
[ "format" ]
|
||||
# In nixpkgs, musl based builds currently enable `pie` hardening by default
|
||||
# (see `defaultHardeningFlags` in `make-derivation.nix`).
|
||||
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
|
||||
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
|
||||
# See:
|
||||
# * https://github.com/NixOS/nixpkgs/issues/129247
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
|
||||
++ lib.optional stdenv.targetPlatform.isMusl "pie";
|
||||
|
||||
# big-parallel allows us to build with more than 2 cores on
|
||||
# Hydra which already warrants a significant speedup
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
postInstall = ''
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
inherit enableShared;
|
||||
|
||||
# This is used by the haskell builder to query
|
||||
# the presence of the haddock program.
|
||||
hasHaddock = enableHaddockProgram;
|
||||
|
||||
# Our Cabal compiler name
|
||||
haskellCompilerName = "ghc-${version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://haskell.org/ghc";
|
||||
description = "The Glasgow Haskell Compiler";
|
||||
maintainers = with lib.maintainers; [
|
||||
guibou
|
||||
] ++ lib.teams.haskell.members;
|
||||
timeout = 24 * 3600;
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
sha256 = "7a54cf0398ad488b4ed219e15d1d1e64c0b6876c43a0564550dd11f0540d7305";
|
||||
}
|
||||
|
||||
@@ -1,389 +1,4 @@
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
|
||||
, xattr, autoSignDarwinBinariesHook
|
||||
, bash
|
||||
|
||||
, libiconv ? null, ncurses
|
||||
, glibcLocales ? null
|
||||
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc
|
||||
|| stdenv.targetPlatform.isAarch64)
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
buildTargetLlvmPackages, llvmPackages
|
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slightly slower native
|
||||
# bignum backend instead of the faster but GPLed gmp backend.
|
||||
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
|
||||
&& lib.meta.availableOn stdenv.targetPlatform gmp)
|
||||
, gmp
|
||||
|
||||
, # If enabled, use -fPIC when compiling static libs.
|
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
|
||||
|
||||
, enableProfiledLibs ? true
|
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg")
|
||||
|
||||
, # Whether to build sphinx documentation.
|
||||
enableDocs ? (
|
||||
# Docs disabled if we are building on musl because it's a large task to keep
|
||||
# all `sphinx` dependencies building in this environment.
|
||||
!stdenv.buildPlatform.isMusl
|
||||
)
|
||||
|
||||
, enableHaddockProgram ?
|
||||
# Disabled for cross; see note [HADDOCK_DOCS].
|
||||
(stdenv.targetPlatform == stdenv.hostPlatform)
|
||||
|
||||
, # Whether to disable the large address space allocator
|
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
|
||||
}:
|
||||
|
||||
assert !enableNativeBignum -> gmp != null;
|
||||
|
||||
# Cross cannot currently build the `haddock` program for silly reasons,
|
||||
# see note [HADDOCK_DOCS].
|
||||
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
inherit (bootPkgs) ghc;
|
||||
|
||||
# TODO(@Ericson2314) Make unconditional
|
||||
targetPrefix = lib.optionalString
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
# program is built (which we generally always want to have a complete GHC install)
|
||||
# and whether it is run on the GHC sources to generate hyperlinked source code
|
||||
# (which is impossible for cross-compilation); see:
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
|
||||
# This implies that currently a cross-compiled GHC will never have a `haddock`
|
||||
# program, so it can never generate haddocks for any packages.
|
||||
# If this is solved in the future, we'd like to unconditionally
|
||||
# build the haddock program (removing the `enableHaddockProgram` option).
|
||||
''
|
||||
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
|
||||
# Build haddocks for boot packages with hyperlinking
|
||||
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
|
||||
'' + lib.optionalString (targetPlatform != hostPlatform) ''
|
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
|
||||
CrossCompilePrefix = ${targetPrefix}
|
||||
'' + lib.optionalString (!enableProfiledLibs) ''
|
||||
BUILD_PROF_LIBS = NO
|
||||
'' +
|
||||
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
|
||||
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
|
||||
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
|
||||
lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
EXTRA_CC_OPTS += -std=gnu99
|
||||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: lib.optional enableTerminfo ncurses
|
||||
++ [libffi]
|
||||
++ lib.optional (!enableNativeBignum) gmp
|
||||
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
|
||||
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
|
||||
# GHC doesn't seem to have {LLC,OPT}_HOST
|
||||
toolsForTarget = [
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
|
||||
# derivation for certain tools depending on the platform.
|
||||
bintoolsFor = {
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
};
|
||||
|
||||
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
|
||||
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
|
||||
# see #84670 and #49071 for more background.
|
||||
useLdGold = targetPlatform.linker == "gold" ||
|
||||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
|
||||
|
||||
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
|
||||
variantSuffix = lib.concatStrings [
|
||||
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
|
||||
(lib.optionalString enableNativeBignum "-native-bignum")
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
# C compiler, bintools and LLVM are used at build time, but will also leak into
|
||||
# the resulting GHC's settings file and used at runtime. This means that we are
|
||||
# currently only able to build GHC if hostPlatform == buildPlatform.
|
||||
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
|
||||
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.2.7";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "a253567a17b734a4c0dd0ffa296d33c2a5b5a54a77df988806a2a1e1ca7e88b8";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
|
||||
(fetchpatch {
|
||||
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
|
||||
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
|
||||
extraPrefix = "utils/haddock/";
|
||||
stripLen = 1;
|
||||
})
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC needs the locale configured during the Haddock phase.
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
|
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
|
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
|
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
|
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
|
||||
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
|
||||
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
|
||||
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
|
||||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
'' + lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
|
||||
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
|
||||
export XATTR=${lib.getBin xattr}/bin/xattr
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
|
||||
'' + lib.optionalString targetPlatform.isMusl ''
|
||||
echo "patching llvm-targets for musl targets..."
|
||||
echo "Cloning these existing '*-linux-gnu*' targets:"
|
||||
grep linux-gnu llvm-targets | sed 's/^/ /'
|
||||
echo "(go go gadget sed)"
|
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
|
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:"
|
||||
grep linux-musl llvm-targets | sed 's/^/ /'
|
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
|
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
|
||||
for x in configure aclocal.m4; do
|
||||
substituteInPlace $x \
|
||||
--replace '*-android*|*-gnueabi*)' \
|
||||
'*-android*|*-gnueabi*|*-musleabi*)'
|
||||
done
|
||||
'';
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (targetPlatform != hostPlatform) "target";
|
||||
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
|
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
|
||||
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
"--with-iconv-includes=${libiconv}/include"
|
||||
"--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ lib.optionals (targetPlatform != hostPlatform) [
|
||||
"--enable-bootstrap-with-devel-snapshot"
|
||||
] ++ lib.optionals useLdGold [
|
||||
"CFLAGS=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||
] ++ lib.optionals (disableLargeAddressSpace) [
|
||||
"--disable-large-address-space"
|
||||
];
|
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatibility.
|
||||
strictDeps = true;
|
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
|
||||
dontAddExtraLibs = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
|
||||
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
|
||||
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
|
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
hardeningDisable =
|
||||
[ "format" ]
|
||||
# In nixpkgs, musl based builds currently enable `pie` hardening by default
|
||||
# (see `defaultHardeningFlags` in `make-derivation.nix`).
|
||||
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
|
||||
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
|
||||
# See:
|
||||
# * https://github.com/NixOS/nixpkgs/issues/129247
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
|
||||
++ lib.optional stdenv.targetPlatform.isMusl "pie";
|
||||
|
||||
# big-parallel allows us to build with more than 2 cores on
|
||||
# Hydra which already warrants a significant speedup
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
postInstall = ''
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
inherit enableShared;
|
||||
|
||||
# This is used by the haskell builder to query
|
||||
# the presence of the haddock program.
|
||||
hasHaddock = enableHaddockProgram;
|
||||
|
||||
# Our Cabal compiler name
|
||||
haskellCompilerName = "ghc-${version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://haskell.org/ghc";
|
||||
description = "The Glasgow Haskell Compiler";
|
||||
maintainers = with lib.maintainers; [
|
||||
guibou
|
||||
] ++ lib.teams.haskell.members;
|
||||
timeout = 24 * 3600;
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
sha256 = "a253567a17b734a4c0dd0ffa296d33c2a5b5a54a77df988806a2a1e1ca7e88b8";
|
||||
}
|
||||
|
||||
@@ -1,389 +1,4 @@
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
|
||||
, xattr, autoSignDarwinBinariesHook
|
||||
, bash
|
||||
|
||||
, libiconv ? null, ncurses
|
||||
, glibcLocales ? null
|
||||
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc
|
||||
|| stdenv.targetPlatform.isAarch64)
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
buildTargetLlvmPackages, llvmPackages
|
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slightly slower native
|
||||
# bignum backend instead of the faster but GPLed gmp backend.
|
||||
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
|
||||
&& lib.meta.availableOn stdenv.targetPlatform gmp)
|
||||
, gmp
|
||||
|
||||
, # If enabled, use -fPIC when compiling static libs.
|
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
|
||||
|
||||
, enableProfiledLibs ? true
|
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg")
|
||||
|
||||
, # Whether to build sphinx documentation.
|
||||
enableDocs ? (
|
||||
# Docs disabled if we are building on musl because it's a large task to keep
|
||||
# all `sphinx` dependencies building in this environment.
|
||||
!stdenv.buildPlatform.isMusl
|
||||
)
|
||||
|
||||
, enableHaddockProgram ?
|
||||
# Disabled for cross; see note [HADDOCK_DOCS].
|
||||
(stdenv.targetPlatform == stdenv.hostPlatform)
|
||||
|
||||
, # Whether to disable the large address space allocator
|
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
|
||||
}:
|
||||
|
||||
assert !enableNativeBignum -> gmp != null;
|
||||
|
||||
# Cross cannot currently build the `haddock` program for silly reasons,
|
||||
# see note [HADDOCK_DOCS].
|
||||
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
inherit (bootPkgs) ghc;
|
||||
|
||||
# TODO(@Ericson2314) Make unconditional
|
||||
targetPrefix = lib.optionalString
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
# program is built (which we generally always want to have a complete GHC install)
|
||||
# and whether it is run on the GHC sources to generate hyperlinked source code
|
||||
# (which is impossible for cross-compilation); see:
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
|
||||
# This implies that currently a cross-compiled GHC will never have a `haddock`
|
||||
# program, so it can never generate haddocks for any packages.
|
||||
# If this is solved in the future, we'd like to unconditionally
|
||||
# build the haddock program (removing the `enableHaddockProgram` option).
|
||||
''
|
||||
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
|
||||
# Build haddocks for boot packages with hyperlinking
|
||||
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
|
||||
'' + lib.optionalString (targetPlatform != hostPlatform) ''
|
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
|
||||
CrossCompilePrefix = ${targetPrefix}
|
||||
'' + lib.optionalString (!enableProfiledLibs) ''
|
||||
BUILD_PROF_LIBS = NO
|
||||
'' +
|
||||
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
|
||||
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
|
||||
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
|
||||
lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
EXTRA_CC_OPTS += -std=gnu99
|
||||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: lib.optional enableTerminfo ncurses
|
||||
++ [libffi]
|
||||
++ lib.optional (!enableNativeBignum) gmp
|
||||
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
|
||||
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
|
||||
# GHC doesn't seem to have {LLC,OPT}_HOST
|
||||
toolsForTarget = [
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
|
||||
# derivation for certain tools depending on the platform.
|
||||
bintoolsFor = {
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
};
|
||||
|
||||
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
|
||||
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
|
||||
# see #84670 and #49071 for more background.
|
||||
useLdGold = targetPlatform.linker == "gold" ||
|
||||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
|
||||
|
||||
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
|
||||
variantSuffix = lib.concatStrings [
|
||||
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
|
||||
(lib.optionalString enableNativeBignum "-native-bignum")
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
# C compiler, bintools and LLVM are used at build time, but will also leak into
|
||||
# the resulting GHC's settings file and used at runtime. This means that we are
|
||||
# currently only able to build GHC if hostPlatform == buildPlatform.
|
||||
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
|
||||
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.2.8";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "sha256-XxPReGv0/RL0tF+qN6vttbs/NtXlj32lMH6L/oilZ6E=";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
|
||||
(fetchpatch {
|
||||
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
|
||||
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
|
||||
extraPrefix = "utils/haddock/";
|
||||
stripLen = 1;
|
||||
})
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC needs the locale configured during the Haddock phase.
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
|
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
|
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
|
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
|
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
|
||||
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
|
||||
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
|
||||
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
|
||||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
'' + lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
|
||||
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
|
||||
export XATTR=${lib.getBin xattr}/bin/xattr
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
|
||||
'' + lib.optionalString targetPlatform.isMusl ''
|
||||
echo "patching llvm-targets for musl targets..."
|
||||
echo "Cloning these existing '*-linux-gnu*' targets:"
|
||||
grep linux-gnu llvm-targets | sed 's/^/ /'
|
||||
echo "(go go gadget sed)"
|
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
|
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:"
|
||||
grep linux-musl llvm-targets | sed 's/^/ /'
|
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
|
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
|
||||
for x in configure aclocal.m4; do
|
||||
substituteInPlace $x \
|
||||
--replace '*-android*|*-gnueabi*)' \
|
||||
'*-android*|*-gnueabi*|*-musleabi*)'
|
||||
done
|
||||
'';
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (targetPlatform != hostPlatform) "target";
|
||||
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
|
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
|
||||
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
"--with-iconv-includes=${libiconv}/include"
|
||||
"--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ lib.optionals (targetPlatform != hostPlatform) [
|
||||
"--enable-bootstrap-with-devel-snapshot"
|
||||
] ++ lib.optionals useLdGold [
|
||||
"CFLAGS=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||
] ++ lib.optionals (disableLargeAddressSpace) [
|
||||
"--disable-large-address-space"
|
||||
];
|
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatibility.
|
||||
strictDeps = true;
|
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
|
||||
dontAddExtraLibs = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
|
||||
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
|
||||
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
|
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
hardeningDisable =
|
||||
[ "format" ]
|
||||
# In nixpkgs, musl based builds currently enable `pie` hardening by default
|
||||
# (see `defaultHardeningFlags` in `make-derivation.nix`).
|
||||
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
|
||||
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
|
||||
# See:
|
||||
# * https://github.com/NixOS/nixpkgs/issues/129247
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
|
||||
++ lib.optional stdenv.targetPlatform.isMusl "pie";
|
||||
|
||||
# big-parallel allows us to build with more than 2 cores on
|
||||
# Hydra which already warrants a significant speedup
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
postInstall = ''
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
inherit enableShared;
|
||||
|
||||
# This is used by the haskell builder to query
|
||||
# the presence of the haddock program.
|
||||
hasHaddock = enableHaddockProgram;
|
||||
|
||||
# Our Cabal compiler name
|
||||
haskellCompilerName = "ghc-${version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://haskell.org/ghc";
|
||||
description = "The Glasgow Haskell Compiler";
|
||||
maintainers = with lib.maintainers; [
|
||||
guibou
|
||||
] ++ lib.teams.haskell.members;
|
||||
timeout = 24 * 3600;
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
sha256 = "sha256-XxPReGv0/RL0tF+qN6vttbs/NtXlj32lMH6L/oilZ6E=";
|
||||
}
|
||||
|
||||
@@ -1,396 +1,6 @@
|
||||
# DO NOT port this expression to hadrian. It is not possible to build a GHC
|
||||
# cross compiler with 9.4.* and hadrian.
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
|
||||
, xattr, autoSignDarwinBinariesHook
|
||||
, bash
|
||||
|
||||
, libiconv ? null, ncurses
|
||||
, glibcLocales ? null
|
||||
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc
|
||||
|| stdenv.targetPlatform.isAarch64)
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
buildTargetLlvmPackages, llvmPackages
|
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slightly slower native
|
||||
# bignum backend instead of the faster but GPLed gmp backend.
|
||||
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
|
||||
&& lib.meta.availableOn stdenv.targetPlatform gmp)
|
||||
, gmp
|
||||
|
||||
, # If enabled, use -fPIC when compiling static libs.
|
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
|
||||
|
||||
, enableProfiledLibs ? true
|
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg")
|
||||
|
||||
, # Whether to build sphinx documentation.
|
||||
enableDocs ? (
|
||||
# Docs disabled if we are building on musl because it's a large task to keep
|
||||
# all `sphinx` dependencies building in this environment.
|
||||
!stdenv.buildPlatform.isMusl
|
||||
)
|
||||
|
||||
, enableHaddockProgram ?
|
||||
# Disabled for cross; see note [HADDOCK_DOCS].
|
||||
(stdenv.targetPlatform == stdenv.hostPlatform)
|
||||
|
||||
, # Whether to disable the large address space allocator
|
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
|
||||
}:
|
||||
|
||||
assert !enableNativeBignum -> gmp != null;
|
||||
|
||||
# Cross cannot currently build the `haddock` program for silly reasons,
|
||||
# see note [HADDOCK_DOCS].
|
||||
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
inherit (bootPkgs) ghc;
|
||||
|
||||
# TODO(@Ericson2314) Make unconditional
|
||||
targetPrefix = lib.optionalString
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
# program is built (which we generally always want to have a complete GHC install)
|
||||
# and whether it is run on the GHC sources to generate hyperlinked source code
|
||||
# (which is impossible for cross-compilation); see:
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
|
||||
# This implies that currently a cross-compiled GHC will never have a `haddock`
|
||||
# program, so it can never generate haddocks for any packages.
|
||||
# If this is solved in the future, we'd like to unconditionally
|
||||
# build the haddock program (removing the `enableHaddockProgram` option).
|
||||
''
|
||||
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
|
||||
# Build haddocks for boot packages with hyperlinking
|
||||
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
|
||||
'' + lib.optionalString (targetPlatform != hostPlatform) ''
|
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
|
||||
CrossCompilePrefix = ${targetPrefix}
|
||||
'' + lib.optionalString (!enableProfiledLibs) ''
|
||||
BUILD_PROF_LIBS = NO
|
||||
'' +
|
||||
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
|
||||
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
|
||||
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
|
||||
lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
EXTRA_CC_OPTS += -std=gnu99
|
||||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: lib.optional enableTerminfo ncurses
|
||||
++ [libffi]
|
||||
++ lib.optional (!enableNativeBignum) gmp
|
||||
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
|
||||
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
|
||||
# GHC doesn't seem to have {LLC,OPT}_HOST
|
||||
toolsForTarget = [
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
|
||||
# derivation for certain tools depending on the platform.
|
||||
bintoolsFor = {
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
};
|
||||
|
||||
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
|
||||
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
|
||||
# see #84670 and #49071 for more background.
|
||||
useLdGold = targetPlatform.linker == "gold" ||
|
||||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
|
||||
|
||||
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
|
||||
variantSuffix = lib.concatStrings [
|
||||
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
|
||||
(lib.optionalString enableNativeBignum "-native-bignum")
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
# C compiler, bintools and LLVM are used at build time, but will also leak into
|
||||
# the resulting GHC's settings file and used at runtime. This means that we are
|
||||
# currently only able to build GHC if hostPlatform == buildPlatform.
|
||||
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
|
||||
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.4.5";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "6256cf9caf6d6dc7b611dcfbb247df2d528e85aa39d22a698e870e5a590e8601";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC needs the locale configured during the Haddock phase.
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
|
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
|
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
|
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
|
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
|
||||
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
|
||||
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
|
||||
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
|
||||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
'' + lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
|
||||
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
|
||||
export XATTR=${lib.getBin xattr}/bin/xattr
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
|
||||
'' + lib.optionalString targetPlatform.isMusl ''
|
||||
echo "patching llvm-targets for musl targets..."
|
||||
echo "Cloning these existing '*-linux-gnu*' targets:"
|
||||
grep linux-gnu llvm-targets | sed 's/^/ /'
|
||||
echo "(go go gadget sed)"
|
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
|
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:"
|
||||
grep linux-musl llvm-targets | sed 's/^/ /'
|
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
|
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
|
||||
for x in configure aclocal.m4; do
|
||||
substituteInPlace $x \
|
||||
--replace '*-android*|*-gnueabi*)' \
|
||||
'*-android*|*-gnueabi*|*-musleabi*)'
|
||||
done
|
||||
''
|
||||
# HACK: allow bootstrapping with GHC 8.10 which works fine, as we don't have
|
||||
# binary 9.0 packaged. Bootstrapping with 9.2 is broken without hadrian.
|
||||
+ ''
|
||||
substituteInPlace configure --replace \
|
||||
'MinBootGhcVersion="9.0"' \
|
||||
'MinBootGhcVersion="8.10"'
|
||||
'';
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (targetPlatform != hostPlatform) "target";
|
||||
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
|
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
|
||||
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
"--with-iconv-includes=${libiconv}/include"
|
||||
"--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ lib.optionals (targetPlatform != hostPlatform) [
|
||||
"--enable-bootstrap-with-devel-snapshot"
|
||||
] ++ lib.optionals useLdGold [
|
||||
"CFLAGS=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||
] ++ lib.optionals (disableLargeAddressSpace) [
|
||||
"--disable-large-address-space"
|
||||
];
|
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatibility.
|
||||
strictDeps = true;
|
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
|
||||
dontAddExtraLibs = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
|
||||
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
|
||||
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
|
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
hardeningDisable =
|
||||
[ "format" ]
|
||||
# In nixpkgs, musl based builds currently enable `pie` hardening by default
|
||||
# (see `defaultHardeningFlags` in `make-derivation.nix`).
|
||||
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
|
||||
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
|
||||
# See:
|
||||
# * https://github.com/NixOS/nixpkgs/issues/129247
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
|
||||
++ lib.optional stdenv.targetPlatform.isMusl "pie";
|
||||
|
||||
# big-parallel allows us to build with more than 2 cores on
|
||||
# Hydra which already warrants a significant speedup
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
postInstall = ''
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
inherit enableShared;
|
||||
|
||||
# This is used by the haskell builder to query
|
||||
# the presence of the haddock program.
|
||||
hasHaddock = enableHaddockProgram;
|
||||
|
||||
# Our Cabal compiler name
|
||||
haskellCompilerName = "ghc-${version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://haskell.org/ghc";
|
||||
description = "The Glasgow Haskell Compiler";
|
||||
maintainers = with lib.maintainers; [
|
||||
guibou
|
||||
] ++ lib.teams.haskell.members;
|
||||
timeout = 24 * 3600;
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
sha256 = "6256cf9caf6d6dc7b611dcfbb247df2d528e85aa39d22a698e870e5a590e8601";
|
||||
}
|
||||
|
||||
@@ -1,392 +1,6 @@
|
||||
# DO NOT port this expression to hadrian. It is not possible to build a GHC
|
||||
# cross compiler with 9.4.* and hadrian.
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
|
||||
, xattr, autoSignDarwinBinariesHook
|
||||
, bash
|
||||
|
||||
, libiconv ? null, ncurses
|
||||
, glibcLocales ? null
|
||||
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc
|
||||
|| stdenv.targetPlatform.isAarch64)
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
buildTargetLlvmPackages, llvmPackages
|
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slightly slower native
|
||||
# bignum backend instead of the faster but GPLed gmp backend.
|
||||
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
|
||||
&& lib.meta.availableOn stdenv.targetPlatform gmp)
|
||||
, gmp
|
||||
|
||||
, # If enabled, use -fPIC when compiling static libs.
|
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
|
||||
|
||||
, enableProfiledLibs ? true
|
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg")
|
||||
|
||||
, # Whether to build sphinx documentation.
|
||||
enableDocs ? (
|
||||
# Docs disabled if we are building on musl because it's a large task to keep
|
||||
# all `sphinx` dependencies building in this environment.
|
||||
!stdenv.buildPlatform.isMusl
|
||||
)
|
||||
|
||||
, enableHaddockProgram ?
|
||||
# Disabled for cross; see note [HADDOCK_DOCS].
|
||||
(stdenv.targetPlatform == stdenv.hostPlatform)
|
||||
|
||||
, # Whether to disable the large address space allocator
|
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
|
||||
}:
|
||||
|
||||
assert !enableNativeBignum -> gmp != null;
|
||||
|
||||
# Cross cannot currently build the `haddock` program for silly reasons,
|
||||
# see note [HADDOCK_DOCS].
|
||||
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
inherit (bootPkgs) ghc;
|
||||
|
||||
# TODO(@Ericson2314) Make unconditional
|
||||
targetPrefix = lib.optionalString
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
# program is built (which we generally always want to have a complete GHC install)
|
||||
# and whether it is run on the GHC sources to generate hyperlinked source code
|
||||
# (which is impossible for cross-compilation); see:
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
|
||||
# This implies that currently a cross-compiled GHC will never have a `haddock`
|
||||
# program, so it can never generate haddocks for any packages.
|
||||
# If this is solved in the future, we'd like to unconditionally
|
||||
# build the haddock program (removing the `enableHaddockProgram` option).
|
||||
''
|
||||
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
|
||||
# Build haddocks for boot packages with hyperlinking
|
||||
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
|
||||
'' + lib.optionalString (targetPlatform != hostPlatform) ''
|
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
|
||||
CrossCompilePrefix = ${targetPrefix}
|
||||
'' + lib.optionalString (!enableProfiledLibs) ''
|
||||
BUILD_PROF_LIBS = NO
|
||||
'' +
|
||||
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
|
||||
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
|
||||
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
|
||||
lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
EXTRA_CC_OPTS += -std=gnu99
|
||||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: lib.optional enableTerminfo ncurses
|
||||
++ [libffi]
|
||||
++ lib.optional (!enableNativeBignum) gmp
|
||||
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
|
||||
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
|
||||
# GHC doesn't seem to have {LLC,OPT}_HOST
|
||||
toolsForTarget = [
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
|
||||
# derivation for certain tools depending on the platform.
|
||||
bintoolsFor = {
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
};
|
||||
|
||||
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
|
||||
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
|
||||
# see #84670 and #49071 for more background.
|
||||
useLdGold = targetPlatform.linker == "gold" ||
|
||||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
|
||||
|
||||
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
|
||||
variantSuffix = lib.concatStrings [
|
||||
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
|
||||
(lib.optionalString enableNativeBignum "-native-bignum")
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
# C compiler, bintools and LLVM are used at build time, but will also leak into
|
||||
# the resulting GHC's settings file and used at runtime. This means that we are
|
||||
# currently only able to build GHC if hostPlatform == buildPlatform.
|
||||
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
|
||||
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.4.6";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "1b705cf52692f9d4d6707cdf8e761590f5f56ec8ea6a65e36610db392d3d24b9";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
|
||||
# Work around a type not being defined when including Rts.h in bytestring's cbits
|
||||
# due to missing feature macros. See https://gitlab.haskell.org/ghc/ghc/-/issues/23810.
|
||||
./9.4.6-bytestring-posix-source.patch
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC needs the locale configured during the Haddock phase.
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
|
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
|
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
|
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
|
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
|
||||
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
|
||||
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
|
||||
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
|
||||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
'' + lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
|
||||
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
|
||||
export XATTR=${lib.getBin xattr}/bin/xattr
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
|
||||
'' + lib.optionalString targetPlatform.isMusl ''
|
||||
echo "patching llvm-targets for musl targets..."
|
||||
echo "Cloning these existing '*-linux-gnu*' targets:"
|
||||
grep linux-gnu llvm-targets | sed 's/^/ /'
|
||||
echo "(go go gadget sed)"
|
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
|
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:"
|
||||
grep linux-musl llvm-targets | sed 's/^/ /'
|
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
|
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
|
||||
for x in configure aclocal.m4; do
|
||||
substituteInPlace $x \
|
||||
--replace '*-android*|*-gnueabi*)' \
|
||||
'*-android*|*-gnueabi*|*-musleabi*)'
|
||||
done
|
||||
''
|
||||
# HACK: allow bootstrapping with GHC 8.10 which works fine, as we don't have
|
||||
# binary 9.0 packaged. Bootstrapping with 9.2 is broken without hadrian.
|
||||
+ ''
|
||||
substituteInPlace configure --replace \
|
||||
'MinBootGhcVersion="9.0"' \
|
||||
'MinBootGhcVersion="8.10"'
|
||||
'';
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (targetPlatform != hostPlatform) "target";
|
||||
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
|
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
|
||||
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
"--with-iconv-includes=${libiconv}/include"
|
||||
"--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ lib.optionals (targetPlatform != hostPlatform) [
|
||||
"--enable-bootstrap-with-devel-snapshot"
|
||||
] ++ lib.optionals useLdGold [
|
||||
"CFLAGS=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||
] ++ lib.optionals (disableLargeAddressSpace) [
|
||||
"--disable-large-address-space"
|
||||
];
|
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatibility.
|
||||
strictDeps = true;
|
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
|
||||
dontAddExtraLibs = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
|
||||
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
|
||||
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
|
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
hardeningDisable =
|
||||
[ "format" ]
|
||||
# In nixpkgs, musl based builds currently enable `pie` hardening by default
|
||||
# (see `defaultHardeningFlags` in `make-derivation.nix`).
|
||||
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
|
||||
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
|
||||
# See:
|
||||
# * https://github.com/NixOS/nixpkgs/issues/129247
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
|
||||
++ lib.optional stdenv.targetPlatform.isMusl "pie";
|
||||
|
||||
# big-parallel allows us to build with more than 2 cores on
|
||||
# Hydra which already warrants a significant speedup
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
postInstall = ''
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
inherit enableShared;
|
||||
|
||||
# This is used by the haskell builder to query
|
||||
# the presence of the haddock program.
|
||||
hasHaddock = enableHaddockProgram;
|
||||
|
||||
# Our Cabal compiler name
|
||||
haskellCompilerName = "ghc-${version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://haskell.org/ghc";
|
||||
description = "The Glasgow Haskell Compiler";
|
||||
maintainers = with lib.maintainers; [
|
||||
guibou
|
||||
] ++ lib.teams.haskell.members;
|
||||
timeout = 24 * 3600;
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
sha256 = "1b705cf52692f9d4d6707cdf8e761590f5f56ec8ea6a65e36610db392d3d24b9";
|
||||
}
|
||||
|
||||
@@ -1,388 +1,6 @@
|
||||
# DO NOT port this expression to hadrian. It is not possible to build a GHC
|
||||
# cross compiler with 9.4.* and hadrian.
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
|
||||
, xattr, autoSignDarwinBinariesHook
|
||||
, bash
|
||||
|
||||
, libiconv ? null, ncurses
|
||||
, glibcLocales ? null
|
||||
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc
|
||||
|| stdenv.targetPlatform.isAarch64)
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
buildTargetLlvmPackages, llvmPackages
|
||||
|
||||
, # If enabled, GHC will be built with the GPL-free but slightly slower native
|
||||
# bignum backend instead of the faster but GPLed gmp backend.
|
||||
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
|
||||
&& lib.meta.availableOn stdenv.targetPlatform gmp)
|
||||
, gmp
|
||||
|
||||
, # If enabled, use -fPIC when compiling static libs.
|
||||
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
|
||||
|
||||
, enableProfiledLibs ? true
|
||||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
|
||||
|
||||
, # Whether to build terminfo.
|
||||
enableTerminfo ? !stdenv.targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
(if useLLVM then "perf-cross" else "perf-cross-ncg")
|
||||
|
||||
, # Whether to build sphinx documentation.
|
||||
enableDocs ? (
|
||||
# Docs disabled if we are building on musl because it's a large task to keep
|
||||
# all `sphinx` dependencies building in this environment.
|
||||
!stdenv.buildPlatform.isMusl
|
||||
)
|
||||
|
||||
, enableHaddockProgram ?
|
||||
# Disabled for cross; see note [HADDOCK_DOCS].
|
||||
(stdenv.targetPlatform == stdenv.hostPlatform)
|
||||
|
||||
, # Whether to disable the large address space allocator
|
||||
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
|
||||
}:
|
||||
|
||||
assert !enableNativeBignum -> gmp != null;
|
||||
|
||||
# Cross cannot currently build the `haddock` program for silly reasons,
|
||||
# see note [HADDOCK_DOCS].
|
||||
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
inherit (bootPkgs) ghc;
|
||||
|
||||
# TODO(@Ericson2314) Make unconditional
|
||||
targetPrefix = lib.optionalString
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' +
|
||||
# Note [HADDOCK_DOCS]:
|
||||
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
|
||||
# program is built (which we generally always want to have a complete GHC install)
|
||||
# and whether it is run on the GHC sources to generate hyperlinked source code
|
||||
# (which is impossible for cross-compilation); see:
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
|
||||
# This implies that currently a cross-compiled GHC will never have a `haddock`
|
||||
# program, so it can never generate haddocks for any packages.
|
||||
# If this is solved in the future, we'd like to unconditionally
|
||||
# build the haddock program (removing the `enableHaddockProgram` option).
|
||||
''
|
||||
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
|
||||
# Build haddocks for boot packages with hyperlinking
|
||||
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
|
||||
|
||||
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
|
||||
'' + lib.optionalString (targetPlatform != hostPlatform) ''
|
||||
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
|
||||
CrossCompilePrefix = ${targetPrefix}
|
||||
'' + lib.optionalString (!enableProfiledLibs) ''
|
||||
BUILD_PROF_LIBS = NO
|
||||
'' +
|
||||
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
|
||||
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
|
||||
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
|
||||
lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
EXTRA_CC_OPTS += -std=gnu99
|
||||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: lib.optional enableTerminfo ncurses
|
||||
++ [libffi]
|
||||
++ lib.optional (!enableNativeBignum) gmp
|
||||
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
|
||||
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
|
||||
# GHC doesn't seem to have {LLC,OPT}_HOST
|
||||
toolsForTarget = [
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
|
||||
# derivation for certain tools depending on the platform.
|
||||
bintoolsFor = {
|
||||
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
|
||||
# part of the bintools wrapper (due to codesigning requirements), but not on
|
||||
# x86_64-darwin.
|
||||
install_name_tool =
|
||||
if stdenv.targetPlatform.isAarch64
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
# Same goes for strip.
|
||||
strip =
|
||||
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
|
||||
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
|
||||
then targetCC.bintools
|
||||
else targetCC.bintools.bintools;
|
||||
};
|
||||
|
||||
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
|
||||
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
|
||||
# see #84670 and #49071 for more background.
|
||||
useLdGold = targetPlatform.linker == "gold" ||
|
||||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
|
||||
|
||||
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
|
||||
variantSuffix = lib.concatStrings [
|
||||
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
|
||||
(lib.optionalString enableNativeBignum "-native-bignum")
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
# C compiler, bintools and LLVM are used at build time, but will also leak into
|
||||
# the resulting GHC's settings file and used at runtime. This means that we are
|
||||
# currently only able to build GHC if hostPlatform == buildPlatform.
|
||||
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
|
||||
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.4.7";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "06775a52b4d13ac09edc6dabc299fd11e59d8886bbcae450af367baee2684c8f";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC needs the locale configured during the Haddock phase.
|
||||
LANG = "en_US.UTF-8";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
|
||||
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
|
||||
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
|
||||
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
|
||||
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
|
||||
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
|
||||
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
|
||||
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
|
||||
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
|
||||
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
|
||||
'' + lib.optionalString useLLVM ''
|
||||
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
|
||||
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
'' + lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
|
||||
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
|
||||
export XATTR=${lib.getBin xattr}/bin/xattr
|
||||
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
|
||||
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
|
||||
'' + lib.optionalString targetPlatform.isMusl ''
|
||||
echo "patching llvm-targets for musl targets..."
|
||||
echo "Cloning these existing '*-linux-gnu*' targets:"
|
||||
grep linux-gnu llvm-targets | sed 's/^/ /'
|
||||
echo "(go go gadget sed)"
|
||||
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
|
||||
echo "llvm-targets now contains these '*-linux-musl*' targets:"
|
||||
grep linux-musl llvm-targets | sed 's/^/ /'
|
||||
|
||||
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
|
||||
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
|
||||
for x in configure aclocal.m4; do
|
||||
substituteInPlace $x \
|
||||
--replace '*-android*|*-gnueabi*)' \
|
||||
'*-android*|*-gnueabi*|*-musleabi*)'
|
||||
done
|
||||
''
|
||||
# HACK: allow bootstrapping with GHC 8.10 which works fine, as we don't have
|
||||
# binary 9.0 packaged. Bootstrapping with 9.2 is broken without hadrian.
|
||||
+ ''
|
||||
substituteInPlace configure --replace \
|
||||
'MinBootGhcVersion="9.0"' \
|
||||
'MinBootGhcVersion="8.10"'
|
||||
'';
|
||||
|
||||
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||
configurePlatforms = [ "build" "host" ]
|
||||
++ lib.optional (targetPlatform != hostPlatform) "target";
|
||||
|
||||
# `--with` flags for libraries needed for RTS linker
|
||||
configureFlags = [
|
||||
"--datadir=$doc/share/doc/ghc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
] ++ lib.optionals (libffi != null) [
|
||||
"--with-system-libffi"
|
||||
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
|
||||
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
|
||||
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
|
||||
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
|
||||
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
"--with-iconv-includes=${libiconv}/include"
|
||||
"--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ lib.optionals (targetPlatform != hostPlatform) [
|
||||
"--enable-bootstrap-with-devel-snapshot"
|
||||
] ++ lib.optionals useLdGold [
|
||||
"CFLAGS=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||
] ++ lib.optionals (disableLargeAddressSpace) [
|
||||
"--disable-large-address-space"
|
||||
];
|
||||
|
||||
# Make sure we never relax`$PATH` and hooks support for compatibility.
|
||||
strictDeps = true;
|
||||
|
||||
# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
|
||||
dontAddExtraLibs = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
|
||||
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
|
||||
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
|
||||
|
||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
checkTarget = "test";
|
||||
|
||||
hardeningDisable =
|
||||
[ "format" ]
|
||||
# In nixpkgs, musl based builds currently enable `pie` hardening by default
|
||||
# (see `defaultHardeningFlags` in `make-derivation.nix`).
|
||||
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
|
||||
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
|
||||
# See:
|
||||
# * https://github.com/NixOS/nixpkgs/issues/129247
|
||||
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
|
||||
++ lib.optional stdenv.targetPlatform.isMusl "pie";
|
||||
|
||||
# big-parallel allows us to build with more than 2 cores on
|
||||
# Hydra which already warrants a significant speedup
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
|
||||
postInstall = ''
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
inherit enableShared;
|
||||
|
||||
# This is used by the haskell builder to query
|
||||
# the presence of the haddock program.
|
||||
hasHaddock = enableHaddockProgram;
|
||||
|
||||
# Our Cabal compiler name
|
||||
haskellCompilerName = "ghc-${version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "http://haskell.org/ghc";
|
||||
description = "The Glasgow Haskell Compiler";
|
||||
maintainers = with lib.maintainers; [
|
||||
guibou
|
||||
] ++ lib.teams.haskell.members;
|
||||
timeout = 24 * 3600;
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
sha256 = "06775a52b4d13ac09edc6dabc299fd11e59d8886bbcae450af367baee2684c8f";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# DO NOT port this expression to hadrian. It is not possible to build a GHC
|
||||
# cross compiler with 9.4.* and hadrian.
|
||||
import ./common-make-native-bignum.nix {
|
||||
version = "9.4.8";
|
||||
sha256 = "0bf407eb67fe3e3c24b0f4c8dea8cb63e07f63ca0f76cf2058565143507ab85e";
|
||||
}
|
||||
+94
-11
@@ -1,5 +1,8 @@
|
||||
# DO NOT port this expression to hadrian. It is not possible to build a GHC
|
||||
# cross compiler with 9.4.* and hadrian.
|
||||
{ version
|
||||
, sha256
|
||||
, url ? "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz"
|
||||
}:
|
||||
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
|
||||
# build-tools
|
||||
@@ -17,7 +20,7 @@
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isSparc
|
||||
|| stdenv.targetPlatform.isAarch64)
|
||||
|| (lib.versionAtLeast version "9.2" && stdenv.targetPlatform.isAarch64))
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
@@ -173,19 +176,61 @@ assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
|
||||
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
version = "9.4.8";
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
|
||||
sha256 = "0bf407eb67fe3e3c24b0f4c8dea8cb63e07f63ca0f76cf2058565143507ab85e";
|
||||
inherit url sha256;
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
# FIXME(@sternenseemann): This can be simplified a lot (causing a rebuild)
|
||||
patches = (if lib.versions.majorMinor version == "9.0" then [
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
|
||||
(fetchpatch {
|
||||
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
|
||||
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
|
||||
extraPrefix = "utils/haddock/";
|
||||
stripLen = 1;
|
||||
})
|
||||
|
||||
# Add flag that fixes C++ exception handling; opt-in. Merged in 9.4 and 9.2.2.
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7423
|
||||
(fetchpatch {
|
||||
name = "ghc-9.0.2-fcompact-unwind.patch";
|
||||
# Note that the test suite is not packaged.
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/c6132c782d974a7701e7f6447bdcd2bf6db4299a.patch?merge_request_iid=7423";
|
||||
sha256 = "sha256-b4feGZIaKDj/UKjWTNY6/jH4s2iate0wAgMxG3rAbZI=";
|
||||
})
|
||||
] else if lib.versions.majorMinor version == "9.2" then [
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
|
||||
(fetchpatch {
|
||||
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
|
||||
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
|
||||
extraPrefix = "utils/haddock/";
|
||||
stripLen = 1;
|
||||
})
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
@@ -194,17 +239,45 @@ stdenv.mkDerivation (rec {
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
] else if lib.versions.majorMinor version == "9.4" then [
|
||||
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
|
||||
# Can be removed if the Cabal library included with ghc backports the linked fix
|
||||
(fetchpatch {
|
||||
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
|
||||
stripLen = 1;
|
||||
extraPrefix = "libraries/Cabal/";
|
||||
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
|
||||
})
|
||||
]
|
||||
++ lib.optionals (version == "9.4.5") [
|
||||
# Fix docs build with sphinx >= 6.0
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
|
||||
(fetchpatch {
|
||||
name = "ghc-docs-sphinx-6.0.patch";
|
||||
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
|
||||
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
|
||||
})
|
||||
]
|
||||
++ [
|
||||
|
||||
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
|
||||
./docs-sphinx-7.patch
|
||||
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
]
|
||||
++ lib.optionals (version == "9.4.6") [
|
||||
# Work around a type not being defined when including Rts.h in bytestring's cbits
|
||||
# due to missing feature macros. See https://gitlab.haskell.org/ghc/ghc/-/issues/23810.
|
||||
./9.4.6-bytestring-posix-source.patch
|
||||
] else [ ])
|
||||
++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
|
||||
# Prevent the paths module from emitting symbols that we don't use
|
||||
# when building with separate outputs.
|
||||
#
|
||||
# These cause problems as they're not eliminated by GHC's dead code
|
||||
# elimination on aarch64-darwin. (see
|
||||
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
|
||||
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
(if lib.versionAtLeast version "9.2"
|
||||
then ./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
|
||||
else ./Cabal-3.2-3.4-paths-fix-cycle-aarch64-darwin.patch)
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
@@ -239,10 +312,15 @@ stdenv.mkDerivation (rec {
|
||||
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
''
|
||||
+ lib.optionalString (version == "9.0.2" || lib.versionAtLeast version "9.4") ''
|
||||
|
||||
'' + ''
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
'' + lib.optionalString (lib.versionAtLeast version "9.4") ''
|
||||
|
||||
''
|
||||
+ lib.optionalString (lib.versionOlder version "9.2" || lib.versionAtLeast version "9.4") ''
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
@@ -250,6 +328,7 @@ stdenv.mkDerivation (rec {
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
'' + lib.optionalString (stdenv.isDarwin && lib.versionAtLeast version "9.2") ''
|
||||
|
||||
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
|
||||
export XATTR=${lib.getBin xattr}/bin/xattr
|
||||
@@ -274,7 +353,7 @@ stdenv.mkDerivation (rec {
|
||||
''
|
||||
# HACK: allow bootstrapping with GHC 8.10 which works fine, as we don't have
|
||||
# binary 9.0 packaged. Bootstrapping with 9.2 is broken without hadrian.
|
||||
+ ''
|
||||
+ lib.optionalString (lib.versions.majorMinor version == "9.4") ''
|
||||
substituteInPlace configure --replace \
|
||||
'MinBootGhcVersion="9.0"' \
|
||||
'MinBootGhcVersion="8.10"'
|
||||
@@ -321,6 +400,10 @@ stdenv.mkDerivation (rec {
|
||||
autoSignDarwinBinariesHook
|
||||
] ++ lib.optionals enableDocs [
|
||||
sphinx
|
||||
] ++ lib.optionals (stdenv.isDarwin && lib.versions.majorMinor version == "9.0") [
|
||||
# TODO(@sternenseemann): backport addition of XATTR env var like
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6447
|
||||
xattr
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
@@ -24,7 +24,7 @@ self: super: {
|
||||
Cabal-syntax = self.Cabal-syntax_3_10_3_0;
|
||||
} // lib.optionalAttrs (lib.versionOlder self.ghc.version "9.2.5") {
|
||||
# Use process core package when possible
|
||||
process = self.process_1_6_19_0;
|
||||
process = self.process_1_6_20_0;
|
||||
}));
|
||||
|
||||
# cabal-install needs most recent versions of Cabal and Cabal-syntax,
|
||||
@@ -48,7 +48,7 @@ self: super: {
|
||||
# cabal-install, but we need to recompile process even if the correct
|
||||
# version is available to prevent inconsistent dependencies:
|
||||
# process depends on directory.
|
||||
process = cself.process_1_6_19_0;
|
||||
process = cself.process_1_6_20_0;
|
||||
|
||||
# Prevent dependency on doctest which causes an inconsistent dependency
|
||||
# due to depending on ghc which depends on directory etc.
|
||||
@@ -220,16 +220,6 @@ self: super: {
|
||||
fused-effects-random = doJailbreak super.fused-effects-random;
|
||||
fused-effects-readline = doJailbreak super.fused-effects-readline;
|
||||
|
||||
# Allow scotty < 0.21
|
||||
# For < 0.22 add https://github.com/taffybar/taffybar/commit/71fe820d892a85e49ad2f2843eac0a59e01f3fd4
|
||||
taffybar = appendPatches [
|
||||
(pkgs.fetchpatch {
|
||||
name = "taffybar-scotty-0.20.patch";
|
||||
url = "https://github.com/taffybar/taffybar/commit/dcc4184fa63295d51b6c6efb2f97f23b13170e66.patch";
|
||||
sha256 = "0hsn0zxpc8icabdq48jlkfn2v07xfjy4l344fnq2pbdc5apcm0fy";
|
||||
})
|
||||
] super.taffybar;
|
||||
|
||||
# fix tests failure for base≥4.15 (https://github.com/kim/leveldb-haskell/pull/41)
|
||||
leveldb-haskell = appendPatch (fetchpatch {
|
||||
url = "https://github.com/kim/leveldb-haskell/commit/f5249081f589233890ddb1945ec548ca9fb717cf.patch";
|
||||
@@ -389,7 +379,7 @@ self: super: {
|
||||
name = "git-annex-${super.git-annex.version}-src";
|
||||
url = "git://git-annex.branchable.com/";
|
||||
rev = "refs/tags/" + super.git-annex.version;
|
||||
sha256 = "sha256-tlEsBXfELnK9rU4LHSDNby/yym+guqXjsh2GA+L9aWA=";
|
||||
sha256 = "sha256-adV7I1P0O/dqH1rEyf3c2Vp4GSiiHReJyqnkSOYQGT0=";
|
||||
# delete android and Android directories which cause issues on
|
||||
# darwin (case insensitive directory). Since we don't need them
|
||||
# during the build process, we can delete it to prevent a hash
|
||||
@@ -558,6 +548,9 @@ self: super: {
|
||||
# 2022-02-14: Strict upper bound: https://github.com/psibi/streamly-bytestring/issues/30
|
||||
streamly-bytestring = dontCheck (doJailbreak super.streamly-bytestring);
|
||||
|
||||
# 2024-05-18: Upstream tests against a different pandoc version
|
||||
pandoc-crossref = dontCheck super.pandoc-crossref;
|
||||
|
||||
# base bound
|
||||
digit = doJailbreak super.digit;
|
||||
|
||||
@@ -2997,7 +2990,7 @@ self: super: {
|
||||
}) super.kmonad;
|
||||
|
||||
ghc-syntax-highlighter_0_0_11_0 = super.ghc-syntax-highlighter_0_0_11_0.overrideScope(self: super: {
|
||||
ghc-lib-parser = self.ghc-lib-parser_9_8_2_20240223;
|
||||
ghc-lib-parser = self.ghc-lib-parser_9_10_1_20240511;
|
||||
});
|
||||
|
||||
# 2024-03-17: broken
|
||||
@@ -3102,6 +3095,12 @@ self: super: {
|
||||
tasty-quickcheck = super.tasty-quickcheck_0_10_3;
|
||||
});
|
||||
|
||||
# Fixes build on some platforms: https://github.com/obsidiansystems/commutative-semigroups/pull/18
|
||||
commutative-semigroups = appendPatch (fetchpatch {
|
||||
url = "https://github.com/obsidiansystems/commutative-semigroups/commit/e031495dd24ae73ffb808eca34e993f5df8e8d76.patch";
|
||||
hash = "sha256-d7AwvGGUJlh/sOXaAbfQLCay6+JyNInb73TTGKkBDz8=";
|
||||
}) super.commutative-semigroups;
|
||||
|
||||
# Too strict bounds on text. Can be removed after https://github.com/alx741/currencies/pull/3 is merged
|
||||
currencies = doJailbreak super.currencies;
|
||||
|
||||
|
||||
@@ -317,11 +317,13 @@ self: super: ({
|
||||
# Tests fail on macOS https://github.com/mrkkrp/zip/issues/112
|
||||
zip = dontCheck super.zip;
|
||||
|
||||
# cabal lib set as unbuildable in linux so callCabal2nix generates a dummy derivation
|
||||
jsaddle-wkwebview = overrideCabal (drv: {
|
||||
libraryFrameworkDepends = with pkgs.buildPackages.darwin.apple_sdk.frameworks; [ Cocoa WebKit ];
|
||||
libraryHaskellDepends = with self; [ aeson data-default jsaddle ];
|
||||
libraryHaskellDepends = with self; [ aeson data-default jsaddle ]; # cabal2nix doesn't add darwin-only deps
|
||||
}) super.jsaddle-wkwebview;
|
||||
reflex-dom = overrideCabal (drv: {
|
||||
libraryHaskellDepends = with self; [ base bytestring jsaddle-wkwebview reflex reflex-dom-core text ]; # cabal2nix doesn't add darwin-only deps
|
||||
}) super.reflex-dom;
|
||||
|
||||
} // lib.optionalAttrs pkgs.stdenv.isAarch64 { # aarch64-darwin
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ self: super: {
|
||||
th-abstraction = doDistribute self.th-abstraction_0_7_0_0;
|
||||
ghc-lib-parser = doDistribute self.ghc-lib-parser_9_8_2_20240223;
|
||||
ghc-lib-parser-ex = doDistribute self.ghc-lib-parser-ex_9_8_0_2;
|
||||
ghc-lib = doDistribute self.ghc-lib_9_8_2_20240223;
|
||||
ghc-lib = doDistribute self.ghc-lib_9_10_1_20240511;
|
||||
megaparsec = doDistribute self.megaparsec_9_6_1;
|
||||
# TODO: remove when aeson updates or launches a revision
|
||||
# see https://github.com/haskell/aeson/issues/1089 and https://github.com/haskell/aeson/pulls/1088
|
||||
|
||||
@@ -384,6 +384,7 @@ broken-packages:
|
||||
- beam-newtype-field # failure in job https://hydra.nixos.org/build/233206317 at 2023-09-02
|
||||
- bech32 # failure in job https://hydra.nixos.org/build/233194823 at 2023-09-02
|
||||
- bed-and-breakfast # failure in job https://hydra.nixos.org/build/233221152 at 2023-09-02
|
||||
- beeminder-api # failure in job https://hydra.nixos.org/build/259970664 at 2024-05-19
|
||||
- Befunge93 # failure in job https://hydra.nixos.org/build/233226751 at 2023-09-02
|
||||
- benc # failure in job https://hydra.nixos.org/build/241434046 at 2023-11-19
|
||||
- bench-graph # failure in job https://hydra.nixos.org/build/233239830 at 2023-09-02
|
||||
@@ -594,6 +595,7 @@ broken-packages:
|
||||
- bytestring-substring # failure in job https://hydra.nixos.org/build/233244318 at 2023-09-02
|
||||
- bytestring-time # failure in job https://hydra.nixos.org/build/233190686 at 2023-09-02
|
||||
- bytestring-typenats # failure in job https://hydra.nixos.org/build/233211815 at 2023-09-02
|
||||
- bytezap # failure in job https://hydra.nixos.org/build/259967564 at 2024-05-19
|
||||
- bzlib-conduit-jappie # failure in job https://hydra.nixos.org/build/233210179 at 2023-09-02
|
||||
- c10k # failure in job https://hydra.nixos.org/build/233213264 at 2023-09-02
|
||||
- c2ats # failure in job https://hydra.nixos.org/build/233220801 at 2023-09-02
|
||||
@@ -693,6 +695,7 @@ broken-packages:
|
||||
- cassava-records # failure in job https://hydra.nixos.org/build/233259049 at 2023-09-02
|
||||
- cassava-streams # failure in job https://hydra.nixos.org/build/233222669 at 2023-09-02
|
||||
- cassette # failure in job https://hydra.nixos.org/build/233201251 at 2023-09-02
|
||||
- caster # failure in job https://hydra.nixos.org/build/259966347 at 2024-05-19
|
||||
- castle # failure in job https://hydra.nixos.org/build/233204027 at 2023-09-02
|
||||
- catamorphism # failure in job https://hydra.nixos.org/build/233208488 at 2023-09-02
|
||||
- Catana # failure in job https://hydra.nixos.org/build/233196550 at 2023-09-02
|
||||
@@ -738,6 +741,7 @@ broken-packages:
|
||||
- changelog-d # failure in job https://hydra.nixos.org/build/255671571 at 2024-04-16
|
||||
- changelog-d # failure in job https://hydra.nixos.org/build/257082502 at 2024-04-27
|
||||
- changelog-d # failure in job https://hydra.nixos.org/build/259607598 at 2024-05-15
|
||||
- changelog-d # failure in job https://hydra.nixos.org/build/259957724 at 2024-05-19
|
||||
- changelogged # failure in job https://hydra.nixos.org/build/233211675 at 2023-09-02
|
||||
- character-cases # failure in job https://hydra.nixos.org/build/233197636 at 2023-09-02
|
||||
- charter # failure in job https://hydra.nixos.org/build/233237264 at 2023-09-02
|
||||
@@ -760,6 +764,7 @@ broken-packages:
|
||||
- ChristmasTree # failure in job https://hydra.nixos.org/build/233259648 at 2023-09-02
|
||||
- chronograph # failure in job https://hydra.nixos.org/build/233232822 at 2023-09-02
|
||||
- chr-parse # failure in job https://hydra.nixos.org/build/233243933 at 2023-09-02
|
||||
- chs-cabal # failure in job https://hydra.nixos.org/build/259964491 at 2024-05-19
|
||||
- chunky # failure in job https://hydra.nixos.org/build/233216440 at 2023-09-02
|
||||
- church # failure in job https://hydra.nixos.org/build/233223920 at 2023-09-02
|
||||
- church-maybe # failure in job https://hydra.nixos.org/build/233258572 at 2023-09-02
|
||||
@@ -1023,6 +1028,7 @@ broken-packages:
|
||||
- cql-io # failure in job https://hydra.nixos.org/build/233245286 at 2023-09-02
|
||||
- cqrs-core # failure in job https://hydra.nixos.org/build/233192102 at 2023-09-02
|
||||
- crack # failure in job https://hydra.nixos.org/build/233229111 at 2023-09-02
|
||||
- cradle # failure in job https://hydra.nixos.org/build/259974954 at 2024-05-19
|
||||
- Craft3e # failure in job https://hydra.nixos.org/build/233255152 at 2023-09-02
|
||||
- craftwerk # failure in job https://hydra.nixos.org/build/233221392 at 2023-09-02
|
||||
- crawlchain # failure in job https://hydra.nixos.org/build/233192450 at 2023-09-02
|
||||
@@ -1241,6 +1247,7 @@ broken-packages:
|
||||
- deriveJsonNoPrefix # failure in job https://hydra.nixos.org/build/233242453 at 2023-09-02
|
||||
- derive-lifted-instances # failure in job https://hydra.nixos.org/build/233194868 at 2023-09-02
|
||||
- derive-monoid # failure in job https://hydra.nixos.org/build/233205670 at 2023-09-02
|
||||
- derive-prim # failure in job https://hydra.nixos.org/build/259957765 at 2024-05-19
|
||||
- derive-trie # failure in job https://hydra.nixos.org/build/233207961 at 2023-09-02
|
||||
- deriving-openapi3 # failure in job https://hydra.nixos.org/build/252718489 at 2024-03-16
|
||||
- derp-lib # failure in job https://hydra.nixos.org/build/233199053 at 2023-09-02
|
||||
@@ -1568,7 +1575,6 @@ broken-packages:
|
||||
- ethereum-analyzer-deps # failure in job https://hydra.nixos.org/build/252732846 at 2024-03-16
|
||||
- ethereum-rlp # failure in job https://hydra.nixos.org/build/233236392 at 2023-09-02
|
||||
- eurofxref # failure in job https://hydra.nixos.org/build/233230942 at 2023-09-02
|
||||
- evdev # failure in job https://hydra.nixos.org/build/236692293 at 2023-10-04
|
||||
- eve-cli # failure in job https://hydra.nixos.org/build/233254555 at 2023-09-02
|
||||
- eved # failure in job https://hydra.nixos.org/build/233194319 at 2023-09-02
|
||||
- eve # failure in job https://hydra.nixos.org/build/252715362 at 2024-03-16
|
||||
@@ -1877,6 +1883,7 @@ broken-packages:
|
||||
- fused-effects-exceptions # failure in job https://hydra.nixos.org/build/233203744 at 2023-09-02
|
||||
- fused-effects-mwc-random # failure in job https://hydra.nixos.org/build/233253228 at 2023-09-02
|
||||
- fused-effects-resumable # failure in job https://hydra.nixos.org/build/233242479 at 2023-09-02
|
||||
- fused-effects-squeal # failure in job https://hydra.nixos.org/build/259962088 at 2024-05-19
|
||||
- fused-effects-th # failure in job https://hydra.nixos.org/build/233192186 at 2023-09-02
|
||||
- fusion # failure in job https://hydra.nixos.org/build/233204359 at 2023-09-02
|
||||
- futhask # failure in job https://hydra.nixos.org/build/233229281 at 2023-09-02
|
||||
@@ -2311,6 +2318,7 @@ broken-packages:
|
||||
- haskell2020 # failure in job https://hydra.nixos.org/build/233251111 at 2023-09-02
|
||||
- haskell98 # failure in job https://hydra.nixos.org/build/233231799 at 2023-09-02
|
||||
- haskell98libraries # failure in job https://hydra.nixos.org/build/233255099 at 2023-09-02
|
||||
- haskell-abci # failure in job https://hydra.nixos.org/build/259980321 at 2024-05-19
|
||||
- haskell-admin-core # failure in job https://hydra.nixos.org/build/233242655 at 2023-09-02
|
||||
- HaskellAnalysisProgram # failure in job https://hydra.nixos.org/build/233235074 at 2023-09-02
|
||||
- haskell-awk # failure in job https://hydra.nixos.org/build/233235921 at 2023-09-02
|
||||
@@ -2897,7 +2905,7 @@ broken-packages:
|
||||
- hts # failure in job https://hydra.nixos.org/build/233256407 at 2023-09-02
|
||||
- htsn # failure in job https://hydra.nixos.org/build/233197004 at 2023-09-02
|
||||
- htssets # failure in job https://hydra.nixos.org/build/233195420 at 2023-09-02
|
||||
- http2-client # failure in job https://hydra.nixos.org/build/233214193 at 2023-09-02
|
||||
- http2-client-exe # failure in job https://hydra.nixos.org/build/260189666 at 2024-05-19
|
||||
- http2-grpc-types # failure in job https://hydra.nixos.org/build/233197769 at 2023-09-02
|
||||
- http2-tls # failure in job https://hydra.nixos.org/build/233227095 at 2023-09-02
|
||||
- http-attoparsec # failure in job https://hydra.nixos.org/build/233233534 at 2023-09-02
|
||||
@@ -3031,7 +3039,6 @@ broken-packages:
|
||||
- ihaskell-hvega # failure in job https://hydra.nixos.org/build/241514418 at 2023-11-20
|
||||
- ihaskell-parsec # failure in job https://hydra.nixos.org/build/233244271 at 2023-09-02
|
||||
- ihaskell-plot # failure in job https://hydra.nixos.org/build/233255936 at 2023-09-02
|
||||
- ihp-hsx # failure in job https://hydra.nixos.org/build/233211401 at 2023-09-02
|
||||
- illuminate # failure in job https://hydra.nixos.org/build/233219478 at 2023-09-02
|
||||
- imagemagick # failure in job https://hydra.nixos.org/build/233598237 at 2023-09-02
|
||||
- imagepaste # failure in job https://hydra.nixos.org/build/233211716 at 2023-09-02
|
||||
@@ -3381,7 +3388,6 @@ broken-packages:
|
||||
- language-sh # failure in job https://hydra.nixos.org/build/233249709 at 2023-09-02
|
||||
- language-sqlite # failure in job https://hydra.nixos.org/build/233248845 at 2023-09-02
|
||||
- language-sygus # failure in job https://hydra.nixos.org/build/233192608 at 2023-09-02
|
||||
- language-thrift # failure in job https://hydra.nixos.org/build/252721081 at 2024-03-16
|
||||
- language-typescript # failure in job https://hydra.nixos.org/build/233247703 at 2023-09-02
|
||||
- language-webidl # failure in job https://hydra.nixos.org/build/233194656 at 2023-09-02
|
||||
- laop # failure in job https://hydra.nixos.org/build/233204106 at 2023-09-02
|
||||
@@ -3418,6 +3424,7 @@ broken-packages:
|
||||
- learn # failure in job https://hydra.nixos.org/build/233247385 at 2023-09-02
|
||||
- Learning # failure in job https://hydra.nixos.org/build/233237137 at 2023-09-02
|
||||
- learn-physics-examples # failure in job https://hydra.nixos.org/build/234444204 at 2023-09-13
|
||||
- learn-physics # failure in job https://hydra.nixos.org/build/260189711 at 2024-05-19
|
||||
- leb128 # failure in job https://hydra.nixos.org/build/252731801 at 2024-03-16
|
||||
- leetify # failure in job https://hydra.nixos.org/build/233200752 at 2023-09-02
|
||||
- lendingclub # failure in job https://hydra.nixos.org/build/233239123 at 2023-09-02
|
||||
@@ -3429,6 +3436,7 @@ broken-packages:
|
||||
- lens-process # failure in job https://hydra.nixos.org/build/233242948 at 2023-09-02
|
||||
- lensref # failure in job https://hydra.nixos.org/build/233205479 at 2023-09-02
|
||||
- lens-simple # failure in job https://hydra.nixos.org/build/233245452 at 2023-09-02
|
||||
- lens-sop # failure in job https://hydra.nixos.org/build/259961739 at 2024-05-19
|
||||
- lens-tell # failure in job https://hydra.nixos.org/build/233234619 at 2023-09-02
|
||||
- lens-text-encoding # failure in job https://hydra.nixos.org/build/233222713 at 2023-09-02
|
||||
- lens-th-rewrite # failure in job https://hydra.nixos.org/build/233201025 at 2023-09-02
|
||||
@@ -3590,6 +3598,7 @@ broken-packages:
|
||||
- louis # failure in job https://hydra.nixos.org/build/233227705 at 2023-09-02
|
||||
- lowgl # failure in job https://hydra.nixos.org/build/233216216 at 2023-09-02
|
||||
- lp-diagrams-svg # failure in job https://hydra.nixos.org/build/233220097 at 2023-09-02
|
||||
- LPFP # failure in job https://hydra.nixos.org/build/260189697 at 2024-05-19
|
||||
- lrucaching # failure in job https://hydra.nixos.org/build/233252034 at 2023-09-02
|
||||
- LRU # failure in job https://hydra.nixos.org/build/233206273 at 2023-09-02
|
||||
- lscabal # failure in job https://hydra.nixos.org/build/233253536 at 2023-09-02
|
||||
@@ -4803,6 +4812,7 @@ broken-packages:
|
||||
- pusher-ws # failure in job https://hydra.nixos.org/build/233204133 at 2023-09-02
|
||||
- pushme # failure in job https://hydra.nixos.org/build/233212481 at 2023-09-02
|
||||
- push-notifications # failure in job https://hydra.nixos.org/build/233199364 at 2023-09-02
|
||||
- push-notify-apn # failure in job https://hydra.nixos.org/build/260189652 at 2024-05-19
|
||||
- pushover # failure in job https://hydra.nixos.org/build/252739908 at 2024-03-16
|
||||
- putlenses # failure in job https://hydra.nixos.org/build/233197372 at 2023-09-02
|
||||
- puzzle-draw # failure in job https://hydra.nixos.org/build/233204953 at 2023-09-02
|
||||
@@ -4960,6 +4970,7 @@ broken-packages:
|
||||
- reflex-dom-retractable # failure in job https://hydra.nixos.org/build/233198362 at 2023-09-02
|
||||
- reflex-dom-svg # failure in job https://hydra.nixos.org/build/233193544 at 2023-09-02
|
||||
- reflex-external-ref # failure in job https://hydra.nixos.org/build/233215834 at 2023-09-02
|
||||
- reflex-gadt-api # failure in job https://hydra.nixos.org/build/260124380 at 2024-05-19
|
||||
- reflex-gi-gtk # failure in job https://hydra.nixos.org/build/253683412 at 2024-03-31
|
||||
- reflex-gloss # failure in job https://hydra.nixos.org/build/234457448 at 2023-09-13
|
||||
- reflex-jsx # failure in job https://hydra.nixos.org/build/233207137 at 2023-09-02
|
||||
@@ -5284,6 +5295,7 @@ broken-packages:
|
||||
- servant-github # failure in job https://hydra.nixos.org/build/233231566 at 2023-09-02
|
||||
- servant-github-webhook # failure in job https://hydra.nixos.org/build/233234237 at 2023-09-02
|
||||
- servant-htmx # failure in job https://hydra.nixos.org/build/233214786 at 2023-09-02
|
||||
- servant-http2-client # failure in job https://hydra.nixos.org/build/260189694 at 2024-05-19
|
||||
- servant-http-streams # failure in job https://hydra.nixos.org/build/233242852 at 2023-09-02
|
||||
- servant-iCalendar # failure in job https://hydra.nixos.org/build/233200493 at 2023-09-02
|
||||
- servant-jquery # failure in job https://hydra.nixos.org/build/233238796 at 2023-09-02
|
||||
@@ -5389,6 +5401,7 @@ broken-packages:
|
||||
- sifflet # failure in job https://hydra.nixos.org/build/233210515 at 2023-09-02
|
||||
- sifflet-lib # failure in job https://hydra.nixos.org/build/233222675 at 2023-09-02
|
||||
- sigmacord # failure in job https://hydra.nixos.org/build/233194491 at 2023-09-02
|
||||
- signable # failure in job https://hydra.nixos.org/build/259979871 at 2024-05-19
|
||||
- signable-haskell-protoc # failure in job https://hydra.nixos.org/build/252734188 at 2024-03-16
|
||||
- signal-messaging-dbus # failure in job https://hydra.nixos.org/build/252723131 at 2024-03-16
|
||||
- simd # failure in job https://hydra.nixos.org/build/233206642 at 2023-09-02
|
||||
@@ -6401,6 +6414,7 @@ broken-packages:
|
||||
- verify # failure in job https://hydra.nixos.org/build/233239874 at 2023-09-02
|
||||
- verilog # failure in job https://hydra.nixos.org/build/233211999 at 2023-09-02
|
||||
- versioning # failure in job https://hydra.nixos.org/build/233205892 at 2023-09-02
|
||||
- vessel # failure in job https://hydra.nixos.org/build/260124469 at 2024-05-19
|
||||
- vformat # failure in job https://hydra.nixos.org/build/233222840 at 2023-09-02
|
||||
- vgrep # failure in job https://hydra.nixos.org/build/233210982 at 2023-09-02
|
||||
- vhd # failure in job https://hydra.nixos.org/build/233230229 at 2023-09-02
|
||||
@@ -6411,6 +6425,7 @@ broken-packages:
|
||||
- Villefort # failure in job https://hydra.nixos.org/build/233224994 at 2023-09-02
|
||||
- vimus # failure in job https://hydra.nixos.org/build/233227980 at 2023-09-02
|
||||
- vintage-basic # failure in job https://hydra.nixos.org/build/233241073 at 2023-09-02
|
||||
- vinyl-generics # failure in job https://hydra.nixos.org/build/259973897 at 2024-05-19
|
||||
- vinyl-json # failure in job https://hydra.nixos.org/build/233207036 at 2023-09-02
|
||||
- vinyl-named-sugar # failure in job https://hydra.nixos.org/build/233205326 at 2023-09-02
|
||||
- vinyl-plus # failure in job https://hydra.nixos.org/build/233237873 at 2023-09-02
|
||||
|
||||
@@ -28,10 +28,15 @@ default-package-overrides:
|
||||
- gi-gdkx11 < 4
|
||||
# 2021-11-09: ghc-bignum is bundled starting with 9.0.1; only 1.0 builds with GHCs prior to 9.2.1
|
||||
- ghc-bignum == 1.0
|
||||
- hie-bios == 0.13.1
|
||||
# 2024-05-18: Various overrides for hls compatibility
|
||||
- lsp < 2.5
|
||||
- lsp-types < 2.2
|
||||
- lsp-test < 0.17.0.1
|
||||
- extensions < 0.1.0.2 # Incompatible with Cabal < 3.12, the newest extensions version is only needed on ghc 9.10
|
||||
# 2024-05-10: need to match hlegder from stackage
|
||||
- hledger-ui < 1.33
|
||||
|
||||
|
||||
extra-packages:
|
||||
- Cabal-syntax == 3.6.* # Dummy package that ensures packages depending on Cabal-syntax can work for Cabal < 3.8
|
||||
- Cabal == 3.2.* # Used for packages needing newer Cabal on ghc 8.6 and 8.8
|
||||
@@ -61,7 +66,9 @@ extra-packages:
|
||||
- ghc-exactprint == 1.6.* # 2023-03-30: needed for GHC == 9.4
|
||||
- ghc-lib == 9.2.* # 2022-02-17: preserve for GHC 9.2
|
||||
- ghc-lib-parser == 9.2.* # 2022-02-17: preserve for GHC 9.2
|
||||
- ghc-lib-parser == 9.8.* # 2024-05-19: preserve for GHC 9.8
|
||||
- ghc-lib-parser-ex == 9.2.* # 2022-07-13: preserve for GHC 9.2
|
||||
- ghc-lib-parser-ex == 9.8.* # 2024-05-19: preserve for GHC 9.8
|
||||
- ghc-syntax-highlighter == 0.0.10.* # 2023-11-20:
|
||||
- gi-soup == 2.4.28 # 2023-04-05: the last version to support libsoup-2.4 (and thus be compatible with our other gi- packages)
|
||||
- haddock == 2.23.* # required on GHC < 8.10.x
|
||||
@@ -673,7 +680,6 @@ unsupported-platforms:
|
||||
Raincat: [ platforms.darwin ]
|
||||
reactive-balsa: [ platforms.darwin ] # depends on alsa-core
|
||||
reflex-dom-fragment-shader-canvas: [ platforms.darwin, aarch64-linux ]
|
||||
reflex-dom: [ platforms.darwin ]
|
||||
reflex-localize-dom: [ platforms.darwin, aarch64-linux ]
|
||||
rsi-break: [ platforms.darwin ] # depends on monomer
|
||||
rtlsdr: [ platforms.darwin ]
|
||||
@@ -723,6 +729,7 @@ supported-platforms:
|
||||
dx9base: [ platforms.windows ]
|
||||
dx9d3d: [ platforms.windows ]
|
||||
dx9d3dx: [ platforms.windows ]
|
||||
erebos-tester: [ platforms.linux ] # depends on linux-namespaces
|
||||
evdev: [ platforms.linux ]
|
||||
evdev-streamly: [ platforms.linux ]
|
||||
geomancy: [ platforms.x86 ] # x86 intrinsics
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Stackage LTS 22.18
|
||||
# Stackage LTS 22.22
|
||||
# This file is auto-generated by
|
||||
# maintainers/scripts/haskell/update-stackage.sh
|
||||
default-package-overrides:
|
||||
@@ -11,7 +11,7 @@ default-package-overrides:
|
||||
- acid-state ==0.16.1.3
|
||||
- action-permutations ==0.0.0.1
|
||||
- active ==0.2.1
|
||||
- ad ==4.5.5
|
||||
- ad ==4.5.6
|
||||
- ad-delcont ==0.5.0.0
|
||||
- adjunctions ==4.4.2
|
||||
- adler32 ==0.1.2.0
|
||||
@@ -384,7 +384,7 @@ default-package-overrides:
|
||||
- asn1-parse ==0.9.5
|
||||
- asn1-types ==0.3.4
|
||||
- assert-failure ==0.1.3.0
|
||||
- assoc ==1.1
|
||||
- assoc ==1.1.1
|
||||
- astro ==0.4.3.0
|
||||
- async ==2.2.5
|
||||
- async-extra ==0.2.0.0
|
||||
@@ -442,7 +442,7 @@ default-package-overrides:
|
||||
- base-compat ==0.13.1
|
||||
- base-compat-batteries ==0.13.1
|
||||
- basement ==0.0.16
|
||||
- base-orphans ==0.9.1
|
||||
- base-orphans ==0.9.2
|
||||
- base-prelude ==1.6.1.1
|
||||
- base-unicode-symbols ==0.2.4.2
|
||||
- basic-prelude ==0.7.0
|
||||
@@ -453,8 +453,8 @@ default-package-overrides:
|
||||
- bcp47-orphans ==0.1.0.6
|
||||
- bcrypt ==0.0.11
|
||||
- beam-core ==0.10.1.0
|
||||
- bech32 ==1.1.5
|
||||
- bech32-th ==1.1.5
|
||||
- bech32 ==1.1.6
|
||||
- bech32-th ==1.1.6
|
||||
- benchpress ==0.2.2.23
|
||||
- bencode ==0.6.1.1
|
||||
- benri-hspec ==0.1.0.2
|
||||
@@ -487,9 +487,10 @@ default-package-overrides:
|
||||
- bits ==0.6
|
||||
- bitset-word8 ==0.1.1.2
|
||||
- bitvec ==1.1.5.0
|
||||
- bitwise ==1.0.0.1
|
||||
- bitwise-enum ==1.0.1.2
|
||||
- blake2 ==0.3.0.1
|
||||
- Blammo ==1.1.2.2
|
||||
- Blammo ==1.1.2.3
|
||||
- blank-canvas ==0.7.4
|
||||
- blanks ==0.5.0
|
||||
- blas-carray ==0.1.0.2
|
||||
@@ -515,7 +516,7 @@ default-package-overrides:
|
||||
- boltzmann-samplers ==0.1.1.0
|
||||
- Boolean ==0.2.4
|
||||
- boolsimplifier ==0.1.8
|
||||
- boomerang ==1.4.9.1
|
||||
- boomerang ==1.4.9.2
|
||||
- boomwhacker ==0.0.1
|
||||
- bordacount ==0.1.0.0
|
||||
- boring ==0.2.1
|
||||
@@ -543,9 +544,10 @@ default-package-overrides:
|
||||
- bugsnag-wai ==1.0.0.1
|
||||
- bugsnag-yesod ==1.0.1.0
|
||||
- bugzilla-redhat ==1.0.1.1
|
||||
- burrito ==2.0.1.8
|
||||
- burrito ==2.0.1.9
|
||||
- bv ==0.5
|
||||
- bv-little ==1.3.2
|
||||
- bv-sized ==1.0.5
|
||||
- byteable ==0.1.1
|
||||
- bytebuild ==0.3.16.2
|
||||
- byte-count-reader ==0.10.1.11
|
||||
@@ -559,11 +561,11 @@ default-package-overrides:
|
||||
- bytesmith ==0.3.11.1
|
||||
- bytestring-builder ==0.10.8.2.0
|
||||
- bytestring-conversion ==0.3.2
|
||||
- bytestring-lexing ==0.5.0.11
|
||||
- bytestring-lexing ==0.5.0.12
|
||||
- bytestring-strict-builder ==0.4.5.7
|
||||
- bytestring-to-vector ==0.3.0.1
|
||||
- bytestring-tree-builder ==0.2.7.12
|
||||
- bytestring-trie ==0.2.7.2
|
||||
- bytestring-trie ==0.2.7.3
|
||||
- bz2 ==1.0.1.2
|
||||
- bzip2-clib ==1.0.8
|
||||
- bzlib ==0.5.2.0
|
||||
@@ -571,7 +573,7 @@ default-package-overrides:
|
||||
- c14n ==0.1.0.3
|
||||
- c2hs ==0.28.8
|
||||
- cabal2spec ==2.7.1
|
||||
- cabal-appimage ==0.4.0.2
|
||||
- cabal-appimage ==0.4.0.4
|
||||
- cabal-clean ==0.2.20230609
|
||||
- cabal-debian ==5.2.3
|
||||
- cabal-doctest ==1.0.9
|
||||
@@ -600,7 +602,7 @@ default-package-overrides:
|
||||
- case-insensitive ==1.2.1.0
|
||||
- cases ==0.1.4.3
|
||||
- casing ==0.1.4.1
|
||||
- cassava ==0.5.3.0
|
||||
- cassava ==0.5.3.1
|
||||
- cassava-conduit ==0.6.6
|
||||
- cassava-megaparsec ==2.0.4
|
||||
- cast ==0.1.0.2
|
||||
@@ -624,7 +626,7 @@ default-package-overrides:
|
||||
- Chart-cairo ==1.9.4.1
|
||||
- Chart-diagrams ==1.9.5.1
|
||||
- chart-svg ==0.5.2.0
|
||||
- ChasingBottoms ==1.3.1.13
|
||||
- ChasingBottoms ==1.3.1.14
|
||||
- check-email ==1.0.2
|
||||
- checkers ==0.6.0
|
||||
- checksum ==0.0.0.1
|
||||
@@ -687,7 +689,7 @@ default-package-overrides:
|
||||
- commutative-semigroups ==0.1.1.0
|
||||
- comonad ==5.0.8
|
||||
- compact ==0.2.0.0
|
||||
- compactmap ==0.1.4.3
|
||||
- compactmap ==0.1.4.4
|
||||
- companion ==0.1.0
|
||||
- compdata ==0.13.1
|
||||
- compensated ==0.8.3
|
||||
@@ -706,7 +708,7 @@ default-package-overrides:
|
||||
- concise ==0.1.0.1
|
||||
- concurrency ==1.11.0.3
|
||||
- concurrent-extra ==0.7.0.12
|
||||
- concurrent-output ==1.10.20
|
||||
- concurrent-output ==1.10.21
|
||||
- concurrent-split ==0.0.1.1
|
||||
- concurrent-supply ==0.1.8
|
||||
- cond ==0.5.1
|
||||
@@ -725,7 +727,8 @@ default-package-overrides:
|
||||
- configurator ==0.3.0.0
|
||||
- configurator-export ==0.1.0.1
|
||||
- configurator-pg ==0.2.10
|
||||
- constraints ==0.14
|
||||
- config-value ==0.8.3
|
||||
- constraints ==0.14.2
|
||||
- constraints-extras ==0.4.0.0
|
||||
- constraint-tuples ==0.1.2
|
||||
- construct ==0.3.1.2
|
||||
@@ -742,6 +745,14 @@ default-package-overrides:
|
||||
- control-monad-omega ==0.3.2
|
||||
- convertible ==1.1.1.1
|
||||
- cookie ==0.4.6
|
||||
- copilot ==3.19.1
|
||||
- copilot-c99 ==3.19.1
|
||||
- copilot-core ==3.19.1
|
||||
- copilot-interpreter ==3.19.1
|
||||
- copilot-language ==3.19.1
|
||||
- copilot-libraries ==3.19.1
|
||||
- copilot-prettyprinter ==3.19.1
|
||||
- copilot-theorem ==3.19.1
|
||||
- copr-api ==0.2.0
|
||||
- core-data ==0.3.9.1
|
||||
- core-program ==0.7.0.0
|
||||
@@ -759,7 +770,7 @@ default-package-overrides:
|
||||
- crc32c ==0.1.0
|
||||
- credential-store ==0.1.2
|
||||
- criterion ==1.6.3.0
|
||||
- criterion-measurement ==0.2.1.0
|
||||
- criterion-measurement ==0.2.2.0
|
||||
- crypto-api ==0.13.3
|
||||
- crypto-api-tests ==0.3
|
||||
- crypto-cipher-tests ==0.0.11
|
||||
@@ -783,7 +794,7 @@ default-package-overrides:
|
||||
- crypton-x509-validation ==1.6.12
|
||||
- crypto-pubkey-types ==0.4.3
|
||||
- crypto-random-api ==0.2.0
|
||||
- cryptostore ==0.3.0.1
|
||||
- cryptostore ==0.3.1.0
|
||||
- crypt-sha512 ==0
|
||||
- csp ==1.4.0
|
||||
- css-syntax ==0.1.0.1
|
||||
@@ -826,7 +837,7 @@ default-package-overrides:
|
||||
- datadog ==0.3.0.0
|
||||
- data-dword ==0.3.2.1
|
||||
- data-endian ==0.1.1
|
||||
- data-fix ==0.3.2
|
||||
- data-fix ==0.3.3
|
||||
- data-forest ==0.1.0.12
|
||||
- data-functor-logistic ==0.0
|
||||
- data-has ==0.4.0.0
|
||||
@@ -849,7 +860,7 @@ default-package-overrides:
|
||||
- DAV ==1.3.4
|
||||
- dbcleaner ==0.1.3
|
||||
- DBFunctor ==0.1.2.1
|
||||
- dbus ==1.3.2
|
||||
- dbus ==1.3.3
|
||||
- dbus-hslogger ==0.1.0.1
|
||||
- debian ==4.0.5
|
||||
- debian-build ==0.10.2.1
|
||||
@@ -873,7 +884,7 @@ default-package-overrides:
|
||||
- deriving-compat ==0.6.6
|
||||
- deriving-trans ==0.9.1.0
|
||||
- detour-via-sci ==1.0.0
|
||||
- df1 ==0.4.2
|
||||
- df1 ==0.4.3
|
||||
- dhall ==1.42.1
|
||||
- dhall-bash ==1.0.41
|
||||
- di ==1.3
|
||||
@@ -885,7 +896,7 @@ default-package-overrides:
|
||||
- diagrams-core ==1.5.1.1
|
||||
- diagrams-gtk ==1.4
|
||||
- diagrams-html5 ==1.4.2
|
||||
- diagrams-lib ==1.4.6.1
|
||||
- diagrams-lib ==1.4.6.2
|
||||
- diagrams-postscript ==1.5.1.1
|
||||
- diagrams-rasterific ==1.4.2.3
|
||||
- diagrams-solve ==0.1.3
|
||||
@@ -928,7 +939,7 @@ default-package-overrides:
|
||||
- doctest-driver-gen ==0.3.0.8
|
||||
- doctest-exitcode-stdio ==0.0
|
||||
- doctest-extract ==0.1.2
|
||||
- doctest-lib ==0.1.1
|
||||
- doctest-lib ==0.1.1.1
|
||||
- doctest-parallel ==0.3.1.1
|
||||
- doldol ==0.4.1.2
|
||||
- do-list ==1.0.1
|
||||
@@ -1039,7 +1050,7 @@ default-package-overrides:
|
||||
- extensible ==0.9
|
||||
- extensible-effects ==5.0.0.1
|
||||
- extensible-exceptions ==0.1.1.4
|
||||
- extra ==1.7.14
|
||||
- extra ==1.7.16
|
||||
- extractable-singleton ==0.0.1
|
||||
- extra-data-yj ==0.1.0.0
|
||||
- extrapolate ==0.4.6
|
||||
@@ -1212,13 +1223,13 @@ default-package-overrides:
|
||||
- ghc-core ==0.5.6
|
||||
- ghc-events ==0.19.0.1
|
||||
- ghc-exactprint ==1.7.1.0
|
||||
- ghc-hs-meta ==0.1.3.0
|
||||
- ghc-hs-meta ==0.1.4.0
|
||||
- ghcid ==0.8.9
|
||||
- ghci-hexcalc ==0.1.1.0
|
||||
- ghcjs-codemirror ==0.0.0.2
|
||||
- ghcjs-perch ==0.3.3.3
|
||||
- ghc-lib ==9.6.4.20240109
|
||||
- ghc-lib-parser ==9.6.4.20240109
|
||||
- ghc-lib ==9.6.5.20240423
|
||||
- ghc-lib-parser ==9.6.5.20240423
|
||||
- ghc-lib-parser-ex ==9.6.0.2
|
||||
- ghc-parser ==0.2.6.0
|
||||
- ghc-paths ==0.1.0.12
|
||||
@@ -1347,14 +1358,14 @@ default-package-overrides:
|
||||
- hasktags ==0.73.0
|
||||
- hasql ==1.6.4.4
|
||||
- hasql-dynamic-statements ==0.3.1.5
|
||||
- hasql-implicits ==0.1.1.2
|
||||
- hasql-interpolate ==0.2.1.0
|
||||
- hasql-implicits ==0.1.1.3
|
||||
- hasql-interpolate ==0.2.2.0
|
||||
- hasql-listen-notify ==0.1.0.1
|
||||
- hasql-migration ==0.3.0
|
||||
- hasql-notifications ==0.2.1.1
|
||||
- hasql-notifications ==0.2.2.0
|
||||
- hasql-optparse-applicative ==0.7.1.3
|
||||
- hasql-pool ==0.10.1
|
||||
- hasql-th ==0.4.0.19
|
||||
- hasql-th ==0.4.0.21
|
||||
- hasql-transaction ==1.0.1.4
|
||||
- has-transformers ==0.1.0.4
|
||||
- hasty-hamiltonian ==1.3.4
|
||||
@@ -1400,7 +1411,7 @@ default-package-overrides:
|
||||
- histogram-fill ==0.9.1.0
|
||||
- hjsmin ==0.2.1
|
||||
- hkd-default ==1.1.0.0
|
||||
- hkgr ==0.4.3.2
|
||||
- hkgr ==0.4.4
|
||||
- hledger ==1.32.3
|
||||
- hledger-iadd ==1.3.20
|
||||
- hledger-interest ==1.6.6
|
||||
@@ -1470,7 +1481,7 @@ default-package-overrides:
|
||||
- hslua-module-system ==1.1.1
|
||||
- hslua-module-text ==1.1.1
|
||||
- hslua-module-version ==1.1.1
|
||||
- hslua-module-zip ==1.1.1
|
||||
- hslua-module-zip ==1.1.3
|
||||
- hslua-objectorientation ==2.3.1
|
||||
- hslua-packaging ==2.3.1
|
||||
- hslua-repl ==0.1.2
|
||||
@@ -1479,13 +1490,13 @@ default-package-overrides:
|
||||
- hsndfile-vector ==0.5.2
|
||||
- HsOpenSSL ==0.11.7.6
|
||||
- HsOpenSSL-x509-system ==0.1.0.4
|
||||
- hspec ==2.11.7
|
||||
- hspec-api ==2.11.7
|
||||
- hspec ==2.11.8
|
||||
- hspec-api ==2.11.8
|
||||
- hspec-attoparsec ==0.1.0.2
|
||||
- hspec-checkers ==0.1.0.2
|
||||
- hspec-contrib ==0.5.2
|
||||
- hspec-core ==2.11.7
|
||||
- hspec-discover ==2.11.7
|
||||
- hspec-core ==2.11.8
|
||||
- hspec-discover ==2.11.8
|
||||
- hspec-expectations ==0.8.4
|
||||
- hspec-expectations-json ==1.0.2.1
|
||||
- hspec-expectations-lifted ==0.10.0
|
||||
@@ -1496,7 +1507,7 @@ default-package-overrides:
|
||||
- hspec-junit-formatter ==1.1.0.2
|
||||
- hspec-leancheck ==0.0.6
|
||||
- hspec-megaparsec ==2.2.1
|
||||
- hspec-meta ==2.11.7
|
||||
- hspec-meta ==2.11.8
|
||||
- hspec-parsec ==0
|
||||
- hspec-smallcheck ==0.5.3
|
||||
- hspec-tmp-proc ==0.5.2.0
|
||||
@@ -1507,16 +1518,17 @@ default-package-overrides:
|
||||
- hstatistics ==0.3.1
|
||||
- HStringTemplate ==0.8.8
|
||||
- HSvm ==0.1.2.3.32
|
||||
- HsYAML ==0.2.1.3
|
||||
- HsYAML ==0.2.1.4
|
||||
- HsYAML-aeson ==0.2.0.1
|
||||
- hsyslog ==5.0.2
|
||||
- htaglib ==1.2.1
|
||||
- HTF ==0.15.0.1
|
||||
- HTF ==0.15.0.2
|
||||
- html ==1.0.1.2
|
||||
- html-conduit ==1.3.2.2
|
||||
- html-email-validate ==0.2.0.0
|
||||
- html-entities ==1.1.4.7
|
||||
- html-entity-map ==0.1.0.0
|
||||
- html-parse ==0.2.1.0
|
||||
- http2 ==5.0.1
|
||||
- HTTP ==4000.4.1
|
||||
- http-api-data ==0.5.1
|
||||
@@ -1684,7 +1696,7 @@ default-package-overrides:
|
||||
- junit-xml ==0.1.0.3
|
||||
- justified-containers ==0.3.0.0
|
||||
- jwt ==0.11.0
|
||||
- kan-extensions ==5.2.5
|
||||
- kan-extensions ==5.2.6
|
||||
- kansas-comet ==0.4.2
|
||||
- katip ==0.8.8.0
|
||||
- katip-logstash ==0.1.0.2
|
||||
@@ -1709,6 +1721,7 @@ default-package-overrides:
|
||||
- knob ==0.2.2
|
||||
- koji ==0.0.2
|
||||
- koji-tool ==1.1.1
|
||||
- kvitable ==1.0.3.0
|
||||
- labels ==0.3.3
|
||||
- lackey ==2.0.0.7
|
||||
- lambdabot-core ==5.3.1.2
|
||||
@@ -1717,13 +1730,16 @@ default-package-overrides:
|
||||
- lame ==0.2.2
|
||||
- language-avro ==0.1.4.0
|
||||
- language-c ==0.9.3
|
||||
- language-c99 ==0.2.0
|
||||
- language-c99-simple ==0.3.0
|
||||
- language-c99-util ==0.2.0
|
||||
- language-c-quote ==0.13.0.1
|
||||
- language-docker ==12.1.0
|
||||
- language-dot ==0.1.2
|
||||
- language-glsl ==0.3.0
|
||||
- language-java ==0.2.9
|
||||
- language-javascript ==0.7.1.0
|
||||
- language-lua ==0.11.0.1
|
||||
- language-lua ==0.11.0.2
|
||||
- language-protobuf ==1.0.1
|
||||
- language-python ==0.5.8
|
||||
- lapack ==0.5.1.1
|
||||
@@ -1743,7 +1759,6 @@ default-package-overrides:
|
||||
- leancheck ==1.0.2
|
||||
- leancheck-instances ==0.0.5
|
||||
- leapseconds-announced ==2017.1.0.1
|
||||
- learn-physics ==0.6.6
|
||||
- leb128-cereal ==1.2
|
||||
- lens ==5.2.3
|
||||
- lens-action ==0.2.6
|
||||
@@ -1808,16 +1823,16 @@ default-package-overrides:
|
||||
- logstash ==0.1.0.4
|
||||
- loop ==0.3.0
|
||||
- lpeg ==1.0.4
|
||||
- LPFP ==1.1.1
|
||||
- LPFP-core ==1.1.1
|
||||
- lrucache ==1.2.0.1
|
||||
- lua ==2.3.2
|
||||
- lua-arbitrary ==1.0.1.1
|
||||
- lucid2 ==0.0.20230706
|
||||
- lucid2 ==0.0.20240424
|
||||
- lucid ==2.11.20230408
|
||||
- lucid-cdn ==0.2.2.0
|
||||
- lucid-extras ==0.2.2
|
||||
- lukko ==0.1.1.3
|
||||
- lumberjack ==1.0.3.0
|
||||
- lz4 ==0.2.3.1
|
||||
- lz4-frame-conduit ==0.1.0.1
|
||||
- lzma ==0.0.1.0
|
||||
@@ -1903,7 +1918,7 @@ default-package-overrides:
|
||||
- min-max-pqueue ==0.1.0.2
|
||||
- mintty ==0.1.4
|
||||
- misfortune ==0.1.2.1
|
||||
- miso ==1.8.3.0
|
||||
- miso ==1.8.4.0
|
||||
- missing-foreign ==0.1.1
|
||||
- MissingH ==1.6.0.1
|
||||
- mixed-types-num ==0.5.12
|
||||
@@ -2085,7 +2100,7 @@ default-package-overrides:
|
||||
- once ==0.4
|
||||
- one-liner ==2.1
|
||||
- one-liner-instances ==0.1.3.0
|
||||
- OneTuple ==0.4.1.1
|
||||
- OneTuple ==0.4.2
|
||||
- Only ==0.1
|
||||
- oo-prototypes ==0.1.0.0
|
||||
- oops ==0.2.0.1
|
||||
@@ -2123,28 +2138,30 @@ default-package-overrides:
|
||||
- OrderedBits ==0.0.2.0
|
||||
- ordered-containers ==0.2.3
|
||||
- ormolu ==0.7.2.0
|
||||
- os-string ==2.0.2
|
||||
- os-string ==2.0.2.2
|
||||
- overhang ==1.0.0
|
||||
- packcheck ==0.6.0
|
||||
- pager ==0.1.1.0
|
||||
- pagination ==0.2.2
|
||||
- pagure ==0.1.1
|
||||
- pagure ==0.1.2
|
||||
- pagure-cli ==0.2.1
|
||||
- palette ==0.3.0.3
|
||||
- pandoc ==3.1.11.1
|
||||
- pandoc-cli ==3.1.11.1
|
||||
- pandoc-dhall-decoder ==0.1.0.1
|
||||
- pandoc-lua-engine ==0.2.1.2
|
||||
- pandoc-lua-marshal ==0.2.6
|
||||
- pandoc-lua-marshal ==0.2.7
|
||||
- pandoc-plot ==1.8.0
|
||||
- pandoc-server ==0.1.0.5
|
||||
- pandoc-throw ==0.1.0.0
|
||||
- pandoc-types ==1.23.1
|
||||
- pango ==0.13.10.0
|
||||
- panic ==0.4.0.1
|
||||
- pantry ==0.9.3.2
|
||||
- parallel ==3.2.2.0
|
||||
- parallel-io ==0.3.5
|
||||
- parameterized ==0.5.0.0
|
||||
- parameterized-utils ==2.1.8.0
|
||||
- park-bench ==0.1.1.0
|
||||
- parseargs ==0.2.0.9
|
||||
- parsec-class ==1.0.1.0
|
||||
@@ -2281,7 +2298,7 @@ default-package-overrides:
|
||||
- pretty-hex ==1.1
|
||||
- prettyprinter ==1.7.1
|
||||
- prettyprinter-ansi-terminal ==1.1.3
|
||||
- prettyprinter-combinators ==0.1.2
|
||||
- prettyprinter-combinators ==0.1.3
|
||||
- prettyprinter-compat-annotated-wl-pprint ==1.1
|
||||
- prettyprinter-compat-ansi-wl-pprint ==1.0.2
|
||||
- prettyprinter-compat-wl-pprint ==1.0.1
|
||||
@@ -2295,7 +2312,7 @@ default-package-overrides:
|
||||
- primes ==0.2.1.0
|
||||
- primitive ==0.8.0.0
|
||||
- primitive-addr ==0.1.0.3
|
||||
- primitive-extras ==0.10.1.10
|
||||
- primitive-extras ==0.10.2
|
||||
- primitive-offset ==0.2.0.1
|
||||
- primitive-serial ==0.1
|
||||
- primitive-unaligned ==0.1.1.2
|
||||
@@ -2350,11 +2367,11 @@ default-package-overrides:
|
||||
- quickcheck-assertions ==0.3.0
|
||||
- quickcheck-classes ==0.6.5.0
|
||||
- quickcheck-classes-base ==0.6.2.0
|
||||
- quickcheck-groups ==0.0.1.1
|
||||
- quickcheck-groups ==0.0.1.2
|
||||
- quickcheck-higherorder ==0.1.0.1
|
||||
- quickcheck-instances ==0.3.30
|
||||
- quickcheck-io ==0.2.0
|
||||
- quickcheck-monoid-subclasses ==0.3.0.2
|
||||
- quickcheck-monoid-subclasses ==0.3.0.3
|
||||
- quickcheck-simple ==0.1.1.1
|
||||
- quickcheck-special ==0.1.0.6
|
||||
- quickcheck-state-machine ==0.8.0
|
||||
@@ -2420,8 +2437,8 @@ default-package-overrides:
|
||||
- reducers ==3.12.4
|
||||
- refact ==0.3.0.2
|
||||
- ref-fd ==0.5.0.1
|
||||
- refined ==0.8.1
|
||||
- reflection ==2.1.7
|
||||
- refined ==0.8.2
|
||||
- reflection ==2.1.8
|
||||
- RefSerialize ==0.4.0
|
||||
- ref-tf ==0.5.0.1
|
||||
- regex ==1.1.0.2
|
||||
@@ -2468,7 +2485,7 @@ default-package-overrides:
|
||||
- rio-orphans ==0.1.2.0
|
||||
- rio-prettyprint ==0.1.8.0
|
||||
- rng-utils ==0.3.1
|
||||
- roc-id ==0.2.0.1
|
||||
- roc-id ==0.2.0.2
|
||||
- rocksdb-haskell ==1.0.1
|
||||
- rocksdb-haskell-jprupp ==2.1.6
|
||||
- rocksdb-query ==0.4.2
|
||||
@@ -2524,6 +2541,7 @@ default-package-overrides:
|
||||
- scalpel-core ==0.6.2.2
|
||||
- scanf ==0.1.0.0
|
||||
- scanner ==0.3.1
|
||||
- s-cargot ==0.1.6.0
|
||||
- scheduler ==2.0.0.1
|
||||
- SciBaseTypes ==0.1.1.0
|
||||
- scientific ==0.3.7.0
|
||||
@@ -2541,7 +2559,7 @@ default-package-overrides:
|
||||
- selections ==0.3.0.0
|
||||
- selective ==0.7.0.1
|
||||
- semialign ==1.3
|
||||
- semigroupoids ==6.0.0.1
|
||||
- semigroupoids ==6.0.1
|
||||
- semigroups ==0.20
|
||||
- semirings ==0.6
|
||||
- semiring-simple ==1.0.0.1
|
||||
@@ -2642,7 +2660,7 @@ default-package-overrides:
|
||||
- since ==0.0.0
|
||||
- singleton-bool ==0.1.7
|
||||
- singleton-nats ==0.4.7
|
||||
- singletons ==3.0.2
|
||||
- singletons ==3.0.3
|
||||
- singletons-base ==3.2
|
||||
- singletons-presburger ==0.7.3.0
|
||||
- singletons-th ==3.2
|
||||
@@ -2653,8 +2671,8 @@ default-package-overrides:
|
||||
- skein ==1.0.9.4
|
||||
- skews ==0.1.0.3
|
||||
- skip-var ==0.1.1.0
|
||||
- skylighting ==0.14.1.1
|
||||
- skylighting-core ==0.14.1.1
|
||||
- skylighting ==0.14.1.2
|
||||
- skylighting-core ==0.14.1.2
|
||||
- skylighting-format-ansi ==0.1
|
||||
- skylighting-format-blaze-html ==0.1.1.2
|
||||
- skylighting-format-context ==0.1.0.2
|
||||
@@ -2720,10 +2738,10 @@ default-package-overrides:
|
||||
- stitch ==0.6.0.0
|
||||
- stm-chans ==3.0.0.9
|
||||
- stm-conduit ==4.0.1
|
||||
- stm-containers ==1.2.0.3
|
||||
- stm-containers ==1.2.1
|
||||
- stm-delay ==0.1.1.1
|
||||
- stm-extras ==0.1.0.3
|
||||
- stm-hamt ==1.2.0.14
|
||||
- stm-hamt ==1.2.1
|
||||
- STMonadTrans ==0.4.8
|
||||
- stm-split ==0.0.2.1
|
||||
- stm-supply ==0.2.0.0
|
||||
@@ -2751,7 +2769,7 @@ default-package-overrides:
|
||||
- strict-lens ==0.4.0.3
|
||||
- strict-list ==0.1.7.4
|
||||
- strict-tuple ==0.1.5.3
|
||||
- strict-wrapper ==0.0.0.0
|
||||
- strict-wrapper ==0.0.1.0
|
||||
- stringable ==0.1.3
|
||||
- stringbuilder ==0.5.1
|
||||
- string-class ==0.1.7.1
|
||||
@@ -2778,7 +2796,7 @@ default-package-overrides:
|
||||
- SVGFonts ==1.8.0.1
|
||||
- svg-tree ==0.6.2.4
|
||||
- swagger2 ==2.8.8
|
||||
- swish ==0.10.7.0
|
||||
- swish ==0.10.8.0
|
||||
- syb ==0.7.2.4
|
||||
- sydtest ==0.15.1.1
|
||||
- sydtest-aeson ==0.1.0.0
|
||||
@@ -2832,6 +2850,7 @@ default-package-overrides:
|
||||
- tasty-autocollect ==0.4.2
|
||||
- tasty-bench ==0.3.5
|
||||
- tasty-bench-fit ==0.1
|
||||
- tasty-checklist ==1.0.6.0
|
||||
- tasty-dejafu ==2.1.0.1
|
||||
- tasty-discover ==5.0.0
|
||||
- tasty-expected-failure ==0.12.3
|
||||
@@ -2853,6 +2872,7 @@ default-package-overrides:
|
||||
- tasty-rerun ==1.1.19
|
||||
- tasty-silver ==3.3.1.3
|
||||
- tasty-smallcheck ==0.8.2
|
||||
- tasty-sugar ==2.2.1.0
|
||||
- tasty-tap ==0.1.0
|
||||
- tasty-th ==0.1.7
|
||||
- tasty-wai ==0.1.2.0
|
||||
@@ -2903,7 +2923,7 @@ default-package-overrides:
|
||||
- text-printer ==0.5.0.2
|
||||
- text-regex-replace ==0.1.1.5
|
||||
- text-rope ==0.2
|
||||
- text-short ==0.1.5
|
||||
- text-short ==0.1.6
|
||||
- text-show ==3.10.5
|
||||
- text-show-instances ==3.9.8
|
||||
- text-zipper ==0.13
|
||||
@@ -2919,7 +2939,7 @@ default-package-overrides:
|
||||
- these ==1.2
|
||||
- these-lens ==1.0.1.3
|
||||
- these-optics ==1.0.1.2
|
||||
- these-skinny ==0.7.5
|
||||
- these-skinny ==0.7.6
|
||||
- th-expand-syns ==0.4.11.0
|
||||
- th-extras ==0.0.0.8
|
||||
- th-lego ==0.3.0.3
|
||||
@@ -2944,7 +2964,7 @@ default-package-overrides:
|
||||
- tidal-link ==1.0.3
|
||||
- tile ==0.3.0.0
|
||||
- time-compat ==1.9.6.1
|
||||
- time-domain ==0.1.0.3
|
||||
- time-domain ==0.1.0.4
|
||||
- timeit ==2.0
|
||||
- timelens ==0.2.0.2
|
||||
- time-lens ==0.4.0.2
|
||||
@@ -3009,7 +3029,7 @@ default-package-overrides:
|
||||
- typecheck-plugin-nat-simple ==0.1.0.9
|
||||
- typed-process ==0.2.11.1
|
||||
- typed-uuid ==0.2.0.0
|
||||
- type-equality ==1
|
||||
- type-equality ==1.0.1
|
||||
- type-errors ==0.2.0.2
|
||||
- type-flip ==0.1.0.0
|
||||
- type-fun ==0.1.3
|
||||
@@ -3059,6 +3079,8 @@ default-package-overrides:
|
||||
- unique-logic ==0.4.0.1
|
||||
- unique-logic-tf ==0.5.1
|
||||
- unit-constraint ==0.0.0
|
||||
- units ==2.4.1.5
|
||||
- units-defs ==2.2.1
|
||||
- units-parser ==0.1.1.5
|
||||
- universe ==1.2.2
|
||||
- universe-base ==1.1.3.1
|
||||
@@ -3122,7 +3144,7 @@ default-package-overrides:
|
||||
- vector-builder ==0.3.8.5
|
||||
- vector-bytes-instances ==0.1.1
|
||||
- vector-extras ==0.2.8.1
|
||||
- vector-hashtables ==0.1.1.4
|
||||
- vector-hashtables ==0.1.2.0
|
||||
- vector-instances ==3.4.2
|
||||
- vector-mmap ==0.0.3
|
||||
- vector-rotcev ==0.1.0.2
|
||||
@@ -3139,7 +3161,7 @@ default-package-overrides:
|
||||
- ViennaRNAParser ==1.3.3
|
||||
- vinyl ==0.14.3
|
||||
- vinyl-loeb ==0.0.1.0
|
||||
- Vis ==0.7.7.0
|
||||
- Vis ==0.7.7.1
|
||||
- vivid-osc ==0.5.0.0
|
||||
- vivid-supercollider ==0.4.1.2
|
||||
- void ==0.7.3
|
||||
@@ -3192,6 +3214,7 @@ default-package-overrides:
|
||||
- websockets-snap ==0.10.3.1
|
||||
- weigh ==0.0.17
|
||||
- welford-online-mean-variance ==0.2.0.0
|
||||
- what4 ==1.5.1
|
||||
- wide-word ==0.1.6.0
|
||||
- Win32-notify ==0.3.0.3
|
||||
- windns ==0.1.0.1
|
||||
@@ -3230,7 +3253,7 @@ default-package-overrides:
|
||||
- xdg-basedir ==0.2.2
|
||||
- xdg-userdirs ==0.1.0.2
|
||||
- xeno ==0.6
|
||||
- xlsx ==1.1.2.1
|
||||
- xlsx ==1.1.2.2
|
||||
- xml ==1.3.14
|
||||
- xml-basic ==0.1.3.2
|
||||
- xmlbf ==0.7
|
||||
@@ -3268,7 +3291,7 @@ default-package-overrides:
|
||||
- yesod-form-bootstrap4 ==3.0.1.1
|
||||
- yesod-gitrepo ==0.3.0
|
||||
- yesod-gitrev ==0.2.2
|
||||
- yesod-markdown ==0.12.6.13
|
||||
- yesod-markdown ==0.12.6.14
|
||||
- yesod-middleware-csp ==1.2.0
|
||||
- yesod-newsfeed ==1.7.0.0
|
||||
- yesod-page-cursor ==2.0.1.0
|
||||
@@ -3288,6 +3311,7 @@ default-package-overrides:
|
||||
- youtube ==0.2.1.1
|
||||
- zenacy-html ==2.1.0
|
||||
- zenacy-unicode ==1.0.2
|
||||
- zenc ==0.1.2
|
||||
- zeromq4-haskell ==0.8.0
|
||||
- zeromq4-patterns ==0.3.1.0
|
||||
- zigzag ==0.0.1.0
|
||||
|
||||
@@ -246,7 +246,6 @@ dont-distribute-packages:
|
||||
- KiCS-debugger
|
||||
- KiCS-prophecy
|
||||
- LDAPv3
|
||||
- LPFP
|
||||
- LPPaver
|
||||
- LambdaINet
|
||||
- LambdaPrettyQuote
|
||||
@@ -403,7 +402,6 @@ dont-distribute-packages:
|
||||
- UTFTConverter
|
||||
- UrlDisp
|
||||
- ViennaRNA-extras
|
||||
- Vis
|
||||
- WEditorBrick
|
||||
- WEditorHyphen
|
||||
- WL500gPControl
|
||||
@@ -467,6 +465,7 @@ dont-distribute-packages:
|
||||
- agda-snippets-hakyll
|
||||
- agentx
|
||||
- aip
|
||||
- airgql
|
||||
- aivika-distributed
|
||||
- alg
|
||||
- algebra-checkers
|
||||
@@ -533,6 +532,7 @@ dont-distribute-packages:
|
||||
- apotiki
|
||||
- approx-rand-test
|
||||
- arbor-monad-metric-datadog
|
||||
- archive-libarchive
|
||||
- archive-tar-bytestring
|
||||
- archlinux-web
|
||||
- arduino-copilot
|
||||
@@ -637,7 +637,6 @@ dont-distribute-packages:
|
||||
- bearriver
|
||||
- beautifHOL
|
||||
- bech32-th
|
||||
- bech32-th_1_1_6
|
||||
- bein
|
||||
- belka
|
||||
- bff
|
||||
@@ -695,6 +694,7 @@ dont-distribute-packages:
|
||||
- blink1
|
||||
- blip
|
||||
- blogination
|
||||
- bloohm
|
||||
- bloxorz
|
||||
- blubber
|
||||
- bluetile
|
||||
@@ -1245,7 +1245,7 @@ dont-distribute-packages:
|
||||
- electrs-client
|
||||
- elerea-examples
|
||||
- eliminators
|
||||
- eliminators_0_9_4
|
||||
- eliminators_0_9_5
|
||||
- elliptic-curve
|
||||
- elsa
|
||||
- ema-extra
|
||||
@@ -2238,7 +2238,6 @@ dont-distribute-packages:
|
||||
- http-exchange
|
||||
- http-exchange-instantiations
|
||||
- http-response-decoder
|
||||
- http2-client-exe
|
||||
- http2-client-grpc
|
||||
- http2-grpc-proto-lens
|
||||
- http2-grpc-proto3-wire
|
||||
@@ -2266,6 +2265,7 @@ dont-distribute-packages:
|
||||
- hw-json-simple-cursor
|
||||
- hw-json-standard-cursor
|
||||
- hw-kafka-avro
|
||||
- hw-polysemy
|
||||
- hw-uri
|
||||
- hworker-ses
|
||||
- hwormhole
|
||||
@@ -2422,6 +2422,7 @@ dont-distribute-packages:
|
||||
- json-query
|
||||
- json-rpc-client
|
||||
- json-schema
|
||||
- json-sop
|
||||
- json-spec-elm
|
||||
- json-spec-elm-servant
|
||||
- json-spec-openapi
|
||||
@@ -2549,7 +2550,6 @@ dont-distribute-packages:
|
||||
- ldapply
|
||||
- leaky
|
||||
- lean
|
||||
- learn-physics
|
||||
- learning-hmm
|
||||
- legion
|
||||
- legion-discovery
|
||||
@@ -2567,6 +2567,7 @@ dont-distribute-packages:
|
||||
- lha
|
||||
- lhae
|
||||
- lhe
|
||||
- libarchive
|
||||
- libconfig
|
||||
- libcspm
|
||||
- libgraph
|
||||
@@ -3256,7 +3257,6 @@ dont-distribute-packages:
|
||||
- purescript-tsd-gen
|
||||
- pursuit-client
|
||||
- push-notify
|
||||
- push-notify-apn
|
||||
- push-notify-ccs
|
||||
- push-notify-general
|
||||
- puzzle-draw-cmdline
|
||||
@@ -3615,7 +3615,6 @@ dont-distribute-packages:
|
||||
- servant-ekg
|
||||
- servant-examples
|
||||
- servant-haxl-client
|
||||
- servant-http2-client
|
||||
- servant-js
|
||||
- servant-jsonrpc-client
|
||||
- servant-jsonrpc-server
|
||||
@@ -3906,6 +3905,8 @@ dont-distribute-packages:
|
||||
- target
|
||||
- task
|
||||
- task-distribution
|
||||
- tasklite
|
||||
- tasklite-core
|
||||
- tasty-bdd
|
||||
- tasty-groundhog-converters
|
||||
- tasty-integrate
|
||||
|
||||
+2463
-1169
File diff suppressed because it is too large
Load Diff
@@ -10,12 +10,13 @@
|
||||
, pythonOlder
|
||||
, mock
|
||||
, pyhamcrest
|
||||
, pyyaml
|
||||
, radish-bdd
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "gremlinpython";
|
||||
version = "3.6.4";
|
||||
version = "3.7.1";
|
||||
format = "setuptools";
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
@@ -24,7 +25,7 @@ buildPythonPackage rec {
|
||||
owner = "apache";
|
||||
repo = "tinkerpop";
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-SQ+LcHeHDB1Hd5wXGDJBZmBG4KEZ3NsV4+4X9WgPb9E=";
|
||||
hash = "sha256-2viZXksHNFynOm6+1Vo2a8xrXl4pQcAxAVgehp5y6us=";
|
||||
};
|
||||
|
||||
sourceRoot = "${src.name}/gremlin-python/src/main/python";
|
||||
@@ -53,6 +54,7 @@ buildPythonPackage rec {
|
||||
pytestCheckHook
|
||||
mock
|
||||
pyhamcrest
|
||||
pyyaml
|
||||
radish-bdd
|
||||
];
|
||||
|
||||
@@ -66,13 +68,26 @@ buildPythonPackage rec {
|
||||
disabledTestPaths = [
|
||||
"tests/driver/test_client.py"
|
||||
"tests/driver/test_driver_remote_connection.py"
|
||||
"tests/driver/test_driver_remote_connection_http.py"
|
||||
"tests/driver/test_driver_remote_connection_threaded.py"
|
||||
"tests/driver/test_web_socket_client_behavior.py"
|
||||
"tests/process/test_dsl.py"
|
||||
"tests/structure/io/test_functionalityio.py"
|
||||
];
|
||||
pytestFlagsArray = [
|
||||
pytestFlagsArray = let
|
||||
fullDisabled = builtins.concatStringsSep " or " [
|
||||
"test_transaction_commit"
|
||||
"test_transaction_rollback"
|
||||
"test_transaction_no_begin"
|
||||
"test_multi_commit_transaction"
|
||||
"test_multi_rollback_transaction"
|
||||
"test_multi_commit_and_rollback"
|
||||
"test_transaction_close_tx"
|
||||
"test_transaction_close_tx_from_parent"
|
||||
];
|
||||
in [
|
||||
# disabledTests doesn't quite allow us to be precise enough for this
|
||||
"-k 'not (TestFunctionalGraphSONIO and (test_timestamp or test_datetime or test_uuid))'"
|
||||
"-k 'not ((TestFunctionalGraphSONIO and (test_timestamp or test_datetime or test_uuid)) or ${fullDisabled})'"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
, astunparse
|
||||
, flatbuffers
|
||||
, h5py
|
||||
, llvmPackages
|
||||
, typing-extensions
|
||||
}:
|
||||
|
||||
@@ -51,12 +52,16 @@ in buildPythonPackage {
|
||||
|
||||
src = let
|
||||
pyVerNoDot = lib.strings.stringAsChars (x: lib.optionalString (x != ".") x) python.pythonVersion;
|
||||
platform = if stdenv.isDarwin then "mac" else "linux";
|
||||
unit = if cudaSupport then "gpu" else "cpu";
|
||||
key = "${platform}_py_${pyVerNoDot}_${unit}";
|
||||
in fetchurl (packages.${key} or {});
|
||||
platform = stdenv.system;
|
||||
cuda = lib.optionalString cudaSupport "_gpu";
|
||||
key = "${platform}_${pyVerNoDot}${cuda}";
|
||||
in fetchurl (packages.${key} or (throw "tensoflow-bin: unsupported system: ${stdenv.system}"));
|
||||
|
||||
propagatedBuildInputs = [
|
||||
buildInputs = [
|
||||
llvmPackages.openmp
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
astunparse
|
||||
flatbuffers
|
||||
typing-extensions
|
||||
@@ -81,7 +86,7 @@ in buildPythonPackage {
|
||||
h5py
|
||||
] ++ lib.optional (!isPy3k) mock;
|
||||
|
||||
nativeBuildInputs = [ wheel ] ++ lib.optionals cudaSupport [ addOpenGLRunpath ];
|
||||
build-system = [ wheel ] ++ lib.optionals cudaSupport [ addOpenGLRunpath ];
|
||||
|
||||
preConfigure = ''
|
||||
unset SOURCE_DATE_EPOCH
|
||||
@@ -91,7 +96,6 @@ in buildPythonPackage {
|
||||
|
||||
pushd dist
|
||||
|
||||
orig_name="$(echo ./*.whl)"
|
||||
wheel unpack --dest unpacked ./*.whl
|
||||
rm ./*.whl
|
||||
(
|
||||
@@ -113,7 +117,6 @@ in buildPythonPackage {
|
||||
-e "s/Requires-Dist: numpy (.*)/Requires-Dist: numpy/"
|
||||
)
|
||||
wheel pack ./unpacked/tensorflow*
|
||||
mv *.whl $orig_name # avoid changes to the _os_arch.whl suffix
|
||||
|
||||
popd
|
||||
'';
|
||||
@@ -168,6 +171,7 @@ in buildPythonPackage {
|
||||
"$out/${python.sitePackages}/tensorflow/python/saved_model"
|
||||
"$out/${python.sitePackages}/tensorflow/python/util"
|
||||
"$out/${python.sitePackages}/tensorflow/tsl/python/lib/core"
|
||||
"$out/${python.sitePackages}/tensorflow.libs/"
|
||||
"${rpath}"
|
||||
)
|
||||
|
||||
@@ -205,6 +209,10 @@ in buildPythonPackage {
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ jyp abbradar ];
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
||||
platforms = platforms.all;
|
||||
# Cannot import tensortfow on python 3.12 as it still dependends on distutils:
|
||||
# ModuleNotFoundError: No module named 'distutils'
|
||||
# https://github.com/tensorflow/tensorflow/issues/58073
|
||||
broken = pythonAtLeast "3.12";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,39 +1,83 @@
|
||||
{
|
||||
version = "2.15.0";
|
||||
linux_py_39_cpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "01m5wn9wpywd2cscklr2h8wdsf3wzg11dhgl0nfj7a997v2bvlyg";
|
||||
version = "2.16.1";
|
||||
x86_64-linux_39 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow_cpu-2.16.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "0j4311fav3b4wdhw9wb3zvc3grvgxddl28i4kwnbsvvjb191pcs5";
|
||||
};
|
||||
linux_py_310_cpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "0qjahvq9gd89cx2dwkb6gk3s947czmasp9cx1pqyw1x5f113s2zn";
|
||||
x86_64-linux_310 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow_cpu-2.16.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "0b8q3r2ql7rknlshiv3bh3hj9zll0dn6w0wdxnqgg18cljys5nhh";
|
||||
};
|
||||
linux_py_311_cpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "0w3jz7rpbf4r8hm91rjh666qyqflqy6x619fas1iqcgnfx8pjv7l";
|
||||
x86_64-linux_311 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow_cpu-2.16.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "12vv2jxybdfa8nq7r2y53vl7lvmaacb1xmy2368hkwqm2ld4mplg";
|
||||
};
|
||||
linux_py_39_gpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-2.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "0ckij6jffsi6yvjfiysnwrfblhqm5g1f8dkw4i7n3dwndnanba1z";
|
||||
x86_64-linux_312 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow_cpu-2.16.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "0vvv3cr10r6kgkalk3hydqz18y4lp990pm4vwq8mbwdi101m59mf";
|
||||
};
|
||||
linux_py_310_gpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-2.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "1y0cxsps4rkidc2c3apaf7vd9vsnjg5lpcq30bnrnzcvvx1inq7d";
|
||||
x86_64-linux_39_gpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "17v85433ns360rcccx7pnkhjzd003cr8p6rj51wqb3gl7gkldf83";
|
||||
};
|
||||
linux_py_311_gpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-2.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "1z7bd4yrdxa7rq4k1fybbwnyhxf4rm9nwx15bpk2m53c5hmyrs6y";
|
||||
x86_64-linux_310_gpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "0w3jd7siamvhgd7si59zpv3rdpq3s2ii3hhcdaimji66axv095hy";
|
||||
};
|
||||
mac_py_39_cpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.15.0-cp39-cp39-macosx_10_15_x86_64.whl";
|
||||
sha256 = "1kqb5h4vs4jlhlqjmqvcg6jivccwqj1rgklrgrhvw09wzzhxvz1c";
|
||||
x86_64-linux_311_gpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "014liy5wnbi2d2lnr8lqhd7221a4a1v6gzih7nv5qfnf1h86234k";
|
||||
};
|
||||
mac_py_310_cpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.15.0-cp310-cp310-macosx_10_15_x86_64.whl";
|
||||
sha256 = "0wmawdfhva9ixal7468c0rrx8qd7nzgkxy6i9k2s7cqn8c7qw94v";
|
||||
x86_64-linux_312_gpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl";
|
||||
sha256 = "0qd09bxfnad969y2h3mlzib51y6xcsqipq1w278k1fl8ayxky4ja";
|
||||
};
|
||||
mac_py_311_cpu = {
|
||||
url = "https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.15.0-cp311-cp311-macosx_10_15_x86_64.whl";
|
||||
sha256 = "0cigk43fabps7vskz4pfgmca3wa0545b15qridyqdbyp5ri1c1qy";
|
||||
aarch64-linux_39 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl";
|
||||
sha256 = "1n3qf0snjwrc0lcahls4bi2qhpd4yrd531b80vlq89j0gjkjl5cj";
|
||||
};
|
||||
aarch64-linux_310 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl";
|
||||
sha256 = "1aygypgm5fbpskf6xvzni2yd9l49hf3ls855z2aq0as73m3m81df";
|
||||
};
|
||||
aarch64-linux_311 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl";
|
||||
sha256 = "1c0bqiq2hbzcqhaym3s3s0dsp06m07mqgvm35z14nz395pxgjzb1";
|
||||
};
|
||||
aarch64-linux_312 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl";
|
||||
sha256 = "1ai2hrmn1il0hididdvhd005pjcn6hjivpgcw7dbhmdv6vacs4n6";
|
||||
};
|
||||
x86_64-darwin_39 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp39-cp39-macosx_10_15_x86_64.whl";
|
||||
sha256 = "0dkcd1v0ivjp6v5pngg0x461wci94nxvwprc6jwgi7rqgyx3zkz9";
|
||||
};
|
||||
x86_64-darwin_310 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp310-cp310-macosx_10_15_x86_64.whl";
|
||||
sha256 = "0rnlxrb4q2cgqaifalhpji15g1f3m9flqfvfj2p2sv3lvmbg2ydb";
|
||||
};
|
||||
x86_64-darwin_311 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp311-cp311-macosx_10_15_x86_64.whl";
|
||||
sha256 = "1xc9lis61adk2y22a82i3rvc0j7qznf4fqwg2pd1665zlhybi9gq";
|
||||
};
|
||||
x86_64-darwin_312 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp312-cp312-macosx_10_15_x86_64.whl";
|
||||
sha256 = "10g8y02ncp5l7f133vank6h01palc445h6s9jndmmy7vm33c7jh9";
|
||||
};
|
||||
aarch64-darwin_39 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp39-cp39-macosx_12_0_arm64.whl";
|
||||
sha256 = "0541ldysc1a06xcb632340gn1c33w245lzqwq2f2p6hm2ifqp1a2";
|
||||
};
|
||||
aarch64-darwin_310 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp310-cp310-macosx_12_0_arm64.whl";
|
||||
sha256 = "1crrd4izayqwji5gxjw1g9qppkvfsc8p1mr7z6hiipxidys6ldwf";
|
||||
};
|
||||
aarch64-darwin_311 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp311-cp311-macosx_12_0_arm64.whl";
|
||||
sha256 = "0kg4g4p563nhw0l2jzydhw4ycyj3dkgqzzm0m3z8k7vzsb8na86c";
|
||||
};
|
||||
aarch64-darwin_312 = {
|
||||
url = "https://storage.googleapis.com/tensorflow/versions/2.16.1/tensorflow-2.16.1-cp312-cp312-macosx_12_0_arm64.whl";
|
||||
sha256 = "1hnzfpfncw8fa84y0jivpfyb5cbbd4cvpln72wkcxpvhj23nvw5v";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,22 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
version="2.15.0"
|
||||
version="2.16.1"
|
||||
|
||||
bucket="https://storage.googleapis.com/tensorflow"
|
||||
bucket="https://storage.googleapis.com/tensorflow/versions/${version}"
|
||||
|
||||
# List of binary wheels for Tensorflow. The most recent versions can be found
|
||||
# on the following page:
|
||||
# https://www.tensorflow.org/install/pip?lang=python3#package-location
|
||||
url_and_key_list=(
|
||||
"linux_py_39_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"linux_py_310_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"linux_py_311_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"linux_py_39_gpu $bucket/linux/gpu/tensorflow-${version}-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"linux_py_310_gpu $bucket/linux/gpu/tensorflow-${version}-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"linux_py_311_gpu $bucket/linux/gpu/tensorflow-${version}-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"mac_py_39_cpu $bucket/mac/cpu/tensorflow-${version}-cp39-cp39-macosx_10_15_x86_64.whl"
|
||||
"mac_py_310_cpu $bucket/mac/cpu/tensorflow-${version}-cp310-cp310-macosx_10_15_x86_64.whl"
|
||||
"mac_py_311_cpu $bucket/mac/cpu/tensorflow-${version}-cp311-cp311-macosx_10_15_x86_64.whl"
|
||||
"x86_64-linux_39 $bucket/tensorflow_cpu-${version}-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"x86_64-linux_310 $bucket/tensorflow_cpu-${version}-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"x86_64-linux_311 $bucket/tensorflow_cpu-${version}-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"x86_64-linux_312 $bucket/tensorflow_cpu-${version}-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"x86_64-linux_39_gpu $bucket/tensorflow-${version}-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"x86_64-linux_310_gpu $bucket/tensorflow-${version}-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"x86_64-linux_311_gpu $bucket/tensorflow-${version}-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"x86_64-linux_312_gpu $bucket/tensorflow-${version}-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
||||
"aarch64-linux_39 $bucket/tensorflow-${version}-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
|
||||
"aarch64-linux_310 $bucket/tensorflow-${version}-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
|
||||
"aarch64-linux_311 $bucket/tensorflow-${version}-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
|
||||
"aarch64-linux_312 $bucket/tensorflow-${version}-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
|
||||
"x86_64-darwin_39 $bucket/tensorflow-${version}-cp39-cp39-macosx_10_15_x86_64.whl"
|
||||
"x86_64-darwin_310 $bucket/tensorflow-${version}-cp310-cp310-macosx_10_15_x86_64.whl"
|
||||
"x86_64-darwin_311 $bucket/tensorflow-${version}-cp311-cp311-macosx_10_15_x86_64.whl"
|
||||
"x86_64-darwin_312 $bucket/tensorflow-${version}-cp312-cp312-macosx_10_15_x86_64.whl"
|
||||
"aarch64-darwin_39 $bucket/tensorflow-${version}-cp39-cp39-macosx_12_0_arm64.whl"
|
||||
"aarch64-darwin_310 $bucket/tensorflow-${version}-cp310-cp310-macosx_12_0_arm64.whl"
|
||||
"aarch64-darwin_311 $bucket/tensorflow-${version}-cp311-cp311-macosx_12_0_arm64.whl"
|
||||
"aarch64-darwin_312 $bucket/tensorflow-${version}-cp312-cp312-macosx_12_0_arm64.whl"
|
||||
)
|
||||
|
||||
hashfile=binary-hashes.nix
|
||||
|
||||
@@ -27,15 +27,22 @@ buildGoModule rec {
|
||||
buildInputs = lib.optionals stdenv.isLinux [ btrfs-progs gpgme lvm2 ];
|
||||
|
||||
patches = [
|
||||
# fix scrolling
|
||||
# See https://github.com/wagoodman/dive/pull/447
|
||||
(fetchpatch {
|
||||
name = "fix-scrolling.patch";
|
||||
url = "https://github.com/wagoodman/dive/pull/473/commits/a885fa6e68b3763d52de20603ee1b9cd8949276f.patch";
|
||||
hash = "sha256-6gTWfyvK19xDqc7Ah33ewgz/WQRcQHLYwerrwUtRpJc=";
|
||||
})
|
||||
(fetchpatch {
|
||||
name = "add-scrolling-layers.patch";
|
||||
url = "https://github.com/wagoodman/dive/pull/478/commits/b7da0f90880ce5e9d3bc2d0f269aadac6ee63c49.patch";
|
||||
url = "https://github.com/wagoodman/dive/pull/473/commits/840653158e235bdd59b4c4621cf282ce6499c714.patch";
|
||||
hash = "sha256-dYqg5JpWKOzy3hVjIVCHA2vmKCtCgc8W+oHEzuGpyxc=";
|
||||
})
|
||||
(fetchpatch {
|
||||
name = "fix-render-update.patch";
|
||||
url = "https://github.com/wagoodman/dive/pull/478/commits/326fb0d8c9094ac068a29fecd4f103783199392c.patch";
|
||||
hash = "sha256-NC74MqHVChv/Z5hHX8ds3FI+tC+yyBpXvZKSFG3RyC0=";
|
||||
url = "https://github.com/wagoodman/dive/pull/473/commits/36177a9154eebe9e3ae9461a9e6f6b368f7974e1.patch";
|
||||
hash = "sha256-rSeEYxUaYlEZGv+NWYK+nATBYS4P2swqjC3HimHyqNI=";
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ version, sha256, patches ? [] }:
|
||||
|
||||
{ lib, stdenv, buildPackages, fetchurl, perl, xz, libintl, bash
|
||||
, gnulib, gawk, libiconv
|
||||
, gnulib, gawk, freebsd, libiconv
|
||||
|
||||
# we are a dependency of gcc, this simplifies bootstraping
|
||||
, interactive ? false, ncurses, procps
|
||||
@@ -63,7 +63,8 @@ stdenv.mkDerivation {
|
||||
installFlags = [ "TEXMF=$(out)/texmf-dist" ];
|
||||
installTargets = [ "install" "install-tex" ];
|
||||
|
||||
nativeCheckInputs = [ procps ];
|
||||
nativeCheckInputs = [ procps ]
|
||||
++ optionals stdenv.buildPlatform.isFreeBSD [ freebsd.locale ];
|
||||
|
||||
doCheck = interactive
|
||||
&& !stdenv.isDarwin
|
||||
|
||||
Generated
-7088
File diff suppressed because it is too large
Load Diff
@@ -1,150 +1,268 @@
|
||||
{ lib, stdenv, fetchurl, system ? builtins.currentSystem, ovftoolBundles ? {}
|
||||
, autoPatchelfHook, makeWrapper, unzip
|
||||
, glibc, c-ares, libxcrypt-legacy, expat, icu60, xercesc, zlib
|
||||
{ autoPatchelfHook
|
||||
, c-ares
|
||||
, darwin
|
||||
, expat
|
||||
, fetchurl
|
||||
, glibc
|
||||
, icu60
|
||||
, lib
|
||||
, libiconv
|
||||
, libredirect
|
||||
, libxcrypt-legacy
|
||||
, libxml2
|
||||
, makeWrapper
|
||||
, stdenv
|
||||
, unzip
|
||||
, xercesc
|
||||
, zlib
|
||||
}:
|
||||
|
||||
let
|
||||
version = "4.6.2-22220919";
|
||||
version_i686 = "4.6.0-21452615";
|
||||
|
||||
ovftoolZipUnpackPhase = ''
|
||||
runHook preUnpack
|
||||
unzip ${ovftoolSource}
|
||||
extracted=ovftool/
|
||||
if [ -d "$extracted" ]; then
|
||||
echo "ovftool extracted successfully" >&2
|
||||
else
|
||||
echo "Could not find $extracted - are you sure this is ovftool?" >&2
|
||||
exit 1
|
||||
fi
|
||||
runHook postUnpack
|
||||
'';
|
||||
ovftoolSystems =
|
||||
let
|
||||
baseUrl = "https://vdc-download.vmware.com/vmwb-repository/dcr-public";
|
||||
in
|
||||
{
|
||||
"i686-linux" = rec {
|
||||
name = "VMware-ovftool-${version}-lin.i386.zip";
|
||||
# As of 2024-02-20 the "Zip of OVF Tool for 32-bit Linux" download link
|
||||
# on the v4.6.2 page links to v4.6.0.
|
||||
version = "4.6.0-21452615";
|
||||
url = "${baseUrl}/7254abb2-434d-4f5d-83e2-9311ced9752e/57e666a2-874c-48fe-b1d2-4b6381f7fe97/${name}";
|
||||
hash = "sha256-qEOr/3SW643G5ZQQNJTelZbUxB8HmxPd5uD+Gqsoxz0=";
|
||||
};
|
||||
"x86_64-linux" = rec {
|
||||
name = "VMware-ovftool-${version}-lin.x86_64.zip";
|
||||
version = "4.6.2-22220919";
|
||||
url = "${baseUrl}/8a93ce23-4f88-4ae8-b067-ae174291e98f/c609234d-59f2-4758-a113-0ec5bbe4b120/${name}";
|
||||
hash = "sha256-3B1cUDldoTqLsbSARj2abM65nv+Ot0z/Fa35/klJXEY=";
|
||||
};
|
||||
"x86_64-darwin" = rec {
|
||||
name = "VMware-ovftool-${version}-mac.x64.zip";
|
||||
version = "4.6.2-22220919";
|
||||
url = "${baseUrl}/91091b23-280a-487a-a048-0c2594303c92/dc666e23-104f-4b9b-be11-6d88dcf3ab98/${name}";
|
||||
hash = "sha256-AZufZ0wxt5DYjnpahDfy36W8i7kjIfEkW6MoELSx11k=";
|
||||
};
|
||||
};
|
||||
|
||||
ovftoolSystems = let
|
||||
baseUrl = "https://vdc-download.vmware.com/vmwb-repository/dcr-public";
|
||||
in {
|
||||
"i686-linux" = rec {
|
||||
name = "VMware-ovftool-${version_i686}-lin.i386.zip";
|
||||
url = "${baseUrl}/7254abb2-434d-4f5d-83e2-9311ced9752e/57e666a2-874c-48fe-b1d2-4b6381f7fe97/${name}";
|
||||
hash = "sha256-qEOr/3SW643G5ZQQNJTelZbUxB8HmxPd5uD+Gqsoxz0=";
|
||||
unpackPhase = ovftoolZipUnpackPhase;
|
||||
};
|
||||
"x86_64-linux" = rec {
|
||||
name = "VMware-ovftool-${version}-lin.x86_64.zip";
|
||||
url = "${baseUrl}/8a93ce23-4f88-4ae8-b067-ae174291e98f/c609234d-59f2-4758-a113-0ec5bbe4b120/${name}";
|
||||
hash = "sha256-3B1cUDldoTqLsbSARj2abM65nv+Ot0z/Fa35/klJXEY=";
|
||||
unpackPhase = ovftoolZipUnpackPhase;
|
||||
};
|
||||
ovftoolSystem = ovftoolSystems.${stdenv.system} or (throw "unsupported system ${stdenv.system}");
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "ovftool";
|
||||
inherit (ovftoolSystem) version;
|
||||
|
||||
src = fetchurl {
|
||||
inherit (ovftoolSystem) name url hash;
|
||||
};
|
||||
|
||||
ovftoolSystem = if builtins.hasAttr system ovftoolSystems then
|
||||
ovftoolSystems.${system}
|
||||
else throw "System '${system}' is unsupported by ovftool";
|
||||
|
||||
ovftoolSource = if builtins.hasAttr system ovftoolBundles then
|
||||
ovftoolBundles.${system}
|
||||
else
|
||||
fetchurl {
|
||||
inherit (ovftoolSystem) name url hash;
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "ovftool";
|
||||
inherit version;
|
||||
|
||||
src = ovftoolSource;
|
||||
|
||||
buildInputs = [
|
||||
glibc
|
||||
libxcrypt-legacy
|
||||
c-ares
|
||||
expat
|
||||
icu60
|
||||
libiconv
|
||||
libxcrypt-legacy
|
||||
xercesc
|
||||
zlib
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
glibc
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
darwin.Libsystem
|
||||
libxml2
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ autoPatchelfHook makeWrapper unzip ];
|
||||
nativeBuildInputs = [ unzip makeWrapper ]
|
||||
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
|
||||
|
||||
preferLocalBuild = true;
|
||||
postUnpack = ''
|
||||
# The linux package wraps ovftool.bin with ovftool. Wrapping
|
||||
# below in installPhase.
|
||||
# Rename to ovftool on install for all systems to ovftool
|
||||
if [[ -f ovftool.bin ]]; then
|
||||
mv -v ovftool.bin ovftool
|
||||
fi
|
||||
'';
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
unpackPhase = ovftoolSystem.unpackPhase;
|
||||
|
||||
# Expects a directory named 'ovftool' containing the ovftool install.
|
||||
# Based on https://aur.archlinux.org/packages/vmware-ovftool/
|
||||
# with the addition of a libexec directory and a Nix-style binary wrapper.
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
if [ -d ovftool ]; then
|
||||
# Ensure we're in the staging directory
|
||||
cd ovftool
|
||||
fi
|
||||
# libraries
|
||||
install -m 755 -d "$out/lib/${pname}"
|
||||
# These all appear to be VMWare proprietary except for libgoogleurl and libcurl.
|
||||
# The rest of the libraries that the installer extracts are omitted here,
|
||||
# and provided in buildInputs. Since libcurl depends on VMWare's OpenSSL,
|
||||
# we have to use both here too.
|
||||
#
|
||||
# FIXME: can we replace libgoogleurl? Possibly from Chromium?
|
||||
# FIXME: tell VMware to use a modern version of OpenSSL.
|
||||
#
|
||||
install -m 644 -t "$out/lib/${pname}" \
|
||||
|
||||
# Based on https://aur.archlinux.org/packages/vmware-ovftool/
|
||||
# with the addition of a libexec directory and a Nix-style binary wrapper.
|
||||
|
||||
# Almost all libs in the package appear to be VMware proprietary except for
|
||||
# libgoogleurl and libcurl. The rest of the libraries that the installer
|
||||
# extracts are omitted here, and provided in buildInputs. Since libcurl
|
||||
# depends on VMware's OpenSSL, both libs are still used.
|
||||
# FIXME: Replace libgoogleurl? Possibly from Chromium?
|
||||
# FIXME: Tell VMware to use a modern version of OpenSSL. As of ovftool
|
||||
# v4.6.2 ovftool uses openssl-1.0.2zh which in seems to be the extended
|
||||
# support LTS release: https://www.openssl.org/support/contracts.html
|
||||
|
||||
# Install all libs that are not patched in preFixup.
|
||||
# Darwin dylibs are under `lib` in the zip.
|
||||
install -m 755 -d "$out/lib"
|
||||
install -m 644 -t "$out/lib" \
|
||||
'' + lib.optionalString stdenv.isLinux ''
|
||||
libcrypto.so.1.0.2 \
|
||||
libcurl.so.4 \
|
||||
libgoogleurl.so.59 \
|
||||
libssl.so.1.0.2 \
|
||||
libssoclient.so \
|
||||
libvim-types.so libvmacore.so libvmomi.so \
|
||||
libcurl.so.4 libcrypto.so.1.0.2 libssl.so.1.0.2
|
||||
# libexec binaries
|
||||
install -m 755 -d "$out/libexec/${pname}"
|
||||
install -m 755 -t "$out/libexec/${pname}" ovftool.bin
|
||||
install -m 644 -t "$out/libexec/${pname}" icudt44l.dat
|
||||
# libexec resources
|
||||
libvim-types.so \
|
||||
libvmacore.so \
|
||||
libvmomi.so
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
lib/libcrypto.1.0.2.dylib \
|
||||
lib/libcurl.4.dylib \
|
||||
lib/libgoogleurl.59.0.30.45.2.dylib \
|
||||
lib/libssl.1.0.2.dylib \
|
||||
lib/libssoclient.dylib \
|
||||
lib/libvim-types.dylib \
|
||||
lib/libvmacore.dylib \
|
||||
lib/libvmomi.dylib
|
||||
'' + ''
|
||||
# Install libexec binaries
|
||||
# ovftool expects to be run relative to certain directories, namely `env`.
|
||||
# Place the binary and those dirs in libexec.
|
||||
install -m 755 -d "$out/libexec"
|
||||
install -m 755 -t "$out/libexec" ovftool
|
||||
[ -f ovftool.bin ] && install -m 755 -t "$out/libexec" ovftool.bin
|
||||
install -m 644 -t "$out/libexec" icudt44l.dat
|
||||
|
||||
# Install other libexec resources that need to be relative to the `ovftool`
|
||||
# binary.
|
||||
for subdir in "certs" "env" "env/en" "schemas/DMTF" "schemas/vmware"; do
|
||||
install -m 755 -d "$out/libexec/${pname}/$subdir"
|
||||
install -m 644 -t "$out/libexec/${pname}/$subdir" "$subdir"/*.*
|
||||
install -m 755 -d "$out/libexec/$subdir"
|
||||
install -m 644 -t "$out/libexec/$subdir" "$subdir"/*.*
|
||||
done
|
||||
# EULA/OSS files
|
||||
install -m 755 -d "$out/share/licenses/${pname}"
|
||||
install -m 644 -t "$out/share/licenses/${pname}" \
|
||||
"vmware.eula" "vmware-eula.rtf" "open_source_licenses.txt"
|
||||
# documentation files
|
||||
install -m 755 -d "$out/share/doc/${pname}"
|
||||
install -m 644 -t "$out/share/doc/${pname}" "README.txt"
|
||||
# binary wrapper; note that LC_CTYPE is defaulted to en_US.UTF-8 by
|
||||
# VMWare's wrapper script. We use C.UTF-8 instead.
|
||||
|
||||
# Install EULA/OSS files
|
||||
install -m 755 -d "$out/share/licenses"
|
||||
install -m 644 -t "$out/share/licenses" \
|
||||
"vmware.eula" \
|
||||
"vmware-eula.rtf" \
|
||||
"open_source_licenses.txt"
|
||||
|
||||
# Install Docs
|
||||
install -m 755 -d "$out/share/doc"
|
||||
install -m 644 -t "$out/share/doc" "README.txt"
|
||||
|
||||
# Install final executable
|
||||
install -m 755 -d "$out/bin"
|
||||
makeWrapper "$out/libexec/${pname}/ovftool.bin" "$out/bin/ovftool" \
|
||||
--set-default LC_CTYPE C.UTF-8 \
|
||||
makeWrapper "$out/libexec/ovftool" "$out/bin/ovftool" \
|
||||
'' + lib.optionalString stdenv.isLinux ''
|
||||
--prefix LD_LIBRARY_PATH : "$out/lib"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
--prefix DYLD_LIBRARY_PATH : "$out/lib"
|
||||
'' + ''
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
preFixup = lib.optionalString stdenv.isLinux ''
|
||||
addAutoPatchelfSearchPath "$out/lib"
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
change_args=()
|
||||
|
||||
# Change relative @loader_path dylibs to absolute paths.
|
||||
for lib in $out/lib/*.dylib; do
|
||||
libname=$(basename $lib)
|
||||
change_args+=(-change "@loader_path/lib/$libname" "$out/lib/$libname")
|
||||
done
|
||||
|
||||
# Patches for ovftool binary
|
||||
change_args+=(-change /usr/lib/libSystem.B.dylib ${darwin.Libsystem}/lib/libSystem.B.dylib)
|
||||
change_args+=(-change /usr/lib/libc++.1.dylib ${stdenv.cc.libcxx}/lib/libc++.1.dylib)
|
||||
change_args+=(-change /usr/lib/libiconv.2.dylib ${libiconv}/lib/libiconv.2.dylib)
|
||||
change_args+=(-change /usr/lib/libxml2.2.dylib ${libxml2}/lib/libxml2.2.dylib)
|
||||
change_args+=(-change /usr/lib/libz.1.dylib ${zlib}/lib/libz.1.dylib)
|
||||
change_args+=(-change @loader_path/lib/libcares.2.dylib ${c-ares}/lib/libcares.2.dylib)
|
||||
change_args+=(-change @loader_path/lib/libexpat.dylib ${expat}/lib/libexpat.dylib)
|
||||
change_args+=(-change @loader_path/lib/libicudata.60.2.dylib ${icu60}/lib/libicudata.60.2.dylib)
|
||||
change_args+=(-change @loader_path/lib/libicuuc.60.2.dylib ${icu60}/lib/libicuuc.60.2.dylib)
|
||||
change_args+=(-change @loader_path/lib/libxerces-c-3.2.dylib ${xercesc}/lib/libxerces-c-3.2.dylib)
|
||||
|
||||
# Patch binary
|
||||
install_name_tool "''${change_args[@]}" "$out/libexec/ovftool"
|
||||
|
||||
# Additional patches for ovftool dylibs
|
||||
change_args+=(-change /usr/lib/libresolv.9.dylib ${darwin.Libsystem}/lib/libresolv.9.dylib)
|
||||
change_args+=(-change @loader_path/libcares.2.dylib ${c-ares}/lib/libcares.2.dylib)
|
||||
change_args+=(-change @loader_path/libexpat.dylib ${expat}/lib/libexpat.dylib)
|
||||
change_args+=(-change @loader_path/libicudata.60.2.dylib ${icu60}/lib/libicudata.60.2.dylib)
|
||||
change_args+=(-change @loader_path/libicuuc.60.2.dylib ${icu60}/lib/libicuuc.60.2.dylib)
|
||||
change_args+=(-change @loader_path/libxerces-c-3.2.dylib ${xercesc}/lib/libxerces-c-3.2.dylib)
|
||||
|
||||
# Add new abolute paths for other libs to all libs
|
||||
for lib in $out/lib/*.dylib; do
|
||||
libname=$(basename $lib)
|
||||
change_args+=(-change "@loader_path/$libname" "$out/lib/$libname")
|
||||
done
|
||||
|
||||
# Patch all libs
|
||||
for lib in $out/lib/*.dylib; do
|
||||
libname=$(basename $lib)
|
||||
install_name_tool -id "$libname" "$lib"
|
||||
install_name_tool "''${change_args[@]}" "$lib"
|
||||
done
|
||||
'';
|
||||
|
||||
# These paths are need for install check tests
|
||||
propagatedSandboxProfile = lib.optionalString stdenv.isDarwin ''
|
||||
(allow file-read* (subpath "/usr/share/locale"))
|
||||
(allow file-read* (subpath "/var/db/timezone"))
|
||||
(allow file-read* (subpath "/System/Library/TextEncodings"))
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
|
||||
installCheckPhase = ''
|
||||
# This is a NixOS 22.11 image (doesn't actually matter) with a 1 MiB root disk that's all zero.
|
||||
# Make sure that it converts properly.
|
||||
mkdir -p ovftool-check
|
||||
cd ovftool-check
|
||||
postInstallCheck = lib.optionalString stdenv.isDarwin ''
|
||||
export HOME=$TMPDIR
|
||||
# Construct a dummy /etc/passwd file - ovftool attempts to determine the
|
||||
# user's "real" home using this
|
||||
DUMMY_PASSWD="$(realpath $HOME/dummy-passwd)"
|
||||
cat > $DUMMY_PASSWD <<EOF
|
||||
$(whoami)::$(id -u):$(id -g)::$HOME:$SHELL
|
||||
EOF
|
||||
export DYLD_INSERT_LIBRARIES="${libredirect}/lib/libredirect.dylib"
|
||||
export NIX_REDIRECTS="/etc/passwd=$DUMMY_PASSWD"
|
||||
'' + ''
|
||||
mkdir -p ovftool-check && cd ovftool-check
|
||||
|
||||
$out/bin/ovftool ${./installCheckPhase.ova} nixos.ovf
|
||||
if [ ! -f nixos.ovf ] || [ ! -f nixos.mf ] || [ ! -f nixos-disk1.vmdk ]; then
|
||||
exit 1
|
||||
fi
|
||||
ovftool_with_args="$out/bin/ovftool --X:logToConsole"
|
||||
|
||||
# `installCheckPhase.ova` is a NixOS 22.11 image (doesn't actually matter)
|
||||
# with a 1 MiB root disk that's all zero. Make sure that it converts
|
||||
# properly.
|
||||
|
||||
$ovftool_with_args --schemaValidate ${./installCheckPhase.ova}
|
||||
$ovftool_with_args --sourceType=OVA --targetType=OVF ${./installCheckPhase.ova} nixos.ovf
|
||||
|
||||
# Test that the output files are there
|
||||
test -f nixos.ovf
|
||||
test -f nixos.mf
|
||||
test -f nixos-disk1.vmdk
|
||||
|
||||
$ovftool_with_args --schemaValidate nixos.ovf
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "VMWare tools for working with OVF, OVA, and VMX images";
|
||||
description = "VMware tools for working with OVF, OVA, and VMX images";
|
||||
homepage = "https://developer.vmware.com/web/tool/ovf-tool/";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [ numinit wolfangaukang ];
|
||||
maintainers = with maintainers; [ numinit wolfangaukang thanegill ];
|
||||
platforms = builtins.attrNames ovftoolSystems;
|
||||
mainProgram = "ovftool";
|
||||
knownVulnerabilities = [
|
||||
"The bundled version of openssl 1.0.2zh in ovftool has open vulnerabilities."
|
||||
"CVE-2024-0727"
|
||||
"CVE-2023-5678"
|
||||
"CVE-2023-3817"
|
||||
"CVE-2009-3767"
|
||||
"CVE-2009-3766"
|
||||
"CVE-2009-3765"
|
||||
"CVE-2009-1390"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9361,8 +9361,6 @@ with pkgs;
|
||||
inherit (darwin.apple_sdk.frameworks) AppKit;
|
||||
};
|
||||
|
||||
stalwart-mail = callPackage ../servers/mail/stalwart { };
|
||||
|
||||
jmespath = callPackage ../development/tools/jmespath { };
|
||||
|
||||
juicefs = callPackage ../tools/filesystems/juicefs { };
|
||||
@@ -15434,6 +15432,7 @@ with pkgs;
|
||||
|
||||
flutterPackages = recurseIntoAttrs (callPackage ../development/compilers/flutter { });
|
||||
flutter = flutterPackages.stable;
|
||||
flutter322 = flutterPackages.v3_22;
|
||||
flutter319 = flutterPackages.v3_19;
|
||||
flutter316 = flutterPackages.v3_16;
|
||||
flutter313 = flutterPackages.v3_13;
|
||||
@@ -24083,6 +24082,17 @@ with pkgs;
|
||||
|
||||
rocksdb = callPackage ../development/libraries/rocksdb { };
|
||||
|
||||
rocksdb_8_11 = rocksdb.overrideAttrs rec {
|
||||
pname = "rocksdb";
|
||||
version = "8.11.4";
|
||||
src = fetchFromGitHub {
|
||||
owner = "facebook";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
hash = "sha256-ZrU7G3xeimF3H2LRGBDHOq936u5pH/3nGecM4XEoWc8=";
|
||||
};
|
||||
};
|
||||
|
||||
rocksdb_8_3 = rocksdb.overrideAttrs rec {
|
||||
pname = "rocksdb";
|
||||
version = "8.3.2";
|
||||
@@ -26564,6 +26574,23 @@ with pkgs;
|
||||
|
||||
thttpd = callPackage ../servers/http/thttpd { };
|
||||
|
||||
stalwart-mail_0_6 = (stalwart-mail.override { rocksdb_8_11 = rocksdb_8_3; }).overrideAttrs (old: rec {
|
||||
pname = "stalwart-mail_0_6";
|
||||
version = "0.6.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "stalwartlabs";
|
||||
repo = "mail-server";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-OHwUWSUW6ovLQTxnuUrolQGhxbhp4YqKSH+ZTpe2WXc=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
cargoDeps = old.cargoDeps.overrideAttrs (_: {
|
||||
inherit src;
|
||||
name = "${pname}-${version}-vendor.tar.gz";
|
||||
outputHash = "sha256-mW3OXQj6DcIMO1YlTG3G+a1ORRcuvp5/h7BU+b4QbnE=";
|
||||
});
|
||||
});
|
||||
|
||||
static-web-server = callPackage ../servers/static-web-server { };
|
||||
|
||||
stone = callPackage ../servers/stone { };
|
||||
|
||||
@@ -229,7 +229,7 @@ in {
|
||||
buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_12;
|
||||
llvmPackages = pkgs.llvmPackages_12;
|
||||
};
|
||||
ghc948 = callPackage ../development/compilers/ghc/9.4.8.nix {
|
||||
ghc948 = callPackage ../development/compilers/ghc/9.4.8.fixme.nix {
|
||||
bootPkgs =
|
||||
# Building with 9.2 is broken due to
|
||||
# https://gitlab.haskell.org/ghc/ghc/-/issues/21914
|
||||
|
||||
Reference in New Issue
Block a user