diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 2da788a56af1..08758631a177 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -1394,12 +1394,6 @@
githubId = 302429;
name = "Marton Boros";
};
- branwright1 = {
- email = "branwright@protonmail.com";
- github = "branwright1";
- githubId = 71175207;
- name = "Brandon Wright";
- };
bramd = {
email = "bram@bramd.nl";
github = "bramd";
@@ -4765,12 +4759,6 @@
githubId = 1102396;
name = "Jussi Maki";
};
- joaquinito2051 = {
- email = "joaquinito2051@gmail.com";
- github = "heroku-miraheze";
- githubId = 61781343;
- name = "JoaquĆn Rufo Gutierrez";
- };
jobojeha = {
email = "jobojeha@jeppener.de";
github = "jobojeha";
@@ -5011,7 +4999,7 @@
name = "Julien Dehos";
};
julm = {
- email = "julm+nix@sourcephile.fr";
+ email = "julm+nixpkgs@sourcephile.fr";
github = "ju1m";
githubId = 21160136;
name = "Julien Moutinho";
diff --git a/nixos/doc/manual/release-notes/rl-2105.xml b/nixos/doc/manual/release-notes/rl-2105.xml
index a57ba2c8d369..3a276075b338 100644
--- a/nixos/doc/manual/release-notes/rl-2105.xml
+++ b/nixos/doc/manual/release-notes/rl-2105.xml
@@ -697,6 +697,17 @@ environment.systemPackages = [
All CUDA toolkit versions prior to CUDA 10 have been removed.
+
+
+ The kbdKeymaps package was removed since dvp and neo
+ are now included in kbd.
+
+ If you want to use the Programmer Dvorak Keyboard Layout, you have to use
+ dvorak-programmer in
+ now instead of dvp.
+ In it's still dvp.
+
+
The babeld service is now being run as an unprivileged user. To achieve that the module configures
@@ -923,6 +934,23 @@ environment.systemPackages = [
Note that users defined with an explicit UID below 500 are exempted from this check, as has no effect for those.
+
+
+ The security.apparmor module,
+ for the AppArmor
+ Mandatory Access Control system,
+ has been substantialy improved along with related tools,
+ so that module maintainers can now more easily write AppArmor profiles for NixOS.
+ The most notable change on the user-side is the new option ,
+ replacing the previous profiles option
+ to provide a way to disable a profile
+ and to select whether to confine in enforce mode (default)
+ or in complain mode (see journalctl -b --grep apparmor).
+ Security-minded users may also want to enable ,
+ at the cost of having some of their processes killed
+ when updating to a NixOS version introducing new AppArmor profiles.
+
+
The GNOME desktop manager once again installs gnome.epiphany by default.
diff --git a/nixos/modules/config/console.nix b/nixos/modules/config/console.nix
index 84ad76246fdb..5be7f06c05d9 100644
--- a/nixos/modules/config/console.nix
+++ b/nixos/modules/config/console.nix
@@ -82,8 +82,7 @@ in
packages = mkOption {
type = types.listOf types.package;
- default = with pkgs.kbdKeymaps; [ dvp neo ];
- defaultText = "with pkgs.kbdKeymaps; [ dvp neo ]";
+ default = [ ];
description = ''
List of additional packages that provide console fonts, keymaps and
other resources for virtual consoles use.
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index 6e7b8c4b88a2..72827c5abaae 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -448,6 +448,40 @@ in
(mkIf cfg.enable {
environment.systemPackages = [ pkgs.fontconfig ];
environment.etc.fonts.source = "${fontconfigEtc}/etc/fonts/";
+ security.apparmor.includes."abstractions/fonts" = ''
+ # fonts.conf
+ r ${pkg.out}/etc/fonts/fonts.conf,
+
+ # fontconfig default config files
+ r ${pkg.out}/etc/fonts/conf.d/*.conf,
+
+ # 00-nixos-cache.conf
+ r ${cacheConf},
+
+ # 10-nixos-rendering.conf
+ r ${renderConf},
+
+ # 50-user.conf
+ ${optionalString cfg.includeUserConf ''
+ r ${pkg.out}/etc/fonts/conf.d.bak/50-user.conf,
+ ''}
+
+ # local.conf (indirect priority 51)
+ ${optionalString (cfg.localConf != "") ''
+ r ${localConf},
+ ''}
+
+ # 52-nixos-default-fonts.conf
+ r ${defaultFontsConf},
+
+ # 53-no-bitmaps.conf
+ r ${rejectBitmaps},
+
+ ${optionalString (!cfg.allowType1) ''
+ # 53-nixos-reject-type1.conf
+ r ${rejectType1},
+ ''}
+ '';
})
(mkIf cfg.enable {
fonts.fontconfig.confPackages = [ confPkg ];
diff --git a/nixos/modules/config/malloc.nix b/nixos/modules/config/malloc.nix
index a3eb55d8a42e..fc35993b5a81 100644
--- a/nixos/modules/config/malloc.nix
+++ b/nixos/modules/config/malloc.nix
@@ -87,5 +87,12 @@ in
environment.etc."ld-nix.so.preload".text = ''
${providerLibPath}
'';
+ security.apparmor.includes = {
+ "abstractions/base" = ''
+ r /etc/ld-nix.so.preload,
+ r ${config.environment.etc."ld-nix.so.preload".source},
+ mr ${providerLibPath},
+ '';
+ };
};
}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 3fd0e1ffde04..9830a5f203e8 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -211,7 +211,6 @@
./rename.nix
./security/acme.nix
./security/apparmor.nix
- ./security/apparmor-suid.nix
./security/audit.nix
./security/auditd.nix
./security/ca.nix
diff --git a/nixos/modules/profiles/hardened.nix b/nixos/modules/profiles/hardened.nix
index 00aafc6831b2..3f8f78f012a7 100644
--- a/nixos/modules/profiles/hardened.nix
+++ b/nixos/modules/profiles/hardened.nix
@@ -36,6 +36,7 @@ with lib;
security.virtualisation.flushL1DataCache = mkDefault "always";
security.apparmor.enable = mkDefault true;
+ security.apparmor.killUnconfinedConfinables = mkDefault true;
boot.kernelParams = [
# Slab/slub sanity checks, redzoning, and poisoning
diff --git a/nixos/modules/security/apparmor-suid.nix b/nixos/modules/security/apparmor-suid.nix
deleted file mode 100644
index 6c479e070e2b..000000000000
--- a/nixos/modules/security/apparmor-suid.nix
+++ /dev/null
@@ -1,49 +0,0 @@
-{ config, lib, pkgs, ... }:
-let
- cfg = config.security.apparmor;
-in
-with lib;
-{
- imports = [
- (mkRenamedOptionModule [ "security" "virtualization" "flushL1DataCache" ] [ "security" "virtualisation" "flushL1DataCache" ])
- ];
-
- options.security.apparmor.confineSUIDApplications = mkOption {
- type = types.bool;
- default = true;
- description = ''
- Install AppArmor profiles for commonly-used SUID application
- to mitigate potential privilege escalation attacks due to bugs
- in such applications.
-
- Currently available profiles: ping
- '';
- };
-
- config = mkIf (cfg.confineSUIDApplications) {
- security.apparmor.profiles = [ (pkgs.writeText "ping" ''
- #include
- /run/wrappers/bin/ping {
- #include
- #include
- #include
-
- capability net_raw,
- capability setuid,
- network inet raw,
-
- ${pkgs.stdenv.cc.libc.out}/lib/*.so mr,
- ${pkgs.libcap.lib}/lib/libcap.so* mr,
- ${pkgs.attr.out}/lib/libattr.so* mr,
-
- ${pkgs.iputils}/bin/ping mixr,
-
- #/etc/modules.conf r,
-
- ## Site-specific additions and overrides. See local/README for details.
- ##include
- }
- '') ];
- };
-
-}
diff --git a/nixos/modules/security/apparmor.nix b/nixos/modules/security/apparmor.nix
index cfc65b347bc6..9bd909aa50bc 100644
--- a/nixos/modules/security/apparmor.nix
+++ b/nixos/modules/security/apparmor.nix
@@ -1,59 +1,216 @@
{ config, lib, pkgs, ... }:
+with lib;
+
let
- inherit (lib) mkIf mkOption types concatMapStrings;
+ inherit (builtins) attrNames head map match readFile;
+ inherit (lib) types;
+ inherit (config.environment) etc;
cfg = config.security.apparmor;
+ mkDisableOption = name: mkEnableOption name // {
+ default = true;
+ example = false;
+ };
+ enabledPolicies = filterAttrs (n: p: p.enable) cfg.policies;
in
{
- options = {
- security.apparmor = {
- enable = mkOption {
- type = types.bool;
- default = false;
- description = "Enable the AppArmor Mandatory Access Control system.";
- };
- profiles = mkOption {
- type = types.listOf types.path;
- default = [];
- description = "List of files containing AppArmor profiles.";
- };
- packages = mkOption {
- type = types.listOf types.package;
- default = [];
- description = "List of packages to be added to apparmor's include path";
- };
- };
- };
+ imports = [
+ (mkRemovedOptionModule [ "security" "apparmor" "confineSUIDApplications" ] "Please use the new options: `security.apparmor.policies..enable'.")
+ (mkRemovedOptionModule [ "security" "apparmor" "profiles" ] "Please use the new option: `security.apparmor.policies'.")
+ apparmor/includes.nix
+ apparmor/profiles.nix
+ ];
- config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.apparmor-utils ];
+ options = {
+ security.apparmor = {
+ enable = mkEnableOption ''
+ the AppArmor Mandatory Access Control system.
- boot.kernelParams = [ "apparmor=1" "security=apparmor" ];
+ If you're enabling this module on a running system,
+ note that a reboot will be required to activate AppArmor in the kernel.
- systemd.services.apparmor = let
- paths = concatMapStrings (s: " -I ${s}/etc/apparmor.d")
- ([ pkgs.apparmor-profiles ] ++ cfg.packages);
- in {
- after = [ "local-fs.target" ];
- before = [ "sysinit.target" ];
- wantedBy = [ "multi-user.target" ];
- unitConfig = {
- DefaultDependencies = "no";
- };
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = "yes";
- ExecStart = map (p:
- ''${pkgs.apparmor-parser}/bin/apparmor_parser -rKv ${paths} "${p}"''
- ) cfg.profiles;
- ExecStop = map (p:
- ''${pkgs.apparmor-parser}/bin/apparmor_parser -Rv "${p}"''
- ) cfg.profiles;
- ExecReload = map (p:
- ''${pkgs.apparmor-parser}/bin/apparmor_parser --reload ${paths} "${p}"''
- ) cfg.profiles;
- };
- };
- };
+ Also, beware that enabling this module privileges stability over security
+ by not trying to kill unconfined but newly confinable running processes by default,
+ though it would be needed because AppArmor can only confine new
+ or already confined processes of an executable.
+ This killing would for instance be necessary when upgrading to a NixOS revision
+ introducing for the first time an AppArmor profile for the executable
+ of a running process.
+
+ Enable
+ if you want this service to do such killing
+ by sending a SIGTERM to those running processes'';
+ policies = mkOption {
+ description = ''
+ AppArmor policies.
+ '';
+ type = types.attrsOf (types.submodule ({ name, config, ... }: {
+ options = {
+ enable = mkDisableOption "loading of the profile into the kernel";
+ enforce = mkDisableOption "enforcing of the policy or only complain in the logs";
+ profile = mkOption {
+ description = "The policy of the profile.";
+ type = types.lines;
+ apply = pkgs.writeText name;
+ };
+ };
+ }));
+ default = {};
+ };
+ includes = mkOption {
+ type = types.attrsOf types.lines;
+ default = {};
+ description = ''
+ List of paths to be added to AppArmor's searched paths
+ when resolving include directives.
+ '';
+ apply = mapAttrs pkgs.writeText;
+ };
+ packages = mkOption {
+ type = types.listOf types.package;
+ default = [];
+ description = "List of packages to be added to AppArmor's include path";
+ };
+ enableCache = mkEnableOption ''
+ caching of AppArmor policies
+ in /var/cache/apparmor/.
+
+ Beware that AppArmor policies almost always contain Nix store paths,
+ and thus produce at each change of these paths
+ a new cached version accumulating in the cache'';
+ killUnconfinedConfinables = mkEnableOption ''
+ killing of processes which have an AppArmor profile enabled
+ (in )
+ but are not confined (because AppArmor can only confine new processes).
+
+ This is only sending a gracious SIGTERM signal to the processes,
+ not a SIGKILL.
+
+ Beware that due to a current limitation of AppArmor,
+ only profiles with exact paths (and no name) can enable such kills'';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions = map (policy:
+ { assertion = match ".*/.*" policy == null;
+ message = "`security.apparmor.policies.\"${policy}\"' must not contain a slash.";
+ # Because, for instance, aa-remove-unknown uses profiles_names_list() in rc.apparmor.functions
+ # which does not recurse into sub-directories.
+ }
+ ) (attrNames cfg.policies);
+
+ environment.systemPackages = [
+ pkgs.apparmor-utils
+ pkgs.apparmor-bin-utils
+ ];
+ environment.etc."apparmor.d".source = pkgs.linkFarm "apparmor.d" (
+ # It's important to put only enabledPolicies here and not all cfg.policies
+ # because aa-remove-unknown reads profiles from all /etc/apparmor.d/*
+ mapAttrsToList (name: p: { inherit name; path = p.profile; }) enabledPolicies ++
+ mapAttrsToList (name: path: { inherit name path; }) cfg.includes
+ );
+ environment.etc."apparmor/parser.conf".text = ''
+ ${if cfg.enableCache then "write-cache" else "skip-cache"}
+ cache-loc /var/cache/apparmor
+ Include /etc/apparmor.d
+ '' +
+ concatMapStrings (p: "Include ${p}/etc/apparmor.d\n") cfg.packages;
+ # For aa-logprof
+ environment.etc."apparmor/apparmor.conf".text = ''
+ '';
+ # For aa-logprof
+ environment.etc."apparmor/severity.db".source = pkgs.apparmor-utils + "/etc/apparmor/severity.db";
+ environment.etc."apparmor/logprof.conf".source = pkgs.runCommand "logprof.conf" {
+ header = ''
+ [settings]
+ # /etc/apparmor.d/ is read-only on NixOS
+ profiledir = /var/cache/apparmor/logprof
+ inactive_profiledir = /etc/apparmor.d/disable
+ # Use: journalctl -b --since today --grep audit: | aa-logprof
+ logfiles = /dev/stdin
+
+ parser = ${pkgs.apparmor-parser}/bin/apparmor_parser
+ ldd = ${pkgs.glibc.bin}/bin/ldd
+ logger = ${pkgs.utillinux}/bin/logger
+
+ # customize how file ownership permissions are presented
+ # 0 - off
+ # 1 - default of what ever mode the log reported
+ # 2 - force the new permissions to be user
+ # 3 - force all perms on the rule to be user
+ default_owner_prompt = 1
+
+ custom_includes = /etc/apparmor.d ${concatMapStringsSep " " (p: "${p}/etc/apparmor.d") cfg.packages}
+
+ [qualifiers]
+ ${pkgs.runtimeShell} = icnu
+ ${pkgs.bashInteractive}/bin/sh = icnu
+ ${pkgs.bashInteractive}/bin/bash = icnu
+ ${config.users.defaultUserShell} = icnu
+ '';
+ footer = "${pkgs.apparmor-utils}/etc/apparmor/logprof.conf";
+ passAsFile = [ "header" ];
+ } ''
+ cp $headerPath $out
+ sed '1,/\[qualifiers\]/d' $footer >> $out
+ '';
+
+ boot.kernelParams = [ "apparmor=1" "security=apparmor" ];
+
+ systemd.services.apparmor = {
+ after = [
+ "local-fs.target"
+ "systemd-journald-audit.socket"
+ ];
+ before = [ "sysinit.target" ];
+ wantedBy = [ "multi-user.target" ];
+ unitConfig = {
+ Description="Load AppArmor policies";
+ DefaultDependencies = "no";
+ ConditionSecurity = "apparmor";
+ };
+ # Reloading instead of restarting enables to load new AppArmor profiles
+ # without necessarily restarting all services which have Requires=apparmor.service
+ reloadIfChanged = true;
+ restartTriggers = [
+ etc."apparmor/parser.conf".source
+ etc."apparmor.d".source
+ ];
+ serviceConfig = let
+ killUnconfinedConfinables = pkgs.writeShellScript "apparmor-kill" ''
+ set -eu
+ ${pkgs.apparmor-bin-utils}/bin/aa-status --json |
+ ${pkgs.jq}/bin/jq --raw-output '.processes | .[] | .[] | select (.status == "unconfined") | .pid' |
+ xargs --verbose --no-run-if-empty --delimiter='\n' \
+ kill
+ '';
+ commonOpts = p: "--verbose --show-cache ${optionalString (!p.enforce) "--complain "}${p.profile}";
+ in {
+ Type = "oneshot";
+ RemainAfterExit = "yes";
+ ExecStartPre = "${pkgs.apparmor-utils}/bin/aa-teardown";
+ ExecStart = mapAttrsToList (n: p: "${pkgs.apparmor-parser}/bin/apparmor_parser --add ${commonOpts p}") enabledPolicies;
+ ExecStartPost = optional cfg.killUnconfinedConfinables killUnconfinedConfinables;
+ ExecReload =
+ # Add or replace into the kernel profiles in enabledPolicies
+ # (because AppArmor can do that without stopping the processes already confined).
+ mapAttrsToList (n: p: "${pkgs.apparmor-parser}/bin/apparmor_parser --replace ${commonOpts p}") enabledPolicies ++
+ # Remove from the kernel any profile whose name is not
+ # one of the names within the content of the profiles in enabledPolicies
+ # (indirectly read from /etc/apparmor.d/*, without recursing into sub-directory).
+ # Note that this does not remove profiles dynamically generated by libvirt.
+ [ "${pkgs.apparmor-utils}/bin/aa-remove-unknown" ] ++
+ # Optionaly kill the processes which are unconfined but now have a profile loaded
+ # (because AppArmor can only start to confine new processes).
+ optional cfg.killUnconfinedConfinables killUnconfinedConfinables;
+ ExecStop = "${pkgs.apparmor-utils}/bin/aa-teardown";
+ CacheDirectory = [ "apparmor" "apparmor/logprof" ];
+ CacheDirectoryMode = "0700";
+ };
+ };
+ };
+
+ meta.maintainers = with maintainers; [ julm ];
}
diff --git a/nixos/modules/security/apparmor/includes.nix b/nixos/modules/security/apparmor/includes.nix
new file mode 100644
index 000000000000..e3dd410b3bb5
--- /dev/null
+++ b/nixos/modules/security/apparmor/includes.nix
@@ -0,0 +1,317 @@
+{ config, lib, pkgs, ... }:
+let
+ inherit (builtins) attrNames hasAttr isAttrs;
+ inherit (lib) getLib;
+ inherit (config.environment) etc;
+ # Utility to generate an AppArmor rule
+ # only when the given path exists in config.environment.etc
+ etcRule = arg:
+ let go = { path ? null, mode ? "r", trail ? "" }:
+ lib.optionalString (hasAttr path etc)
+ "${mode} ${config.environment.etc.${path}.source}${trail},";
+ in if isAttrs arg
+ then go arg
+ else go { path = arg; };
+in
+{
+# FIXME: most of the etcRule calls below have been
+# written systematically by converting from apparmor-profiles's profiles
+# without testing nor deep understanding of their uses,
+# and thus may need more rules or can have less rules;
+# this remains to be determined case by case,
+# some may even be completely useless.
+config.security.apparmor.includes = {
+ # This one is included by
+ # which is usualy included before any profile.
+ "abstractions/tunables/alias" = ''
+ alias /bin -> /run/current-system/sw/bin,
+ alias /lib/modules -> /run/current-system/kernel/lib/modules,
+ alias /sbin -> /run/current-system/sw/sbin,
+ alias /usr -> /run/current-system/sw,
+ '';
+ "abstractions/audio" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/audio"
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ "asound.conf"
+ "esound/esd.conf"
+ "libao.conf"
+ { path = "pulse"; trail = "/"; }
+ { path = "pulse"; trail = "/**"; }
+ { path = "sound"; trail = "/"; }
+ { path = "sound"; trail = "/**"; }
+ { path = "alsa/conf.d"; trail = "/"; }
+ { path = "alsa/conf.d"; trail = "/*"; }
+ "openal/alsoft.conf"
+ "wildmidi/wildmidi.conf"
+ ];
+ "abstractions/authentication" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/authentication"
+ # Defined in security.pam
+ include
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ "nologin"
+ "securetty"
+ { path = "security"; trail = "/*"; }
+ "shadow"
+ "gshadow"
+ "pwdb.conf"
+ "default/passwd"
+ "login.defs"
+ ];
+ "abstractions/base" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/base"
+ r ${pkgs.stdenv.cc.libc}/share/locale/**,
+ r ${pkgs.stdenv.cc.libc}/share/locale.alias,
+ ${lib.optionalString (pkgs.glibcLocales != null) "r ${pkgs.glibcLocales}/lib/locale/locale-archive,"}
+ ${etcRule "localtime"}
+ r ${pkgs.tzdata}/share/zoneinfo/**,
+ r ${pkgs.stdenv.cc.libc}/share/i18n/**,
+ '';
+ "abstractions/bash" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/bash"
+
+ # bash inspects filesystems at startup
+ # and /etc/mtab is linked to /proc/mounts
+ @{PROC}/mounts
+
+ # system-wide bash configuration
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ "profile.dos"
+ "profile"
+ "profile.d"
+ { path = "profile.d"; trail = "/*"; }
+ "bashrc"
+ "bash.bashrc"
+ "bash.bashrc.local"
+ "bash_completion"
+ "bash_completion.d"
+ { path = "bash_completion.d"; trail = "/*"; }
+ # bash relies on system-wide readline configuration
+ "inputrc"
+ # run out of /etc/bash.bashrc
+ "DIR_COLORS"
+ ];
+ "abstractions/consoles" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/consoles"
+ '';
+ "abstractions/cups-client" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/cpus-client"
+ ${etcRule "cups/cups-client.conf"}
+ '';
+ "abstractions/dbus-session-strict" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/dbus-session-strict"
+ ${etcRule "machine-id"}
+ '';
+ "abstractions/dconf" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/dconf"
+ ${etcRule { path = "dconf"; trail = "/**"; }}
+ '';
+ "abstractions/dri-common" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/dri-common"
+ ${etcRule "drirc"}
+ '';
+ # The config.fonts.fontconfig NixOS module adds many files to /etc/fonts/
+ # by symlinking them but without exporting them outside of its NixOS module,
+ # those are therefore added there to this "abstractions/fonts".
+ "abstractions/fonts" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/fonts"
+ ${etcRule { path = "fonts"; trail = "/**"; }}
+ '';
+ "abstractions/gnome" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/gnome"
+ include
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ { path = "gnome"; trail = "/gtkrc*"; }
+ { path = "gtk"; trail = "/*"; }
+ { path = "gtk-2.0"; trail = "/*"; }
+ { path = "gtk-3.0"; trail = "/*"; }
+ "orbitrc"
+ { path = "pango"; trail = "/*"; }
+ { path = "/etc/gnome-vfs-2.0"; trail = "/modules/"; }
+ { path = "/etc/gnome-vfs-2.0"; trail = "/modules/*"; }
+ "papersize"
+ { path = "cups"; trail = "/lpoptions"; }
+ { path = "gnome"; trail = "/defaults.list"; }
+ { path = "xdg"; trail = "/{,*-}mimeapps.list"; }
+ "xdg/mimeapps.list"
+ ];
+ "abstractions/kde" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/kde"
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ { path = "qt3"; trail = "/kstylerc"; }
+ { path = "qt3"; trail = "/qt_plugins_3.3rc"; }
+ { path = "qt3"; trail = "/qtrc"; }
+ "kderc"
+ { path = "kde3"; trail = "/*"; }
+ "kde4rc"
+ { path = "xdg"; trail = "/kdeglobals"; }
+ { path = "xdg"; trail = "/Trolltech.conf"; }
+ ];
+ "abstractions/kerberosclient" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/kerberosclient"
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ { path = "krb5.keytab"; mode="rk"; }
+ "krb5.conf"
+ "krb5.conf.d"
+ { path = "krb5.conf.d"; trail = "/*"; }
+
+ # config files found via strings on libs
+ "krb.conf"
+ "krb.realms"
+ "srvtab"
+ ];
+ "abstractions/ldapclient" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/ldapclient"
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ "ldap.conf"
+ "ldap.secret"
+ { path = "openldap"; trail = "/*"; }
+ { path = "openldap"; trail = "/cacerts/*"; }
+ { path = "sasl2"; trail = "/*"; }
+ ];
+ "abstractions/likewise" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/likewise"
+ '';
+ "abstractions/mdns" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/mdns"
+ ${etcRule "nss_mdns.conf"}
+ '';
+ "abstractions/nameservice" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/nameservice"
+
+ # Many programs wish to perform nameservice-like operations, such as
+ # looking up users by name or id, groups by name or id, hosts by name
+ # or IP, etc. These operations may be performed through files, dns,
+ # NIS, NIS+, LDAP, hesiod, wins, etc. Allow them all here.
+ mr ${getLib pkgs.nss}/lib/libnss_*.so*,
+ mr ${getLib pkgs.nss}/lib64/libnss_*.so*,
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ "group"
+ "host.conf"
+ "hosts"
+ "nsswitch.conf"
+ "gai.conf"
+ "passwd"
+ "protocols"
+
+ # libtirpc (used for NIS/YP login) needs this
+ "netconfig"
+
+ "resolv.conf"
+
+ { path = "samba"; trail = "/lmhosts"; }
+ "services"
+
+ "default/nss"
+
+ # libnl-3-200 via libnss-gw-name
+ { path = "libnl"; trail = "/classid"; }
+ { path = "libnl-3"; trail = "/classid"; }
+ ];
+ "abstractions/nis" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/nis"
+ '';
+ "abstractions/nvidia" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/nvidia"
+ ${etcRule "vdpau_wrapper.cfg"}
+ '';
+ "abstractions/opencl-common" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/opencl-common"
+ ${etcRule { path = "OpenCL"; trail = "/**"; }}
+ '';
+ "abstractions/opencl-mesa" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/opencl-mesa"
+ ${etcRule "default/drirc"}
+ '';
+ "abstractions/openssl" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/openssl"
+ ${etcRule { path = "ssl"; trail = "/openssl.cnf"; }}
+ '';
+ "abstractions/p11-kit" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/p11-kit"
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ { path = "pkcs11"; trail = "/"; }
+ { path = "pkcs11"; trail = "/pkcs11.conf"; }
+ { path = "pkcs11"; trail = "/modules/"; }
+ { path = "pkcs11"; trail = "/modules/*"; }
+ ];
+ "abstractions/perl" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/perl"
+ ${etcRule { path = "perl"; trail = "/**"; }}
+ '';
+ "abstractions/php" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/php"
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ { path = "php"; trail = "/**/"; }
+ { path = "php5"; trail = "/**/"; }
+ { path = "php7"; trail = "/**/"; }
+ { path = "php"; trail = "/**.ini"; }
+ { path = "php5"; trail = "/**.ini"; }
+ { path = "php7"; trail = "/**.ini"; }
+ ];
+ "abstractions/postfix-common" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/postfix-common"
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ "mailname"
+ { path = "postfix"; trail = "/*.cf"; }
+ "postfix/main.cf"
+ "postfix/master.cf"
+ ];
+ "abstractions/python" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/python"
+ '';
+ "abstractions/qt5" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/qt5"
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ { path = "xdg"; trail = "/QtProject/qtlogging.ini"; }
+ { path = "xdg/QtProject"; trail = "/qtlogging.ini"; }
+ "xdg/QtProject/qtlogging.ini"
+ ];
+ "abstractions/samba" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/samba"
+ ${etcRule { path = "samba"; trail = "/*"; }}
+ '';
+ "abstractions/ssl_certs" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/ssl_certs"
+
+ # For the NixOS module: security.acme
+ r /var/lib/acme/*/cert.pem,
+ r /var/lib/acme/*/chain.pem,
+ r /var/lib/acme/*/fullchain.pem,
+
+ '' + lib.concatMapStringsSep "\n" etcRule [
+ "ssl/certs/ca-certificates.crt"
+ "ssl/certs/ca-bundle.crt"
+ "pki/tls/certs/ca-bundle.crt"
+
+ { path = "ssl/trust"; trail = "/"; }
+ { path = "ssl/trust"; trail = "/*"; }
+ { path = "ssl/trust/anchors"; trail = "/"; }
+ { path = "ssl/trust/anchors"; trail = "/**"; }
+ { path = "pki/trust"; trail = "/"; }
+ { path = "pki/trust"; trail = "/*"; }
+ { path = "pki/trust/anchors"; trail = "/"; }
+ { path = "pki/trust/anchors"; trail = "/**"; }
+ ];
+ "abstractions/ssl_keys" = ''
+ # security.acme NixOS module
+ r /var/lib/acme/*/full.pem,
+ r /var/lib/acme/*/key.pem,
+ '';
+ "abstractions/vulkan" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/vulkan"
+ ${etcRule { path = "vulkan/icd.d"; trail = "/"; }}
+ ${etcRule { path = "vulkan/icd.d"; trail = "/*.json"; }}
+ '';
+ "abstractions/winbind" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/winbind"
+ ${etcRule { path = "samba"; trail = "/smb.conf"; }}
+ ${etcRule { path = "samba"; trail = "/dhcp.conf"; }}
+ '';
+ "abstractions/X" = ''
+ include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/X"
+ ${etcRule { path = "X11/cursors"; trail = "/"; }}
+ ${etcRule { path = "X11/cursors"; trail = "/**"; }}
+ '';
+};
+}
diff --git a/nixos/modules/security/apparmor/profiles.nix b/nixos/modules/security/apparmor/profiles.nix
new file mode 100644
index 000000000000..8eb630b5a48a
--- /dev/null
+++ b/nixos/modules/security/apparmor/profiles.nix
@@ -0,0 +1,11 @@
+{ config, lib, pkgs, ... }:
+let apparmor = config.security.apparmor; in
+{
+config.security.apparmor.packages = [ pkgs.apparmor-profiles ];
+config.security.apparmor.policies."bin.ping".profile = lib.mkIf apparmor.policies."bin.ping".enable ''
+ include "${pkgs.iputils.apparmor}/bin.ping"
+ include "${pkgs.inetutils.apparmor}/bin.ping"
+ # Note that including those two profiles in the same profile
+ # would not work if the second one were to re-include .
+'';
+}
diff --git a/nixos/modules/security/misc.nix b/nixos/modules/security/misc.nix
index d51dbbb77f71..e7abc1e0d597 100644
--- a/nixos/modules/security/misc.nix
+++ b/nixos/modules/security/misc.nix
@@ -7,6 +7,10 @@ with lib;
maintainers = [ maintainers.joachifm ];
};
+ imports = [
+ (lib.mkRenamedOptionModule [ "security" "virtualization" "flushL1DataCache" ] [ "security" "virtualisation" "flushL1DataCache" ])
+ ];
+
options = {
security.allowUserNamespaces = mkOption {
type = types.bool;
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 523ad1ed407b..b5bd22f6ba7b 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -895,6 +895,81 @@ in
runuser-l = { rootOK = true; unixAuth = false; };
};
+ security.apparmor.includes."abstractions/pam" = let
+ isEnabled = test: fold or false (map test (attrValues config.security.pam.services));
+ in
+ lib.concatMapStringsSep "\n"
+ (name: "r ${config.environment.etc."pam.d/${name}".source},")
+ (attrNames config.security.pam.services) +
+ ''
+ mr ${getLib pkgs.pam}/lib/security/pam_filter/*,
+ mr ${getLib pkgs.pam}/lib/security/pam_*.so,
+ r ${getLib pkgs.pam}/lib/security/,
+ '' +
+ optionalString use_ldap ''
+ mr ${pam_ldap}/lib/security/pam_ldap.so,
+ '' +
+ optionalString config.services.sssd.enable ''
+ mr ${pkgs.sssd}/lib/security/pam_sss.so,
+ '' +
+ optionalString config.krb5.enable ''
+ mr ${pam_krb5}/lib/security/pam_krb5.so,
+ mr ${pam_ccreds}/lib/security/pam_ccreds.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.googleOsLoginAccountVerification)) ''
+ mr ${pkgs.google-compute-engine-oslogin}/lib/pam_oslogin_login.so,
+ mr ${pkgs.google-compute-engine-oslogin}/lib/pam_oslogin_admin.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.googleOsLoginAuthentication)) ''
+ mr ${pkgs.google-compute-engine-oslogin}/lib/pam_oslogin_login.so,
+ '' +
+ optionalString (config.security.pam.enableSSHAgentAuth
+ && isEnabled (cfg: cfg.sshAgentAuth)) ''
+ mr ${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.fprintAuth)) ''
+ mr ${pkgs.fprintd}/lib/security/pam_fprintd.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.u2fAuth)) ''
+ mr ${pkgs.pam_u2f}/lib/security/pam_u2f.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.usbAuth)) ''
+ mr ${pkgs.pam_usb}/lib/security/pam_usb.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.oathAuth)) ''
+ "mr ${pkgs.oathToolkit}/lib/security/pam_oath.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.yubicoAuth)) ''
+ mr ${pkgs.yubico-pam}/lib/security/pam_yubico.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.duoSecurity.enable)) ''
+ mr ${pkgs.duo-unix}/lib/security/pam_duo.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.otpwAuth)) ''
+ mr ${pkgs.otpw}/lib/security/pam_otpw.so,
+ '' +
+ optionalString config.security.pam.enableEcryptfs ''
+ mr ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.pamMount)) ''
+ mr ${pkgs.pam_mount}/lib/security/pam_mount.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.enableGnomeKeyring)) ''
+ mr ${pkgs.gnome3.gnome-keyring}/lib/security/pam_gnome_keyring.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.startSession)) ''
+ mr ${pkgs.systemd}/lib/security/pam_systemd.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.enableAppArmor)
+ && config.security.apparmor.enable) ''
+ mr ${pkgs.apparmor-pam}/lib/security/pam_apparmor.so,
+ '' +
+ optionalString (isEnabled (cfg: cfg.enableKwallet)) ''
+ mr ${pkgs.plasma5.kwallet-pam}/lib/security/pam_kwallet5.so,
+ '' +
+ optionalString config.virtualisation.lxc.lxcfs.enable ''
+ mr ${pkgs.lxc}/lib/security/pam_cgfs.so
+ '';
};
}
diff --git a/nixos/modules/security/wrappers/default.nix b/nixos/modules/security/wrappers/default.nix
index 3cbf22fea7a9..1e65f4515155 100644
--- a/nixos/modules/security/wrappers/default.nix
+++ b/nixos/modules/security/wrappers/default.nix
@@ -171,6 +171,14 @@ in
export PATH="${wrapperDir}:$PATH"
'';
+ security.apparmor.includes."nixos/security.wrappers" = ''
+ include "${pkgs.apparmorRulesFromClosure { name="security.wrappers"; } [
+ securityWrapper
+ pkgs.stdenv.cc.cc
+ pkgs.stdenv.cc.libc
+ ]}"
+ '';
+
###### setcap activation script
system.activationScripts.wrappers =
lib.stringAfter [ "specialfs" "users" ]
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix
index 1dec111b8298..34a5219c9594 100644
--- a/nixos/modules/services/torrent/transmission.nix
+++ b/nixos/modules/services/torrent/transmission.nix
@@ -5,7 +5,7 @@ with lib;
let
cfg = config.services.transmission;
inherit (config.environment) etc;
- apparmor = config.security.apparmor.enable;
+ apparmor = config.security.apparmor;
rootDir = "/run/transmission";
homeDir = "/var/lib/transmission";
settingsDir = ".config/transmission-daemon";
@@ -184,8 +184,8 @@ in
systemd.services.transmission = {
description = "Transmission BitTorrent Service";
- after = [ "network.target" ] ++ optional apparmor "apparmor.service";
- requires = optional apparmor "apparmor.service";
+ after = [ "network.target" ] ++ optional apparmor.enable "apparmor.service";
+ requires = optional apparmor.enable "apparmor.service";
wantedBy = [ "multi-user.target" ];
environment.CURL_CA_BUNDLE = etc."ssl/certs/ca-certificates.crt".source;
@@ -358,96 +358,39 @@ in
})
];
- security.apparmor.profiles = mkIf apparmor [
- (pkgs.writeText "apparmor-transmission-daemon" ''
- include
+ security.apparmor.policies."bin.transmission-daemon".profile = ''
+ include "${pkgs.transmission.apparmor}/bin.transmission-daemon"
+ '';
+ security.apparmor.includes."local/bin.transmission-daemon" = ''
+ r ${config.systemd.services.transmission.environment.CURL_CA_BUNDLE},
- ${pkgs.transmission}/bin/transmission-daemon {
- include
- include
+ owner rw ${cfg.home}/${settingsDir}/**,
+ rw ${cfg.settings.download-dir}/**,
+ ${optionalString cfg.settings.incomplete-dir-enabled ''
+ rw ${cfg.settings.incomplete-dir}/**,
+ ''}
+ ${optionalString cfg.settings.watch-dir-enabled ''
+ rw ${cfg.settings.watch-dir}/**,
+ ''}
+ profile dirs {
+ rw ${cfg.settings.download-dir}/**,
+ ${optionalString cfg.settings.incomplete-dir-enabled ''
+ rw ${cfg.settings.incomplete-dir}/**,
+ ''}
+ ${optionalString cfg.settings.watch-dir-enabled ''
+ rw ${cfg.settings.watch-dir}/**,
+ ''}
+ }
- # NOTE: https://github.com/NixOS/nixpkgs/pull/93457
- # will remove the need for these by fixing
- r ${etc."hosts".source},
- r /etc/ld-nix.so.preload,
- ${lib.optionalString (builtins.hasAttr "ld-nix.so.preload" etc) ''
- r ${etc."ld-nix.so.preload".source},
- ${concatMapStrings (p: optionalString (p != "") ("mr ${p},\n"))
- (splitString "\n" config.environment.etc."ld-nix.so.preload".text)}
- ''}
- r ${etc."ssl/certs/ca-certificates.crt".source},
- r ${pkgs.tzdata}/share/zoneinfo/**,
- r ${pkgs.stdenv.cc.libc}/share/i18n/**,
- r ${pkgs.stdenv.cc.libc}/share/locale/**,
-
- mr ${getLib pkgs.stdenv.cc.cc}/lib/*.so*,
- mr ${getLib pkgs.stdenv.cc.libc}/lib/*.so*,
- mr ${getLib pkgs.attr}/lib/libattr*.so*,
- mr ${getLib pkgs.c-ares}/lib/libcares*.so*,
- mr ${getLib pkgs.curl}/lib/libcurl*.so*,
- mr ${getLib pkgs.keyutils}/lib/libkeyutils*.so*,
- mr ${getLib pkgs.libcap}/lib/libcap*.so*,
- mr ${getLib pkgs.libevent}/lib/libevent*.so*,
- mr ${getLib pkgs.libgcrypt}/lib/libgcrypt*.so*,
- mr ${getLib pkgs.libgpgerror}/lib/libgpg-error*.so*,
- mr ${getLib pkgs.libkrb5}/lib/lib*.so*,
- mr ${getLib pkgs.libssh2}/lib/libssh2*.so*,
- mr ${getLib pkgs.lz4}/lib/liblz4*.so*,
- mr ${getLib pkgs.nghttp2}/lib/libnghttp2*.so*,
- mr ${getLib pkgs.openssl}/lib/libcrypto*.so*,
- mr ${getLib pkgs.openssl}/lib/libssl*.so*,
- mr ${getLib pkgs.systemd}/lib/libsystemd*.so*,
- mr ${getLib pkgs.util-linuxMinimal.out}/lib/libblkid.so*,
- mr ${getLib pkgs.util-linuxMinimal.out}/lib/libmount.so*,
- mr ${getLib pkgs.util-linuxMinimal.out}/lib/libuuid.so*,
- mr ${getLib pkgs.xz}/lib/liblzma*.so*,
- mr ${getLib pkgs.zlib}/lib/libz*.so*,
- mr ${getLib pkgs.brotli}/lib/libbrotli*.so*,
-
- r @{PROC}/sys/kernel/random/uuid,
- r @{PROC}/sys/vm/overcommit_memory,
- # @{pid} is not a kernel variable yet but a regexp
- #r @{PROC}/@{pid}/environ,
- r @{PROC}/@{pid}/mounts,
- rwk /tmp/tr_session_id_*,
- r /run/systemd/resolve/stub-resolv.conf,
-
- r ${pkgs.openssl.out}/etc/**,
- r ${config.systemd.services.transmission.environment.CURL_CA_BUNDLE},
- r ${pkgs.transmission}/share/transmission/**,
-
- owner rw ${cfg.home}/${settingsDir}/**,
- rw ${cfg.settings.download-dir}/**,
- ${optionalString cfg.settings.incomplete-dir-enabled ''
- rw ${cfg.settings.incomplete-dir}/**,
- ''}
- ${optionalString cfg.settings.watch-dir-enabled ''
- rw ${cfg.settings.watch-dir}/**,
- ''}
- profile dirs {
- rw ${cfg.settings.download-dir}/**,
- ${optionalString cfg.settings.incomplete-dir-enabled ''
- rw ${cfg.settings.incomplete-dir}/**,
- ''}
- ${optionalString cfg.settings.watch-dir-enabled ''
- rw ${cfg.settings.watch-dir}/**,
- ''}
- }
-
- ${optionalString (cfg.settings.script-torrent-done-enabled &&
- cfg.settings.script-torrent-done-filename != "") ''
- # Stack transmission_directories profile on top of
- # any existing profile for script-torrent-done-filename
- # FIXME: to be tested as I'm not sure it works well with NoNewPrivileges=
- # https://gitlab.com/apparmor/apparmor/-/wikis/AppArmorStacking#seccomp-and-no_new_privs
- px ${cfg.settings.script-torrent-done-filename} -> &@{dirs},
- ''}
-
- # FIXME: enable customizing using https://github.com/NixOS/nixpkgs/pull/93457
- # include
- }
- '')
- ];
+ ${optionalString (cfg.settings.script-torrent-done-enabled &&
+ cfg.settings.script-torrent-done-filename != "") ''
+ # Stack transmission_directories profile on top of
+ # any existing profile for script-torrent-done-filename
+ # FIXME: to be tested as I'm not sure it works well with NoNewPrivileges=
+ # https://gitlab.com/apparmor/apparmor/-/wikis/AppArmorStacking#seccomp-and-no_new_privs
+ px ${cfg.settings.script-torrent-done-filename} -> &@{dirs},
+ ''}
+ '';
};
meta.maintainers = with lib.maintainers; [ julm ];
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 3d1628d0783d..879f077332e3 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -1139,6 +1139,21 @@ in
} else {
ping.source = "${pkgs.iputils.out}/bin/ping";
};
+ security.apparmor.policies."bin.ping".profile = lib.mkIf config.security.apparmor.policies."bin.ping".enable (lib.mkAfter ''
+ /run/wrappers/bin/ping {
+ include
+ include
+ rpx /run/wrappers/wrappers.*/ping,
+ }
+ /run/wrappers/wrappers.*/ping {
+ include
+ include
+ r /run/wrappers/wrappers.*/ping.real,
+ mrpx ${config.security.wrappers.ping.source},
+ capability net_raw,
+ capability setpcap,
+ }
+ '');
# Set the host and domain names in the activation script. Don't
# clear it if it's not configured in the NixOS configuration,
diff --git a/nixos/modules/virtualisation/lxc.nix b/nixos/modules/virtualisation/lxc.nix
index f484d5ee59a8..0f8b22a45df0 100644
--- a/nixos/modules/virtualisation/lxc.nix
+++ b/nixos/modules/virtualisation/lxc.nix
@@ -74,9 +74,13 @@ in
systemd.tmpfiles.rules = [ "d /var/lib/lxc/rootfs 0755 root root -" ];
security.apparmor.packages = [ pkgs.lxc ];
- security.apparmor.profiles = [
- "${pkgs.lxc}/etc/apparmor.d/lxc-containers"
- "${pkgs.lxc}/etc/apparmor.d/usr.bin.lxc-start"
- ];
+ security.apparmor.policies = {
+ "bin.lxc-start".profile = ''
+ include ${pkgs.lxc}/etc/apparmor.d/usr.bin.lxc-start
+ '';
+ "lxc-containers".profile = ''
+ include ${pkgs.lxc}/etc/apparmor.d/lxc-containers
+ '';
+ };
};
}
diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix
index 96e8d68ae50e..6b6f4b6e6524 100644
--- a/nixos/modules/virtualisation/lxd.nix
+++ b/nixos/modules/virtualisation/lxd.nix
@@ -97,11 +97,17 @@ in {
# does a bunch of unrelated things.
systemd.tmpfiles.rules = [ "d /var/lib/lxc/rootfs 0755 root root -" ];
- security.apparmor.packages = [ cfg.lxcPackage ];
- security.apparmor.profiles = [
- "${cfg.lxcPackage}/etc/apparmor.d/lxc-containers"
- "${cfg.lxcPackage}/etc/apparmor.d/usr.bin.lxc-start"
- ];
+ security.apparmor = {
+ packages = [ cfg.lxcPackage ];
+ policies = {
+ "bin.lxc-start".profile = ''
+ include ${cfg.lxcPackage}/etc/apparmor.d/usr.bin.lxc-start
+ '';
+ "lxc-containers".profile = ''
+ include ${cfg.lxcPackage}/etc/apparmor.d/lxc-containers
+ '';
+ };
+ };
# TODO: remove once LXD gets proper support for cgroupsv2
# (currently most of the e.g. CPU accounting stuff doesn't work)
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 232d89052d4e..2c2ee95788db 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -27,6 +27,7 @@ in
airsonic = handleTest ./airsonic.nix {};
amazon-init-shell = handleTest ./amazon-init-shell.nix {};
ammonite = handleTest ./ammonite.nix {};
+ apparmor = handleTest ./apparmor.nix {};
atd = handleTest ./atd.nix {};
avahi = handleTest ./avahi.nix {};
avahi-with-resolved = handleTest ./avahi.nix { networkd = true; };
diff --git a/nixos/tests/apparmor.nix b/nixos/tests/apparmor.nix
new file mode 100644
index 000000000000..c6daa8e67de3
--- /dev/null
+++ b/nixos/tests/apparmor.nix
@@ -0,0 +1,82 @@
+import ./make-test-python.nix ({ pkgs, ... } : {
+ name = "apparmor";
+ meta = with pkgs.lib.maintainers; {
+ maintainers = [ julm ];
+ };
+
+ machine =
+ { lib, pkgs, config, ... }:
+ with lib;
+ {
+ security.apparmor.enable = mkDefault true;
+ };
+
+ testScript =
+ ''
+ machine.wait_for_unit("multi-user.target")
+
+ with subtest("AppArmor profiles are loaded"):
+ machine.succeed("systemctl status apparmor.service")
+
+ # AppArmor securityfs
+ with subtest("AppArmor securityfs is mounted"):
+ machine.succeed("mountpoint -q /sys/kernel/security")
+ machine.succeed("cat /sys/kernel/security/apparmor/profiles")
+
+ # Test apparmorRulesFromClosure by:
+ # 1. Prepending a string of the relevant packages' name and version on each line.
+ # 2. Sorting according to those strings.
+ # 3. Removing those prepended strings.
+ # 4. Using `diff` against the expected output.
+ with subtest("apparmorRulesFromClosure"):
+ machine.succeed(
+ "${pkgs.diffutils}/bin/diff ${pkgs.writeText "expected.rules" ''
+ mr ${pkgs.bash}/lib/**.so*,
+ r ${pkgs.bash},
+ r ${pkgs.bash}/etc/**,
+ r ${pkgs.bash}/lib/**,
+ r ${pkgs.bash}/share/**,
+ x ${pkgs.bash}/foo/**,
+ mr ${pkgs.glibc}/lib/**.so*,
+ r ${pkgs.glibc},
+ r ${pkgs.glibc}/etc/**,
+ r ${pkgs.glibc}/lib/**,
+ r ${pkgs.glibc}/share/**,
+ x ${pkgs.glibc}/foo/**,
+ mr ${pkgs.libcap}/lib/**.so*,
+ r ${pkgs.libcap},
+ r ${pkgs.libcap}/etc/**,
+ r ${pkgs.libcap}/lib/**,
+ r ${pkgs.libcap}/share/**,
+ x ${pkgs.libcap}/foo/**,
+ mr ${pkgs.libcap.lib}/lib/**.so*,
+ r ${pkgs.libcap.lib},
+ r ${pkgs.libcap.lib}/etc/**,
+ r ${pkgs.libcap.lib}/lib/**,
+ r ${pkgs.libcap.lib}/share/**,
+ x ${pkgs.libcap.lib}/foo/**,
+ mr ${pkgs.libidn2.out}/lib/**.so*,
+ r ${pkgs.libidn2.out},
+ r ${pkgs.libidn2.out}/etc/**,
+ r ${pkgs.libidn2.out}/lib/**,
+ r ${pkgs.libidn2.out}/share/**,
+ x ${pkgs.libidn2.out}/foo/**,
+ mr ${pkgs.libunistring}/lib/**.so*,
+ r ${pkgs.libunistring},
+ r ${pkgs.libunistring}/etc/**,
+ r ${pkgs.libunistring}/lib/**,
+ r ${pkgs.libunistring}/share/**,
+ x ${pkgs.libunistring}/foo/**,
+ ''} ${pkgs.runCommand "actual.rules" { preferLocalBuild = true; } ''
+ ${pkgs.gnused}/bin/sed -e 's:^[^ ]* ${builtins.storeDir}/[^,/-]*-\([^/,]*\):\1 \0:' ${
+ pkgs.apparmorRulesFromClosure {
+ name = "ping";
+ additionalRules = ["x $path/foo/**"];
+ } [ pkgs.libcap ]
+ } |
+ ${pkgs.coreutils}/bin/sort -n -k1 |
+ ${pkgs.gnused}/bin/sed -e 's:^[^ ]* ::' >$out
+ ''}"
+ )
+ '';
+})
diff --git a/nixos/tests/keymap.nix b/nixos/tests/keymap.nix
index 09d5d2a6c9e1..a18a05f90c6d 100644
--- a/nixos/tests/keymap.nix
+++ b/nixos/tests/keymap.nix
@@ -107,17 +107,32 @@ in pkgs.lib.mapAttrs mkKeyboardTest {
altgr.expect = [ "~" "#" "{" "[" "|" ];
};
- extraConfig.console.keyMap = "azerty/fr";
+ extraConfig.console.keyMap = "fr";
extraConfig.services.xserver.layout = "fr";
};
+ bone = {
+ tests = {
+ layer1.qwerty = [ "f" "j" ];
+ layer1.expect = [ "e" "n" ];
+ layer2.qwerty = [ "shift-f" "shift-j" "shift-6" ];
+ layer2.expect = [ "E" "N" "$" ];
+ layer3.qwerty = [ "caps_lock-d" "caps_lock-f" ];
+ layer3.expect = [ "{" "}" ];
+ };
+
+ extraConfig.console.keyMap = "bone";
+ extraConfig.services.xserver.layout = "de";
+ extraConfig.services.xserver.xkbVariant = "bone";
+ };
+
colemak = {
tests = {
homerow.qwerty = [ "a" "s" "d" "f" "j" "k" "l" "semicolon" ];
homerow.expect = [ "a" "r" "s" "t" "n" "e" "i" "o" ];
};
- extraConfig.console.keyMap = "colemak/colemak";
+ extraConfig.console.keyMap = "colemak";
extraConfig.services.xserver.layout = "us";
extraConfig.services.xserver.xkbVariant = "colemak";
};
@@ -129,9 +144,13 @@ in pkgs.lib.mapAttrs mkKeyboardTest {
symbols.qwerty = [ "q" "w" "e" "minus" "equal" ];
symbols.expect = [ "'" "," "." "[" "]" ];
};
+
+ extraConfig.console.keyMap = "dvorak";
+ extraConfig.services.xserver.layout = "us";
+ extraConfig.services.xserver.xkbVariant = "dvorak";
};
- dvp = {
+ dvorak-programmer = {
tests = {
homerow.qwerty = [ "a" "s" "d" "f" "j" "k" "l" "semicolon" ];
homerow.expect = [ "a" "o" "e" "u" "h" "t" "n" "s" ];
@@ -142,6 +161,7 @@ in pkgs.lib.mapAttrs mkKeyboardTest {
symbols.expect = [ "&" "[" "{" "}" "(" "=" "*" ")" "+" "]" "!" ];
};
+ extraConfig.console.keyMap = "dvorak-programmer";
extraConfig.services.xserver.layout = "us";
extraConfig.services.xserver.xkbVariant = "dvp";
};
@@ -156,6 +176,7 @@ in pkgs.lib.mapAttrs mkKeyboardTest {
layer3.expect = [ "{" "}" ];
};
+ extraConfig.console.keyMap = "neo";
extraConfig.services.xserver.layout = "de";
extraConfig.services.xserver.xkbVariant = "neo";
};
diff --git a/nixos/tests/minecraft-server.nix b/nixos/tests/minecraft-server.nix
index e6e0bca972a9..dbe2cd6d56fe 100644
--- a/nixos/tests/minecraft-server.nix
+++ b/nixos/tests/minecraft-server.nix
@@ -24,7 +24,7 @@ in import ./make-test-python.nix ({ pkgs, ... }: {
};
};
- virtualisation.memorySize = 2048;
+ virtualisation.memorySize = 2047;
};
testScript = ''
diff --git a/pkgs/applications/accessibility/dasher/default.nix b/pkgs/applications/accessibility/dasher/default.nix
index fe0d8fe86346..328ff2c5c570 100644
--- a/pkgs/applications/accessibility/dasher/default.nix
+++ b/pkgs/applications/accessibility/dasher/default.nix
@@ -1,22 +1,33 @@
-{ stdenv, lib, fetchFromGitHub
-, autoreconfHook, pkg-config, wrapGAppsHook
-, glib, gtk3, expat, gnome-doc-utils, which
-, at-spi2-core, dbus
-, libxslt, libxml2
-, speechSupport ? true, speechd ? null
+{ stdenv
+, lib
+, fetchFromGitLab
+, autoreconfHook
+, pkg-config
+, wrapGAppsHook
+, glib
+, gtk3
+, expat
+, itstool
+, gnome-doc-utils
+, which
+, at-spi2-core
+, dbus
+, libxslt
+, libxml2
+, speechSupport ? true
+, speechd
}:
-assert speechSupport -> speechd != null;
-
stdenv.mkDerivation {
pname = "dasher";
- version = "2018-04-03";
+ version = "unstable-2021-04-25";
- src = fetchFromGitHub {
- owner = "dasher-project";
+ src = fetchFromGitLab {
+ domain = "gitlab.gnome.org";
+ owner = "GNOME";
repo = "dasher";
- rev = "9ab12462e51d17a38c0ddc7f7ffe1cb5fe83b627";
- sha256 = "1r9xn966nx3pv2bidd6i3pxmprvlw6insnsb38zabmac609h9d9s";
+ rev = "90c753b87564fa3f42cb2d04e1eb6662dc8e0f8f";
+ sha256 = "sha256-aM05CV68pCRlhfIPyhuHWeRL+tDroB3fVsoX08OU8hY=";
};
prePatch = ''
@@ -33,23 +44,27 @@ stdenv.mkDerivation {
# doc generation
gnome-doc-utils
which
- libxslt libxml2
+ libxslt
+ libxml2
];
buildInputs = [
glib
gtk3
expat
+ itstool
# at-spi2 needs dbus to be recognized by pkg-config
- at-spi2-core dbus
+ at-spi2-core
+ dbus
] ++ lib.optional speechSupport speechd;
+ enableParallelBuilding = true;
+
meta = {
- homepage = "http://www.inference.org.uk/dasher/";
+ homepage = "https://www.inference.org.uk/dasher/";
description = "Information-efficient text-entry interface, driven by natural continuous pointing gestures";
- license = lib.licenses.gpl2;
+ license = lib.licenses.gpl2Only;
maintainers = [ lib.maintainers.Profpatsch ];
platforms = lib.platforms.all;
};
-
}
diff --git a/pkgs/applications/blockchains/electrs.nix b/pkgs/applications/blockchains/electrs.nix
index 30742f8d7199..af0346196a32 100644
--- a/pkgs/applications/blockchains/electrs.nix
+++ b/pkgs/applications/blockchains/electrs.nix
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
# needed for librocksdb-sys
nativeBuildInputs = [ llvmPackages.clang ];
- LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
cargoSha256 = "1rqpadlr9r4z2z825li6vi5a21hivc3bsn5ibxshrdrwiycyyxz8";
diff --git a/pkgs/applications/blockchains/polkadot/default.nix b/pkgs/applications/blockchains/polkadot/default.nix
index 63ae8042da43..29e7767a0c8e 100644
--- a/pkgs/applications/blockchains/polkadot/default.nix
+++ b/pkgs/applications/blockchains/polkadot/default.nix
@@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [ clang ];
- LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
PROTOC = "${protobuf}/bin/protoc";
# NOTE: We don't build the WASM runtimes since this would require a more
diff --git a/pkgs/applications/editors/emacs/generic.nix b/pkgs/applications/editors/emacs/generic.nix
index 13062ae92613..ad044d3968e8 100644
--- a/pkgs/applications/editors/emacs/generic.nix
+++ b/pkgs/applications/editors/emacs/generic.nix
@@ -7,7 +7,7 @@
, patches ? [ ]
}:
{ stdenv, lib, fetchurl, fetchpatch, ncurses, xlibsWrapper, libXaw, libXpm
-, Xaw3d, libXcursor, pkg-config, gettext, libXft, dbus, libpng, libjpeg, libungif
+, Xaw3d, libXcursor, pkg-config, gettext, libXft, dbus, libpng, libjpeg, giflib
, libtiff, librsvg, gconf, libxml2, imagemagick, gnutls, libselinux
, alsaLib, cairo, acl, gpm, AppKit, GSS, ImageIO, m17n_lib, libotf
, jansson, harfbuzz
@@ -108,7 +108,7 @@ let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp {
[ ncurses gconf libxml2 gnutls alsaLib acl gpm gettext jansson harfbuzz.dev ]
++ lib.optionals stdenv.isLinux [ dbus libselinux systemd ]
++ lib.optionals withX
- [ xlibsWrapper libXaw Xaw3d libXpm libpng libjpeg libungif libtiff libXft
+ [ xlibsWrapper libXaw Xaw3d libXpm libpng libjpeg giflib libtiff libXft
gconf cairo ]
++ lib.optionals (withX || withNS) [ librsvg ]
++ lib.optionals withImageMagick [ imagemagick ]
diff --git a/pkgs/applications/editors/jove/default.nix b/pkgs/applications/editors/jove/default.nix
index 0b60b9474bd6..c2625271665f 100644
--- a/pkgs/applications/editors/jove/default.nix
+++ b/pkgs/applications/editors/jove/default.nix
@@ -6,13 +6,13 @@
stdenv.mkDerivation rec {
pname = "jove";
- version = "4.17.3.6";
+ version = "4.17.3.7";
src = fetchFromGitHub {
owner = "jonmacs";
repo = "jove";
rev = version;
- sha256 = "sha256-uQRNKV06ipOHrOsvsceqIFGGlRv5qOQy18q0tFkR6Kg=";
+ sha256 = "sha256-fD87FIWZlfJE2tVX+0QaiGGqu+tJFHheXe1guJR/Hxg=";
};
nativeBuildInputs = [ makeWrapper ];
diff --git a/pkgs/applications/editors/jucipp/default.nix b/pkgs/applications/editors/jucipp/default.nix
index 7304219e2369..140bf04c9f36 100644
--- a/pkgs/applications/editors/jucipp/default.nix
+++ b/pkgs/applications/editors/jucipp/default.nix
@@ -56,8 +56,8 @@ stdenv.mkDerivation rec {
e = "\");";
v = lib.getVersion llvmPackages.clang;
in
- p+llvmPackages.libcxx+"/include/c++/v1"+e
- +p+llvmPackages.clang-unwrapped+"/lib/clang/"+v+"/include/"+e
+ p+llvmPackages.libcxx.dev+"/include/c++/v1"+e
+ +p+llvmPackages.clang-unwrapped.lib+"/lib/clang/"+v+"/include/"+e
+p+glibc.dev+"/include"+e;
preConfigure = ''
diff --git a/pkgs/applications/editors/kdevelop5/kdevelop.nix b/pkgs/applications/editors/kdevelop5/kdevelop.nix
index b54015de7b8f..8894707643ad 100644
--- a/pkgs/applications/editors/kdevelop5/kdevelop.nix
+++ b/pkgs/applications/editors/kdevelop5/kdevelop.nix
@@ -23,7 +23,7 @@ mkDerivation rec {
buildInputs = [
kdevelop-pg-qt
- llvmPackages.llvm llvmPackages.clang-unwrapped
+ llvmPackages.llvm llvmPackages.libclang
];
propagatedBuildInputs = [
@@ -37,7 +37,7 @@ mkDerivation rec {
# https://cgit.kde.org/kdevelop.git/commit/?id=716372ae2e8dff9c51e94d33443536786e4bd85b
# required as nixos seems to be unable to find CLANG_BUILTIN_DIR
cmakeFlags = [
- "-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${lib.getVersion llvmPackages.clang}/include"
+ "-DCLANG_BUILTIN_DIR=${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion llvmPackages.clang}/include"
];
dontWrapQtApps = true;
diff --git a/pkgs/applications/editors/rstudio/clang-location.patch b/pkgs/applications/editors/rstudio/clang-location.patch
index 402abdd85636..700ed754d2bb 100644
--- a/pkgs/applications/editors/rstudio/clang-location.patch
+++ b/pkgs/applications/editors/rstudio/clang-location.patch
@@ -7,7 +7,7 @@ index ec12a3a1ff..8c81b633ae 100644
// we need to add in the associated libclang headers as
// they are not discovered / used by default during compilation
- FilePath llvmPath = s_libraryPath.parent().parent();
-+ FilePath llvmPath("@clang@");
++ FilePath llvmPath("@libclang@");
boost::format fmt("%1%/lib/clang/%2%/include");
fmt % llvmPath.absolutePath() % version.asString();
std::string includePath = fmt.str();
diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix
index 00d0259a7a9b..76d9c2e594b2 100644
--- a/pkgs/applications/editors/rstudio/default.nix
+++ b/pkgs/applications/editors/rstudio/default.nix
@@ -42,8 +42,8 @@ mkDerivation rec {
postPatch = ''
substituteInPlace src/cpp/core/r_util/REnvironmentPosix.cpp --replace '@R@' ${R}
substituteInPlace src/cpp/core/libclang/LibClang.cpp \
- --replace '@clang@' ${llvmPackages.clang.cc} \
- --replace '@libclang.so@' ${llvmPackages.clang.cc.lib}/lib/libclang.so
+ --replace '@libclang@' ${llvmPackages.libclang.lib} \
+ --replace '@libclang.so@' ${llvmPackages.libclang.lib}/lib/libclang.so
'';
ginSrc = fetchurl {
diff --git a/pkgs/applications/gis/qgis/unwrapped.nix b/pkgs/applications/gis/qgis/unwrapped.nix
index a8dd7787a521..3669cf0771b1 100644
--- a/pkgs/applications/gis/qgis/unwrapped.nix
+++ b/pkgs/applications/gis/qgis/unwrapped.nix
@@ -19,7 +19,7 @@ let
urllib3
pygments
pyqt5
- sip
+ sip_4
owslib
six
];
diff --git a/pkgs/applications/graphics/ImageMagick/7.0.nix b/pkgs/applications/graphics/ImageMagick/7.0.nix
index 01cbddcc2839..c4e1f3406f6d 100644
--- a/pkgs/applications/graphics/ImageMagick/7.0.nix
+++ b/pkgs/applications/graphics/ImageMagick/7.0.nix
@@ -18,13 +18,13 @@ in
stdenv.mkDerivation rec {
pname = "imagemagick";
- version = "7.0.11-8";
+ version = "7.0.11-9";
src = fetchFromGitHub {
owner = "ImageMagick";
repo = "ImageMagick";
rev = version;
- sha256 = "sha256-h9hoFXnxuLVQRVtEh83P7efz2KFLLqOXKD6nVJEhqiM=";
+ sha256 = "sha256-eL9zFrgkLb3pS8/UlQB5+p50UG8j3Q7TNDwcO/3BuXo=";
};
outputs = [ "out" "dev" "doc" ]; # bin/ isn't really big
diff --git a/pkgs/applications/graphics/fbida/default.nix b/pkgs/applications/graphics/fbida/default.nix
index 9ed6ee75159e..f2d2e267595c 100644
--- a/pkgs/applications/graphics/fbida/default.nix
+++ b/pkgs/applications/graphics/fbida/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, libjpeg, libexif, libungif, libtiff, libpng, libwebp, libdrm
+{ lib, stdenv, fetchurl, libjpeg, libexif, giflib, libtiff, libpng, libwebp, libdrm
, pkg-config, freetype, fontconfig, which, imagemagick, curl, sane-backends, libXpm
, epoxy, poppler, mesa, lirc }:
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config which ];
buildInputs = [
- libexif libjpeg libpng libungif freetype fontconfig libtiff libwebp
+ libexif libjpeg libpng giflib freetype fontconfig libtiff libwebp
imagemagick curl sane-backends libdrm libXpm epoxy poppler lirc
mesa
];
diff --git a/pkgs/applications/graphics/jpeg-archive/default.nix b/pkgs/applications/graphics/jpeg-archive/default.nix
index cac930dae143..b974e271a675 100644
--- a/pkgs/applications/graphics/jpeg-archive/default.nix
+++ b/pkgs/applications/graphics/jpeg-archive/default.nix
@@ -22,9 +22,10 @@ stdenv.mkDerivation {
'';
makeFlags = [
+ "CC=${stdenv.cc.targetPrefix}cc"
"PREFIX=$(out)"
"MOZJPEG_PREFIX=${mozjpeg}"
- "LIBJPEG=${mozjpeg}/lib/libjpeg.so"
+ "LIBJPEG=${mozjpeg}/lib/libjpeg${stdenv.hostPlatform.extensions.sharedLibrary}"
];
postInstall = ''
diff --git a/pkgs/applications/graphics/krita/default.nix b/pkgs/applications/graphics/krita/default.nix
index 282db23f4756..15d8096e5496 100644
--- a/pkgs/applications/graphics/krita/default.nix
+++ b/pkgs/applications/graphics/krita/default.nix
@@ -17,7 +17,7 @@ mkDerivation rec {
sha256 = "0rwghzci2wn2jmisvnzs23yxc2z3d4dcx2qbbhcvjyi3q8ij61nl";
};
- nativeBuildInputs = [ cmake extra-cmake-modules python3Packages.sip makeWrapper ];
+ nativeBuildInputs = [ cmake extra-cmake-modules python3Packages.sip_4 makeWrapper ];
buildInputs = [
karchive kconfig kwidgetsaddons kcompletion kcoreaddons kguiaddons
diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix
index 95a0e41d2ae4..8d345cdefe0e 100644
--- a/pkgs/applications/misc/blender/default.nix
+++ b/pkgs/applications/misc/blender/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
patches = lib.optional stdenv.isDarwin ./darwin.patch;
- nativeBuildInputs = [ cmake makeWrapper python3Packages.wrapPython ]
+ nativeBuildInputs = [ cmake makeWrapper python3Packages.wrapPython llvmPackages.llvm.dev ]
++ optionals cudaSupport [ addOpenGLRunpath ];
buildInputs =
[ boost ffmpeg gettext glew ilmbase
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix
index aff203cce618..f5c4acb1f997 100644
--- a/pkgs/applications/misc/calibre/default.nix
+++ b/pkgs/applications/misc/calibre/default.nix
@@ -45,7 +45,7 @@ mkDerivation rec {
prePatch = ''
sed -i "s/\[tool.sip.project\]/[tool.sip.project]\nsip-include-dirs = [\"${escaped_pyqt5_dir}\/share\/sip\/PyQt5\"]/g" \
setup/build.py
- sed -i "s/\[tool.sip.bindings.pictureflow\]/[tool.sip.bindings.pictureflow]\ntags = [\"${python3Packages.sip_5.platform_tag}\"]/g" \
+ sed -i "s/\[tool.sip.bindings.pictureflow\]/[tool.sip.bindings.pictureflow]\ntags = [\"${python3Packages.sip.platform_tag}\"]/g" \
setup/build.py
# Remove unneeded files and libs
@@ -95,7 +95,7 @@ mkDerivation rec {
pyqtwebengine
python
regex
- sip_5
+ sip
zeroconf
# the following are distributed with calibre, but we use upstream instead
odfpy
diff --git a/pkgs/applications/misc/clipcat/default.nix b/pkgs/applications/misc/clipcat/default.nix
index 497e5616e805..95f50998f3ff 100644
--- a/pkgs/applications/misc/clipcat/default.nix
+++ b/pkgs/applications/misc/clipcat/default.nix
@@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "1ffgvhkdj8wkhlgi0cj0njdm9ycxq2qda4b5qn8bmaygzr2zkwpd";
- LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
# needed for internal protobuf c wrapper library
PROTOC = "${protobuf}/bin/protoc";
diff --git a/pkgs/applications/misc/cointop/default.nix b/pkgs/applications/misc/cointop/default.nix
index d62d96e530e8..66d73c94b460 100644
--- a/pkgs/applications/misc/cointop/default.nix
+++ b/pkgs/applications/misc/cointop/default.nix
@@ -2,13 +2,13 @@
buildGoPackage rec {
pname = "cointop";
- version = "1.6.3";
+ version = "1.6.5";
src = fetchFromGitHub {
owner = "miguelmota";
repo = pname;
rev = "v${version}";
- sha256 = "sha256-h4102oWYSuY4uq/Pyo9u25Pdsai7AK2W9yUmS/zdjrw=";
+ sha256 = "sha256-pnh4z7vk8xazdBPNbwR5BrKFbi8df8UTM2SOU+KDvsk=";
};
goPackagePath = "github.com/miguelmota/cointop";
diff --git a/pkgs/applications/misc/corectrl/default.nix b/pkgs/applications/misc/corectrl/default.nix
index 5245d559d447..32ca4b0e06c4 100644
--- a/pkgs/applications/misc/corectrl/default.nix
+++ b/pkgs/applications/misc/corectrl/default.nix
@@ -5,6 +5,7 @@
, karchive
, kauth
, libdrm
+, hwdata
, mesa-demos
, procps
, util-linux
@@ -20,13 +21,13 @@
stdenv.mkDerivation rec{
pname = "corectrl";
- version = "1.1.2";
+ version = "1.1.3";
src = fetchFromGitLab {
owner = "corectrl";
repo = "corectrl";
rev = "v${version}";
- sha256 = "sha256-hKYZkKQOvNu2qDSOq1cjoiLwwOvEqdJfqGG5p3Vhkhs=";
+ sha256 = "sha256-xRyc7FYzG8MnhQ8DjIUHYLeUZCZQdi4j1v1fG7F0+G8=";
};
nativeBuildInputs = [
@@ -50,7 +51,9 @@ stdenv.mkDerivation rec{
qtxmlpatterns
];
- runtimeDeps = [ mesa-demos vulkan-tools ];
+ cmakeFlags = [ "-DWITH_PCI_IDS_PATH=${hwdata}/share/hwdata/pci.ids" ];
+
+ runtimeDeps = [ hwdata mesa-demos vulkan-tools ];
binPath = lib.makeBinPath runtimeDeps;
dontWrapQtApps = true;
diff --git a/pkgs/applications/misc/cura/lulzbot/default.nix b/pkgs/applications/misc/cura/lulzbot/default.nix
index 229966561c6d..360ef47ecf1d 100644
--- a/pkgs/applications/misc/cura/lulzbot/default.nix
+++ b/pkgs/applications/misc/cura/lulzbot/default.nix
@@ -10,10 +10,10 @@ let
};
libarcusLulzbot = callPackage ./libarcus.nix {
- inherit (python3.pkgs) buildPythonPackage sip pythonOlder;
+ inherit (python3.pkgs) buildPythonPackage sip_4 pythonOlder;
};
libsavitarLulzbot = callPackage ./libsavitar.nix {
- inherit (python3.pkgs) buildPythonPackage sip pythonOlder;
+ inherit (python3.pkgs) buildPythonPackage sip_4 pythonOlder;
};
inherit (python3.pkgs) buildPythonPackage pyqt5 numpy scipy shapely pythonOlder;
diff --git a/pkgs/applications/misc/cura/lulzbot/libarcus.nix b/pkgs/applications/misc/cura/lulzbot/libarcus.nix
index 7b1dbf4d85ef..15e221a8f743 100644
--- a/pkgs/applications/misc/cura/lulzbot/libarcus.nix
+++ b/pkgs/applications/misc/cura/lulzbot/libarcus.nix
@@ -1,4 +1,4 @@
-{ lib, buildPythonPackage, fetchgit, fetchurl, cmake, sip, protobuf, pythonOlder }:
+{ lib, buildPythonPackage, fetchgit, fetchurl, cmake, sip_4, protobuf, pythonOlder }:
buildPythonPackage {
pname = "libarcus";
@@ -13,7 +13,7 @@ buildPythonPackage {
disabled = pythonOlder "3.4.0";
- propagatedBuildInputs = [ sip ];
+ propagatedBuildInputs = [ sip_4 ];
nativeBuildInputs = [ cmake ];
buildInputs = [ protobuf ];
diff --git a/pkgs/applications/misc/cura/lulzbot/libsavitar.nix b/pkgs/applications/misc/cura/lulzbot/libsavitar.nix
index f12059e6317b..dd84173ffce1 100644
--- a/pkgs/applications/misc/cura/lulzbot/libsavitar.nix
+++ b/pkgs/applications/misc/cura/lulzbot/libsavitar.nix
@@ -1,4 +1,4 @@
-{ lib, buildPythonPackage, pythonOlder, fetchgit, cmake, sip }:
+{ lib, buildPythonPackage, pythonOlder, fetchgit, cmake, sip_4 }:
buildPythonPackage {
pname = "libsavitar-lulzbot";
@@ -19,7 +19,7 @@ buildPythonPackage {
nativeBuildInputs = [ cmake ];
- propagatedBuildInputs = [ sip ];
+ propagatedBuildInputs = [ sip_4 ];
disabled = pythonOlder "3.4.0";
diff --git a/pkgs/applications/misc/imag/default.nix b/pkgs/applications/misc/imag/default.nix
index 09f734df9a11..5c1e87612e1b 100644
--- a/pkgs/applications/misc/imag/default.nix
+++ b/pkgs/applications/misc/imag/default.nix
@@ -26,7 +26,7 @@ rustPlatform.buildRustPackage rec {
++ lib.optional stdenv.isDarwin Security;
checkInputs = [ gitMinimal util-linuxMinimal ];
- LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
cargoSha256 = "0n8cw70qh8g4hfwfaxwwxbrrx5hm2z037z8kdhvdpqkxljl9189x";
diff --git a/pkgs/applications/misc/openlp/lib.nix b/pkgs/applications/misc/openlp/lib.nix
index 6f0634b5c934..c044e76c597d 100644
--- a/pkgs/applications/misc/openlp/lib.nix
+++ b/pkgs/applications/misc/openlp/lib.nix
@@ -5,7 +5,7 @@
# python deps
, python, buildPythonPackage
, alembic, beautifulsoup4, chardet, lxml, Mako, pyenchant
-, pyqt5_with_qtwebkit, pyxdg, sip, sqlalchemy, sqlalchemy_migrate
+, pyqt5_with_qtwebkit, pyxdg, sip_4, sqlalchemy, sqlalchemy_migrate
}:
buildPythonPackage rec {
@@ -41,7 +41,7 @@ buildPythonPackage rec {
pyenchant
pyqt5_with_qtwebkit
pyxdg
- sip
+ sip_4
sqlalchemy
sqlalchemy_migrate
];
diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix
index 24195e578bd0..487232493230 100644
--- a/pkgs/applications/networking/browsers/firefox/common.nix
+++ b/pkgs/applications/networking/browsers/firefox/common.nix
@@ -248,8 +248,8 @@ buildStdenv.mkDerivation ({
$(< ${buildStdenv.cc}/nix-support/libc-cflags) \
$(< ${buildStdenv.cc}/nix-support/cc-cflags) \
$(< ${buildStdenv.cc}/nix-support/libcxx-cxxflags) \
- ${lib.optionalString buildStdenv.cc.isClang "-idirafter ${buildStdenv.cc.cc}/lib/clang/${lib.getVersion buildStdenv.cc.cc}/include"} \
- ${lib.optionalString buildStdenv.cc.isGNU "-isystem ${buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc} -isystem ${buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc}/${buildStdenv.hostPlatform.config}"} \
+ ${lib.optionalString buildStdenv.cc.isClang "-idirafter ${buildStdenv.cc.cc.lib}/lib/clang/${lib.getVersion buildStdenv.cc.cc}/include"} \
+ ${lib.optionalString buildStdenv.cc.isGNU "-isystem ${lib.getDev buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc} -isystem ${buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc}/${buildStdenv.hostPlatform.config}"} \
$NIX_CFLAGS_COMPILE"
echo "ac_add_options BINDGEN_CFLAGS='$BINDGEN_CFLAGS'" >> $MOZCONFIG
@@ -282,7 +282,7 @@ buildStdenv.mkDerivation ({
"--disable-updater"
"--enable-jemalloc"
"--enable-default-toolkit=${default-toolkit}"
- "--with-libclang-path=${llvmPackages.libclang}/lib"
+ "--with-libclang-path=${llvmPackages.libclang.lib}/lib"
"--with-system-nspr"
"--with-system-nss"
]
diff --git a/pkgs/applications/networking/cluster/k9s/default.nix b/pkgs/applications/networking/cluster/k9s/default.nix
index ee16f923b788..8d515528a026 100644
--- a/pkgs/applications/networking/cluster/k9s/default.nix
+++ b/pkgs/applications/networking/cluster/k9s/default.nix
@@ -2,13 +2,13 @@
buildGoModule rec {
pname = "k9s";
- version = "0.24.6";
+ version = "0.24.8";
src = fetchFromGitHub {
owner = "derailed";
repo = "k9s";
rev = "v${version}";
- sha256 = "sha256-uqtjAvtsF+4cz3M60Xj9sCNotaoPzaeeTKnXQUB4CIo=";
+ sha256 = "sha256-6RGm2uiYvsdpWdhNwDTw4z1O6uNErkWTuyOiwKIvXOY=";
};
buildFlagsArray = ''
@@ -18,7 +18,7 @@ buildGoModule rec {
-X github.com/derailed/k9s/cmd.commit=${src.rev}
'';
- vendorSha256 = "sha256-/4Aof09MYHPc4VJJV2EyB7T9zNFtYY4JeDGJi67FQic=";
+ vendorSha256 = "sha256-lzxGTubm+qQes5QKaamfmSkXs4qquHHjIhts8YmKlYI=";
doCheck = false;
diff --git a/pkgs/applications/networking/cluster/kube3d/default.nix b/pkgs/applications/networking/cluster/kube3d/default.nix
index decb586045d7..1265448fc61d 100644
--- a/pkgs/applications/networking/cluster/kube3d/default.nix
+++ b/pkgs/applications/networking/cluster/kube3d/default.nix
@@ -2,13 +2,13 @@
buildGoModule rec {
pname = "kube3d";
- version = "4.4.2";
+ version = "4.4.3";
src = fetchFromGitHub {
owner = "rancher";
repo = "k3d";
rev = "v${version}";
- sha256 = "sha256-6BDetNPWyAVZOsnCWs90HljVpfUlAytFDPQ/SqPxwgg=";
+ sha256 = "sha256-G8oaJtfsbSi5WaJobxUpNu9DchHfzbkpPvq23GYM99s=";
};
vendorSha256 = null;
diff --git a/pkgs/applications/networking/gns3/gui.nix b/pkgs/applications/networking/gns3/gui.nix
index f206c645ae21..5f5594c05374 100644
--- a/pkgs/applications/networking/gns3/gui.nix
+++ b/pkgs/applications/networking/gns3/gui.nix
@@ -24,7 +24,7 @@ in python.pkgs.buildPythonPackage rec {
propagatedBuildInputs = with python.pkgs; [
sentry-sdk psutil jsonschema # tox for check
# Runtime dependencies
- sip (pyqt5.override { withWebSockets = true; }) distro setuptools
+ sip_4 (pyqt5.override { withWebSockets = true; }) distro setuptools
];
doCheck = false; # Failing
diff --git a/pkgs/applications/networking/mailreaders/thunderbird-bin/68.nix b/pkgs/applications/networking/mailreaders/thunderbird-bin/68.nix
deleted file mode 100644
index 83e8984db7bd..000000000000
--- a/pkgs/applications/networking/mailreaders/thunderbird-bin/68.nix
+++ /dev/null
@@ -1,184 +0,0 @@
-# This pakcage is keeped until Thunderbird 78 supports OpenPGP.
-# https://www.thunderbird.net/en-US/thunderbird/78.0.1/releasenotes/
-{ lib, stdenv, fetchurl, config, makeWrapper
-, alsaLib
-, at-spi2-atk
-, atk
-, cairo
-, cups
-, curl
-, dbus-glib
-, dbus
-, fontconfig
-, freetype
-, gdk-pixbuf
-, glib
-, glibc
-, gtk2
-, gtk3
-, libkrb5
-, libX11
-, libXScrnSaver
-, libXcomposite
-, libXcursor
-, libXdamage
-, libXext
-, libXfixes
-, libXi
-, libXinerama
-, libXrender
-, libXt
-, libxcb
-, libcanberra
-, gnome
-, libGLU, libGL
-, nspr
-, nss
-, pango
-, writeScript
-, xidel
-, coreutils
-, gnused
-, gnugrep
-, gnupg
-, runtimeShell
-}:
-
-# imports `version` and `sources`
-with (import ./68_sources.nix);
-
-let
- arch = if stdenv.hostPlatform.system == "i686-linux"
- then "linux-i686"
- else "linux-x86_64";
-
- isPrefixOf = prefix: string:
- builtins.substring 0 (builtins.stringLength prefix) string == prefix;
-
- sourceMatches = locale: source:
- (isPrefixOf source.locale locale) && source.arch == arch;
-
- systemLocale = config.i18n.defaultLocale or "en-US";
-
- defaultSource = lib.findFirst (sourceMatches "en-US") {} sources;
-
- source = lib.findFirst (sourceMatches systemLocale) defaultSource sources;
-
- name = "thunderbird-bin-${version}";
-in
-
-stdenv.mkDerivation {
- inherit name;
-
- src = fetchurl {
- url = "https://download-installer.cdn.mozilla.net/pub/thunderbird/releases/${version}/${source.arch}/${source.locale}/thunderbird-${version}.tar.bz2";
- inherit (source) sha256;
- };
-
- phases = "unpackPhase installPhase";
-
- libPath = lib.makeLibraryPath
- [ stdenv.cc.cc
- alsaLib
- at-spi2-atk
- atk
- cairo
- cups
- curl
- dbus-glib
- dbus
- fontconfig
- freetype
- gdk-pixbuf
- glib
- glibc
- gtk2
- gtk3
- libkrb5
- libX11
- libXScrnSaver
- libXcomposite
- libXcursor
- libXdamage
- libXext
- libXfixes
- libXi
- libXinerama
- libXrender
- libXt
- libxcb
- libcanberra
- libGLU libGL
- nspr
- nss
- pango
- ] + ":" + lib.makeSearchPathOutput "lib" "lib64" [
- stdenv.cc.cc
- ];
-
- buildInputs = [ gtk3 gnome.adwaita-icon-theme ];
-
- nativeBuildInputs = [ makeWrapper ];
-
- installPhase =
- ''
- mkdir -p "$prefix/usr/lib/thunderbird-bin-${version}"
- cp -r * "$prefix/usr/lib/thunderbird-bin-${version}"
-
- mkdir -p "$out/bin"
- ln -s "$prefix/usr/lib/thunderbird-bin-${version}/thunderbird" "$out/bin/"
-
- for executable in \
- thunderbird crashreporter thunderbird-bin plugin-container updater
- do
- patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
- "$out/usr/lib/thunderbird-bin-${version}/$executable"
- done
-
- find . -executable -type f -exec \
- patchelf --set-rpath "$libPath" \
- "$out/usr/lib/thunderbird-bin-${version}/{}" \;
-
- # Create a desktop item.
- mkdir -p $out/share/applications
- cat > $out/share/applications/thunderbird.desktop < gtk3Support == true;
-
-stdenv.mkDerivation rec {
- pname = "thunderbird";
- version = "68.12.0";
-
- src = fetchurl {
- url =
- "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";
- sha512 =
- "33350vjgzvsg6sdhdld92z75k1xcf1wmngdcvzsj4f3y3aal73pyw03mlvgg6y36bm0j8fhaxvgbbg5zm7hxhn779z78970m4v9amg7";
- };
-
- nativeBuildInputs = [
- autoconf213
- cargo
- copyDesktopItems
- gnused
- llvmPackages.llvm
- m4
- nasm
- nodejs
- perl
- pkg-config
- python2
- python3
- rust-cbindgen
- rustc
- which
- yasm
- unzip
- ] ++ lib.optional gtk3Support wrapGAppsHook;
-
- buildInputs = [
- bzip2
- dbus
- dbus-glib
- file
- fontconfig
- freetype
- glib
- gtk2
- icu
- jemalloc
- libGL
- libGLU
- libevent
- libjpeg
- libnotify
- libpng
- libstartup_notification
- libvpx
- libwebp
- nspr
- nss
- pango
- perl
- sqlite
- xorg.libX11
- xorg.libXScrnSaver
- xorg.libXcursor
- xorg.libXext
- xorg.libXft
- xorg.libXi
- xorg.libXrender
- xorg.libXt
- xorg.pixman
- xorg.xorgproto
- zip
- zlib
- ] ++ lib.optional alsaSupport alsaLib
- ++ lib.optional gtk3Support gtk3
- ++ lib.optional pulseaudioSupport libpulseaudio
- ++ lib.optional waylandSupport libxkbcommon;
-
- NIX_CFLAGS_COMPILE =[
- "-I${glib.dev}/include/gio-unix-2.0"
- "-I${nss.dev}/include/nss"
- ];
-
- patches = [
- ./no-buildconfig-68.patch
- ];
-
- postPatch = ''
- rm -rf obj-x86_64-pc-linux-gnu
- '';
-
- hardeningDisable = [ "format" ];
-
- preConfigure = ''
- # remove distributed configuration files
- rm -f configure
- rm -f js/src/configure
- rm -f .mozconfig*
-
- configureScript="$(realpath ./mach) configure"
- # AS=as in the environment causes build failure https://bugzilla.mozilla.org/show_bug.cgi?id=1497286
- unset AS
-
- export MOZCONFIG=$(pwd)/mozconfig
-
- # Set C flags for Rust's bindgen program. Unlike ordinary C
- # compilation, bindgen does not invoke $CC directly. Instead it
- # uses LLVM's libclang. To make sure all necessary flags are
- # included we need to look in a few places.
- # TODO: generalize this process for other use-cases.
-
- BINDGEN_CFLAGS="$(< ${stdenv.cc}/nix-support/libc-cflags) \
- $(< ${stdenv.cc}/nix-support/cc-cflags) \
- $(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \
- ${
- lib.optionalString stdenv.cc.isClang
- "-idirafter ${stdenv.cc.cc}/lib/clang/${
- lib.getVersion stdenv.cc.cc
- }/include"
- } \
- ${
- lib.optionalString stdenv.cc.isGNU
- "-isystem ${stdenv.cc.cc}/include/c++/${
- lib.getVersion stdenv.cc.cc
- } -isystem ${stdenv.cc.cc}/include/c++/${
- lib.getVersion stdenv.cc.cc
- }/${stdenv.hostPlatform.config}"
- } \
- $NIX_CFLAGS_COMPILE"
-
- echo "ac_add_options BINDGEN_CFLAGS='$BINDGEN_CFLAGS'" >> $MOZCONFIG
- '';
-
- configureFlags = let
- toolkitSlug = if gtk3Support then
- "3${lib.optionalString waylandSupport "-wayland"}"
- else
- "2";
- toolkitValue = "cairo-gtk${toolkitSlug}";
- in [
- "--enable-application=comm/mail"
-
- "--with-system-bz2"
- "--with-system-icu"
- "--with-system-jpeg"
- "--with-system-libevent"
- "--with-system-nspr"
- "--with-system-nss"
- "--with-system-png" # needs APNG support
- "--with-system-icu"
- "--with-system-zlib"
- "--with-system-webp"
- "--with-system-libvpx"
-
- "--enable-rust-simd"
- "--enable-crashreporter"
- "--enable-default-toolkit=${toolkitValue}"
- "--enable-js-shell"
- "--enable-necko-wifi"
- "--enable-startup-notification"
- "--enable-system-ffi"
- "--enable-system-pixman"
- "--enable-system-sqlite"
-
- "--disable-gconf"
- "--disable-tests"
- "--disable-updater"
- "--enable-jemalloc"
- ] ++ (if debugBuild then [
- "--enable-debug"
- "--enable-profiling"
- ] else [
- "--disable-debug"
- "--enable-release"
- "--disable-debug-symbols"
- "--enable-optimize"
- "--enable-strip"
- ]) ++ lib.optionals (!stdenv.hostPlatform.isi686) [
- # on i686-linux: --with-libclang-path is not available in this configuration
- "--with-libclang-path=${llvmPackages.libclang}/lib"
- "--with-clang-path=${llvmPackages.clang}/bin/clang"
- ] ++ lib.optional alsaSupport "--enable-alsa"
- ++ lib.optional calendarSupport "--enable-calendar"
- ++ lib.optional enableOfficialBranding "--enable-official-branding"
- ++ lib.optional pulseaudioSupport "--enable-pulseaudio";
-
- enableParallelBuilding = true;
-
- postConfigure = ''
- cd obj-*
- '';
-
- makeFlags = lib.optionals enableOfficialBranding [
- "MOZILLA_OFFICIAL=1"
- "BUILD_OFFICIAL=1"
- ];
-
- doCheck = false;
-
- desktopItems = [
- (makeDesktopItem {
- categories = lib.concatStringsSep ";" [ "Application" "Network" ];
- desktopName = "Thunderbird";
- genericName = "Mail Reader";
- name = "thunderbird";
- exec = "thunderbird %U";
- icon = "$out/lib/thunderbird/chrome/icons/default/default256.png";
- mimeType = lib.concatStringsSep ";" [
- # Email
- "x-scheme-handler/mailto"
- "message/rfc822"
- # Feeds
- "x-scheme-handler/feed"
- "application/rss+xml"
- "application/x-extension-rss"
- # Newsgroups
- "x-scheme-handler/news"
- "x-scheme-handler/snews"
- "x-scheme-handler/nntp"
- ];
- })
- ];
- postInstall = ''
- # TODO: Move to a dev output?
- rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl
- '';
-
- preFixup = ''
- # Needed to find Mozilla runtime
- gappsWrapperArgs+=(
- --argv0 "$out/bin/thunderbird"
- --set MOZ_APP_LAUNCHER thunderbird
- # https://github.com/NixOS/nixpkgs/pull/61980
- --set SNAP_NAME "thunderbird"
- --set MOZ_LEGACY_PROFILES 1
- --set MOZ_ALLOW_DOWNGRADE 1
- )
- '';
-
- # FIXME: The XUL portion of this can probably be removed as soon as we
- # package a Thunderbird >=71.0 since XUL shouldn't be anymore (in use)?
- postFixup = ''
- local xul="$out/lib/thunderbird/libxul.so"
- patchelf --set-rpath "${libnotify}/lib:${lib.getLib systemd}/lib:$(patchelf --print-rpath $xul)" $xul
- '';
-
- doInstallCheck = true;
- installCheckPhase = ''
- "$out/bin/thunderbird" --version
- '';
-
- disallowedRequisites = [
- stdenv.cc
- ];
-
- passthru.updateScript = import ./../../browsers/firefox/update.nix {
- attrPath = "thunderbird";
- baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/";
- inherit writeScript lib common-updater-scripts xidel coreutils gnused
- gnugrep curl runtimeShell;
- };
-
- meta = with lib; {
- description = "A full-featured e-mail client";
- homepage = "https://www.thunderbird.net";
- maintainers = with maintainers; [
- eelco
- lovesegfault
- pierron
- vcunat
- ];
- platforms = platforms.linux;
- license = licenses.mpl20;
- knownVulnerabilities = [ "Support ended around Semptember 2020." ];
- };
-}
diff --git a/pkgs/applications/networking/mailreaders/thunderbird/default.nix b/pkgs/applications/networking/mailreaders/thunderbird/default.nix
index 5d9aacf515dd..7099f526751d 100644
--- a/pkgs/applications/networking/mailreaders/thunderbird/default.nix
+++ b/pkgs/applications/networking/mailreaders/thunderbird/default.nix
@@ -242,7 +242,7 @@ stdenv.mkDerivation rec {
"--enable-strip"
]) ++ lib.optionals (!stdenv.hostPlatform.isi686) [
# on i686-linux: --with-libclang-path is not available in this configuration
- "--with-libclang-path=${llvmPackages.libclang}/lib"
+ "--with-libclang-path=${llvmPackages.libclang.lib}/lib"
"--with-clang-path=${llvmPackages.clang}/bin/clang"
] ++ lib.optional alsaSupport "--enable-alsa"
++ lib.optional calendarSupport "--enable-calendar"
diff --git a/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-68.patch b/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-68.patch
deleted file mode 100644
index 482c10bd1cfc..000000000000
--- a/pkgs/applications/networking/mailreaders/thunderbird/no-buildconfig-68.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Remove about:buildconfig. If used as-is, it would add unnecessary runtime dependencies.
-diff -ru -x '*~' a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp
---- a/docshell/base/nsAboutRedirector.cpp 2017-07-31 18:20:51.000000000 +0200
-+++ b/docshell/base/nsAboutRedirector.cpp 2017-09-26 22:02:00.814151731 +0200
-@@ -32,8 +32,6 @@
- {"about", "chrome://global/content/aboutAbout.xhtml", 0},
- {"addons", "chrome://mozapps/content/extensions/extensions.xul",
- nsIAboutModule::ALLOW_SCRIPT},
-- {"buildconfig", "chrome://global/content/buildconfig.html",
-- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT},
- {"checkerboard", "chrome://global/content/aboutCheckerboard.xhtml",
- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::ALLOW_SCRIPT},
-diff -ru -x '*~' a/toolkit/content/jar.mn b/toolkit/content/jar.mn
---- a/toolkit/content/jar.mn 2017-07-31 18:20:52.000000000 +0200
-+++ b/toolkit/content/jar.mn 2017-09-26 22:01:42.383350314 +0200
-@@ -39,7 +39,6 @@
- content/global/plugins.css
- content/global/browser-child.js
- content/global/browser-content.js
--* content/global/buildconfig.html
- content/global/buildconfig.css
- content/global/contentAreaUtils.js
- content/global/datepicker.xhtml
---- a/comm/mail/base/jar.mn
-+++ b/comm/mail/base/jar.mn
-@@ -117,9 +117,7 @@
- % override chrome://mozapps/content/profile/profileDowngrade.js chrome://messenger/content/profileDowngrade.js
- % override chrome://mozapps/content/profile/profileDowngrade.xul chrome://messenger/content/profileDowngrade.xul
-
--* content/messenger/buildconfig.html (content/buildconfig.html)
- content/messenger/buildconfig.css (content/buildconfig.css)
--% override chrome://global/content/buildconfig.html chrome://messenger/content/buildconfig.html
- % override chrome://global/content/buildconfig.css chrome://messenger/content/buildconfig.css
-
- # L10n resources and overrides.
diff --git a/pkgs/applications/networking/p2p/transmission/default.nix b/pkgs/applications/networking/p2p/transmission/default.nix
index 43ca9d455bd9..cfccff689fe0 100644
--- a/pkgs/applications/networking/p2p/transmission/default.nix
+++ b/pkgs/applications/networking/p2p/transmission/default.nix
@@ -22,6 +22,7 @@
, enableDaemon ? true
, enableCli ? true
, installLib ? false
+, apparmorRulesFromClosure
}:
let
@@ -39,6 +40,8 @@ in stdenv.mkDerivation {
fetchSubmodules = true;
};
+ outputs = [ "out" "apparmor" ];
+
cmakeFlags =
let
mkFlag = opt: if opt then "ON" else "OFF";
@@ -75,6 +78,31 @@ in stdenv.mkDerivation {
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework CoreFoundation";
+ postInstall = ''
+ mkdir $apparmor
+ cat >$apparmor/bin.transmission-daemon <
+ $out/bin/transmission-daemon {
+ include
+ include
+ include
+ include "${apparmorRulesFromClosure { name = "transmission-daemon"; } ([
+ curl libevent openssl pcre zlib
+ ] ++ lib.optionals enableSystemd [ systemd ]
+ ++ lib.optionals stdenv.isLinux [ inotify-tools ]
+ )}"
+ r @{PROC}/sys/kernel/random/uuid,
+ r @{PROC}/sys/vm/overcommit_memory,
+ r @{PROC}/@{pid}/environ,
+ r @{PROC}/@{pid}/mounts,
+ rwk /tmp/tr_session_id_*,
+ r /run/systemd/resolve/stub-resolv.conf,
+
+ include
+ }
+ EOF
+ '';
+
passthru.tests = {
smoke-test = nixosTests.bittorrent;
};
diff --git a/pkgs/applications/radio/rtl_433/default.nix b/pkgs/applications/radio/rtl_433/default.nix
index b926e29bc472..72aa865176c2 100644
--- a/pkgs/applications/radio/rtl_433/default.nix
+++ b/pkgs/applications/radio/rtl_433/default.nix
@@ -3,14 +3,14 @@
}:
stdenv.mkDerivation rec {
- version = "20.11";
+ version = "21.05";
pname = "rtl_433";
src = fetchFromGitHub {
owner = "merbanan";
repo = "rtl_433";
rev = version;
- sha256 = "093bxjxkg7yf78wqj5gpijbfa2p05ny09qqsj84kzi1svnzsa369";
+ sha256 = "sha256-01mXOwLv16yTR65BboN+TFm2aE2EMfW1D5teDdW2wLg=";
};
nativeBuildInputs = [ pkg-config cmake ];
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "Decode traffic from devices that broadcast on 433.9 MHz, 868 MHz, 315 MHz, 345 MHz and 915 MHz";
homepage = "https://github.com/merbanan/rtl_433";
- license = licenses.gpl2;
+ license = licenses.gpl2Plus;
maintainers = with maintainers; [ earldouglas ];
platforms = platforms.all;
};
diff --git a/pkgs/applications/science/machine-learning/labelimg/default.nix b/pkgs/applications/science/machine-learning/labelimg/default.nix
index 50d0aa6f9d1d..620ccfb084ef 100644
--- a/pkgs/applications/science/machine-learning/labelimg/default.nix
+++ b/pkgs/applications/science/machine-learning/labelimg/default.nix
@@ -15,7 +15,7 @@
propagatedBuildInputs = with python3Packages; [
pyqt5
lxml
- sip
+ sip_4
];
preBuild = ''
make qt5py3
diff --git a/pkgs/applications/science/math/R/default.nix b/pkgs/applications/science/math/R/default.nix
index 8905df8ccef9..827c817fd1a6 100644
--- a/pkgs/applications/science/math/R/default.nix
+++ b/pkgs/applications/science/math/R/default.nix
@@ -69,8 +69,8 @@ stdenv.mkDerivation rec {
--disable-R-framework
--without-x
OBJC="clang"
- CPPFLAGS="-isystem ${libcxx}/include/c++/v1"
- LDFLAGS="-L${libcxx}/lib"
+ CPPFLAGS="-isystem ${lib.getDev libcxx}/include/c++/v1"
+ LDFLAGS="-L${lib.getLib libcxx}/lib"
'' + ''
)
echo >>etc/Renviron.in "TCLLIBPATH=${tk}/lib"
diff --git a/pkgs/applications/science/math/eukleides/default.nix b/pkgs/applications/science/math/eukleides/default.nix
index 5f7fe58465d0..b5a9fc3fa86d 100644
--- a/pkgs/applications/science/math/eukleides/default.nix
+++ b/pkgs/applications/science/math/eukleides/default.nix
@@ -1,26 +1,57 @@
-{ lib, stdenv, fetchurl, bison, flex, texinfo, readline, texLive }:
+{ lib, stdenv, fetchurl, bison, flex, makeWrapper, texinfo, readline, texLive }:
-let
- name = "eukleides";
+lib.fix (eukleides: stdenv.mkDerivation rec {
+ pname = "eukleides";
version = "1.5.4";
-in
-stdenv.mkDerivation {
- name = "${name}-${version}";
src = fetchurl {
- url = "http://www.eukleides.org/files/${name}-${version}.tar.bz2";
+ url = "http://www.eukleides.org/files/${pname}-${version}.tar.bz2";
sha256 = "0s8cyh75hdj89v6kpm3z24i48yzpkr8qf0cwxbs9ijxj1i38ki0q";
};
- buildInputs = [bison flex texinfo readline texLive];
+ # use $CC instead of hardcoded gcc
+ patches = [ ./use-CC.patch ];
- preConfigure = "sed -i 's/ginstall-info/install-info/g' doc/Makefile";
- installPhase = "mkdir -p $out/bin ; make PREFIX=$out install";
+ nativeBuildInputs = [ bison flex texinfo makeWrapper ];
+
+ buildInputs = [ readline texLive ];
+
+ preConfigure = ''
+ substituteInPlace Makefile \
+ --replace mktexlsr true
+
+ substituteInPlace doc/Makefile \
+ --replace ginstall-info install-info
+
+ substituteInPlace Config \
+ --replace '/usr/local' "$out" \
+ --replace '$(SHARE_DIR)/texmf' "$tex"
+ '';
+
+ preInstall = ''
+ mkdir -p $out/bin
+ '';
+
+ postInstall = ''
+ wrapProgram $out/bin/euktoeps \
+ --set-default TEXINPUTS : \
+ --prefix TEXINPUTS : "$tex/tex/latex/eukleides" \
+ --prefix PATH : "${texLive}/bin"
+ wrapProgram $out/bin/euktopdf \
+ --set-default TEXINPUTS : \
+ --prefix TEXINPUTS : "$tex/tex/latex/eukleides" \
+ --prefix PATH : "${texLive}/bin"
+ '';
+
+ outputs = [ "out" "doc" "tex" ];
+
+ passthru.tlType = "run";
+ passthru.pkgs = [ eukleides.tex ];
meta = {
description = "Geometry Drawing Language";
homepage = "http://www.eukleides.org/";
- license = lib.licenses.gpl2;
+ license = lib.licenses.gpl3Plus;
longDescription = ''
Eukleides is a computer language devoted to elementary plane
@@ -31,7 +62,7 @@ stdenv.mkDerivation {
circles and conics.
'';
- platforms = lib.platforms.linux;
+ platforms = lib.platforms.unix;
maintainers = [ lib.maintainers.peti ];
};
-}
+})
diff --git a/pkgs/applications/science/math/eukleides/use-CC.patch b/pkgs/applications/science/math/eukleides/use-CC.patch
new file mode 100644
index 000000000000..08bd71ec9dc5
--- /dev/null
+++ b/pkgs/applications/science/math/eukleides/use-CC.patch
@@ -0,0 +1,11 @@
+--- a/build/Makefile
++++ b/build/Makefile
+@@ -11,7 +11,7 @@ LEX = flex
+ LFLAGS = -8
+ YACC = bison
+ YFLAGS = -d
+-CC = gcc
++CC ?= gcc
+ IFLAGS = -I$(COMMON_DIR) -I$(MAIN_DIR) -I$(BUILD_DIR)
+ ifneq ($(strip $(LOCALES)),)
+ MOFLAGS = -DMO_DIR=\"$(MO_DIR)\"
diff --git a/pkgs/applications/science/math/glsurf/default.nix b/pkgs/applications/science/math/glsurf/default.nix
index 599d4bac8e76..208bb95f930e 100644
--- a/pkgs/applications/science/math/glsurf/default.nix
+++ b/pkgs/applications/science/math/glsurf/default.nix
@@ -1,5 +1,5 @@
-{ lib, stdenv, fetchurl, ocamlPackages, libGLU, libGL, freeglut
-, libmysqlclient, mpfr, gmp, libtiff, libjpeg, libpng, giflib
+{ lib, stdenv, fetchurl, ocamlPackages, libGLU, libGL, freeglut, giflib
+, libmysqlclient, mpfr, gmp, libtiff, libjpeg, libpng
}:
stdenv.mkDerivation {
@@ -10,10 +10,10 @@ stdenv.mkDerivation {
sha256 = "0w8xxfnw2snflz8wdr2ca9f5g91w5vbyp1hwlx1v7vg83d4bwqs7";
};
- buildInputs = [ freeglut libGLU libGL libmysqlclient mpfr gmp
- libtiff libjpeg libpng giflib ]
+ buildInputs = [ freeglut libGLU libGL libmysqlclient mpfr giflib gmp
+ libtiff libjpeg libpng ]
++ (with ocamlPackages; [
- ocaml findlib ocaml_mysql lablgl camlimages_4_0 mlgmpidl
+ ocaml findlib ocaml_mysql lablgl camlimages_4_1_2 mlgmpidl
]);
installPhase = ''
@@ -26,6 +26,6 @@ stdenv.mkDerivation {
meta = {
homepage = "https://raffalli.eu/~christophe/glsurf/";
description = "A program to draw implicit surfaces and curves";
- license = lib.licenses.lgpl21;
+ license = lib.licenses.gpl2Plus;
};
}
diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/applications/science/misc/root/default.nix
index ab5352975f76..20b239dc6771 100644
--- a/pkgs/applications/science/misc/root/default.nix
+++ b/pkgs/applications/science/misc/root/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
sha256 = "0vrgi83hrw4n9zgx873fn4ba3vk54slrwk1cl4cc4plgxzv1y1kg";
};
- nativeBuildInputs = [ makeWrapper cmake pkg-config ];
+ nativeBuildInputs = [ makeWrapper cmake pkg-config llvm_5.dev ];
buildInputs = [ ftgl gl2ps glew pcre zlib zstd llvm_5 libxml2 lz4 xz gsl xxHash libAfterImage giflib libjpeg libtiff libpng python.pkgs.numpy ]
++ lib.optionals (!stdenv.isDarwin) [ libX11 libXpm libXft libXext libGLU libGL ]
++ lib.optionals (stdenv.isDarwin) [ Cocoa OpenGL ]
diff --git a/pkgs/applications/version-management/git-and-tools/git-cola/default.nix b/pkgs/applications/version-management/git-and-tools/git-cola/default.nix
index 37c10bf2f982..707e0855d151 100644
--- a/pkgs/applications/version-management/git-and-tools/git-cola/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git-cola/default.nix
@@ -1,7 +1,7 @@
{ lib, fetchFromGitHub, python3Packages, gettext, git, qt5 }:
let
- inherit (python3Packages) buildPythonApplication pyqt5 sip pyinotify;
+ inherit (python3Packages) buildPythonApplication pyqt5 sip_4 pyinotify;
in buildPythonApplication rec {
pname = "git-cola";
@@ -15,7 +15,7 @@ in buildPythonApplication rec {
};
buildInputs = [ git gettext ];
- propagatedBuildInputs = [ pyqt5 sip pyinotify ];
+ propagatedBuildInputs = [ pyqt5 sip_4 pyinotify ];
nativeBuildInputs = [ qt5.wrapQtAppsHook ];
doCheck = false;
diff --git a/pkgs/applications/video/hdhomerun-config-gui/default.nix b/pkgs/applications/video/hdhomerun-config-gui/default.nix
index b44da238d1e1..62726dff4112 100644
--- a/pkgs/applications/video/hdhomerun-config-gui/default.nix
+++ b/pkgs/applications/video/hdhomerun-config-gui/default.nix
@@ -1,12 +1,12 @@
-{ lib, stdenv, fetchurl, libhdhomerun, gcc, gnumake, pkg-config, gtk2 }:
+{ lib, stdenv, fetchurl, libhdhomerun, pkg-config, gtk2 }:
stdenv.mkDerivation rec {
pname = "hdhomerun-config-gui";
- version = "20200907";
+ version = "20210224";
src = fetchurl {
url = "https://download.silicondust.com/hdhomerun/hdhomerun_config_gui_${version}.tgz";
- sha256 = "17zf0hzw68b0xdkh1maqhl96jb7171mbhd29y64as29nps9x4fmz";
+ sha256 = "sha256-vzrSk742Ca2I8Uk0uGo44SxpEoVY1QBn62Ahwz8E7p8=";
};
nativeBuildInputs = [ pkg-config ];
diff --git a/pkgs/applications/video/mplayer/default.nix b/pkgs/applications/video/mplayer/default.nix
index 0162a9997097..b6bfa9d0dcf2 100644
--- a/pkgs/applications/video/mplayer/default.nix
+++ b/pkgs/applications/video/mplayer/default.nix
@@ -106,6 +106,8 @@ stdenv.mkDerivation rec {
rm -rf ffmpeg
'';
+ patches = [ ./svn-r38199-ffmpeg44fix.patch ];
+
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ pkg-config yasm ];
buildInputs = with lib;
diff --git a/pkgs/applications/video/mplayer/svn-r38199-ffmpeg44fix.patch b/pkgs/applications/video/mplayer/svn-r38199-ffmpeg44fix.patch
new file mode 100644
index 000000000000..4137989fcb54
--- /dev/null
+++ b/pkgs/applications/video/mplayer/svn-r38199-ffmpeg44fix.patch
@@ -0,0 +1,22 @@
+Index: libmpcodecs/ad_spdif.c
+===================================================================
+diff --git a/libmpcodecs/ad_spdif.c b/libmpcodecs/ad_spdif.c
+--- a/libmpcodecs/ad_spdif.c (revision 38198)
++++ b/libmpcodecs/ad_spdif.c (revision 38199)
+@@ -298,14 +298,8 @@
+ if (spdif_ctx->header_written)
+ av_write_trailer(lavf_ctx);
+ av_freep(&lavf_ctx->pb);
+- if (lavf_ctx->streams) {
+- av_freep(&lavf_ctx->streams[0]->codec);
+- av_freep(&lavf_ctx->streams[0]->info);
+- av_freep(&lavf_ctx->streams[0]);
+- }
+- av_freep(&lavf_ctx->streams);
+- av_freep(&lavf_ctx->priv_data);
++ avformat_free_context(lavf_ctx);
++ lavf_ctx = NULL;
+ }
+- av_freep(&lavf_ctx);
+ av_freep(&spdif_ctx);
+ }
diff --git a/pkgs/applications/video/openshot-qt/default.nix b/pkgs/applications/video/openshot-qt/default.nix
index 5951f4665e40..c25e53b657b6 100644
--- a/pkgs/applications/video/openshot-qt/default.nix
+++ b/pkgs/applications/video/openshot-qt/default.nix
@@ -18,7 +18,7 @@ mkDerivationWith python3Packages.buildPythonApplication rec {
buildInputs = [ gtk3 ];
- propagatedBuildInputs = with python3Packages; [ libopenshot pyqt5_with_qtwebkit requests sip httplib2 pyzmq ];
+ propagatedBuildInputs = with python3Packages; [ libopenshot pyqt5_with_qtwebkit requests sip_4 httplib2 pyzmq ];
dontWrapGApps = true;
dontWrapQtApps = true;
diff --git a/pkgs/applications/video/vdr/default.nix b/pkgs/applications/video/vdr/default.nix
index eeb61624409f..265ef82528db 100644
--- a/pkgs/applications/video/vdr/default.nix
+++ b/pkgs/applications/video/vdr/default.nix
@@ -5,12 +5,12 @@
}: stdenv.mkDerivation rec {
pname = "vdr";
- version = "2.4.6";
+ version = "2.4.7";
src = fetchgit {
url = "git://git.tvdr.de/vdr.git";
- rev = "V20406";
- sha256 = "sha256-te9lMmnWpesv+np2gJUDL17pI0WyVxhUnoBsFSRtOco=";
+ rev = version;
+ sha256 = "sha256-hDJ/DemWuLddDvXGqxkSTIqATlWUjolcP7ojjhK2CDk=";
};
enableParallelBuilding = true;
@@ -51,6 +51,6 @@
description = "Video Disc Recorder";
maintainers = [ maintainers.ck3d ];
platforms = [ "i686-linux" "x86_64-linux" ];
- license = licenses.gpl2;
+ license = licenses.gpl2Plus;
};
}
diff --git a/pkgs/applications/window-managers/icewm/default.nix b/pkgs/applications/window-managers/icewm/default.nix
index 0dc962e84c5b..77ed0c561cd4 100644
--- a/pkgs/applications/window-managers/icewm/default.nix
+++ b/pkgs/applications/window-managers/icewm/default.nix
@@ -30,7 +30,7 @@
, libpthreadstubs
, libsndfile
, libtiff
-, libungif
+, giflib
, libxcb
, mkfontdir
, pcre
@@ -81,7 +81,7 @@ stdenv.mkDerivation rec {
libpthreadstubs
libsndfile
libtiff
- libungif
+ giflib
libxcb
mkfontdir
pcre
diff --git a/pkgs/applications/window-managers/river/default.nix b/pkgs/applications/window-managers/river/default.nix
index e82f290169c7..b8b530272198 100644
--- a/pkgs/applications/window-managers/river/default.nix
+++ b/pkgs/applications/window-managers/river/default.nix
@@ -43,6 +43,6 @@ stdenv.mkDerivation rec {
description = "A dynamic tiling wayland compositor";
license = licenses.gpl3Plus;
platforms = platforms.linux;
- maintainers = with maintainers; [ branwright1 ];
+ maintainers = with maintainers; [ fortuneteller2k ];
};
}
diff --git a/pkgs/applications/window-managers/windowmaker/default.nix b/pkgs/applications/window-managers/windowmaker/default.nix
index e56ff2512c10..8c354c616fd2 100644
--- a/pkgs/applications/window-managers/windowmaker/default.nix
+++ b/pkgs/applications/window-managers/windowmaker/default.nix
@@ -1,6 +1,6 @@
{ lib, stdenv, fetchurl, pkg-config
, libX11, libXext, libXft, libXmu, libXinerama, libXrandr, libXpm
-, imagemagick, libpng, libjpeg, libexif, libtiff, libungif, libwebp }:
+, imagemagick, libpng, libjpeg, libexif, libtiff, giflib, libwebp }:
stdenv.mkDerivation rec {
pname = "windowmaker";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libX11 libXext libXft libXmu libXinerama libXrandr libXpm
- imagemagick libpng libjpeg libexif libtiff libungif libwebp ];
+ imagemagick libpng libjpeg libexif libtiff giflib libwebp ];
configureFlags = [
"--with-x"
diff --git a/pkgs/applications/window-managers/wio/default.nix b/pkgs/applications/window-managers/wio/default.nix
index c330bbe0e0f4..72fa23de9dd4 100644
--- a/pkgs/applications/window-managers/wio/default.nix
+++ b/pkgs/applications/window-managers/wio/default.nix
@@ -25,6 +25,11 @@ stdenv.mkDerivation rec {
sha256 = "1vpvlahv6dmr7vfb11p5cc5ds2y2vfvcb877nkqx18yin6pg357l";
};
+ patches = [
+ # To fix the build with wlroots 0.13:
+ ./wlroots-0.13.patch
+ ];
+
nativeBuildInputs = [ meson ninja pkg-config makeWrapper ];
buildInputs = [
cairo
diff --git a/pkgs/applications/window-managers/wio/wlroots-0.13.patch b/pkgs/applications/window-managers/wio/wlroots-0.13.patch
new file mode 100644
index 000000000000..989e812bb535
--- /dev/null
+++ b/pkgs/applications/window-managers/wio/wlroots-0.13.patch
@@ -0,0 +1,254 @@
+commit 8a3f903b20d646ebb2472c4f094ca1bf225a96c7
+Author: Michael Weiss
+Date: Fri May 14 19:19:05 2021 +0200
+
+ Fix the build with wlroots 0.13
+
+diff --git a/main.c b/main.c
+index 5d7dcda..870fdb0 100644
+--- a/main.c
++++ b/main.c
+@@ -1,6 +1,7 @@
+ #define _POSIX_C_SOURCE 200809L
+ #include
+ #include
++#include
+ #include
+ #include
+ #include
+@@ -49,7 +50,7 @@ static void gen_menu_textures(struct wio_server *server) {
+ cairo_surface_flush(surf);
+ unsigned char *data = cairo_image_surface_get_data(surf);
+ server->menu.inactive_textures[i] = wlr_texture_from_pixels(renderer,
+- WL_SHM_FORMAT_ARGB8888,
++ DRM_FORMAT_ARGB8888,
+ cairo_image_surface_get_stride(surf),
+ extents.width + 2, extents.height + 2, data);
+ }
+@@ -66,7 +67,7 @@ static void gen_menu_textures(struct wio_server *server) {
+ cairo_surface_flush(surf);
+ unsigned char *data = cairo_image_surface_get_data(surf);
+ server->menu.active_textures[i] = wlr_texture_from_pixels(renderer,
+- WL_SHM_FORMAT_ARGB8888,
++ DRM_FORMAT_ARGB8888,
+ cairo_image_surface_get_stride(surf),
+ extents.width + 2, extents.height + 2, data);
+ }
+@@ -152,7 +153,7 @@ int main(int argc, char **argv) {
+ }
+
+ server.wl_display = wl_display_create();
+- server.backend = wlr_backend_autocreate(server.wl_display, NULL);
++ server.backend = wlr_backend_autocreate(server.wl_display);
+ server.renderer = wlr_backend_get_renderer(server.backend);
+ wlr_renderer_init_wl_display(server.renderer, server.wl_display);
+
+diff --git a/protocols/wlr-layer-shell-unstable-v1.xml b/protocols/wlr-layer-shell-unstable-v1.xml
+index 90b8bc8..d62fd51 100644
+--- a/protocols/wlr-layer-shell-unstable-v1.xml
++++ b/protocols/wlr-layer-shell-unstable-v1.xml
+@@ -25,7 +25,7 @@
+ THIS SOFTWARE.
+
+
+-
++
+
+ Clients can use this interface to assign the surface_layer role to
+ wl_surfaces. Such surfaces are assigned to a "layer" of the output and
+@@ -47,6 +47,12 @@
+ or manipulate a buffer prior to the first layer_surface.configure call
+ must also be treated as errors.
+
++ After creating a layer_surface object and setting it up, the client
++ must perform an initial commit without any buffer attached.
++ The compositor will reply with a layer_surface.configure event.
++ The client must acknowledge it and is then allowed to attach a buffer
++ to map the surface.
++
+ You may pass NULL for output to allow the compositor to decide which
+ output to use. Generally this will be the one that the user most
+ recently interacted with.
+@@ -82,17 +88,35 @@
+
+
+
++
++
++
++
++
++ This request indicates that the client will not use the layer_shell
++ object any more. Objects that have been created through this instance
++ are not affected.
++
++
+
+
+-
++
+
+ An interface that may be implemented by a wl_surface, for surfaces that
+ are designed to be rendered as a layer of a stacked desktop-like
+ environment.
+
+- Layer surface state (size, anchor, exclusive zone, margin, interactivity)
+- is double-buffered, and will be applied at the time wl_surface.commit of
+- the corresponding wl_surface is called.
++ Layer surface state (layer, size, anchor, exclusive zone,
++ margin, interactivity) is double-buffered, and will be applied at the
++ time wl_surface.commit of the corresponding wl_surface is called.
++
++ Attaching a null buffer to a layer surface unmaps it.
++
++ Unmapping a layer_surface means that the surface cannot be shown by the
++ compositor until it is explicitly mapped again. The layer_surface
++ returns to the state it had right after layer_shell.get_layer_surface.
++ The client can re-map the surface by performing a commit without any
++ buffer attached, waiting for a configure event and handling it as usual.
+
+
+
+@@ -127,14 +151,19 @@
+
+
+
+- Requests that the compositor avoids occluding an area of the surface
+- with other surfaces. The compositor's use of this information is
++ Requests that the compositor avoids occluding an area with other
++ surfaces. The compositor's use of this information is
+ implementation-dependent - do not assume that this region will not
+ actually be occluded.
+
+- A positive value is only meaningful if the surface is anchored to an
+- edge, rather than a corner. The zone is the number of surface-local
+- coordinates from the edge that is considered exclusive.
++ A positive value is only meaningful if the surface is anchored to one
++ edge or an edge and both perpendicular edges. If the surface is not
++ anchored, anchored to only two perpendicular edges (a corner), anchored
++ to only two parallel edges or anchored to all edges, a positive value
++ will be treated the same as zero.
++
++ A positive zone is the distance from the edge in surface-local
++ coordinates to consider exclusive.
+
+ Surfaces that do not wish to have an exclusive zone may instead specify
+ how they should interact with surfaces that do. If set to zero, the
+@@ -174,21 +203,85 @@
+
+
+
++
++
++ Types of keyboard interaction possible for layer shell surfaces. The
++ rationale for this is twofold: (1) some applications are not interested
++ in keyboard events and not allowing them to be focused can improve the
++ desktop experience; (2) some applications will want to take exclusive
++ keyboard focus.
++
++
++
++
++ This value indicates that this surface is not interested in keyboard
++ events and the compositor should never assign it the keyboard focus.
++
++ This is the default value, set for newly created layer shell surfaces.
++
++ This is useful for e.g. desktop widgets that display information or
++ only have interaction with non-keyboard input devices.
++
++
++
++
++ Request exclusive keyboard focus if this surface is above the shell surface layer.
++
++ For the top and overlay layers, the seat will always give
++ exclusive keyboard focus to the top-most layer which has keyboard
++ interactivity set to exclusive. If this layer contains multiple
++ surfaces with keyboard interactivity set to exclusive, the compositor
++ determines the one receiving keyboard events in an implementation-
++ defined manner. In this case, no guarantee is made when this surface
++ will receive keyboard focus (if ever).
++
++ For the bottom and background layers, the compositor is allowed to use
++ normal focus semantics.
++
++ This setting is mainly intended for applications that need to ensure
++ they receive all keyboard events, such as a lock screen or a password
++ prompt.
++
++
++
++
++ This requests the compositor to allow this surface to be focused and
++ unfocused by the user in an implementation-defined manner. The user
++ should be able to unfocus this surface even regardless of the layer
++ it is on.
++
++ Typically, the compositor will want to use its normal mechanism to
++ manage keyboard focus between layer shell surfaces with this setting
++ and regular toplevels on the desktop layer (e.g. click to focus).
++ Nevertheless, it is possible for a compositor to require a special
++ interaction to focus or unfocus layer shell surfaces (e.g. requiring
++ a click even if focus follows the mouse normally, or providing a
++ keybinding to switch focus between layers).
++
++ This setting is mainly intended for desktop shell components (e.g.
++ panels) that allow keyboard interaction. Using this option can allow
++ implementing a desktop shell that can be fully usable without the
++ mouse.
++
++
++
++
+
+
+- Set to 1 to request that the seat send keyboard events to this layer
+- surface. For layers below the shell surface layer, the seat will use
+- normal focus semantics. For layers above the shell surface layers, the
+- seat will always give exclusive keyboard focus to the top-most layer
+- which has keyboard interactivity set to true.
++ Set how keyboard events are delivered to this surface. By default,
++ layer shell surfaces do not receive keyboard events; this request can
++ be used to change this.
++
++ This setting is inherited by child surfaces set by the get_popup
++ request.
+
+ Layer surfaces receive pointer, touch, and tablet events normally. If
+ you do not want to receive them, set the input region on your surface
+ to an empty region.
+
+- Events is double-buffered, see wl_surface.commit.
++ Keyboard interactivity is double-buffered, see wl_surface.commit.
+
+-
++
+
+
+
+@@ -273,6 +366,7 @@
+
+
+
++
+
+
+
+@@ -281,5 +375,16 @@
+
+
+
++
++
++
++
++
++ Change the layer that the surface is rendered on.
++
++ Layer is double-buffered, see wl_surface.commit.
++
++
++
+
+
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
index b402893100b0..2e62aef46048 100644
--- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh
+++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
@@ -25,8 +25,9 @@ dontLink=0
nonFlagArgs=0
cc1=0
# shellcheck disable=SC2193
-[[ "@prog@" = *++ ]] && isCpp=1 || isCpp=0
-cppInclude=1
+[[ "@prog@" = *++ ]] && isCxx=1 || isCxx=0
+cxxInclude=1
+cxxLibrary=1
cInclude=1
setDynamicLinker=1
@@ -50,15 +51,15 @@ while (( "$n" < "$nParams" )); do
dontLink=1
elif [[ "$p" = -x && "$p2" = *-header ]]; then
dontLink=1
- elif [[ "$p" = -x && "$p2" = c++* && "$isCpp" = 0 ]]; then
- isCpp=1
+ elif [[ "$p" = -x && "$p2" = c++* && "$isCxx" = 0 ]]; then
+ isCxx=1
elif [ "$p" = -nostdlib ]; then
- isCpp=-1
+ cxxLibrary=0
elif [ "$p" = -nostdinc ]; then
cInclude=0
- cppInclude=0
+ cxxInclude=0
elif [ "$p" = -nostdinc++ ]; then
- cppInclude=0
+ cxxInclude=0
elif [[ "$p" = -static || "$p" = -static-pie ]]; then
setDynamicLinker=0
elif [[ "$p" != -?* ]]; then
@@ -131,12 +132,13 @@ if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then
params=(${rest+"${rest[@]}"})
fi
-if [[ "$isCpp" = 1 ]]; then
- NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
-fi
-
-if [[ "$cppInclude" = 1 ]]; then
- NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
+if [[ "$isCxx" = 1 ]]; then
+ if [[ "$cxxInclude" = 1 ]]; then
+ NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
+ fi
+ if [[ "$cxxLibrary" = 1 ]]; then
+ NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
+ fi
fi
source @out@/nix-support/add-hardening.sh
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 14317cbe4cc5..36a98a180b3e 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -370,7 +370,7 @@ stdenv.mkDerivation {
done
''
+ optionalString (libcxx.isLLVM or false) (''
- echo "-isystem ${libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
+ echo "-isystem ${lib.getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
'' + lib.optionalString stdenv.targetPlatform.isLinux ''
echo "-lc++abi" >> $out/nix-support/libcxx-ldflags
@@ -404,7 +404,7 @@ stdenv.mkDerivation {
echo "$ccLDFlags" >> $out/nix-support/cc-ldflags
echo "$ccCFlags" >> $out/nix-support/cc-cflags
'' + optionalString (targetPlatform.isDarwin && (libcxx != null) && (cc.isClang or false)) ''
- echo " -L${libcxx}/lib" >> $out/nix-support/cc-ldflags
+ echo " -L${lib.getLib libcxx}/lib" >> $out/nix-support/cc-ldflags
''
##
diff --git a/pkgs/build-support/rust/default-crate-overrides.nix b/pkgs/build-support/rust/default-crate-overrides.nix
index 3d2dc3733c22..61cec2a6abab 100644
--- a/pkgs/build-support/rust/default-crate-overrides.nix
+++ b/pkgs/build-support/rust/default-crate-overrides.nix
@@ -92,7 +92,7 @@ in
nettle-sys = attrs: {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ nettle clang ];
- LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
};
openssl = attrs: {
diff --git a/pkgs/data/themes/marwaita/default.nix b/pkgs/data/themes/marwaita/default.nix
index d06d9be9aa90..5eeab879743a 100644
--- a/pkgs/data/themes/marwaita/default.nix
+++ b/pkgs/data/themes/marwaita/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv
+{ lib
+, stdenv
, fetchFromGitHub
, gdk-pixbuf
, gtk-engine-murrine
@@ -8,13 +9,13 @@
stdenv.mkDerivation rec {
pname = "marwaita";
- version = "9.1";
+ version = "9.2.1";
src = fetchFromGitHub {
owner = "darkomarko42";
repo = pname;
rev = version;
- sha256 = "0974pfcdbhajxvd6fnp2kix963s28n2il9w879h5zm1f6ayglsfz";
+ sha256 = "08392ybpxnbq3wswa7bvz8nnxryjg9aczvw3arnhfvmbigwq5q0s";
};
buildInputs = [
diff --git a/pkgs/desktops/gnustep/base/default.nix b/pkgs/desktops/gnustep/base/default.nix
index 8fe232dff7b4..e661dae90990 100644
--- a/pkgs/desktops/gnustep/base/default.nix
+++ b/pkgs/desktops/gnustep/base/default.nix
@@ -4,7 +4,7 @@
, fetchurl, fetchpatch
, gmp, gnutls
, libffi, binutils-unwrapped
-, libjpeg, libtiff, libpng, giflib, libungif
+, libjpeg, libtiff, libpng, giflib
, libxml2, libxslt, libiconv
, libobjc, libgcrypt
, icu
@@ -26,7 +26,7 @@ gsmakeDerivation {
cups
gmp gnutls
libffi binutils-unwrapped
- libjpeg libtiff libpng giflib libungif
+ libjpeg libtiff libpng giflib giflib
libxml2 libxslt libiconv
libobjc libgcrypt
icu
diff --git a/pkgs/desktops/gnustep/default.nix b/pkgs/desktops/gnustep/default.nix
index abbabd4abf29..d337512dceca 100644
--- a/pkgs/desktops/gnustep/default.nix
+++ b/pkgs/desktops/gnustep/default.nix
@@ -1,6 +1,5 @@
{ newScope
, llvmPackages
-, giflib_4_1
}:
let
@@ -16,7 +15,7 @@ let
libobjc = callPackage ./libobjc2 {};
make = callPackage ./make {};
back = callPackage ./back {};
- base = callPackage ./base { giflib = giflib_4_1; };
+ base = callPackage ./base { };
gui = callPackage ./gui {};
gworkspace = callPackage ./gworkspace {};
};
diff --git a/pkgs/desktops/plasma-5/fetch.sh b/pkgs/desktops/plasma-5/fetch.sh
index 10214b3fe23f..398f9a1b97de 100644
--- a/pkgs/desktops/plasma-5/fetch.sh
+++ b/pkgs/desktops/plasma-5/fetch.sh
@@ -1 +1 @@
-WGET_ARGS=( https://download.kde.org/stable/plasma/5.21.3/ -A '*.tar.xz' )
+WGET_ARGS=( https://download.kde.org/stable/plasma/5.21.4/ -A '*.tar.xz' )
diff --git a/pkgs/desktops/plasma-5/srcs.nix b/pkgs/desktops/plasma-5/srcs.nix
index bf93e0564d9f..8fa7ba91c6a5 100644
--- a/pkgs/desktops/plasma-5/srcs.nix
+++ b/pkgs/desktops/plasma-5/srcs.nix
@@ -4,419 +4,419 @@
{
bluedevil = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/bluedevil-5.21.3.tar.xz";
- sha256 = "1xqm4bn97asilc4yw5rvmmhk7c7wvmbalalr6gz8gw4gv0pg67qv";
- name = "bluedevil-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/bluedevil-5.21.4.tar.xz";
+ sha256 = "0ls6ijk10pgi75ycwcnq3z4j5hn657cnr4s7fky53qkc3y2x25g1";
+ name = "bluedevil-5.21.4.tar.xz";
};
};
breeze = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/breeze-5.21.3.tar.xz";
- sha256 = "0frm3f8q1n0pdzjk7zwmvlrl19fb9265ihnnfhak6ckaq50x72l3";
- name = "breeze-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/breeze-5.21.4.tar.xz";
+ sha256 = "1n6hwppcbnn3hw5r3f9jssvslnming9qvs4s2czyl0kky1nv8bfm";
+ name = "breeze-5.21.4.tar.xz";
};
};
breeze-grub = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/breeze-grub-5.21.3.tar.xz";
- sha256 = "1j0pk4pv5pxwhwah1gd5znnsw3j15x2sc74pp6zinz9a1ywjklnz";
- name = "breeze-grub-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/breeze-grub-5.21.4.tar.xz";
+ sha256 = "1jd8fy9b5cmv1da27xqbl6x3197pq6m4wwxzylxgnmciivhmnzm2";
+ name = "breeze-grub-5.21.4.tar.xz";
};
};
breeze-gtk = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/breeze-gtk-5.21.3.tar.xz";
- sha256 = "1x5by915lfhbkhgrhy3lkwg64skwdlqaxzbq92x0m9v9a9agwidc";
- name = "breeze-gtk-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/breeze-gtk-5.21.4.tar.xz";
+ sha256 = "03aj8rxh46j663m26jsb9hrg0x5j0hvzjqwc8l1ayfcwkdgl4b4i";
+ name = "breeze-gtk-5.21.4.tar.xz";
};
};
breeze-plymouth = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/breeze-plymouth-5.21.3.tar.xz";
- sha256 = "01ida3pfj6g1igndjfjpv16199zysgxlxlnc7vsx7kr8aval8pmx";
- name = "breeze-plymouth-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/breeze-plymouth-5.21.4.tar.xz";
+ sha256 = "0ibwl2aikh547k851pb78216v8ld5la9xg3f9945dcbf7ly88nd7";
+ name = "breeze-plymouth-5.21.4.tar.xz";
};
};
discover = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/discover-5.21.3.tar.xz";
- sha256 = "170kxhrwj4mvj5qg7cyz3sxdfyp7rr4pgsi3v7kahs19a9w3isnx";
- name = "discover-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/discover-5.21.4.tar.xz";
+ sha256 = "1f3hvafyf2kga1ywn5aia37xxgagx6p2b43h7ap7mjkmw7ywyr30";
+ name = "discover-5.21.4.tar.xz";
};
};
drkonqi = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/drkonqi-5.21.3.tar.xz";
- sha256 = "1hq37vi0vndhy66labspm75blicx1g4q594wxfxzl076mav5jds4";
- name = "drkonqi-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/drkonqi-5.21.4.tar.xz";
+ sha256 = "123l0hyyzskjivasp1q8w9y2f2mbjrwjap3yfi23h98zbzcblcaq";
+ name = "drkonqi-5.21.4.tar.xz";
};
};
kactivitymanagerd = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kactivitymanagerd-5.21.3.tar.xz";
- sha256 = "1x5p6rbjf9kz07r5mrkiglvbigvk5bfx8qpb8l2vagsbvlg298c3";
- name = "kactivitymanagerd-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kactivitymanagerd-5.21.4.tar.xz";
+ sha256 = "0waawpy5pqllj8iacrxpwsnz4m1yy7z8jih63s7psgr22cbvd116";
+ name = "kactivitymanagerd-5.21.4.tar.xz";
};
};
kde-cli-tools = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kde-cli-tools-5.21.3.tar.xz";
- sha256 = "0hkmr3zxg4np1ppsgj77ijgkwgvl7d0zxwl46xjc2px877lx8bpp";
- name = "kde-cli-tools-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kde-cli-tools-5.21.4.tar.xz";
+ sha256 = "1hvfb0qg6hxbyih665xwki8gbxjljgbw6x2blh2cikp7df66nhh1";
+ name = "kde-cli-tools-5.21.4.tar.xz";
};
};
kdecoration = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kdecoration-5.21.3.tar.xz";
- sha256 = "06a3gsf1lyjxccjzn0ad254wsf7x2bln2i6kyk5j4gwqss6lplf5";
- name = "kdecoration-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kdecoration-5.21.4.tar.xz";
+ sha256 = "003yp803gnsszlnbw1lbh043h8xlrrzg92v7vls8k5cb04ib0p8a";
+ name = "kdecoration-5.21.4.tar.xz";
};
};
kde-gtk-config = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kde-gtk-config-5.21.3.tar.xz";
- sha256 = "17fyan2jah059kj1i0sy7h901a4d2k7cc87sd84mskyys7g8vs1h";
- name = "kde-gtk-config-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kde-gtk-config-5.21.4.tar.xz";
+ sha256 = "0g7h1l5q9hdi2iq1kh5aclxjw1ffpq1l020p37k7f251m49440y8";
+ name = "kde-gtk-config-5.21.4.tar.xz";
};
};
kdeplasma-addons = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kdeplasma-addons-5.21.3.tar.xz";
- sha256 = "1181ax96csn4170p5blvhr679d7l865nby5a66swscyl3a5ys8b1";
- name = "kdeplasma-addons-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kdeplasma-addons-5.21.4.tar.xz";
+ sha256 = "18jny36w6zf4nfqffaqgmdgp4vcaa2civnd2lrrls8jhlz81grid";
+ name = "kdeplasma-addons-5.21.4.tar.xz";
};
};
kgamma5 = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kgamma5-5.21.3.tar.xz";
- sha256 = "0h8rwwd6lyfzmxsr5sfvllh1j8gk1pbq1w2fva8q534qrkqhqb49";
- name = "kgamma5-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kgamma5-5.21.4.tar.xz";
+ sha256 = "1rzn3d7i2i4bba9nfydbsvjqc7wzfz9lgd7qg74k19hzmfiqfhsl";
+ name = "kgamma5-5.21.4.tar.xz";
};
};
khotkeys = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/khotkeys-5.21.3.tar.xz";
- sha256 = "1n3ahrb5mzrxap572ydal1sy5q71af97iy4i2fwbljdb6zb1l1bl";
- name = "khotkeys-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/khotkeys-5.21.4.tar.xz";
+ sha256 = "05k6b8zilll97s14s50x27dk8p4lzmld95gzgrsv4i81jdvjgx53";
+ name = "khotkeys-5.21.4.tar.xz";
};
};
kinfocenter = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kinfocenter-5.21.3.tar.xz";
- sha256 = "1hj4mnx2mxb1ya7la05frx5c39cp3q7c5f78lnp6p8bkv3ylik72";
- name = "kinfocenter-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kinfocenter-5.21.4.tar.xz";
+ sha256 = "150kfx4cb10zjsaqkyidh1qis5644849xfqfnd5ldwsn07nkyp1y";
+ name = "kinfocenter-5.21.4.tar.xz";
};
};
kmenuedit = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kmenuedit-5.21.3.tar.xz";
- sha256 = "0fc3sal11amaj5ydws86hdmc45zhrxkv6lc5sfy200wvff3ynjjj";
- name = "kmenuedit-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kmenuedit-5.21.4.tar.xz";
+ sha256 = "1hmqji2ahkw3knv7pcj5m86zlmxmbsz98xv2igdx2gv6hrjbn8nh";
+ name = "kmenuedit-5.21.4.tar.xz";
};
};
kscreen = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kscreen-5.21.3.tar.xz";
- sha256 = "1f9gxdlj883ddmc1xgd1nmm8n6m5yd269kfx3m9bbp61cw4hrqlm";
- name = "kscreen-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kscreen-5.21.4.tar.xz";
+ sha256 = "1n9ymmysdfipwwi3f6ixg1kh3pkbp5wvi2y8fli0cpjdbrfj5lfr";
+ name = "kscreen-5.21.4.tar.xz";
};
};
kscreenlocker = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kscreenlocker-5.21.3.tar.xz";
- sha256 = "1hjlpwwca9nrdwgsiy5ss5ainr1fy1wfvi4g599cvijb77qc84h0";
- name = "kscreenlocker-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kscreenlocker-5.21.4.tar.xz";
+ sha256 = "1z94p93khl2b8zz965d6wdd4vi1q60f0s2a7ca9ph06gp8d574k4";
+ name = "kscreenlocker-5.21.4.tar.xz";
};
};
ksshaskpass = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/ksshaskpass-5.21.3.tar.xz";
- sha256 = "16c2kzdmw3viphaygdff29cvi06r53ag4a6hkxw15yrscw31n3ns";
- name = "ksshaskpass-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/ksshaskpass-5.21.4.tar.xz";
+ sha256 = "0zj4160xs940b9rin43b0a3j6czm3n04drg484y1h2mfqjflgc61";
+ name = "ksshaskpass-5.21.4.tar.xz";
};
};
ksysguard = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/ksysguard-5.21.3.tar.xz";
- sha256 = "0ys1idjqb9n67czdhlds6mhhiizxq8qq4rmds9nq8cm961g5kqsf";
- name = "ksysguard-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/ksysguard-5.21.4.tar.xz";
+ sha256 = "10p5bb80rcawd0qdm4f17whmqrfhzhv6hd20d57f1i9m7ijq456d";
+ name = "ksysguard-5.21.4.tar.xz";
};
};
kwallet-pam = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kwallet-pam-5.21.3.tar.xz";
- sha256 = "1dnni2k4ry11mfjnfc0i44zww3glhsbr70qnpkl9dsf5rj4dcwj3";
- name = "kwallet-pam-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kwallet-pam-5.21.4.tar.xz";
+ sha256 = "0s3wy9qikciblr6g98kn6s4ii5pnqwcngzng0czr3r4p90w33kkg";
+ name = "kwallet-pam-5.21.4.tar.xz";
};
};
kwayland-integration = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kwayland-integration-5.21.3.tar.xz";
- sha256 = "0kqw5dbsxmdm5fi34yq718ngkx5j23211jh4l9vl029qgbi42xhc";
- name = "kwayland-integration-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kwayland-integration-5.21.4.tar.xz";
+ sha256 = "1r3fmmzmdyfdam4hsjvjv3wss5zvyi674xsyn6csclmq3jwfz70k";
+ name = "kwayland-integration-5.21.4.tar.xz";
};
};
kwayland-server = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kwayland-server-5.21.3.tar.xz";
- sha256 = "0d3asblzz9c7cbjfdk33z26hn5n14rdrc3s9jm9awvcc1sd122a4";
- name = "kwayland-server-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kwayland-server-5.21.4.tar.xz";
+ sha256 = "1mkivw3siyxhgyhrm6fkqmp2wiswckrb433q87dh1j9gp7kg8cpz";
+ name = "kwayland-server-5.21.4.tar.xz";
};
};
kwin = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kwin-5.21.3.tar.xz";
- sha256 = "0ni0ipfm0hp90sq03m1a5lm6shxb2cf9j1a4kiqpaf7n62ch8f3w";
- name = "kwin-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kwin-5.21.4.tar.xz";
+ sha256 = "0br3hxnbqm2vyxcxind01784zd88bkhpz6ira03g3gjq7hlwzjx9";
+ name = "kwin-5.21.4.tar.xz";
};
};
kwrited = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/kwrited-5.21.3.tar.xz";
- sha256 = "01nn94qmi8q38rdv694d9qs7zahsziclmkw49zy0wlffq4ivpk6x";
- name = "kwrited-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/kwrited-5.21.4.tar.xz";
+ sha256 = "1hrsy1r7b7sgnj0l8zn1yxlrfhrrbk8rq2frbfi329fk3psca247";
+ name = "kwrited-5.21.4.tar.xz";
};
};
libkscreen = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/libkscreen-5.21.3.tar.xz";
- sha256 = "1j2d1xpn48ks0wk9vvnvj9r03bc0ggrqvblyhs30p31svfihjs3a";
- name = "libkscreen-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/libkscreen-5.21.4.tar.xz";
+ sha256 = "0b0mlc1lzfbkpzxs8rd7s7q5xmqla6p1q1jdnjxly3wj60pas2dc";
+ name = "libkscreen-5.21.4.tar.xz";
};
};
libksysguard = {
- version = "5.21.3.1";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/libksysguard-5.21.3.1.tar.xz";
- sha256 = "0nayjihapn71wrnzfb4wv9laafysl0x6sn98sbwhclapbdvxnw73";
- name = "libksysguard-5.21.3.1.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/libksysguard-5.21.4.tar.xz";
+ sha256 = "0sziqldjwcwpblkn7mn4w9xg34lv9pzdlc87andka4g1lxcln2gc";
+ name = "libksysguard-5.21.4.tar.xz";
};
};
milou = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/milou-5.21.3.tar.xz";
- sha256 = "0qbk0y783n7f7pl0akx252vyblrrgmsg5yr7ncaijq4x4l90f1yf";
- name = "milou-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/milou-5.21.4.tar.xz";
+ sha256 = "0y6mvzc5prgg1n7z2gzv1b7ngh0fygggrhdbk5wvpy6zp8yanwka";
+ name = "milou-5.21.4.tar.xz";
};
};
oxygen = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/oxygen-5.21.3.tar.xz";
- sha256 = "16yj1qx4mbi62brkn8wkcr6sz5dkbl2pf49zc1hadnxfm9wd3z0a";
- name = "oxygen-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/oxygen-5.21.4.tar.xz";
+ sha256 = "1d7cdpy3k7zyg3k6n6jz2473cqhbi7npgnpka4kc2lfjrkb9s0zj";
+ name = "oxygen-5.21.4.tar.xz";
};
};
plasma-browser-integration = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-browser-integration-5.21.3.tar.xz";
- sha256 = "1hz996lv3vvp1zldzpkb9dmvnn94v69j2vq9sfs446c25ggf9d6y";
- name = "plasma-browser-integration-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-browser-integration-5.21.4.tar.xz";
+ sha256 = "14yna45ykfa88a17iy4c5qkd673ay818693qqn13s4zwkxriby3n";
+ name = "plasma-browser-integration-5.21.4.tar.xz";
};
};
plasma-desktop = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-desktop-5.21.3.tar.xz";
- sha256 = "0bryk523qfzb5max1h460d67ir6xbrsws9bq72bdfbv1wkv64kyy";
- name = "plasma-desktop-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-desktop-5.21.4.tar.xz";
+ sha256 = "1drv50601030xvskkw1pa5hi5ngrx2i8lkj7m8i9pym8zy15qqy9";
+ name = "plasma-desktop-5.21.4.tar.xz";
};
};
plasma-disks = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-disks-5.21.3.tar.xz";
- sha256 = "18a7dppfhb2wpb7sfhnayq96bxjlzygdz7sppcjikxil8klhv1aq";
- name = "plasma-disks-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-disks-5.21.4.tar.xz";
+ sha256 = "1hjihh088v1w03lpz5pcz6pycbpd8b8kh54a44pq7zkhh6l6n65g";
+ name = "plasma-disks-5.21.4.tar.xz";
};
};
plasma-firewall = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-firewall-5.21.3.tar.xz";
- sha256 = "0bzmcakzwiimc90bbpih1z5isrcfhdfwlslp4q3v3npppnivv9bw";
- name = "plasma-firewall-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-firewall-5.21.4.tar.xz";
+ sha256 = "1in9maphksc7ajj6jhy0qxgw5f7fy4m23dpik6wvxc5r3v5b76z7";
+ name = "plasma-firewall-5.21.4.tar.xz";
};
};
plasma-integration = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-integration-5.21.3.tar.xz";
- sha256 = "09dlbfildd8wl0nbss84yibljyl6cadx95q8q4n0c5wymyc4zqy1";
- name = "plasma-integration-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-integration-5.21.4.tar.xz";
+ sha256 = "0bj2k5c4170apy7ascfdqc052jm35pi2w5zb3m39qb5b7ylq1hhw";
+ name = "plasma-integration-5.21.4.tar.xz";
};
};
plasma-nano = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-nano-5.21.3.tar.xz";
- sha256 = "1yqn29769nnfhiyqbpv15c0zxvkfzq4yvk9x9qlchbcwjc1gr23j";
- name = "plasma-nano-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-nano-5.21.4.tar.xz";
+ sha256 = "0v5vr5di9bk57g2xi442qj8yv9219mdpc0l0n2bsvbb8x4f0d5qk";
+ name = "plasma-nano-5.21.4.tar.xz";
};
};
plasma-nm = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-nm-5.21.3.tar.xz";
- sha256 = "0d7v757kzd0pcvlz201m0njcz9y8j0bqkwbzdz3gik9s7x6rl73p";
- name = "plasma-nm-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-nm-5.21.4.tar.xz";
+ sha256 = "1gy1drykjyipmrpqbb7yk2232g5hzy316gkmr45invgfg3fizl73";
+ name = "plasma-nm-5.21.4.tar.xz";
};
};
plasma-pa = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-pa-5.21.3.tar.xz";
- sha256 = "16z9xzn5swrzz86yd8lykjphs92ghdsahfxjv0v9nj3ca24kfibp";
- name = "plasma-pa-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-pa-5.21.4.tar.xz";
+ sha256 = "1rcghgqvasldmpianxhn980kc3nw1knmdlmxz52kngnpnimmqmz9";
+ name = "plasma-pa-5.21.4.tar.xz";
};
};
plasma-phone-components = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-phone-components-5.21.3.tar.xz";
- sha256 = "1dhv0gdyk47dl8il6zwjdz84jmz2d4ppfyifzc2rzf0ys934scn0";
- name = "plasma-phone-components-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-phone-components-5.21.4.tar.xz";
+ sha256 = "08dpch4c6q59c9ys4n4w1hky09886hi1wqxgwwr4lyp02g3xmwbd";
+ name = "plasma-phone-components-5.21.4.tar.xz";
};
};
plasma-sdk = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-sdk-5.21.3.tar.xz";
- sha256 = "0asbb7j5b8c4kixw1yf7mdfyd8gjrf57gdb2wfs1npasak0dw84w";
- name = "plasma-sdk-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-sdk-5.21.4.tar.xz";
+ sha256 = "1cn0lq3d5ipmlwkjzarm7s5ipx6ybjv9cz93pnpxkfxlbi47q0s0";
+ name = "plasma-sdk-5.21.4.tar.xz";
};
};
plasma-systemmonitor = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-systemmonitor-5.21.3.tar.xz";
- sha256 = "1w1xzqmpzk016f8rkyx6cvm6lng3h177c441hird13n6v147l7ll";
- name = "plasma-systemmonitor-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-systemmonitor-5.21.4.tar.xz";
+ sha256 = "16mrq66qripffnj4gskzb6l52hqw9siqr8cwxq618cwk5g7hg544";
+ name = "plasma-systemmonitor-5.21.4.tar.xz";
};
};
plasma-tests = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-tests-5.21.3.tar.xz";
- sha256 = "000iwijpxxicixy5zbbgfs96h988x1d4wvjw90vagjw4hj361dk8";
- name = "plasma-tests-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-tests-5.21.4.tar.xz";
+ sha256 = "0mxl3laym3wlhqnq7pmjm1g9mm0r306dnsr3yjl5mmhdx3dwb165";
+ name = "plasma-tests-5.21.4.tar.xz";
};
};
plasma-thunderbolt = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-thunderbolt-5.21.3.tar.xz";
- sha256 = "1j0nb9p5wbgksxy19bxsz9ni9ys40r4arvs8rl8pvvv9hndqhndm";
- name = "plasma-thunderbolt-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-thunderbolt-5.21.4.tar.xz";
+ sha256 = "10r90hjm1ykigy587kdna6cydbbh9y4h7rbifx2r5rjzkhp9mihd";
+ name = "plasma-thunderbolt-5.21.4.tar.xz";
};
};
plasma-vault = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-vault-5.21.3.tar.xz";
- sha256 = "1q59q6y8gx4qbp1a5nbsg8zmrdljacfqd3i5n214nlj6al13sg9j";
- name = "plasma-vault-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-vault-5.21.4.tar.xz";
+ sha256 = "13d4z2g34skhw11wykhwyigdzxpa12pgq01i30km5cyp0idi6xy5";
+ name = "plasma-vault-5.21.4.tar.xz";
};
};
plasma-workspace = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-workspace-5.21.3.tar.xz";
- sha256 = "1djanxc7mslw9hnbzlngf6pflc6byjzqb14ibilg3fxsir2jwq40";
- name = "plasma-workspace-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-workspace-5.21.4.tar.xz";
+ sha256 = "1m98ssdq4vzhlqazd87qmgryi3fhmp68y47qw95yhaxnf12ih2xs";
+ name = "plasma-workspace-5.21.4.tar.xz";
};
};
plasma-workspace-wallpapers = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plasma-workspace-wallpapers-5.21.3.tar.xz";
- sha256 = "1qjkk3qfzz1id898kmx7xx6rr6p77y0jfwkjyf26abk51bdfk9lm";
- name = "plasma-workspace-wallpapers-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plasma-workspace-wallpapers-5.21.4.tar.xz";
+ sha256 = "1myqz90b1fcmzgq08a15mlikn83iv6hflmdw7985419w7cly81n7";
+ name = "plasma-workspace-wallpapers-5.21.4.tar.xz";
};
};
plymouth-kcm = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/plymouth-kcm-5.21.3.tar.xz";
- sha256 = "0wmpvb06z0js50c9jpv61jlxbx9sf1f5lidzs5v4xs31shxc9sbg";
- name = "plymouth-kcm-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/plymouth-kcm-5.21.4.tar.xz";
+ sha256 = "1d0na5831azka04n3j78582i3hy5ns1hpdw24y558rly16w80z60";
+ name = "plymouth-kcm-5.21.4.tar.xz";
};
};
polkit-kde-agent = {
- version = "1-5.21.3";
+ version = "1-5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/polkit-kde-agent-1-5.21.3.tar.xz";
- sha256 = "06qpkf01665mjr49wyc3f336g6g7l93k8l35q0yyih58i3v04s0v";
- name = "polkit-kde-agent-1-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/polkit-kde-agent-1-5.21.4.tar.xz";
+ sha256 = "0lg2ls4fb135p64y3kmkxczrqmqzlzdq4ywsrf58ayi42drghdmj";
+ name = "polkit-kde-agent-1-5.21.4.tar.xz";
};
};
powerdevil = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/powerdevil-5.21.3.tar.xz";
- sha256 = "0lk6bvc0mym3x3sd85bsvsxvm82vr40lcx355xjycxskf75c5jzz";
- name = "powerdevil-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/powerdevil-5.21.4.tar.xz";
+ sha256 = "0i84k7dv8nvww0pfly2d7mplydjgzdkh14sd17113rlwzyfp5wf6";
+ name = "powerdevil-5.21.4.tar.xz";
};
};
qqc2-breeze-style = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/qqc2-breeze-style-5.21.3.tar.xz";
- sha256 = "1ydvirjrkjbwfc2faz74dd9zlmfz18fa3cig143gna9rfr5api54";
- name = "qqc2-breeze-style-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/qqc2-breeze-style-5.21.4.tar.xz";
+ sha256 = "0ny9i75zm0j4m103kazs6lnny8lcmisgl6kmyvjwsnxfl0wfrdww";
+ name = "qqc2-breeze-style-5.21.4.tar.xz";
};
};
sddm-kcm = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/sddm-kcm-5.21.3.tar.xz";
- sha256 = "1flqgfpiz66s7dsw1k95zdrbj7ka09r0i2pcdygnrwlls5yvqljz";
- name = "sddm-kcm-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/sddm-kcm-5.21.4.tar.xz";
+ sha256 = "00940pi4x7is88w6b25f5chqhi97xqvnmn92jzy629p1g8zg75ik";
+ name = "sddm-kcm-5.21.4.tar.xz";
};
};
systemsettings = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/systemsettings-5.21.3.tar.xz";
- sha256 = "08ynlg282x1klgpd43mh3ng4m579iq9hjlln96fqaw19g7x1i58x";
- name = "systemsettings-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/systemsettings-5.21.4.tar.xz";
+ sha256 = "017d42fdb8dn1srni4lvdyvraaflybbcwkdgdl98vwyv9hw0qjq3";
+ name = "systemsettings-5.21.4.tar.xz";
};
};
xdg-desktop-portal-kde = {
- version = "5.21.3";
+ version = "5.21.4";
src = fetchurl {
- url = "${mirror}/stable/plasma/5.21.3/xdg-desktop-portal-kde-5.21.3.tar.xz";
- sha256 = "05r1kbw39jmj2gfn42052y779l0k89kxh7xynw07igr7c5mxy4ih";
- name = "xdg-desktop-portal-kde-5.21.3.tar.xz";
+ url = "${mirror}/stable/plasma/5.21.4/xdg-desktop-portal-kde-5.21.4.tar.xz";
+ sha256 = "01klvbvivw2zd478vj7bq0dn7l5mwsrqhnkj8hd5vc9xcaq6kgzg";
+ name = "xdg-desktop-portal-kde-5.21.4.tar.xz";
};
};
}
diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix
index 262e52c25217..71a55c68290c 100644
--- a/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix
+++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix
@@ -3,6 +3,7 @@
{ swingSupport ? true # not used for now
, lib, stdenv
, fetchurl
+, setJavaClassPath
}:
let cpuName = stdenv.hostPlatform.parsed.cpu.name;
@@ -30,7 +31,11 @@ let cpuName = stdenv.hostPlatform.parsed.cpu.name;
ln -s $out/Contents/Home/* $out/
+ # Propagate the setJavaClassPath setup hook from the JDK so that
+ # any package that depends on the JDK has $CLASSPATH set up
+ # properly.
mkdir -p $out/nix-support
+ printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
cat <> $out/nix-support/setup-hook
diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix
index a433a2f13215..e304f67bd754 100644
--- a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix
+++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix
@@ -5,6 +5,7 @@
, fetchurl
, autoPatchelfHook
, makeWrapper
+, setJavaClassPath
# minimum dependencies
, alsaLib
, fontconfig
@@ -74,7 +75,11 @@ let result = stdenv.mkDerivation rec {
# https://github.com/NixOS/nixpkgs/issues/57733
find "$out" -name 'libfreetype.so*' -delete
+ # Propagate the setJavaClassPath setup hook from the JDK so that
+ # any package that depends on the JDK has $CLASSPATH set up
+ # properly.
mkdir -p $out/nix-support
+ printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
# Set JAVA_HOME automatically.
cat <> "$out/nix-support/setup-hook"
diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix
index 58e4b3b355d2..8fc4a15efced 100644
--- a/pkgs/development/compilers/crystal/default.nix
+++ b/pkgs/development/compilers/crystal/default.nix
@@ -146,7 +146,7 @@ let
"CRYSTAL_CONFIG_VERSION=${version}"
];
- LLVM_CONFIG = "${llvmPackages.llvm}/bin/llvm-config";
+ LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config";
FLAGS = [
"--release"
diff --git a/pkgs/development/compilers/dale/default.nix b/pkgs/development/compilers/dale/default.nix
index addd7997d366..bf02d623e525 100644
--- a/pkgs/development/compilers/dale/default.nix
+++ b/pkgs/development/compilers/dale/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
sha256 = "0v4ajrzrqvf279kd7wsd9flrpsav57lzxlwwimk9vnfwh7xpzf9v";
};
- nativeBuildInputs = [ cmake pkg-config ];
+ nativeBuildInputs = [ cmake pkg-config llvm_6.dev ];
buildInputs = [ libffi llvm_6 ];
inherit doCheck;
diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix
index 1502b09cca6a..2f7991a92124 100644
--- a/pkgs/development/compilers/gcc/10/default.nix
+++ b/pkgs/development/compilers/gcc/10/default.nix
@@ -4,6 +4,7 @@
, langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin
, langGo ? false
+, reproducibleBuild ? true
, profiledCompiler ? false
, langJit ? false
, staticCompiler ? false
@@ -48,11 +49,15 @@ assert langAda -> gnatboot != null;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
+# profiledCompiler builds inject non-determinism in one of the compilation stages.
+# If turned on, we can't provide reproducible builds anymore
+assert reproducibleBuild -> profiledCompiler == false;
+
with lib;
with builtins;
let majorVersion = "10";
- version = "${majorVersion}.2.0";
+ version = "${majorVersion}.3.0";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@@ -85,7 +90,7 @@ stdenv.mkDerivation ({
src = fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
- sha256 = "130xdkhmz1bc2kzx061s3sfwk36xah1fw5w332c0nzwwpdl47pdq";
+ sha256 = "0i6378ig6h397zkhd7m4ccwjx5alvzrf2hm27p1pzwjhlv0h9x34";
};
inherit patches;
@@ -186,8 +191,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
- # TODO(@Ericson2314): Always pass "--target" and always prefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (targetPlatform != hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
configureFlags = import ../common/configure-flags.nix {
inherit
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 6a2121a82981..4ed41ba3ca1c 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -4,6 +4,7 @@
, langObjCpp ? stdenv.targetPlatform.isDarwin
, langJava ? false
, langGo ? false
+, reproducibleBuild ? true
, profiledCompiler ? false
, langJit ? false
, staticCompiler ? false
@@ -58,6 +59,10 @@ assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
+# profiledCompiler builds inject non-determinism in one of the compilation stages.
+# If turned on, we can't provide reproducible builds anymore
+assert reproducibleBuild -> profiledCompiler == false;
+
with lib;
with builtins;
@@ -196,8 +201,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
- # TODO(@Ericson2314): Always pass "--target" and always prefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (targetPlatform != hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
configureFlags = import ../common/configure-flags.nix {
inherit
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 709288559d1c..0eb0a85eaff5 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -4,6 +4,7 @@
, langObjCpp ? stdenv.targetPlatform.isDarwin
, langJava ? false
, langGo ? false
+, reproducibleBuild ? true
, profiledCompiler ? false
, langJit ? false
, staticCompiler ? false
@@ -58,6 +59,10 @@ assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
+# profiledCompiler builds inject non-determinism in one of the compilation stages.
+# If turned on, we can't provide reproducible builds anymore
+assert reproducibleBuild -> profiledCompiler == false;
+
with lib;
with builtins;
@@ -209,8 +214,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
- # TODO(@Ericson2314): Always pass "--target" and always prefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (targetPlatform != hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
configureFlags = import ../common/configure-flags.nix {
inherit
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index 93c9dde61fc3..32a4ad0dd090 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -5,6 +5,7 @@
, langObjCpp ? stdenv.targetPlatform.isDarwin
, langJava ? false
, langGo ? false
+, reproducibleBuild ? true
, profiledCompiler ? false
, langJit ? false
, staticCompiler ? false
@@ -61,6 +62,10 @@ assert langAda -> gnatboot != null;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
+# profiledCompiler builds inject non-determinism in one of the compilation stages.
+# If turned on, we can't provide reproducible builds anymore
+assert reproducibleBuild -> profiledCompiler == false;
+
with lib;
with builtins;
@@ -232,8 +237,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
- # TODO(@Ericson2314): Always pass "--target" and always prefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (targetPlatform != hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
configureFlags = import ../common/configure-flags.nix {
inherit
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index d9b4c639b5ab..33edc81ce539 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -3,6 +3,7 @@
, langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin
, langGo ? false
+, reproducibleBuild ? true
, profiledCompiler ? false
, langJit ? false
, staticCompiler ? false
@@ -45,6 +46,10 @@ assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
+# profiledCompiler builds inject non-determinism in one of the compilation stages.
+# If turned on, we can't provide reproducible builds anymore
+assert reproducibleBuild -> profiledCompiler == false;
+
with lib;
with builtins;
@@ -197,8 +202,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
- # TODO(@Ericson2314): Always pass "--target" and always prefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (targetPlatform != hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
configureFlags = import ../common/configure-flags.nix {
inherit
diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix
index 4edc034720c4..dae98afccb90 100644
--- a/pkgs/development/compilers/gcc/8/default.nix
+++ b/pkgs/development/compilers/gcc/8/default.nix
@@ -3,6 +3,7 @@
, langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin
, langGo ? false
+, reproducibleBuild ? true
, profiledCompiler ? false
, langJit ? false
, staticCompiler ? false
@@ -45,6 +46,10 @@ assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
+# profiledCompiler builds inject non-determinism in one of the compilation stages.
+# If turned on, we can't provide reproducible builds anymore
+assert reproducibleBuild -> profiledCompiler == false;
+
with lib;
with builtins;
@@ -183,8 +188,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
- # TODO(@Ericson2314): Always pass "--target" and always prefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (targetPlatform != hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
configureFlags = import ../common/configure-flags.nix {
inherit
diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix
index ca92a8f48450..ebe20e0cba5c 100644
--- a/pkgs/development/compilers/gcc/9/default.nix
+++ b/pkgs/development/compilers/gcc/9/default.nix
@@ -5,6 +5,7 @@
, langObjCpp ? stdenv.targetPlatform.isDarwin
, langD ? false
, langGo ? false
+, reproducibleBuild ? true
, profiledCompiler ? false
, langJit ? false
, staticCompiler ? false
@@ -54,6 +55,10 @@ assert langAda -> gnatboot != null;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
+# profiledCompiler builds inject non-determinism in one of the compilation stages.
+# If turned on, we can't provide reproducible builds anymore
+assert reproducibleBuild -> profiledCompiler == false;
+
with lib;
with builtins;
@@ -200,8 +205,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
- # TODO(@Ericson2314): Always pass "--target" and always prefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (targetPlatform != hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
configureFlags = import ../common/configure-flags.nix {
inherit
diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix
index 7f7a40f3368d..42deb970dfea 100644
--- a/pkgs/development/compilers/gcc/common/configure-flags.nix
+++ b/pkgs/development/compilers/gcc/common/configure-flags.nix
@@ -44,6 +44,9 @@ let
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
+ targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
+ "${stdenv.targetPlatform.config}-";
+
crossConfigureFlags =
# Ensure that -print-prog-name is able to find the correct programs.
[
@@ -112,6 +115,18 @@ let
# Basic configuration
++ [
+ # Force target prefix. The behavior if `--target` and `--host`
+ # are specified is inconsistent: Sometimes specifying `--target`
+ # always causes a prefix to be generated, sometimes it's only
+ # added if the `--host` and `--target` differ. This means that
+ # sometimes there may be a prefix even though nixpkgs doesn't
+ # expect one and sometimes there may be none even though nixpkgs
+ # expects one (since not all information is serialized into the
+ # config attribute). The easiest way out of these problems is to
+ # always set the program prefix, so gcc will conform to our
+ # expectations.
+ "--program-prefix=${targetPrefix}"
+
(lib.enableFeature enableLTO "lto")
"--disable-libstdcxx-pch"
"--without-included-gettext"
diff --git a/pkgs/development/compilers/ghdl/default.nix b/pkgs/development/compilers/ghdl/default.nix
index ec07331dc52b..e7886eb8f5ed 100644
--- a/pkgs/development/compilers/ghdl/default.nix
+++ b/pkgs/development/compilers/ghdl/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
'';
configureFlags = [ "--enable-synth" ] ++ lib.optional (backend == "llvm")
- "--with-llvm-config=${llvm}/bin/llvm-config";
+ "--with-llvm-config=${llvm.dev}/bin/llvm-config";
hardeningDisable = [ "format" ];
diff --git a/pkgs/development/compilers/intel-graphics-compiler/default.nix b/pkgs/development/compilers/intel-graphics-compiler/default.nix
index 512865829607..75687de4e9e2 100644
--- a/pkgs/development/compilers/intel-graphics-compiler/default.nix
+++ b/pkgs/development/compilers/intel-graphics-compiler/default.nix
@@ -18,7 +18,7 @@ let
inherit spirv-llvm-translator;
};
inherit (llvmPkgs) llvm;
- inherit (if buildWithPatches then opencl-clang else llvmPkgs) clang clang-unwrapped spirv-llvm-translator;
+ inherit (if buildWithPatches then opencl-clang else llvmPkgs) clang libclang spirv-llvm-translator;
inherit (lib) getVersion optional optionals versionOlder versions;
in
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
ln -s ${clang}/bin/clang $out/
ln -s clang $out/clang-${versions.major (getVersion clang)}
ln -s ${opencl-clang}/lib/* $out/
- ln -s ${clang-unwrapped}/lib/clang/${getVersion clang}/include/opencl-c.h $out/
+ ln -s ${lib.getLib libclang}/lib/clang/${getVersion clang}/include/opencl-c.h $out/
'';
};
diff --git a/pkgs/development/compilers/ispc/default.nix b/pkgs/development/compilers/ispc/default.nix
index fd7481587115..bbe17e0755ce 100644
--- a/pkgs/development/compilers/ispc/default.nix
+++ b/pkgs/development/compilers/ispc/default.nix
@@ -28,10 +28,9 @@ stdenv.mkDerivation rec {
})
];
- nativeBuildInputs = [ cmake which m4 bison flex python3 ];
+ nativeBuildInputs = [ cmake which m4 bison flex python3 llvmPackages.llvm.dev ];
buildInputs = with llvmPackages; [
- # we need to link against libclang, so we need the unwrapped
- llvm llvmPackages.clang-unwrapped
+ llvm llvmPackages.libclang
];
postPatch = ''
@@ -66,6 +65,7 @@ stdenv.mkDerivation rec {
'';
cmakeFlags = [
+ "-DLLVM_CONFIG_EXECUTABLE=${llvmPackages.llvm.dev}/bin/llvm-config"
"-DCLANG_EXECUTABLE=${llvmPackages.clang}/bin/clang"
"-DCLANGPP_EXECUTABLE=${llvmPackages.clang}/bin/clang++"
"-DISPC_INCLUDE_EXAMPLES=OFF"
diff --git a/pkgs/development/compilers/ldc/generic.nix b/pkgs/development/compilers/ldc/generic.nix
index 4261c2b65334..f79fb24a56b4 100644
--- a/pkgs/development/compilers/ldc/generic.nix
+++ b/pkgs/development/compilers/ldc/generic.nix
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
'';
nativeBuildInputs = [
- cmake ldcBootstrap lit lit.python llvm_11 makeWrapper ninja unzip
+ cmake ldcBootstrap lit lit.python llvm_11.dev makeWrapper ninja unzip
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.Foundation
diff --git a/pkgs/development/compilers/llvm/10/clang/default.nix b/pkgs/development/compilers/llvm/10/clang/default.nix
index 35b7ab313d8e..d228c4261afe 100644
--- a/pkgs/development/compilers/llvm/10/clang/default.nix
+++ b/pkgs/development/compilers/llvm/10/clang/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
+{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
}:
@@ -18,28 +19,33 @@ let
mv clang-tools-extra-* $sourceRoot/tools/extra
'';
- nativeBuildInputs = [ cmake python3 lld ]
+ nativeBuildInputs = [ cmake python3 ]
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
- buildInputs = [ libxml2 llvm ];
+ buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++14"
"-DCLANGD_BUILD_XPC=OFF"
"-DLLVM_ENABLE_RTTI=ON"
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
];
patches = [
./purity.patch
# https://reviews.llvm.org/D51899
./compiler-rt-baremetal.patch
+ ./gnu-install-dirs.patch
];
postPatch = ''
@@ -56,12 +62,12 @@ let
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
'';
- outputs = [ "out" "lib" "python" ];
+ outputs = [ "out" "lib" "dev" "python" ];
# Clang expects to find LLVMgold in its own prefix
postInstall = ''
- if [ -e ${llvm}/lib/LLVMgold.so ]; then
- ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+ if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
+ ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
fi
ln -sv $out/bin/clang $out/bin/cpp
@@ -80,11 +86,14 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
+
+ mkdir -p $dev/bin
+ cp bin/clang-tblgen $dev/bin
'';
passthru = {
isClang = true;
- inherit llvm;
+ inherit libllvm;
};
meta = {
diff --git a/pkgs/development/compilers/llvm/10/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/clang/gnu-install-dirs.patch
new file mode 100644
index 000000000000..454c81875eab
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/clang/gnu-install-dirs.patch
@@ -0,0 +1,248 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index dc1413f4b597..c173531e624f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,6 +9,8 @@ endif()
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ project(Clang)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ if(LLVM_CONFIG)
+@@ -417,7 +419,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/clang include/clang-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT clang-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -427,7 +429,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT clang-headers
+ FILES_MATCHING
+ PATTERN "CMakeFiles" EXCLUDE
+@@ -447,7 +449,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
+ install(PROGRAMS utils/bash-autocomplete.sh
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT bash-autocomplete)
+ if(NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-bash-autocomplete
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index 577cc11ab015..a4f4481d8442 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -114,9 +114,9 @@ macro(add_clang_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_clangtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${name}
+@@ -160,7 +160,7 @@ macro(add_clang_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_clangtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT LLVM_ENABLE_IDE)
+@@ -175,7 +175,7 @@ endmacro()
+ macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+
+ function(clang_target_link_libraries target type)
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index 85c3124234ad..64c48235d914 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -191,7 +191,7 @@ set_target_properties(clang-resource-headers PROPERTIES
+ FOLDER "Misc"
+ RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
+
+-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${files} ${generated_files}
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index ceef4b08637c..8efad5520ca4 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
+ "@executable_path/../../lib")
+ else()
+- set(INSTALL_DESTINATION bin)
++ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+
+ install(TARGETS c-index-test
+diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
+index 35ecdb11253c..d77d75de0094 100644
+--- a/tools/clang-format/CMakeLists.txt
++++ b/tools/clang-format/CMakeLists.txt
+@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
+ endif()
+
+ install(PROGRAMS clang-format-bbedit.applescript
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-diff.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-sublime.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS git-clang-format
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT clang-format)
+diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
+index cda8e29ec5b1..0134d8ccd70b 100644
+--- a/tools/clang-rename/CMakeLists.txt
++++ b/tools/clang-rename/CMakeLists.txt
+@@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
+ )
+
+ install(PROGRAMS clang-rename.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+ install(PROGRAMS clang-rename.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+diff --git a/tools/diagtool/CMakeLists.txt b/tools/diagtool/CMakeLists.txt
+index a95444be40ee..136d96d9bf5b 100644
+--- a/tools/diagtool/CMakeLists.txt
++++ b/tools/diagtool/CMakeLists.txt
+@@ -21,7 +21,7 @@ clang_target_link_libraries(diagtool
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(TARGETS diagtool
+ COMPONENT diagtool
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-diagtool
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 973655361f71..0181002e4e3b 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -141,7 +141,7 @@ endif()
+ if(INTERNAL_INSTALL_PREFIX)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
+ else()
+- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
++ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ endif()
+
+ install(DIRECTORY ../../include/clang-c
+@@ -172,7 +172,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
+ COMPONENT
+ libclang-python-bindings
+ DESTINATION
+- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
++ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ endforeach()
+ if(NOT LLVM_ENABLE_IDE)
+ add_custom_target(libclang-python-bindings)
+diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
+index 28241245fcb7..d6b59f02fc2a 100644
+--- a/tools/scan-build/CMakeLists.txt
++++ b/tools/scan-build/CMakeLists.txt
+@@ -42,7 +42,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+ install(PROGRAMS bin/${BinFile}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT scan-build)
+ endforeach()
+
+@@ -56,7 +56,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
+ install(PROGRAMS libexec/${LibexecFile}
+- DESTINATION libexec
++ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
+ COMPONENT scan-build)
+ endforeach()
+
+@@ -84,7 +84,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+ install(FILES share/scan-build/${ShareFile}
+- DESTINATION share/scan-build
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
+ COMPONENT scan-build)
+ endforeach()
+
+diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
+index 22edb974bac7..9f140a9a4538 100644
+--- a/tools/scan-view/CMakeLists.txt
++++ b/tools/scan-view/CMakeLists.txt
+@@ -22,7 +22,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+ install(PROGRAMS bin/${BinFile}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT scan-view)
+ endforeach()
+
+@@ -36,7 +36,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+ install(FILES share/${ShareFile}
+- DESTINATION share/scan-view
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
+ COMPONENT scan-view)
+ endforeach()
+
+diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
+index 62f2de0cb15c..6aa66825b6ec 100644
+--- a/utils/hmaptool/CMakeLists.txt
++++ b/utils/hmaptool/CMakeLists.txt
+@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
+
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
+ install(PROGRAMS ${CLANG_HMAPTOOL}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT hmaptool)
+
+ add_custom_target(hmaptool ALL DEPENDS ${Depends})
diff --git a/pkgs/development/compilers/llvm/10/compiler-rt/default.nix b/pkgs/development/compilers/llvm/10/compiler-rt/default.nix
index 1d759c903fc9..1f990ac433d2 100644
--- a/pkgs/development/compilers/llvm/10/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/10/compiler-rt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
inherit version;
src = fetch pname "1yjqjri753w0fzmxcyz687nvd97sbc9rsqrxzpq720na47hwh3fr";
- nativeBuildInputs = [ cmake python3 llvm ];
+ nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
NIX_CFLAGS_COMPILE = [
@@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
patches = [
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
./find-darwin-sdk-version.patch # don't test for macOS being >= 10.15
+ ./gnu-install-dirs.patch
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
diff --git a/pkgs/development/compilers/llvm/10/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 000000000000..db0bd006eaf2
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,129 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8d768a404f21..74551dc5a004 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,6 +12,7 @@ endif()
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+ project(CompilerRT C CXX ASM)
++ include(GNUInstallDirs)
+ set(COMPILER_RT_STANDALONE_BUILD TRUE)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ endif()
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index 35a48c6af29c..e4300f256091 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -493,7 +493,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ # Install in Clang resource directory.
+ install(FILES ${file_name}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+@@ -510,7 +510,7 @@ macro(add_compiler_rt_script name)
+ add_custom_target(${name} DEPENDS ${dst})
+ install(FILES ${dst}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
+ endmacro(add_compiler_rt_script src name)
+
+ # Builds custom version of libc++ and installs it in .
+diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
+index 9f501a61c4b6..f9a0d92dbca0 100644
+--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
+@@ -440,7 +440,7 @@ macro(darwin_add_embedded_builtin_libraries)
+ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
+
+ set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+ set(CFLAGS_i386 "-march=pentium")
+diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
+index 6e672b1e1818..64999709958e 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -371,7 +371,7 @@ endfunction()
+ function(get_compiler_rt_install_dir arch install_dir)
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ get_compiler_rt_target(${arch} target)
+- set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
++ set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE)
+ else()
+ set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
+ endif()
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index b4b87aa53073..f1ae8668837c 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -65,11 +65,11 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+ # Take output dir and install path from the user.
+ set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+- "Path where built compiler-rt libraries should be stored.")
++ "Path where built compiler-rt build artifacts should be stored.")
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+ "Path where built compiler-rt executables should be stored.")
+- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+- "Path where built compiler-rt libraries should be installed.")
++ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
++ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
+ # Use a host compiler to compile/link tests.
+@@ -97,7 +97,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
+ set(COMPILER_RT_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+ endif()
+
+ if(APPLE)
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index d47d7baeb118..507c8e5c713e 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -62,22 +62,22 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
+ install(FILES ${SANITIZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
+ # Install fuzzer headers.
+ install(FILES ${FUZZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
+ # Install xray headers.
+ install(FILES ${XRAY_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
+ # Install profile headers.
+ install(FILES ${PROFILE_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
+ add_custom_target(install-compiler-rt-headers
+diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
+index 051215edbeb7..ecce1f52efb0 100644
+--- a/lib/dfsan/CMakeLists.txt
++++ b/lib/dfsan/CMakeLists.txt
+@@ -56,4 +56,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
+ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
+ add_dependencies(dfsan dfsan_abilist)
+ install(FILES ${dfsan_abilist_filename}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/pkgs/development/compilers/llvm/10/default.nix b/pkgs/development/compilers/llvm/10/default.nix
index 3fa91cd83749..e2e78e16d797 100644
--- a/pkgs/development/compilers/llvm/10/default.nix
+++ b/pkgs/development/compilers/llvm/10/default.nix
@@ -1,6 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildPackages
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@@ -18,31 +17,39 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "06n1yp638rh24xdxv9v2df0qajxbjz4w59b7dd4ky36drwmpi4yh";
tools = lib.makeExtensible (tools: let
- callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
- mkExtraBuildCommands = cc: ''
+ callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
+ mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
- ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
- ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
+ ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
+ mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
+ ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+ ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
+ '';
+
in {
- llvm = callPackage ./llvm { };
+ libllvm = callPackage ./llvm { };
- clang-unwrapped = callPackage ./clang {
- inherit (tools) lld;
+ # `llvm` historically had the binaries. When choosing an output explicitly,
+ # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
+ llvm = tools.libllvm.out // { outputUnspecified = true; };
+
+ libclang = callPackage ./clang {
inherit clang-tools-extra_src;
};
+ clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
+
# disabled until recommonmark supports sphinx 3
- #Llvm-manpages = lowPrio (tools.llvm.override {
+ #Llvm-manpages = lowPrio (tools.libllvm.override {
# enableManpages = true;
# python3 = pkgs.python3; # don't use python-boot
#});
- clang-manpages = lowPrio (tools.clang-unwrapped.override {
+ clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
@@ -53,8 +60,6 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });
- libclang = tools.clang-unwrapped.lib;
-
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
@@ -144,7 +149,7 @@ let
'' + mkExtraBuildCommands cc;
};
- lldClangNoCompilerRt = wrapCCWith {
+ lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
@@ -154,7 +159,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
- '';
+ '' + mkExtraBuildCommands0 cc;
};
});
diff --git a/pkgs/development/compilers/llvm/10/libc++/default.nix b/pkgs/development/compilers/llvm/10/libc++/default.nix
index a3fb09273451..1e5dc5b2dacc 100644
--- a/pkgs/development/compilers/llvm/10/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/10/libc++/default.nix
@@ -13,7 +13,11 @@ stdenv.mkDerivation {
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
'';
- patches = lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
+ outputs = [ "out" "dev" ];
+
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
preConfigure = ''
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
diff --git a/pkgs/development/compilers/llvm/10/libc++/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/libc++/gnu-install-dirs.patch
new file mode 100644
index 000000000000..4b031e90bdd5
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/libc++/gnu-install-dirs.patch
@@ -0,0 +1,99 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 60564dc96c7b..77d832ad5a44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,6 +26,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
+ project(libcxx CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxx)
+ set(PACKAGE_VERSION 10.0.1)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+@@ -415,7 +417,7 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
+ string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
+@@ -423,10 +425,10 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+ set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
+ else()
+ set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
+ endif()
+
+ file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
+diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
+index 10f100f7f0fb..95ed3978ab73 100644
+--- a/cmake/Modules/HandleLibCXXABI.cmake
++++ b/cmake/Modules/HandleLibCXXABI.cmake
+@@ -61,7 +61,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
+
+ if (LIBCXX_INSTALL_HEADERS)
+ install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
+ COMPONENT cxx-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index 302da8a131b4..4c6ab463f564 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -244,7 +244,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ foreach(file ${files})
+ get_filename_component(dir ${file} DIRECTORY)
+ install(FILES ${file}
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
+ COMPONENT ${CXX_HEADER_TARGET}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+@@ -253,7 +253,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ if (LIBCXX_NEEDS_SITE_CONFIG)
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT ${CXX_HEADER_TARGET})
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 120505fe18da..9b8456d8405a 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -341,21 +341,21 @@ if (LIBCXX_INSTALL_LIBRARY)
+ install(TARGETS cxx_shared
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ if (LIBCXX_INSTALL_STATIC_LIBRARY)
+ install(TARGETS cxx_static
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
+ install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib}
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ # NOTE: This install command must go after the cxx install command otherwise
diff --git a/pkgs/development/compilers/llvm/10/libc++abi/default.nix b/pkgs/development/compilers/llvm/10/libc++abi/default.nix
index 1909996614dc..bc5e77b739d7 100644
--- a/pkgs/development/compilers/llvm/10/libc++abi/default.nix
+++ b/pkgs/development/compilers/llvm/10/libc++abi/default.nix
@@ -8,6 +8,25 @@ stdenv.mkDerivation {
src = fetch "libcxxabi" "0yqs722y76cwvmfsq0lb917r9m3fci7bf5z3yzl71yz9n88ghzm9";
+ outputs = [ "out" "dev" ];
+
+ postUnpack = ''
+ unpackFile ${libcxx.src}
+ unpackFile ${llvm.src}
+ cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
+ '' + lib.optionalString stdenv.isDarwin ''
+ export TRIPLE=x86_64-apple-darwin
+ '' + lib.optionalString stdenv.hostPlatform.isMusl ''
+ patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
+ '' + lib.optionalString stdenv.hostPlatform.isWasm ''
+ patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
+ '';
+
+ patches = [
+ ./no-threads.patch
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
@@ -21,20 +40,6 @@ stdenv.mkDerivation {
"-DLIBCXXABI_ENABLE_SHARED=OFF"
];
- patches = [ ./no-threads.patch ];
-
- postUnpack = ''
- unpackFile ${libcxx.src}
- unpackFile ${llvm.src}
- cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
- '' + lib.optionalString stdenv.isDarwin ''
- export TRIPLE=x86_64-apple-darwin
- '' + lib.optionalString stdenv.hostPlatform.isMusl ''
- patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
- '' + lib.optionalString stdenv.hostPlatform.isWasm ''
- patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
- '';
-
installPhase = if stdenv.isDarwin
then ''
for file in lib/*.dylib; do
diff --git a/pkgs/development/compilers/llvm/10/libc++abi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/libc++abi/gnu-install-dirs.patch
new file mode 100644
index 000000000000..0f80ade7c389
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/libc++abi/gnu-install-dirs.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8f9572586b4a..bf0e41dfc751 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD)
+ project(libcxxabi CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxxabi)
+ set(PACKAGE_VERSION 10.0.1)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+@@ -214,17 +216,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
+ string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
+ endif()
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
+ else()
+ set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
+ endif()
+
+ set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.")
diff --git a/pkgs/development/compilers/llvm/10/libunwind/default.nix b/pkgs/development/compilers/llvm/10/libunwind/default.nix
index f0f45780a22c..d010deb66186 100644
--- a/pkgs/development/compilers/llvm/10/libunwind/default.nix
+++ b/pkgs/development/compilers/llvm/10/libunwind/default.nix
@@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
src = fetch pname "09syx66idnm2pr46x2vmk0jn3iwdv0lkd04xy4zjbwmz3vn066bl";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
+ outputs = [ "out" "dev" ];
+
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
diff --git a/pkgs/development/compilers/llvm/10/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/libunwind/gnu-install-dirs.patch
new file mode 100644
index 000000000000..8cea7d3e3341
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/libunwind/gnu-install-dirs.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c033069ef1d0..e2846896eece 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
+ project(libunwind)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ if(NOT LLVM_CONFIG_PATH)
+@@ -189,17 +191,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+ string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+ endif()
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
+ else()
+ set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
+ endif()
+
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
diff --git a/pkgs/development/compilers/llvm/10/lld/default.nix b/pkgs/development/compilers/llvm/10/lld/default.nix
index a94c1b5b0dd3..03a48f02a0c1 100644
--- a/pkgs/development/compilers/llvm/10/lld/default.nix
+++ b/pkgs/development/compilers/llvm/10/lld/default.nix
@@ -1,8 +1,9 @@
{ lib, stdenv
+, buildLlvmTools
, fetch
, cmake
, libxml2
-, llvm
+, libllvm
, version
}:
@@ -12,15 +13,20 @@ stdenv.mkDerivation rec {
src = fetch pname "0ynzi35r4fckvp6842alpd43qr810j3728yfslc66fk2mbh4j52r";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvm libxml2 ];
+ buildInputs = [ libllvm libxml2 ];
- outputs = [ "out" "dev" ];
+ cmakeFlags = [
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ ];
- postInstall = ''
- moveToOutput include "$dev"
- moveToOutput lib "$dev"
- '';
+ outputs = [ "out" "lib" "dev" ];
meta = {
description = "The LLVM Linker";
diff --git a/pkgs/development/compilers/llvm/10/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/lld/gnu-install-dirs.patch
new file mode 100644
index 000000000000..232f5cbac9dd
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/lld/gnu-install-dirs.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 641f71c114ae..9d44c1463aff 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(LLD_BUILT_STANDALONE TRUE)
+
++ include(GNUInstallDirs)
++
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
+ if(NOT LLVM_CONFIG_PATH)
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
+@@ -202,7 +204,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index fa48b428d26b..e7967aad3ceb 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -20,9 +20,9 @@ macro(add_lld_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -54,7 +54,7 @@ macro(add_lld_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_lldtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -69,5 +69,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
+index a15e296e31df..654c2cfdb9c0 100644
+--- a/tools/lld/CMakeLists.txt
++++ b/tools/lld/CMakeLists.txt
+@@ -17,7 +17,7 @@ target_link_libraries(lld
+ )
+
+ install(TARGETS lld
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(NOT LLD_SYMLINKS_TO_CREATE)
+ set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)
diff --git a/pkgs/development/compilers/llvm/10/lldb/default.nix b/pkgs/development/compilers/llvm/10/lldb/default.nix
index 7fb8ed57a01f..ccca340b3e23 100644
--- a/pkgs/development/compilers/llvm/10/lldb/default.nix
+++ b/pkgs/development/compilers/llvm/10/lldb/default.nix
@@ -7,8 +7,8 @@
, which
, libedit
, libxml2
-, llvm
-, clang-unwrapped
+, libllvm
+, libclang
, python3
, version
, darwin
@@ -22,19 +22,22 @@ stdenv.mkDerivation (rec {
src = fetch pname "051p5b04y6z3g730rmc2n2v71lipbw7k69riww3a6sl74myfiaq7";
- patches = [ ./procfs.patch ];
+ patches = [
+ ./procfs.patch
+ ./gnu-install-dirs.patch
+ ];
- nativeBuildInputs = [ cmake python3 which swig lit ]
- ++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
+ outputs = [ "out" "lib" "dev" ];
+
+ nativeBuildInputs = [
+ cmake python3 which swig lit
+ ] ++ lib.optionals enableManpages [
+ python3.pkgs.sphinx python3.pkgs.recommonmark
+ ];
buildInputs = [
- ncurses
- zlib
- libedit
- libxml2
- llvm
- ]
- ++ lib.optionals stdenv.isDarwin [
+ ncurses zlib libedit libxml2 libllvm
+ ] ++ lib.optionals stdenv.isDarwin [
darwin.libobjc
darwin.apple_sdk.libs.xpc
darwin.apple_sdk.frameworks.Foundation
@@ -46,8 +49,9 @@ stdenv.mkDerivation (rec {
hardeningDisable = [ "format" ];
cmakeFlags = [
+ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
"-DLLVM_ENABLE_RTTI=OFF"
- "-DClang_DIR=${clang-unwrapped}/lib/cmake"
+ "-DClang_DIR=${libclang.dev}/lib/cmake"
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
] ++ lib.optionals stdenv.isDarwin [
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
@@ -57,33 +61,38 @@ stdenv.mkDerivation (rec {
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
+ ] ++ lib.optionals doCheck [
+ "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
];
+ doCheck = false;
+
postInstall = ''
# Editor support
# vscode:
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
- ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
+ ln -s $out/bin/llvm-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
'';
meta = with lib; {
description = "A next-generation high-performance debugger";
- homepage = "https://lldb.llvm.org";
- license = licenses.ncsa;
- platforms = platforms.all;
+ homepage = "https://lldb.llvm.org";
+ license = licenses.ncsa;
+ platforms = platforms.all;
};
} // lib.optionalAttrs enableManpages {
pname = "lldb-manpages";
buildPhase = ''
- make docs-lldb-man
+ make docs-man
'';
propagatedBuildInputs = [];
+ # manually install lldb man page
installPhase = ''
- # manually install lldb man page
mkdir -p $out/share/man/man1
install docs/man/lldb.1 -t $out/share/man/man1/
'';
diff --git a/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch
new file mode 100644
index 000000000000..053a580e45ec
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/lldb/gnu-install-dirs.patch
@@ -0,0 +1,65 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 573b8556989e..a12cc6f6ba77 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -17,6 +17,8 @@ set(CMAKE_MODULE_PATH
+ # If we are not building as part of LLVM, build LLDB as a standalone project,
+ # using LLVM as an external library.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
++ include(GNUInstallDirs)
++
+ project(lldb)
+ include(LLDBStandalone)
+
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index ecf0b66a41a3..6f2d97af7a11 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -107,13 +107,13 @@ function(add_lldb_library name)
+ endif()
+
+ if(PARAM_SHARED)
+- set(install_dest lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(PARAM_INSTALL_PREFIX)
+ set(install_dest ${PARAM_INSTALL_PREFIX})
+ endif()
+ # RUNTIME is relevant for DLL platforms, FRAMEWORK for macOS
+ install(TARGETS ${name} COMPONENT ${name}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${install_dest}
+ ARCHIVE DESTINATION ${install_dest}
+ FRAMEWORK DESTINATION ${install_dest})
+diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
+index 4a15a343ee1d..c74bbb6878d7 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -238,7 +238,7 @@ include_directories(BEFORE
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+@@ -247,7 +247,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
+index aff75d7db334..98a527c5e761 100644
+--- a/tools/intel-features/CMakeLists.txt
++++ b/tools/intel-features/CMakeLists.txt
+@@ -64,4 +64,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ endif()
+
+ install(TARGETS lldbIntelFeatures
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/pkgs/development/compilers/llvm/10/llvm/default.nix b/pkgs/development/compilers/llvm/10/llvm/default.nix
index 3100eaf4db4d..22ed308486db 100644
--- a/pkgs/development/compilers/llvm/10/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/10/llvm/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv
+, pkgsBuildBuild
, fetch
, cmake
, python3
@@ -10,10 +11,10 @@
, version
, release_version
, zlib
-, buildPackages
+, buildLlvmTools
, debugVersion ? false
, enableManpages ? false
-, enableSharedLibraries ? true
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
, enablePFM ? !(stdenv.isDarwin
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|| stdenv.isAarch32 # broken for the armv7l builder
@@ -44,8 +45,7 @@ in stdenv.mkDerivation (rec {
mv polly-* $sourceRoot/tools/polly
'';
- outputs = [ "out" "python" ]
- ++ optional enableSharedLibraries "lib";
+ outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python3 ]
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
@@ -55,10 +55,14 @@ in stdenv.mkDerivation (rec {
propagatedBuildInputs = [ ncurses zlib ];
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
+
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
- --replace 'set(_install_rpath "@loader_path/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
+ --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
@@ -97,6 +101,7 @@ in stdenv.mkDerivation (rec {
'';
cmakeFlags = with stdenv; [
+ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
@@ -120,7 +125,20 @@ in stdenv.mkDerivation (rec {
"-DCAN_TARGET_i386=false"
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
- "-DLLVM_TABLEGEN=${buildPackages.llvm_10}/bin/llvm-tblgen"
+ "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ (
+ let
+ nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+ nativeBintools = nativeCC.bintools.bintools;
+ nativeToolchainFlags = [
+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+ ];
+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+ )
];
postBuild = ''
@@ -134,20 +152,19 @@ in stdenv.mkDerivation (rec {
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
- ''
- + optionalString enableSharedLibraries ''
- moveToOutput "lib/libLLVM-*" "$lib"
- moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- ''
- + optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+ moveToOutput "bin/llvm-config*" "$dev"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+ --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+ --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
+ ''
+ + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32);
diff --git a/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 000000000000..3353058d8ab1
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,106 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index 9939097f743e..8cc538da912a 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -2,7 +2,11 @@
+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ project(Polly)
+ cmake_minimum_required(VERSION 3.4.3)
++endif()
++
++include(GNUInstallDirs)
+
++if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ # Where is LLVM installed?
+ find_package(LLVM CONFIG REQUIRED)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -145,14 +149,14 @@ include_directories(
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+ )
+
+ install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 211f95512717..f9e04a4844b6 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
+- "${POLLY_INSTALL_PREFIX}/include/polly"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+ )
+ else()
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+ ${ISL_INCLUDE_DIRS}
+ )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+ get_target_property(tgt_type ${tgt} TYPE)
+ if (tgt_type STREQUAL "EXECUTABLE")
+- set(tgt_prefix "bin/")
++ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+ else()
+- set(tgt_prefix "lib/")
++ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+ endif()
+
+- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
++ set(tgt_path "${tgt_prefix}$")
+ file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+
+ if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index 86de6f10686e..91f30891ccbe 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index 8ffd984e542b..261cc19f3238 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -274,7 +274,7 @@ if (POLLY_BUNDLED_ISL)
+ install(DIRECTORY
+ ${ISL_SOURCE_DIR}/include/
+ ${ISL_BINARY_DIR}/include/
+- DESTINATION include/polly
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs.patch
new file mode 100644
index 000000000000..155bab32f439
--- /dev/null
+++ b/pkgs/development/compilers/llvm/10/llvm/gnu-install-dirs.patch
@@ -0,0 +1,416 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0e85afa82c76..3e700d9c5fae 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -253,15 +253,21 @@ if (CMAKE_BUILD_TYPE AND
+ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ endif()
+
++include(GNUInstallDirs)
++
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
++set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
++ "Path for binary subdirectory (defaults to 'bin')")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
+ set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
+ "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
+ mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
+
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+@@ -527,9 +533,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
+ option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+
+-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
++set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
+ CACHE STRING "Doxygen-generated HTML documentation install directory")
+-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
++set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
+ CACHE STRING "OCamldoc-generated HTML documentation install directory")
+
+ option (LLVM_BUILD_EXTERNAL_COMPILER_RT
+@@ -993,7 +999,7 @@ endif()
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -1005,7 +1011,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -1020,13 +1026,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ if (LLVM_INSTALL_MODULEMAPS)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "module.modulemap"
+ )
+ install(FILES include/llvm/module.install.modulemap
+- DESTINATION include/llvm
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
+ COMPONENT llvm-headers
+ RENAME "module.extern.modulemap"
+ )
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index f5a1b0d6f238..a7387224d68f 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -729,9 +729,9 @@ macro(add_llvm_library name)
+
+ install(TARGETS ${name}
+ ${export_to_llvmexports}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+- RUNTIME DESTINATION bin COMPONENT ${name})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${name}
+@@ -934,7 +934,7 @@ function(process_llvm_pass_plugins)
+ "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
+ install(FILES
+ ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
+- DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
++ DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
+ COMPONENT cmake-exports)
+
+ set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
+@@ -1147,7 +1147,7 @@ macro(add_llvm_example name)
+ endif()
+ add_llvm_executable(${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endmacro(add_llvm_example name)
+@@ -1713,7 +1713,7 @@ function(llvm_install_library_symlink name dest type)
+ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+
+- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 AND "${type}" STREQUAL "SHARED")
+ set(output_dir bin)
+ endif()
+@@ -1730,7 +1730,7 @@ function(llvm_install_library_symlink name dest type)
+ endif()
+ endfunction()
+
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+ cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+ foreach(path ${CMAKE_MODULE_PATH})
+ if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1753,7 +1753,7 @@ function(llvm_install_symlink name dest)
+ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+
+ install(SCRIPT ${INSTALL_SYMLINK}
+- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+ COMPONENT ${component})
+
+ if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
+@@ -1836,7 +1836,8 @@ function(add_llvm_tool_symlink link_name target)
+ endif()
+
+ if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+- llvm_install_symlink(${link_name} ${target})
++ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++ llvm_install_symlink(${link_name} ${target} ${output_dir})
+ endif()
+ endif()
+ endfunction()
+@@ -1958,9 +1959,9 @@ function(llvm_setup_rpath name)
+
+ if (APPLE)
+ set(_install_name_dir INSTALL_NAME_DIR "@rpath")
+- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ elseif(UNIX)
+- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 554046b20edf..4d1ad980641e 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -144,9 +144,9 @@ function(add_ocaml_library name)
+ endforeach()
+
+ if( APPLE )
+- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 2bf654b60c44..450ee45d86e6 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -78,7 +78,7 @@ function (add_sphinx_target builder project)
+ endif()
+ elseif (builder STREQUAL html)
+ string(TOUPPER "${project}" project_upper)
+- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
++ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
+ CACHE STRING "HTML documentation install directory for ${project}")
+
+ # '/.' indicates: copy the contents of the directory directly into
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index af757d6199a8..b0fb7e7705d1 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -96,13 +96,13 @@ foreach(p ${_count})
+ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+ get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
++set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
+ set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+ set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
++set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
+ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
+-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
++set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
+ set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
+ configure_file(
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index 09fed8085c23..aa79f192abf0 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
+ set(LINK_OR_COPY copy)
+ endif()
+
+- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
++ set(bindir "${DESTDIR}${outdir}/")
+
+ message(STATUS "Creating ${name}")
+
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index a86ebb3a37bd..e720711e2b3c 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+- to install libraries to ``/usr/lib64``.
++ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
+ **CMAKE_C_FLAGS**:STRING
+ Extra flags to use when compiling C source files.
+@@ -516,8 +516,8 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
+ The path to install Doxygen-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/doxygen-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
+
+ **LLVM_ENABLE_SPHINX**:BOOL
+ If specified, CMake will search for the ``sphinx-build`` executable and will make
+@@ -548,13 +548,33 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
+ The path to install Sphinx-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
+
+ **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
+ The path to install OCamldoc-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/ocaml-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
++
++**CMAKE_INSTALL_BINDIR**:STRING
++ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `bin`.
++
++**CMAKE_INSTALL_LIBDIR**:STRING
++ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `lib`.
++
++**CMAKE_INSTALL_INCLUDEDIR**:STRING
++ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `include`.
++
++**CMAKE_INSTALL_DOCDIR**:STRING
++ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/doc`.
++
++**CMAKE_INSTALL_MANDIR**:STRING
++ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/man`.
+
+ **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
+ macOS Only: If enabled CMake will generate a target named
+@@ -740,9 +760,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+
+ This file is available in two different locations.
+
+-* ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+- ```` is the install prefix of an installed version of LLVM.
+- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``LLVMConfig.cmake`` where
++ ```` is the location where LLVM CMake modules are
++ installed as part of an installed version of LLVM. This is typically
++ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+
+ * ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+ ```` is the root of the LLVM build tree. **Note: this is only
+diff --git a/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt
+index 3206f90d0916..1822965fc35f 100644
+--- a/examples/Bye/CMakeLists.txt
++++ b/examples/Bye/CMakeLists.txt
+@@ -9,5 +9,5 @@ add_llvm_pass_plugin(Bye
+ BUILDTREE_ONLY
+ )
+
+-install(TARGETS ${name} RUNTIME DESTINATION examples)
++install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index 1d5ca3ba92b0..026f5453c1da 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -4,5 +4,5 @@ add_subdirectory(Support)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+- configure_file(module.modulemap.build module.modulemap COPYONLY)
++ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index 63cef75368b7..6295478b1f3d 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -23,6 +23,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
++#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index fb12e29a36a8..dbb6c2b90332 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -358,12 +358,26 @@ int main(int argc, char **argv) {
+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
+ } else {
+ ActivePrefix = CurrentExecPrefix;
+- ActiveIncludeDir = ActivePrefix + "/include";
+- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+- sys::fs::make_absolute(ActivePrefix, path);
+- ActiveBinDir = path.str();
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveIncludeDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveBinDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveLibDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveCMakeDir = std::string(path.str());
++ }
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
+index b86e4abd01a7..02ce5773f17d 100644
+--- a/tools/lto/CMakeLists.txt
++++ b/tools/lto/CMakeLists.txt
+@@ -23,7 +23,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
+ add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS intrinsics_gen)
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT LTO)
+
+ if (APPLE)
+diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
+index ead73ec13a8f..250362021f17 100644
+--- a/tools/opt-viewer/CMakeLists.txt
++++ b/tools/opt-viewer/CMakeLists.txt
+@@ -8,7 +8,7 @@ set (files
+
+ foreach (file ${files})
+ install(PROGRAMS ${file}
+- DESTINATION share/opt-viewer
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
+ COMPONENT opt-viewer)
+ endforeach (file)
+
+diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt
+index e948496c603a..1f4df8a98b10 100644
+--- a/tools/remarks-shlib/CMakeLists.txt
++++ b/tools/remarks-shlib/CMakeLists.txt
+@@ -11,7 +11,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
+ add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES})
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT Remarks)
+
+ if (APPLE)
diff --git a/pkgs/development/compilers/llvm/11/clang/default.nix b/pkgs/development/compilers/llvm/11/clang/default.nix
index 2e03112d827d..3b7accffbca8 100644
--- a/pkgs/development/compilers/llvm/11/clang/default.nix
+++ b/pkgs/development/compilers/llvm/11/clang/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
+{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
}:
@@ -19,26 +20,31 @@ let
mv clang-tools-extra-* $sourceRoot/tools/extra
'';
- nativeBuildInputs = [ cmake python3 lld ]
+ nativeBuildInputs = [ cmake python3 ]
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
- buildInputs = [ libxml2 llvm ];
+ buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++14"
"-DCLANGD_BUILD_XPC=OFF"
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
];
patches = [
./purity.patch
# https://reviews.llvm.org/D51899
+ ./gnu-install-dirs.patch
];
postPatch = ''
@@ -55,12 +61,12 @@ let
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
'';
- outputs = [ "out" "lib" "python" ];
+ outputs = [ "out" "lib" "dev" "python" ];
# Clang expects to find LLVMgold in its own prefix
postInstall = ''
- if [ -e ${llvm}/lib/LLVMgold.so ]; then
- ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+ if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
+ ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
fi
ln -sv $out/bin/clang $out/bin/cpp
@@ -79,11 +85,14 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
+
+ mkdir -p $dev/bin
+ cp bin/clang-tblgen $dev/bin
'';
passthru = {
isClang = true;
- inherit llvm;
+ inherit libllvm;
};
meta = {
diff --git a/pkgs/development/compilers/llvm/11/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/clang/gnu-install-dirs.patch
new file mode 100644
index 000000000000..98ea97e05808
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/clang/gnu-install-dirs.patch
@@ -0,0 +1,235 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bb4b801f01c8..77a8b43b22c8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,6 +9,8 @@ endif()
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ project(Clang)
+
++ include(GNUInstallDirs)
++
+ set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+ set(CMAKE_CXX_STANDARD_REQUIRED YES)
+ set(CMAKE_CXX_EXTENSIONS NO)
+@@ -447,7 +449,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/clang include/clang-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT clang-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -457,7 +459,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT clang-headers
+ FILES_MATCHING
+ PATTERN "CMakeFiles" EXCLUDE
+@@ -477,7 +479,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
+ install(PROGRAMS utils/bash-autocomplete.sh
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT bash-autocomplete)
+ if(NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-bash-autocomplete
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index 704278a0e93b..d25c8d325c71 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -123,9 +123,9 @@ macro(add_clang_library name)
+ install(TARGETS ${lib}
+ COMPONENT ${lib}
+ ${export_to_clangtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${lib}
+@@ -170,7 +170,7 @@ macro(add_clang_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_clangtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT LLVM_ENABLE_IDE)
+@@ -185,7 +185,7 @@ endmacro()
+ macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+
+ function(clang_target_link_libraries target type)
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index 0692fe75a441..6f201e7207d0 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -208,7 +208,7 @@ set_target_properties(clang-resource-headers PROPERTIES
+ FOLDER "Misc"
+ RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
+
+-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${files} ${generated_files}
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index ceef4b08637c..8efad5520ca4 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
+ "@executable_path/../../lib")
+ else()
+- set(INSTALL_DESTINATION bin)
++ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+
+ install(TARGETS c-index-test
+diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
+index 35ecdb11253c..d77d75de0094 100644
+--- a/tools/clang-format/CMakeLists.txt
++++ b/tools/clang-format/CMakeLists.txt
+@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
+ endif()
+
+ install(PROGRAMS clang-format-bbedit.applescript
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-diff.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-sublime.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS git-clang-format
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT clang-format)
+diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
+index cda8e29ec5b1..0134d8ccd70b 100644
+--- a/tools/clang-rename/CMakeLists.txt
++++ b/tools/clang-rename/CMakeLists.txt
+@@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
+ )
+
+ install(PROGRAMS clang-rename.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+ install(PROGRAMS clang-rename.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 5cd9ac5cddc1..a197676fedbd 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -165,7 +165,7 @@ endif()
+ if(INTERNAL_INSTALL_PREFIX)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
+ else()
+- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
++ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ endif()
+
+ install(DIRECTORY ../../include/clang-c
+@@ -196,7 +196,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
+ COMPONENT
+ libclang-python-bindings
+ DESTINATION
+- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
++ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ endforeach()
+ if(NOT LLVM_ENABLE_IDE)
+ add_custom_target(libclang-python-bindings)
+diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
+index ec0702d76f18..d25d982f51da 100644
+--- a/tools/scan-build/CMakeLists.txt
++++ b/tools/scan-build/CMakeLists.txt
+@@ -47,7 +47,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+ install(PROGRAMS bin/${BinFile}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT scan-build)
+ endforeach()
+
+@@ -61,7 +61,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
+ install(PROGRAMS libexec/${LibexecFile}
+- DESTINATION libexec
++ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
+ COMPONENT scan-build)
+ endforeach()
+
+@@ -89,7 +89,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+ install(FILES share/scan-build/${ShareFile}
+- DESTINATION share/scan-build
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
+ COMPONENT scan-build)
+ endforeach()
+
+diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
+index 22edb974bac7..9f140a9a4538 100644
+--- a/tools/scan-view/CMakeLists.txt
++++ b/tools/scan-view/CMakeLists.txt
+@@ -22,7 +22,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+ install(PROGRAMS bin/${BinFile}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT scan-view)
+ endforeach()
+
+@@ -36,7 +36,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+ install(FILES share/${ShareFile}
+- DESTINATION share/scan-view
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
+ COMPONENT scan-view)
+ endforeach()
+
+diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
+index 62f2de0cb15c..6aa66825b6ec 100644
+--- a/utils/hmaptool/CMakeLists.txt
++++ b/utils/hmaptool/CMakeLists.txt
+@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
+
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
+ install(PROGRAMS ${CLANG_HMAPTOOL}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT hmaptool)
+
+ add_custom_target(hmaptool ALL DEPENDS ${Depends})
diff --git a/pkgs/development/compilers/llvm/11/compiler-rt/default.nix b/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
index 6ab36063077f..257bc34092fe 100644
--- a/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/11/compiler-rt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
inherit version;
src = fetch pname "0x1j8ngf1zj63wlnns9vlibafq48qcm72p4jpaxkmkb4qw0grwfy";
- nativeBuildInputs = [ cmake python3 llvm ];
+ nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
NIX_CFLAGS_COMPILE = [
@@ -24,10 +24,6 @@ stdenv.mkDerivation rec {
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
- ] ++ lib.optionals (stdenv.isDarwin) [
- "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
- "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
- "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
"-DCOMPILER_RT_BUILD_XRAY=OFF"
@@ -45,6 +41,10 @@ stdenv.mkDerivation rec {
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
+ ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
+ "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
+ "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
+ "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
];
outputs = [ "out" "dev" ];
@@ -52,6 +52,10 @@ stdenv.mkDerivation rec {
patches = [
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
+ ./gnu-install-dirs.patch
+ # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
+ # extra `/`.
+ ./normalize-var.patch
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
diff --git a/pkgs/development/compilers/llvm/11/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 000000000000..91e208829295
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,129 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index fa62814b635d..6328614d829e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,6 +12,7 @@ endif()
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+ project(CompilerRT C CXX ASM)
++ include(GNUInstallDirs)
+ set(COMPILER_RT_STANDALONE_BUILD TRUE)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ endif()
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index 7c127a93dfa7..6a95a65b70a7 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -524,7 +524,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ # Install in Clang resource directory.
+ install(FILES ${file_name}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+@@ -541,7 +541,7 @@ macro(add_compiler_rt_script name)
+ add_custom_target(${name} DEPENDS ${dst})
+ install(FILES ${dst}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
+ endmacro(add_compiler_rt_script src name)
+
+ # Builds custom version of libc++ and installs it in .
+diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
+index be8d7e733c7a..ab256bdff26c 100644
+--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
+@@ -498,7 +498,7 @@ macro(darwin_add_embedded_builtin_libraries)
+ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
+
+ set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+ set(CFLAGS_i386 "-march=pentium")
+diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
+index 99b9f0e4af44..c5183ffa746e 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -375,7 +375,7 @@ endfunction()
+ function(get_compiler_rt_install_dir arch install_dir)
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ get_compiler_rt_target(${arch} target)
+- set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
++ set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE)
+ else()
+ set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
+ endif()
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index 964dd598f102..2acaab87d349 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -66,11 +66,11 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+ # Take output dir and install path from the user.
+ set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+- "Path where built compiler-rt libraries should be stored.")
++ "Path where built compiler-rt build artifacts should be stored.")
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+ "Path where built compiler-rt executables should be stored.")
+- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+- "Path where built compiler-rt libraries should be installed.")
++ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
++ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
+ # Use a host compiler to compile/link tests.
+@@ -98,7 +98,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
+ set(COMPILER_RT_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+ endif()
+
+ if(APPLE)
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index d47d7baeb118..507c8e5c713e 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -62,22 +62,22 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
+ install(FILES ${SANITIZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
+ # Install fuzzer headers.
+ install(FILES ${FUZZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
+ # Install xray headers.
+ install(FILES ${XRAY_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
+ # Install profile headers.
+ install(FILES ${PROFILE_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
+ add_custom_target(install-compiler-rt-headers
+diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
+index 051215edbeb7..ecce1f52efb0 100644
+--- a/lib/dfsan/CMakeLists.txt
++++ b/lib/dfsan/CMakeLists.txt
+@@ -56,4 +56,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
+ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
+ add_dependencies(dfsan dfsan_abilist)
+ install(FILES ${dfsan_abilist_filename}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/pkgs/development/compilers/llvm/11/compiler-rt/normalize-var.patch b/pkgs/development/compilers/llvm/11/compiler-rt/normalize-var.patch
new file mode 100644
index 000000000000..b9986910e516
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/compiler-rt/normalize-var.patch
@@ -0,0 +1,16 @@
+diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+index c5183ffa746e..e4e4a007335d 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -299,8 +299,9 @@ macro(load_llvm_config)
+ # Get some LLVM variables from LLVMConfig.
+ include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
+
+- set(LLVM_LIBRARY_OUTPUT_INTDIR
+- ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
++ get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR
++ ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}
++ REALPATH)
+ endif()
+ endmacro()
+
diff --git a/pkgs/development/compilers/llvm/11/default.nix b/pkgs/development/compilers/llvm/11/default.nix
index 22209ffb6470..69c6564babe7 100644
--- a/pkgs/development/compilers/llvm/11/default.nix
+++ b/pkgs/development/compilers/llvm/11/default.nix
@@ -1,6 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildPackages
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@@ -20,31 +19,38 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "18n1w1hkv931xzq02b34wglbv6zd6sd0r5kb8piwvag7klj7qw3n";
tools = lib.makeExtensible (tools: let
- callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
- mkExtraBuildCommands = cc: ''
+ callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
+ mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
- ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
- ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
+ ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
+ mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
+ ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+ ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
+ '';
+
in {
- llvm = callPackage ./llvm { };
+ libllvm = callPackage ./llvm { };
- clang-unwrapped = callPackage ./clang {
- inherit (tools) lld;
+ # `llvm` historically had the binaries. When choosing an output explicitly,
+ # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
+ llvm = tools.libllvm.out // { outputUnspecified = true; };
+
+ libclang = callPackage ./clang {
inherit clang-tools-extra_src;
};
+ clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
# disabled until recommonmark supports sphinx 3
- #Llvm-manpages = lowPrio (tools.llvm.override {
+ #Llvm-manpages = lowPrio (tools.libllvm.override {
# enableManpages = true;
# python3 = pkgs.python3; # don't use python-boot
#});
- clang-manpages = lowPrio (tools.clang-unwrapped.override {
+ clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
@@ -55,8 +61,6 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });
- libclang = tools.clang-unwrapped.lib;
-
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
@@ -146,7 +150,7 @@ let
'' + mkExtraBuildCommands cc;
};
- lldClangNoCompilerRt = wrapCCWith {
+ lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
@@ -156,7 +160,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
- '';
+ '' + mkExtraBuildCommands0 cc;
};
});
diff --git a/pkgs/development/compilers/llvm/11/libc++/default.nix b/pkgs/development/compilers/llvm/11/libc++/default.nix
index 6adb824f539d..e095350cea77 100644
--- a/pkgs/development/compilers/llvm/11/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/11/libc++/default.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation {
mv llvm-* llvm
'';
+ outputs = [ "out" "dev" ];
+
patches = [
(fetchpatch {
# Backported from LLVM 12, avoids clashes with commonly used "block.h" header.
@@ -22,6 +24,7 @@ stdenv.mkDerivation {
sha256 = "sha256-aWa66ogmPkG0xHzSfcpD0qZyZQcNKwLV44js4eiun78=";
stripLen = 1;
})
+ ./gnu-install-dirs.patch
] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
diff --git a/pkgs/development/compilers/llvm/11/libc++/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/libc++/gnu-install-dirs.patch
new file mode 100644
index 000000000000..2b95d6a85d8f
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/libc++/gnu-install-dirs.patch
@@ -0,0 +1,100 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 910d04b54b6d..80ef692d83eb 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -31,6 +31,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
+ project(libcxx CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxx)
+ set(PACKAGE_VERSION 11.1.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+@@ -418,7 +420,7 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
+ string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
+@@ -426,11 +428,11 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+ set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
+ else()
+ set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+ set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
+ endif()
+
+ file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
+diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
+index c5aa26739e36..8841c4a5252d 100644
+--- a/cmake/Modules/HandleLibCXXABI.cmake
++++ b/cmake/Modules/HandleLibCXXABI.cmake
+@@ -63,7 +63,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
+
+ if (LIBCXX_INSTALL_HEADERS)
+ install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
+ COMPONENT cxx-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index be8141c98166..93847e5758cc 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -257,7 +257,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ foreach(file ${files})
+ get_filename_component(dir ${file} DIRECTORY)
+ install(FILES ${file}
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
+ COMPONENT ${CXX_HEADER_TARGET}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+@@ -265,7 +265,7 @@ if (LIBCXX_INSTALL_HEADERS)
+
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT ${CXX_HEADER_TARGET})
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 2001c09761d9..5bd11ea6b400 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -344,21 +344,21 @@ if (LIBCXX_INSTALL_LIBRARY)
+ install(TARGETS cxx_shared
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ if (LIBCXX_INSTALL_STATIC_LIBRARY)
+ install(TARGETS cxx_static
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
+ install(TARGETS cxx_experimental
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ # NOTE: This install command must go after the cxx install command otherwise
diff --git a/pkgs/development/compilers/llvm/11/libc++abi/default.nix b/pkgs/development/compilers/llvm/11/libc++abi/default.nix
index c35ec706a023..a79a0d2f07ad 100644
--- a/pkgs/development/compilers/llvm/11/libc++abi/default.nix
+++ b/pkgs/development/compilers/llvm/11/libc++abi/default.nix
@@ -8,20 +8,7 @@ stdenv.mkDerivation {
src = fetch "libcxxabi" "1azcf31mxw59hb1x17xncnm3dyw90ylh8rqx462lvypqh3nr6c8l";
- nativeBuildInputs = [ cmake ];
- buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
-
- cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
- "-DLLVM_ENABLE_LIBCXX=ON"
- "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
- ] ++ lib.optionals stdenv.hostPlatform.isWasm [
- "-DLIBCXXABI_ENABLE_THREADS=OFF"
- "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
- ] ++ lib.optionals (!enableShared) [
- "-DLIBCXXABI_ENABLE_SHARED=OFF"
- ];
-
- patches = [ ./no-threads.patch ];
+ outputs = [ "out" "dev" ];
postUnpack = ''
unpackFile ${libcxx.src}
@@ -36,6 +23,24 @@ stdenv.mkDerivation {
patch -p1 -d llvm -i ${./wasm.patch}
'';
+ patches = [
+ ./no-threads.patch
+ ./gnu-install-dirs.patch
+ ];
+
+ nativeBuildInputs = [ cmake ];
+ buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
+
+ cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
+ "-DLLVM_ENABLE_LIBCXX=ON"
+ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
+ ] ++ lib.optionals stdenv.hostPlatform.isWasm [
+ "-DLIBCXXABI_ENABLE_THREADS=OFF"
+ "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
+ ] ++ lib.optionals (!enableShared) [
+ "-DLIBCXXABI_ENABLE_SHARED=OFF"
+ ];
+
installPhase = if stdenv.isDarwin
then ''
for file in lib/*.dylib; do
diff --git a/pkgs/development/compilers/llvm/11/libc++abi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/libc++abi/gnu-install-dirs.patch
new file mode 100644
index 000000000000..10651c1255ef
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/libc++abi/gnu-install-dirs.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 36c6b2249e2b..a93c13ccaed9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -24,6 +24,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD)
+ project(libcxxabi CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxxabi)
+ set(PACKAGE_VERSION 11.1.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+@@ -160,17 +162,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
+ string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
+ endif()
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
+ else()
+ set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
+ endif()
+
+ set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.")
diff --git a/pkgs/development/compilers/llvm/11/libunwind/default.nix b/pkgs/development/compilers/llvm/11/libunwind/default.nix
index 0c635cabc0a9..6b095f4feae8 100644
--- a/pkgs/development/compilers/llvm/11/libunwind/default.nix
+++ b/pkgs/development/compilers/llvm/11/libunwind/default.nix
@@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
src = fetch pname "1vpqs2c358v8fbr1r8jmzkfqk12jllimjcfmgxga127ksq9b37nj";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
+ outputs = [ "out" "dev" ];
+
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
diff --git a/pkgs/development/compilers/llvm/11/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/libunwind/gnu-install-dirs.patch
new file mode 100644
index 000000000000..b5b9c209278e
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/libunwind/gnu-install-dirs.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e44a103648f9..aaf1f9555d7f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
+ project(libunwind LANGUAGES C CXX ASM)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ if(NOT LLVM_CONFIG_PATH)
+@@ -192,17 +194,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+ string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+ endif()
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
+ else()
+ set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
+ endif()
+
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
diff --git a/pkgs/development/compilers/llvm/11/lld/default.nix b/pkgs/development/compilers/llvm/11/lld/default.nix
index 1a16184a6e71..3ee5ba6e5a67 100644
--- a/pkgs/development/compilers/llvm/11/lld/default.nix
+++ b/pkgs/development/compilers/llvm/11/lld/default.nix
@@ -1,8 +1,9 @@
{ lib, stdenv
+, buildLlvmTools
, fetch
, cmake
, libxml2
-, llvm
+, libllvm
, version
}:
@@ -12,15 +13,20 @@ stdenv.mkDerivation rec {
src = fetch pname "1kk61i7z5bi9i11rzsd2b388d42if1c7a45zkaa4mk0yps67hyh1";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvm libxml2 ];
+ buildInputs = [ libllvm libxml2 ];
- outputs = [ "out" "dev" ];
+ cmakeFlags = [
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ ];
- postInstall = ''
- moveToOutput include "$dev"
- moveToOutput lib "$dev"
- '';
+ outputs = [ "out" "lib" "dev" ];
meta = {
description = "The LLVM Linker";
diff --git a/pkgs/development/compilers/llvm/11/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/lld/gnu-install-dirs.patch
new file mode 100644
index 000000000000..19cf5526aa50
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/lld/gnu-install-dirs.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 040bb2c8f6d7..f765f0096d97 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(LLD_BUILT_STANDALONE TRUE)
+
++ include(GNUInstallDirs)
++
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
+ if(NOT LLVM_CONFIG_PATH)
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
+@@ -205,7 +207,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index 23df41312403..d62372c88de7 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -20,9 +20,9 @@ macro(add_lld_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -54,7 +54,7 @@ macro(add_lld_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_lldtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -69,5 +69,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
+index e6f72fcd3488..d903609e6e4f 100644
+--- a/tools/lld/CMakeLists.txt
++++ b/tools/lld/CMakeLists.txt
+@@ -21,7 +21,7 @@ target_link_libraries(lld
+ )
+
+ install(TARGETS lld
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(NOT LLD_SYMLINKS_TO_CREATE)
+ set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)
diff --git a/pkgs/development/compilers/llvm/11/lldb/default.nix b/pkgs/development/compilers/llvm/11/lldb/default.nix
index fc9b471ec9ab..2979a46a6ccd 100644
--- a/pkgs/development/compilers/llvm/11/lldb/default.nix
+++ b/pkgs/development/compilers/llvm/11/lldb/default.nix
@@ -7,8 +7,8 @@
, which
, libedit
, libxml2
-, llvm
-, clang-unwrapped
+, libllvm
+, libclang
, python3
, version
, darwin
@@ -22,19 +22,22 @@ stdenv.mkDerivation (rec {
src = fetch pname "1vlyg015dyng43xqb8cg2l6r9ix8klibxsajazbfnckdnh54hwxj";
- patches = [ ./procfs.patch ];
+ patches = [
+ ./procfs.patch
+ ./gnu-install-dirs.patch
+ ];
- nativeBuildInputs = [ cmake python3 which swig lit ]
- ++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
+ outputs = [ "out" "lib" "dev" ];
+
+ nativeBuildInputs = [
+ cmake python3 which swig lit
+ ] ++ lib.optionals enableManpages [
+ python3.pkgs.sphinx python3.pkgs.recommonmark
+ ];
buildInputs = [
- ncurses
- zlib
- libedit
- libxml2
- llvm
- ]
- ++ lib.optionals stdenv.isDarwin [
+ ncurses zlib libedit libxml2 libllvm
+ ] ++ lib.optionals stdenv.isDarwin [
darwin.libobjc
darwin.apple_sdk.libs.xpc
darwin.apple_sdk.frameworks.Foundation
@@ -46,8 +49,9 @@ stdenv.mkDerivation (rec {
hardeningDisable = [ "format" ];
cmakeFlags = [
+ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
"-DLLVM_ENABLE_RTTI=OFF"
- "-DClang_DIR=${clang-unwrapped}/lib/cmake"
+ "-DClang_DIR=${libclang.dev}/lib/cmake"
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
] ++ lib.optionals stdenv.isDarwin [
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
@@ -57,33 +61,38 @@ stdenv.mkDerivation (rec {
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
+ ] ++ lib.optionals doCheck [
+ "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
];
+ doCheck = false;
+
postInstall = ''
# Editor support
# vscode:
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
- ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
+ ln -s $out/bin/llvm-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
'';
meta = with lib; {
description = "A next-generation high-performance debugger";
- homepage = "https://lldb.llvm.org";
- license = licenses.ncsa;
- platforms = platforms.all;
+ homepage = "https://lldb.llvm.org";
+ license = licenses.ncsa;
+ platforms = platforms.all;
};
} // lib.optionalAttrs enableManpages {
pname = "lldb-manpages";
buildPhase = ''
- make docs-lldb-man
+ make docs-man
'';
propagatedBuildInputs = [];
+ # manually install lldb man page
installPhase = ''
- # manually install lldb man page
mkdir -p $out/share/man/man1
install docs/man/lldb.1 -t $out/share/man/man1/
'';
diff --git a/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch
new file mode 100644
index 000000000000..a4769109523d
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/lldb/gnu-install-dirs.patch
@@ -0,0 +1,65 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bf748020ea40..34103d2b5e1a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -17,6 +17,8 @@ set(CMAKE_MODULE_PATH
+ # If we are not building as part of LLVM, build LLDB as a standalone project,
+ # using LLVM as an external library.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
++ include(GNUInstallDirs)
++
+ project(lldb)
+ include(LLDBStandalone)
+
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index 4ed5c647c5d2..89f96e710d55 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -107,13 +107,13 @@ function(add_lldb_library name)
+ endif()
+
+ if(PARAM_SHARED)
+- set(install_dest lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(PARAM_INSTALL_PREFIX)
+ set(install_dest ${PARAM_INSTALL_PREFIX})
+ endif()
+ # RUNTIME is relevant for DLL platforms, FRAMEWORK for macOS
+ install(TARGETS ${name} COMPONENT ${name}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${install_dest}
+ ARCHIVE DESTINATION ${install_dest}
+ FRAMEWORK DESTINATION ${install_dest})
+diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
+index 8465cfe3b7b7..01b7eae136e2 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -245,7 +245,7 @@ include_directories(BEFORE
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+@@ -254,7 +254,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
+index efba2f74904f..e08413b1dbb1 100644
+--- a/tools/intel-features/CMakeLists.txt
++++ b/tools/intel-features/CMakeLists.txt
+@@ -65,4 +65,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ endif()
+
+ install(TARGETS lldbIntelFeatures
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/pkgs/development/compilers/llvm/11/llvm/default.nix b/pkgs/development/compilers/llvm/11/llvm/default.nix
index ee2fe9c90b2b..c8033b585cb1 100644
--- a/pkgs/development/compilers/llvm/11/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/11/llvm/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv
+, pkgsBuildBuild
, fetch
, cmake
, python3
@@ -10,15 +11,15 @@
, version
, release_version
, zlib
-, buildPackages
+, buildLlvmTools
, debugVersion ? false
, enableManpages ? false
-, enableSharedLibraries ? true
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
, enablePFM ? !(stdenv.isDarwin
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|| stdenv.isAarch32 # broken for the armv7l builder
)
-, enablePolly ? false
+, enablePolly ? false # TODO should be on by default
}:
let
@@ -44,8 +45,7 @@ in stdenv.mkDerivation (rec {
mv polly-* $sourceRoot/tools/polly
'';
- outputs = [ "out" "python" ]
- ++ optional enableSharedLibraries "lib";
+ outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python3 ]
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
@@ -55,10 +55,14 @@ in stdenv.mkDerivation (rec {
propagatedBuildInputs = [ ncurses zlib ];
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
+
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
- --replace 'set(_install_rpath "@loader_path/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
+ --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
@@ -99,6 +103,7 @@ in stdenv.mkDerivation (rec {
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
cmakeFlags = with stdenv; [
+ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
@@ -122,7 +127,20 @@ in stdenv.mkDerivation (rec {
"-DCAN_TARGET_i386=false"
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
- "-DLLVM_TABLEGEN=${buildPackages.llvm_11}/bin/llvm-tblgen"
+ "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ (
+ let
+ nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+ nativeBintools = nativeCC.bintools.bintools;
+ nativeToolchainFlags = [
+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+ ];
+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+ )
];
postBuild = ''
@@ -136,20 +154,19 @@ in stdenv.mkDerivation (rec {
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
- ''
- + optionalString enableSharedLibraries ''
- moveToOutput "lib/libLLVM-*" "$lib"
- moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- ''
- + optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+ moveToOutput "bin/llvm-config*" "$dev"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+ --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+ --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
+ ''
+ + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
diff --git a/pkgs/development/compilers/llvm/11/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/11/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 000000000000..fff2d4953e94
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,106 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index 9939097f743e..8cc538da912a 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -2,7 +2,11 @@
+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ project(Polly)
+ cmake_minimum_required(VERSION 3.4.3)
++endif()
++
++include(GNUInstallDirs)
+
++if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ # Where is LLVM installed?
+ find_package(LLVM CONFIG REQUIRED)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -145,14 +149,14 @@ include_directories(
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+ )
+
+ install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 211f95512717..f9e04a4844b6 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
+- "${POLLY_INSTALL_PREFIX}/include/polly"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+ )
+ else()
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+ ${ISL_INCLUDE_DIRS}
+ )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+ get_target_property(tgt_type ${tgt} TYPE)
+ if (tgt_type STREQUAL "EXECUTABLE")
+- set(tgt_prefix "bin/")
++ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+ else()
+- set(tgt_prefix "lib/")
++ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+ endif()
+
+- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
++ set(tgt_path "${tgt_prefix}$")
+ file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+
+ if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index 86de6f10686e..91f30891ccbe 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index 1039079cb49c..28b499ae1e9e 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -275,7 +275,7 @@ if (POLLY_BUNDLED_ISL)
+ install(DIRECTORY
+ ${ISL_SOURCE_DIR}/include/
+ ${ISL_BINARY_DIR}/include/
+- DESTINATION include/polly
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/11/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/11/llvm/gnu-install-dirs.patch
new file mode 100644
index 000000000000..29df98a693f0
--- /dev/null
+++ b/pkgs/development/compilers/llvm/11/llvm/gnu-install-dirs.patch
@@ -0,0 +1,417 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 247ad36d3845..815e2c4ba955 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -269,15 +269,21 @@ if (CMAKE_BUILD_TYPE AND
+ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ endif()
+
++include(GNUInstallDirs)
++
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
++set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
++ "Path for binary subdirectory (defaults to 'bin')")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
+ set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
+ "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
+ mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
+
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+@@ -559,9 +565,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
+ option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+
+-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
++set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
+ CACHE STRING "Doxygen-generated HTML documentation install directory")
+-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
++set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
+ CACHE STRING "OCamldoc-generated HTML documentation install directory")
+
+ option (LLVM_BUILD_EXTERNAL_COMPILER_RT
+@@ -1107,7 +1113,7 @@ endif()
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -1119,7 +1125,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -1134,13 +1140,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ if (LLVM_INSTALL_MODULEMAPS)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "module.modulemap"
+ )
+ install(FILES include/llvm/module.install.modulemap
+- DESTINATION include/llvm
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
+ COMPONENT llvm-headers
+ RENAME "module.extern.modulemap"
+ )
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index b74adc11ade9..a5aa258cde30 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -766,9 +766,9 @@ macro(add_llvm_library name)
+
+ install(TARGETS ${name}
+ ${export_to_llvmexports}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+- RUNTIME DESTINATION bin COMPONENT ${name})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${name}
+@@ -981,7 +981,7 @@ function(process_llvm_pass_plugins)
+ "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
+ install(FILES
+ ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
+- DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
++ DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
+ COMPONENT cmake-exports)
+
+ set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
+@@ -1201,7 +1201,7 @@ macro(add_llvm_example name)
+ endif()
+ add_llvm_executable(${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endmacro(add_llvm_example name)
+@@ -1819,7 +1819,7 @@ function(llvm_install_library_symlink name dest type)
+ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+
+- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 AND "${type}" STREQUAL "SHARED")
+ set(output_dir bin)
+ endif()
+@@ -1836,7 +1836,7 @@ function(llvm_install_library_symlink name dest type)
+ endif()
+ endfunction()
+
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+ cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+ foreach(path ${CMAKE_MODULE_PATH})
+ if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1859,7 +1859,7 @@ function(llvm_install_symlink name dest)
+ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+
+ install(SCRIPT ${INSTALL_SYMLINK}
+- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+ COMPONENT ${component})
+
+ if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
+@@ -1942,7 +1942,8 @@ function(add_llvm_tool_symlink link_name target)
+ endif()
+
+ if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+- llvm_install_symlink(${link_name} ${target})
++ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++ llvm_install_symlink(${link_name} ${target} ${output_dir})
+ endif()
+ endif()
+ endfunction()
+@@ -2064,9 +2065,9 @@ function(llvm_setup_rpath name)
+
+ if (APPLE)
+ set(_install_name_dir INSTALL_NAME_DIR "@rpath")
+- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ elseif(UNIX)
+- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 554046b20edf..4d1ad980641e 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -144,9 +144,9 @@ function(add_ocaml_library name)
+ endforeach()
+
+ if( APPLE )
+- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index b5babb30abcf..190b1222a9f9 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -84,7 +84,7 @@ function (add_sphinx_target builder project)
+ endif()
+ elseif (builder STREQUAL html)
+ string(TOUPPER "${project}" project_upper)
+- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
++ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
+ CACHE STRING "HTML documentation install directory for ${project}")
+
+ # '/.' indicates: copy the contents of the directory directly into
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index 4b8879f65fe4..f01920bcc60f 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -108,13 +108,13 @@ foreach(p ${_count})
+ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+ get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
++set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
+ set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+ set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
++set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
+ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
+-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
++set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+
+ # Generate a default location for lit
+ if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index 09fed8085c23..aa79f192abf0 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
+ set(LINK_OR_COPY copy)
+ endif()
+
+- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
++ set(bindir "${DESTDIR}${outdir}/")
+
+ message(STATUS "Creating ${name}")
+
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index 1f908d3e95b1..1315e0aa40e1 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+- to install libraries to ``/usr/lib64``.
++ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
+ **CMAKE_C_FLAGS**:STRING
+ Extra flags to use when compiling C source files.
+@@ -516,8 +516,8 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
+ The path to install Doxygen-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/doxygen-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
+
+ **LLVM_ENABLE_SPHINX**:BOOL
+ If specified, CMake will search for the ``sphinx-build`` executable and will make
+@@ -548,13 +548,33 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
+ The path to install Sphinx-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
+
+ **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
+ The path to install OCamldoc-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/ocaml-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
++
++**CMAKE_INSTALL_BINDIR**:STRING
++ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `bin`.
++
++**CMAKE_INSTALL_LIBDIR**:STRING
++ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `lib`.
++
++**CMAKE_INSTALL_INCLUDEDIR**:STRING
++ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `include`.
++
++**CMAKE_INSTALL_DOCDIR**:STRING
++ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/doc`.
++
++**CMAKE_INSTALL_MANDIR**:STRING
++ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/man`.
+
+ **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
+ macOS Only: If enabled CMake will generate a target named
+@@ -752,9 +772,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+
+ This file is available in two different locations.
+
+-* ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+- ```` is the install prefix of an installed version of LLVM.
+- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``LLVMConfig.cmake`` where
++ ```` is the location where LLVM CMake modules are
++ installed as part of an installed version of LLVM. This is typically
++ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+
+ * ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+ ```` is the root of the LLVM build tree. **Note: this is only
+diff --git a/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt
+index bb96edb4b4bf..678c22fb43c8 100644
+--- a/examples/Bye/CMakeLists.txt
++++ b/examples/Bye/CMakeLists.txt
+@@ -14,6 +14,6 @@ if (NOT WIN32)
+ BUILDTREE_ONLY
+ )
+
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endif()
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index b46319f24fc8..2feabd1954e4 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -5,5 +5,5 @@ add_subdirectory(Frontend)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+- configure_file(module.modulemap.build module.modulemap COPYONLY)
++ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index 63cef75368b7..6295478b1f3d 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -23,6 +23,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
++#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 7e74b7c90816..f185e9283f83 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -358,12 +358,26 @@ int main(int argc, char **argv) {
+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
+ } else {
+ ActivePrefix = CurrentExecPrefix;
+- ActiveIncludeDir = ActivePrefix + "/include";
+- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+- sys::fs::make_absolute(ActivePrefix, path);
+- ActiveBinDir = std::string(path.str());
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveIncludeDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveBinDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveLibDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveCMakeDir = std::string(path.str());
++ }
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
+index 2963f97cad88..69d66c9c9ca1 100644
+--- a/tools/lto/CMakeLists.txt
++++ b/tools/lto/CMakeLists.txt
+@@ -25,7 +25,7 @@ add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
+ intrinsics_gen)
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT LTO)
+
+ if (APPLE)
+diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
+index ead73ec13a8f..250362021f17 100644
+--- a/tools/opt-viewer/CMakeLists.txt
++++ b/tools/opt-viewer/CMakeLists.txt
+@@ -8,7 +8,7 @@ set (files
+
+ foreach (file ${files})
+ install(PROGRAMS ${file}
+- DESTINATION share/opt-viewer
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
+ COMPONENT opt-viewer)
+ endforeach (file)
+
+diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt
+index e948496c603a..1f4df8a98b10 100644
+--- a/tools/remarks-shlib/CMakeLists.txt
++++ b/tools/remarks-shlib/CMakeLists.txt
+@@ -11,7 +11,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
+ add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES})
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT Remarks)
+
+ if (APPLE)
diff --git a/pkgs/development/compilers/llvm/12/clang/default.nix b/pkgs/development/compilers/llvm/12/clang/default.nix
index ab329e3d85d7..3d1106dbc52c 100644
--- a/pkgs/development/compilers/llvm/12/clang/default.nix
+++ b/pkgs/development/compilers/llvm/12/clang/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
+{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
}:
@@ -18,26 +19,31 @@ let
unpackFile ${clang-tools-extra_src}
'';
- nativeBuildInputs = [ cmake python3 lld ]
+ nativeBuildInputs = [ cmake python3 ]
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
- buildInputs = [ libxml2 llvm ];
+ buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++14"
"-DCLANGD_BUILD_XPC=OFF"
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
];
patches = [
./purity.patch
# https://reviews.llvm.org/D51899
+ ./gnu-install-dirs.patch
];
postPatch = ''
@@ -51,12 +57,12 @@ let
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
'';
- outputs = [ "out" "lib" "python" ];
+ outputs = [ "out" "lib" "dev" "python" ];
# Clang expects to find LLVMgold in its own prefix
postInstall = ''
- if [ -e ${llvm}/lib/LLVMgold.so ]; then
- ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+ if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
+ ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
fi
ln -sv $out/bin/clang $out/bin/cpp
@@ -75,11 +81,14 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
+
+ mkdir -p $dev/bin
+ cp bin/clang-tblgen $dev/bin
'';
passthru = {
isClang = true;
- inherit llvm;
+ inherit libllvm;
};
meta = llvm_meta // {
diff --git a/pkgs/development/compilers/llvm/12/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/clang/gnu-install-dirs.patch
new file mode 100644
index 000000000000..b834d386b4eb
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/clang/gnu-install-dirs.patch
@@ -0,0 +1,235 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9e74014134a0..976e6a1757fd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.13.4)
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ project(Clang)
+
++ include(GNUInstallDirs)
++
+ set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+ set(CMAKE_CXX_STANDARD_REQUIRED YES)
+ set(CMAKE_CXX_EXTENSIONS NO)
+@@ -416,7 +418,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/clang include/clang-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT clang-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -425,7 +427,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT clang-headers
+ FILES_MATCHING
+ PATTERN "CMakeFiles" EXCLUDE
+@@ -445,7 +447,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
+ install(PROGRAMS utils/bash-autocomplete.sh
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT bash-autocomplete)
+ if(NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-bash-autocomplete
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index 704278a0e93b..d25c8d325c71 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -123,9 +123,9 @@ macro(add_clang_library name)
+ install(TARGETS ${lib}
+ COMPONENT ${lib}
+ ${export_to_clangtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${lib}
+@@ -170,7 +170,7 @@ macro(add_clang_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_clangtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT LLVM_ENABLE_IDE)
+@@ -185,7 +185,7 @@ endmacro()
+ macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+
+ function(clang_target_link_libraries target type)
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index b2c0ce8dd4a0..19e5443d8c25 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -215,7 +215,7 @@ set_target_properties(clang-resource-headers PROPERTIES
+ FOLDER "Misc"
+ RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
+
+-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${files} ${generated_files}
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index ceef4b08637c..8efad5520ca4 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
+ "@executable_path/../../lib")
+ else()
+- set(INSTALL_DESTINATION bin)
++ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+
+ install(TARGETS c-index-test
+diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
+index 35ecdb11253c..d77d75de0094 100644
+--- a/tools/clang-format/CMakeLists.txt
++++ b/tools/clang-format/CMakeLists.txt
+@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
+ endif()
+
+ install(PROGRAMS clang-format-bbedit.applescript
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-diff.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-sublime.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS git-clang-format
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT clang-format)
+diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
+index cda8e29ec5b1..0134d8ccd70b 100644
+--- a/tools/clang-rename/CMakeLists.txt
++++ b/tools/clang-rename/CMakeLists.txt
+@@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
+ )
+
+ install(PROGRAMS clang-rename.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+ install(PROGRAMS clang-rename.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 51ff2e7e1565..1ed5f8a079a1 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -166,7 +166,7 @@ endif()
+ if(INTERNAL_INSTALL_PREFIX)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
+ else()
+- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
++ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ endif()
+
+ install(DIRECTORY ../../include/clang-c
+@@ -196,7 +196,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
+ COMPONENT
+ libclang-python-bindings
+ DESTINATION
+- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
++ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ endforeach()
+ if(NOT LLVM_ENABLE_IDE)
+ add_custom_target(libclang-python-bindings)
+diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
+index ec0702d76f18..d25d982f51da 100644
+--- a/tools/scan-build/CMakeLists.txt
++++ b/tools/scan-build/CMakeLists.txt
+@@ -47,7 +47,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+ install(PROGRAMS bin/${BinFile}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT scan-build)
+ endforeach()
+
+@@ -61,7 +61,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
+ install(PROGRAMS libexec/${LibexecFile}
+- DESTINATION libexec
++ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
+ COMPONENT scan-build)
+ endforeach()
+
+@@ -89,7 +89,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+ install(FILES share/scan-build/${ShareFile}
+- DESTINATION share/scan-build
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
+ COMPONENT scan-build)
+ endforeach()
+
+diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
+index dd3d33439299..fea19c12ce70 100644
+--- a/tools/scan-view/CMakeLists.txt
++++ b/tools/scan-view/CMakeLists.txt
+@@ -19,7 +19,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+ install(PROGRAMS bin/${BinFile}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT scan-view)
+ endforeach()
+
+@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+ install(FILES share/${ShareFile}
+- DESTINATION share/scan-view
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
+ COMPONENT scan-view)
+ endforeach()
+
+diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
+index 62f2de0cb15c..6aa66825b6ec 100644
+--- a/utils/hmaptool/CMakeLists.txt
++++ b/utils/hmaptool/CMakeLists.txt
+@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
+
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
+ install(PROGRAMS ${CLANG_HMAPTOOL}
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT hmaptool)
+
+ add_custom_target(hmaptool ALL DEPENDS ${Depends})
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/compiler-rt-X86-support-extension.patch b/pkgs/development/compilers/llvm/12/compiler-rt/X86-support-extension.patch
similarity index 100%
rename from pkgs/development/compilers/llvm/12/compiler-rt/compiler-rt-X86-support-extension.patch
rename to pkgs/development/compilers/llvm/12/compiler-rt/X86-support-extension.patch
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/compiler-rt-armv7l.patch b/pkgs/development/compilers/llvm/12/compiler-rt/armv7l.patch
similarity index 100%
rename from pkgs/development/compilers/llvm/12/compiler-rt/compiler-rt-armv7l.patch
rename to pkgs/development/compilers/llvm/12/compiler-rt/armv7l.patch
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/compiler-rt-codesign.patch b/pkgs/development/compilers/llvm/12/compiler-rt/codesign.patch
similarity index 100%
rename from pkgs/development/compilers/llvm/12/compiler-rt/compiler-rt-codesign.patch
rename to pkgs/development/compilers/llvm/12/compiler-rt/codesign.patch
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
index bf7f4bc4312a..b880a0071b9e 100644
--- a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
inherit version;
src = fetch pname "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45";
- nativeBuildInputs = [ cmake python3 llvm ];
+ nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
NIX_CFLAGS_COMPILE = [
@@ -24,9 +24,6 @@ stdenv.mkDerivation rec {
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
- ] ++ lib.optionals (stdenv.isDarwin) [
- "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
- "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}"
] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
"-DCOMPILER_RT_BUILD_XRAY=OFF"
@@ -44,15 +41,23 @@ stdenv.mkDerivation rec {
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
+ ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
+ "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
+ "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
+ "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
];
outputs = [ "out" "dev" ];
patches = [
- ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
- ./compiler-rt-X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
+ ./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
+ ./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
+ ./gnu-install-dirs.patch
+ # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
+ # extra `/`.
+ ./normalize-var.patch
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
- ++ lib.optional stdenv.hostPlatform.isAarch32 ./compiler-rt-armv7l.patch;
+ ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 000000000000..5f025764de1c
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,129 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b44ad2c2118e..d42f5664d448 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.13.4)
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+ project(CompilerRT C CXX ASM)
++ include(GNUInstallDirs)
+ set(COMPILER_RT_STANDALONE_BUILD TRUE)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ endif()
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index 361538a58e47..f0d8d9ab80f1 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -495,7 +495,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ # Install in Clang resource directory.
+ install(FILES ${file_name}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+@@ -512,7 +512,7 @@ macro(add_compiler_rt_script name)
+ add_custom_target(${name} DEPENDS ${dst})
+ install(FILES ${dst}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
+ endmacro(add_compiler_rt_script src name)
+
+ # Builds custom version of libc++ and installs it in .
+diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
+index 456a8dcda59f..7a09e74c7c79 100644
+--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
+@@ -508,7 +508,7 @@ macro(darwin_add_embedded_builtin_libraries)
+ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
+
+ set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+ set(CFLAGS_i386 "-march=pentium")
+diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
+index f61d487e93a0..f1f46fb9599c 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -378,7 +378,7 @@ endfunction()
+ function(get_compiler_rt_install_dir arch install_dir)
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ get_compiler_rt_target(${arch} target)
+- set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
++ set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE)
+ else()
+ set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
+ endif()
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index 1edab43e7c0d..1aac6b73ff82 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -65,11 +65,11 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+ # Take output dir and install path from the user.
+ set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+- "Path where built compiler-rt libraries should be stored.")
++ "Path where built compiler-rt build artifacts should be stored.")
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+ "Path where built compiler-rt executables should be stored.")
+- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+- "Path where built compiler-rt libraries should be installed.")
++ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
++ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
+ # Use a host compiler to compile/link tests.
+@@ -97,7 +97,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
+ set(COMPILER_RT_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+ endif()
+
+ if(APPLE)
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index b00e8caa1ddd..0fe64e4862c9 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -69,22 +69,22 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
+ install(FILES ${SANITIZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
+ # Install fuzzer headers.
+ install(FILES ${FUZZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
+ # Install xray headers.
+ install(FILES ${XRAY_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
+ # Install profile headers.
+ install(FILES ${PROFILE_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
+ add_custom_target(install-compiler-rt-headers
+diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
+index a29de8deff1b..d39ff01613d2 100644
+--- a/lib/dfsan/CMakeLists.txt
++++ b/lib/dfsan/CMakeLists.txt
+@@ -57,4 +57,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
+ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
+ add_dependencies(dfsan dfsan_abilist)
+ install(FILES ${dfsan_abilist_filename}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/normalize-var.patch b/pkgs/development/compilers/llvm/12/compiler-rt/normalize-var.patch
new file mode 100644
index 000000000000..135cf625ef78
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/compiler-rt/normalize-var.patch
@@ -0,0 +1,16 @@
+diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+index f1f46fb9599c..6f19e69507ba 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -302,8 +302,9 @@ macro(load_llvm_config)
+ # Get some LLVM variables from LLVMConfig.
+ include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
+
+- set(LLVM_LIBRARY_OUTPUT_INTDIR
+- ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
++ get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR
++ ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}
++ REALPATH)
+ endif()
+ endmacro()
+
diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix
index a6d68d2e2a44..ea054107e056 100644
--- a/pkgs/development/compilers/llvm/12/default.nix
+++ b/pkgs/development/compilers/llvm/12/default.nix
@@ -1,6 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildPackages
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, darwin
@@ -27,34 +26,41 @@ let
};
tools = lib.makeExtensible (tools: let
- callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
- mkExtraBuildCommands = cc: ''
+ callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
+ mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
+ ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
+ echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
+ '';
+ mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
- echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
in {
- llvm = callPackage ./llvm {
+ libllvm = callPackage ./llvm {
inherit llvm_meta;
};
- clang-unwrapped = callPackage ./clang {
- inherit (tools) lld;
+ # `llvm` historically had the binaries. When choosing an output explicitly,
+ # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
+ llvm = tools.libllvm.out // { outputUnspecified = true; };
+
+ libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
+ clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
+
# disabled until recommonmark supports sphinx 3
- #Llvm-manpages = lowPrio (tools.llvm.override {
+ #Llvm-manpages = lowPrio (tools.libllvm.override {
# enableManpages = true;
# python3 = pkgs.python3; # don't use python-boot
#});
- clang-manpages = lowPrio (tools.clang-unwrapped.override {
+ clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
@@ -65,8 +71,6 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });
- libclang = tools.clang-unwrapped.lib;
-
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
@@ -164,7 +168,7 @@ let
'' + mkExtraBuildCommands cc;
};
- lldClangNoCompilerRt = wrapCCWith {
+ lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
@@ -174,7 +178,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
- '';
+ '' + mkExtraBuildCommands0 cc;
};
});
diff --git a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
index dab6c583e889..7c9742624380 100644
--- a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
+++ b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation {
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d libcxx -i ${../../libcxx-0001-musl-hacks.patch}
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
- patch -p1 -d llvm -i ${./libcxxabi-wasm.patch}
+ patch -p1 -d llvm -i ${./wasm.patch}
'';
installPhase = if stdenv.isDarwin
diff --git a/pkgs/development/compilers/llvm/12/libcxxabi/libcxxabi-wasm.patch b/pkgs/development/compilers/llvm/12/libcxxabi/wasm.patch
similarity index 100%
rename from pkgs/development/compilers/llvm/12/libcxxabi/libcxxabi-wasm.patch
rename to pkgs/development/compilers/llvm/12/libcxxabi/wasm.patch
diff --git a/pkgs/development/compilers/llvm/12/libunwind/default.nix b/pkgs/development/compilers/llvm/12/libunwind/default.nix
index 8b75146d7b22..abfe950614ad 100644
--- a/pkgs/development/compilers/llvm/12/libunwind/default.nix
+++ b/pkgs/development/compilers/llvm/12/libunwind/default.nix
@@ -15,6 +15,12 @@ stdenv.mkDerivation rec {
mv llvm-* llvm
'';
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
+ outputs = [ "out" "dev" ];
+
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
diff --git a/pkgs/development/compilers/llvm/12/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/libunwind/gnu-install-dirs.patch
new file mode 100644
index 000000000000..a791d6c43231
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/libunwind/gnu-install-dirs.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 48cb8e004e08..fec8144fb95a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -23,6 +23,8 @@ set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
+ project(libunwind LANGUAGES C CXX ASM)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libunwind)
+ set(PACKAGE_VERSION 12.0.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+@@ -115,17 +117,17 @@ set(CMAKE_MODULE_PATH
+
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+ string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+ endif()
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
+ else()
+ set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
+ endif()
+
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
diff --git a/pkgs/development/compilers/llvm/12/lld/default.nix b/pkgs/development/compilers/llvm/12/lld/default.nix
index 18b72a904071..d46f25b68b31 100644
--- a/pkgs/development/compilers/llvm/12/lld/default.nix
+++ b/pkgs/development/compilers/llvm/12/lld/default.nix
@@ -1,9 +1,10 @@
{ lib, stdenv, llvm_meta
+, buildLlvmTools
, fetch
, libunwind
, cmake
, libxml2
-, llvm
+, libllvm
, version
}:
@@ -13,8 +14,20 @@ stdenv.mkDerivation rec {
src = fetch pname "1zakyxk5bwnh7jarckcd4rbmzi58jgn2dbah5j5cwcyfyfbx9drc";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvm libxml2 ];
+ buildInputs = [ libllvm libxml2 ];
+
+ cmakeFlags = [
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ ];
+
+ outputs = [ "out" "lib" "dev" ];
postPatch = ''
substituteInPlace MachO/CMakeLists.txt --replace \
@@ -23,13 +36,6 @@ stdenv.mkDerivation rec {
tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/"
'';
- outputs = [ "out" "dev" ];
-
- postInstall = ''
- moveToOutput include "$dev"
- moveToOutput lib "$dev"
- '';
-
meta = llvm_meta // {
homepage = "https://lld.llvm.org/";
description = "The LLVM linker";
diff --git a/pkgs/development/compilers/llvm/12/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/lld/gnu-install-dirs.patch
new file mode 100644
index 000000000000..61e2f0e48653
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/lld/gnu-install-dirs.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d4e561b50d8f..cfa5bdd79c2a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(LLD_BUILT_STANDALONE TRUE)
+
++ include(GNUInstallDirs)
++
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
+ if(NOT LLVM_CONFIG_PATH)
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
+@@ -179,7 +181,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ )
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index 23df41312403..d62372c88de7 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -20,9 +20,9 @@ macro(add_lld_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -54,7 +54,7 @@ macro(add_lld_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_lldtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -69,5 +69,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
+index 5cff736ff57f..64e775c771b9 100644
+--- a/tools/lld/CMakeLists.txt
++++ b/tools/lld/CMakeLists.txt
+@@ -21,7 +21,7 @@ target_link_libraries(lld
+ )
+
+ install(TARGETS lld
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(NOT LLD_SYMLINKS_TO_CREATE)
+ set(LLD_SYMLINKS_TO_CREATE
diff --git a/pkgs/development/compilers/llvm/12/lldb/default.nix b/pkgs/development/compilers/llvm/12/lldb/default.nix
index 1fce82d7990e..07517308b467 100644
--- a/pkgs/development/compilers/llvm/12/lldb/default.nix
+++ b/pkgs/development/compilers/llvm/12/lldb/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv, llvm_meta
+, runCommand
, fetch
, cmake
, zlib
@@ -7,8 +8,8 @@
, which
, libedit
, libxml2
-, llvm
-, clang-unwrapped
+, libllvm
+, libclang
, python3
, version
, libobjc
@@ -27,17 +28,30 @@ stdenv.mkDerivation (rec {
src = fetch pname "1v85qyq3snk81vjmwq5q7xikyyqsfpqy2c4qmr81mps4avsw1g0l";
- patches = [ ./lldb-procfs.patch ];
+ patches = [
+ ./procfs.patch
+ (runCommand "resource-dir.patch" {
+ clangLibDir = "${libclang.lib}/lib";
+ } ''
+ substitute '${./resource-dir.patch}' "$out" --subst-var clangLibDir
+ '')
+ ./gnu-install-dirs.patch
+ ];
- nativeBuildInputs = [ cmake python3 which swig lit ]
- ++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
+ outputs = [ "out" "lib" "dev" ];
+
+ nativeBuildInputs = [
+ cmake python3 which swig lit
+ ] ++ lib.optionals enableManpages [
+ python3.pkgs.sphinx python3.pkgs.recommonmark
+ ];
buildInputs = [
ncurses
zlib
libedit
libxml2
- llvm
+ libllvm
]
++ lib.optionals stdenv.isDarwin [
libobjc
@@ -51,8 +65,9 @@ stdenv.mkDerivation (rec {
hardeningDisable = [ "format" ];
cmakeFlags = [
+ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
"-DLLVM_ENABLE_RTTI=OFF"
- "-DClang_DIR=${clang-unwrapped}/lib/cmake"
+ "-DClang_DIR=${libclang.dev}/lib/cmake"
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
] ++ lib.optionals stdenv.isDarwin [
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
@@ -62,8 +77,13 @@ stdenv.mkDerivation (rec {
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
+ ] ++ lib.optionals doCheck [
+ "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
];
+ doCheck = false;
+
postInstall = ''
# Editor support
# vscode:
@@ -90,6 +110,7 @@ stdenv.mkDerivation (rec {
'';
propagatedBuildInputs = [];
+
# manually install lldb man page
installPhase = ''
mkdir -p $out/share/man/man1
diff --git a/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch
new file mode 100644
index 000000000000..98321f4479e6
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/lldb/gnu-install-dirs.patch
@@ -0,0 +1,65 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b5633e21c56a..f2f1035e9238 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -10,6 +10,8 @@ set(CMAKE_MODULE_PATH
+ # If we are not building as part of LLVM, build LLDB as a standalone project,
+ # using LLVM as an external library.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
++ include(GNUInstallDirs)
++
+ project(lldb)
+ include(LLDBStandalone)
+
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index 4ed5c647c5d2..89f96e710d55 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -107,13 +107,13 @@ function(add_lldb_library name)
+ endif()
+
+ if(PARAM_SHARED)
+- set(install_dest lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(PARAM_INSTALL_PREFIX)
+ set(install_dest ${PARAM_INSTALL_PREFIX})
+ endif()
+ # RUNTIME is relevant for DLL platforms, FRAMEWORK for macOS
+ install(TARGETS ${name} COMPONENT ${name}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${install_dest}
+ ARCHIVE DESTINATION ${install_dest}
+ FRAMEWORK DESTINATION ${install_dest})
+diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
+index 2fdf1502d055..37364341ff8b 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -225,7 +225,7 @@ include_directories(BEFORE
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".cmake" EXCLUDE
+@@ -233,7 +233,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".cmake" EXCLUDE
+diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
+index 734167e51bc5..f95761b5df58 100644
+--- a/tools/intel-features/CMakeLists.txt
++++ b/tools/intel-features/CMakeLists.txt
+@@ -65,4 +65,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ endif()
+
+ install(TARGETS lldbIntelFeatures
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/pkgs/development/compilers/llvm/12/lldb/lldb-procfs.patch b/pkgs/development/compilers/llvm/12/lldb/procfs.patch
similarity index 100%
rename from pkgs/development/compilers/llvm/12/lldb/lldb-procfs.patch
rename to pkgs/development/compilers/llvm/12/lldb/procfs.patch
diff --git a/pkgs/development/compilers/llvm/12/lldb/resource-dir.patch b/pkgs/development/compilers/llvm/12/lldb/resource-dir.patch
new file mode 100644
index 000000000000..e0db80afeb9f
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/lldb/resource-dir.patch
@@ -0,0 +1,13 @@
+diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
+index 37364341ff8b..7f74c1a3e257 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -257,7 +257,7 @@ if (NOT TARGET clang-resource-headers)
+ # Iterate over the possible places where the external resource directory
+ # could be and pick the first that exists.
+ foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
+- "${LLVM_BUILD_LIBRARY_DIR}"
++ "${LLVM_BUILD_LIBRARY_DIR}" "@clangLibDir@"
+ "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
+ # Build the resource directory path by appending 'clang/'.
+ set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
diff --git a/pkgs/development/compilers/llvm/12/llvm/default.nix b/pkgs/development/compilers/llvm/12/llvm/default.nix
index 33bb7b931f1e..0bc704a81559 100644
--- a/pkgs/development/compilers/llvm/12/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/12/llvm/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv, llvm_meta
+, pkgsBuildBuild
, fetch
, cmake
, python3
@@ -10,10 +11,10 @@
, version
, release_version
, zlib
-, buildPackages
+, buildLlvmTools
, debugVersion ? false
, enableManpages ? false
-, enableSharedLibraries ? true
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
, enablePFM ? !(stdenv.isDarwin
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|| stdenv.isAarch32 # broken for the armv7l builder
@@ -44,8 +45,7 @@ in stdenv.mkDerivation (rec {
mv polly-* $sourceRoot/tools/polly
'';
- outputs = [ "out" "python" ]
- ++ optional enableSharedLibraries "lib";
+ outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python3 ]
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
@@ -59,17 +59,18 @@ in stdenv.mkDerivation (rec {
# Force a test to evaluate the saved benchmark for a CPU for which LLVM has
# an execution model. See NixOS/nixpkgs#119673.
../../exegesis-force-bdver2.patch
- ];
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
- --replace 'set(_install_rpath "@loader_path/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
+ --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
- substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
- patch -p1 < ./llvm-outputs.patch
+ substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
+ patch -p1 < ./outputs.patch
'' + ''
# FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \
@@ -108,6 +109,7 @@ in stdenv.mkDerivation (rec {
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
cmakeFlags = with stdenv; [
+ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
@@ -131,11 +133,24 @@ in stdenv.mkDerivation (rec {
"-DCAN_TARGET_i386=false"
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
- "-DLLVM_TABLEGEN=${buildPackages.llvm_12}/bin/llvm-tblgen"
+ "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ (
+ let
+ nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+ nativeBintools = nativeCC.bintools.bintools;
+ nativeToolchainFlags = [
+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+ ];
+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+ )
];
postBuild = ''
- rm -R $out
+ rm -fR $out
'';
preCheck = ''
@@ -145,20 +160,19 @@ in stdenv.mkDerivation (rec {
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
- ''
- + optionalString enableSharedLibraries ''
- moveToOutput "lib/libLLVM-*" "$lib"
- moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- ''
- + optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+ moveToOutput "bin/llvm-config*" "$dev"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+ --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+ --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
+ ''
+ + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
diff --git a/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 000000000000..68f3c45396f6
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,105 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index ca7c04c565bb..6ed5db5dd4f8 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -2,7 +2,11 @@
+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ project(Polly)
+ cmake_minimum_required(VERSION 3.13.4)
++endif()
++
++include(GNUInstallDirs)
+
++if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ # Where is LLVM installed?
+ find_package(LLVM CONFIG REQUIRED)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -122,13 +126,13 @@ include_directories(
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ )
+
+ install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 7cc129ba2e90..137be25e4b80 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
+- "${POLLY_INSTALL_PREFIX}/include/polly"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+ )
+ else()
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+ ${ISL_INCLUDE_DIRS}
+ )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+ get_target_property(tgt_type ${tgt} TYPE)
+ if (tgt_type STREQUAL "EXECUTABLE")
+- set(tgt_prefix "bin/")
++ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+ else()
+- set(tgt_prefix "lib/")
++ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+ endif()
+
+- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
++ set(tgt_path "${tgt_prefix}$")
+ file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+
+ if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index 518a09b45a42..bd9d6f5542ad 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index 8991094d92c7..178d8ad606bb 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -275,7 +275,7 @@ if (POLLY_BUNDLED_ISL)
+ install(DIRECTORY
+ ${ISL_SOURCE_DIR}/include/
+ ${ISL_BINARY_DIR}/include/
+- DESTINATION include/polly
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs.patch
new file mode 100644
index 000000000000..da8dc1445171
--- /dev/null
+++ b/pkgs/development/compilers/llvm/12/llvm/gnu-install-dirs.patch
@@ -0,0 +1,417 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 277d0fe54d7b..af69c8be8745 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -256,15 +256,21 @@ if (CMAKE_BUILD_TYPE AND
+ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ endif()
+
++include(GNUInstallDirs)
++
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
++set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
++ "Path for binary subdirectory (defaults to 'bin')")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
+ set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
+ "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
+ mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
+
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+@@ -567,9 +573,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
+ option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+
+-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
++set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
+ CACHE STRING "Doxygen-generated HTML documentation install directory")
+-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
++set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
+ CACHE STRING "OCamldoc-generated HTML documentation install directory")
+
+ option (LLVM_BUILD_EXTERNAL_COMPILER_RT
+@@ -1027,7 +1033,7 @@ endif()
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -1038,7 +1044,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -1052,13 +1058,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ if (LLVM_INSTALL_MODULEMAPS)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "module.modulemap"
+ )
+ install(FILES include/llvm/module.install.modulemap
+- DESTINATION include/llvm
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
+ COMPONENT llvm-headers
+ RENAME "module.extern.modulemap"
+ )
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index 97c9980c7de3..409e8b615f75 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -804,9 +804,9 @@ macro(add_llvm_library name)
+
+ install(TARGETS ${name}
+ ${export_to_llvmexports}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+- RUNTIME DESTINATION bin COMPONENT ${name})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${name}
+@@ -1022,7 +1022,7 @@ function(process_llvm_pass_plugins)
+ "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
+ install(FILES
+ ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
+- DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
++ DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
+ COMPONENT cmake-exports)
+
+ set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
+@@ -1242,7 +1242,7 @@ macro(add_llvm_example name)
+ endif()
+ add_llvm_executable(${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endmacro(add_llvm_example name)
+@@ -1854,7 +1854,7 @@ function(llvm_install_library_symlink name dest type)
+ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+
+- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 AND "${type}" STREQUAL "SHARED")
+ set(output_dir bin)
+ endif()
+@@ -1871,7 +1871,7 @@ function(llvm_install_library_symlink name dest type)
+ endif()
+ endfunction()
+
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+ cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+ foreach(path ${CMAKE_MODULE_PATH})
+ if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1894,7 +1894,7 @@ function(llvm_install_symlink name dest)
+ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+
+ install(SCRIPT ${INSTALL_SYMLINK}
+- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+ COMPONENT ${component})
+
+ if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
+@@ -1977,7 +1977,8 @@ function(add_llvm_tool_symlink link_name target)
+ endif()
+
+ if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+- llvm_install_symlink(${link_name} ${target})
++ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++ llvm_install_symlink(${link_name} ${target} ${output_dir})
+ endif()
+ endif()
+ endfunction()
+@@ -2100,9 +2101,9 @@ function(llvm_setup_rpath name)
+
+ if (APPLE)
+ set(_install_name_dir INSTALL_NAME_DIR "@rpath")
+- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ elseif(UNIX)
+- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 554046b20edf..4d1ad980641e 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -144,9 +144,9 @@ function(add_ocaml_library name)
+ endforeach()
+
+ if( APPLE )
+- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index e80c3b5c1cac..482f6d715ef5 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -90,7 +90,7 @@ function (add_sphinx_target builder project)
+ endif()
+ elseif (builder STREQUAL html)
+ string(TOUPPER "${project}" project_upper)
+- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
++ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
+ CACHE STRING "HTML documentation install directory for ${project}")
+
+ # '/.' indicates: copy the contents of the directory directly into
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index 505dc9a29d70..36e6c63af3f4 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -107,13 +107,13 @@ foreach(p ${_count})
+ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+ get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
++set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
+ set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+ set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
++set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
+ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
+-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
++set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+
+ # Generate a default location for lit
+ if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index 09fed8085c23..aa79f192abf0 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
+ set(LINK_OR_COPY copy)
+ endif()
+
+- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
++ set(bindir "${DESTDIR}${outdir}/")
+
+ message(STATUS "Creating ${name}")
+
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index bb821b417ad9..6a528f7c2ad3 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+- to install libraries to ``/usr/lib64``.
++ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
+ **CMAKE_C_FLAGS**:STRING
+ Extra flags to use when compiling C source files.
+@@ -550,8 +550,8 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
+ The path to install Doxygen-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/doxygen-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
+
+ **LLVM_ENABLE_SPHINX**:BOOL
+ If specified, CMake will search for the ``sphinx-build`` executable and will make
+@@ -582,13 +582,33 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
+ The path to install Sphinx-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
+
+ **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
+ The path to install OCamldoc-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/ocaml-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
++
++**CMAKE_INSTALL_BINDIR**:STRING
++ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `bin`.
++
++**CMAKE_INSTALL_LIBDIR**:STRING
++ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `lib`.
++
++**CMAKE_INSTALL_INCLUDEDIR**:STRING
++ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `include`.
++
++**CMAKE_INSTALL_DOCDIR**:STRING
++ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/doc`.
++
++**CMAKE_INSTALL_MANDIR**:STRING
++ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/man`.
+
+ **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
+ macOS Only: If enabled CMake will generate a target named
+@@ -786,9 +806,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+
+ This file is available in two different locations.
+
+-* ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+- ```` is the install prefix of an installed version of LLVM.
+- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``LLVMConfig.cmake`` where
++ ```` is the location where LLVM CMake modules are
++ installed as part of an installed version of LLVM. This is typically
++ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+
+ * ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+ ```` is the root of the LLVM build tree. **Note: this is only
+diff --git a/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt
+index bb96edb4b4bf..678c22fb43c8 100644
+--- a/examples/Bye/CMakeLists.txt
++++ b/examples/Bye/CMakeLists.txt
+@@ -14,6 +14,6 @@ if (NOT WIN32)
+ BUILDTREE_ONLY
+ )
+
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endif()
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index b46319f24fc8..2feabd1954e4 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -5,5 +5,5 @@ add_subdirectory(Frontend)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+- configure_file(module.modulemap.build module.modulemap COPYONLY)
++ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index ebe5b73a5c65..70c497be12f5 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -23,6 +23,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
++#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 1a2f04552d13..44fa7d3eec6b 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -357,12 +357,26 @@ int main(int argc, char **argv) {
+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
+ } else {
+ ActivePrefix = CurrentExecPrefix;
+- ActiveIncludeDir = ActivePrefix + "/include";
+- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+- sys::fs::make_absolute(ActivePrefix, path);
+- ActiveBinDir = std::string(path.str());
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveIncludeDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveBinDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveLibDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveCMakeDir = std::string(path.str());
++ }
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
+index 2963f97cad88..69d66c9c9ca1 100644
+--- a/tools/lto/CMakeLists.txt
++++ b/tools/lto/CMakeLists.txt
+@@ -25,7 +25,7 @@ add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
+ intrinsics_gen)
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT LTO)
+
+ if (APPLE)
+diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
+index ead73ec13a8f..250362021f17 100644
+--- a/tools/opt-viewer/CMakeLists.txt
++++ b/tools/opt-viewer/CMakeLists.txt
+@@ -8,7 +8,7 @@ set (files
+
+ foreach (file ${files})
+ install(PROGRAMS ${file}
+- DESTINATION share/opt-viewer
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
+ COMPONENT opt-viewer)
+ endforeach (file)
+
+diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt
+index 865436247270..ce1daa62f6ab 100644
+--- a/tools/remarks-shlib/CMakeLists.txt
++++ b/tools/remarks-shlib/CMakeLists.txt
+@@ -19,7 +19,7 @@ if(LLVM_ENABLE_PIC)
+ endif()
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT Remarks)
+
+ if (APPLE)
diff --git a/pkgs/development/compilers/llvm/12/llvm/llvm-outputs.patch b/pkgs/development/compilers/llvm/12/llvm/outputs.patch
similarity index 100%
rename from pkgs/development/compilers/llvm/12/llvm/llvm-outputs.patch
rename to pkgs/development/compilers/llvm/12/llvm/outputs.patch
diff --git a/pkgs/development/compilers/llvm/5/clang/default.nix b/pkgs/development/compilers/llvm/5/clang/default.nix
index 21961f4f0413..bbeb9277683d 100644
--- a/pkgs/development/compilers/llvm/5/clang/default.nix
+++ b/pkgs/development/compilers/llvm/5/clang/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
}:
@@ -22,20 +23,27 @@ let
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
- buildInputs = [ libxml2 llvm ];
+ buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DLLVM_ENABLE_RTTI=ON"
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
];
- patches = [ ./purity.patch ];
+ patches = [
+ ./purity.patch
+ ./gnu-install-dirs.patch
+ ];
postPatch = ''
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
@@ -48,12 +56,12 @@ let
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
'';
- outputs = [ "out" "lib" "python" ];
+ outputs = [ "out" "lib" "dev" "python" ];
# Clang expects to find LLVMgold in its own prefix
postInstall = ''
- if [ -e ${llvm}/lib/LLVMgold.so ]; then
- ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+ if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
+ ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
fi
ln -sv $out/bin/clang $out/bin/cpp
@@ -70,11 +78,14 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
+
+ mkdir -p $dev/bin
+ cp bin/clang-tblgen $dev/bin
'';
passthru = {
isClang = true;
- inherit llvm;
+ inherit libllvm;
};
meta = {
diff --git a/pkgs/development/compilers/llvm/5/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/5/clang/gnu-install-dirs.patch
new file mode 100644
index 000000000000..7e6903222f45
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/clang/gnu-install-dirs.patch
@@ -0,0 +1,242 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2667b1d6892e..87c5ad58738f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.4.3)
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ project(Clang)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ find_program(LLVM_CONFIG "llvm-config")
+@@ -344,7 +346,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/clang include/clang-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+@@ -353,7 +355,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "CMakeFiles" EXCLUDE
+ PATTERN "*.inc"
+@@ -361,7 +363,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(PROGRAMS utils/bash-autocomplete.sh
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ )
+ endif()
+
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index e657059744a4..19da44638fe6 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -99,9 +99,9 @@ macro(add_clang_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_clangtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_custom_target(install-${name}
+@@ -143,7 +143,7 @@ macro(add_clang_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_clangtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -160,5 +160,5 @@ endmacro()
+ macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index a621c02644e3..e140efc9c83c 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -129,13 +129,13 @@ install(
+ FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${cuda_wrapper_files}
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
+ add_custom_target(install-clang-headers
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index ad990e010eef..92e52d05afb9 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -48,7 +48,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
+ "@executable_path/../../lib")
+ else()
+- set(INSTALL_DESTINATION bin)
++ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+
+ install(TARGETS c-index-test
+diff --git a/tools/clang-check/CMakeLists.txt b/tools/clang-check/CMakeLists.txt
+index 04151a8e0331..13918d91c4ba 100644
+--- a/tools/clang-check/CMakeLists.txt
++++ b/tools/clang-check/CMakeLists.txt
+@@ -19,4 +19,4 @@ target_link_libraries(clang-check
+ )
+
+ install(TARGETS clang-check
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
+index a13633eaefc4..9b0094783690 100644
+--- a/tools/clang-format/CMakeLists.txt
++++ b/tools/clang-format/CMakeLists.txt
+@@ -20,20 +20,20 @@ if( LLVM_USE_SANITIZE_COVERAGE )
+ endif()
+
+ install(PROGRAMS clang-format-bbedit.applescript
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-diff.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-sublime.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS git-clang-format
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT clang-format)
+diff --git a/tools/clang-offload-bundler/CMakeLists.txt b/tools/clang-offload-bundler/CMakeLists.txt
+index 6161d08ae587..a003292d1676 100644
+--- a/tools/clang-offload-bundler/CMakeLists.txt
++++ b/tools/clang-offload-bundler/CMakeLists.txt
+@@ -21,4 +21,4 @@ target_link_libraries(clang-offload-bundler
+ ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
+ )
+
+-install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
++install(TARGETS clang-offload-bundler RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
+index 771e3bdea6f0..d1396e62b28f 100644
+--- a/tools/clang-rename/CMakeLists.txt
++++ b/tools/clang-rename/CMakeLists.txt
+@@ -14,11 +14,11 @@ target_link_libraries(clang-rename
+ clangToolingRefactor
+ )
+
+-install(TARGETS clang-rename RUNTIME DESTINATION bin)
++install(TARGETS clang-rename RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ install(PROGRAMS clang-rename.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+ install(PROGRAMS clang-rename.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 2dd670307636..1fe576f77ddb 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -121,7 +121,7 @@ endif()
+ if(INTERNAL_INSTALL_PREFIX)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
+ else()
+- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
++ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ endif()
+
+ install(DIRECTORY ../../include/clang-c
+diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
+index 380379300b09..adfd58ed5f7d 100644
+--- a/tools/scan-build/CMakeLists.txt
++++ b/tools/scan-build/CMakeLists.txt
+@@ -41,7 +41,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(LibexecFile ${LibexecFiles})
+@@ -53,7 +53,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/libexec/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
+- install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
++ install(PROGRAMS libexec/${LibexecFile} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
+ endforeach()
+
+ foreach(ManPage ${ManPages})
+@@ -77,7 +77,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/share/scan-build/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+- install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
++ install(FILES share/scan-build/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build)
+ endforeach()
+
+ add_custom_target(scan-build ALL DEPENDS ${Depends})
+diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
+index b305ca562a72..554bcb379061 100644
+--- a/tools/scan-view/CMakeLists.txt
++++ b/tools/scan-view/CMakeLists.txt
+@@ -21,7 +21,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(ShareFile ${ShareFiles})
+@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/share/scan-view/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+- install(FILES share/${ShareFile} DESTINATION share/scan-view)
++ install(FILES share/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view)
+ endforeach()
+
+ add_custom_target(scan-view ALL DEPENDS ${Depends})
diff --git a/pkgs/development/compilers/llvm/5/compiler-rt/default.nix b/pkgs/development/compilers/llvm/5/compiler-rt/default.nix
index 705c5994bd14..7e85c420da03 100644
--- a/pkgs/development/compilers/llvm/5/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/5/compiler-rt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
inherit version;
src = fetch "compiler-rt" "0ipd4jdxpczgr2w6lzrabymz6dhzj69ywmyybjjc1q397zgrvziy";
- nativeBuildInputs = [ cmake python3 llvm ];
+ nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
NIX_CFLAGS_COMPILE = [
@@ -54,6 +54,7 @@ stdenv.mkDerivation {
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
+ ./gnu-install-dirs.patch
] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional (stdenv.hostPlatform.libc == "glibc") ./sys-ustat.patch
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
diff --git a/pkgs/development/compilers/llvm/5/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/5/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 000000000000..618e597e96d4
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,103 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f997c53410c1..ac079d89b57b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,6 +12,7 @@ cmake_minimum_required(VERSION 3.4.3)
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+ project(CompilerRT C CXX ASM)
++ include(GNUInstallDirs)
+ set(COMPILER_RT_STANDALONE_BUILD TRUE)
+ endif()
+
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index bc5fb9ff722b..91fb79d1980c 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -344,7 +344,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ # Install in Clang resource directory.
+ install(FILES ${file_name}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_PREFIX}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+@@ -361,7 +361,7 @@ macro(add_compiler_rt_script name)
+ add_custom_target(${name} DEPENDS ${dst})
+ install(FILES ${dst}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
+ endmacro(add_compiler_rt_script src name)
+
+ # Builds custom version of libc++ and installs it in .
+diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
+index f646975475bb..75885bf305b8 100644
+--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
+@@ -391,7 +391,7 @@ macro(darwin_add_embedded_builtin_libraries)
+ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
+
+ set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+ set(CFLAGS_i386 "-march=pentium")
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index b38c6ca96fac..a4580414cbc8 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -43,11 +43,11 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+ # Take output dir and install path from the user.
+ set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+- "Path where built compiler-rt libraries should be stored.")
++ "Path where built compiler-rt build artifacts should be stored.")
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+ "Path where built compiler-rt executables should be stored.")
+- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+- "Path where built compiler-rt libraries should be installed.")
++ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
++ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
+ # Use a host compiler to compile/link tests.
+@@ -67,9 +67,9 @@ if(NOT DEFINED COMPILER_RT_OS_DIR)
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
+ endif()
+ set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+- ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_OUTPUT_DIR}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+ set(COMPILER_RT_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+
+ if(APPLE)
+ # On Darwin if /usr/include doesn't exist, the user probably has Xcode but not
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index ec3bf40b95e6..af119f10ee2b 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -44,8 +44,8 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
+ # Install sanitizer headers.
+ install(FILES ${SANITIZER_HEADERS}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
+ # Install xray headers.
+ install(FILES ${XRAY_HEADERS}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
+diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
+index 2c486bff821b..0ee715da95f8 100644
+--- a/lib/dfsan/CMakeLists.txt
++++ b/lib/dfsan/CMakeLists.txt
+@@ -44,4 +44,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
+ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
+ add_dependencies(dfsan dfsan_abilist)
+ install(FILES ${dfsan_abilist_filename}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH})
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_PREFIX})
diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix
index 86bba415c015..c416964b22a3 100644
--- a/pkgs/development/compilers/llvm/5/default.nix
+++ b/pkgs/development/compilers/llvm/5/default.nix
@@ -1,6 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith
-, buildPackages
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@@ -18,34 +17,43 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "018b3fiwah8f8br5i26qmzh6sjvzchpn358sn8v079m49f2jldm3";
tools = lib.makeExtensible (tools: let
- callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
+ callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
+ ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
+
in {
- llvm = callPackage ./llvm { };
+ libllvm = callPackage ./llvm { };
- clang-unwrapped = callPackage ./clang {
+ # `llvm` historically had the binaries. When choosing an output explicitly,
+ # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
+ llvm = tools.libllvm.out // { outputUnspecified = true; };
+
+ libllvm-polly = callPackage ./llvm { enablePolly = true; };
+
+ llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
+
+ libclang = callPackage ./clang {
inherit clang-tools-extra_src;
};
- llvm-manpages = lowPrio (tools.llvm.override {
+ clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
+
+ llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
- clang-manpages = lowPrio (tools.clang-unwrapped.override {
+ clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
- libclang = tools.clang-unwrapped.lib;
-
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
diff --git a/pkgs/development/compilers/llvm/5/libc++/default.nix b/pkgs/development/compilers/llvm/5/libc++/default.nix
index 164836e1a4ce..77421b4e6d8d 100644
--- a/pkgs/development/compilers/llvm/5/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/5/libc++/default.nix
@@ -11,7 +11,11 @@ stdenv.mkDerivation {
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
'';
- patches = lib.optionals stdenv.hostPlatform.isMusl [
+ outputs = [ "out" "dev" ];
+
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
diff --git a/pkgs/development/compilers/llvm/5/libc++/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/5/libc++/gnu-install-dirs.patch
new file mode 100644
index 000000000000..d9ea0dc7dfd0
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/libc++/gnu-install-dirs.patch
@@ -0,0 +1,72 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ca5afba86d19..ed69e4043c3d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,6 +22,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libcxx CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxx)
+ set(PACKAGE_VERSION 5.0.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
+index b1f6bee8f945..1b455fceed7f 100644
+--- a/cmake/Modules/HandleLibCXXABI.cmake
++++ b/cmake/Modules/HandleLibCXXABI.cmake
+@@ -55,7 +55,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
+ )
+ if (LIBCXX_INSTALL_HEADERS)
+ install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
+ COMPONENT libcxx
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index 5a1b2ccdc426..106d3d6c1d3c 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -20,7 +20,7 @@ endif()
+
+ if (LIBCXX_INSTALL_HEADERS)
+ install(DIRECTORY .
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ COMPONENT cxx-headers
+ FILES_MATCHING
+ ${LIBCXX_HEADER_PATTERN}
+@@ -44,7 +44,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ set(generated_config_deps generate_config_header)
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT cxx-headers)
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index 578651423f3b..277befd631ac 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -355,8 +355,8 @@ if (LIBCXX_INSTALL_LIBRARY)
+ set(experimental_lib cxx_experimental)
+ endif()
+ install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
+- LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+- ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
++ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
++ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+ )
+ # NOTE: This install command must go after the cxx install command otherwise
+ # it will not be executed after the library symlinks are installed.
+@@ -364,7 +364,7 @@ if (LIBCXX_INSTALL_LIBRARY)
+ # Replace the libc++ filename with $
+ # after we required CMake 3.0.
+ install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}
+ COMPONENT libcxx)
+ endif()
+ endif()
diff --git a/pkgs/development/compilers/llvm/5/libc++abi/default.nix b/pkgs/development/compilers/llvm/5/libc++abi/default.nix
index dd148a8917f9..8bc3b9e2977b 100644
--- a/pkgs/development/compilers/llvm/5/libc++abi/default.nix
+++ b/pkgs/development/compilers/llvm/5/libc++abi/default.nix
@@ -6,8 +6,7 @@ stdenv.mkDerivation {
src = fetch "libcxxabi" "12lp799rskr4fc2xr64qn4jfkjnfd8b1aymvsxyn4k9ar7r9pgqv";
- nativeBuildInputs = [ cmake ];
- buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
+ outputs = [ "out" "dev" ];
postUnpack = ''
unpackFile ${libcxx.src}
@@ -19,6 +18,13 @@ stdenv.mkDerivation {
patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
'';
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
+ nativeBuildInputs = [ cmake ];
+ buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
+
installPhase = if stdenv.isDarwin
then ''
for file in lib/*.dylib; do
diff --git a/pkgs/development/compilers/llvm/5/libc++abi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/5/libc++abi/gnu-install-dirs.patch
new file mode 100644
index 000000000000..760d7194f7b9
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/libc++abi/gnu-install-dirs.patch
@@ -0,0 +1,28 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4db3328deb9c..74b39acfe588 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libcxxabi CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxxabi)
+ set(PACKAGE_VERSION 5.0.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index adcc412880c9..71758665af05 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -174,8 +174,8 @@ endif()
+ add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
+
+ install(TARGETS ${LIBCXXABI_TARGETS}
+- LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
+- ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
++ LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
++ ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
+ )
+
+ if (NOT CMAKE_CONFIGURATION_TYPES)
diff --git a/pkgs/development/compilers/llvm/5/lld/default.nix b/pkgs/development/compilers/llvm/5/lld/default.nix
index 244960cf41ba..73762e2d2e50 100644
--- a/pkgs/development/compilers/llvm/5/lld/default.nix
+++ b/pkgs/development/compilers/llvm/5/lld/default.nix
@@ -1,7 +1,8 @@
{ lib, stdenv
+, buildLlvmTools
, fetch
, cmake
-, llvm
+, libllvm
, version
}:
@@ -11,15 +12,20 @@ stdenv.mkDerivation {
src = fetch "lld" "1ah75rjly6747jk1zbwca3z0svr9b09ylgxd4x9ns721xir6sia6";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvm ];
+ buildInputs = [ libllvm ];
- outputs = [ "out" "dev" ];
+ cmakeFlags = [
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ ];
- postInstall = ''
- moveToOutput include "$dev"
- moveToOutput lib "$dev"
- '';
+ outputs = [ "out" "lib" "dev" ];
meta = {
description = "The LLVM Linker";
diff --git a/pkgs/development/compilers/llvm/5/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/5/lld/gnu-install-dirs.patch
new file mode 100644
index 000000000000..ed673870dec5
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/lld/gnu-install-dirs.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e2ab0e35f1ab..f68e23d2a70d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(LLD_BUILT_STANDALONE TRUE)
+
++ include(GNUInstallDirs)
++
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
+ if(NOT LLVM_CONFIG_PATH)
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
+@@ -203,7 +205,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index fd1d44199ca6..2ec1831ed8f6 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -20,9 +20,9 @@ macro(add_lld_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_custom_target(install-${name}
+@@ -56,7 +56,7 @@ macro(add_lld_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_lldtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -73,5 +73,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
+index 2df10697ff66..94aa8d092220 100644
+--- a/tools/lld/CMakeLists.txt
++++ b/tools/lld/CMakeLists.txt
+@@ -13,7 +13,7 @@ target_link_libraries(lld
+ )
+
+ install(TARGETS lld
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(NOT LLD_SYMLINKS_TO_CREATE)
+ set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld)
diff --git a/pkgs/development/compilers/llvm/5/lldb/default.nix b/pkgs/development/compilers/llvm/5/lldb/default.nix
index 61a9e60391c8..723792d1341c 100644
--- a/pkgs/development/compilers/llvm/5/lldb/default.nix
+++ b/pkgs/development/compilers/llvm/5/lldb/default.nix
@@ -8,14 +8,14 @@
, which
, libedit
, libxml2
-, llvm
-, clang-unwrapped
+, libllvm
+, libclang
, python3
, version
, darwin
}:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
pname = "lldb";
inherit version;
@@ -28,29 +28,46 @@ stdenv.mkDerivation {
sha256 = "1zbx4m0m8kbg0wq6740jcw151vb2pb1p25p401wiq8diqqagkjps";
stripLen = 1;
})
+ ./gnu-install-dirs.patch
];
postPatch = ''
# Fix up various paths that assume llvm and clang are installed in the same place
- sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
+ sed -i 's,".*ClangConfig.cmake","${libclang.dev}/lib/cmake/clang/ClangConfig.cmake",' \
cmake/modules/LLDBStandalone.cmake
- sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
+ sed -i 's,".*tools/clang/include","${libclang.dev}/include",' \
cmake/modules/LLDBStandalone.cmake
- sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
+ sed -i 's,"$.LLVM_LIBRARY_DIR.",${libllvm.lib}/lib ${libclang.lib}/lib,' \
cmake/modules/LLDBStandalone.cmake
'';
- nativeBuildInputs = [ cmake python3 which swig ];
- buildInputs = [ ncurses zlib libedit libxml2 llvm ]
- ++ lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
+ outputs = [ "out" "lib" "dev" ];
+
+ nativeBuildInputs = [
+ cmake python3 which swig
+ ];
+
+ buildInputs = [
+ ncurses zlib libedit libxml2 libllvm
+ ] ++ lib.optionals stdenv.isDarwin [
+ darwin.libobjc
+ darwin.apple_sdk.libs.xpc
+ darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa
+ ];
CXXFLAGS = "-fno-rtti";
hardeningDisable = [ "format" ];
cmakeFlags = [
+ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
+ ] ++ lib.optionals doCheck [
+ "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
];
+ doCheck = false;
+
postInstall = ''
mkdir -p $out/share/man/man1
cp ../docs/lldb.1 $out/share/man/man1/
diff --git a/pkgs/development/compilers/llvm/5/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/5/lldb/gnu-install-dirs.patch
new file mode 100644
index 000000000000..5c6193b028fa
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/lldb/gnu-install-dirs.patch
@@ -0,0 +1,76 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ada293811b3e..6c2149309f65 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,8 @@ set(CMAKE_MODULE_PATH
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+ )
+
++include(GNUInstallDirs)
++
+ include(LLDBStandalone)
+ include(LLDBConfig)
+ include(AddLLDB)
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index 4c6f1efd673d..179a12b49cce 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -54,14 +54,14 @@ function(add_lldb_library name)
+ endif()
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${out_dir}
+ ARCHIVE DESTINATION ${out_dir})
+ else()
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_custom_target(install-${name}
+@@ -126,7 +126,7 @@ function(add_lldb_executable name)
+ if(ARG_GENERATE_INSTALL AND NOT (ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK ))
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_custom_target(install-${name}
+ DEPENDS ${name}
+diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
+index 726552675f47..f1f769f34446 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -276,7 +276,7 @@ include_directories(BEFORE
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+ COMPONENT lldb_headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+@@ -286,7 +286,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ COMPONENT lldb_headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/tools/intel-mpx/CMakeLists.txt b/tools/intel-mpx/CMakeLists.txt
+index 29ba9a1cacec..30e2f9334b95 100644
+--- a/tools/intel-mpx/CMakeLists.txt
++++ b/tools/intel-mpx/CMakeLists.txt
+@@ -12,4 +12,4 @@ target_link_libraries(lldb-intel-mpxtable
+ PUBLIC liblldb LLVMSupport)
+
+ install(TARGETS lldb-intel-mpxtable
+- LIBRARY DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/pkgs/development/compilers/llvm/5/llvm/default.nix b/pkgs/development/compilers/llvm/5/llvm/default.nix
index 94d2a1e58638..0cbd30c783c1 100644
--- a/pkgs/development/compilers/llvm/5/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/5/llvm/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv
+, pkgsBuildBuild
, fetch
, fetchpatch
, cmake
@@ -10,9 +11,11 @@
, version
, release_version
, zlib
+, buildLlvmTools
, debugVersion ? false
, enableManpages ? false
, enableSharedLibraries ? !enableManpages
+, enablePolly ? false
}:
let
@@ -29,15 +32,18 @@ stdenv.mkDerivation ({
inherit version;
src = fetch "llvm" "0g1bbj2n6xv4p1n6hh17vj3vpvg56wacipc81dgwga9mg2lys8nm";
+ polly_src = fetch "polly" "1f4i1qsw7ywx25v262p8syz339zcbvfkx295xz26hmqrn944xa6x";
unpackPhase = ''
unpackFile $src
mv llvm-${version}* llvm
sourceRoot=$PWD/llvm
+ '' + optionalString enablePolly ''
+ unpackFile $polly_src
+ mv polly-* $sourceRoot/tools/polly
'';
- outputs = [ "out" "python" ]
- ++ optional enableSharedLibraries "lib";
+ outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python3 ]
++ optional enableManpages python3.pkgs.sphinx;
@@ -59,11 +65,13 @@ stdenv.mkDerivation ({
# sha256 = "0injj1hqgrbcbihhwp2nbal88jfykad30r54f2cdcx7gws2fcy8i";
# stripLen = 1;
#})
- ];
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
+
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
- --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
+ --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
@@ -90,6 +98,7 @@ stdenv.mkDerivation ({
'';
cmakeFlags = with stdenv; [
+ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
@@ -100,20 +109,36 @@ stdenv.mkDerivation ({
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
]
- ++ optional enableSharedLibraries
+ ++ lib.optional enableSharedLibraries
"-DLLVM_LINK_LLVM_DYLIB=ON"
- ++ optionals enableManpages [
+ ++ lib.optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
]
- ++ optional (!isDarwin)
+ ++ lib.optional (!isDarwin)
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
- ++ optionals (isDarwin) [
+ ++ lib.optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false"
+ ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DCMAKE_CROSSCOMPILING=True"
+ "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ (
+ let
+ nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+ nativeBintools = nativeCC.bintools.bintools;
+ nativeToolchainFlags = [
+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+ ];
+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+ )
];
postBuild = ''
@@ -127,21 +152,20 @@ stdenv.mkDerivation ({
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
- ''
- + optionalString enableSharedLibraries ''
- moveToOutput "lib/libLLVM-*" "$lib"
- moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- moveToOutput "lib/libLTO${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+ moveToOutput "bin/llvm-config*" "$dev"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+ --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+ --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLTO.dylib" "$lib/lib/libLTO.dylib"
${lib.concatMapStringsSep "\n" (v: ''
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes}
+ ''
+ + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isi686);
diff --git a/pkgs/development/compilers/llvm/5/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/5/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 000000000000..40f6fa06036c
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,106 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index 9ddc0f7ff81d..7ca45f286d47 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -2,7 +2,11 @@
+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ project(Polly)
+ cmake_minimum_required(VERSION 3.4.3)
++endif()
++
++include(GNUInstallDirs)
+
++if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ # Where is LLVM installed?
+ find_package(LLVM CONFIG REQUIRED)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -157,14 +161,14 @@ include_directories(
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+ )
+
+ install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 969292cd6b00..d7aea77bdd20 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
+- "${POLLY_INSTALL_PREFIX}/include/polly"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+ )
+ else()
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+ ${ISL_INCLUDE_DIRS}
+ )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+ get_target_property(tgt_type ${tgt} TYPE)
+ if (tgt_type STREQUAL "EXECUTABLE")
+- set(tgt_prefix "bin/")
++ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+ else()
+- set(tgt_prefix "lib/")
++ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+ endif()
+
+- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
++ set(tgt_path "${tgt_prefix}$")
+ file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+
+ if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index 32bed50bb060..cca5bfff4970 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index 286c04fba287..07905e68f595 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -268,7 +268,7 @@ if (POLLY_BUNDLED_ISL)
+ install(DIRECTORY
+ ${ISL_SOURCE_DIR}/include/
+ ${ISL_BINARY_DIR}/include/
+- DESTINATION include/polly
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/5/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/5/llvm/gnu-install-dirs.patch
new file mode 100644
index 000000000000..3f6d6acb83f7
--- /dev/null
+++ b/pkgs/development/compilers/llvm/5/llvm/gnu-install-dirs.patch
@@ -0,0 +1,386 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c1e03aed4809..8b8bbb8c403e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -279,15 +279,21 @@ if (CMAKE_BUILD_TYPE AND
+ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ endif()
+
++include(GNUInstallDirs)
++
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
++set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
++ "Path for binary subdirectory (defaults to 'bin')")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
+ set(LLVM_UTILS_INSTALL_DIR "bin" CACHE STRING
+ "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+@@ -512,9 +518,9 @@ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OF
+ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
+
+-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
++set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
+ CACHE STRING "Doxygen-generated HTML documentation install directory")
+-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
++set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
+ CACHE STRING "OCamldoc-generated HTML documentation install directory")
+
+ option (LLVM_BUILD_EXTERNAL_COMPILER_RT
+@@ -945,7 +951,7 @@ add_subdirectory(cmake/modules)
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -957,7 +963,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index 1c922651b133..d555fd627a4f 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -589,11 +589,11 @@ macro(add_llvm_library name)
+ else()
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" OR
+ (LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
+- set(install_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(ARG_SHARED OR BUILD_SHARED_LIBS)
+ if(WIN32 OR CYGWIN OR MINGW)
+ set(install_type RUNTIME)
+- set(install_dir bin)
++ set(install_dir ${CMAKE_INSTALL_BINDIR})
+ else()
+ set(install_type LIBRARY)
+ endif()
+@@ -637,9 +637,9 @@ macro(add_llvm_loadable_module name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ if(WIN32 OR CYGWIN)
+ # DLL platform
+- set(dlldir "bin")
++ set(dlldir "${CMAKE_INSTALL_BINDIR}")
+ else()
+- set(dlldir "lib${LLVM_LIBDIR_SUFFIX}")
++ set(dlldir "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+
+ if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+@@ -651,7 +651,7 @@ macro(add_llvm_loadable_module name)
+ install(TARGETS ${name}
+ ${export_to_llvmexports}
+ LIBRARY DESTINATION ${dlldir}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endif()
+@@ -864,7 +864,7 @@ macro(add_llvm_example name)
+ endif()
+ add_llvm_executable(${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endmacro(add_llvm_example name)
+@@ -1275,7 +1275,7 @@ function(llvm_install_library_symlink name dest type)
+ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+
+- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 AND "${type}" STREQUAL "SHARED")
+ set(output_dir bin)
+ endif()
+@@ -1293,7 +1293,7 @@ function(llvm_install_library_symlink name dest type)
+ endif()
+ endfunction()
+
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+ cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+ foreach(path ${CMAKE_MODULE_PATH})
+ if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1316,7 +1316,7 @@ function(llvm_install_symlink name dest)
+ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+
+ install(SCRIPT ${INSTALL_SYMLINK}
+- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+ COMPONENT ${component})
+
+ if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
+@@ -1400,7 +1400,8 @@ function(add_llvm_tool_symlink link_name target)
+ endif()
+
+ if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+- llvm_install_symlink(${link_name} ${target})
++ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++ llvm_install_symlink(${link_name} ${target} ${output_dir})
+ endif()
+ endif()
+ endfunction()
+@@ -1452,9 +1453,9 @@ function(llvm_setup_rpath name)
+
+ if (APPLE)
+ set(_install_name_dir INSTALL_NAME_DIR "@rpath")
+- set(_install_rpath "@loader_path/../lib" ${extra_libdir})
++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
+ elseif(UNIX)
+- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 1d8094cc505f..afdbe6e6d19c 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -140,9 +140,9 @@ function(add_ocaml_library name)
+ endforeach()
+
+ if( APPLE )
+- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 4540c5c36c8e..4cefb17fbd55 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -73,7 +73,7 @@ function (add_sphinx_target builder project)
+
+ elseif (builder STREQUAL html)
+ string(TOUPPER "${project}" project_upper)
+- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
++ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
+ CACHE STRING "HTML documentation install directory for ${project}")
+
+ # '/.' indicates: copy the contents of the directory directly into
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index ac4b0b7c0304..21a6a3da8667 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -84,11 +84,11 @@ foreach(p ${_count})
+ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+ get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
+-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
++set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
++set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
+ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
+-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
++set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
+ set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
+ configure_file(
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index 482697b06baf..af2ac1e6c979 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
+ set(LINK_OR_COPY copy)
+ endif()
+
+- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
++ set(bindir "${DESTDIR}${outdir}/")
+
+ message("Creating ${name}")
+
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index b6ebf37adc92..34c73d2869e0 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+- to install libraries to ``/usr/lib64``.
++ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
+ **CMAKE_C_FLAGS**:STRING
+ Extra flags to use when compiling C source files.
+@@ -461,8 +461,8 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
+ The path to install Doxygen-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/doxygen-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
+
+ **LLVM_ENABLE_SPHINX**:BOOL
+ If specified, CMake will search for the ``sphinx-build`` executable and will make
+@@ -493,13 +493,33 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
+ The path to install Sphinx-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
+
+ **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
+ The path to install OCamldoc-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/ocaml-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
++
++**CMAKE_INSTALL_BINDIR**:STRING
++ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `bin`.
++
++**CMAKE_INSTALL_LIBDIR**:STRING
++ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `lib`.
++
++**CMAKE_INSTALL_INCLUDEDIR**:STRING
++ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `include`.
++
++**CMAKE_INSTALL_DOCDIR**:STRING
++ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/doc`.
++
++**CMAKE_INSTALL_MANDIR**:STRING
++ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/man`.
+
+ **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
+ OS X Only: If enabled CMake will generate a target named
+@@ -651,9 +671,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+
+ This file is available in two different locations.
+
+-* ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+- ```` is the install prefix of an installed version of LLVM.
+- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``LLVMConfig.cmake`` where
++ ```` is the location where LLVM CMake modules are
++ installed as part of an installed version of LLVM. This is typically
++ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+
+ * ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+ ```` is the root of the LLVM build tree. **Note: this is only
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index 1d5ca3ba92b0..026f5453c1da 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -4,5 +4,5 @@ add_subdirectory(Support)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+- configure_file(module.modulemap.build module.modulemap COPYONLY)
++ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index f201e1f7bff0..4582ed556a02 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -24,6 +24,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
++#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 08b096afb052..2deae0dcfacc 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -332,12 +332,26 @@ int main(int argc, char **argv) {
+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
+ } else {
+ ActivePrefix = CurrentExecPrefix;
+- ActiveIncludeDir = ActivePrefix + "/include";
+- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+- sys::fs::make_absolute(ActivePrefix, path);
+- ActiveBinDir = path.str();
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveIncludeDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveBinDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveLibDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveCMakeDir = std::string(path.str());
++ }
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
+index 6e913519a809..85641eef721f 100644
+--- a/tools/lto/CMakeLists.txt
++++ b/tools/lto/CMakeLists.txt
+@@ -19,7 +19,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
+ add_llvm_library(LTO SHARED ${SOURCES} DEPENDS intrinsics_gen)
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT LTO)
+
+ if (APPLE)
+diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
+index 19b606933082..27b9f71b3d79 100644
+--- a/tools/opt-viewer/CMakeLists.txt
++++ b/tools/opt-viewer/CMakeLists.txt
+@@ -8,6 +8,6 @@ set (files
+
+ foreach (file ${files})
+ install(PROGRAMS ${file}
+- DESTINATION share/opt-viewer
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
+ COMPONENT opt-viewer)
+ endforeach (file)
diff --git a/pkgs/development/compilers/llvm/6/clang/default.nix b/pkgs/development/compilers/llvm/6/clang/default.nix
index 41202dd3f5dc..5c4894af9da9 100644
--- a/pkgs/development/compilers/llvm/6/clang/default.nix
+++ b/pkgs/development/compilers/llvm/6/clang/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
+{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
}:
@@ -22,20 +23,27 @@ let
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
- buildInputs = [ libxml2 llvm ];
+ buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DLLVM_ENABLE_RTTI=ON"
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
];
- patches = [ ./purity.patch ];
+ patches = [
+ ./purity.patch
+ ./gnu-install-dirs.patch
+ ];
postPatch = ''
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
@@ -48,12 +56,12 @@ let
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
'';
- outputs = [ "out" "lib" "python" ];
+ outputs = [ "out" "lib" "dev" "python" ];
# Clang expects to find LLVMgold in its own prefix
postInstall = ''
- if [ -e ${llvm}/lib/LLVMgold.so ]; then
- ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+ if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
+ ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
fi
ln -sv $out/bin/clang $out/bin/cpp
@@ -70,11 +78,14 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
+
+ mkdir -p $dev/bin
+ cp bin/clang-tblgen $dev/bin
'';
passthru = {
isClang = true;
- inherit llvm;
+ inherit libllvm;
};
meta = {
diff --git a/pkgs/development/compilers/llvm/6/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/6/clang/gnu-install-dirs.patch
new file mode 100644
index 000000000000..bdbbae955169
--- /dev/null
+++ b/pkgs/development/compilers/llvm/6/clang/gnu-install-dirs.patch
@@ -0,0 +1,258 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2eee8e6148f7..63efc7d2fdd0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.4.3)
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ project(Clang)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ find_program(LLVM_CONFIG "llvm-config")
+@@ -365,7 +367,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/clang include/clang-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+@@ -374,7 +376,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "CMakeFiles" EXCLUDE
+ PATTERN "*.inc"
+@@ -382,7 +384,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(PROGRAMS utils/bash-autocomplete.sh
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ )
+ endif()
+
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index c09a8423f9f6..39f37e0097eb 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -99,9 +99,9 @@ macro(add_clang_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_clangtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -141,7 +141,7 @@ macro(add_clang_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_clangtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -156,5 +156,5 @@ endmacro()
+ macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index 97ba3edea1c5..9d2bc5714af5 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -142,13 +142,13 @@ install(
+ FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${cuda_wrapper_files}
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
+ add_llvm_install_targets(install-clang-headers
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index d38c7bb28709..c9b5499cb756 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -50,7 +50,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
+ "@executable_path/../../lib")
+ else()
+- set(INSTALL_DESTINATION bin)
++ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+
+ install(TARGETS c-index-test
+diff --git a/tools/clang-check/CMakeLists.txt b/tools/clang-check/CMakeLists.txt
+index c5ace26c2914..97bdfca7d896 100644
+--- a/tools/clang-check/CMakeLists.txt
++++ b/tools/clang-check/CMakeLists.txt
+@@ -20,4 +20,4 @@ target_link_libraries(clang-check
+ )
+
+ install(TARGETS clang-check
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
+index a295e8cd0b2a..1973ff82c7f6 100644
+--- a/tools/clang-format/CMakeLists.txt
++++ b/tools/clang-format/CMakeLists.txt
+@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
+ endif()
+
+ install(PROGRAMS clang-format-bbedit.applescript
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-diff.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-sublime.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS git-clang-format
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT clang-format)
+diff --git a/tools/clang-func-mapping/CMakeLists.txt b/tools/clang-func-mapping/CMakeLists.txt
+index ae28e28d532d..8ecb2e37a8f7 100644
+--- a/tools/clang-func-mapping/CMakeLists.txt
++++ b/tools/clang-func-mapping/CMakeLists.txt
+@@ -20,4 +20,4 @@ target_link_libraries(clang-func-mapping
+ )
+
+ install(TARGETS clang-func-mapping
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-offload-bundler/CMakeLists.txt b/tools/clang-offload-bundler/CMakeLists.txt
+index 8718015be76a..7a038f39622e 100644
+--- a/tools/clang-offload-bundler/CMakeLists.txt
++++ b/tools/clang-offload-bundler/CMakeLists.txt
+@@ -22,4 +22,4 @@ target_link_libraries(clang-offload-bundler
+ ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
+ )
+
+-install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
++install(TARGETS clang-offload-bundler RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-refactor/CMakeLists.txt b/tools/clang-refactor/CMakeLists.txt
+index d2029066b9b7..9bc152a675af 100644
+--- a/tools/clang-refactor/CMakeLists.txt
++++ b/tools/clang-refactor/CMakeLists.txt
+@@ -21,4 +21,4 @@ target_link_libraries(clang-refactor
+ clangToolingRefactor
+ )
+
+-install(TARGETS clang-refactor RUNTIME DESTINATION bin)
++install(TARGETS clang-refactor RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
+index 9689e1c6804d..6087716510a9 100644
+--- a/tools/clang-rename/CMakeLists.txt
++++ b/tools/clang-rename/CMakeLists.txt
+@@ -16,8 +16,8 @@ target_link_libraries(clang-rename
+ )
+
+ install(PROGRAMS clang-rename.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+ install(PROGRAMS clang-rename.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 44406378207b..3b64b18ad4a5 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -130,7 +130,7 @@ endif()
+ if(INTERNAL_INSTALL_PREFIX)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
+ else()
+- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
++ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ endif()
+
+ install(DIRECTORY ../../include/clang-c
+diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
+index 380379300b09..adfd58ed5f7d 100644
+--- a/tools/scan-build/CMakeLists.txt
++++ b/tools/scan-build/CMakeLists.txt
+@@ -41,7 +41,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(LibexecFile ${LibexecFiles})
+@@ -53,7 +53,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/libexec/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
+- install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
++ install(PROGRAMS libexec/${LibexecFile} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
+ endforeach()
+
+ foreach(ManPage ${ManPages})
+@@ -77,7 +77,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/share/scan-build/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+- install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
++ install(FILES share/scan-build/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build)
+ endforeach()
+
+ add_custom_target(scan-build ALL DEPENDS ${Depends})
+diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
+index b305ca562a72..554bcb379061 100644
+--- a/tools/scan-view/CMakeLists.txt
++++ b/tools/scan-view/CMakeLists.txt
+@@ -21,7 +21,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(ShareFile ${ShareFiles})
+@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/share/scan-view/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+- install(FILES share/${ShareFile} DESTINATION share/scan-view)
++ install(FILES share/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view)
+ endforeach()
+
+ add_custom_target(scan-view ALL DEPENDS ${Depends})
diff --git a/pkgs/development/compilers/llvm/6/compiler-rt/default.nix b/pkgs/development/compilers/llvm/6/compiler-rt/default.nix
index f0a1c7ecc34f..384305f5cf28 100644
--- a/pkgs/development/compilers/llvm/6/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/6/compiler-rt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
inherit version;
src = fetch "compiler-rt" "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl";
- nativeBuildInputs = [ cmake python3 llvm ];
+ nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
NIX_CFLAGS_COMPILE = [
@@ -54,6 +54,7 @@ stdenv.mkDerivation {
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
+ ./gnu-install-dirs.patch
] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
diff --git a/pkgs/development/compilers/llvm/6/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/6/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 000000000000..8daf03994b57
--- /dev/null
+++ b/pkgs/development/compilers/llvm/6/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,107 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4b953b212829..a10b69aa67dc 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.4.3)
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+ project(CompilerRT C CXX ASM)
++ include(GNUInstallDirs)
+ set(COMPILER_RT_STANDALONE_BUILD TRUE)
+ endif()
+
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index 139b6140011c..502354a37d67 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -439,7 +439,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ # Install in Clang resource directory.
+ install(FILES ${file_name}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_PREFIX}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+@@ -456,7 +456,7 @@ macro(add_compiler_rt_script name)
+ add_custom_target(${name} DEPENDS ${dst})
+ install(FILES ${dst}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
+ endmacro(add_compiler_rt_script src name)
+
+ # Builds custom version of libc++ and installs it in .
+diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
+index a25540bf46d1..77ea739fea74 100644
+--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
+@@ -375,7 +375,7 @@ macro(darwin_add_embedded_builtin_libraries)
+ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
+
+ set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+ set(CFLAGS_i386 "-march=pentium")
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index b208f0852408..cacf4e8fb69d 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -46,11 +46,11 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+ # Take output dir and install path from the user.
+ set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+- "Path where built compiler-rt libraries should be stored.")
++ "Path where built compiler-rt build artifacts should be stored.")
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+ "Path where built compiler-rt executables should be stored.")
+- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+- "Path where built compiler-rt libraries should be installed.")
++ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
++ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
+ # Use a host compiler to compile/link tests.
+@@ -70,9 +70,9 @@ if(NOT DEFINED COMPILER_RT_OS_DIR)
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
+ endif()
+ set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+- ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_OUTPUT_DIR}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+ set(COMPILER_RT_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+
+ if(APPLE)
+ # On Darwin if /usr/include doesn't exist, the user probably has Xcode but not
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index f7efb102ab63..ab8a94d9ff40 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -47,12 +47,12 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
+ install(FILES ${SANITIZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
+ # Install xray headers.
+ install(FILES ${XRAY_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
+ add_custom_target(install-compiler-rt-headers
+diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
+index 2c486bff821b..0ee715da95f8 100644
+--- a/lib/dfsan/CMakeLists.txt
++++ b/lib/dfsan/CMakeLists.txt
+@@ -44,4 +44,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
+ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
+ add_dependencies(dfsan dfsan_abilist)
+ install(FILES ${dfsan_abilist_filename}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH})
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_PREFIX})
diff --git a/pkgs/development/compilers/llvm/6/default.nix b/pkgs/development/compilers/llvm/6/default.nix
index 2c4c11c89bd2..b78f7a62506d 100644
--- a/pkgs/development/compilers/llvm/6/default.nix
+++ b/pkgs/development/compilers/llvm/6/default.nix
@@ -1,6 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith
-, buildPackages
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@@ -18,35 +17,44 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "1w8ml7fyn4vyxmy59n2qm4r1k1kgwgwkaldp6m45fdv4g0kkfbhd";
tools = lib.makeExtensible (tools: let
- callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
+ callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
+ ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
+
in {
- llvm = callPackage ./llvm { };
+ libllvm = callPackage ./llvm { };
- clang-unwrapped = callPackage ./clang {
+ # `llvm` historically had the binaries. When choosing an output explicitly,
+ # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
+ llvm = tools.libllvm.out // { outputUnspecified = true; };
+
+ libllvm-polly = callPackage ./llvm { enablePolly = true; };
+
+ llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
+
+ libclang = callPackage ./clang {
inherit clang-tools-extra_src;
};
- llvm-manpages = lowPrio (tools.llvm.override {
+ clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
+
+ llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;
enableSharedLibraries = false;
python3 = pkgs.python3; # don't use python-boot
});
- clang-manpages = lowPrio (tools.clang-unwrapped.override {
+ clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
- libclang = tools.clang-unwrapped.lib;
-
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
diff --git a/pkgs/development/compilers/llvm/6/libc++/default.nix b/pkgs/development/compilers/llvm/6/libc++/default.nix
index ac489db54fcf..69314fbe2ba1 100644
--- a/pkgs/development/compilers/llvm/6/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/6/libc++/default.nix
@@ -11,7 +11,11 @@ stdenv.mkDerivation {
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
'';
- patches = lib.optionals stdenv.hostPlatform.isMusl [
+ outputs = [ "out" "dev" ];
+
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
diff --git a/pkgs/development/compilers/llvm/6/libc++/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/6/libc++/gnu-install-dirs.patch
new file mode 100644
index 000000000000..33ff9ef123a4
--- /dev/null
+++ b/pkgs/development/compilers/llvm/6/libc++/gnu-install-dirs.patch
@@ -0,0 +1,72 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9e8e9d5e3d9b..e1d6d2392b92 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,6 +22,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libcxx CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxx)
+ set(PACKAGE_VERSION 6.0.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
+index 558e11ba2cc1..c6a99cec0191 100644
+--- a/cmake/Modules/HandleLibCXXABI.cmake
++++ b/cmake/Modules/HandleLibCXXABI.cmake
+@@ -55,7 +55,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
+ )
+ if (LIBCXX_INSTALL_HEADERS)
+ install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
+ COMPONENT cxx-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index b98e09260ca1..c920f48697bc 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -20,7 +20,7 @@ endif()
+
+ if (LIBCXX_INSTALL_HEADERS)
+ install(DIRECTORY .
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ COMPONENT cxx-headers
+ FILES_MATCHING
+ ${LIBCXX_HEADER_PATTERN}
+@@ -44,7 +44,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ set(generated_config_deps generate_config_header)
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT cxx-headers)
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index aa5ebf1568ec..36d85b94c3ba 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -357,8 +357,8 @@ if (LIBCXX_INSTALL_LIBRARY)
+ set(experimental_lib cxx_experimental)
+ endif()
+ install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
+- LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+- ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
++ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
++ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+ )
+ # NOTE: This install command must go after the cxx install command otherwise
+ # it will not be executed after the library symlinks are installed.
+@@ -366,7 +366,7 @@ if (LIBCXX_INSTALL_LIBRARY)
+ # Replace the libc++ filename with $
+ # after we required CMake 3.0.
+ install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}
+ COMPONENT libcxx)
+ endif()
+ endif()
diff --git a/pkgs/development/compilers/llvm/6/libc++abi/default.nix b/pkgs/development/compilers/llvm/6/libc++abi/default.nix
index c0d90f6c8e48..04054f0ba0e7 100644
--- a/pkgs/development/compilers/llvm/6/libc++abi/default.nix
+++ b/pkgs/development/compilers/llvm/6/libc++abi/default.nix
@@ -6,8 +6,7 @@ stdenv.mkDerivation {
src = fetch "libcxxabi" "0prqvdj317qrc8nddaq1hh2ag9algkd9wbkj3y4mr5588k12x7r0";
- nativeBuildInputs = [ cmake ];
- buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
+ outputs = [ "out" "dev" ];
postUnpack = ''
unpackFile ${libcxx.src}
@@ -19,6 +18,13 @@ stdenv.mkDerivation {
patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
'';
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
+ nativeBuildInputs = [ cmake ];
+ buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
+
installPhase = if stdenv.isDarwin
then ''
for file in lib/*.dylib; do
diff --git a/pkgs/development/compilers/llvm/6/libc++abi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/6/libc++abi/gnu-install-dirs.patch
new file mode 100644
index 000000000000..649d28d6c459
--- /dev/null
+++ b/pkgs/development/compilers/llvm/6/libc++abi/gnu-install-dirs.patch
@@ -0,0 +1,28 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1adbdb338322..2978631e1c58 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libcxxabi CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxxabi)
+ set(PACKAGE_VERSION 6.0.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 240f6d0d103b..7ad5c31ec7b4 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -181,8 +181,8 @@ add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
+
+ if (LIBCXXABI_INSTALL_LIBRARY)
+ install(TARGETS ${LIBCXXABI_TARGETS}
+- LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
+- ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
++ LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
++ ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
+ )
+ endif()
+
diff --git a/pkgs/development/compilers/llvm/6/lld/default.nix b/pkgs/development/compilers/llvm/6/lld/default.nix
index b80385248059..5bfd5f60e92f 100644
--- a/pkgs/development/compilers/llvm/6/lld/default.nix
+++ b/pkgs/development/compilers/llvm/6/lld/default.nix
@@ -1,8 +1,9 @@
{ lib, stdenv
+, buildLlvmTools
, fetch
, cmake
, libxml2
-, llvm
+, libllvm
, version
}:
@@ -12,15 +13,20 @@ stdenv.mkDerivation {
src = fetch "lld" "04afcfq2h7ysyqxxhyhb7ig4p0vdw7mi63kh8mffl74j0rc781p7";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvm libxml2 ];
+ buildInputs = [ libllvm libxml2 ];
- outputs = [ "out" "dev" ];
+ cmakeFlags = [
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ ];
- postInstall = ''
- moveToOutput include "$dev"
- moveToOutput lib "$dev"
- '';
+ outputs = [ "out" "lib" "dev" ];
meta = {
description = "The LLVM Linker";
diff --git a/pkgs/development/compilers/llvm/6/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/6/lld/gnu-install-dirs.patch
new file mode 100644
index 000000000000..8c6886c68907
--- /dev/null
+++ b/pkgs/development/compilers/llvm/6/lld/gnu-install-dirs.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e2fbdbfbbb47..d601b231ebb8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(LLD_BUILT_STANDALONE TRUE)
+
++ include(GNUInstallDirs)
++
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
+ if(NOT LLVM_CONFIG_PATH)
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
+@@ -203,7 +205,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index 0d951799cdfe..7d8546ba87f8 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -20,9 +20,9 @@ macro(add_lld_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -54,7 +54,7 @@ macro(add_lld_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_lldtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -69,5 +69,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
+index d8829493fc22..df748a0e749b 100644
+--- a/tools/lld/CMakeLists.txt
++++ b/tools/lld/CMakeLists.txt
+@@ -16,7 +16,7 @@ target_link_libraries(lld
+ )
+
+ install(TARGETS lld
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(NOT LLD_SYMLINKS_TO_CREATE)
+ set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)
diff --git a/pkgs/development/compilers/llvm/6/lldb/default.nix b/pkgs/development/compilers/llvm/6/lldb/default.nix
index 7c6f8b1bd979..31cc0ca68d71 100644
--- a/pkgs/development/compilers/llvm/6/lldb/default.nix
+++ b/pkgs/development/compilers/llvm/6/lldb/default.nix
@@ -8,14 +8,14 @@
, which
, libedit
, libxml2
-, llvm
-, clang-unwrapped
+, libllvm
+, libclang
, python3
, version
, darwin
}:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
pname = "lldb";
inherit version;
@@ -28,29 +28,46 @@ stdenv.mkDerivation {
sha256 = "1zbx4m0m8kbg0wq6740jcw151vb2pb1p25p401wiq8diqqagkjps";
stripLen = 1;
})
+ ./gnu-install-dirs.patch
];
postPatch = ''
# Fix up various paths that assume llvm and clang are installed in the same place
- sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
+ sed -i 's,".*ClangConfig.cmake","${libclang.dev}/lib/cmake/clang/ClangConfig.cmake",' \
cmake/modules/LLDBStandalone.cmake
- sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
+ sed -i 's,".*tools/clang/include","${libclang.dev}/include",' \
cmake/modules/LLDBStandalone.cmake
- sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
+ sed -i 's,"$.LLVM_LIBRARY_DIR.",${libllvm.lib}/lib ${libclang.lib}/lib,' \
cmake/modules/LLDBStandalone.cmake
'';
- nativeBuildInputs = [ cmake python3 which swig ];
- buildInputs = [ ncurses zlib libedit libxml2 llvm ]
- ++ lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
+ outputs = [ "out" "lib" "dev" ];
+
+ nativeBuildInputs = [
+ cmake python3 which swig
+ ];
+
+ buildInputs = [
+ ncurses zlib libedit libxml2 libllvm
+ ] ++ lib.optionals stdenv.isDarwin [
+ darwin.libobjc
+ darwin.apple_sdk.libs.xpc
+ darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa
+ ];
CXXFLAGS = "-fno-rtti";
hardeningDisable = [ "format" ];
cmakeFlags = [
+ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
+ ] ++ lib.optionals doCheck [
+ "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
];
+ doCheck = false;
+
postInstall = ''
mkdir -p $out/share/man/man1
cp ../docs/lldb.1 $out/share/man/man1/
diff --git a/pkgs/development/compilers/llvm/6/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/6/lldb/gnu-install-dirs.patch
new file mode 100644
index 000000000000..a240ecaab17d
--- /dev/null
+++ b/pkgs/development/compilers/llvm/6/lldb/gnu-install-dirs.patch
@@ -0,0 +1,76 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c6b082e104e5..568a99837e1f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,8 @@ set(CMAKE_MODULE_PATH
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+ )
+
++include(GNUInstallDirs)
++
+ include(LLDBStandalone)
+ include(LLDBConfig)
+ include(AddLLDB)
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index 2fd8b384d9e3..4db5e786c493 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -56,14 +56,14 @@ function(add_lldb_library name)
+ endif()
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${out_dir}
+ ARCHIVE DESTINATION ${out_dir})
+ else()
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -132,7 +132,7 @@ function(add_lldb_executable name)
+ if(ARG_GENERATE_INSTALL AND NOT (ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK ))
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
+index 24878b5913f3..b9d27788bb87 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -278,7 +278,7 @@ include_directories(BEFORE
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+@@ -288,7 +288,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
+index b5316540fdf3..3c3c882d503f 100644
+--- a/tools/intel-features/CMakeLists.txt
++++ b/tools/intel-features/CMakeLists.txt
+@@ -64,4 +64,4 @@ if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ endif()
+
+ install(TARGETS lldbIntelFeatures
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/pkgs/development/compilers/llvm/6/llvm/default.nix b/pkgs/development/compilers/llvm/6/llvm/default.nix
index de99691094b7..1c04a62c4d53 100644
--- a/pkgs/development/compilers/llvm/6/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/6/llvm/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv
+, pkgsBuildBuild
, fetch
, cmake
, python3
@@ -9,11 +10,12 @@
, version
, release_version
, zlib
-, buildPackages
+, buildLlvmTools
, fetchpatch
, debugVersion ? false
, enableManpages ? false
-, enableSharedLibraries ? true
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
+, enablePolly ? false
}:
let
@@ -30,15 +32,18 @@ stdenv.mkDerivation ({
inherit version;
src = fetch "llvm" "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn";
+ polly_src = fetch "polly" "1k2frwg5mkqh0raia8xf69h3jhdw7a5nxd6vjscjn44cdkgmyxp7";
unpackPhase = ''
unpackFile $src
mv llvm-${version}* llvm
sourceRoot=$PWD/llvm
+ '' + optionalString enablePolly ''
+ unpackFile $polly_src
+ mv polly-* $sourceRoot/tools/polly
'';
- outputs = [ "out" "python" ]
- ++ optional enableSharedLibraries "lib";
+ outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python3 ]
++ optional enableManpages python3.pkgs.sphinx;
@@ -58,12 +63,13 @@ stdenv.mkDerivation ({
includes = [ "test/tools/gold/X86/common.ll" ];
sha256 = "0fxgrxmfnjx17w3lcq19rk68b2xksh1bynz3ina784kma7hp4wdb";
})
- ];
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
- --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
+ --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
@@ -88,6 +94,7 @@ stdenv.mkDerivation ({
'';
cmakeFlags = with stdenv; [
+ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
@@ -112,7 +119,20 @@ stdenv.mkDerivation ({
"-DCAN_TARGET_i386=false"
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
- "-DLLVM_TABLEGEN=${buildPackages.llvm_6}/bin/llvm-tblgen"
+ "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ (
+ let
+ nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+ nativeBintools = nativeCC.bintools.bintools;
+ nativeToolchainFlags = [
+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+ ];
+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+ )
];
postBuild = ''
@@ -126,19 +146,20 @@ stdenv.mkDerivation ({
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
- ''
- + optionalString enableSharedLibraries ''
- moveToOutput "lib/libLLVM-*" "$lib"
- moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+ moveToOutput "bin/llvm-config*" "$dev"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+ --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+ --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
${lib.concatMapStringsSep "\n" (v: ''
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes}
+ ''
+ + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isi686);
diff --git a/pkgs/development/compilers/llvm/6/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/6/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 000000000000..b4fda24a55f3
--- /dev/null
+++ b/pkgs/development/compilers/llvm/6/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,106 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index 9ddc0f7ff81d..7ca45f286d47 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -2,7 +2,11 @@
+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ project(Polly)
+ cmake_minimum_required(VERSION 3.4.3)
++endif()
++
++include(GNUInstallDirs)
+
++if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ # Where is LLVM installed?
+ find_package(LLVM CONFIG REQUIRED)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -157,14 +161,14 @@ include_directories(
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+ )
+
+ install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 969292cd6b00..d7aea77bdd20 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
+- "${POLLY_INSTALL_PREFIX}/include/polly"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+ )
+ else()
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+ ${ISL_INCLUDE_DIRS}
+ )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+ get_target_property(tgt_type ${tgt} TYPE)
+ if (tgt_type STREQUAL "EXECUTABLE")
+- set(tgt_prefix "bin/")
++ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+ else()
+- set(tgt_prefix "lib/")
++ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+ endif()
+
+- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
++ set(tgt_path "${tgt_prefix}$")
+ file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+
+ if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index 32bed50bb060..cca5bfff4970 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index b3c6e73a7a00..c67acf8576c7 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -268,7 +268,7 @@ if (POLLY_BUNDLED_ISL)
+ install(DIRECTORY
+ ${ISL_SOURCE_DIR}/include/
+ ${ISL_BINARY_DIR}/include/
+- DESTINATION include/polly
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/6/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/6/llvm/gnu-install-dirs.patch
new file mode 100644
index 000000000000..987f97210fb8
--- /dev/null
+++ b/pkgs/development/compilers/llvm/6/llvm/gnu-install-dirs.patch
@@ -0,0 +1,386 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f8da6cf92119..881e4cda4971 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -271,15 +271,21 @@ if (CMAKE_BUILD_TYPE AND
+ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ endif()
+
++include(GNUInstallDirs)
++
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
++set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
++ "Path for binary subdirectory (defaults to 'bin')")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
+ set(LLVM_UTILS_INSTALL_DIR "bin" CACHE STRING
+ "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+@@ -510,9 +516,9 @@ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OF
+ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
+
+-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
++set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
+ CACHE STRING "Doxygen-generated HTML documentation install directory")
+-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
++set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
+ CACHE STRING "OCamldoc-generated HTML documentation install directory")
+
+ option (LLVM_BUILD_EXTERNAL_COMPILER_RT
+@@ -944,7 +950,7 @@ endif()
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -956,7 +962,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index fd5627eecbb2..29e09c6f3f8a 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -621,11 +621,11 @@ macro(add_llvm_library name)
+ else()
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" OR
+ (LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
+- set(install_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(ARG_SHARED OR BUILD_SHARED_LIBS)
+ if(WIN32 OR CYGWIN OR MINGW)
+ set(install_type RUNTIME)
+- set(install_dir bin)
++ set(install_dir ${CMAKE_INSTALL_BINDIR})
+ else()
+ set(install_type LIBRARY)
+ endif()
+@@ -667,9 +667,9 @@ macro(add_llvm_loadable_module name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ if(WIN32 OR CYGWIN)
+ # DLL platform
+- set(dlldir "bin")
++ set(dlldir "${CMAKE_INSTALL_BINDIR}")
+ else()
+- set(dlldir "lib${LLVM_LIBDIR_SUFFIX}")
++ set(dlldir "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+
+ if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+@@ -681,7 +681,7 @@ macro(add_llvm_loadable_module name)
+ install(TARGETS ${name}
+ ${export_to_llvmexports}
+ LIBRARY DESTINATION ${dlldir}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endif()
+@@ -892,7 +892,7 @@ macro(add_llvm_example name)
+ endif()
+ add_llvm_executable(${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endmacro(add_llvm_example name)
+@@ -1410,7 +1410,7 @@ function(llvm_install_library_symlink name dest type)
+ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+
+- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 AND "${type}" STREQUAL "SHARED")
+ set(output_dir bin)
+ endif()
+@@ -1426,7 +1426,7 @@ function(llvm_install_library_symlink name dest type)
+ endif()
+ endfunction()
+
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+ cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+ foreach(path ${CMAKE_MODULE_PATH})
+ if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1449,7 +1449,7 @@ function(llvm_install_symlink name dest)
+ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+
+ install(SCRIPT ${INSTALL_SYMLINK}
+- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+ COMPONENT ${component})
+
+ if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
+@@ -1531,7 +1531,8 @@ function(add_llvm_tool_symlink link_name target)
+ endif()
+
+ if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+- llvm_install_symlink(${link_name} ${target})
++ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++ llvm_install_symlink(${link_name} ${target} ${output_dir})
+ endif()
+ endif()
+ endfunction()
+@@ -1583,9 +1584,9 @@ function(llvm_setup_rpath name)
+
+ if (APPLE)
+ set(_install_name_dir INSTALL_NAME_DIR "@rpath")
+- set(_install_rpath "@loader_path/../lib" ${extra_libdir})
++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
+ elseif(UNIX)
+- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 02bab6846376..eff26adb2efc 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -140,9 +140,9 @@ function(add_ocaml_library name)
+ endforeach()
+
+ if( APPLE )
+- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 22e3dcb776aa..ba77b9c195e2 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -73,7 +73,7 @@ function (add_sphinx_target builder project)
+
+ elseif (builder STREQUAL html)
+ string(TOUPPER "${project}" project_upper)
+- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
++ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
+ CACHE STRING "HTML documentation install directory for ${project}")
+
+ # '/.' indicates: copy the contents of the directory directly into
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index 6074e8358594..9d0be6c2ced5 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -84,11 +84,11 @@ foreach(p ${_count})
+ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+ get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
+-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
++set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
++set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
+ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
+-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
++set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
+ set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
+ configure_file(
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index 482697b06baf..af2ac1e6c979 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
+ set(LINK_OR_COPY copy)
+ endif()
+
+- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
++ set(bindir "${DESTDIR}${outdir}/")
+
+ message("Creating ${name}")
+
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index 05edec64da33..6db014f04656 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+- to install libraries to ``/usr/lib64``.
++ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
+ **CMAKE_C_FLAGS**:STRING
+ Extra flags to use when compiling C source files.
+@@ -465,8 +465,8 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
+ The path to install Doxygen-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/doxygen-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
+
+ **LLVM_ENABLE_SPHINX**:BOOL
+ If specified, CMake will search for the ``sphinx-build`` executable and will make
+@@ -497,13 +497,33 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
+ The path to install Sphinx-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
+
+ **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
+ The path to install OCamldoc-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/ocaml-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
++
++**CMAKE_INSTALL_BINDIR**:STRING
++ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `bin`.
++
++**CMAKE_INSTALL_LIBDIR**:STRING
++ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `lib`.
++
++**CMAKE_INSTALL_INCLUDEDIR**:STRING
++ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `include`.
++
++**CMAKE_INSTALL_DOCDIR**:STRING
++ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/doc`.
++
++**CMAKE_INSTALL_MANDIR**:STRING
++ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/man`.
+
+ **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
+ OS X Only: If enabled CMake will generate a target named
+@@ -660,9 +680,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+
+ This file is available in two different locations.
+
+-* ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+- ```` is the install prefix of an installed version of LLVM.
+- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``LLVMConfig.cmake`` where
++ ```` is the location where LLVM CMake modules are
++ installed as part of an installed version of LLVM. This is typically
++ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+
+ * ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+ ```` is the root of the LLVM build tree. **Note: this is only
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index 1d5ca3ba92b0..026f5453c1da 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -4,5 +4,5 @@ add_subdirectory(Support)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+- configure_file(module.modulemap.build module.modulemap COPYONLY)
++ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index f201e1f7bff0..4582ed556a02 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -24,6 +24,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
++#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 08b096afb052..2deae0dcfacc 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -332,12 +332,26 @@ int main(int argc, char **argv) {
+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
+ } else {
+ ActivePrefix = CurrentExecPrefix;
+- ActiveIncludeDir = ActivePrefix + "/include";
+- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+- sys::fs::make_absolute(ActivePrefix, path);
+- ActiveBinDir = path.str();
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveIncludeDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveBinDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveLibDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveCMakeDir = std::string(path.str());
++ }
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
+index 6e913519a809..85641eef721f 100644
+--- a/tools/lto/CMakeLists.txt
++++ b/tools/lto/CMakeLists.txt
+@@ -19,7 +19,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
+ add_llvm_library(LTO SHARED ${SOURCES} DEPENDS intrinsics_gen)
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT LTO)
+
+ if (APPLE)
+diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
+index 19b606933082..27b9f71b3d79 100644
+--- a/tools/opt-viewer/CMakeLists.txt
++++ b/tools/opt-viewer/CMakeLists.txt
+@@ -8,6 +8,6 @@ set (files
+
+ foreach (file ${files})
+ install(PROGRAMS ${file}
+- DESTINATION share/opt-viewer
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
+ COMPONENT opt-viewer)
+ endforeach (file)
diff --git a/pkgs/development/compilers/llvm/7/clang/default.nix b/pkgs/development/compilers/llvm/7/clang/default.nix
index 4ab13441e36f..187602ef361e 100644
--- a/pkgs/development/compilers/llvm/7/clang/default.nix
+++ b/pkgs/development/compilers/llvm/7/clang/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
+{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
, enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -23,17 +24,21 @@ let
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
- buildInputs = [ libxml2 llvm lld ];
+ buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DLLVM_ENABLE_RTTI=ON"
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
] ++ lib.optionals enablePolly [
"-DWITH_POLLY=ON"
"-DLINK_POLLY_INTO_TOOLS=ON"
@@ -43,6 +48,10 @@ let
./purity.patch
# make clang -xhip use $PATH to find executables
./HIP-use-PATH-7.patch
+ # Backport for the `--unwindlib=[libgcc|compiler-rt]` flag, which is
+ # needed for our bootstrapping to not interfere with C.
+ ./unwindlib.patch
+ ./gnu-install-dirs.patch
];
postPatch = ''
@@ -59,12 +68,12 @@ let
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
'';
- outputs = [ "out" "lib" "python" ];
+ outputs = [ "out" "lib" "dev" "python" ];
# Clang expects to find LLVMgold in its own prefix
postInstall = ''
- if [ -e ${llvm}/lib/LLVMgold.so ]; then
- ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+ if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
+ ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
fi
ln -sv $out/bin/clang $out/bin/cpp
@@ -81,11 +90,14 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
+
+ mkdir -p $dev/bin
+ cp bin/clang-tblgen $dev/bin
'';
passthru = {
isClang = true;
- inherit llvm;
+ inherit libllvm;
};
meta = {
diff --git a/pkgs/development/compilers/llvm/7/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/7/clang/gnu-install-dirs.patch
new file mode 100644
index 000000000000..540c043a2db9
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/clang/gnu-install-dirs.patch
@@ -0,0 +1,281 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 52b881939499..85662a2113e7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.4.3)
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ project(Clang)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ find_program(LLVM_CONFIG "llvm-config")
+@@ -374,7 +376,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/clang include/clang-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+@@ -383,7 +385,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "CMakeFiles" EXCLUDE
+ PATTERN "*.inc"
+@@ -391,7 +393,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(PROGRAMS utils/bash-autocomplete.sh
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ )
+ endif()
+
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index c09a8423f9f6..39f37e0097eb 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -99,9 +99,9 @@ macro(add_clang_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_clangtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -141,7 +141,7 @@ macro(add_clang_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_clangtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -156,5 +156,5 @@ endmacro()
+ macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index 1930d8e225c7..bb9158093079 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -162,19 +162,19 @@ install(
+ FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_fp16.h
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${cuda_wrapper_files}
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
+ add_llvm_install_targets(install-clang-headers
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index 53e3421f1b35..79ae5bb4c399 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
+ "@executable_path/../../lib")
+ else()
+- set(INSTALL_DESTINATION bin)
++ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+
+ install(TARGETS c-index-test
+diff --git a/tools/clang-check/CMakeLists.txt b/tools/clang-check/CMakeLists.txt
+index c5ace26c2914..97bdfca7d896 100644
+--- a/tools/clang-check/CMakeLists.txt
++++ b/tools/clang-check/CMakeLists.txt
+@@ -20,4 +20,4 @@ target_link_libraries(clang-check
+ )
+
+ install(TARGETS clang-check
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
+index a295e8cd0b2a..1973ff82c7f6 100644
+--- a/tools/clang-format/CMakeLists.txt
++++ b/tools/clang-format/CMakeLists.txt
+@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
+ endif()
+
+ install(PROGRAMS clang-format-bbedit.applescript
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-diff.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-sublime.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS git-clang-format
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT clang-format)
+diff --git a/tools/clang-func-mapping/CMakeLists.txt b/tools/clang-func-mapping/CMakeLists.txt
+index ae28e28d532d..8ecb2e37a8f7 100644
+--- a/tools/clang-func-mapping/CMakeLists.txt
++++ b/tools/clang-func-mapping/CMakeLists.txt
+@@ -20,4 +20,4 @@ target_link_libraries(clang-func-mapping
+ )
+
+ install(TARGETS clang-func-mapping
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-offload-bundler/CMakeLists.txt b/tools/clang-offload-bundler/CMakeLists.txt
+index 8718015be76a..7a038f39622e 100644
+--- a/tools/clang-offload-bundler/CMakeLists.txt
++++ b/tools/clang-offload-bundler/CMakeLists.txt
+@@ -22,4 +22,4 @@ target_link_libraries(clang-offload-bundler
+ ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
+ )
+
+-install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
++install(TARGETS clang-offload-bundler RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
+index 3b3ab1540a80..9aca9ba4a2cf 100644
+--- a/tools/clang-rename/CMakeLists.txt
++++ b/tools/clang-rename/CMakeLists.txt
+@@ -18,8 +18,8 @@ target_link_libraries(clang-rename
+ )
+
+ install(PROGRAMS clang-rename.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+ install(PROGRAMS clang-rename.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+diff --git a/tools/diagtool/CMakeLists.txt b/tools/diagtool/CMakeLists.txt
+index 96d1c390249c..41c762b37b76 100644
+--- a/tools/diagtool/CMakeLists.txt
++++ b/tools/diagtool/CMakeLists.txt
+@@ -21,7 +21,7 @@ target_link_libraries(diagtool
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(TARGETS diagtool
+ COMPONENT diagtool
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-diagtool
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index e539c8308e75..4e1fbccea35d 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -130,7 +130,7 @@ endif()
+ if(INTERNAL_INSTALL_PREFIX)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
+ else()
+- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
++ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ endif()
+
+ install(DIRECTORY ../../include/clang-c
+diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
+index 380379300b09..adfd58ed5f7d 100644
+--- a/tools/scan-build/CMakeLists.txt
++++ b/tools/scan-build/CMakeLists.txt
+@@ -41,7 +41,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(LibexecFile ${LibexecFiles})
+@@ -53,7 +53,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/libexec/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
+- install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
++ install(PROGRAMS libexec/${LibexecFile} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
+ endforeach()
+
+ foreach(ManPage ${ManPages})
+@@ -77,7 +77,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/share/scan-build/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+- install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
++ install(FILES share/scan-build/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build)
+ endforeach()
+
+ add_custom_target(scan-build ALL DEPENDS ${Depends})
+diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
+index b305ca562a72..554bcb379061 100644
+--- a/tools/scan-view/CMakeLists.txt
++++ b/tools/scan-view/CMakeLists.txt
+@@ -21,7 +21,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(ShareFile ${ShareFiles})
+@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/share/scan-view/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+- install(FILES share/${ShareFile} DESTINATION share/scan-view)
++ install(FILES share/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view)
+ endforeach()
+
+ add_custom_target(scan-view ALL DEPENDS ${Depends})
+diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
+index 5573009d343a..24b3a90f233f 100644
+--- a/utils/hmaptool/CMakeLists.txt
++++ b/utils/hmaptool/CMakeLists.txt
+@@ -9,7 +9,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL})
+
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
+-install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION bin)
++install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ add_custom_target(hmaptool ALL DEPENDS ${Depends})
+ set_target_properties(hmaptool PROPERTIES FOLDER "Utils")
diff --git a/pkgs/development/compilers/llvm/7/clang/unwindlib.patch b/pkgs/development/compilers/llvm/7/clang/unwindlib.patch
new file mode 100644
index 000000000000..59a092d7c706
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/clang/unwindlib.patch
@@ -0,0 +1,227 @@
+commit a5cacb5ba7f1f18e7bb6f6709e42683eeb7e6470
+Author: Sterling Augustine
+Date: Tue Mar 19 20:01:59 2019 +0000
+
+ Add --unwindlib=[libgcc|compiler-rt] to parallel --rtlib= [take 2]
+
+ "clang++ hello.cc --rtlib=compiler-rt"
+
+ now can works without specifying additional unwind or exception
+ handling libraries.
+
+ This reworked version of the feature no longer modifies today's default
+ unwind library for compiler-rt: which is nothing. Rather, a user
+ can specify -DCLANG_DEFAULT_UNWINDLIB=libunwind when configuring
+ the compiler.
+
+ This should address the issues from the previous version.
+
+ Update tests for new --unwindlib semantics.
+
+ Differential Revision: https://reviews.llvm.org/D59109
+
+ llvm-svn: 356508
+
+diff --git clang/CMakeLists.txt clang/CMakeLists.txt
+index 52b881939499..2c3fb62f6e73 100644
+--- clang/CMakeLists.txt
++++ clang/CMakeLists.txt
+@@ -244,6 +244,24 @@ if (NOT(CLANG_DEFAULT_RTLIB STREQUAL "" OR
+ "Default runtime library to use (\"libgcc\" or \"compiler-rt\", empty for platform default)" FORCE)
+ endif()
+
++set(CLANG_DEFAULT_UNWINDLIB "" CACHE STRING
++ "Default unwind library to use (\"none\" \"libgcc\" or \"libunwind\", empty to match runtime library.)")
++if (CLANG_DEFAULT_UNWINDLIB STREQUAL "")
++ if (CLANG_DEFAULT_RTLIB STREQUAL "libgcc")
++ set (CLANG_DEFAULT_UNWINDLIB "libgcc" CACHE STRING "" FORCE)
++ elseif (CLANG_DEFAULT_RTLIBS STREQUAL "libunwind")
++ set (CLANG_DEFAULT_UNWINDLIB "none" CACHE STRING "" FORCE)
++ endif()
++endif()
++
++if (NOT(CLANG_DEFAULT_UNWINDLIB STREQUAL "none" OR
++ CLANG_DEFAULT_UNWINDLIB STREQUAL "libgcc" OR
++ CLANG_DEFAULT_UNWINDLIB STREQUAL "libunwind"))
++ message(WARNING "Resetting default unwindlib to use platform default")
++ set(CLANG_DEFAULT_UNWINDLIB "" CACHE STRING
++ "Default unwind library to use (\"none\" \"libgcc\" or \"libunwind\", empty for none)" FORCE)
++endif()
++
+ set(CLANG_DEFAULT_OBJCOPY "objcopy" CACHE STRING
+ "Default objcopy executable to use.")
+
+diff --git clang/include/clang/Basic/DiagnosticDriverKinds.td clang/include/clang/Basic/DiagnosticDriverKinds.td
+index 7f75f45c6578..7e1bb33b5cef 100644
+--- clang/include/clang/Basic/DiagnosticDriverKinds.td
++++ clang/include/clang/Basic/DiagnosticDriverKinds.td
+@@ -52,6 +52,10 @@ def err_drv_invalid_rtlib_name : Error<
+ "invalid runtime library name in argument '%0'">;
+ def err_drv_unsupported_rtlib_for_platform : Error<
+ "unsupported runtime library '%0' for platform '%1'">;
++def err_drv_invalid_unwindlib_name : Error<
++ "invalid unwind library name in argument '%0'">;
++def err_drv_incompatible_unwindlib : Error<
++ "--rtlib=libgcc requires --unwindlib=libgcc">;
+ def err_drv_invalid_stdlib_name : Error<
+ "invalid library name in argument '%0'">;
+ def err_drv_invalid_output_with_multiple_archs : Error<
+diff --git clang/include/clang/Config/config.h.cmake clang/include/clang/Config/config.h.cmake
+index 1d624450b9d9..2d4cb747e87e 100644
+--- clang/include/clang/Config/config.h.cmake
++++ clang/include/clang/Config/config.h.cmake
+@@ -23,6 +23,9 @@
+ /* Default runtime library to use. */
+ #define CLANG_DEFAULT_RTLIB "${CLANG_DEFAULT_RTLIB}"
+
++/* Default unwind library to use. */
++#define CLANG_DEFAULT_UNWINDLIB "${CLANG_DEFAULT_UNWINDLIB}"
++
+ /* Default objcopy to use */
+ #define CLANG_DEFAULT_OBJCOPY "${CLANG_DEFAULT_OBJCOPY}"
+
+diff --git clang/include/clang/Driver/Options.td clang/include/clang/Driver/Options.td
+index 601aa8744967..0e74a2d36dea 100644
+--- clang/include/clang/Driver/Options.td
++++ clang/include/clang/Driver/Options.td
+@@ -2428,6 +2428,8 @@ def std_EQ : Joined<["-", "--"], "std=">, Flags<[CC1Option]>,
+ }]>;
+ def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>,
+ HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">;
++def unwindlib_EQ : Joined<["-", "--"], "unwindlib=">, Flags<[CC1Option]>,
++ HelpText<"Unwind library to use">, Values<"libgcc,unwindlib,platform">;
+ def sub__library : JoinedOrSeparate<["-"], "sub_library">;
+ def sub__umbrella : JoinedOrSeparate<["-"], "sub_umbrella">;
+ def system_header_prefix : Joined<["--"], "system-header-prefix=">,
+diff --git clang/include/clang/Driver/ToolChain.h clang/include/clang/Driver/ToolChain.h
+index 2f9c2c190e32..d5b131bcf112 100644
+--- clang/include/clang/Driver/ToolChain.h
++++ clang/include/clang/Driver/ToolChain.h
+@@ -99,6 +99,12 @@ public:
+ RLT_Libgcc
+ };
+
++ enum UnwindLibType {
++ UNW_None,
++ UNW_CompilerRT,
++ UNW_Libgcc
++ };
++
+ enum RTTIMode {
+ RM_Enabled,
+ RM_Disabled,
+@@ -352,6 +358,10 @@ public:
+ return ToolChain::CST_Libstdcxx;
+ }
+
++ virtual UnwindLibType GetDefaultUnwindLibType() const {
++ return ToolChain::UNW_None;
++ }
++
+ virtual std::string getCompilerRTPath() const;
+
+ virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
+@@ -484,6 +494,10 @@ public:
+ // given compilation arguments.
+ virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
+
++ // GetUnwindLibType - Determine the unwind library type to use with the
++ // given compilation arguments.
++ virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const;
++
+ /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
+ /// the include paths to use for the given C++ standard library type.
+ virtual void
+diff --git clang/lib/Driver/ToolChain.cpp clang/lib/Driver/ToolChain.cpp
+index cf3db34688df..d980dd5d23fb 100644
+--- clang/lib/Driver/ToolChain.cpp
++++ clang/lib/Driver/ToolChain.cpp
+@@ -665,6 +665,33 @@ ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
+ return GetDefaultRuntimeLibType();
+ }
+
++ToolChain::UnwindLibType ToolChain::GetUnwindLibType(
++ const ArgList &Args) const {
++ const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ);
++ StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_UNWINDLIB;
++
++ if (LibName == "none")
++ return ToolChain::UNW_None;
++ else if (LibName == "platform" || LibName == "") {
++ ToolChain::RuntimeLibType RtLibType = GetRuntimeLibType(Args);
++ if (RtLibType == ToolChain::RLT_CompilerRT)
++ return ToolChain::UNW_None;
++ else if (RtLibType == ToolChain::RLT_Libgcc)
++ return ToolChain::UNW_Libgcc;
++ } else if (LibName == "libunwind") {
++ if (GetRuntimeLibType(Args) == RLT_Libgcc)
++ getDriver().Diag(diag::err_drv_incompatible_unwindlib);
++ return ToolChain::UNW_CompilerRT;
++ } else if (LibName == "libgcc")
++ return ToolChain::UNW_Libgcc;
++
++ if (A)
++ getDriver().Diag(diag::err_drv_invalid_unwindlib_name)
++ << A->getAsString(Args);
++
++ return GetDefaultUnwindLibType();
++}
++
+ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
+ const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
+ StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;
+diff --git clang/test/Driver/compiler-rt-unwind.c clang/test/Driver/compiler-rt-unwind.c
+new file mode 100644
+index 000000000000..00024dfa7ed3
+--- /dev/null
++++ clang/test/Driver/compiler-rt-unwind.c
+@@ -0,0 +1,49 @@
++// General tests that the driver handles combinations of --rtlib=XXX and
++// --unwindlib=XXX properly.
++//
++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
++// RUN: --target=x86_64-unknown-linux \
++// RUN: --gcc-toolchain="" \
++// RUN: | FileCheck --check-prefix=RTLIB-EMPTY %s
++// RTLIB-EMPTY: "{{.*}}lgcc"
++// RTLIB-EMPTY: "{{.*}}-lgcc_s"
++//
++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
++// RUN: --target=x86_64-unknown-linux -rtlib=libgcc \
++// RUN: --gcc-toolchain="" \
++// RUN: | FileCheck --check-prefix=RTLIB-GCC %s
++// RTLIB-GCC: "{{.*}}lgcc"
++// RTLIB-GCC: "{{.*}}lgcc_s"
++//
++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
++// RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
++// RUN: --gcc-toolchain="" \
++// RUN: | FileCheck --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER-RT %s
++// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lgcc"
++// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lunwind"
++//
++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
++// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt \
++// RUN: --gcc-toolchain="" \
++// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT %s
++// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins-x86_64.a"
++//
++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
++// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
++// RUN: --gcc-toolchain="" \
++// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s
++// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins-x86_64.a"
++// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}lgcc_s"
++//
++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
++// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
++// RUN: -static --gcc-toolchain="" \
++// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s
++// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins-x86_64.a"
++// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}lgcc_eh"
++//
++// RUN: not %clang -no-canonical-prefixes %s -o %t.o 2> %t.err \
++// RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
++// RUN: --gcc-toolchain="" \
++// RUN: FileCheck --input-file=%t.err --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER_RT %s
++// RTLIB-GCC-UNWINDLIB-COMPILER_RT: "{{[.|\\\n]*}}--rtlib=libgcc requires --unwindlib=libgcc"
diff --git a/pkgs/development/compilers/llvm/7/compiler-rt/default.nix b/pkgs/development/compilers/llvm/7/compiler-rt/default.nix
index 218421315995..75d61a51e601 100644
--- a/pkgs/development/compilers/llvm/7/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/7/compiler-rt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
inherit version;
src = fetch "compiler-rt" "1n48p8gjarihkws0i2bay5w9bdwyxyxxbpwyng7ba58jb30dlyq5";
- nativeBuildInputs = [ cmake python3 llvm ];
+ nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
NIX_CFLAGS_COMPILE = [
@@ -54,6 +54,7 @@ stdenv.mkDerivation {
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
+ ./gnu-install-dirs.patch
] ++ lib.optional (useLLVM) ./crtbegin-and-end.patch
++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
diff --git a/pkgs/development/compilers/llvm/7/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/7/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 000000000000..fd7c6a690fad
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,117 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 86ca2b3ef74b..555103bd97fe 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.4.3)
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+ project(CompilerRT C CXX ASM)
++ include(GNUInstallDirs)
+ set(COMPILER_RT_STANDALONE_BUILD TRUE)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ endif()
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index cd4c704fc824..5abcd1260381 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -478,7 +478,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ # Install in Clang resource directory.
+ install(FILES ${file_name}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+@@ -495,7 +495,7 @@ macro(add_compiler_rt_script name)
+ add_custom_target(${name} DEPENDS ${dst})
+ install(FILES ${dst}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
+ endmacro(add_compiler_rt_script src name)
+
+ # Builds custom version of libc++ and installs it in .
+diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
+index 04cc955980fa..a99f6dfb2f82 100644
+--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
+@@ -377,7 +377,7 @@ macro(darwin_add_embedded_builtin_libraries)
+ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
+
+ set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+ set(CFLAGS_i386 "-march=pentium")
+diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
+index e5651718fa34..d95cfc984a85 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -330,7 +330,7 @@ endfunction()
+ function(get_compiler_rt_install_dir arch install_dir)
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ get_compiler_rt_target(${arch} target)
+- set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${target}/lib PARENT_SCOPE)
++ set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${target}/${CMAKE_INSTALL_FULL_LIBDIR} PARENT_SCOPE)
+ else()
+ set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
+ endif()
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index 91fe2494b476..b59a0ffc69f4 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -53,11 +53,11 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+ # Take output dir and install path from the user.
+ set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+- "Path where built compiler-rt libraries should be stored.")
++ "Path where built compiler-rt build artifacts should be stored.")
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+ "Path where built compiler-rt executables should be stored.")
+- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+- "Path where built compiler-rt libraries should be installed.")
++ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
++ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
+ # Use a host compiler to compile/link tests.
+@@ -85,7 +85,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
+ set(COMPILER_RT_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+ endif()
+
+ if(APPLE)
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index c4b93b89a30c..3913dc3a1ee6 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -48,12 +48,12 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
+ install(FILES ${SANITIZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
+ # Install xray headers.
+ install(FILES ${XRAY_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
+ add_custom_target(install-compiler-rt-headers
+diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
+index b3ae713cf02c..52b364b900f5 100644
+--- a/lib/dfsan/CMakeLists.txt
++++ b/lib/dfsan/CMakeLists.txt
+@@ -54,4 +54,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
+ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
+ add_dependencies(dfsan dfsan_abilist)
+ install(FILES ${dfsan_abilist_filename}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix
index 2170177117e1..7aa3f9099cc9 100644
--- a/pkgs/development/compilers/llvm/7/default.nix
+++ b/pkgs/development/compilers/llvm/7/default.nix
@@ -1,6 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildPackages
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@@ -18,42 +17,51 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "0lb4kdh7j2fhfz8kd6iv5df7m3pikiryk1vvwsf87spc90n09q0w";
tools = lib.makeExtensible (tools: let
- callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
- mkExtraBuildCommands = cc: ''
+ callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
+ mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
- ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+ ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
+ mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
+ ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+ '';
+
in {
- llvm = callPackage ./llvm { };
+ libllvm = callPackage ./llvm { };
- llvm-polly = callPackage ./llvm { enablePolly = true; };
+ # `llvm` historically had the binaries. When choosing an output explicitly,
+ # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
+ llvm = tools.libllvm.out // { outputUnspecified = true; };
- clang-unwrapped = callPackage ./clang {
- inherit (tools) lld;
+ libllvm-polly = callPackage ./llvm { enablePolly = true; };
+
+ llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
+
+ libclang = callPackage ./clang {
inherit clang-tools-extra_src;
};
+
+ clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
+
clang-polly-unwrapped = callPackage ./clang {
inherit clang-tools-extra_src;
- llvm = tools.llvm-polly;
+ libllvm = tools.libllvm-polly;
enablePolly = true;
};
- llvm-manpages = lowPrio (tools.llvm.override {
+ llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
- clang-manpages = lowPrio (tools.clang-unwrapped.override {
+ clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
- libclang = tools.clang-unwrapped.lib;
-
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
@@ -141,7 +149,7 @@ let
'' + mkExtraBuildCommands cc;
};
- lldClangNoCompilerRt = wrapCCWith {
+ lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
@@ -151,7 +159,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
- '';
+ '' + mkExtraBuildCommands0 cc;
};
});
@@ -181,6 +189,12 @@ let
libunwind = libraries.libunwind;
}));
+ libunwind = callPackage ./libunwind ({
+ inherit (buildLlvmTools) llvm;
+ } // lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
+ stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
+ });
+
openmp = callPackage ./openmp.nix {};
});
diff --git a/pkgs/development/compilers/llvm/7/libc++/default.nix b/pkgs/development/compilers/llvm/7/libc++/default.nix
index fb50c4e24d72..afc59d911794 100644
--- a/pkgs/development/compilers/llvm/7/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/7/libc++/default.nix
@@ -13,7 +13,11 @@ stdenv.mkDerivation {
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
'';
- patches = lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
+ outputs = [ "out" "dev" ];
+
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
prePatch = ''
substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
@@ -37,7 +41,8 @@ stdenv.mkDerivation {
"-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=libcxxabi"
] ++ lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1"
- ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" ;
+ ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
+ ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF" ;
passthru = {
isLLVM = true;
diff --git a/pkgs/development/compilers/llvm/7/libc++/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/7/libc++/gnu-install-dirs.patch
new file mode 100644
index 000000000000..910e5287a866
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/libc++/gnu-install-dirs.patch
@@ -0,0 +1,72 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index acb49565ce97..6a863926cbca 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,6 +26,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libcxx CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxx)
+ set(PACKAGE_VERSION 7.0.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
+index 1c19d7e01af7..9c8aee8e8bb7 100644
+--- a/cmake/Modules/HandleLibCXXABI.cmake
++++ b/cmake/Modules/HandleLibCXXABI.cmake
+@@ -59,7 +59,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
+
+ if (LIBCXX_INSTALL_HEADERS)
+ install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
+ COMPONENT cxx-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index d9def18d725c..16494dacaf6f 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -243,7 +243,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ foreach(file ${files})
+ get_filename_component(dir ${file} DIRECTORY)
+ install(FILES ${file}
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
+ COMPONENT cxx-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+@@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ if (LIBCXX_NEEDS_SITE_CONFIG)
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT cxx-headers)
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index e068edc8a7af..b63ad92d1d78 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -399,8 +399,8 @@ if (LIBCXX_INSTALL_LIBRARY)
+ set(experimental_lib cxx_experimental)
+ endif()
+ install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${filesystem_lib} ${experimental_lib}
+- LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+- ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
++ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
++ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+ )
+ # NOTE: This install command must go after the cxx install command otherwise
+ # it will not be executed after the library symlinks are installed.
+@@ -408,7 +408,7 @@ if (LIBCXX_INSTALL_LIBRARY)
+ # Replace the libc++ filename with $
+ # after we required CMake 3.0.
+ install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}
+ COMPONENT libcxx)
+ endif()
+ endif()
diff --git a/pkgs/development/compilers/llvm/7/libc++abi/default.nix b/pkgs/development/compilers/llvm/7/libc++abi/default.nix
index 84c478651416..31ead6eb4215 100644
--- a/pkgs/development/compilers/llvm/7/libc++abi/default.nix
+++ b/pkgs/development/compilers/llvm/7/libc++abi/default.nix
@@ -1,5 +1,6 @@
-{ lib, stdenv, cmake, fetch, libcxx, llvm, version
-, standalone ? false
+{ lib, stdenv, cmake, fetch, libcxx, libunwind, llvm, version
+, standalone ? stdenv.hostPlatform.useLLVM or false
+, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm
# on musl the shared objects don't build
, enableShared ? !stdenv.hostPlatform.isStatic
}:
@@ -10,7 +11,7 @@ stdenv.mkDerivation {
src = fetch "libcxxabi" "1zcqxsdjhawgz1cvpk07y3jl6fg9p3ay4nl69zsirqb2ghgyhhb2";
- nativeBuildInputs = [ cmake ];
+ outputs = [ "out" "dev" ];
postUnpack = ''
unpackFile ${libcxx.src}
@@ -22,9 +23,18 @@ stdenv.mkDerivation {
patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
'';
- cmakeFlags =
- lib.optional standalone "-DLLVM_ENABLE_LIBCXX=ON" ++
- lib.optional (!enableShared) "-DLIBCXXABI_ENABLE_SHARED=OFF";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
+ nativeBuildInputs = [ cmake ];
+ buildInputs = lib.optional withLibunwind libunwind;
+
+ cmakeFlags = lib.optionals standalone [
+ "-DLLVM_ENABLE_LIBCXX=ON"
+ ] ++ lib.optionals (standalone && withLibunwind) [
+ "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
+ ] ++ lib.optional (!enableShared) "-DLIBCXXABI_ENABLE_SHARED=OFF";
installPhase = if stdenv.isDarwin
then ''
diff --git a/pkgs/development/compilers/llvm/7/libc++abi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/7/libc++abi/gnu-install-dirs.patch
new file mode 100644
index 000000000000..92d9e94fdee7
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/libc++abi/gnu-install-dirs.patch
@@ -0,0 +1,28 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d6648ede1f59..55a8f17ca5e6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libcxxabi CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxxabi)
+ set(PACKAGE_VERSION 7.0.0svn)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 776c51294330..314b45feac69 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -195,8 +195,8 @@ add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
+
+ if (LIBCXXABI_INSTALL_LIBRARY)
+ install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
+- LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
+- ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
++ LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
++ ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
+ )
+ endif()
+
diff --git a/pkgs/development/compilers/llvm/7/libunwind/default.nix b/pkgs/development/compilers/llvm/7/libunwind/default.nix
new file mode 100644
index 000000000000..14c0abc5153f
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/libunwind/default.nix
@@ -0,0 +1,35 @@
+{ lib, stdenv, version, fetch, fetchpatch, cmake, llvm, libcxx
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
+
+stdenv.mkDerivation {
+ pname = "libunwind";
+ inherit version;
+
+ src = fetch "libunwind" "035dsxs10nyiqd00q07yycvmkjl01yz4jdlrjvmch8klxg4pyjhp";
+
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
+ # removes use of `new` that require libc++
+ (fetchpatch {
+ url = "https://github.com/llvm-mirror/libunwind/commit/34a45c630d4c79af403661d267db42fbe7de1178.patch";
+ sha256 = "0n0pv6jvcky8pn3srhrf9x5kbnd0d2kia9xlx2g590f5q0bgwfhv";
+ })
+ # cleans up remaining libc++ dependencies (mostly header inclusions)
+ (fetchpatch {
+ url = "https://github.com/llvm-mirror/libunwind/commit/e050272d2eb57eb4e56a37b429a61df2ebb8aa3e.patch";
+ sha256 = "170mwmj0wf40iyk1kzdpaiy36rz9n8dpl881h4h7s5da0rh51xya";
+ includes = [ "src/libunwind.cpp" "src/UnwindCursor.hpp" ];
+ })
+ ];
+
+ nativeBuildInputs = [ cmake llvm.dev ];
+
+ cmakeFlags = lib.optionals (!enableShared) [
+ "-DLIBUNWIND_ENABLE_SHARED=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
+ "-DLIBUNWIND_HAS_NOSTDINCXX_FLAG=ON"
+ "-DLLVM_ENABLE_LIBCXX=ON"
+ ];
+}
diff --git a/pkgs/development/compilers/llvm/7/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/7/libunwind/gnu-install-dirs.patch
new file mode 100644
index 000000000000..21d4fa80ea13
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/libunwind/gnu-install-dirs.patch
@@ -0,0 +1,28 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0e48d713837a..05483c367bd1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libunwind)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ if(NOT LLVM_CONFIG_PATH)
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 937159e2cb86..07f8b936e7e5 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -141,8 +141,8 @@ add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS})
+
+ if (LIBUNWIND_INSTALL_LIBRARY)
+ install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
+- LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
+- ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
++ LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
++ ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
+ endif()
+
+ if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)
diff --git a/pkgs/development/compilers/llvm/7/lld/default.nix b/pkgs/development/compilers/llvm/7/lld/default.nix
index f4c58abef8a3..da863d5ad4a4 100644
--- a/pkgs/development/compilers/llvm/7/lld/default.nix
+++ b/pkgs/development/compilers/llvm/7/lld/default.nix
@@ -1,8 +1,9 @@
{ lib, stdenv
+, buildLlvmTools
, fetch
, cmake
, libxml2
-, llvm
+, libllvm
, version
}:
@@ -12,15 +13,20 @@ stdenv.mkDerivation {
src = fetch "lld" "0rsqb7zcnij5r5ipfhr129j7skr5n9pyr388kjpqwh091952f3x1";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvm libxml2 ];
+ buildInputs = [ libllvm libxml2 ];
- outputs = [ "out" "dev" ];
+ cmakeFlags = [
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ ];
- postInstall = ''
- moveToOutput include "$dev"
- moveToOutput lib "$dev"
- '';
+ outputs = [ "out" "lib" "dev" ];
meta = {
description = "The LLVM Linker";
diff --git a/pkgs/development/compilers/llvm/7/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/7/lld/gnu-install-dirs.patch
new file mode 100644
index 000000000000..acc2d3d47760
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/lld/gnu-install-dirs.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e2fbdbfbbb47..d601b231ebb8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(LLD_BUILT_STANDALONE TRUE)
+
++ include(GNUInstallDirs)
++
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
+ if(NOT LLVM_CONFIG_PATH)
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
+@@ -203,7 +205,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index fa48b428d26b..e7967aad3ceb 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -20,9 +20,9 @@ macro(add_lld_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -54,7 +54,7 @@ macro(add_lld_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_lldtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -69,5 +69,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
+index d8829493fc22..df748a0e749b 100644
+--- a/tools/lld/CMakeLists.txt
++++ b/tools/lld/CMakeLists.txt
+@@ -16,7 +16,7 @@ target_link_libraries(lld
+ )
+
+ install(TARGETS lld
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(NOT LLD_SYMLINKS_TO_CREATE)
+ set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)
diff --git a/pkgs/development/compilers/llvm/7/lldb/default.nix b/pkgs/development/compilers/llvm/7/lldb/default.nix
index 3fa5b411f634..978884928796 100644
--- a/pkgs/development/compilers/llvm/7/lldb/default.nix
+++ b/pkgs/development/compilers/llvm/7/lldb/default.nix
@@ -7,32 +7,31 @@
, which
, libedit
, libxml2
-, llvm
-, clang-unwrapped
+, libllvm
+, libclang
, perl
, python3
, version
, darwin
}:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
pname = "lldb";
inherit version;
src = fetch "lldb" "0klsscg1sczc4nw2l53xggi969k361cng2sjjrfp3bv4g5x14s4v";
- nativeBuildInputs = [ cmake perl python3 which swig ];
- buildInputs = [ ncurses zlib libedit libxml2 llvm ]
- ++ lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
-
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
postPatch = ''
# Fix up various paths that assume llvm and clang are installed in the same place
- sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
+ sed -i 's,".*ClangConfig.cmake","${libclang.dev}/lib/cmake/clang/ClangConfig.cmake",' \
cmake/modules/LLDBStandalone.cmake
- sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
+ sed -i 's,".*tools/clang/include","${libclang.dev}/include",' \
cmake/modules/LLDBStandalone.cmake
- sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
+ sed -i 's,"$.LLVM_LIBRARY_DIR.",${libllvm.lib}/lib ${libclang.lib}/lib,' \
cmake/modules/LLDBStandalone.cmake
sed -i -e 's,message(SEND_ERROR "Cannot find debugserver on system."),,' \
-e 's,string(STRIP ''${XCODE_DEV_DIR} XCODE_DEV_DIR),,' \
@@ -42,9 +41,18 @@ stdenv.mkDerivation {
patchShebangs scripts
'';
- cmakeFlags = [
- "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
- "-DSKIP_DEBUGSERVER=ON"
+ outputs = [ "out" "lib" "dev" ];
+
+ nativeBuildInputs = [
+ cmake perl python3 which swig
+ ];
+
+ buildInputs = [
+ ncurses zlib libedit libxml2 libllvm
+ ] ++ lib.optionals stdenv.isDarwin [
+ darwin.libobjc
+ darwin.apple_sdk.libs.xpc
+ darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa
];
CXXFLAGS = "-fno-rtti";
@@ -52,6 +60,17 @@ stdenv.mkDerivation {
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-I${libxml2.dev}/include/libxml2";
+ cmakeFlags = [
+ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
+ "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
+ "-DSKIP_DEBUGSERVER=ON"
+ ] ++ lib.optionals doCheck [
+ "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
+ ];
+
+ doCheck = false;
+
postInstall = ''
mkdir -p $out/share/man/man1
cp ../docs/lldb.1 $out/share/man/man1/
diff --git a/pkgs/development/compilers/llvm/7/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/7/lldb/gnu-install-dirs.patch
new file mode 100644
index 000000000000..40645743ecc7
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/lldb/gnu-install-dirs.patch
@@ -0,0 +1,76 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 00ddcdc1488f..af2aa238939a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,8 @@ set(CMAKE_MODULE_PATH
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+ )
+
++include(GNUInstallDirs)
++
+ include(LLDBStandalone)
+ include(LLDBConfig)
+ include(AddLLDB)
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index 129a5ef7500d..fb3fb3ce655c 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -56,14 +56,14 @@ function(add_lldb_library name)
+ endif()
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${out_dir}
+ ARCHIVE DESTINATION ${out_dir})
+ else()
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -121,7 +121,7 @@ function(add_lldb_executable name)
+ endif()
+
+ if(ARG_GENERATE_INSTALL)
+- set(out_dir "bin")
++ set(out_dir "${CMAKE_INSTALL_BINDIR}")
+ if (LLDB_BUILD_FRAMEWORK AND ARG_INCLUDE_IN_SUITE)
+ set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
+ endif()
+diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
+index dae6e365da38..ef272d5de5c0 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -278,7 +278,7 @@ include_directories(BEFORE
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+@@ -288,7 +288,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
+index b5316540fdf3..3c3c882d503f 100644
+--- a/tools/intel-features/CMakeLists.txt
++++ b/tools/intel-features/CMakeLists.txt
+@@ -64,4 +64,4 @@ if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ endif()
+
+ install(TARGETS lldbIntelFeatures
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/pkgs/development/compilers/llvm/7/llvm/default.nix b/pkgs/development/compilers/llvm/7/llvm/default.nix
index 53a7301b19b1..6f189779f848 100644
--- a/pkgs/development/compilers/llvm/7/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/7/llvm/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv
+, pkgsBuildBuild
, fetch
, fetchpatch
, cmake
@@ -11,10 +12,10 @@
, version
, release_version
, zlib
-, buildPackages
+, buildLlvmTools
, debugVersion ? false
, enableManpages ? false
-, enableSharedLibraries ? true
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
, enablePFM ? !(stdenv.isDarwin
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|| stdenv.isAarch32 # broken for the armv7l builder
@@ -46,8 +47,7 @@ in stdenv.mkDerivation ({
mv polly-* $sourceRoot/tools/polly
'';
- outputs = [ "out" "python" ]
- ++ optional enableSharedLibraries "lib";
+ outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python3 ]
++ optional enableManpages python3.pkgs.sphinx;
@@ -67,12 +67,13 @@ in stdenv.mkDerivation ({
url = "https://github.com/llvm-mirror/llvm/commit/cc1f2a595ead516812a6c50398f0f3480ebe031f.patch";
sha256 = "0k6k1p5yisgwx417a67s7sr9930rqh1n0zv5jvply8vjjy4b3kf8";
})
- ];
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
- --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
+ --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
@@ -110,6 +111,7 @@ in stdenv.mkDerivation ({
'';
cmakeFlags = with stdenv; [
+ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
@@ -134,7 +136,20 @@ in stdenv.mkDerivation ({
"-DCAN_TARGET_i386=false"
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
- "-DLLVM_TABLEGEN=${buildPackages.llvm_7}/bin/llvm-tblgen"
+ "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ (
+ let
+ nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+ nativeBintools = nativeCC.bintools.bintools;
+ nativeToolchainFlags = [
+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+ ];
+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+ )
];
postBuild = ''
@@ -148,19 +163,20 @@ in stdenv.mkDerivation ({
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
- ''
- + optionalString enableSharedLibraries ''
- moveToOutput "lib/libLLVM-*" "$lib"
- moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+ moveToOutput "bin/llvm-config*" "$dev"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+ --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+ --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
${lib.concatMapStringsSep "\n" (v: ''
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes}
+ ''
+ + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32);
diff --git a/pkgs/development/compilers/llvm/7/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/7/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 000000000000..0b2d3b79e41f
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,106 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index 9939097f743e..8cc538da912a 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -2,7 +2,11 @@
+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ project(Polly)
+ cmake_minimum_required(VERSION 3.4.3)
++endif()
++
++include(GNUInstallDirs)
+
++if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ # Where is LLVM installed?
+ find_package(LLVM CONFIG REQUIRED)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -145,14 +149,14 @@ include_directories(
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+ )
+
+ install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 969292cd6b00..d7aea77bdd20 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
+- "${POLLY_INSTALL_PREFIX}/include/polly"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+ )
+ else()
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+ ${ISL_INCLUDE_DIRS}
+ )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+ get_target_property(tgt_type ${tgt} TYPE)
+ if (tgt_type STREQUAL "EXECUTABLE")
+- set(tgt_prefix "bin/")
++ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+ else()
+- set(tgt_prefix "lib/")
++ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+ endif()
+
+- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
++ set(tgt_path "${tgt_prefix}$")
+ file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+
+ if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index e48203871884..5bc8a2a52541 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index 8ffd984e542b..261cc19f3238 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -274,7 +274,7 @@ if (POLLY_BUNDLED_ISL)
+ install(DIRECTORY
+ ${ISL_SOURCE_DIR}/include/
+ ${ISL_BINARY_DIR}/include/
+- DESTINATION include/polly
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/7/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/7/llvm/gnu-install-dirs.patch
new file mode 100644
index 000000000000..7e7921e49ab0
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/llvm/gnu-install-dirs.patch
@@ -0,0 +1,386 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a3d3013cedcd..b298d6ef04af 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -275,15 +275,21 @@ if (CMAKE_BUILD_TYPE AND
+ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ endif()
+
++include(GNUInstallDirs)
++
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
++set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
++ "Path for binary subdirectory (defaults to 'bin')")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
+ set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
+ "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
+ mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
+
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+@@ -531,9 +537,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
+ option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+
+-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
++set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
+ CACHE STRING "Doxygen-generated HTML documentation install directory")
+-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
++set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
+ CACHE STRING "OCamldoc-generated HTML documentation install directory")
+
+ option (LLVM_BUILD_EXTERNAL_COMPILER_RT
+@@ -966,7 +972,7 @@ endif()
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -978,7 +984,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index c0f90ba7068d..d656156ff9c8 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -638,11 +638,11 @@ macro(add_llvm_library name)
+ else()
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" OR
+ (LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
+- set(install_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(ARG_SHARED OR BUILD_SHARED_LIBS)
+ if(WIN32 OR CYGWIN OR MINGW)
+ set(install_type RUNTIME)
+- set(install_dir bin)
++ set(install_dir ${CMAKE_INSTALL_BINDIR})
+ else()
+ set(install_type LIBRARY)
+ endif()
+@@ -684,9 +684,9 @@ macro(add_llvm_loadable_module name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ if(WIN32 OR CYGWIN)
+ # DLL platform
+- set(dlldir "bin")
++ set(dlldir "${CMAKE_INSTALL_BINDIR}")
+ else()
+- set(dlldir "lib${LLVM_LIBDIR_SUFFIX}")
++ set(dlldir "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+
+ if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+@@ -698,7 +698,7 @@ macro(add_llvm_loadable_module name)
+ install(TARGETS ${name}
+ ${export_to_llvmexports}
+ LIBRARY DESTINATION ${dlldir}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endif()
+@@ -912,7 +912,7 @@ macro(add_llvm_example name)
+ endif()
+ add_llvm_executable(${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endmacro(add_llvm_example name)
+@@ -1430,7 +1430,7 @@ function(llvm_install_library_symlink name dest type)
+ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+
+- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 AND "${type}" STREQUAL "SHARED")
+ set(output_dir bin)
+ endif()
+@@ -1446,7 +1446,7 @@ function(llvm_install_library_symlink name dest type)
+ endif()
+ endfunction()
+
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+ cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+ foreach(path ${CMAKE_MODULE_PATH})
+ if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1469,7 +1469,7 @@ function(llvm_install_symlink name dest)
+ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+
+ install(SCRIPT ${INSTALL_SYMLINK}
+- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+ COMPONENT ${component})
+
+ if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
+@@ -1551,7 +1551,8 @@ function(add_llvm_tool_symlink link_name target)
+ endif()
+
+ if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+- llvm_install_symlink(${link_name} ${target})
++ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++ llvm_install_symlink(${link_name} ${target} ${output_dir})
+ endif()
+ endif()
+ endfunction()
+@@ -1635,9 +1636,9 @@ function(llvm_setup_rpath name)
+
+ if (APPLE)
+ set(_install_name_dir INSTALL_NAME_DIR "@rpath")
+- set(_install_rpath "@loader_path/../lib" ${extra_libdir})
++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
+ elseif(UNIX)
+- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 02bab6846376..eff26adb2efc 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -140,9 +140,9 @@ function(add_ocaml_library name)
+ endforeach()
+
+ if( APPLE )
+- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 22e3dcb776aa..ba77b9c195e2 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -73,7 +73,7 @@ function (add_sphinx_target builder project)
+
+ elseif (builder STREQUAL html)
+ string(TOUPPER "${project}" project_upper)
+- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
++ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
+ CACHE STRING "HTML documentation install directory for ${project}")
+
+ # '/.' indicates: copy the contents of the directory directly into
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index 6c316a2f04fb..129c0995059c 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -90,11 +90,11 @@ foreach(p ${_count})
+ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+ get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
+-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
++set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
++set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
+ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
+-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
++set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
+ set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
+ configure_file(
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index 1a04de931ff7..1c5ea4200635 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
+ set(LINK_OR_COPY copy)
+ endif()
+
+- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
++ set(bindir "${DESTDIR}${outdir}/")
+
+ message("Creating ${name}")
+
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index cbcadc212498..a3da96546f43 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+- to install libraries to ``/usr/lib64``.
++ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
+ **CMAKE_C_FLAGS**:STRING
+ Extra flags to use when compiling C source files.
+@@ -473,8 +473,8 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
+ The path to install Doxygen-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/doxygen-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
+
+ **LLVM_ENABLE_SPHINX**:BOOL
+ If specified, CMake will search for the ``sphinx-build`` executable and will make
+@@ -505,13 +505,33 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
+ The path to install Sphinx-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
+
+ **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
+ The path to install OCamldoc-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/ocaml-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
++
++**CMAKE_INSTALL_BINDIR**:STRING
++ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `bin`.
++
++**CMAKE_INSTALL_LIBDIR**:STRING
++ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `lib`.
++
++**CMAKE_INSTALL_INCLUDEDIR**:STRING
++ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `include`.
++
++**CMAKE_INSTALL_DOCDIR**:STRING
++ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/doc`.
++
++**CMAKE_INSTALL_MANDIR**:STRING
++ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/man`.
+
+ **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
+ OS X Only: If enabled CMake will generate a target named
+@@ -676,9 +696,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+
+ This file is available in two different locations.
+
+-* ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+- ```` is the install prefix of an installed version of LLVM.
+- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``LLVMConfig.cmake`` where
++ ```` is the location where LLVM CMake modules are
++ installed as part of an installed version of LLVM. This is typically
++ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+
+ * ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+ ```` is the root of the LLVM build tree. **Note: this is only
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index 1d5ca3ba92b0..026f5453c1da 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -4,5 +4,5 @@ add_subdirectory(Support)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+- configure_file(module.modulemap.build module.modulemap COPYONLY)
++ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index f201e1f7bff0..4582ed556a02 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -24,6 +24,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
++#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 892adc3b9dd8..cabe7fcc630f 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -333,12 +333,26 @@ int main(int argc, char **argv) {
+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
+ } else {
+ ActivePrefix = CurrentExecPrefix;
+- ActiveIncludeDir = ActivePrefix + "/include";
+- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+- sys::fs::make_absolute(ActivePrefix, path);
+- ActiveBinDir = path.str();
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveIncludeDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveBinDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveLibDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveCMakeDir = std::string(path.str());
++ }
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
+index 6e913519a809..85641eef721f 100644
+--- a/tools/lto/CMakeLists.txt
++++ b/tools/lto/CMakeLists.txt
+@@ -19,7 +19,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
+ add_llvm_library(LTO SHARED ${SOURCES} DEPENDS intrinsics_gen)
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT LTO)
+
+ if (APPLE)
+diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
+index 19b606933082..27b9f71b3d79 100644
+--- a/tools/opt-viewer/CMakeLists.txt
++++ b/tools/opt-viewer/CMakeLists.txt
+@@ -8,6 +8,6 @@ set (files
+
+ foreach (file ${files})
+ install(PROGRAMS ${file}
+- DESTINATION share/opt-viewer
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
+ COMPONENT opt-viewer)
+ endforeach (file)
diff --git a/pkgs/development/compilers/llvm/8/clang/default.nix b/pkgs/development/compilers/llvm/8/clang/default.nix
index 8f44ffc0615d..c82b3e873e8c 100644
--- a/pkgs/development/compilers/llvm/8/clang/default.nix
+++ b/pkgs/development/compilers/llvm/8/clang/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
+{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
, enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -23,18 +24,22 @@ let
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
- buildInputs = [ libxml2 llvm lld ];
+ buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DCLANGD_BUILD_XPC=OFF"
"-DLLVM_ENABLE_RTTI=ON"
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
] ++ lib.optionals enablePolly [
"-DWITH_POLLY=ON"
"-DLINK_POLLY_INTO_TOOLS=ON"
@@ -42,7 +47,7 @@ let
patches = [
./purity.patch
- ./clang-xpc.patch
+ ./xpc.patch
# Backport for -static-pie, which the latter touches, and which is nice in
# its own right.
./static-pie.patch
@@ -53,6 +58,7 @@ let
./compiler-rt-baremetal.patch
# make clang -xhip use $PATH to find executables
./HIP-use-PATH-8.patch
+ ./gnu-install-dirs.patch
];
postPatch = ''
@@ -69,12 +75,12 @@ let
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
'';
- outputs = [ "out" "lib" "python" ];
+ outputs = [ "out" "lib" "dev" "python" ];
# Clang expects to find LLVMgold in its own prefix
postInstall = ''
- if [ -e ${llvm}/lib/LLVMgold.so ]; then
- ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+ if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
+ ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
fi
ln -sv $out/bin/clang $out/bin/cpp
@@ -91,11 +97,14 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
+
+ mkdir -p $dev/bin
+ cp bin/clang-tblgen $dev/bin
'';
passthru = {
isClang = true;
- inherit llvm;
+ inherit libllvm;
};
meta = {
diff --git a/pkgs/development/compilers/llvm/8/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/clang/gnu-install-dirs.patch
new file mode 100644
index 000000000000..e4b9c3f8ddd6
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/clang/gnu-install-dirs.patch
@@ -0,0 +1,290 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c2016a45ca6b..9224797da0b5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,6 +9,8 @@ endif()
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ project(Clang)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ if(LLVM_CONFIG)
+@@ -382,7 +384,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/clang include/clang-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+@@ -391,7 +393,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "CMakeFiles" EXCLUDE
+ PATTERN "*.inc"
+@@ -399,7 +401,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(PROGRAMS utils/bash-autocomplete.sh
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ )
+ endif()
+
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index 7e22f16f365b..3c0c1d245969 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -99,9 +99,9 @@ macro(add_clang_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_clangtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -142,7 +142,7 @@ macro(add_clang_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_clangtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -157,5 +157,5 @@ endmacro()
+ macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index e444c9c8706f..f8e4d06366a4 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -164,19 +164,19 @@ install(
+ FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_fp16.h
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${cuda_wrapper_files}
+ COMPONENT clang-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
+ add_llvm_install_targets(install-clang-headers
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index 53e3421f1b35..79ae5bb4c399 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
+ "@executable_path/../../lib")
+ else()
+- set(INSTALL_DESTINATION bin)
++ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+
+ install(TARGETS c-index-test
+diff --git a/tools/clang-check/CMakeLists.txt b/tools/clang-check/CMakeLists.txt
+index b837b0a0a5d9..9e30bd5780a5 100644
+--- a/tools/clang-check/CMakeLists.txt
++++ b/tools/clang-check/CMakeLists.txt
+@@ -21,4 +21,4 @@ target_link_libraries(clang-check
+ )
+
+ install(TARGETS clang-check
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-extdef-mapping/CMakeLists.txt b/tools/clang-extdef-mapping/CMakeLists.txt
+index 6c81689a831a..dacc14737719 100644
+--- a/tools/clang-extdef-mapping/CMakeLists.txt
++++ b/tools/clang-extdef-mapping/CMakeLists.txt
+@@ -18,4 +18,4 @@ target_link_libraries(clang-extdef-mapping
+ )
+
+ install(TARGETS clang-extdef-mapping
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
+index a295e8cd0b2a..1973ff82c7f6 100644
+--- a/tools/clang-format/CMakeLists.txt
++++ b/tools/clang-format/CMakeLists.txt
+@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
+ endif()
+
+ install(PROGRAMS clang-format-bbedit.applescript
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-diff.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-sublime.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS git-clang-format
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT clang-format)
+diff --git a/tools/clang-offload-bundler/CMakeLists.txt b/tools/clang-offload-bundler/CMakeLists.txt
+index 8718015be76a..7a038f39622e 100644
+--- a/tools/clang-offload-bundler/CMakeLists.txt
++++ b/tools/clang-offload-bundler/CMakeLists.txt
+@@ -22,4 +22,4 @@ target_link_libraries(clang-offload-bundler
+ ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
+ )
+
+-install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
++install(TARGETS clang-offload-bundler RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
+index 45cbd763425c..f534e022024a 100644
+--- a/tools/clang-rename/CMakeLists.txt
++++ b/tools/clang-rename/CMakeLists.txt
+@@ -19,8 +19,8 @@ target_link_libraries(clang-rename
+ )
+
+ install(PROGRAMS clang-rename.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+ install(PROGRAMS clang-rename.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+diff --git a/tools/diagtool/CMakeLists.txt b/tools/diagtool/CMakeLists.txt
+index 96d1c390249c..41c762b37b76 100644
+--- a/tools/diagtool/CMakeLists.txt
++++ b/tools/diagtool/CMakeLists.txt
+@@ -21,7 +21,7 @@ target_link_libraries(diagtool
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(TARGETS diagtool
+ COMPONENT diagtool
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-diagtool
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 32333b011ad1..258dfb2d520c 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -131,7 +131,7 @@ endif()
+ if(INTERNAL_INSTALL_PREFIX)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
+ else()
+- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
++ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ endif()
+
+ install(DIRECTORY ../../include/clang-c
+@@ -162,7 +162,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
+ COMPONENT
+ libclang-python-bindings
+ DESTINATION
+- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
++ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ endforeach()
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+ add_custom_target(libclang-python-bindings)
+diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
+index 380379300b09..adfd58ed5f7d 100644
+--- a/tools/scan-build/CMakeLists.txt
++++ b/tools/scan-build/CMakeLists.txt
+@@ -41,7 +41,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(LibexecFile ${LibexecFiles})
+@@ -53,7 +53,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/libexec/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
+- install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
++ install(PROGRAMS libexec/${LibexecFile} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
+ endforeach()
+
+ foreach(ManPage ${ManPages})
+@@ -77,7 +77,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/share/scan-build/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+- install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
++ install(FILES share/scan-build/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build)
+ endforeach()
+
+ add_custom_target(scan-build ALL DEPENDS ${Depends})
+diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
+index b305ca562a72..554bcb379061 100644
+--- a/tools/scan-view/CMakeLists.txt
++++ b/tools/scan-view/CMakeLists.txt
+@@ -21,7 +21,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(ShareFile ${ShareFiles})
+@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/share/scan-view/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+- install(FILES share/${ShareFile} DESTINATION share/scan-view)
++ install(FILES share/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view)
+ endforeach()
+
+ add_custom_target(scan-view ALL DEPENDS ${Depends})
+diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
+index 5573009d343a..24b3a90f233f 100644
+--- a/utils/hmaptool/CMakeLists.txt
++++ b/utils/hmaptool/CMakeLists.txt
+@@ -9,7 +9,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL})
+
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
+-install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION bin)
++install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ add_custom_target(hmaptool ALL DEPENDS ${Depends})
+ set_target_properties(hmaptool PROPERTIES FOLDER "Utils")
diff --git a/pkgs/development/compilers/llvm/8/clang/clang-xpc.patch b/pkgs/development/compilers/llvm/8/clang/xpc.patch
similarity index 100%
rename from pkgs/development/compilers/llvm/8/clang/clang-xpc.patch
rename to pkgs/development/compilers/llvm/8/clang/xpc.patch
diff --git a/pkgs/development/compilers/llvm/8/compiler-rt/default.nix b/pkgs/development/compilers/llvm/8/compiler-rt/default.nix
index 3da3d59d1110..d370de031bb5 100644
--- a/pkgs/development/compilers/llvm/8/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/8/compiler-rt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
inherit version;
src = fetch "compiler-rt" "0dqqf8f930l8gag4d9qjgn1n0pj0nbv2anviqqhdi1rkhas8z0hi";
- nativeBuildInputs = [ cmake python3 llvm ];
+ nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
NIX_CFLAGS_COMPILE = [
@@ -54,6 +54,7 @@ stdenv.mkDerivation {
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
+ ./gnu-install-dirs.patch
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional (useLLVM) ./crtbegin-and-end.patch
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
diff --git a/pkgs/development/compilers/llvm/8/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 000000000000..1c2e7f0b3116
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,117 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index aa360a3ef36e..a39676148181 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.4.3)
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+ project(CompilerRT C CXX ASM)
++ include(GNUInstallDirs)
+ set(COMPILER_RT_STANDALONE_BUILD TRUE)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ endif()
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index 81b110203c27..df7598a11caf 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -479,7 +479,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ # Install in Clang resource directory.
+ install(FILES ${file_name}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+@@ -496,7 +496,7 @@ macro(add_compiler_rt_script name)
+ add_custom_target(${name} DEPENDS ${dst})
+ install(FILES ${dst}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
+ endmacro(add_compiler_rt_script src name)
+
+ # Builds custom version of libc++ and installs it in .
+diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
+index 04cc955980fa..a99f6dfb2f82 100644
+--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
+@@ -377,7 +377,7 @@ macro(darwin_add_embedded_builtin_libraries)
+ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
+
+ set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+ set(CFLAGS_i386 "-march=pentium")
+diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
+index 5348f2064b67..d7b8fe190789 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -363,7 +363,7 @@ endfunction()
+ function(get_compiler_rt_install_dir arch install_dir)
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ get_compiler_rt_target(${arch} target)
+- set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${target}/lib PARENT_SCOPE)
++ set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${target}/${CMAKE_INSTALL_FULL_LIBDIR} PARENT_SCOPE)
+ else()
+ set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
+ endif()
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index aeabf17653f5..0a927fbfc750 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -59,11 +59,11 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+ # Take output dir and install path from the user.
+ set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+- "Path where built compiler-rt libraries should be stored.")
++ "Path where built compiler-rt build artifacts should be stored.")
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+ "Path where built compiler-rt executables should be stored.")
+- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+- "Path where built compiler-rt libraries should be installed.")
++ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
++ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
+ # Use a host compiler to compile/link tests.
+@@ -91,7 +91,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
+ set(COMPILER_RT_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+ endif()
+
+ if(APPLE)
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index c4b93b89a30c..3913dc3a1ee6 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -48,12 +48,12 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
+ install(FILES ${SANITIZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
+ # Install xray headers.
+ install(FILES ${XRAY_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
+ add_custom_target(install-compiler-rt-headers
+diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
+index b3ae713cf02c..52b364b900f5 100644
+--- a/lib/dfsan/CMakeLists.txt
++++ b/lib/dfsan/CMakeLists.txt
+@@ -54,4 +54,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
+ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
+ add_dependencies(dfsan dfsan_abilist)
+ install(FILES ${dfsan_abilist_filename}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/pkgs/development/compilers/llvm/8/default.nix b/pkgs/development/compilers/llvm/8/default.nix
index 6d6d8b4f7830..bcbbd155e36c 100644
--- a/pkgs/development/compilers/llvm/8/default.nix
+++ b/pkgs/development/compilers/llvm/8/default.nix
@@ -1,6 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildPackages
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@@ -18,43 +17,52 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "1qf3097bc5ia8p6cpmbx985rjr3yaah5s8fc0nv7pw742yv7jw8q";
tools = lib.makeExtensible (tools: let
- callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
- mkExtraBuildCommands = cc: ''
+ callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
+ mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
- ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+ ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
+ mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
+ ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+ '';
+
in {
- llvm = callPackage ./llvm { };
+ libllvm = callPackage ./llvm { };
- llvm-polly = callPackage ./llvm { enablePolly = true; };
+ # `llvm` historically had the binaries. When choosing an output explicitly,
+ # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
+ llvm = tools.libllvm.out // { outputUnspecified = true; };
- clang-unwrapped = callPackage ./clang {
- inherit (tools) lld;
+ libllvm-polly = callPackage ./llvm { enablePolly = true; };
+
+ llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
+
+ libclang = callPackage ./clang {
inherit clang-tools-extra_src;
};
+
+ clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
+
clang-polly-unwrapped = callPackage ./clang {
inherit clang-tools-extra_src;
- llvm = tools.llvm-polly;
+ libllvm = tools.libllvm-polly;
enablePolly = true;
};
# disabled until recommonmark supports sphinx 3
- #llvm-manpages = lowPrio (tools.llvm.override {
+ #llvm-manpages = lowPrio (tools.libllvm.override {
# enableManpages = true;
# python3 = pkgs.python3; # don't use python-boot
#});
- clang-manpages = lowPrio (tools.clang-unwrapped.override {
+ clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
- libclang = tools.clang-unwrapped.lib;
-
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
@@ -144,7 +152,7 @@ let
'' + mkExtraBuildCommands cc;
};
- lldClangNoCompilerRt = wrapCCWith {
+ lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
@@ -154,7 +162,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
- '';
+ '' + mkExtraBuildCommands0 cc;
};
});
diff --git a/pkgs/development/compilers/llvm/8/libc++/default.nix b/pkgs/development/compilers/llvm/8/libc++/default.nix
index 70e4d9e1a65e..d73600b441d1 100644
--- a/pkgs/development/compilers/llvm/8/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/8/libc++/default.nix
@@ -13,7 +13,11 @@ stdenv.mkDerivation {
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
'';
- patches = lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
+ outputs = [ "out" "dev" ];
+
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
prePatch = ''
substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
diff --git a/pkgs/development/compilers/llvm/8/libc++/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/libc++/gnu-install-dirs.patch
new file mode 100644
index 000000000000..6af403ac86b4
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/libc++/gnu-install-dirs.patch
@@ -0,0 +1,72 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6b83bce1ae72..63cda3e4e80c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,6 +26,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libcxx CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxx)
+ set(PACKAGE_VERSION 8.0.1)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
+index 1c19d7e01af7..9c8aee8e8bb7 100644
+--- a/cmake/Modules/HandleLibCXXABI.cmake
++++ b/cmake/Modules/HandleLibCXXABI.cmake
+@@ -59,7 +59,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
+
+ if (LIBCXX_INSTALL_HEADERS)
+ install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
+ COMPONENT cxx-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index 73f7cfc4d8e3..92cf0864ac7e 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -243,7 +243,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ foreach(file ${files})
+ get_filename_component(dir ${file} DIRECTORY)
+ install(FILES ${file}
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
+ COMPONENT cxx-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+@@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ if (LIBCXX_NEEDS_SITE_CONFIG)
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT cxx-headers)
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index 24489e8fb5e8..7327e5ee4b85 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -414,8 +414,8 @@ if (LIBCXX_INSTALL_LIBRARY)
+ set(experimental_lib cxx_experimental)
+ endif()
+ install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${filesystem_lib} ${experimental_lib}
+- LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+- ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
++ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
++ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+ )
+ # NOTE: This install command must go after the cxx install command otherwise
+ # it will not be executed after the library symlinks are installed.
+@@ -423,7 +423,7 @@ if (LIBCXX_INSTALL_LIBRARY)
+ # Replace the libc++ filename with $
+ # after we required CMake 3.0.
+ install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
+- DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
++ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}
+ COMPONENT libcxx)
+ endif()
+ endif()
diff --git a/pkgs/development/compilers/llvm/8/libc++abi/default.nix b/pkgs/development/compilers/llvm/8/libc++abi/default.nix
index bde67f86640d..5659bb4f14ac 100644
--- a/pkgs/development/compilers/llvm/8/libc++abi/default.nix
+++ b/pkgs/development/compilers/llvm/8/libc++abi/default.nix
@@ -8,6 +8,25 @@ stdenv.mkDerivation {
src = fetch "libcxxabi" "1vznz8n1z1h8af0ga451m98lc2hjnv4fyzl71napsvjhvk4g6nxp";
+ outputs = [ "out" "dev" ];
+
+ postUnpack = ''
+ unpackFile ${libcxx.src}
+ unpackFile ${llvm.src}
+ cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
+ '' + lib.optionalString stdenv.isDarwin ''
+ export TRIPLE=x86_64-apple-darwin
+ '' + lib.optionalString stdenv.hostPlatform.isMusl ''
+ patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
+ '' + lib.optionalString stdenv.hostPlatform.isWasm ''
+ patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
+ '';
+
+ patches = [
+ ./no-threads.patch
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
@@ -21,20 +40,6 @@ stdenv.mkDerivation {
"-DLIBCXXABI_ENABLE_SHARED=OFF"
];
- patches = [ ./no-threads.patch ];
-
- postUnpack = ''
- unpackFile ${libcxx.src}
- unpackFile ${llvm.src}
- cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
- '' + lib.optionalString stdenv.isDarwin ''
- export TRIPLE=x86_64-apple-darwin
- '' + lib.optionalString stdenv.hostPlatform.isMusl ''
- patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
- '' + lib.optionalString stdenv.hostPlatform.isWasm ''
- patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
- '';
-
installPhase = if stdenv.isDarwin
then ''
for file in lib/*.dylib; do
diff --git a/pkgs/development/compilers/llvm/8/libc++abi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/libc++abi/gnu-install-dirs.patch
new file mode 100644
index 000000000000..3f924b0efbea
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/libc++abi/gnu-install-dirs.patch
@@ -0,0 +1,28 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 92c7dc5dc557..556b3e05a042 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libcxxabi CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxxabi)
+ set(PACKAGE_VERSION 8.0.0)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 7e21fb2d7926..30711099a19c 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -220,8 +220,8 @@ add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
+
+ if (LIBCXXABI_INSTALL_LIBRARY)
+ install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
+- LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
+- ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
++ LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
++ ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
+ )
+ endif()
+
diff --git a/pkgs/development/compilers/llvm/8/libunwind/default.nix b/pkgs/development/compilers/llvm/8/libunwind/default.nix
index d1bd54fbd349..e38f2072cede 100644
--- a/pkgs/development/compilers/llvm/8/libunwind/default.nix
+++ b/pkgs/development/compilers/llvm/8/libunwind/default.nix
@@ -2,13 +2,11 @@
, enableShared ? !stdenv.hostPlatform.isStatic
}:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
pname = "libunwind";
inherit version;
- src = fetch "libunwind" "0vhgcgzsb33l83qaikrkj87ypqb48mi607rccczccwiiv8ficw0q";
-
- nativeBuildInputs = [ cmake ];
+ src = fetch pname "0vhgcgzsb33l83qaikrkj87ypqb48mi607rccczccwiiv8ficw0q";
patches = [
(fetchpatch {
@@ -19,7 +17,12 @@ stdenv.mkDerivation {
url = "https://github.com/llvm-mirror/libunwind/commit/e050272d2eb57eb4e56a37b429a61df2ebb8aa3e.patch";
sha256 = "1sxyx5xnax8k713jjcxgq3jq3cpnxygs2rcdf5vfja0f2k9jzldl";
})
+ ./gnu-install-dirs.patch
];
+ outputs = [ "out" "dev" ];
+
+ nativeBuildInputs = [ cmake ];
+
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
}
diff --git a/pkgs/development/compilers/llvm/8/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/libunwind/gnu-install-dirs.patch
new file mode 100644
index 000000000000..ffabba8137d6
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/libunwind/gnu-install-dirs.patch
@@ -0,0 +1,28 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3d06073cfe74..55c7d1635fcd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(libunwind)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ if(NOT LLVM_CONFIG_PATH)
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index f7523f88b6ac..4060dad214de 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -151,8 +151,8 @@ add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS})
+
+ if (LIBUNWIND_INSTALL_LIBRARY)
+ install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
+- LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
+- ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
++ LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
++ ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
+ endif()
+
+ if (NOT CMAKE_CONFIGURATION_TYPES AND LIBUNWIND_INSTALL_LIBRARY)
diff --git a/pkgs/development/compilers/llvm/8/lld/default.nix b/pkgs/development/compilers/llvm/8/lld/default.nix
index 8009beb7bc13..696403d1bf65 100644
--- a/pkgs/development/compilers/llvm/8/lld/default.nix
+++ b/pkgs/development/compilers/llvm/8/lld/default.nix
@@ -1,8 +1,9 @@
{ lib, stdenv
+, buildLlvmTools
, fetch
, cmake
, libxml2
-, llvm
+, libllvm
, version
}:
@@ -12,15 +13,20 @@ stdenv.mkDerivation {
src = fetch "lld" "121xhxrlvwy3k5nf6p1wv31whxlb635ssfkci8z93mwv4ja1xflz";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvm libxml2 ];
+ buildInputs = [ libllvm libxml2 ];
- outputs = [ "out" "dev" ];
+ cmakeFlags = [
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ ];
- postInstall = ''
- moveToOutput include "$dev"
- moveToOutput lib "$dev"
- '';
+ outputs = [ "out" "lib" "dev" ];
meta = {
description = "The LLVM Linker";
diff --git a/pkgs/development/compilers/llvm/8/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/lld/gnu-install-dirs.patch
new file mode 100644
index 000000000000..acc2d3d47760
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/lld/gnu-install-dirs.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e2fbdbfbbb47..d601b231ebb8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(LLD_BUILT_STANDALONE TRUE)
+
++ include(GNUInstallDirs)
++
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
+ if(NOT LLVM_CONFIG_PATH)
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
+@@ -203,7 +205,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index fa48b428d26b..e7967aad3ceb 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -20,9 +20,9 @@ macro(add_lld_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -54,7 +54,7 @@ macro(add_lld_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_lldtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -69,5 +69,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
+index d8829493fc22..df748a0e749b 100644
+--- a/tools/lld/CMakeLists.txt
++++ b/tools/lld/CMakeLists.txt
+@@ -16,7 +16,7 @@ target_link_libraries(lld
+ )
+
+ install(TARGETS lld
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(NOT LLD_SYMLINKS_TO_CREATE)
+ set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)
diff --git a/pkgs/development/compilers/llvm/8/lldb/default.nix b/pkgs/development/compilers/llvm/8/lldb/default.nix
index 83c171d2a572..95bf4aae0546 100644
--- a/pkgs/development/compilers/llvm/8/lldb/default.nix
+++ b/pkgs/development/compilers/llvm/8/lldb/default.nix
@@ -7,47 +7,67 @@
, which
, libedit
, libxml2
-, llvm
-, clang-unwrapped
+, libllvm
+, libclang
, python3
, version
, darwin
}:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
pname = "lldb";
inherit version;
src = fetch "lldb" "1mriw4adrwm6kzabrjr7yqmdiylxd6glf6samd80dp8idnm9p9z8";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
postPatch = ''
# Fix up various paths that assume llvm and clang are installed in the same place
- sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
+ sed -i 's,".*ClangConfig.cmake","${libclang.dev}/lib/cmake/clang/ClangConfig.cmake",' \
cmake/modules/LLDBStandalone.cmake
- sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
+ sed -i 's,".*tools/clang/include","${libclang.dev}/include",' \
cmake/modules/LLDBStandalone.cmake
- sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
+ sed -i 's,"$.LLVM_LIBRARY_DIR.",${libllvm.lib}/lib ${libclang.lib}/lib,' \
cmake/modules/LLDBStandalone.cmake
'';
- nativeBuildInputs = [ cmake python3 which swig ];
- buildInputs = [ ncurses zlib libedit libxml2 llvm ]
- ++ lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
+ outputs = [ "out" "lib" "dev" ];
+
+ nativeBuildInputs = [
+ cmake python3 which swig
+ ];
+
+ buildInputs = [
+ ncurses zlib libedit libxml2 libllvm
+ ] ++ lib.optionals stdenv.isDarwin [
+ darwin.libobjc
+ darwin.apple_sdk.libs.xpc
+ darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa
+ ];
CXXFLAGS = "-fno-rtti";
hardeningDisable = [ "format" ];
cmakeFlags = [
+ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
+ ] ++ lib.optionals doCheck [
+ "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
];
+ doCheck = false;
+
postInstall = ''
mkdir -p $out/share/man/man1
cp ../docs/lldb.1 $out/share/man/man1/
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
- mkdir $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
- ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
+ mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
+ ln -s $out/bin/llvm-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
'';
meta = with lib; {
diff --git a/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch
new file mode 100644
index 000000000000..b2e79086beda
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/lldb/gnu-install-dirs.patch
@@ -0,0 +1,81 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cdf22c4b0fc8..8def776f2b4a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,8 @@ set(CMAKE_MODULE_PATH
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+ )
+
++include(GNUInstallDirs)
++
+ include(LLDBStandalone)
+ include(LLDBConfig)
+ include(AddLLDB)
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index f82c11d3d317..776e6d6ef9de 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -63,18 +63,18 @@ function(add_lldb_library name)
+ set(install_dir ".")
+ endif()
+ else()
+- set(install_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${install_dir}
+ ARCHIVE DESTINATION ${install_dir})
+ else()
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -122,7 +122,7 @@ function(add_lldb_executable name)
+ if(ARG_GENERATE_INSTALL)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
+index 109c5132d3be..8b9092faa29d 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -319,7 +319,7 @@ include_directories(BEFORE
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+@@ -329,7 +329,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
+index b5316540fdf3..3c3c882d503f 100644
+--- a/tools/intel-features/CMakeLists.txt
++++ b/tools/intel-features/CMakeLists.txt
+@@ -64,4 +64,4 @@ if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ endif()
+
+ install(TARGETS lldbIntelFeatures
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/pkgs/development/compilers/llvm/8/llvm/default.nix b/pkgs/development/compilers/llvm/8/llvm/default.nix
index c0b88e7ff3e0..8ea9b287c7ce 100644
--- a/pkgs/development/compilers/llvm/8/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/8/llvm/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv
+, pkgsBuildBuild
, fetch
, fetchpatch
, cmake
@@ -11,10 +12,10 @@
, version
, release_version
, zlib
-, buildPackages
+, buildLlvmTools
, debugVersion ? false
, enableManpages ? false
-, enableSharedLibraries ? true
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
, enablePFM ? !(stdenv.isDarwin
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|| stdenv.isAarch32 # broken for the armv7l builder
@@ -45,8 +46,7 @@ in stdenv.mkDerivation ({
mv polly-* $sourceRoot/tools/polly
'';
- outputs = [ "out" "python" ]
- ++ optional enableSharedLibraries "lib";
+ outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python3 ]
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
@@ -62,12 +62,13 @@ in stdenv.mkDerivation ({
url = "https://bugs.gentoo.org/attachment.cgi?id=612792";
sha256 = "0rwx6jpqq4xnf4mvfm8v2d4r34y1yi05am0mx5k2d5bha9j64lqg";
})
- ];
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
- --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
+ --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
@@ -96,6 +97,7 @@ in stdenv.mkDerivation ({
'';
cmakeFlags = with stdenv; [
+ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
@@ -119,7 +121,20 @@ in stdenv.mkDerivation ({
"-DCAN_TARGET_i386=false"
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
- "-DLLVM_TABLEGEN=${buildPackages.llvm_8}/bin/llvm-tblgen"
+ "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ (
+ let
+ nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+ nativeBintools = nativeCC.bintools.bintools;
+ nativeToolchainFlags = [
+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+ ];
+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+ )
];
postBuild = ''
@@ -133,18 +148,19 @@ in stdenv.mkDerivation ({
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
- ''
- + optionalString enableSharedLibraries ''
- moveToOutput "lib/libLLVM-*" "$lib"
- moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+ moveToOutput "bin/llvm-config*" "$dev"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+ --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+ --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
+ ''
+ + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32);
diff --git a/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 000000000000..7c477c7df58a
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,106 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index 9939097f743e..8cc538da912a 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -2,7 +2,11 @@
+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ project(Polly)
+ cmake_minimum_required(VERSION 3.4.3)
++endif()
++
++include(GNUInstallDirs)
+
++if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ # Where is LLVM installed?
+ find_package(LLVM CONFIG REQUIRED)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -145,14 +149,14 @@ include_directories(
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+ )
+
+ install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 211f95512717..f9e04a4844b6 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
+- "${POLLY_INSTALL_PREFIX}/include/polly"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+ )
+ else()
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+ ${ISL_INCLUDE_DIRS}
+ )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+ get_target_property(tgt_type ${tgt} TYPE)
+ if (tgt_type STREQUAL "EXECUTABLE")
+- set(tgt_prefix "bin/")
++ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+ else()
+- set(tgt_prefix "lib/")
++ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+ endif()
+
+- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
++ set(tgt_path "${tgt_prefix}$")
+ file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+
+ if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index e48203871884..5bc8a2a52541 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index 8ffd984e542b..261cc19f3238 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -274,7 +274,7 @@ if (POLLY_BUNDLED_ISL)
+ install(DIRECTORY
+ ${ISL_SOURCE_DIR}/include/
+ ${ISL_BINARY_DIR}/include/
+- DESTINATION include/polly
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs.patch
new file mode 100644
index 000000000000..027e43f7caca
--- /dev/null
+++ b/pkgs/development/compilers/llvm/8/llvm/gnu-install-dirs.patch
@@ -0,0 +1,394 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 81c2bab39ec9..075e68be6125 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -251,15 +251,21 @@ if (CMAKE_BUILD_TYPE AND
+ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ endif()
+
++include(GNUInstallDirs)
++
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
++set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
++ "Path for binary subdirectory (defaults to 'bin')")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
+ set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
+ "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
+ mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
+
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+@@ -517,9 +523,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
+ option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+
+-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
++set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
+ CACHE STRING "Doxygen-generated HTML documentation install directory")
+-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
++set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
+ CACHE STRING "OCamldoc-generated HTML documentation install directory")
+
+ option (LLVM_BUILD_EXTERNAL_COMPILER_RT
+@@ -956,7 +962,7 @@ endif()
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -968,7 +974,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -983,13 +989,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ if (LLVM_INSTALL_MODULEMAPS)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "module.modulemap"
+ )
+ install(FILES include/llvm/module.install.modulemap
+- DESTINATION include/llvm
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
+ COMPONENT llvm-headers
+ RENAME "module.extern.modulemap"
+ )
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index 1a417447278b..0c2aef338078 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -646,11 +646,11 @@ macro(add_llvm_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" OR
+ ${name} STREQUAL "OptRemarks" OR
+ (LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
+- set(install_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(ARG_MODULE OR ARG_SHARED OR BUILD_SHARED_LIBS)
+ if(WIN32 OR CYGWIN OR MINGW)
+ set(install_type RUNTIME)
+- set(install_dir bin)
++ set(install_dir ${CMAKE_INSTALL_BINDIR})
+ else()
+ set(install_type LIBRARY)
+ endif()
+@@ -898,7 +898,7 @@ macro(add_llvm_example name)
+ endif()
+ add_llvm_executable(${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endmacro(add_llvm_example name)
+@@ -1442,7 +1442,7 @@ function(llvm_install_library_symlink name dest type)
+ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+
+- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 AND "${type}" STREQUAL "SHARED")
+ set(output_dir bin)
+ endif()
+@@ -1458,7 +1458,7 @@ function(llvm_install_library_symlink name dest type)
+ endif()
+ endfunction()
+
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+ cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+ foreach(path ${CMAKE_MODULE_PATH})
+ if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1481,7 +1481,7 @@ function(llvm_install_symlink name dest)
+ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+
+ install(SCRIPT ${INSTALL_SYMLINK}
+- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+ COMPONENT ${component})
+
+ if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
+@@ -1563,7 +1563,8 @@ function(add_llvm_tool_symlink link_name target)
+ endif()
+
+ if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+- llvm_install_symlink(${link_name} ${target})
++ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++ llvm_install_symlink(${link_name} ${target} ${output_dir})
+ endif()
+ endif()
+ endfunction()
+@@ -1670,9 +1671,9 @@ function(llvm_setup_rpath name)
+
+ if (APPLE)
+ set(_install_name_dir INSTALL_NAME_DIR "@rpath")
+- set(_install_rpath "@loader_path/../lib" ${extra_libdir})
++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
+ elseif(UNIX)
+- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 02bab6846376..eff26adb2efc 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -140,9 +140,9 @@ function(add_ocaml_library name)
+ endforeach()
+
+ if( APPLE )
+- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 22e3dcb776aa..ba77b9c195e2 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -73,7 +73,7 @@ function (add_sphinx_target builder project)
+
+ elseif (builder STREQUAL html)
+ string(TOUPPER "${project}" project_upper)
+- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
++ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
+ CACHE STRING "HTML documentation install directory for ${project}")
+
+ # '/.' indicates: copy the contents of the directory directly into
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index f5cc0006fa06..77698aeaf000 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -90,11 +90,11 @@ foreach(p ${_count})
+ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+ get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
+-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
++set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
++set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
+ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
+-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
++set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
+ set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
+ configure_file(
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index 1a04de931ff7..1c5ea4200635 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
+ set(LINK_OR_COPY copy)
+ endif()
+
+- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
++ set(bindir "${DESTDIR}${outdir}/")
+
+ message("Creating ${name}")
+
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index eb219c58560b..6f32532f8ebf 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+- to install libraries to ``/usr/lib64``.
++ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
+ **CMAKE_C_FLAGS**:STRING
+ Extra flags to use when compiling C source files.
+@@ -479,8 +479,8 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
+ The path to install Doxygen-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/doxygen-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
+
+ **LLVM_ENABLE_SPHINX**:BOOL
+ If specified, CMake will search for the ``sphinx-build`` executable and will make
+@@ -511,13 +511,33 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
+ The path to install Sphinx-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
+
+ **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
+ The path to install OCamldoc-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/ocaml-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
++
++**CMAKE_INSTALL_BINDIR**:STRING
++ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `bin`.
++
++**CMAKE_INSTALL_LIBDIR**:STRING
++ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `lib`.
++
++**CMAKE_INSTALL_INCLUDEDIR**:STRING
++ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `include`.
++
++**CMAKE_INSTALL_DOCDIR**:STRING
++ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/doc`.
++
++**CMAKE_INSTALL_MANDIR**:STRING
++ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/man`.
+
+ **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
+ OS X Only: If enabled CMake will generate a target named
+@@ -691,9 +711,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+
+ This file is available in two different locations.
+
+-* ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+- ```` is the install prefix of an installed version of LLVM.
+- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``LLVMConfig.cmake`` where
++ ```` is the location where LLVM CMake modules are
++ installed as part of an installed version of LLVM. This is typically
++ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+
+ * ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+ ```` is the root of the LLVM build tree. **Note: this is only
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index 1d5ca3ba92b0..026f5453c1da 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -4,5 +4,5 @@ add_subdirectory(Support)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+- configure_file(module.modulemap.build module.modulemap COPYONLY)
++ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index f201e1f7bff0..4582ed556a02 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -24,6 +24,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
++#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index bec89fef98ca..31d78f925d45 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -333,12 +333,26 @@ int main(int argc, char **argv) {
+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
+ } else {
+ ActivePrefix = CurrentExecPrefix;
+- ActiveIncludeDir = ActivePrefix + "/include";
+- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+- sys::fs::make_absolute(ActivePrefix, path);
+- ActiveBinDir = path.str();
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveIncludeDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveBinDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveLibDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveCMakeDir = std::string(path.str());
++ }
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
+index 6e913519a809..85641eef721f 100644
+--- a/tools/lto/CMakeLists.txt
++++ b/tools/lto/CMakeLists.txt
+@@ -19,7 +19,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
+ add_llvm_library(LTO SHARED ${SOURCES} DEPENDS intrinsics_gen)
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT LTO)
+
+ if (APPLE)
+diff --git a/tools/opt-remarks/CMakeLists.txt b/tools/opt-remarks/CMakeLists.txt
+index a87beae1e893..149ea3d10168 100644
+--- a/tools/opt-remarks/CMakeLists.txt
++++ b/tools/opt-remarks/CMakeLists.txt
+@@ -11,7 +11,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/OptRemarks.exports)
+ add_llvm_library(OptRemarks SHARED ${SOURCES})
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/OptRemarks.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT OptRemarks)
+
+ if (APPLE)
+diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
+index 19b606933082..27b9f71b3d79 100644
+--- a/tools/opt-viewer/CMakeLists.txt
++++ b/tools/opt-viewer/CMakeLists.txt
+@@ -8,6 +8,6 @@ set (files
+
+ foreach (file ${files})
+ install(PROGRAMS ${file}
+- DESTINATION share/opt-viewer
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
+ COMPONENT opt-viewer)
+ endforeach (file)
diff --git a/pkgs/development/compilers/llvm/9/clang/default.nix b/pkgs/development/compilers/llvm/9/clang/default.nix
index 87b29163f43e..f1c21083bb66 100644
--- a/pkgs/development/compilers/llvm/9/clang/default.nix
+++ b/pkgs/development/compilers/llvm/9/clang/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
+{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
+, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
, enablePolly ? false # TODO: get this info from llvm (passthru?)
@@ -23,18 +24,22 @@ let
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
- buildInputs = [ libxml2 llvm lld ];
+ buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DCLANGD_BUILD_XPC=OFF"
"-DLLVM_ENABLE_RTTI=ON"
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
] ++ lib.optionals enablePolly [
"-DWITH_POLLY=ON"
"-DLINK_POLLY_INTO_TOOLS=ON"
@@ -46,6 +51,7 @@ let
./compiler-rt-baremetal.patch
# make clang -xhip use $PATH to find executables
./HIP-use-PATH-9.patch
+ ./gnu-install-dirs.patch
];
postPatch = ''
@@ -62,12 +68,12 @@ let
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
'';
- outputs = [ "out" "lib" "python" ];
+ outputs = [ "out" "lib" "dev" "python" ];
# Clang expects to find LLVMgold in its own prefix
postInstall = ''
- if [ -e ${llvm}/lib/LLVMgold.so ]; then
- ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+ if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
+ ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
fi
ln -sv $out/bin/clang $out/bin/cpp
@@ -86,11 +92,14 @@ let
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
+
+ mkdir -p $dev/bin
+ cp bin/clang-tblgen $dev/bin
'';
passthru = {
isClang = true;
- inherit llvm;
+ inherit libllvm;
};
meta = {
diff --git a/pkgs/development/compilers/llvm/9/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/clang/gnu-install-dirs.patch
new file mode 100644
index 000000000000..625cbcc72361
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/clang/gnu-install-dirs.patch
@@ -0,0 +1,278 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 60937aa9db38..45522ff32998 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,6 +9,8 @@ endif()
+ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ project(Clang)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ if(LLVM_CONFIG)
+@@ -413,7 +415,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/clang include/clang-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT clang-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -423,7 +425,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT clang-headers
+ FILES_MATCHING
+ PATTERN "CMakeFiles" EXCLUDE
+@@ -442,7 +444,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ endif()
+
+ install(PROGRAMS utils/bash-autocomplete.sh
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ )
+ endif()
+
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index cbd618e18afb..63ba43f18e64 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -109,9 +109,9 @@ macro(add_clang_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_clangtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${name}
+@@ -155,7 +155,7 @@ macro(add_clang_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_clangtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT LLVM_ENABLE_IDE)
+@@ -170,7 +170,7 @@ endmacro()
+ macro(add_clang_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+
+ function(clang_target_link_libraries target type)
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index a3c0b08fa364..aa4215c0999c 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -185,7 +185,7 @@ set_target_properties(clang-resource-headers PROPERTIES
+ FOLDER "Misc"
+ RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
+
+-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+ FILES ${files} ${generated_files}
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index ceef4b08637c..8efad5520ca4 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
+ "@executable_path/../../lib")
+ else()
+- set(INSTALL_DESTINATION bin)
++ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+
+ install(TARGETS c-index-test
+diff --git a/tools/clang-check/CMakeLists.txt b/tools/clang-check/CMakeLists.txt
+index 4576d78bcfb4..7c3b302d8d59 100644
+--- a/tools/clang-check/CMakeLists.txt
++++ b/tools/clang-check/CMakeLists.txt
+@@ -21,4 +21,4 @@ clang_target_link_libraries(clang-check
+ )
+
+ install(TARGETS clang-check
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-extdef-mapping/CMakeLists.txt b/tools/clang-extdef-mapping/CMakeLists.txt
+index 4798bdb71ad0..02d07b9982ac 100644
+--- a/tools/clang-extdef-mapping/CMakeLists.txt
++++ b/tools/clang-extdef-mapping/CMakeLists.txt
+@@ -18,4 +18,4 @@ clang_target_link_libraries(clang-extdef-mapping
+ )
+
+ install(TARGETS clang-extdef-mapping
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
+index 35ecdb11253c..d77d75de0094 100644
+--- a/tools/clang-format/CMakeLists.txt
++++ b/tools/clang-format/CMakeLists.txt
+@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
+ endif()
+
+ install(PROGRAMS clang-format-bbedit.applescript
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-diff.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format-sublime.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS clang-format.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-format)
+ install(PROGRAMS git-clang-format
+- DESTINATION bin
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT clang-format)
+diff --git a/tools/clang-offload-bundler/CMakeLists.txt b/tools/clang-offload-bundler/CMakeLists.txt
+index 465bef040a6c..729369ed9429 100644
+--- a/tools/clang-offload-bundler/CMakeLists.txt
++++ b/tools/clang-offload-bundler/CMakeLists.txt
+@@ -22,4 +22,4 @@ clang_target_link_libraries(clang-offload-bundler
+ ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
+ )
+
+-install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
++install(TARGETS clang-offload-bundler RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
+index cda8e29ec5b1..0134d8ccd70b 100644
+--- a/tools/clang-rename/CMakeLists.txt
++++ b/tools/clang-rename/CMakeLists.txt
+@@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
+ )
+
+ install(PROGRAMS clang-rename.py
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+ install(PROGRAMS clang-rename.el
+- DESTINATION share/clang
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
+ COMPONENT clang-rename)
+diff --git a/tools/diagtool/CMakeLists.txt b/tools/diagtool/CMakeLists.txt
+index a95444be40ee..136d96d9bf5b 100644
+--- a/tools/diagtool/CMakeLists.txt
++++ b/tools/diagtool/CMakeLists.txt
+@@ -21,7 +21,7 @@ clang_target_link_libraries(diagtool
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(TARGETS diagtool
+ COMPONENT diagtool
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-diagtool
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 613ead1a36b6..e5c7bf27f739 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -137,7 +137,7 @@ endif()
+ if(INTERNAL_INSTALL_PREFIX)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
+ else()
+- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
++ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ endif()
+
+ install(DIRECTORY ../../include/clang-c
+@@ -168,7 +168,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
+ COMPONENT
+ libclang-python-bindings
+ DESTINATION
+- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
++ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ endforeach()
+ if(NOT LLVM_ENABLE_IDE)
+ add_custom_target(libclang-python-bindings)
+diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
+index 380379300b09..adfd58ed5f7d 100644
+--- a/tools/scan-build/CMakeLists.txt
++++ b/tools/scan-build/CMakeLists.txt
+@@ -41,7 +41,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(LibexecFile ${LibexecFiles})
+@@ -53,7 +53,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/libexec/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
+- install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
++ install(PROGRAMS libexec/${LibexecFile} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
+ endforeach()
+
+ foreach(ManPage ${ManPages})
+@@ -77,7 +77,7 @@ if(CLANG_INSTALL_SCANBUILD)
+ ${CMAKE_BINARY_DIR}/share/scan-build/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
+- install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
++ install(FILES share/scan-build/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build)
+ endforeach()
+
+ add_custom_target(scan-build ALL DEPENDS ${Depends})
+diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
+index b305ca562a72..554bcb379061 100644
+--- a/tools/scan-view/CMakeLists.txt
++++ b/tools/scan-view/CMakeLists.txt
+@@ -21,7 +21,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/bin/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
+- install(PROGRAMS bin/${BinFile} DESTINATION bin)
++ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endforeach()
+
+ foreach(ShareFile ${ShareFiles})
+@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
+ ${CMAKE_BINARY_DIR}/share/scan-view/
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
+- install(FILES share/${ShareFile} DESTINATION share/scan-view)
++ install(FILES share/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view)
+ endforeach()
+
+ add_custom_target(scan-view ALL DEPENDS ${Depends})
+diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
+index 5573009d343a..24b3a90f233f 100644
+--- a/utils/hmaptool/CMakeLists.txt
++++ b/utils/hmaptool/CMakeLists.txt
+@@ -9,7 +9,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL})
+
+ list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
+-install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION bin)
++install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ add_custom_target(hmaptool ALL DEPENDS ${Depends})
+ set_target_properties(hmaptool PROPERTIES FOLDER "Utils")
diff --git a/pkgs/development/compilers/llvm/9/compiler-rt/default.nix b/pkgs/development/compilers/llvm/9/compiler-rt/default.nix
index cfc8e0ea74a2..285fe811514f 100644
--- a/pkgs/development/compilers/llvm/9/compiler-rt/default.nix
+++ b/pkgs/development/compilers/llvm/9/compiler-rt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
inherit version;
src = fetch pname "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2";
- nativeBuildInputs = [ cmake python3 llvm ];
+ nativeBuildInputs = [ cmake python3 llvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
NIX_CFLAGS_COMPILE = [
@@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
+ ./gnu-install-dirs.patch
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
diff --git a/pkgs/development/compilers/llvm/9/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 000000000000..7967bbc48550
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,117 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f26ae25ada30..8ba536afdccc 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,6 +12,7 @@ endif()
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+ project(CompilerRT C CXX ASM)
++ include(GNUInstallDirs)
+ set(COMPILER_RT_STANDALONE_BUILD TRUE)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ endif()
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index f7ee932f214f..ef94a97c4be9 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -488,7 +488,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
+ add_custom_target(${target_name} DEPENDS ${dst_file})
+ # Install in Clang resource directory.
+ install(FILES ${file_name}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}
+ COMPONENT ${component})
+ add_dependencies(${component} ${target_name})
+
+@@ -505,7 +505,7 @@ macro(add_compiler_rt_script name)
+ add_custom_target(${name} DEPENDS ${dst})
+ install(FILES ${dst}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
+ endmacro(add_compiler_rt_script src name)
+
+ # Builds custom version of libc++ and installs it in .
+diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
+index b50d55b56940..7e5729ad9c8e 100644
+--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
++++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
+@@ -386,7 +386,7 @@ macro(darwin_add_embedded_builtin_libraries)
+ set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
+
+ set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+ set(CFLAGS_i386 "-march=pentium")
+diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
+index 6e672b1e1818..64999709958e 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -371,7 +371,7 @@ endfunction()
+ function(get_compiler_rt_install_dir arch install_dir)
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ get_compiler_rt_target(${arch} target)
+- set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
++ set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE)
+ else()
+ set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
+ endif()
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index cef0e0d73d87..db33fb028287 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -55,11 +55,11 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+ # Take output dir and install path from the user.
+ set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+- "Path where built compiler-rt libraries should be stored.")
++ "Path where built compiler-rt build artifacts should be stored.")
+ set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+ "Path where built compiler-rt executables should be stored.")
+- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+- "Path where built compiler-rt libraries should be installed.")
++ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
++ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
+ option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
+ option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
+ # Use a host compiler to compile/link tests.
+@@ -87,7 +87,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set(COMPILER_RT_LIBRARY_OUTPUT_DIR
+ ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
+ set(COMPILER_RT_LIBRARY_INSTALL_DIR
+- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
++ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
+ endif()
+
+ if(APPLE)
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index 38bd6e41a912..2092d0d08247 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -50,12 +50,12 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
+ install(FILES ${SANITIZER_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
+ # Install xray headers.
+ install(FILES ${XRAY_HEADERS}
+ COMPONENT compiler-rt-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
+
+ if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
+ add_custom_target(install-compiler-rt-headers
+diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
+index b3ae713cf02c..52b364b900f5 100644
+--- a/lib/dfsan/CMakeLists.txt
++++ b/lib/dfsan/CMakeLists.txt
+@@ -54,4 +54,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
+ DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
+ add_dependencies(dfsan dfsan_abilist)
+ install(FILES ${dfsan_abilist_filename}
+- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
++ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})
diff --git a/pkgs/development/compilers/llvm/9/default.nix b/pkgs/development/compilers/llvm/9/default.nix
index 1b8bdad07bbd..0660bac137f6 100644
--- a/pkgs/development/compilers/llvm/9/default.nix
+++ b/pkgs/development/compilers/llvm/9/default.nix
@@ -1,6 +1,5 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
-, buildPackages
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
}:
@@ -18,43 +17,52 @@ let
clang-tools-extra_src = fetch "clang-tools-extra" "01vgzd4k1q93nfs8gyl83mjlc4x0qsgfqw32lacbjzdxg0mdfvxj";
tools = lib.makeExtensible (tools: let
- callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
- mkExtraBuildCommands = cc: ''
+ callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
+ mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
- ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+ ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
+ mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
+ ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+ '';
+
in {
- llvm = callPackage ./llvm { };
+ libllvm = callPackage ./llvm { };
- llvm-polly = callPackage ./llvm { enablePolly = true; };
+ # `llvm` historically had the binaries. When choosing an output explicitly,
+ # we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
+ llvm = tools.libllvm.out // { outputUnspecified = true; };
- clang-unwrapped = callPackage ./clang {
- inherit (tools) lld;
+ libllvm-polly = callPackage ./llvm { enablePolly = true; };
+
+ llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
+
+ libclang = callPackage ./clang {
inherit clang-tools-extra_src;
};
+
+ clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
+
clang-polly-unwrapped = callPackage ./clang {
inherit clang-tools-extra_src;
- llvm = tools.llvm-polly;
+ libllvm = tools.libllvm-polly;
enablePolly = true;
};
# disabled until recommonmark supports sphinx 3
- #llvm-manpages = lowPrio (tools.llvm.override {
+ #llvm-manpages = lowPrio (tools.libllvm.override {
# enableManpages = true;
# python3 = pkgs.python3; # don't use python-boot
#});
- clang-manpages = lowPrio (tools.clang-unwrapped.override {
+ clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
- libclang = tools.clang-unwrapped.lib;
-
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
@@ -144,7 +152,7 @@ let
'' + mkExtraBuildCommands cc;
};
- lldClangNoCompilerRt = wrapCCWith {
+ lldClangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = wrapBintoolsWith {
@@ -154,7 +162,7 @@ let
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
- '';
+ '' + mkExtraBuildCommands0 cc;
};
});
diff --git a/pkgs/development/compilers/llvm/9/libc++/default.nix b/pkgs/development/compilers/llvm/9/libc++/default.nix
index 6ea1e28e7b4b..3cdb4f32a050 100644
--- a/pkgs/development/compilers/llvm/9/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/9/libc++/default.nix
@@ -13,7 +13,11 @@ stdenv.mkDerivation {
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
'';
- patches = lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
+ outputs = [ "out" "dev" ];
+
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
preConfigure = ''
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
diff --git a/pkgs/development/compilers/llvm/9/libc++/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/libc++/gnu-install-dirs.patch
new file mode 100644
index 000000000000..424488bd2e52
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/libc++/gnu-install-dirs.patch
@@ -0,0 +1,99 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ec1869ddc7ae..a1c040235c8d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,6 +26,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
+ project(libcxx CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxx)
+ set(PACKAGE_VERSION 9.0.1)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+@@ -416,7 +418,7 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
+ string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
+@@ -424,10 +426,10 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+ set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
+ else()
+ set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
++ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
+ endif()
+
+ file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
+diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
+index 10f100f7f0fb..95ed3978ab73 100644
+--- a/cmake/Modules/HandleLibCXXABI.cmake
++++ b/cmake/Modules/HandleLibCXXABI.cmake
+@@ -61,7 +61,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
+
+ if (LIBCXX_INSTALL_HEADERS)
+ install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
+ COMPONENT cxx-headers
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index 7cbf82caa81f..7cbde7accd78 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -243,7 +243,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ foreach(file ${files})
+ get_filename_component(dir ${file} DIRECTORY)
+ install(FILES ${file}
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
+ COMPONENT ${CXX_HEADER_TARGET}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ )
+@@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS)
+ if (LIBCXX_NEEDS_SITE_CONFIG)
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
++ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT ${CXX_HEADER_TARGET})
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 31cd24333a5e..a419cef662b0 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -437,21 +437,21 @@ if (LIBCXX_INSTALL_LIBRARY)
+ install(TARGETS cxx_shared
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ if (LIBCXX_INSTALL_STATIC_LIBRARY)
+ install(TARGETS cxx_static
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
+ install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib}
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
+- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
++ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
+ endif()
+
+ # NOTE: This install command must go after the cxx install command otherwise
diff --git a/pkgs/development/compilers/llvm/9/libc++abi/default.nix b/pkgs/development/compilers/llvm/9/libc++abi/default.nix
index 99d3918b89da..5358985f448e 100644
--- a/pkgs/development/compilers/llvm/9/libc++abi/default.nix
+++ b/pkgs/development/compilers/llvm/9/libc++abi/default.nix
@@ -8,6 +8,25 @@ stdenv.mkDerivation {
src = fetch "libcxxabi" "1b4aiaa8cirx52vk2p5kfk57qmbqf1ipb4nqnjhdgqps9jm7iyg8";
+ outputs = [ "out" "dev" ];
+
+ postUnpack = ''
+ unpackFile ${libcxx.src}
+ unpackFile ${llvm.src}
+ cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
+ '' + lib.optionalString stdenv.isDarwin ''
+ export TRIPLE=x86_64-apple-darwin
+ '' + lib.optionalString stdenv.hostPlatform.isMusl ''
+ patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
+ '' + lib.optionalString stdenv.hostPlatform.isWasm ''
+ patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
+ '';
+
+ patches = [
+ ./no-threads.patch
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
@@ -21,20 +40,6 @@ stdenv.mkDerivation {
"-DLIBCXXABI_ENABLE_SHARED=OFF"
];
- patches = [ ./no-threads.patch ];
-
- postUnpack = ''
- unpackFile ${libcxx.src}
- unpackFile ${llvm.src}
- cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
- '' + lib.optionalString stdenv.isDarwin ''
- export TRIPLE=x86_64-apple-darwin
- '' + lib.optionalString stdenv.hostPlatform.isMusl ''
- patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
- '' + lib.optionalString stdenv.hostPlatform.isWasm ''
- patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
- '';
-
installPhase = if stdenv.isDarwin
then ''
for file in lib/*.dylib; do
diff --git a/pkgs/development/compilers/llvm/9/libc++abi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/libc++abi/gnu-install-dirs.patch
new file mode 100644
index 000000000000..70b41a6ff531
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/libc++abi/gnu-install-dirs.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index aa0b124fc3c4..d74373f465c5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD)
+ project(libcxxabi CXX C)
+
++ include(GNUInstallDirs)
++
+ set(PACKAGE_NAME libcxxabi)
+ set(PACKAGE_VERSION 9.0.1)
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+@@ -181,17 +183,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
+ string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
+ endif()
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
+ else()
+ set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
+- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
++ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
+ endif()
+
+ set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.")
diff --git a/pkgs/development/compilers/llvm/9/libunwind/default.nix b/pkgs/development/compilers/llvm/9/libunwind/default.nix
index 4c4c85512e3d..fdb362dcd2e3 100644
--- a/pkgs/development/compilers/llvm/9/libunwind/default.nix
+++ b/pkgs/development/compilers/llvm/9/libunwind/default.nix
@@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
src = fetch pname "1wb02ha3gl6p0a321hwpll74pz5qvjr11xmjqx62g288f1m10njk";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
+ outputs = [ "out" "dev" ];
+
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
diff --git a/pkgs/development/compilers/llvm/9/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/libunwind/gnu-install-dirs.patch
new file mode 100644
index 000000000000..12171bb51550
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/libunwind/gnu-install-dirs.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index df68491d686e..3b53267ae464 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
+ project(libunwind)
+
++ include(GNUInstallDirs)
++
+ # Rely on llvm-config.
+ set(CONFIG_OUTPUT)
+ if(NOT LLVM_CONFIG_PATH)
+@@ -189,17 +191,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ if(LIBCXX_LIBDIR_SUBDIR)
+ string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+ string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+ endif()
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
+ else()
+ set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
++ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
+ endif()
+
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})
diff --git a/pkgs/development/compilers/llvm/9/lld/default.nix b/pkgs/development/compilers/llvm/9/lld/default.nix
index 8b12642d2a70..cd84afe70e46 100644
--- a/pkgs/development/compilers/llvm/9/lld/default.nix
+++ b/pkgs/development/compilers/llvm/9/lld/default.nix
@@ -1,8 +1,9 @@
{ lib, stdenv
+, buildLlvmTools
, fetch
, cmake
, libxml2
-, llvm
+, libllvm
, version
}:
@@ -12,15 +13,20 @@ stdenv.mkDerivation rec {
src = fetch pname "10hckfxpapfnh6y9apjiya2jpw9nmbbmh8ayijx89mrg7snjn9l6";
+ patches = [
+ ./gnu-install-dirs.patch
+ ];
+
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvm libxml2 ];
+ buildInputs = [ libllvm libxml2 ];
- outputs = [ "out" "dev" ];
+ cmakeFlags = [
+ "-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ ];
- postInstall = ''
- moveToOutput include "$dev"
- moveToOutput lib "$dev"
- '';
+ outputs = [ "out" "lib" "dev" ];
meta = {
description = "The LLVM Linker";
diff --git a/pkgs/development/compilers/llvm/9/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/lld/gnu-install-dirs.patch
new file mode 100644
index 000000000000..232f5cbac9dd
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/lld/gnu-install-dirs.patch
@@ -0,0 +1,68 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 641f71c114ae..9d44c1463aff 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(LLD_BUILT_STANDALONE TRUE)
+
++ include(GNUInstallDirs)
++
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
+ if(NOT LLVM_CONFIG_PATH)
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
+@@ -202,7 +204,7 @@ include_directories(BEFORE
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index fa48b428d26b..e7967aad3ceb 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -20,9 +20,9 @@ macro(add_lld_library name)
+ install(TARGETS ${name}
+ COMPONENT ${name}
+ ${export_to_lldtargets}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- RUNTIME DESTINATION bin)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-${name}
+@@ -54,7 +54,7 @@ macro(add_lld_tool name)
+
+ install(TARGETS ${name}
+ ${export_to_lldtargets}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT ${name})
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+@@ -69,5 +69,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+ add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+ # Always generate install targets
+- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
+index a15e296e31df..654c2cfdb9c0 100644
+--- a/tools/lld/CMakeLists.txt
++++ b/tools/lld/CMakeLists.txt
+@@ -17,7 +17,7 @@ target_link_libraries(lld
+ )
+
+ install(TARGETS lld
+- RUNTIME DESTINATION bin)
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(NOT LLD_SYMLINKS_TO_CREATE)
+ set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)
diff --git a/pkgs/development/compilers/llvm/9/lldb/default.nix b/pkgs/development/compilers/llvm/9/lldb/default.nix
index d75acf135f36..6d753ce1a869 100644
--- a/pkgs/development/compilers/llvm/9/lldb/default.nix
+++ b/pkgs/development/compilers/llvm/9/lldb/default.nix
@@ -7,8 +7,8 @@
, which
, libedit
, libxml2
-, llvm
-, clang-unwrapped
+, libllvm
+, libclang
, python3
, version
, darwin
@@ -21,17 +21,20 @@ stdenv.mkDerivation rec {
src = fetch pname "02gb3fbz09kyw8n71218v5v77ip559x3gqbcp8y3w6n3jpbryywa";
- patches = [ ./procfs.patch ];
+ patches = [
+ ./procfs.patch
+ ./gnu-install-dirs.patch
+ ];
+
+ outputs = [ "out" "lib" "dev" ];
+
+ nativeBuildInputs = [
+ cmake python3 which swig lit
+ ];
- nativeBuildInputs = [ cmake python3 which swig lit ];
buildInputs = [
- ncurses
- zlib
- libedit
- libxml2
- llvm
- ]
- ++ lib.optionals stdenv.isDarwin [
+ ncurses zlib libedit libxml2 libllvm
+ ] ++ lib.optionals stdenv.isDarwin [
darwin.libobjc
darwin.apple_sdk.libs.xpc
darwin.apple_sdk.frameworks.Foundation
@@ -44,11 +47,17 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ];
cmakeFlags = [
- "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
- "-DClang_DIR=${clang-unwrapped}/lib/cmake"
+ "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
+ "-DClang_DIR=${libclang.dev}/lib/cmake"
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
+ "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
+ ] ++ lib.optionals doCheck [
+ "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+ "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
];
+ doCheck = false;
+
postInstall = ''
# man page
mkdir -p $out/share/man/man1
@@ -58,13 +67,13 @@ stdenv.mkDerivation rec {
# vscode:
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
- ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
+ ln -s $out/bin/llvm-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
'';
meta = with lib; {
description = "A next-generation high-performance debugger";
- homepage = "https://llvm.org/";
- license = licenses.ncsa;
- platforms = platforms.all;
+ homepage = "https://llvm.org/";
+ license = licenses.ncsa;
+ platforms = platforms.all;
};
}
diff --git a/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch
new file mode 100644
index 000000000000..cb4e400b3678
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/lldb/gnu-install-dirs.patch
@@ -0,0 +1,65 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5d52f6450657..a05130cf80b9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,6 +14,8 @@ set(CMAKE_MODULE_PATH
+ # If we are not building as part of LLVM, build LLDB as a standalone project,
+ # using LLVM as an external library.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
++ include(GNUInstallDirs)
++
+ include(LLDBStandalone)
+ endif()
+
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index 4c99278c583b..36d3640a6afc 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -94,13 +94,13 @@ function(add_lldb_library name)
+ endif()
+
+ if(PARAM_SHARED)
+- set(install_dest lib${LLVM_LIBDIR_SUFFIX})
++ set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(PARAM_INSTALL_PREFIX)
+ set(install_dest ${PARAM_INSTALL_PREFIX})
+ endif()
+ # RUNTIME is relevant for DLL platforms, FRAMEWORK for macOS
+ install(TARGETS ${name} COMPONENT ${name}
+- RUNTIME DESTINATION bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${install_dest}
+ ARCHIVE DESTINATION ${install_dest}
+ FRAMEWORK DESTINATION ${install_dest})
+diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
+index e1a133709ff2..357b4bb4492a 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -335,7 +335,7 @@ include_directories(BEFORE
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+@@ -345,7 +345,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ COMPONENT lldb-headers
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
+index b5316540fdf3..3c3c882d503f 100644
+--- a/tools/intel-features/CMakeLists.txt
++++ b/tools/intel-features/CMakeLists.txt
+@@ -64,4 +64,4 @@ if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
+ endif()
+
+ install(TARGETS lldbIntelFeatures
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/pkgs/development/compilers/llvm/9/llvm/default.nix b/pkgs/development/compilers/llvm/9/llvm/default.nix
index b795f07d472b..78d8d7b30ef0 100644
--- a/pkgs/development/compilers/llvm/9/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/9/llvm/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv
+, pkgsBuildBuild
, fetch
, cmake
, python3
@@ -10,10 +11,10 @@
, version
, release_version
, zlib
-, buildPackages
+, buildLlvmTools
, debugVersion ? false
, enableManpages ? false
-, enableSharedLibraries ? true
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
, enablePFM ? !(stdenv.isDarwin
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|| stdenv.isAarch32 # broken for the armv7l builder
@@ -44,8 +45,7 @@ in stdenv.mkDerivation (rec {
mv polly-* $sourceRoot/tools/polly
'';
- outputs = [ "out" "python" ]
- ++ optional enableSharedLibraries "lib";
+ outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python3 ]
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
@@ -55,10 +55,14 @@ in stdenv.mkDerivation (rec {
propagatedBuildInputs = [ ncurses zlib ];
+ patches = [
+ ./gnu-install-dirs.patch
+ ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
+
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
- --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
+ --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
@@ -104,6 +108,7 @@ in stdenv.mkDerivation (rec {
'';
cmakeFlags = with stdenv; [
+ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
@@ -127,7 +132,20 @@ in stdenv.mkDerivation (rec {
"-DCAN_TARGET_i386=false"
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
- "-DLLVM_TABLEGEN=${buildPackages.llvm_9}/bin/llvm-tblgen"
+ "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ (
+ let
+ nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+ nativeBintools = nativeCC.bintools.bintools;
+ nativeToolchainFlags = [
+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+ ];
+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
+ )
];
postBuild = ''
@@ -141,18 +159,19 @@ in stdenv.mkDerivation (rec {
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
- ''
- + optionalString enableSharedLibraries ''
- moveToOutput "lib/libLLVM-*" "$lib"
- moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+ moveToOutput "bin/llvm-config*" "$dev"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+ --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+ substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+ --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
- substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
- --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
+ ''
+ + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32);
diff --git a/pkgs/development/compilers/llvm/9/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/9/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 000000000000..7c477c7df58a
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,106 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index 9939097f743e..8cc538da912a 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -2,7 +2,11 @@
+ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ project(Polly)
+ cmake_minimum_required(VERSION 3.4.3)
++endif()
++
++include(GNUInstallDirs)
+
++if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+ # Where is LLVM installed?
+ find_package(LLVM CONFIG REQUIRED)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -145,14 +149,14 @@ include_directories(
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN ".svn" EXCLUDE
+ )
+
+ install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 211f95512717..f9e04a4844b6 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
+- "${POLLY_INSTALL_PREFIX}/include/polly"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+ )
+ else()
+ set(POLLY_CONFIG_INCLUDE_DIRS
+- "${POLLY_INSTALL_PREFIX}/include"
++ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+ ${ISL_INCLUDE_DIRS}
+ )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+ get_target_property(tgt_type ${tgt} TYPE)
+ if (tgt_type STREQUAL "EXECUTABLE")
+- set(tgt_prefix "bin/")
++ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+ else()
+- set(tgt_prefix "lib/")
++ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+ endif()
+
+- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$")
++ set(tgt_path "${tgt_prefix}$")
+ file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+
+ if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index e48203871884..5bc8a2a52541 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index 8ffd984e542b..261cc19f3238 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -274,7 +274,7 @@ if (POLLY_BUNDLED_ISL)
+ install(DIRECTORY
+ ${ISL_SOURCE_DIR}/include/
+ ${ISL_BINARY_DIR}/include/
+- DESTINATION include/polly
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/9/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/9/llvm/gnu-install-dirs.patch
new file mode 100644
index 000000000000..380cc3f6df39
--- /dev/null
+++ b/pkgs/development/compilers/llvm/9/llvm/gnu-install-dirs.patch
@@ -0,0 +1,395 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b9a10685b99f..c2750500df99 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -242,15 +242,21 @@ if (CMAKE_BUILD_TYPE AND
+ message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ endif()
+
++include(GNUInstallDirs)
++
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
++set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
++ "Path for binary subdirectory (defaults to 'bin')")
+ mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
+
+ set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
+ "Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
+ mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
+
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+@@ -534,9 +540,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
+ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
+ option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+
+-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
++set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
+ CACHE STRING "Doxygen-generated HTML documentation install directory")
+-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
++set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
+ CACHE STRING "OCamldoc-generated HTML documentation install directory")
+
+ option (LLVM_BUILD_EXTERNAL_COMPILER_RT
+@@ -1002,7 +1008,7 @@ endif()
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -1014,7 +1020,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ )
+
+ install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+@@ -1029,13 +1035,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+
+ if (LLVM_INSTALL_MODULEMAPS)
+ install(DIRECTORY include/llvm include/llvm-c
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT llvm-headers
+ FILES_MATCHING
+ PATTERN "module.modulemap"
+ )
+ install(FILES include/llvm/module.install.modulemap
+- DESTINATION include/llvm
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
+ COMPONENT llvm-headers
+ RENAME "module.extern.modulemap"
+ )
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index 619e986b8aa0..842b4f71d07e 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -697,9 +697,9 @@ macro(add_llvm_library name)
+
+ install(TARGETS ${name}
+ ${export_to_llvmexports}
+- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+- RUNTIME DESTINATION bin COMPONENT ${name})
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${name}
+@@ -930,7 +930,7 @@ macro(add_llvm_example name)
+ endif()
+ add_llvm_executable(${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+- install(TARGETS ${name} RUNTIME DESTINATION examples)
++ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+ endmacro(add_llvm_example name)
+@@ -1485,7 +1485,7 @@ function(llvm_install_library_symlink name dest type)
+ set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+ set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+
+- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+ if(WIN32 AND "${type}" STREQUAL "SHARED")
+ set(output_dir bin)
+ endif()
+@@ -1501,7 +1501,7 @@ function(llvm_install_library_symlink name dest type)
+ endif()
+ endfunction()
+
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+ cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+ foreach(path ${CMAKE_MODULE_PATH})
+ if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1524,7 +1524,7 @@ function(llvm_install_symlink name dest)
+ set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+
+ install(SCRIPT ${INSTALL_SYMLINK}
+- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+ COMPONENT ${component})
+
+ if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
+@@ -1606,7 +1606,8 @@ function(add_llvm_tool_symlink link_name target)
+ endif()
+
+ if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+- llvm_install_symlink(${link_name} ${target})
++ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++ llvm_install_symlink(${link_name} ${target} ${output_dir})
+ endif()
+ endif()
+ endfunction()
+@@ -1728,9 +1729,9 @@ function(llvm_setup_rpath name)
+
+ if (APPLE)
+ set(_install_name_dir INSTALL_NAME_DIR "@rpath")
+- set(_install_rpath "@loader_path/../lib" ${extra_libdir})
++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
+ elseif(UNIX)
+- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+ set_property(TARGET ${name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 02bab6846376..eff26adb2efc 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -140,9 +140,9 @@ function(add_ocaml_library name)
+ endforeach()
+
+ if( APPLE )
+- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 22e3dcb776aa..ba77b9c195e2 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -73,7 +73,7 @@ function (add_sphinx_target builder project)
+
+ elseif (builder STREQUAL html)
+ string(TOUPPER "${project}" project_upper)
+- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
++ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
+ CACHE STRING "HTML documentation install directory for ${project}")
+
+ # '/.' indicates: copy the contents of the directory directly into
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index 9cf22b436fa7..486e40010cd8 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -96,13 +96,13 @@ foreach(p ${_count})
+ set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
+ get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
+ endforeach(p)
+-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
++set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
+ set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+ set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
++set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
+ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
+-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
++set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
+ set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
+ configure_file(
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index 09fed8085c23..aa79f192abf0 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
+ set(LINK_OR_COPY copy)
+ endif()
+
+- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
++ set(bindir "${DESTDIR}${outdir}/")
+
+ message(STATUS "Creating ${name}")
+
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index 91fb5282206f..d2c9fd94d131 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+ Extra suffix to append to the directory where libraries are to be
+ installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+- to install libraries to ``/usr/lib64``.
++ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+
+ **CMAKE_C_FLAGS**:STRING
+ Extra flags to use when compiling C source files.
+@@ -492,8 +492,8 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
+ The path to install Doxygen-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/doxygen-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
+
+ **LLVM_ENABLE_SPHINX**:BOOL
+ If specified, CMake will search for the ``sphinx-build`` executable and will make
+@@ -524,13 +524,33 @@ LLVM-specific variables
+
+ **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
+ The path to install Sphinx-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
+
+ **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
+ The path to install OCamldoc-generated HTML documentation to. This path can
+- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
+- `share/doc/llvm/ocaml-html`.
++ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
++ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
++
++**CMAKE_INSTALL_BINDIR**:STRING
++ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `bin`.
++
++**CMAKE_INSTALL_LIBDIR**:STRING
++ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `lib`.
++
++**CMAKE_INSTALL_INCLUDEDIR**:STRING
++ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `include`.
++
++**CMAKE_INSTALL_DOCDIR**:STRING
++ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/doc`.
++
++**CMAKE_INSTALL_MANDIR**:STRING
++ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
++ Defaults to `share/man`.
+
+ **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
+ macOS Only: If enabled CMake will generate a target named
+@@ -710,9 +730,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+
+ This file is available in two different locations.
+
+-* ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+- ```` is the install prefix of an installed version of LLVM.
+- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``LLVMConfig.cmake`` where
++ ```` is the location where LLVM CMake modules are
++ installed as part of an installed version of LLVM. This is typically
++ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+
+ * ``/lib/cmake/llvm/LLVMConfig.cmake`` where
+ ```` is the root of the LLVM build tree. **Note: this is only
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index 1d5ca3ba92b0..026f5453c1da 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -4,5 +4,5 @@ add_subdirectory(Support)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+- configure_file(module.modulemap.build module.modulemap COPYONLY)
++ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index 3a24d3e974e1..987d82c1bb97 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -23,6 +23,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
++#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 7ef7c46a2627..1f71f8b0f820 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -332,12 +332,26 @@ int main(int argc, char **argv) {
+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
+ } else {
+ ActivePrefix = CurrentExecPrefix;
+- ActiveIncludeDir = ActivePrefix + "/include";
+- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
+- sys::fs::make_absolute(ActivePrefix, path);
+- ActiveBinDir = path.str();
+- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveIncludeDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveBinDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveLibDir = std::string(path.str());
++ }
++ {
++ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
++ sys::fs::make_absolute(ActivePrefix, path);
++ ActiveCMakeDir = std::string(path.str());
++ }
+ ActiveIncludeOption = "-I" + ActiveIncludeDir;
+ }
+
+diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
+index b86e4abd01a7..02ce5773f17d 100644
+--- a/tools/lto/CMakeLists.txt
++++ b/tools/lto/CMakeLists.txt
+@@ -23,7 +23,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
+ add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS intrinsics_gen)
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT LTO)
+
+ if (APPLE)
+diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
+index 19b606933082..27b9f71b3d79 100644
+--- a/tools/opt-viewer/CMakeLists.txt
++++ b/tools/opt-viewer/CMakeLists.txt
+@@ -8,6 +8,6 @@ set (files
+
+ foreach (file ${files})
+ install(PROGRAMS ${file}
+- DESTINATION share/opt-viewer
++ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
+ COMPONENT opt-viewer)
+ endforeach (file)
+diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt
+index e948496c603a..1f4df8a98b10 100644
+--- a/tools/remarks-shlib/CMakeLists.txt
++++ b/tools/remarks-shlib/CMakeLists.txt
+@@ -11,7 +11,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
+ add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES})
+
+ install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
+- DESTINATION include/llvm-c
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
+ COMPONENT Remarks)
+
+ if (APPLE)
diff --git a/pkgs/development/compilers/llvm/rocm/default.nix b/pkgs/development/compilers/llvm/rocm/default.nix
index 6a11ded0529a..581d05746718 100644
--- a/pkgs/development/compilers/llvm/rocm/default.nix
+++ b/pkgs/development/compilers/llvm/rocm/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchFromGitHub, callPackage, wrapCCWith }:
+{ lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith }:
let
version = "4.1.0";
@@ -15,7 +15,7 @@ in rec {
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
rsrc="$out/resource-root"
mkdir "$rsrc"
- ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
+ ln -s "${lib.getLib cc}/lib/clang/$clang_version/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
rm $out/nix-support/add-hardening.sh
@@ -31,6 +31,7 @@ in rec {
lld = callPackage ./lld {
inherit llvm version;
src = "${src}/lld";
+ buildLlvmTools = buildPackages.llvmPackages_rocm;
};
llvm = callPackage ./llvm {
diff --git a/pkgs/development/compilers/llvm/rocm/lld/default.nix b/pkgs/development/compilers/llvm/rocm/lld/default.nix
index a6e993bb203f..ef60747b0138 100644
--- a/pkgs/development/compilers/llvm/rocm/lld/default.nix
+++ b/pkgs/development/compilers/llvm/rocm/lld/default.nix
@@ -1,4 +1,5 @@
{ lib, stdenv
+, buildLlvmTools
, cmake
, libxml2
, llvm
@@ -13,12 +14,17 @@ stdenv.mkDerivation rec {
pname = "lld";
nativeBuildInputs = [ cmake ];
-
buildInputs = [ libxml2 llvm ];
- outputs = [ "out" "dev" ];
- cmakeFlags = [ "-DLLVM_MAIN_SRC_DIR=${llvm.src}" ];
+ cmakeFlags = [
+ "-DLLVM_MAIN_SRC_DIR=${llvm.src}"
+ ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+ "-DLLVM_CONFIG_PATH=${llvm.dev}/bin/llvm-config-native"
+ ];
+
+ outputs = [ "out" "dev" ];
postInstall = ''
moveToOutput include "$dev"
diff --git a/pkgs/development/compilers/llvm/rocm/llvm/default.nix b/pkgs/development/compilers/llvm/rocm/llvm/default.nix
index 62559bf13926..b3e8c06195ff 100644
--- a/pkgs/development/compilers/llvm/rocm/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/rocm/llvm/default.nix
@@ -9,7 +9,7 @@
, zlib
, debugVersion ? false
, enableManpages ? false
-, enableSharedLibraries ? true
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
, version
, src
diff --git a/pkgs/development/compilers/mrustc/bootstrap.nix b/pkgs/development/compilers/mrustc/bootstrap.nix
index 35e7daaf2103..85b328848b1f 100644
--- a/pkgs/development/compilers/mrustc/bootstrap.nix
+++ b/pkgs/development/compilers/mrustc/bootstrap.nix
@@ -78,7 +78,7 @@ stdenv.mkDerivation rec {
# Use shared mrustc/minicargo/llvm instead of rebuilding them
"MRUSTC=${mrustc}/bin/mrustc"
"MINICARGO=${mrustc-minicargo}/bin/minicargo"
- "LLVM_CONFIG=${llvm_7}/bin/llvm-config"
+ "LLVM_CONFIG=${llvm_7.dev}/bin/llvm-config"
"RUSTC_TARGET=${rust.toRustTarget stdenv.targetPlatform}"
];
diff --git a/pkgs/development/compilers/rust/1_45.nix b/pkgs/development/compilers/rust/1_45.nix
index 13b1b3ef488c..f499fc9e9b08 100644
--- a/pkgs/development/compilers/rust/1_45.nix
+++ b/pkgs/development/compilers/rust/1_45.nix
@@ -20,9 +20,9 @@ import ./default.nix {
rustcVersion = "1.45.2";
rustcSha256 = "0273a1g3f59plyi1n0azf21qjzwml1yqdnj5z472crz37qggr8xp";
- llvmSharedForBuild = pkgsBuildBuild.llvm_10.override { enableSharedLibraries = true; };
- llvmSharedForHost = pkgsBuildHost.llvm_10.override { enableSharedLibraries = true; };
- llvmSharedForTarget = pkgsBuildTarget.llvm_10.override { enableSharedLibraries = true; };
+ llvmSharedForBuild = pkgsBuildBuild.llvmPackages_10.libllvm.override { enableSharedLibraries = true; };
+ llvmSharedForHost = pkgsBuildHost.llvmPackages_10.libllvm.override { enableSharedLibraries = true; };
+ llvmSharedForTarget = pkgsBuildTarget.llvmPackages_10.libllvm.override { enableSharedLibraries = true; };
llvmBootstrapForDarwin = llvmPackages_5;
diff --git a/pkgs/development/compilers/rust/1_51.nix b/pkgs/development/compilers/rust/1_51.nix
index a489df471a8c..17fafa4c7cb0 100644
--- a/pkgs/development/compilers/rust/1_51.nix
+++ b/pkgs/development/compilers/rust/1_51.nix
@@ -22,9 +22,9 @@ import ./default.nix {
rustcVersion = "1.51.0";
rustcSha256 = "0ixqkqglv3isxbvl4ldr4byrkx692wghsz3fasy1pn5kr2prnsvs";
- llvmSharedForBuild = pkgsBuildBuild.llvm_11.override { enableSharedLibraries = true; };
- llvmSharedForHost = pkgsBuildHost.llvm_11.override { enableSharedLibraries = true; };
- llvmSharedForTarget = pkgsBuildTarget.llvm_11.override { enableSharedLibraries = true; };
+ llvmSharedForBuild = pkgsBuildBuild.llvmPackages_11.libllvm.override { enableSharedLibraries = true; };
+ llvmSharedForHost = pkgsBuildHost.llvmPackages_11.libllvm.override { enableSharedLibraries = true; };
+ llvmSharedForTarget = pkgsBuildTarget.llvmPackages_11.libllvm.override { enableSharedLibraries = true; };
llvmBootstrapForDarwin = llvmPackages_11;
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index 315fe7c0c6d1..b9bccf9f16e9 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -88,9 +88,9 @@ in stdenv.mkDerivation rec {
"${setTarget}.cxx=${cxxForTarget}"
] ++ optionals (!withBundledLLVM) [
"--enable-llvm-link-shared"
- "${setBuild}.llvm-config=${llvmSharedForBuild}/bin/llvm-config"
- "${setHost}.llvm-config=${llvmSharedForHost}/bin/llvm-config"
- "${setTarget}.llvm-config=${llvmSharedForTarget}/bin/llvm-config"
+ "${setBuild}.llvm-config=${llvmSharedForBuild.dev}/bin/llvm-config"
+ "${setHost}.llvm-config=${llvmSharedForHost.dev}/bin/llvm-config"
+ "${setTarget}.llvm-config=${llvmSharedForTarget.dev}/bin/llvm-config"
] ++ optionals (stdenv.isLinux && !stdenv.targetPlatform.isRedox) [
"--enable-profiler" # build libprofiler_builtins
] ++ optionals stdenv.buildPlatform.isMusl [
diff --git a/pkgs/development/compilers/spirv-llvm-translator/default.nix b/pkgs/development/compilers/spirv-llvm-translator/default.nix
index 324e0b07ad87..e4549a7d65d7 100644
--- a/pkgs/development/compilers/spirv-llvm-translator/default.nix
+++ b/pkgs/development/compilers/spirv-llvm-translator/default.nix
@@ -1,6 +1,7 @@
{ lib, stdenv
, fetchFromGitHub
, cmake
+, pkg-config
, lit
, llvm_8
@@ -17,7 +18,7 @@ stdenv.mkDerivation rec {
sha256 = "0hxalc3fkliqs61hpr97phbm3qsx4b8vgnlg30aimzr6aas403r5";
};
- nativeBuildInputs = [ cmake ];
+ nativeBuildInputs = [ pkg-config cmake llvm_8.dev ];
buildInputs = [ llvm_8 ];
diff --git a/pkgs/development/compilers/zig/default.nix b/pkgs/development/compilers/zig/default.nix
index 41e63d63dbeb..399cb62ba3d7 100644
--- a/pkgs/development/compilers/zig/default.nix
+++ b/pkgs/development/compilers/zig/default.nix
@@ -19,13 +19,13 @@ llvmPackages.stdenv.mkDerivation rec {
};
nativeBuildInputs = [
- cmake
+ cmake llvmPackages.llvm.dev
];
buildInputs = [
libxml2
zlib
] ++ (with llvmPackages; [
- clang-unwrapped
+ libclang
lld
llvm
]);
diff --git a/pkgs/development/interpreters/cling/default.nix b/pkgs/development/interpreters/cling/default.nix
index dbc2751e7899..73ed5b523dde 100644
--- a/pkgs/development/interpreters/cling/default.nix
+++ b/pkgs/development/interpreters/cling/default.nix
@@ -10,6 +10,7 @@
, runCommandNoCC
, llvmPackages_5
, glibc
+, ncurses
}:
let
@@ -38,8 +39,8 @@ let
chmod -R a+w ./tools/cling
'';
- nativeBuildInputs = [ python3 git cmake ];
- buildInputs = [ libffi llvmPackages_5.llvm zlib ];
+ nativeBuildInputs = [ python3 git cmake llvmPackages_5.llvm.dev ];
+ buildInputs = [ libffi llvmPackages_5.llvm zlib ncurses ];
strictDeps = true;
@@ -76,8 +77,8 @@ let
"-nostdinc"
"-nostdinc++"
"-isystem" "${lib.getDev stdenv.cc.libc}/include"
- "-I" "${unwrapped}/include"
- "-I" "${unwrapped}/lib/clang/5.0.2/include"
+ "-I" "${lib.getDev unwrapped}/include"
+ "-I" "${lib.getLib unwrapped}/lib/clang/5.0.2/include"
];
# Autodetect the include paths for the compiler used to build Cling, in the same way Cling does at
diff --git a/pkgs/development/interpreters/jruby/default.nix b/pkgs/development/interpreters/jruby/default.nix
index be1a1a15c84e..4e540dc8aacb 100644
--- a/pkgs/development/interpreters/jruby/default.nix
+++ b/pkgs/development/interpreters/jruby/default.nix
@@ -6,11 +6,11 @@ rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "5" "7" "";
jruby = stdenv.mkDerivation rec {
pname = "jruby";
- version = "9.2.16.0";
+ version = "9.2.17.0";
src = fetchurl {
url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz";
- sha256 = "sha256-WuJ/FJ9z8/6k80NZy7dzwl2dmH5yte3snouTlXmX6zA=";
+ sha256 = "sha256-dwHTU3s6YG0nZaxtXEDmdd2qAdPOutJqIaZuOq3VwgI=";
};
nativeBuildInputs = [ makeWrapper ];
diff --git a/pkgs/development/interpreters/lua-5/default.nix b/pkgs/development/interpreters/lua-5/default.nix
index 43ed70fee1db..95b593fb5dbb 100644
--- a/pkgs/development/interpreters/lua-5/default.nix
+++ b/pkgs/development/interpreters/lua-5/default.nix
@@ -1,27 +1,12 @@
# similar to interpreters/python/default.nix
{ stdenv, lib, callPackage, fetchurl, fetchpatch }:
-let
- dsoPatch51 = fetchurl {
- url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/lua-arch.patch?h=packages/lua51";
- sha256 = "11fcyb4q55p4p7kdb8yp85xlw8imy14kzamp2khvcyxss4vw8ipw";
- name = "lua-arch.patch";
- };
- dsoPatch52 = fetchurl {
- url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/liblua.so.patch?h=packages/lua52";
- sha256 = "1by1dy4ql61f5c6njq9ibf9kaqm3y633g2q8j54iyjr4cxvqwqz9";
- name = "lua-arch.patch";
- };
-
-in rec {
+rec {
lua5_4 = callPackage ./interpreter.nix {
sourceVersion = { major = "5"; minor = "4"; patch = "2"; };
hash = "0ksj5zpj74n0jkamy3di1p6l10v4gjnd2zjnb453qc6px6bhsmqi";
- patches = if stdenv.isDarwin then [ ./5.4.darwin.patch ] else [
- # build lua as a shared library as well, MIT-licensed from
- # https://github.com/archlinux/svntogit-packages/tree/packages/lua/trunk
- ./liblua.so.patch
- ];
+
+ patches = lib.optional stdenv.isDarwin ./5.4.darwin.patch;
};
lua5_4_compat = lua5_4.override({
@@ -35,11 +20,6 @@ in rec {
patches =
lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ];
- postConfigure = lib.optionalString (!stdenv.isDarwin) ''
- cat ${./lua-5.3-dso.make} >> src/Makefile
- sed -e 's/ALL_T *= */& $(LUA_SO)/' -i src/Makefile
- '';
-
postBuild = lib.optionalString (!stdenv.isDarwin) ''
( cd src; make $makeFlags "''${makeFlagsArray[@]}" liblua.so )
'';
@@ -53,7 +33,7 @@ in rec {
lua5_2 = callPackage ./interpreter.nix {
sourceVersion = { major = "5"; minor = "2"; patch = "4"; };
hash = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr";
- patches = if stdenv.isDarwin then [ ./5.2.darwin.patch ] else [ dsoPatch52 ];
+ patches = lib.optional stdenv.isDarwin ./5.2.darwin.patch;
};
lua5_2_compat = lua5_2.override({
@@ -64,7 +44,7 @@ in rec {
lua5_1 = callPackage ./interpreter.nix {
sourceVersion = { major = "5"; minor = "1"; patch = "5"; };
hash = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333";
- patches = (if stdenv.isDarwin then [ ./5.1.darwin.patch ] else [ dsoPatch51 ])
+ patches = (lib.optional stdenv.isDarwin ./5.1.darwin.patch)
++ [ ./CVE-2014-5461.patch ];
};
diff --git a/pkgs/development/interpreters/lua-5/interpreter.nix b/pkgs/development/interpreters/lua-5/interpreter.nix
index 35a074add097..fd8c47d751b3 100644
--- a/pkgs/development/interpreters/lua-5/interpreter.nix
+++ b/pkgs/development/interpreters/lua-5/interpreter.nix
@@ -11,6 +11,15 @@
let
luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;};
+plat = if stdenv.isLinux then "linux"
+ else if stdenv.isDarwin then "macosx"
+ else if stdenv.hostPlatform.isMinGW then "mingw"
+ else if stdenv.isFreeBSD then "freebsd"
+ else if stdenv.isSunOS then "solaris"
+ else if stdenv.hostPlatform.isBSD then "bsd"
+ else if stdenv.hostPlatform.isUnix then "posix"
+ else "generic";
+
self = stdenv.mkDerivation rec {
pname = "lua";
luaversion = with sourceVersion; "${major}.${minor}";
@@ -29,6 +38,14 @@ self = stdenv.mkDerivation rec {
inherit patches;
+ postPatch = lib.optionalString (!stdenv.isDarwin) ''
+ # Add a target for a shared library to the Makefile.
+ sed -e '1s/^/LUA_SO = liblua.so/' \
+ -e 's/ALL_T *= */&$(LUA_SO) /' \
+ -i src/Makefile
+ cat ${./lua-dso.make} >> src/Makefile
+ '';
+
# see configurePhase for additional flags (with space)
makeFlags = [
"INSTALL_TOP=${placeholder "out"}"
@@ -36,21 +53,17 @@ self = stdenv.mkDerivation rec {
"R=${version}"
"LDFLAGS=-fPIC"
"V=${luaversion}"
- ] ++ (if stdenv.isDarwin then [
- "PLAT=macosx"
- ] else [
- "PLAT=linux"
- ]) ++ (if stdenv.buildPlatform != stdenv.hostPlatform then [
- "CC=${stdenv.hostPlatform.config}-gcc"
- "RANLIB=${stdenv.hostPlatform.config}-ranlib"
- ] else [])
- ;
+ "PLAT=${plat}"
+ "CC=${stdenv.cc.targetPrefix}cc"
+ "RANLIB=${stdenv.cc.targetPrefix}ranlib"
+ ];
configurePhase = ''
runHook preConfigure
- makeFlagsArray+=(CFLAGS="-DLUA_USE_LINUX -O2 -fPIC${if compat then " -DLUA_COMPAT_ALL" else ""}" )
- makeFlagsArray+=(${lib.optionalString stdenv.isDarwin "CC=\"$CC\""}${lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) " 'AR=${stdenv.hostPlatform.config}-ar rcu'"})
+ makeFlagsArray+=(CFLAGS='-O2 -fPIC${lib.optionalString compat " -DLUA_COMPAT_ALL"} $(${
+ if lib.versionAtLeast luaversion "5.2" then "SYSCFLAGS" else "MYCFLAGS"})' )
+ makeFlagsArray+=(${lib.optionalString stdenv.isDarwin "CC=\"$CC\""}${lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) " 'AR=${stdenv.cc.targetPrefix}ar rcu'"})
installFlagsArray=( TO_BIN="lua luac" INSTALL_DATA='cp -d' \
TO_LIB="${if stdenv.isDarwin then "liblua.${version}.dylib" else "liblua.a liblua.so liblua.so.${luaversion} liblua.so.${version}"}" )
@@ -80,7 +93,7 @@ self = stdenv.mkDerivation rec {
Description: An Extensible Extension Language
Version: ${version}
Requires:
- Libs: -L$out/lib -llua -lm
+ Libs: -L$out/lib -llua
Cflags: -I$out/include
EOF
ln -s "$out/lib/pkgconfig/lua.pc" "$out/lib/pkgconfig/lua-${luaversion}.pc"
diff --git a/pkgs/development/interpreters/lua-5/liblua.so.patch b/pkgs/development/interpreters/lua-5/liblua.so.patch
deleted file mode 100644
index 197832116c19..000000000000
--- a/pkgs/development/interpreters/lua-5/liblua.so.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-diff --git a/Makefile b/Makefile
-index 416f444..eeaff03 100644
---- a/Makefile
-+++ b/Makefile
-@@ -52,7 +52,7 @@ R= $V.0
- all: $(PLAT)
-
- $(PLATS) help test clean:
-- @cd src && $(MAKE) $@
-+ @cd src && $(MAKE) $@ V=$(V) R=$(R)
-
- install: dummy
- cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
-diff --git a/src/Makefile b/src/Makefile
-index 514593d..372a6dc 100644
---- a/src/Makefile
-+++ b/src/Makefile
-@@ -33,6 +33,7 @@ CMCFLAGS= -Os
- PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
-
- LUA_A= liblua.a
-+LUA_SO= liblua.so
- CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
- LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
- BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
-@@ -44,7 +45,7 @@ LUAC_T= luac
- LUAC_O= luac.o
-
- ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
--ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
-+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
- ALL_A= $(LUA_A)
-
- # Targets start here.
-@@ -60,6 +61,12 @@ $(LUA_A): $(BASE_O)
- $(AR) $@ $(BASE_O)
- $(RANLIB) $@
-
-+$(LUA_SO): $(CORE_O) $(LIB_O)
-+ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
-+ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
-+ ln -sf $(LUA_SO).$(R) $(LUA_SO)
-+
-+
- $(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
-
-diff --git a/src/luaconf.h b/src/luaconf.h
-index bdf927e..7e15198 100644
---- a/src/luaconf.h
-+++ b/src/luaconf.h
-@@ -227,7 +227,7 @@
-
- #else /* }{ */
-
--#define LUA_ROOT "/usr/local/"
-+#define LUA_ROOT "/usr/"
- #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
- #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
-
diff --git a/pkgs/development/interpreters/lua-5/lua-5.3-dso.make b/pkgs/development/interpreters/lua-5/lua-dso.make
similarity index 50%
rename from pkgs/development/interpreters/lua-5/lua-5.3-dso.make
rename to pkgs/development/interpreters/lua-5/lua-dso.make
index c70dbc4f9cc2..19c57685677d 100644
--- a/pkgs/development/interpreters/lua-5/lua-5.3-dso.make
+++ b/pkgs/development/interpreters/lua-5/lua-dso.make
@@ -1,8 +1,4 @@
-
-LUA_SO=liblua.so
-
$(LUA_SO): $(CORE_O) $(LIB_O)
- $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+ $(CC) -shared $(LIBS) -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? $(MYLDFLAGS)
ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
ln -sf $(LUA_SO).$(R) $(LUA_SO)
-
diff --git a/pkgs/development/interpreters/pure/default.nix b/pkgs/development/interpreters/pure/default.nix
index 863df66899b1..d1c03bba5a31 100644
--- a/pkgs/development/interpreters/pure/default.nix
+++ b/pkgs/development/interpreters/pure/default.nix
@@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl, makeWrapper,
- llvm, gmp, mpfr, readline, bison, flex }:
+ libllvm, gmp, mpfr, readline, bison, flex }:
stdenv.mkDerivation rec {
baseName="pure";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ bison flex ];
- propagatedBuildInputs = [ llvm gmp mpfr readline ];
+ propagatedBuildInputs = [ libllvm gmp mpfr readline ];
NIX_LDFLAGS = "-lLLVMJIT";
postPatch = ''
@@ -25,10 +25,10 @@ stdenv.mkDerivation rec {
configureFlags = [ "--enable-release" ];
doCheck = true;
checkPhase = ''
- LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${llvm}/lib make check
+ LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${libllvm}/lib make check
'';
postInstall = ''
- wrapProgram $out/bin/pure --prefix LD_LIBRARY_PATH : ${llvm}/lib
+ wrapProgram $out/bin/pure --prefix LD_LIBRARY_PATH : ${libllvm}/lib
'';
meta = {
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 4b185f038a17..9179866fe9e3 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -12,7 +12,7 @@ let
opString = lib.optionalString;
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
config = import ./config.nix { inherit fetchFromSavannah; };
- rubygems = import ./rubygems { inherit stdenv lib fetchurl fetchpatch; };
+ rubygems = import ./rubygems { inherit stdenv lib fetchurl; };
# Contains the ruby version heuristics
rubyVersion = import ./ruby-version.nix { inherit lib; };
@@ -55,13 +55,7 @@ let
# Or (usually):
# $(nix-build -A ruby)/lib/ruby/2.6.0/x86_64-linux/rbconfig.rb
# - In $out/lib/libruby.so and/or $out/lib/libruby.dylib
- #
- # Since some Gems require JIT support, there's probably no
- # escape from this reference. Hence, it was decided to enable this
- # feature by default, as it's enabled by default by ruby's ./configure
- # script. If you'd like to have a ruby without reference to cc, setting
- # jitSupport to false should remove all known references mentioned above.
- , removeReferencesTo, jitSupport ? true
+ , removeReferencesTo, jitSupport ? false
, autoreconfHook, bison, autoconf
, buildEnv, bundler, bundix
, libiconv, libobjc, libunwind, Foundation
@@ -112,7 +106,17 @@ let
patchLevel = ver.patchLevel;
}).${ver.majMinTiny}
++ op atLeast27 ./do-not-regenerate-revision.h.patch
- ++ op (atLeast30 && useRailsExpress) ./do-not-update-gems-baseruby.patch;
+ ++ op (atLeast30 && useRailsExpress) ./do-not-update-gems-baseruby.patch
+ # Ruby prior to 3.0 has a bug the installer (tools/rbinstall.rb) but
+ # the resulting error was swallowed. Newer rubygems no longer swallows
+ # this error. We upgrade rubygems when rubygemsSupport is enabled, so
+ # we have to fix this bug to prevent the install step from failing.
+ # See https://github.com/ruby/ruby/pull/2930
+ ++ op (!atLeast30 && rubygemsSupport)
+ (fetchpatch {
+ url = "https://github.com/ruby/ruby/commit/261d8dd20afd26feb05f00a560abd99227269c1c.patch";
+ sha256 = "0wrii25cxcz2v8bgkrf7ibcanjlxwclzhayin578bf0qydxdm9qy";
+ });
postUnpack = opString rubygemsSupport ''
rm -rf $sourceRoot/{lib,test}/rubygems*
@@ -167,8 +171,9 @@ let
installFlags = lib.optional docSupport "install-doc";
# Bundler tries to create this directory
postInstall = ''
+ rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
# Remove unnecessary groff reference from runtime closure, since it's big
- sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb
+ sed -i '/NROFF/d' $rbConfig
${
lib.optionalString (!jitSupport) ''
# Get rid of the CC runtime dependency
@@ -177,7 +182,8 @@ let
$out/lib/libruby*
${removeReferencesTo}/bin/remove-references-to \
-t ${stdenv.cc} \
- $out/${passthru.libPath}/${stdenv.hostPlatform.system}/rbconfig.rb
+ $rbConfig
+ sed -i '/CC_VERSION_MESSAGE/d' $rbConfig
''
}
# Bundler tries to create this directory
@@ -195,8 +201,6 @@ let
addEnvHooks "$hostOffset" addGemPath
addEnvHooks "$hostOffset" addRubyLibPath
EOF
-
- rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
'' + opString docSupport ''
# Prevent the docs from being included in the closure
sed -i "s|\$(DESTDIR)$devdoc|\$(datarootdir)/\$(RI_BASE_NAME)|" $rbConfig
diff --git a/pkgs/development/interpreters/ruby/rubygems/default.nix b/pkgs/development/interpreters/ruby/rubygems/default.nix
index 19eed817ec29..db508caae310 100644
--- a/pkgs/development/interpreters/ruby/rubygems/default.nix
+++ b/pkgs/development/interpreters/ruby/rubygems/default.nix
@@ -1,23 +1,18 @@
-{ stdenv, lib, fetchurl, fetchpatch }:
+{ stdenv, lib, fetchurl }:
stdenv.mkDerivation rec {
name = "rubygems";
- version = "3.1.3";
+ version = "3.2.16";
src = fetchurl {
url = "https://rubygems.org/rubygems/rubygems-${version}.tgz";
- sha256 = "181wjclxnq5lrwnr53famy9pg8911hi9w2v0vy7dqgjqnc4iy1hp";
+ sha256 = "1bpn45hchcbirqvqwxcxyk1xy2xkdd915jci2hfjq4y6zc4idns0";
};
patches = [
./0001-add-post-extract-hook.patch
./0002-binaries-with-env-shebang.patch
./0003-gem-install-default-to-user.patch
-
- (fetchpatch {
- url = "https://github.com/rubygems/rubygems/commit/0af4d2d369ff580ef54839ec15a8c7ec419978cb.patch";
- sha256 = "13gyfxn4rmxq1dbxq5rzphnhagn8n8kpp8lb9h6h4s9d4zaklax9";
- })
];
installPhase = ''
diff --git a/pkgs/development/interpreters/spidermonkey/68.nix b/pkgs/development/interpreters/spidermonkey/68.nix
index 0ac005b07dea..f867e606140f 100644
--- a/pkgs/development/interpreters/spidermonkey/68.nix
+++ b/pkgs/development/interpreters/spidermonkey/68.nix
@@ -55,7 +55,7 @@ in stdenv.mkDerivation rec {
"--with-system-zlib"
"--with-system-icu"
- "--with-libclang-path=${llvmPackages.libclang}/lib"
+ "--with-libclang-path=${llvmPackages.libclang.lib}/lib"
"--with-clang-path=${llvmPackages.clang}/bin/clang"
"--enable-shared-js"
diff --git a/pkgs/development/interpreters/wasmer/default.nix b/pkgs/development/interpreters/wasmer/default.nix
index 8077177d8b8f..eb17fda08301 100644
--- a/pkgs/development/interpreters/wasmer/default.nix
+++ b/pkgs/development/interpreters/wasmer/default.nix
@@ -35,7 +35,7 @@ rustPlatform.buildRustPackage rec {
"--features" "test-cranelift,test-jit"
];
- LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
meta = with lib; {
description = "The Universal WebAssembly Runtime";
diff --git a/pkgs/development/interpreters/wasmtime/default.nix b/pkgs/development/interpreters/wasmtime/default.nix
index 3d13dddb6425..9afca8f1f714 100644
--- a/pkgs/development/interpreters/wasmtime/default.nix
+++ b/pkgs/development/interpreters/wasmtime/default.nix
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [ python cmake clang ];
buildInputs = [ llvmPackages.libclang ] ++
lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
- LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
doCheck = true;
diff --git a/pkgs/development/libraries/SDL2_image/default.nix b/pkgs/development/libraries/SDL2_image/default.nix
index 96f85ddb0ea5..a0f770178cc9 100644
--- a/pkgs/development/libraries/SDL2_image/default.nix
+++ b/pkgs/development/libraries/SDL2_image/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, SDL2, libpng, libjpeg, libtiff, libungif, libwebp, libXpm, zlib, Foundation }:
+{ lib, stdenv, fetchurl, SDL2, libpng, libjpeg, libtiff, giflib, libwebp, libXpm, zlib, Foundation }:
stdenv.mkDerivation rec {
pname = "SDL2_image";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "1l0864kas9cwpp2d32yxl81g98lx40dhbdp03dz7sbv84vhgdmdx";
};
- buildInputs = [ SDL2 libpng libjpeg libtiff libungif libwebp libXpm zlib ]
+ buildInputs = [ SDL2 libpng libjpeg libtiff giflib libwebp libXpm zlib ]
++ lib.optional stdenv.isDarwin Foundation;
diff --git a/pkgs/development/libraries/SDL_image/default.nix b/pkgs/development/libraries/SDL_image/default.nix
index 2e5841b3f482..fe97f0167439 100644
--- a/pkgs/development/libraries/SDL_image/default.nix
+++ b/pkgs/development/libraries/SDL_image/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, fetchpatch, SDL, libpng, libjpeg, libtiff, libungif, libXpm }:
+{ lib, stdenv, fetchurl, fetchpatch, SDL, libpng, libjpeg, libtiff, giflib, libXpm }:
stdenv.mkDerivation rec {
pname = "SDL_image";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
"--disable-tif-shared"
] ++ lib.optional stdenv.isDarwin "--disable-sdltest";
- buildInputs = [ SDL libpng libjpeg libtiff libungif libXpm ];
+ buildInputs = [ SDL libpng libjpeg libtiff giflib libXpm ];
meta = with lib; {
description = "SDL image library";
diff --git a/pkgs/development/libraries/bctoolbox/default.nix b/pkgs/development/libraries/bctoolbox/default.nix
index 1d8f35cd01c0..c482b55c60b9 100644
--- a/pkgs/development/libraries/bctoolbox/default.nix
+++ b/pkgs/development/libraries/bctoolbox/default.nix
@@ -7,7 +7,7 @@
stdenv.mkDerivation rec {
pname = "bctoolbox";
- version = "4.5.7";
+ version = "4.5.15";
nativeBuildInputs = [ cmake bcunit ];
buildInputs = [ mbedtls ];
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
group = "BC";
repo = pname;
rev = version;
- sha256 = "sha256-JQ2HgFVqgO+LLXmN95ZTHyT+htCFUC3VRreKLwPYo9Y=";
+ sha256 = "sha256-yN9dfeJBuUxXfG7zDoawn2nKGsrhetBcXpGDmcekU20=";
};
# Do not build static libraries
diff --git a/pkgs/development/libraries/beignet/default.nix b/pkgs/development/libraries/beignet/default.nix
index 8e8e455e59a6..3d88c93784a8 100644
--- a/pkgs/development/libraries/beignet/default.nix
+++ b/pkgs/development/libraries/beignet/default.nix
@@ -2,8 +2,8 @@
, fetchFromGitHub
, cmake
, pkg-config
-, clang-unwrapped
-, llvm
+, libclang
+, libllvm
, libdrm
, libX11
, libpthreadstubs
@@ -35,11 +35,11 @@ stdenv.mkDerivation rec {
patchShebangs src/git_sha1.sh
'';
- cmakeFlags = [ "-DCLANG_LIBRARY_DIR=${clang-unwrapped}/lib" ];
+ cmakeFlags = [ "-DCLANG_LIBRARY_DIR=${libclang.lib}/lib" ];
buildInputs = [
- llvm
- clang-unwrapped
+ libllvm
+ libclang
libX11
libXext
libpthreadstubs
diff --git a/pkgs/development/libraries/ffmpeg-full/default.nix b/pkgs/development/libraries/ffmpeg-full/default.nix
index d861d25e67a7..e9c9f2fdf6a1 100644
--- a/pkgs/development/libraries/ffmpeg-full/default.nix
+++ b/pkgs/development/libraries/ffmpeg-full/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, ffmpeg, addOpenGLRunpath, fetchurl, fetchpatch, pkg-config, perl, texinfo, yasm
+{ lib, stdenv, ffmpeg, addOpenGLRunpath, pkg-config, perl, texinfo, yasm
/*
* Licensing options (yes some are listed twice, filters and such are not listed)
*/
@@ -126,13 +126,14 @@
, vid-stab ? null # Video stabilization
#, vo-aacenc ? null # AAC encoder
, vo-amrwbenc ? null # AMR-WB encoder
-, wavpack ? null # Wavpack encoder
, x264 ? null # H.264/AVC encoder
, x265 ? null # H.265/HEVC encoder
, xavs ? null # AVS encoder
, xvidcore ? null # Xvid encoder, native encoder exists
, zeromq4 ? null # Message passing
, zlib ? null
+, vulkan-loader ? null
+, glslang ? null
#, zvbi ? null # Teletext support
/*
* Developer options
@@ -244,15 +245,6 @@ stdenv.mkDerivation rec {
pname = "ffmpeg-full";
inherit (ffmpeg) src version;
- # this should go away in the next release
- patches = [
- # Patch ffmpeg for svt-av1 until version 4.4
- (fetchpatch {
- url = "https://raw.githubusercontent.com/AOMediaCodec/SVT-AV1/v0.8.4/ffmpeg_plugin/0001-Add-ability-for-ffmpeg-to-run-svt-av1.patch";
- sha256 = "1p4g8skr5gjw5h1648j7qrks81zx49lrnx9g0p81qgnrvxc2wwx0";
- })
- ];
-
prePatch = ''
patchShebangs .
'' + lib.optionalString stdenv.isDarwin ''
@@ -405,13 +397,14 @@ stdenv.mkDerivation rec {
(enableFeature (vid-stab != null && gplLicensing) "libvidstab") # Actual min. version 2.0
#(enableFeature (vo-aacenc != null && version3Licensing) "libvo-aacenc")
(enableFeature (vo-amrwbenc != null && version3Licensing) "libvo-amrwbenc")
- (enableFeature (wavpack != null) "libwavpack")
(enableFeature (x264 != null && gplLicensing) "libx264")
(enableFeature (x265 != null && gplLicensing) "libx265")
(enableFeature (xavs != null && gplLicensing) "libxavs")
(enableFeature (xvidcore != null && gplLicensing) "libxvid")
(enableFeature (zeromq4 != null) "libzmq")
(enableFeature (zlib != null) "zlib")
+ (enableFeature (isLinux && vulkan-loader != null) "vulkan")
+ (enableFeature (glslang != null) "libglslang")
#(enableFeature (zvbi != null && gplLicensing) "libzvbi")
/*
* Developer flags
@@ -432,13 +425,13 @@ stdenv.mkDerivation rec {
libjack2 ladspaH lame libaom libass libbluray libbs2b libcaca libdc1394 libmodplug libmysofa
libogg libopus librsvg libssh libtheora libvdpau libvorbis libvpx libwebp libX11
libxcb libXv libXext xz openal openjpeg libpulseaudio rav1e svt-av1 rtmpdump opencore-amr
- samba SDL2 soxr speex srt vid-stab vo-amrwbenc wavpack x264 x265 xavs xvidcore
- zeromq4 zlib
+ samba SDL2 soxr speex srt vid-stab vo-amrwbenc x264 x265 xavs xvidcore
+ zeromq4 zlib glslang
] ++ optionals openglExtlib [ libGL libGLU ]
++ optionals nonfreeLicensing [ fdk_aac openssl ]
++ optional ((isLinux || isFreeBSD) && libva != null) libva
++ optional (!isAarch64 && libvmaf != null && version3Licensing) libvmaf
- ++ optionals isLinux [ alsaLib libraw1394 libv4l ]
+ ++ optionals isLinux [ alsaLib libraw1394 libv4l vulkan-loader ]
++ optional (isLinux && !isAarch64 && libmfx != null) libmfx
++ optional nvenc nv-codec-headers
++ optionals stdenv.isDarwin [ Cocoa CoreServices CoreAudio AVFoundation
@@ -465,6 +458,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "A complete, cross-platform solution to record, convert and stream audio and video";
homepage = "https://www.ffmpeg.org/";
+ changelog = "https://github.com/FFmpeg/FFmpeg/blob/n${version}/Changelog";
longDescription = ''
FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
mux, demux, stream, filter and play pretty much anything that humans and machines
diff --git a/pkgs/development/libraries/ffmpeg/3.4.nix b/pkgs/development/libraries/ffmpeg/3.4.nix
index be341d588c1d..a5140fa01ca0 100644
--- a/pkgs/development/libraries/ffmpeg/3.4.nix
+++ b/pkgs/development/libraries/ffmpeg/3.4.nix
@@ -1,4 +1,4 @@
-{ callPackage, fetchpatch
+{ callPackage
# Darwin frameworks
, Cocoa, CoreMedia
, ...
diff --git a/pkgs/development/libraries/ffmpeg/4.nix b/pkgs/development/libraries/ffmpeg/4.nix
index 95207b5386f8..df3d0732393e 100644
--- a/pkgs/development/libraries/ffmpeg/4.nix
+++ b/pkgs/development/libraries/ffmpeg/4.nix
@@ -1,12 +1,17 @@
-{ callPackage, fetchpatch
+{ callPackage
# Darwin frameworks
, Cocoa, CoreMedia, VideoToolbox
+, stdenv, lib
, ...
}@args:
callPackage ./generic.nix (rec {
- version = "4.3.2";
- branch = "4.3";
- sha256 = "0flik4y7c5kchj65p3p908mk1dsncqgzjdvzysjs12rmf1m6sfmb";
+ version = "4.4";
+ branch = "4.4";
+ sha256 = "03kxc29y8190k4y8s8qdpsghlbpmchv1m8iqygq2qn0vfm4ka2a2";
darwinFrameworks = [ Cocoa CoreMedia VideoToolbox ];
+
+ /* Work around https://trac.ffmpeg.org/ticket/9242 */
+ patches = lib.optional stdenv.isDarwin
+ ./v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch;
} // args)
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index ca77e425904f..7e4a6a080987 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -213,7 +213,8 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "A complete, cross-platform solution to record, convert and stream audio and video";
- homepage = "http://www.ffmpeg.org/";
+ homepage = "https://www.ffmpeg.org/";
+ changelog = "https://github.com/FFmpeg/FFmpeg/blob/n${version}/Changelog";
longDescription = ''
FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
mux, demux, stream, filter and play pretty much anything that humans and machines
diff --git a/pkgs/development/libraries/ffmpeg/v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch b/pkgs/development/libraries/ffmpeg/v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch
new file mode 100644
index 000000000000..c0c2c1fb23bb
--- /dev/null
+++ b/pkgs/development/libraries/ffmpeg/v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch
@@ -0,0 +1,35 @@
+From 5b562aaddbc6e7a94a079c2e88230b205a7f4d73 Mon Sep 17 00:00:00 2001
+From: Zane van Iperen
+Date: Sat, 15 May 2021 19:33:52 +1000
+Subject: [PATCH v2] avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if
+ not provided by the SDK
+
+Fixes build failure on older SDKs without it.
+
+Fixes #9242
+
+Signed-off-by: Zane van Iperen
+---
+ libavcodec/videotoolboxenc.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+NB: This is untested, I do not have a Mac to try it on.
+
+diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
+index 58239e0ab9..f063a86e73 100644
+--- a/libavcodec/videotoolboxenc.c
++++ b/libavcodec/videotoolboxenc.c
+@@ -50,6 +50,10 @@ enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20' };
+ enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' };
+ #endif
+
++#ifndef TARGET_CPU_ARM64
++# define TARGET_CPU_ARM64 0
++#endif
++
+ typedef OSStatus (*getParameterSetAtIndex)(CMFormatDescriptionRef videoDesc,
+ size_t parameterSetIndex,
+ const uint8_t **parameterSetPointerOut,
+--
+2.29.3
+
diff --git a/pkgs/development/libraries/giflib/libungif.nix b/pkgs/development/libraries/giflib/libungif.nix
deleted file mode 100644
index d8c32d14fca2..000000000000
--- a/pkgs/development/libraries/giflib/libungif.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{lib, stdenv, fetchurl}:
-
-stdenv.mkDerivation {
- name = "libungif-4.1.4";
- src = fetchurl {
- url = "mirror://sourceforge/giflib/libungif-4.1.4.tar.gz";
- sha256 = "5e65e1e5deacd0cde489900dbf54c6c2ee2ebc818199e720dbad685d87abda3d";
- };
-
- hardeningDisable = [ "format" ];
-
- meta = with lib; {
- description = "Library and utilities for processing GIFs";
- platforms = platforms.unix;
- license = licenses.mit;
- };
-}
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 170cddf3100c..08f7c9a4c780 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -92,13 +92,23 @@ stdenv.mkDerivation rec {
buildInputs = [
libelf setupHook pcre
bash gnum4 # install glib-gettextize and m4 macros for other apps to use
- gtk-doc
] ++ optionals stdenv.isLinux [
libselinux
util-linuxMinimal # for libmount
] ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
AppKit Carbon Cocoa CoreFoundation CoreServices Foundation
- ]);
+ ]) ++ optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
+ # Note: this needs to be both in buildInputs and nativeBuildInputs. The
+ # Meson gtkdoc module uses find_program to look it up (-> build dep), but
+ # glib's own Meson configuration uses the host pkg-config to find its
+ # version (-> host dep). We could technically go and fix this in glib, add
+ # pkg-config to depsBuildBuild, but this would be a futile exercise since
+ # Meson's gtkdoc integration does not support cross compilation[1] anyway
+ # and this derivation disables the docs build when cross compiling.
+ #
+ # [1] https://github.com/mesonbuild/meson/issues/2003
+ gtk-doc
+ ];
strictDeps = true;
diff --git a/pkgs/development/libraries/glibc/2.32-master.patch.gz b/pkgs/development/libraries/glibc/2.32-master.patch.gz
index bcf4d13443cf..2fda4294130a 100644
Binary files a/pkgs/development/libraries/glibc/2.32-master.patch.gz and b/pkgs/development/libraries/glibc/2.32-master.patch.gz differ
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index 7a83ffd36d74..0108214a56ee 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -42,7 +42,7 @@
let
version = "2.32";
- patchSuffix = "-40";
+ patchSuffix = "-46";
sha256 = "0di848ibffrnwq7g2dvgqrnn4xqhj3h96csn69q4da51ymafl9qn";
in
@@ -61,7 +61,7 @@ stdenv.mkDerivation ({
[
/* No tarballs for stable upstream branch, only https://sourceware.org/git/glibc.git and using git would complicate bootstrapping.
$ git fetch --all -p && git checkout origin/release/2.32/master && git describe
- glibc-2.32-40-g778b8d3786
+ glibc-2.32-46-g1799ac8eab
$ git show --minimal --reverse glibc-2.32.. | gzip -9n --rsyncable - > 2.32-master.patch.gz
To compare the archive contents zdiff can be used.
diff --git a/pkgs/development/libraries/gstreamer/base/default.nix b/pkgs/development/libraries/gstreamer/base/default.nix
index 4f392622065b..7e9095ef0ede 100644
--- a/pkgs/development/libraries/gstreamer/base/default.nix
+++ b/pkgs/development/libraries/gstreamer/base/default.nix
@@ -41,13 +41,13 @@
stdenv.mkDerivation rec {
pname = "gst-plugins-base";
- version = "1.18.2";
+ version = "1.18.4";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "1b05kg46azrxxvq42c71071lfsnc34pw4vynnkczdqi6g0gzn16x";
+ sha256 = "08w3ivbc6n4vdds2ap6q7l8zdk9if8417nznyqidf0adm0lk5r99";
};
patches = [
diff --git a/pkgs/development/libraries/gstreamer/core/default.nix b/pkgs/development/libraries/gstreamer/core/default.nix
index 84badf304108..2d43a02725f9 100644
--- a/pkgs/development/libraries/gstreamer/core/default.nix
+++ b/pkgs/development/libraries/gstreamer/core/default.nix
@@ -21,7 +21,7 @@
stdenv.mkDerivation rec {
pname = "gstreamer";
- version = "1.18.2";
+ version = "1.18.4";
outputs = [
"out"
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "0ijlmvr660m8zn09xlmnq1ajrziqsivp2hig5a9mabhcjx7ypkb6";
+ sha256 = "1igv9l4hm21kp1jmlwlagzs7ly1vaxv1sbda29q8247372dwkvls";
};
patches = [
diff --git a/pkgs/development/libraries/gstreamer/devtools/default.nix b/pkgs/development/libraries/gstreamer/devtools/default.nix
index a39eadafb0b7..517fe9b302d3 100644
--- a/pkgs/development/libraries/gstreamer/devtools/default.nix
+++ b/pkgs/development/libraries/gstreamer/devtools/default.nix
@@ -12,11 +12,11 @@
stdenv.mkDerivation rec {
pname = "gst-devtools";
- version = "1.18.2";
+ version = "1.18.4";
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "0mhascwvgirgh7b5dykpnk06f7f5g62gh3sl30i6kygiidqkv9vf";
+ sha256 = "1kvcabcfzm7wqih3lzgrg9xjbn4xpx43d1m2zkkvab4i8161kggz";
};
patches = [
diff --git a/pkgs/development/libraries/gstreamer/ges/default.nix b/pkgs/development/libraries/gstreamer/ges/default.nix
index 774fefbc3584..6ada053ea012 100644
--- a/pkgs/development/libraries/gstreamer/ges/default.nix
+++ b/pkgs/development/libraries/gstreamer/ges/default.nix
@@ -16,7 +16,7 @@
stdenv.mkDerivation rec {
pname = "gst-editing-services";
- version = "1.18.2";
+ version = "1.18.4";
outputs = [
"out"
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "0pv2k8zlpn3vv2sdlspi3m63ixcwzi90pjly2ypbkg59ab97rb15";
+ sha256 = "010xg960qsh5dwmf0y9l1q13h0cymmrgapzla2zsw66ylxqbi1s6";
};
patches = [
diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix
index b08759b8dba1..86684893efd3 100644
--- a/pkgs/development/libraries/gstreamer/good/default.nix
+++ b/pkgs/development/libraries/gstreamer/good/default.nix
@@ -48,13 +48,13 @@ assert raspiCameraSupport -> (stdenv.isLinux && stdenv.isAarch64);
stdenv.mkDerivation rec {
pname = "gst-plugins-good";
- version = "1.18.2";
+ version = "1.18.4";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "1929nhjsvbl4bw37nfagnfsnxz737cm2x3ayz9ayrn9lwkfm45zp";
+ sha256 = "1c1rpq709cy8maaykyn1n0kckj9c6fl3mhvixkk6xmdwkcx0xrdn";
};
nativeBuildInputs = [
diff --git a/pkgs/development/libraries/gstreamer/libav/default.nix b/pkgs/development/libraries/gstreamer/libav/default.nix
index f0755f201d48..009a1555f770 100644
--- a/pkgs/development/libraries/gstreamer/libav/default.nix
+++ b/pkgs/development/libraries/gstreamer/libav/default.nix
@@ -15,11 +15,11 @@
stdenv.mkDerivation rec {
pname = "gst-libav";
- version = "1.18.2";
+ version = "1.18.4";
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "0jbzams9ggk3sq9ywv4gsl9rghyn203l2582m6l5c1sz9ka9m5in";
+ sha256 = "15n3x3vhshqa3icw93g4vqmqd46122anzqvfxwn6q8famlxlcjil";
};
outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/gstreamer/rtsp-server/default.nix b/pkgs/development/libraries/gstreamer/rtsp-server/default.nix
index 037face3d128..56596960019b 100644
--- a/pkgs/development/libraries/gstreamer/rtsp-server/default.nix
+++ b/pkgs/development/libraries/gstreamer/rtsp-server/default.nix
@@ -12,11 +12,11 @@
stdenv.mkDerivation rec {
pname = "gst-rtsp-server";
- version = "1.18.2";
+ version = "1.18.4";
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "1qjlp7az0hkzxvq53hwnp55sp6xhbybfwzaj66hp45jslsmj4fcp";
+ sha256 = "153c78klvzlmi86d0gmdf7w9crv11rkd4y82b14a0wdr83gbhsx4";
};
outputs = [
diff --git a/pkgs/development/libraries/gstreamer/ugly/default.nix b/pkgs/development/libraries/gstreamer/ugly/default.nix
index 7c70b7ead1ab..049e8a99f095 100644
--- a/pkgs/development/libraries/gstreamer/ugly/default.nix
+++ b/pkgs/development/libraries/gstreamer/ugly/default.nix
@@ -23,13 +23,13 @@
stdenv.mkDerivation rec {
pname = "gst-plugins-ugly";
- version = "1.18.2";
+ version = "1.18.4";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "1nwbcv5yaib3d8icvyja3zf6lyjf5zf1hndbijrhj8j7xlia0dx3";
+ sha256 = "0g6i4db1883q3j0l2gdv46fcqwiiaw63n6mhvsfcms1i1p7g1391";
};
nativeBuildInputs = [
diff --git a/pkgs/development/libraries/gstreamer/vaapi/default.nix b/pkgs/development/libraries/gstreamer/vaapi/default.nix
index 2c92cd2236ff..19e65c5a75eb 100644
--- a/pkgs/development/libraries/gstreamer/vaapi/default.nix
+++ b/pkgs/development/libraries/gstreamer/vaapi/default.nix
@@ -21,11 +21,11 @@
stdenv.mkDerivation rec {
pname = "gstreamer-vaapi";
- version = "1.18.2";
+ version = "1.18.4";
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
- sha256 = "1h67n7wk1297rzynknbyv44gdacblvkcvb37x8yxi5d0zms2qywc";
+ sha256 = "1sia4l88z7kkxm2z9j20l43rqkrnsa47xccski10s5gkhsprinwj";
};
outputs = [
diff --git a/pkgs/development/libraries/hunspell/dictionaries.nix b/pkgs/development/libraries/hunspell/dictionaries.nix
index 37b567896359..f1bcd4ad00c0 100644
--- a/pkgs/development/libraries/hunspell/dictionaries.nix
+++ b/pkgs/development/libraries/hunspell/dictionaries.nix
@@ -761,11 +761,11 @@ in rec {
da_DK = da-dk;
da-dk = mkDict rec {
name = "hunspell-dict-da-dk-${version}";
- version = "2.5.137";
+ version = "2.5.189";
src = fetchurl {
url = "https://stavekontrolden.dk/dictionaries/da_DK/da_DK-${version}.oxt";
- sha256 = "16y0smkg1mq0133r1fbw5ak6s2xw39281knk5ivhanakayq789qx";
+ sha256 = "sha256:0i1cw0nfg24b0sg2yc3q7315ng5vc5245nvh0l1cndkn2c9z4978";
};
shortName = "da-dk";
diff --git a/pkgs/development/libraries/icu/69.nix b/pkgs/development/libraries/icu/69.nix
new file mode 100644
index 000000000000..8cea41daadb9
--- /dev/null
+++ b/pkgs/development/libraries/icu/69.nix
@@ -0,0 +1,4 @@
+import ./base.nix {
+ version = "69.1";
+ sha256 = "0icps0avkwy5df3wwc5kybxcg63hcgk4phdh9g244g0xrmx7pfjc";
+}
diff --git a/pkgs/development/libraries/imlib/default.nix b/pkgs/development/libraries/imlib/default.nix
index 53612f8205fe..1d6fed2281e7 100644
--- a/pkgs/development/libraries/imlib/default.nix
+++ b/pkgs/development/libraries/imlib/default.nix
@@ -1,4 +1,6 @@
-{lib, stdenv, fetchurl, fetchpatch, libX11, libXext, xorgproto, libjpeg, libungif, libtiff, libpng}:
+{ lib, stdenv, fetchurl, fetchpatch
+, libX11, libXext, xorgproto, libjpeg, giflib, libtiff, libpng
+}:
stdenv.mkDerivation {
name = "imlib-1.9.15";
@@ -13,6 +15,16 @@ stdenv.mkDerivation {
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch";
sha256 = "0lxfibi094gki39sq1w4p0hcx25xlk0875agbhjkjngzx862wvbg";
})
+
+ # The following two patches fix the build with recent giflib.
+ (fetchpatch {
+ url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/imlib/files/imlib-1.9.15-giflib51-1.patch?id=c6d0ed89ad5653421f21cbf3b3d40fd9a1361828";
+ sha256 = "0jynlhxcyjiwnz1m8j48xwz4z5csgyg03jfjc8xgpvvcyid4m65l";
+ })
+ (fetchpatch {
+ url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/imlib/files/imlib-1.9.15-giflib51-2.patch?id=c6d0ed89ad5653421f21cbf3b3d40fd9a1361828";
+ sha256 = "164x7rd992930rqllmr89p5ahfmbz37ipi8x0igd8gkvc8a4fd5x";
+ })
];
configureFlags = [
@@ -21,11 +33,11 @@ stdenv.mkDerivation {
"--x-libraries=${libX11.out}/lib"
];
- buildInputs = [libjpeg libXext libX11 xorgproto libtiff libungif libpng];
+ buildInputs = [ libjpeg libXext libX11 xorgproto libtiff giflib libpng ];
meta = with lib; {
description = "An image loading and rendering library for X11";
platforms = platforms.unix;
- license = with licenses; [ gpl2 lgpl2 ];
+ license = with licenses; [ gpl2Only lgpl2Only ];
};
}
diff --git a/pkgs/development/libraries/json-glib/default.nix b/pkgs/development/libraries/json-glib/default.nix
index afbb7aaed96f..9ef66fd2ce69 100644
--- a/pkgs/development/libraries/json-glib/default.nix
+++ b/pkgs/development/libraries/json-glib/default.nix
@@ -6,6 +6,7 @@
, ninja
, pkg-config
, gettext
+, withIntrospection ? stdenv.buildPlatform == stdenv.hostPlatform
, gobject-introspection
, fixDarwinDylibNames
, gtk-doc
@@ -18,31 +19,45 @@ stdenv.mkDerivation rec {
pname = "json-glib";
version = "1.6.2";
- outputs = [ "out" "dev" "devdoc" ];
+ outputs = [ "out" "dev" ]
+ ++ lib.optional withIntrospection "devdoc";
src = fetchurl {
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "092g2dyy1hhl0ix9kp33wcab0pg1qicnsv0cj5ms9g9qs336cgd3";
};
+ strictDeps = true;
+
+ depsBuildBuild = [
+ pkg-config
+ ];
+
nativeBuildInputs = [
meson
ninja
pkg-config
gettext
- gobject-introspection
glib
- gtk-doc
docbook-xsl-nons
docbook_xml_dtd_43
] ++ lib.optional stdenv.hostPlatform.isDarwin [
fixDarwinDylibNames
+ ] ++ lib.optionals withIntrospection [
+ gobject-introspection
+ gtk-doc
];
propagatedBuildInputs = [
glib
];
+ mesonFlags = lib.optionals (!withIntrospection) [
+ "-Dintrospection=disabled"
+ # doc gen uses introspection, doesn't work properly
+ "-Dgtk_doc=disabled"
+ ];
+
doCheck = true;
passthru = {
diff --git a/pkgs/development/libraries/libaom/default.nix b/pkgs/development/libraries/libaom/default.nix
index 62045a79ebf5..83f5de4d0130 100644
--- a/pkgs/development/libraries/libaom/default.nix
+++ b/pkgs/development/libraries/libaom/default.nix
@@ -1,13 +1,13 @@
-{ lib, stdenv, fetchgit, yasm, perl, cmake, pkg-config, python3 }:
+{ lib, stdenv, fetchzip, yasm, perl, cmake, pkg-config, python3 }:
stdenv.mkDerivation rec {
pname = "libaom";
- version = "3.0.0";
+ version = "3.1.0";
- src = fetchgit {
- url = "https://aomedia.googlesource.com/aom";
- rev = "v${version}";
- sha256 = "178rq1d7i9q4lg40bipkyhdrk18j9wi5k5avpa5bls0zm7g5ifsx";
+ src = fetchzip {
+ url = "https://aomedia.googlesource.com/aom/+archive/v${version}.tar.gz";
+ sha256 = "1v3i34jmbz1p3x8msj3vx46nl6jdzxbkr2lfbh06vard8adb16il";
+ stripRoot = false;
};
patches = [ ./outputs.patch ];
diff --git a/pkgs/development/libraries/libass/default.nix b/pkgs/development/libraries/libass/default.nix
index 6a180cb62c19..3a8c2a2655ac 100644
--- a/pkgs/development/libraries/libass/default.nix
+++ b/pkgs/development/libraries/libass/default.nix
@@ -17,11 +17,11 @@ in
with lib;
stdenv.mkDerivation rec {
pname = "libass";
- version = "0.15.0";
+ version = "0.15.1";
src = fetchurl {
url = "https://github.com/libass/libass/releases/download/${version}/${pname}-${version}.tar.xz";
- sha256 = "0cz8v6kh3f2j5rdjrra2z0h715fa16vjm7kambvqx9hak86262cz";
+ sha256 = "sha256-HN05ydAHsG5zfnc4AE1/OM+bHpKEPzcweyTn/2OrjlM=";
};
configureFlags = [
diff --git a/pkgs/development/libraries/libfido2/default.nix b/pkgs/development/libraries/libfido2/default.nix
index f44ae4d01f24..64c16e92c44b 100644
--- a/pkgs/development/libraries/libfido2/default.nix
+++ b/pkgs/development/libraries/libfido2/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv
+{ lib
+, stdenv
, fetchurl
, fetchpatch
, cmake
@@ -7,30 +8,47 @@
, libcbor
, openssl
, udev
+, zlib
}:
stdenv.mkDerivation rec {
pname = "libfido2";
- version = "1.5.0";
+ version = "1.7.0";
+
+ # releases on https://developers.yubico.com/libfido2/Releases/ are signed
src = fetchurl {
url = "https://developers.yubico.com/${pname}/Releases/${pname}-${version}.tar.gz";
- sha256 = "08iizxq3w8mpkwfrfpl59csffc20yz8x398bl3kf23rrr4izk42r";
+ sha256 = "13khkp2q8g447797l09p83qxy0z8vgmzr54l8dcnapy9lsr4jrqi";
};
+ patches = [
+ # fix log truncation
+ # https://github.com/Yubico/libfido2/issues/318
+ # https://github.com/Yubico/libfido2/pull/319
+ (fetchpatch {
+ url = "https://github.com/Yubico/libfido2/commit/8edb9a204b2f4aeb487e282908c3187f1d02d606.patch";
+ sha256 = "1i360bghwbdccgkzjfzvhilscnwsj9lhfiviy000n928698l4wan";
+ })
+ ];
+
nativeBuildInputs = [ cmake pkg-config ];
- buildInputs = [ hidapi libcbor openssl ]
+ buildInputs = [ libcbor openssl zlib ]
+ ++ lib.optionals stdenv.isDarwin [ hidapi ]
++ lib.optionals stdenv.isLinux [ udev ];
cmakeFlags = [
"-DUDEV_RULES_DIR=${placeholder "out"}/etc/udev/rules.d"
- "-DUSE_HIDAPI=1"
"-DCMAKE_INSTALL_LIBDIR=lib"
+ ] ++ lib.optionals stdenv.isDarwin [
+ "-DUSE_HIDAPI=1"
+ ] ++ lib.optionals stdenv.isLinux [
+ "-DNFC_LINUX=1"
];
meta = with lib; {
description = ''
- Provides library functionality for FIDO 2.0, including communication with a device over USB.
+ Provides library functionality for FIDO 2.0, including communication with a device over USB.
'';
homepage = "https://github.com/Yubico/libfido2";
license = licenses.bsd2;
diff --git a/pkgs/development/libraries/libglvnd/default.nix b/pkgs/development/libraries/libglvnd/default.nix
index 31a9579a8928..65d0651ed415 100644
--- a/pkgs/development/libraries/libglvnd/default.nix
+++ b/pkgs/development/libraries/libglvnd/default.nix
@@ -5,14 +5,14 @@
stdenv.mkDerivation rec {
pname = "libglvnd";
- version = "1.3.2";
+ version = "1.3.3";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "glvnd";
repo = "libglvnd";
rev = "v${version}";
- sha256 = "10x7fgb114r4gikdg6flszl3kwzcb9y5qa7sj9936mk0zxhjaylz";
+ sha256 = "0gjk6m3gkdm12bmih2jflp0v5s1ibkixk7mrzrk0cj884m3hy1z6";
};
nativeBuildInputs = [ autoreconfHook pkg-config python3 addOpenGLRunpath ];
diff --git a/pkgs/development/libraries/libheif/default.nix b/pkgs/development/libraries/libheif/default.nix
index 71dfca5e6430..d445a7c3867e 100644
--- a/pkgs/development/libraries/libheif/default.nix
+++ b/pkgs/development/libraries/libheif/default.nix
@@ -3,7 +3,7 @@
stdenv.mkDerivation rec {
pname = "libheif";
- version = "1.11.0";
+ version = "1.12.0";
outputs = [ "bin" "out" "dev" "man" ];
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
owner = "strukturag";
repo = "libheif";
rev = "v${version}";
- sha256 = "sha256-xT0sfYPp5atYXnVpP8TYu2TC9/Z/ClyEP1OTSfcw1gw=";
+ sha256 = "sha256-RjGLaDSBO8T7ijRb5a16aUlkCy5vdFPs4O9caIJo4jI=";
};
nativeBuildInputs = [ autoreconfHook pkg-config ];
diff --git a/pkgs/development/libraries/libmwaw/default.nix b/pkgs/development/libraries/libmwaw/default.nix
index 1b8c30f9a8f5..aa42edfeadbf 100644
--- a/pkgs/development/libraries/libmwaw/default.nix
+++ b/pkgs/development/libraries/libmwaw/default.nix
@@ -3,11 +3,11 @@ let
s = # Generated upstream information
rec {
baseName="libmwaw";
- version="0.3.18";
+ version="0.3.19";
name="${baseName}-${version}";
- hash="sha256-/F0FFoD4AAvmT/68CwxYcWscm/BgA+w5k4exCdHtHg8=";
- url="mirror://sourceforge/libmwaw/libmwaw/libmwaw-0.3.18/libmwaw-0.3.18.tar.xz";
- sha256="sha256-/F0FFoD4AAvmT/68CwxYcWscm/BgA+w5k4exCdHtHg8=";
+ hash="sha256-snLiNO78goxLuDRK8PBHpi4HD1MOni+6EbBMjbjtpa8=";
+ url="mirror://sourceforge/libmwaw/libmwaw/libmwaw-0.3.19/libmwaw-0.3.19.tar.xz";
+ sha256="sha256-snLiNO78goxLuDRK8PBHpi4HD1MOni+6EbBMjbjtpa8=";
};
nativeBuildInputs = [ pkg-config ];
diff --git a/pkgs/development/libraries/libxkbcommon/default.nix b/pkgs/development/libraries/libxkbcommon/default.nix
index 8c37bb0c173b..b738089c853f 100644
--- a/pkgs/development/libraries/libxkbcommon/default.nix
+++ b/pkgs/development/libraries/libxkbcommon/default.nix
@@ -1,34 +1,46 @@
-{ lib, stdenv, fetchurl, meson, ninja, pkg-config, bison, doxygen
-, xkeyboard_config, libxcb, libxml2
+{ lib
+, stdenv
+, fetchurl
+, meson
+, ninja
+, pkg-config
+, bison
+, doxygen
+, xkeyboard_config
+, libxcb
+, libxml2
, python3
, libX11
-# To enable the "interactive-wayland" subcommand of xkbcli:
-, withWaylandSupport ? false, wayland, wayland-protocols
+ # To enable the "interactive-wayland" subcommand of xkbcli. This is the
+ # wayland equivalent of `xev` on X11.
+, withWaylandTools ? stdenv.isLinux
+, wayland
+, wayland-protocols
}:
stdenv.mkDerivation rec {
pname = "libxkbcommon";
- version = "1.2.1";
+ version = "1.3.0";
src = fetchurl {
url = "https://xkbcommon.org/download/${pname}-${version}.tar.xz";
- sha256 = "1cqzd4vd5jw3ghibmdqvy90mb1h8vvazc81bxgavk6sc0b9sfcz8";
+ sha256 = "0ysynzzgzd9jdrh1321r4bgw8wd5zljrlyn5y1a31g39xacf02bv";
};
outputs = [ "out" "dev" "doc" ];
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [ meson ninja pkg-config bison doxygen ]
- ++ lib.optional withWaylandSupport wayland;
+ ++ lib.optional withWaylandTools wayland;
buildInputs = [ xkeyboard_config libxcb libxml2 ]
- ++ lib.optionals withWaylandSupport [ wayland wayland-protocols ];
+ ++ lib.optionals withWaylandTools [ wayland wayland-protocols ];
checkInputs = [ python3 ];
mesonFlags = [
"-Dxkb-config-root=${xkeyboard_config}/etc/X11/xkb"
"-Dxkb-config-extra-path=/etc/xkb" # default=$sysconfdir/xkb ($out/etc)
"-Dx-locale-root=${libX11.out}/share/X11/locale"
- "-Denable-wayland=${lib.boolToString withWaylandSupport}"
+ "-Denable-wayland=${lib.boolToString withWaylandTools}"
];
doCheck = true;
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 3be50b5dbd9d..743080ee82ea 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -122,7 +122,7 @@ self = stdenv.mkDerivation {
];
buildInputs = with xorg; [
- expat llvmPackages.llvm libglvnd xorgproto
+ expat llvmPackages.libllvm libglvnd xorgproto
libX11 libXext libxcb libXt libXfixes libxshmfence libXrandr
libffi libvdpau libelf libXvMC
libpthreadstubs openssl /*or another sha1 provider*/
diff --git a/pkgs/development/libraries/nss/3.44.nix b/pkgs/development/libraries/nss/3.44.nix
deleted file mode 100644
index b08b8b3ed2a7..000000000000
--- a/pkgs/development/libraries/nss/3.44.nix
+++ /dev/null
@@ -1,144 +0,0 @@
-{ lib, stdenv, fetchurl, nspr, perl, zlib, sqlite, fixDarwinDylibNames, buildPackages }:
-
-let
- nssPEM = fetchurl {
- url = "http://dev.gentoo.org/~polynomial-c/mozilla/nss-3.15.4-pem-support-20140109.patch.xz";
- sha256 = "10ibz6y0hknac15zr6dw4gv9nb5r5z9ym6gq18j3xqx7v7n3vpdw";
- };
- version = "3.44.4";
- underscoreVersion = builtins.replaceStrings ["."] ["_"] version;
-
-in stdenv.mkDerivation rec {
- pname = "nss";
- inherit version;
-
- src = fetchurl {
- url = "mirror://mozilla/security/nss/releases/NSS_${underscoreVersion}_RTM/src/${pname}-${version}.tar.gz";
- sha256 = "7ec1a52e20fd9a23e1907eeba8f4f2ecd619dac5d20fa023ec5b4faa1843e847";
- };
-
- depsBuildBuild = [ buildPackages.stdenv.cc ];
-
- nativeBuildInputs = [ perl ]
- ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
-
- buildInputs = [ zlib sqlite ];
-
- propagatedBuildInputs = [ nspr ];
-
- prePatch = ''
- xz -d < ${nssPEM} | patch -p1
- '';
-
- patches =
- [
- # Based on http://patch-tracker.debian.org/patch/series/dl/nss/2:3.15.4-1/85_security_load.patch
- ./85_security_load-3.44.patch
- ./ckpem.patch
- ];
-
- patchFlags = [ "-p0" ];
-
- postPatch = lib.optionalString stdenv.isDarwin ''
- substituteInPlace nss/coreconf/Darwin.mk --replace '@executable_path/$(notdir $@)' "$out/lib/\$(notdir \$@)"
- '';
-
- outputs = [ "out" "dev" "tools" ];
-
- preConfigure = "cd nss";
-
- makeFlags = let
- # NSS's build systems expects aarch32 to be called arm; if we pass in armv6l/armv7l, it
- # fails with a linker error
- cpu = if stdenv.hostPlatform.isAarch32 then "arm" else stdenv.hostPlatform.parsed.cpu.name;
- in [
- "NSPR_INCLUDE_DIR=${nspr.dev}/include"
- "NSPR_LIB_DIR=${nspr.out}/lib"
- "NSDISTMODE=copy"
- "BUILD_OPT=1"
- "SOURCE_PREFIX=\$(out)"
- "NSS_ENABLE_ECC=1"
- "USE_SYSTEM_ZLIB=1"
- "NSS_USE_SYSTEM_SQLITE=1"
- "NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc"
- ] ++ lib.optionals (!stdenv.isDarwin) [
- # Pass in CPU even if we're not cross compiling, because otherwise it tries to guess with
- # uname, which can be wrong if e.g. we're compiling for aarch32 on aarch64
- "OS_TEST=${cpu}"
- "CPU_ARCH=${cpu}"
- ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
- "CROSS_COMPILE=1"
- "NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling
- ] ++ lib.optional stdenv.is64bit "USE_64=1"
- ++ lib.optional stdenv.isDarwin "CCC=clang++";
-
- NIX_CFLAGS_COMPILE = "-Wno-error";
-
- # TODO(@oxij): investigate this: `make -n check` works but `make
- # check` fails with "no rule", same for "installcheck".
- doCheck = false;
- doInstallCheck = false;
-
- postInstall = ''
- rm -rf $out/private
- mv $out/public $out/include
- mv $out/*.OBJ/* $out/
- rmdir $out/*.OBJ
-
- ln -s lib $out/lib64
-
- # Upstream issue: https://bugzilla.mozilla.org/show_bug.cgi?id=530672
- # https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/nss/files/nss-3.32-gentoo-fixups.patch?id=af1acce6c6d2c3adb17689261dfe2c2b6771ab8a
- NSS_MAJOR_VERSION=`grep "NSS_VMAJOR" lib/nss/nss.h | awk '{print $3}'`
- NSS_MINOR_VERSION=`grep "NSS_VMINOR" lib/nss/nss.h | awk '{print $3}'`
- NSS_PATCH_VERSION=`grep "NSS_VPATCH" lib/nss/nss.h | awk '{print $3}'`
- PREFIX="$out"
-
- mkdir -p $out/lib/pkgconfig
- sed -e "s,%prefix%,$PREFIX," \
- -e "s,%exec_prefix%,$PREFIX," \
- -e "s,%libdir%,$PREFIX/lib64," \
- -e "s,%includedir%,$dev/include/nss," \
- -e "s,%NSS_VERSION%,$NSS_MAJOR_VERSION.$NSS_MINOR_VERSION.$NSS_PATCH_VERSION,g" \
- -e "s,%NSPR_VERSION%,4.16,g" \
- pkg/pkg-config/nss.pc.in > $out/lib/pkgconfig/nss.pc
- chmod 0644 $out/lib/pkgconfig/nss.pc
-
- sed -e "s,@prefix@,$PREFIX," \
- -e "s,@MOD_MAJOR_VERSION@,$NSS_MAJOR_VERSION," \
- -e "s,@MOD_MINOR_VERSION@,$NSS_MINOR_VERSION," \
- -e "s,@MOD_PATCH_VERSION@,$NSS_PATCH_VERSION," \
- pkg/pkg-config/nss-config.in > $out/bin/nss-config
- chmod 0755 $out/bin/nss-config
- '';
-
- postFixup = let
- isCross = stdenv.hostPlatform != stdenv.buildPlatform;
- nss = if isCross then buildPackages.nss.tools else "$out";
- in ''
- for libname in freebl3 nssdbm3 softokn3
- do '' +
- (if stdenv.isDarwin
- then ''
- libfile="$out/lib/lib$libname.dylib"
- DYLD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
- '' else ''
- libfile="$out/lib/lib$libname.so"
- LD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
- '') + ''
- ${nss}/bin/shlibsign -v -i "$libfile"
- done
-
- moveToOutput bin "$tools"
- moveToOutput bin/nss-config "$dev"
- moveToOutput lib/libcrmf.a "$dev" # needed by firefox, for example
- rm -f "$out"/lib/*.a
- '';
-
- meta = with lib; {
- homepage = "https://developer.mozilla.org/en-US/docs/NSS";
- description = "A set of libraries for development of security-enabled client and server applications";
- license = licenses.mpl20;
- platforms = platforms.all;
- };
-}
diff --git a/pkgs/development/libraries/nss/85_security_load-3.44.patch b/pkgs/development/libraries/nss/85_security_load-3.44.patch
deleted file mode 100644
index 132d5a96b29f..000000000000
--- a/pkgs/development/libraries/nss/85_security_load-3.44.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-diff -ru -x '*~' -x '*.orig' -x '*.rej' nss/cmd/shlibsign/shlibsign.c nss/cmd/shlibsign/shlibsign.c
---- nss/cmd/shlibsign/shlibsign.c 2017-01-04 15:24:24.000000000 +0100
-+++ nss/cmd/shlibsign/shlibsign.c 2017-01-24 14:43:31.030420852 +0100
-@@ -875,6 +875,8 @@
- goto cleanup;
- }
- lib = PR_LoadLibrary(libname);
-+ if (!lib)
-+ lib = PR_LoadLibrary(NIX_NSS_LIBDIR"libsoftokn3.so");
- assert(lib != NULL);
- if (!lib) {
- PR_fprintf(PR_STDERR, "loading softokn3 failed");
-diff -ru -x '*~' -x '*.orig' -x '*.rej' nss/coreconf/config.mk nss/coreconf/config.mk
---- nss/coreconf/config.mk 2017-01-04 15:24:24.000000000 +0100
-+++ nss/coreconf/config.mk 2017-01-24 14:43:47.989432372 +0100
-@@ -202,3 +202,6 @@
-
- # Hide old, deprecated, TLS cipher suite names when building NSS
- DEFINES += -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES
-+
-+# Nix specific stuff.
-+DEFINES += -DNIX_NSS_LIBDIR=\"$(out)/lib/\"
-diff -ru -x '*~' -x '*.orig' -x '*.rej' nss/lib/pk11wrap/pk11load.c nss/lib/pk11wrap/pk11load.c
---- nss/lib/pk11wrap/pk11load.c 2017-01-04 15:24:24.000000000 +0100
-+++ nss/lib/pk11wrap/pk11load.c 2017-01-24 14:45:06.883485652 +0100
-@@ -440,6 +440,13 @@
- * unload the library if anything goes wrong from here on out...
- */
- library = PR_LoadLibrary(mod->dllName);
-+ if ((library == NULL) &&
-+ !rindex(mod->dllName, PR_GetDirectorySeparator())) {
-+ library = PORT_LoadLibraryFromOrigin(my_shlib_name,
-+ (PRFuncPtr) &softoken_LoadDSO,
-+ mod->dllName);
-+ }
-+
- mod->library = (void *)library;
-
- if (library == NULL) {
-diff -ru -x '*~' -x '*.orig' -x '*.rej' nss/lib/util/secload.c nss/lib/util/secload.c
---- nss/lib/util/secload.c 2017-01-04 15:24:24.000000000 +0100
-+++ nss/lib/util/secload.c 2017-01-24 14:43:31.030420852 +0100
-@@ -70,9 +70,14 @@
-
- /* Remove the trailing filename from referencePath and add the new one */
- c = strrchr(referencePath, PR_GetDirectorySeparator());
-+ if (!c) { /* referencePath doesn't contain a / means that dladdr gave us argv[0]
-+ * and program was called from $PATH. Hack to get libs from NIX_NSS_LIBDIR */
-+ referencePath = NIX_NSS_LIBDIR;
-+ c = (char*) &referencePath[sizeof(NIX_NSS_LIBDIR) - 1]; /* last / */
-+ }
- if (c) {
- size_t referencePathSize = 1 + c - referencePath;
-- fullName = (char*)PORT_Alloc(strlen(name) + referencePathSize + 1);
-+ fullName = (char*) PORT_Alloc(strlen(name) + referencePathSize + 5);
- if (fullName) {
- memcpy(fullName, referencePath, referencePathSize);
- strcpy(fullName + referencePathSize, name);
-@@ -82,6 +87,11 @@
- #endif
- libSpec.type = PR_LibSpec_Pathname;
- libSpec.value.pathname = fullName;
-+ if ((referencePathSize >= 4) &&
-+ (strncmp(fullName + referencePathSize - 4, "bin", 3) == 0)) {
-+ memcpy(fullName + referencePathSize -4, "lib", 3);
-+ }
-+ strcpy(fullName + referencePathSize, name);
- dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL
- #ifdef PR_LD_ALT_SEARCH_PATH
- /* allow library's dependencies to be found in the same directory
-@@ -89,6 +99,10 @@
- | PR_LD_ALT_SEARCH_PATH
- #endif
- );
-+ if (! dlh) {
-+ strcpy(fullName + referencePathSize, name);
-+ dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL);
-+ }
- PORT_Free(fullName);
- }
- }
diff --git a/pkgs/development/libraries/opencl-clang/default.nix b/pkgs/development/libraries/opencl-clang/default.nix
index 8bbde9796d9a..c40fb9c1203a 100644
--- a/pkgs/development/libraries/opencl-clang/default.nix
+++ b/pkgs/development/libraries/opencl-clang/default.nix
@@ -32,7 +32,9 @@ let
passthru = rec {
- clang-unwrapped = addPatches "clang" llvmPkgs.clang-unwrapped;
+ libclang = addPatches "clang" llvmPkgs.libclang;
+
+ clang-unwrapped = libclang.out;
clang = llvmPkgs.clang.override {
cc = clang-unwrapped;
@@ -53,7 +55,7 @@ let
library = let
inherit (llvmPkgs) llvm;
- inherit (if buildWithPatches then passthru else llvmPkgs) clang-unwrapped spirv-llvm-translator;
+ inherit (if buildWithPatches then passthru else llvmPkgs) libclang spirv-llvm-translator;
in
stdenv.mkDerivation rec {
pname = "opencl-clang";
@@ -74,13 +76,13 @@ let
./opencl-headers-dir.patch
];
- nativeBuildInputs = [ cmake git ];
+ nativeBuildInputs = [ cmake git llvm.dev ];
- buildInputs = [ clang-unwrapped llvm spirv-llvm-translator ];
+ buildInputs = [ libclang llvm spirv-llvm-translator ];
cmakeFlags = [
"-DPREFERRED_LLVM_VERSION=${getVersion llvm}"
- "-DOPENCL_HEADERS_DIR=${clang-unwrapped}/lib/clang/${getVersion clang-unwrapped}/include/"
+ "-DOPENCL_HEADERS_DIR=${libclang.lib}/lib/clang/${getVersion libclang}/include/"
"-DLLVMSPIRV_INCLUDED_IN_LLVM=OFF"
"-DSPIRV_TRANSLATOR_DIR=${spirv-llvm-translator}"
diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix
index 39831a3baf08..fe4704341ef5 100644
--- a/pkgs/development/libraries/openldap/default.nix
+++ b/pkgs/development/libraries/openldap/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, openssl, db, groff, libtool
+{ lib, stdenv, fetchurl, openssl, db, groff, libtool, libsodium
, withCyrusSasl ? true
, cyrus_sasl
}:
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ groff ];
- buildInputs = [ openssl cyrus_sasl db libtool ];
+ buildInputs = [ openssl cyrus_sasl db libsodium libtool ];
# Disable install stripping as it breaks cross-compiling.
# We strip binaries anyway in fixupPhase.
@@ -46,6 +46,7 @@ stdenv.mkDerivation rec {
postBuild = ''
make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/sha2
make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/pbkdf2
+ make $makeFlags CC=$CC -C contrib/slapd-modules/passwd/argon2
'';
doCheck = false; # needs a running LDAP server
@@ -54,6 +55,9 @@ stdenv.mkDerivation rec {
"sysconfdir=$(out)/etc"
"localstatedir=$(out)/var"
"moduledir=$(out)/lib/modules"
+ # The argon2 module hardcodes /usr/bin/install as the path for the
+ # `install` binary, which is overridden here.
+ "INSTALL=install"
];
# 1. Libraries left in the build location confuse `patchelf --shrink-rpath`
@@ -76,6 +80,7 @@ stdenv.mkDerivation rec {
postInstall = ''
make $installFlags install -C contrib/slapd-modules/passwd/sha2
make $installFlags install -C contrib/slapd-modules/passwd/pbkdf2
+ make $installFlags install-lib -C contrib/slapd-modules/passwd/argon2
chmod +x "$out"/lib/*.{so,dylib}
'';
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 13cac47793ef..a336dd18fae4 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -125,8 +125,6 @@ let
if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
rm "$out/lib/"*.a
fi
-
- mkdir -p $bin
'' + lib.optionalString (!stdenv.hostPlatform.isWindows)
# Fix bin/c_rehash's perl interpreter line
#
@@ -140,9 +138,9 @@ let
# "#!/usr/bin/env perl"
''
substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl}/bin/perl "/usr/bin/env perl"
- '' +
- ''
- mv $out/bin $bin/
+ '' + ''
+ mkdir -p $bin
+ mv $out/bin $bin/bin
mkdir $dev
mv $out/include $dev/
diff --git a/pkgs/development/libraries/plasma-wayland-protocols/default.nix b/pkgs/development/libraries/plasma-wayland-protocols/default.nix
index 2d3a5239d7b7..ea02eb428db1 100644
--- a/pkgs/development/libraries/plasma-wayland-protocols/default.nix
+++ b/pkgs/development/libraries/plasma-wayland-protocols/default.nix
@@ -5,11 +5,11 @@
mkDerivation rec {
pname = "plasma-wayland-protocols";
- version = "1.1.1";
+ version = "1.2.1";
src = fetchurl {
- url = "mirror://kde/stable/${pname}/${version}/${pname}-${version}.tar.xz";
- sha256 = "sha256-xUkzg9EVFxw0NeqaIbOWaGBjKoRFRP+sj1SJBDalHTg=";
+ url = "mirror://kde/stable/${pname}/${pname}-v${version}.tar.xz";
+ sha256 = "sha256-KHuQkD+afzlMdedcsYdCaGLq9kqS8b5+LvaOmf2Muqo=";
};
nativeBuildInputs = [ extra-cmake-modules ];
diff --git a/pkgs/development/libraries/protobuf/3.15.nix b/pkgs/development/libraries/protobuf/3.15.nix
index 661a552882e8..e4783be6a351 100644
--- a/pkgs/development/libraries/protobuf/3.15.nix
+++ b/pkgs/development/libraries/protobuf/3.15.nix
@@ -1,6 +1,6 @@
{ callPackage, ... }:
callPackage ./generic-v3.nix {
- version = "3.15.7";
- sha256 = "03fx96rwxfbmr47f1nrflvaq5kk5p3a9wms4688nbnmymyghyml0";
+ version = "3.15.8";
+ sha256 = "1q3k8axhq6g8fqczmd6kbgzpdplrrgygppym4x1l99lzhplx9rqv";
}
diff --git a/pkgs/development/libraries/protobuf/3.16.nix b/pkgs/development/libraries/protobuf/3.16.nix
new file mode 100644
index 000000000000..df8d53b9f1c3
--- /dev/null
+++ b/pkgs/development/libraries/protobuf/3.16.nix
@@ -0,0 +1,6 @@
+{ callPackage, ... }:
+
+callPackage ./generic-v3.nix {
+ version = "3.16.0";
+ sha256 = "0jc523ys6xh1fk3l52f5mfqxhb4g8aim1js7330v0fdc3fjr8ncf";
+}
diff --git a/pkgs/development/libraries/pslib/default.nix b/pkgs/development/libraries/pslib/default.nix
index ec2362009ff3..b3439b7ee96f 100644
--- a/pkgs/development/libraries/pslib/default.nix
+++ b/pkgs/development/libraries/pslib/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, cmake, pkg-config, zlib, libpng, libjpeg, libungif, libtiff
+{ lib, stdenv, fetchurl, cmake, pkg-config, zlib, libpng, libjpeg, giflib, libtiff
}:
stdenv.mkDerivation rec {
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ cmake pkg-config ];
- buildInputs = [ zlib libpng libjpeg libungif libtiff ];
+ buildInputs = [ zlib libpng libjpeg giflib libtiff ];
doCheck = true;
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index a4ac41d81df7..532a72c820ce 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -204,7 +204,7 @@ stdenv.mkDerivation rec {
++ lib.optional stdenv.isLinux "-std=gnu++98" # gnu++ in (Obj)C flags is no good on Darwin
++ lib.optionals (stdenv.isFreeBSD || stdenv.isDarwin)
[ "-I${glib.dev}/include/glib-2.0" "-I${glib.out}/lib/glib-2.0/include" ]
- ++ lib.optional stdenv.isDarwin "-I${libcxx}/include/c++/v1");
+ ++ lib.optional stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1");
NIX_LDFLAGS = lib.optionalString (stdenv.isFreeBSD || stdenv.isDarwin) "-lglib-2.0";
diff --git a/pkgs/development/libraries/qt-5/qtModule.nix b/pkgs/development/libraries/qt-5/qtModule.nix
index 930ed9d67baa..ebd6e887ec9d 100644
--- a/pkgs/development/libraries/qt-5/qtModule.nix
+++ b/pkgs/development/libraries/qt-5/qtModule.nix
@@ -7,15 +7,14 @@ let inherit (lib) licenses maintainers platforms; in
args:
let
- inherit (args) name;
- version = args.version or srcs.${name}.version;
- src = args.src or srcs.${name}.src;
+ pname = args.name;
+ version = args.version or srcs.${pname}.version;
+ src = args.src or srcs.${pname}.src;
in
mkDerivation (args // {
- name = "${name}-${version}";
- inherit src;
- patches = args.patches or patches.${name} or [];
+ inherit pname version src;
+ patches = args.patches or patches.${pname} or [];
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ perl self.qmake ];
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
diff --git a/pkgs/development/libraries/re2/default.nix b/pkgs/development/libraries/re2/default.nix
index 2d8d00597647..9b7a2e910117 100644
--- a/pkgs/development/libraries/re2/default.nix
+++ b/pkgs/development/libraries/re2/default.nix
@@ -1,14 +1,14 @@
{ lib, stdenv, fetchFromGitHub }:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
pname = "re2";
- version = "20201001";
+ version = "2021-04-01";
src = fetchFromGitHub {
owner = "google";
repo = "re2";
- rev = "2020-10-01";
- sha256 = "0a5f7av1pk6p3jxc2w6prl00lyrplap97m68hnhw7jllnwljk0bx";
+ rev = version;
+ sha256 = "1iia0883lssj7ckbsr0n7yb3gdw24c8wnl2q5hhzlml23h4ipbh3";
};
preConfigure = ''
diff --git a/pkgs/development/libraries/readline/8.0.nix b/pkgs/development/libraries/readline/8.1.nix
similarity index 85%
rename from pkgs/development/libraries/readline/8.0.nix
rename to pkgs/development/libraries/readline/8.1.nix
index 9ea0277467e5..35835c1a1436 100644
--- a/pkgs/development/libraries/readline/8.0.nix
+++ b/pkgs/development/libraries/readline/8.1.nix
@@ -1,13 +1,13 @@
-{ fetchurl, lib, stdenv, ncurses
+{ fetchurl, stdenv, lib, ncurses
}:
stdenv.mkDerivation rec {
pname = "readline";
- version = "8.0p${toString (builtins.length upstreamPatches)}";
+ version = "8.1p${toString (builtins.length upstreamPatches)}";
src = fetchurl {
url = "mirror://gnu/readline/readline-${meta.branch}.tar.gz";
- sha256 = "0qg4924hf4hg0r0wbx2chswsr08734536fh5iagkd3a7f4czafg3";
+ sha256 = "00ibp0n9crbwx15k9vvckq5wsipw98b1px8pd8i34chy2gpb9kpq";
};
outputs = [ "out" "dev" "man" "doc" "info" ];
@@ -20,11 +20,11 @@ stdenv.mkDerivation rec {
(let
patch = nr: sha256:
fetchurl {
- url = "mirror://gnu/readline/readline-${meta.branch}-patches/readline80-${nr}";
+ url = "mirror://gnu/readline/readline-${meta.branch}-patches/readline81-${nr}";
inherit sha256;
};
in
- import ./readline-8.0-patches.nix patch);
+ import ./readline-8.1-patches.nix patch);
patches =
[ ./link-against-ncurses.patch
@@ -57,6 +57,6 @@ stdenv.mkDerivation rec {
maintainers = with maintainers; [ dtzWill ];
platforms = platforms.unix;
- branch = "8.0";
+ branch = "8.1";
};
}
diff --git a/pkgs/development/libraries/readline/readline-8.0-patches.nix b/pkgs/development/libraries/readline/readline-8.0-patches.nix
deleted file mode 100644
index 2fac6a413c71..000000000000
--- a/pkgs/development/libraries/readline/readline-8.0-patches.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-# Automatically generated by `update-patch-set.sh'; do not edit.
-
-patch: [
-(patch "001" "0sfh7wn0pr743xspnb1zndxndlv9rc0hcg14cbw5cmyg6f4ykrfq")
-(patch "002" "1xy8mv8xm8hsfixwp3ci9kfx3dii3y92cq27wwd0jq75y6zzxc1n")
-(patch "003" "1vza7sxjcsr2z295ij12nzgncdil1vb6as3mqy4m7svi1chv5pcl")
-(patch "004" "0k1rfx9w32lglxg564yvp0mw6jg6883p8ac2f2lxxqpf80m3vami")
-]
diff --git a/pkgs/development/libraries/readline/readline-8.1-patches.nix b/pkgs/development/libraries/readline/readline-8.1-patches.nix
new file mode 100644
index 000000000000..b8019fb33502
--- /dev/null
+++ b/pkgs/development/libraries/readline/readline-8.1-patches.nix
@@ -0,0 +1,4 @@
+# Automatically generated by `update-patch-set.sh'; do not edit.
+
+patch: [
+]
diff --git a/pkgs/development/libraries/tk/generic.nix b/pkgs/development/libraries/tk/generic.nix
index 57dc3dac2d09..ecb3840b2de3 100644
--- a/pkgs/development/libraries/tk/generic.nix
+++ b/pkgs/development/libraries/tk/generic.nix
@@ -16,6 +16,12 @@ stdenv.mkDerivation {
cd unix
'';
+ postPatch = ''
+ for file in $(find library/demos/. -type f ! -name "*.*"); do
+ substituteInPlace $file --replace "exec wish" "exec $out/bin/wish"
+ done
+ '';
+
postInstall = ''
ln -s $out/bin/wish* $out/bin/wish
cp ../{unix,generic}/*.h $out/include
diff --git a/pkgs/development/libraries/wayland/default.nix b/pkgs/development/libraries/wayland/default.nix
index 07671ddebddc..4a685b430739 100644
--- a/pkgs/development/libraries/wayland/default.nix
+++ b/pkgs/development/libraries/wayland/default.nix
@@ -5,7 +5,7 @@
, meson
, pkg-config
, ninja
-, wayland
+, wayland-scanner
, expat
, libxml2
, withLibraries ? stdenv.isLinux
@@ -64,7 +64,7 @@ stdenv.mkDerivation rec {
pkg-config
ninja
] ++ lib.optionals isCross [
- wayland # For wayland-scanner during the build
+ wayland-scanner
] ++ lib.optionals withDocumentation [
(graphviz-nox.override { pango = null; }) # To avoid an infinite recursion
doxygen
@@ -85,6 +85,18 @@ stdenv.mkDerivation rec {
docbook_xml_dtd_42
];
+ postFixup = ''
+ # The pkg-config file is required for cross-compilation:
+ mkdir -p $bin/lib/pkgconfig/
+ cat < $bin/lib/pkgconfig/wayland-scanner.pc
+ wayland_scanner=$bin/bin/wayland-scanner
+
+ Name: Wayland Scanner
+ Description: Wayland scanner
+ Version: ${version}
+ EOF
+ '';
+
meta = with lib; {
description = "Core Wayland window system code and protocol";
longDescription = ''
diff --git a/pkgs/development/libraries/wayland/protocols.nix b/pkgs/development/libraries/wayland/protocols.nix
index 23258aff3e93..8a2b05aa4dff 100644
--- a/pkgs/development/libraries/wayland/protocols.nix
+++ b/pkgs/development/libraries/wayland/protocols.nix
@@ -1,19 +1,15 @@
-{ lib, stdenv, fetchurl, pkg-config
-, wayland
-}:
+{ lib, stdenv, fetchurl, wayland-scanner }:
stdenv.mkDerivation rec {
pname = "wayland-protocols";
- version = "1.20";
+ version = "1.21";
src = fetchurl {
url = "https://wayland.freedesktop.org/releases/${pname}-${version}.tar.xz";
- sha256 = "1rsdgvkkvxs3cjhpl6agvbkm53vm7k8rg127j9y2vn33m2hvg0lp";
+ sha256 = "1rfdlkzz67qsb955zqb8jbw3m22pl6ppvrvfq8bqiqcb5n24b6dr";
};
- nativeBuildInputs = [ pkg-config ];
-
- buildInputs = [ wayland ];
+ nativeBuildInputs = [ wayland-scanner ];
meta = {
description = "Wayland protocol extensions";
diff --git a/pkgs/development/libraries/wlroots/0.12.nix b/pkgs/development/libraries/wlroots/0.12.nix
index 66d4fab2bf98..c21205beabc3 100644
--- a/pkgs/development/libraries/wlroots/0.12.nix
+++ b/pkgs/development/libraries/wlroots/0.12.nix
@@ -30,6 +30,8 @@ stdenv.mkDerivation rec {
mesonFlags = [ "-Dlogind-provider=systemd" "-Dlibseat=disabled" ];
+ CFLAGS = "-Wno-error=deprecated-declarations";
+
postFixup = ''
# Install ALL example programs to $examples:
# screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle
diff --git a/pkgs/development/misc/umr/default.nix b/pkgs/development/misc/umr/default.nix
index 158cef2eed1e..3dba51022d3c 100644
--- a/pkgs/development/misc/umr/default.nix
+++ b/pkgs/development/misc/umr/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
sha256 = "IwTkHEuJ82hngPjFVIihU2rSolLBqHxQTNsP8puYPaY=";
};
- nativeBuildInputs = [ cmake pkg-config ];
+ nativeBuildInputs = [ cmake pkg-config llvmPackages.llvm.dev ];
buildInputs = [
bash-completion
diff --git a/pkgs/development/ocaml-modules/camlimages/4.0.nix b/pkgs/development/ocaml-modules/camlimages/4.0.nix
deleted file mode 100644
index 26735b1c5d7f..000000000000
--- a/pkgs/development/ocaml-modules/camlimages/4.0.nix
+++ /dev/null
@@ -1,41 +0,0 @@
-{ lib, stdenv, fetchurl, omake, ocaml, libtiff, libjpeg, libpng, giflib, findlib, libXpm, freetype, graphicsmagick, ghostscript }:
-
-let
- pname = "camlimages";
- version = "4.0.1";
-in
-
-stdenv.mkDerivation {
- name = "${pname}-${version}";
-
- src = fetchurl {
- url = "https://bitbucket.org/camlspotter/camlimages/get/v4.0.1.tar.gz";
- sha256 = "b40237c1505487049799a7af296eb3996b3fa08eab94415546f46d61355747c4";
- };
-
- buildInputs = [ ocaml omake findlib graphicsmagick ghostscript ];
-
- propagatedBuildInputs = [libtiff libjpeg libpng giflib freetype libXpm ];
-
- createFindlibDestdir = true;
-
- preConfigure = ''
- rm ./configure
- '';
-
- buildPhase = ''
- omake
- '';
-
- installPhase = ''
- omake install
- '';
-
- meta = with lib; {
- branch = "4.0";
- homepage = "https://bitbucket.org/camlspotter/camlimages";
- description = "OCaml image processing library";
- license = licenses.lgpl2;
- maintainers = [ maintainers.vbgl ];
- };
-}
diff --git a/pkgs/development/ocaml-modules/camlimages/4.1.2.nix b/pkgs/development/ocaml-modules/camlimages/4.1.2.nix
new file mode 100644
index 000000000000..dba303afdf24
--- /dev/null
+++ b/pkgs/development/ocaml-modules/camlimages/4.1.2.nix
@@ -0,0 +1,37 @@
+{ lib, stdenv, fetchFromGitLab, fetchpatch, omake, ocaml, findlib
+, graphicsmagick, ghostscript
+, freetype, giflib, libjpeg, libpng, libtiff, libXpm
+}:
+
+stdenv.mkDerivation rec {
+ pname = "camlimages";
+ version = "4.1.2";
+
+ src = fetchFromGitLab {
+ owner = "camlspotter";
+ repo = "camlimages";
+ rev = "98661d507e12ce91a51295a50f244cb8265b4439"; # no tag
+ sha256 = "0kpxj8wm2m17wjq217jzjpfgv1d7sp4w1yd1gi8ipn5rj4sid2j8";
+ };
+
+ buildInputs = [ ocaml omake findlib graphicsmagick ghostscript ];
+ propagatedBuildInputs = [ libtiff libjpeg libpng giflib freetype libXpm ];
+
+ createFindlibDestdir = true;
+
+ buildPhase = ''
+ omake
+ '';
+
+ installPhase = ''
+ omake install
+ '';
+
+ meta = with lib; {
+ branch = "4.1";
+ homepage = "https://gitlab.com/camlspotter/camlimages";
+ description = "OCaml image processing library";
+ license = licenses.lgpl2;
+ maintainers = [ maintainers.vbgl ];
+ };
+}
diff --git a/pkgs/development/ocaml-modules/eigen/default.nix b/pkgs/development/ocaml-modules/eigen/default.nix
index c86b7cba0103..47b002fd7302 100644
--- a/pkgs/development/ocaml-modules/eigen/default.nix
+++ b/pkgs/development/ocaml-modules/eigen/default.nix
@@ -15,7 +15,7 @@ buildDunePackage rec {
minimumOCamlVersion = "4.02";
- NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
+ NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
propagatedBuildInputs = [ ctypes ];
diff --git a/pkgs/development/ocaml-modules/llvm/default.nix b/pkgs/development/ocaml-modules/llvm/default.nix
index 34fe75a2943f..f984a28869e1 100644
--- a/pkgs/development/ocaml-modules/llvm/default.nix
+++ b/pkgs/development/ocaml-modules/llvm/default.nix
@@ -1,16 +1,16 @@
-{ stdenv, lib, fetchpatch, python, cmake, llvm, ocaml, findlib, ctypes }:
+{ stdenv, lib, fetchpatch, python, cmake, libllvm, ocaml, findlib, ctypes }:
-let version = lib.getVersion llvm; in
+let version = lib.getVersion libllvm; in
stdenv.mkDerivation {
pname = "ocaml-llvm";
inherit version;
- inherit (llvm) src;
+ inherit (libllvm) src;
nativeBuildInputs = [ cmake ];
buildInputs = [ python ocaml findlib ctypes ];
- propagatedBuildInputs = [ llvm ];
+ propagatedBuildInputs = [ libllvm ];
patches = [ (fetchpatch {
url = "https://raw.githubusercontent.com/ocaml/opam-repository/2bdc193f5a9305ea93bf0f0dfc1fbc327c8b9306/packages/llvm/llvm.7.0.0/files/fix-shared.patch";
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
cmakeFlags = [
"-DLLVM_OCAML_OUT_OF_TREE=TRUE"
"-DLLVM_OCAML_INSTALL_PATH=${placeholder "out"}/ocaml"
- "-DLLVM_OCAML_EXTERNAL_LLVM_LIBDIR=${lib.getLib llvm}/lib"
+ "-DLLVM_OCAML_EXTERNAL_LLVM_LIBDIR=${lib.getLib libllvm}/lib"
];
buildFlags = [ "ocaml_all" ];
@@ -34,11 +34,11 @@ stdenv.mkDerivation {
'';
passthru = {
- inherit llvm;
+ inherit libllvm;
};
meta = {
- inherit (llvm.meta) license homepage;
+ inherit (libllvm.meta) license homepage;
platforms = ocaml.meta.platforms or [];
description = "OCaml bindings distributed with LLVM";
maintainers = with lib.maintainers; [ vbgl ];
diff --git a/pkgs/development/python-modules/Babel/default.nix b/pkgs/development/python-modules/Babel/default.nix
index 1074d2eef48c..183478396eb7 100644
--- a/pkgs/development/python-modules/Babel/default.nix
+++ b/pkgs/development/python-modules/Babel/default.nix
@@ -1,38 +1,17 @@
-{ stdenv, lib, buildPythonPackage, fetchPypi, fetchpatch, pytz, pytest, freezegun, glibcLocales }:
+{ stdenv, lib, buildPythonPackage, fetchPypi, pytz, pytestCheckHook, freezegun }:
buildPythonPackage rec {
pname = "Babel";
- version = "2.7.0";
+ version = "2.9.0";
src = fetchPypi {
inherit pname version;
- sha256 = "e86135ae101e31e2c8ec20a4e0c5220f4eed12487d5cf3f78be7e98d3a57fc28";
+ sha256 = "018yg7g2pa6vjixx1nx41cfispgfi0azzp0a1chlycbj8jsil0ys";
};
- patches = [
- # The following 2 patches fix the test suite failing on nix < 2.3 with
- # Python < 3 because those nix versions do not run in a pseudoterminal,
- # which makes Python 2 not set the default encoding to UTF-8, and the
- # Babel code crashes when printing a warning in that case.
- # See #75676 and https://github.com/python-babel/babel/pull/691.
- # It is important to fix this because otherwise Babel is not buildable
- # with older nix versions (e.g. on machines used as --builders).
- # TODO: Remove at release > 2.8.0.
- (fetchpatch {
- name = "Babel-Introduce-invariant-that-invalid_pofile-takes-unicode-line.patch";
- url = "https://github.com/python-babel/babel/commit/f4f6653e6aa053724d2c6dc0ee71dcb928013352.patch";
- sha256 = "1kyknwn9blspcf9yxmgdiaxdii1dnkblyhcflqwhxyl1mss1dxv5";
- })
- (fetchpatch {
- name = "Babel-Fix-unicode-printing-error-on-Python-2-without-TTY.patch";
- url = "https://github.com/python-babel/babel/commit/da7f31143847659b6b74d802618b03438aceb350.patch";
- sha256 = "09yny8614knr8ngrrddmqzkxk70am135rccv2ncc6dji4xbqbfln";
- })
- ];
-
propagatedBuildInputs = [ pytz ];
- checkInputs = [ pytest freezegun ];
+ checkInputs = [ pytestCheckHook freezegun ];
doCheck = !stdenv.isDarwin;
diff --git a/pkgs/development/python-modules/autobahn/default.nix b/pkgs/development/python-modules/autobahn/default.nix
index 19015a5729ad..2585cd539d78 100644
--- a/pkgs/development/python-modules/autobahn/default.nix
+++ b/pkgs/development/python-modules/autobahn/default.nix
@@ -1,34 +1,78 @@
-{ lib, buildPythonPackage, fetchPypi, isPy3k,
- six, txaio, twisted, zope_interface, cffi,
- mock, pytest, cryptography, pynacl
+{ lib
+, argon2_cffi
+, attrs
+, buildPythonPackage
+, cbor
+, cbor2
+, cffi
+, cryptography
+, fetchPypi
+, flatbuffers
+, mock
+, msgpack
+, passlib
+, pynacl
+, pytest-asyncio
+, pytestCheckHook
+, pythonOlder
+, twisted
+, py-ubjson
+, txaio
+, ujson
+, zope_interface
}:
+
buildPythonPackage rec {
pname = "autobahn";
version = "21.3.1";
- disabled = !isPy3k;
+ disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
- sha256 = "e126c1f583e872fb59e79d36977cfa1f2d0a8a79f90ae31f406faae7664b8e03";
+ sha256 = "00wf9dkfgakg80gy62prg650lb8zz9y9fdlxwxcznwp8hgsw29p1";
};
- propagatedBuildInputs = [ six txaio twisted zope_interface cffi cryptography pynacl ];
+ propagatedBuildInputs = [
+ argon2_cffi
+ cbor
+ cbor2
+ cffi
+ cryptography
+ flatbuffers
+ msgpack
+ passlib
+ py-ubjson
+ pynacl
+ twisted
+ txaio
+ ujson
+ zope_interface
+ ];
- checkInputs = [ mock pytest ];
- checkPhase = ''
- runHook preCheck
- USE_TWISTED=true py.test $out
- runHook postCheck
+ checkInputs = [
+ mock
+ pytest-asyncio
+ pytestCheckHook
+ ];
+
+ postPatch = ''
+ substituteInPlace setup.py \
+ --replace "pytest>=2.8.6,<3.3.0" "pytest"
'';
- # Tests do no seem to be compatible yet with pytest 5.1
- # https://github.com/crossbario/autobahn-python/issues/1235
- doCheck = false;
+ preCheck = ''
+ # Run asyncio tests (requires twisted)
+ export USE_ASYNCIO=1
+ '';
+
+ pytestFlagsArray = [ "--pyargs autobahn" ];
+
+ pythonImportsCheck = [ "autobahn" ];
meta = with lib; {
- description = "WebSocket and WAMP in Python for Twisted and asyncio.";
- homepage = "https://crossbar.io/autobahn";
- license = licenses.mit;
+ description = "WebSocket and WAMP in Python for Twisted and asyncio";
+ homepage = "https://crossbar.io/autobahn";
+ license = licenses.mit;
maintainers = with maintainers; [ nand0p ];
};
}
diff --git a/pkgs/development/python-modules/cffi/default.nix b/pkgs/development/python-modules/cffi/default.nix
index afd9cfdc2950..92899ed85e58 100644
--- a/pkgs/development/python-modules/cffi/default.nix
+++ b/pkgs/development/python-modules/cffi/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, buildPythonPackage, isPyPy, fetchPypi, libffi, pycparser, pytest }:
+{ lib, stdenv, buildPythonPackage, isPyPy, fetchPypi, libffi, pycparser, pytestCheckHook }:
if isPyPy then null else buildPythonPackage rec {
pname = "cffi";
@@ -11,8 +11,9 @@ if isPyPy then null else buildPythonPackage rec {
outputs = [ "out" "dev" ];
- propagatedBuildInputs = [ libffi pycparser ];
- checkInputs = [ pytest ];
+ buildInputs = [ libffi ];
+
+ propagatedBuildInputs = [ pycparser ];
# On Darwin, the cffi tests want to hit libm a lot, and look for it in a global
# impure search path. It's obnoxious how much repetition there is, and how difficult
@@ -33,9 +34,8 @@ if isPyPy then null else buildPythonPackage rec {
"-Wno-unused-command-line-argument -Wno-unreachable-code";
doCheck = !stdenv.hostPlatform.isMusl && !stdenv.isDarwin; # TODO: Investigate
- checkPhase = ''
- py.test -k "not test_char_pointer_conversion"
- '';
+
+ checkInputs = [ pytestCheckHook ];
meta = with lib; {
maintainers = with maintainers; [ domenkozar lnl7 ];
diff --git a/pkgs/development/python-modules/datatable/default.nix b/pkgs/development/python-modules/datatable/default.nix
index c5271e473e3e..60eb0df1d09d 100644
--- a/pkgs/development/python-modules/datatable/default.nix
+++ b/pkgs/development/python-modules/datatable/default.nix
@@ -39,7 +39,7 @@ buildPythonPackage rec {
checkInputs = [ docutils pytestCheckHook ];
LLVM = llvm;
- NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-isystem ${libcxx}/include/c++/v1";
+ NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-isystem ${lib.getDev libcxx}/include/c++/v1";
pytestFlagsArray = let
# ini file (not included in tarball) required to change python_files setting,
diff --git a/pkgs/development/python-modules/django/2.nix b/pkgs/development/python-modules/django/2.nix
index 991c353df179..e0d3cd12f8fd 100644
--- a/pkgs/development/python-modules/django/2.nix
+++ b/pkgs/development/python-modules/django/2.nix
@@ -6,13 +6,13 @@
buildPythonPackage rec {
pname = "Django";
- version = "2.2.20";
+ version = "2.2.22";
disabled = !isPy3k;
src = fetchPypi {
inherit pname version;
- sha256 = "0r3a6gbhwngxl172yy6n0sq5knibl2vxc0wbk1g8licfbzfgjs95";
+ sha256 = "db2214db1c99017cbd971e58824e6f424375154fe358afc30e976f5b99fc6060";
};
patches = lib.optional withGdal
diff --git a/pkgs/development/python-modules/django/3.nix b/pkgs/development/python-modules/django/3.nix
index 62ca390eac5b..321582946b3b 100644
--- a/pkgs/development/python-modules/django/3.nix
+++ b/pkgs/development/python-modules/django/3.nix
@@ -13,13 +13,13 @@
buildPythonPackage rec {
pname = "Django";
- version = "3.2";
+ version = "3.2.2";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
- sha256 = "179qdxa438fnycnnf1j5z6359h1kbp2q7djf01v5jrr26xjgkw11";
+ sha256 = "0a1d195ad65c52bf275b8277b3d49680bd1137a5f55039a806f25f6b9752ce3d";
};
patches = lib.optional withGdal
diff --git a/pkgs/development/python-modules/dnspython/1.nix b/pkgs/development/python-modules/dnspython/1.nix
index 30f280a5029e..5ff02c043380 100644
--- a/pkgs/development/python-modules/dnspython/1.nix
+++ b/pkgs/development/python-modules/dnspython/1.nix
@@ -1,4 +1,8 @@
-{ buildPythonPackage, fetchPypi, lib, pythonOlder }:
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pythonOlder
+}:
buildPythonPackage rec {
pname = "dnspython";
@@ -12,11 +16,11 @@ buildPythonPackage rec {
# needs networking for some tests
doCheck = false;
+ pythonImportsCheck = [ "dns" ];
- meta = {
- description = "A DNS toolkit for Python 3.x";
+ meta = with lib; {
+ description = "A DNS toolkit for Python";
homepage = "http://www.dnspython.org";
- # BSD-like, check https://www.dnspython.org/LICENSE for details
- license = lib.licenses.free;
+ license = with licenses; [ isc ];
};
}
diff --git a/pkgs/development/python-modules/dnspython/default.nix b/pkgs/development/python-modules/dnspython/default.nix
index afb85fb61f57..56e69aac0443 100644
--- a/pkgs/development/python-modules/dnspython/default.nix
+++ b/pkgs/development/python-modules/dnspython/default.nix
@@ -1,4 +1,8 @@
-{ buildPythonPackage, fetchPypi, lib, pythonOlder }:
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pythonOlder
+}:
buildPythonPackage rec {
pname = "dnspython";
@@ -13,11 +17,11 @@ buildPythonPackage rec {
# needs networking for some tests
doCheck = false;
+ pythonImportsCheck = [ "dns" ];
- meta = {
- description = "A DNS toolkit for Python 3.x";
+ meta = with lib; {
+ description = "A DNS toolkit for Python";
homepage = "http://www.dnspython.org";
- # BSD-like, check https://www.dnspython.org/LICENSE for details
- license = lib.licenses.free;
+ license = with licenses; [ isc ];
};
}
diff --git a/pkgs/development/python-modules/dotmap/default.nix b/pkgs/development/python-modules/dotmap/default.nix
new file mode 100644
index 000000000000..cb5f032a6f26
--- /dev/null
+++ b/pkgs/development/python-modules/dotmap/default.nix
@@ -0,0 +1,30 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+ pname = "dotmap";
+ version = "1.3.23";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "0hy88kzzb7zhxfr7iyvl6rhmvz02538pbna7zypaard4a88bbbka";
+ };
+
+ checkInputs = [
+ pytestCheckHook
+ ];
+
+ pytestFlagsArray = [ "dotmap/test.py" ];
+
+ pythonImportsCheck = [ "dotmap" ];
+
+ meta = with lib; {
+ description = "Python for dot-access dictionaries";
+ homepage = "https://github.com/drgrib/dotmap";
+ license = with licenses; [ mit ];
+ maintainers = with maintainers; [ fab ];
+ };
+}
diff --git a/pkgs/development/python-modules/enaml/default.nix b/pkgs/development/python-modules/enaml/default.nix
index 1102443884f7..8896c5c706a6 100644
--- a/pkgs/development/python-modules/enaml/default.nix
+++ b/pkgs/development/python-modules/enaml/default.nix
@@ -5,7 +5,7 @@
, ply
, kiwisolver
, qtpy
-, sip
+, sip_4
, cppy
, bytecode
}:
@@ -44,7 +44,7 @@ buildPythonPackage rec {
ply
kiwisolver
qtpy
- sip
+ sip_4
cppy
bytecode
];
diff --git a/pkgs/development/python-modules/flask-appbuilder/default.nix b/pkgs/development/python-modules/flask-appbuilder/default.nix
index 6e98f6e80ac5..e2c077162b14 100644
--- a/pkgs/development/python-modules/flask-appbuilder/default.nix
+++ b/pkgs/development/python-modules/flask-appbuilder/default.nix
@@ -6,6 +6,7 @@
, colorama
, click
, email_validator
+, fetchpatch
, flask
, flask-babel
, flask_login
@@ -20,21 +21,27 @@
, python-dateutil
, prison
, pyjwt
+, pyyaml
, sqlalchemy-utils
}:
buildPythonPackage rec {
pname = "flask-appbuilder";
- version = "3.1.1";
+ version = "3.2.3";
src = fetchPypi {
pname = "Flask-AppBuilder";
inherit version;
- sha256 = "076b020b0ba125339a2e710e74eab52648cde2b18599f7cb0fa1eada9bbb648c";
+ sha256 = "sha256-+ZYrn2LnVORyYsnZtsH3JX+4XbGgAZZ/Eh6O5gUP+y4=";
};
- checkInputs = [
- nose
+ patches = [
+ (fetchpatch {
+ name = "flask_jwt_extended-and-pyjwt-patch";
+ url = "https://github.com/dpgaspar/Flask-AppBuilder/commit/7097a7b133f27c78d2b54d2a46e4a4c24478a066.patch";
+ sha256 = "sha256-ZpY8+2Hoz3z01GVtw2OIbQcsmAwa7iwilFWzgcGhY1w=";
+ includes = [ "flask_appbuilder/security/manager.py" "setup.py" ];
+ })
];
propagatedBuildInputs = [
@@ -56,22 +63,23 @@ buildPythonPackage rec {
python-dateutil
prison
pyjwt
+ pyyaml
sqlalchemy-utils
];
postPatch = ''
substituteInPlace setup.py \
- --replace "apispec[yaml]>=3.3, <4" "apispec" \
- --replace "Flask-Login>=0.3, <0.5" "Flask-Login" \
- --replace "Flask-Babel>=1, <2" "Flask-Babel" \
- --replace "marshmallow-sqlalchemy>=0.22.0, <0.24.0" "marshmallow-sqlalchemy" \
- --replace "prison>=0.1.3, <1.0.0" "prison"
+ --replace "apispec[yaml]>=3.3, <4" "apispec[yaml] >=3.3, <5" \
+ --replace "Flask-Login>=0.3, <0.5" "Flask-Login >=0.3, <0.6" \
+ --replace "Flask-Babel>=1, <2" "Flask-Babel >=1, <3" \
+ --replace "marshmallow-sqlalchemy>=0.22.0, <0.24.0" "marshmallow-sqlalchemy >=0.22.0, <0.25.0"
'';
-
# majority of tests require network access or mongo
doCheck = false;
+ pythonImportsCheck = [ "flask_appbuilder" ];
+
meta = with lib; {
description = "Simple and rapid application development framework, built on top of Flask";
homepage = "https://github.com/dpgaspar/flask-appbuilder/";
diff --git a/pkgs/development/python-modules/gst-python/default.nix b/pkgs/development/python-modules/gst-python/default.nix
index ea89f7214c63..a391d993cf0c 100644
--- a/pkgs/development/python-modules/gst-python/default.nix
+++ b/pkgs/development/python-modules/gst-python/default.nix
@@ -14,7 +14,7 @@
buildPythonPackage rec {
pname = "gst-python";
- version = "1.18.0";
+ version = "1.18.4";
format = "other";
@@ -22,7 +22,7 @@ buildPythonPackage rec {
src = fetchurl {
url = "${meta.homepage}/src/gst-python/${pname}-${version}.tar.xz";
- sha256 = "0ifx2s2j24sj2w5jm7cxyg1kinnhbxiz4x0qp3gnsjlwbawfigvn";
+ sha256 = "13h9qzfz8s1gyj2ar9q2gf5346sgdv6jv8hj7aw0hpl2gs5f0s6b";
};
# Python 2.x is not supported.
diff --git a/pkgs/development/python-modules/hyperlink/default.nix b/pkgs/development/python-modules/hyperlink/default.nix
index ad56de86782b..21927683b18b 100644
--- a/pkgs/development/python-modules/hyperlink/default.nix
+++ b/pkgs/development/python-modules/hyperlink/default.nix
@@ -1,4 +1,10 @@
-{ lib, buildPythonPackage, fetchPypi, isPy27, idna, typing ? null }:
+{ lib
+, buildPythonPackage
+, fetchPypi
+, isPy27
+, idna
+, typing ? null
+}:
buildPythonPackage rec {
pname = "hyperlink";
@@ -6,7 +12,7 @@ buildPythonPackage rec {
src = fetchPypi {
inherit pname version;
- sha256 = "427af957daa58bc909471c6c40f74c5450fa123dd093fc53efd2e91d2705a56b";
+ sha256 = "0sx50lkivsfjxx9zr4yh7l9gll2l9kvl0v0w8w4wk2x5v9bzjyj2";
};
propagatedBuildInputs = [ idna ]
@@ -14,6 +20,7 @@ buildPythonPackage rec {
meta = with lib; {
description = "A featureful, correct URL for Python";
+ homepage = "https://github.com/python-hyper/hyperlink";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ apeschar ];
diff --git a/pkgs/development/python-modules/iso8601/default.nix b/pkgs/development/python-modules/iso8601/default.nix
index 783f6f1eb305..d0a74f400bba 100644
--- a/pkgs/development/python-modules/iso8601/default.nix
+++ b/pkgs/development/python-modules/iso8601/default.nix
@@ -1,7 +1,7 @@
{ lib
, buildPythonPackage
, fetchPypi
-, pytest
+, pytestCheckHook
}:
buildPythonPackage rec {
@@ -13,15 +13,18 @@ buildPythonPackage rec {
sha256 = "8aafd56fa0290496c5edbb13c311f78fa3a241f0853540da09d9363eae3ebd79";
};
- checkInputs = [ pytest ];
+ checkInputs = [
+ pytestCheckHook
+ ];
- checkPhase = ''
- py.test iso8601
- '';
+ pytestFlagsArray = [ "iso8601" ];
- meta = {
- homepage = "https://bitbucket.org/micktwomey/pyiso8601/";
+ pythonImportsCheck = [ "iso8601" ];
+
+ meta = with lib; {
description = "Simple module to parse ISO 8601 dates";
- maintainers = with lib.maintainers; [ phreedom ];
+ homepage = "https://pyiso8601.readthedocs.io/";
+ license = with licenses; [ mit ];
+ maintainers = with maintainers; [ fab ];
};
}
diff --git a/pkgs/development/python-modules/johnnycanencrypt/default.nix b/pkgs/development/python-modules/johnnycanencrypt/default.nix
index 460b0cddf616..d2d4719dab4b 100644
--- a/pkgs/development/python-modules/johnnycanencrypt/default.nix
+++ b/pkgs/development/python-modules/johnnycanencrypt/default.nix
@@ -39,7 +39,7 @@ buildPythonPackage rec {
cargoSha256 = "0ifvpdizcdp2c5x2x2j1bhhy5a75q0pk7a63dmh52mlpmh45fy6r";
- LIBCLANG_PATH = llvmPackages.libclang + "/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
propagatedBuildInputs = [
requests
diff --git a/pkgs/development/python-modules/kiwisolver/1_1.nix b/pkgs/development/python-modules/kiwisolver/1_1.nix
index 0702e3518e01..762b5bc0b7b3 100644
--- a/pkgs/development/python-modules/kiwisolver/1_1.nix
+++ b/pkgs/development/python-modules/kiwisolver/1_1.nix
@@ -14,7 +14,7 @@ buildPythonPackage rec {
sha256 = "53eaed412477c836e1b9522c19858a8557d6e595077830146182225613b11a75";
};
- NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
+ NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
# Does not include tests
doCheck = false;
diff --git a/pkgs/development/python-modules/kiwisolver/default.nix b/pkgs/development/python-modules/kiwisolver/default.nix
index d4d62787092b..2b157494f919 100644
--- a/pkgs/development/python-modules/kiwisolver/default.nix
+++ b/pkgs/development/python-modules/kiwisolver/default.nix
@@ -15,7 +15,7 @@ buildPythonPackage rec {
sha256 = "950a199911a8d94683a6b10321f9345d5a3a8433ec58b217ace979e18f16e248";
};
- NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
+ NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
nativeBuildInputs = [
cppy
diff --git a/pkgs/development/python-modules/libarcus/default.nix b/pkgs/development/python-modules/libarcus/default.nix
index edea85876a84..a48d70c544c3 100644
--- a/pkgs/development/python-modules/libarcus/default.nix
+++ b/pkgs/development/python-modules/libarcus/default.nix
@@ -1,5 +1,5 @@
{ lib, buildPythonPackage, python, fetchFromGitHub
-, cmake, sip, protobuf, pythonOlder }:
+, cmake, sip_4, protobuf, pythonOlder }:
buildPythonPackage rec {
pname = "libarcus";
@@ -15,7 +15,7 @@ buildPythonPackage rec {
disabled = pythonOlder "3.4.0";
- propagatedBuildInputs = [ sip ];
+ propagatedBuildInputs = [ sip_4 ];
nativeBuildInputs = [ cmake ];
buildInputs = [ protobuf ];
diff --git a/pkgs/development/python-modules/libsavitar/default.nix b/pkgs/development/python-modules/libsavitar/default.nix
index f6aa1b378f58..7ecd09160fff 100644
--- a/pkgs/development/python-modules/libsavitar/default.nix
+++ b/pkgs/development/python-modules/libsavitar/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildPythonPackage, python, pythonOlder, fetchFromGitHub, cmake, sip }:
+{ lib, buildPythonPackage, python, pythonOlder, fetchFromGitHub, cmake, sip_4 }:
buildPythonPackage rec {
pname = "libsavitar";
@@ -18,7 +18,7 @@ buildPythonPackage rec {
nativeBuildInputs = [ cmake ];
- propagatedBuildInputs = [ sip ];
+ propagatedBuildInputs = [ sip_4 ];
disabled = pythonOlder "3.4.0";
diff --git a/pkgs/development/python-modules/llvmlite/default.nix b/pkgs/development/python-modules/llvmlite/default.nix
index b5e6847a9f0c..c7d2221a22e2 100644
--- a/pkgs/development/python-modules/llvmlite/default.nix
+++ b/pkgs/development/python-modules/llvmlite/default.nix
@@ -33,7 +33,7 @@ buildPythonPackage rec {
'';
# Set directory containing llvm-config binary
preConfigure = ''
- export LLVM_CONFIG=${llvm}/bin/llvm-config
+ export LLVM_CONFIG=${llvm.dev}/bin/llvm-config
'';
checkPhase = ''
${python.executable} runtests.py
diff --git a/pkgs/development/python-modules/matplotlib/2.nix b/pkgs/development/python-modules/matplotlib/2.nix
index 2c929d9a694e..a6ee1a3bade7 100644
--- a/pkgs/development/python-modules/matplotlib/2.nix
+++ b/pkgs/development/python-modules/matplotlib/2.nix
@@ -1,24 +1,16 @@
-{ lib, stdenv, fetchPypi, python, buildPythonPackage, pycairo, backports_functools_lru_cache
+{ lib, stdenv, fetchPypi, writeText, python, buildPythonPackage, pycairo, backports_functools_lru_cache
, which, cycler, dateutil, nose, numpy, pyparsing, sphinx, tornado, kiwisolver
, freetype, libpng, pkg-config, mock, pytz, pygobject3, gobject-introspection, functools32, subprocess32
, fetchpatch
-, enableGhostscript ? false, ghostscript ? null, gtk3
+, enableGhostscript ? false, ghostscript, gtk3
, enableGtk3 ? false, cairo
# darwin has its own "MacOSX" backend
-, enableTk ? !stdenv.isDarwin, tcl ? null, tk ? null, tkinter ? null, libX11 ? null
+, enableTk ? !stdenv.isDarwin, tcl, tk, tkinter, libX11
, enableQt ? false, pyqt4
, Cocoa
, pythonOlder
}:
-assert enableGhostscript -> ghostscript != null;
-assert enableTk -> (tcl != null)
- && (tk != null)
- && (tkinter != null)
- && (libX11 != null)
- ;
-assert enableQt -> pyqt4 != null;
-
buildPythonPackage rec {
version = "2.2.3";
pname = "matplotlib";
@@ -54,7 +46,10 @@ buildPythonPackage rec {
++ lib.optionals enableQt [ pyqt4 ]
++ lib.optionals python.isPy2 [ functools32 subprocess32 ];
- setup_cfg = ./setup.cfg;
+ passthru.config = {
+ directories = { basedirlist = "."; };
+ };
+ setup_cfg = writeText "setup.cfg" (lib.generators.toINI {} passthru.config);
preBuild = ''
cp "$setup_cfg" ./setup.cfg
'';
diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix
index 4be4189f8c7a..7364920cba22 100644
--- a/pkgs/development/python-modules/matplotlib/default.nix
+++ b/pkgs/development/python-modules/matplotlib/default.nix
@@ -1,33 +1,25 @@
-{ lib, stdenv, fetchPypi, python, buildPythonPackage, isPy3k, pycairo, backports_functools_lru_cache
+{ lib, stdenv, fetchPypi, writeText, python, buildPythonPackage, isPy3k, pycairo, backports_functools_lru_cache
, which, cycler, dateutil, nose, numpy, pyparsing, sphinx, tornado, kiwisolver
-, freetype, libpng, pkg-config, mock, pytz, pygobject3, gobject-introspection
+, freetype, qhull, libpng, pkg-config, mock, pytz, pygobject3, gobject-introspection
, certifi, pillow
-, enableGhostscript ? true, ghostscript ? null, gtk3
+, enableGhostscript ? true, ghostscript, gtk3
, enableGtk3 ? false, cairo
# darwin has its own "MacOSX" backend
-, enableTk ? !stdenv.isDarwin, tcl ? null, tk ? null, tkinter ? null, libX11 ? null
-, enableQt ? false, pyqt5 ? null
+, enableTk ? !stdenv.isDarwin, tcl, tk, tkinter, libX11
+, enableQt ? false, pyqt5
, Cocoa
, pythonOlder
}:
-assert enableGhostscript -> ghostscript != null;
-assert enableTk -> (tcl != null)
- && (tk != null)
- && (tkinter != null)
- && (libX11 != null)
- ;
-assert enableQt -> pyqt5 != null;
-
buildPythonPackage rec {
- version = "3.3.4";
+ version = "3.4.1";
pname = "matplotlib";
disabled = !isPy3k;
src = fetchPypi {
inherit pname version;
- sha256 = "3e477db76c22929e4c6876c44f88d790aacdf3c3f8f3a90cb1975c0bf37825b0";
+ sha256 = "84d4c4f650f356678a5d658a43ca21a41fca13f9b8b00169c0b76e6a6a948908";
};
XDG_RUNTIME_DIR = "/tmp";
@@ -39,13 +31,23 @@ buildPythonPackage rec {
++ lib.optional stdenv.isDarwin [ Cocoa ];
propagatedBuildInputs =
- [ cycler dateutil numpy pyparsing tornado freetype kiwisolver
- certifi libpng mock pytz pillow ]
+ [ cycler dateutil numpy pyparsing tornado freetype qhull
+ kiwisolver certifi libpng mock pytz pillow ]
++ lib.optionals enableGtk3 [ cairo pycairo gtk3 gobject-introspection pygobject3 ]
++ lib.optionals enableTk [ tcl tk tkinter libX11 ]
++ lib.optionals enableQt [ pyqt5 ];
- setup_cfg = if stdenv.isDarwin then ./setup-darwin.cfg else ./setup.cfg;
+ passthru.config = {
+ directories = { basedirlist = "."; };
+ libs = {
+ system_freetype = true;
+ system_qhull = true;
+ } // lib.optionalAttrs stdenv.isDarwin {
+ # LTO not working in darwin stdenv, see #19312
+ enable_lto = false;
+ };
+ };
+ setup_cfg = writeText "setup.cfg" (lib.generators.toINI {} passthru.config);
preBuild = ''
cp "$setup_cfg" ./setup.cfg
'';
diff --git a/pkgs/development/python-modules/matplotlib/setup-darwin.cfg b/pkgs/development/python-modules/matplotlib/setup-darwin.cfg
deleted file mode 100644
index f6463d9c574a..000000000000
--- a/pkgs/development/python-modules/matplotlib/setup-darwin.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-[directories]
-basedirlist = .
-
-[libs]
-system_freetype = true
-# LTO not working in darwin stdenv, see #19312
-enable_lto = false
diff --git a/pkgs/development/python-modules/matplotlib/setup.cfg b/pkgs/development/python-modules/matplotlib/setup.cfg
deleted file mode 100644
index 6a7738627651..000000000000
--- a/pkgs/development/python-modules/matplotlib/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[directories]
-basedirlist = .
-
-[libs]
-system_freetype = true
diff --git a/pkgs/development/python-modules/meshtastic/default.nix b/pkgs/development/python-modules/meshtastic/default.nix
new file mode 100644
index 000000000000..c8a9d78e7c1b
--- /dev/null
+++ b/pkgs/development/python-modules/meshtastic/default.nix
@@ -0,0 +1,57 @@
+{ lib
+, buildPythonPackage
+, dotmap
+, fetchPypi
+, pexpect
+, protobuf
+, pygatt
+, pypubsub
+, pyqrcode
+, pyserial
+, pythonOlder
+, tabulate
+, timeago
+}:
+
+buildPythonPackage rec {
+ pname = "meshtastic";
+ version = "1.2.30";
+ disabled = pythonOlder "3.6";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "1kjflc2jwnsgxyr2zx1gyykhak9fsgy6hxaxlggsz5sw9b8rdrby";
+ };
+
+ propagatedBuildInputs = [
+ dotmap
+ pexpect
+ protobuf
+ pygatt
+ pypubsub
+ pyqrcode
+ pyserial
+ tabulate
+ timeago
+ ];
+
+ postPatch = ''
+ # https://github.com/meshtastic/Meshtastic-python/pull/87
+ substituteInPlace setup.py \
+ --replace 'with open("README.md", "r") as fh:' "" \
+ --replace "long_description = fh.read()" "" \
+ --replace "long_description=long_description," 'long_description="",'
+ '';
+
+ # Project only provides PyPI releases which don't contain the tests
+ # https://github.com/meshtastic/Meshtastic-python/issues/86
+ doCheck = false;
+ pythonImportsCheck = [ "meshtastic" ];
+
+ meta = with lib; {
+ description = "Python API for talking to Meshtastic devices";
+ homepage = "https://meshtastic.github.io/Meshtastic-python/";
+ license = with licenses; [ asl20 ];
+ maintainers = with maintainers; [ fab ];
+ };
+}
diff --git a/pkgs/development/python-modules/numba/default.nix b/pkgs/development/python-modules/numba/default.nix
index 211e9d6185f6..c49a4105abe9 100644
--- a/pkgs/development/python-modules/numba/default.nix
+++ b/pkgs/development/python-modules/numba/default.nix
@@ -22,7 +22,7 @@ buildPythonPackage rec {
sha256 = "55c11d7edbba2ba715f2b56f5294cad55cfd87bff98e2627c3047c2d5cc52d16";
};
- NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
+ NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
propagatedBuildInputs = [ numpy llvmlite setuptools ];
pythonImportsCheck = [ "numba" ];
diff --git a/pkgs/development/python-modules/pandas/2.nix b/pkgs/development/python-modules/pandas/2.nix
index 936a3db296ec..8af4094b0cfb 100644
--- a/pkgs/development/python-modules/pandas/2.nix
+++ b/pkgs/development/python-modules/pandas/2.nix
@@ -59,7 +59,7 @@ buildPythonPackage rec {
# For OSX, we need to add a dependency on libcxx, which provides
# `complex.h` and other libraries that pandas depends on to build.
postPatch = lib.optionalString stdenv.isDarwin ''
- cpp_sdk="${libcxx}/include/c++/v1";
+ cpp_sdk="${lib.getDev libcxx}/include/c++/v1";
echo "Adding $cpp_sdk to the setup.py common_include variable"
substituteInPlace setup.py \
--replace "['pandas/src/klib', 'pandas/src']" \
diff --git a/pkgs/development/python-modules/pandas/default.nix b/pkgs/development/python-modules/pandas/default.nix
index 7fd551e192c9..f3505e3c9a6a 100644
--- a/pkgs/development/python-modules/pandas/default.nix
+++ b/pkgs/development/python-modules/pandas/default.nix
@@ -77,7 +77,7 @@ buildPythonPackage rec {
# For OSX, we need to add a dependency on libcxx, which provides
# `complex.h` and other libraries that pandas depends on to build.
postPatch = lib.optionalString stdenv.isDarwin ''
- cpp_sdk="${libcxx}/include/c++/v1";
+ cpp_sdk="${lib.getDev libcxx}/include/c++/v1";
echo "Adding $cpp_sdk to the setup.py common_include variable"
substituteInPlace setup.py \
--replace "['pandas/src/klib', 'pandas/src']" \
diff --git a/pkgs/development/python-modules/poppler-qt5/default.nix b/pkgs/development/python-modules/poppler-qt5/default.nix
index 94d86f7b7133..4a9fdfa42620 100644
--- a/pkgs/development/python-modules/poppler-qt5/default.nix
+++ b/pkgs/development/python-modules/poppler-qt5/default.nix
@@ -4,7 +4,7 @@
, isPy3k
, fetchPypi
, pythonPackages
-, sip_5
+, sip
, qtbase
, qmake
, pyqt5
@@ -34,7 +34,7 @@ buildPythonPackage rec {
];
buildInputs = [ qtbase.dev poppler pyqt-builder ];
- nativeBuildInputs = [ pkg-config qmake sip_5 ];
+ nativeBuildInputs = [ pkg-config qmake sip ];
propagatedBuildInputs = [ pyqt5.dev ];
format = "pyproject";
@@ -46,7 +46,7 @@ buildPythonPackage rec {
[tool.sip.bindings.Poppler-Qt5]
include-dirs = ["${poppler.dev}/include/poppler"]
- tags = ["${sip_5.platform_tag}"]
+ tags = ["${sip.platform_tag}"]
EOF
'';
diff --git a/pkgs/development/python-modules/prison/default.nix b/pkgs/development/python-modules/prison/default.nix
index 941da2bf9afd..95a79ea1896b 100644
--- a/pkgs/development/python-modules/prison/default.nix
+++ b/pkgs/development/python-modules/prison/default.nix
@@ -7,13 +7,13 @@
buildPythonPackage rec {
pname = "prison";
- version = "0.1.2";
+ version = "0.1.3";
src = fetchFromGitHub {
owner = "betodealmeida";
repo = "python-rison";
rev = version;
- sha256 = "14vb468iznf9416z993bbqihywp9ibyslw5vp67wfr200zyxjwak";
+ sha256 = "sha256-qor40vUQeTdlO3vwug3GGNX5vkNaF0H7EWlRdsY4bvc=";
};
propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/py-cpuinfo/default.nix b/pkgs/development/python-modules/py-cpuinfo/default.nix
index f9e276b3bb5f..12b9668f1edd 100644
--- a/pkgs/development/python-modules/py-cpuinfo/default.nix
+++ b/pkgs/development/python-modules/py-cpuinfo/default.nix
@@ -1,7 +1,6 @@
{ lib
, stdenv
, fetchFromGitHub
-, fetchpatch
, buildPythonPackage
, pytestCheckHook
, sysctl
@@ -9,28 +8,15 @@
buildPythonPackage rec {
pname = "py-cpuinfo";
- version = "7.0.0";
+ version = "8.0.0";
src = fetchFromGitHub {
owner = "workhorsy";
repo = pname;
rev = "v${version}";
- sha256 = "10qfaibyb2syiwiyv74l7d97vnmlk079qirgnw3ncklqjs0s3gbi";
+ sha256 = "sha256-Mgzj1HTasUNHeHMVwV6d+TeyVqnBNUwCJ1EC3kfovf8=";
};
- patches = [
- # Make it detect Apple Silicon, remove after https://github.com/workhorsy/py-cpuinfo/pull/161 is merged.
- (fetchpatch {
- url = "https://github.com/workhorsy/py-cpuinfo/commit/54c32da6678f9d75ec5acf4534056cdc85c2a04d.patch";
- sha256 = "sha256-3R46KrpACAQ1V0CQtz48V5mQXxvplUQrXnACtiE8WqY=";
- })
- # Continuation of the patch above
- (fetchpatch {
- url = "https://github.com/workhorsy/py-cpuinfo/commit/0d00f4b99750f292c85ff23e1039ea9489cb7ec8.patch";
- sha256 = "sha256-mHoXoCAEG2v3xpQppRFWzSvhYCp5i9CZkbEgtiLVzMs=";
- })
- ];
-
checkInputs = [
pytestCheckHook
];
@@ -42,17 +28,19 @@ buildPythonPackage rec {
--replace "_run_and_get_stdout(['sysctl'" "_run_and_get_stdout(['${sysctl}/bin/sysctl'"
'';
- meta = {
- description = "Get CPU info with pure Python 2 & 3";
+ pythonImportsCheck = [ "cpuinfo" ];
+
+ meta = with lib; {
+ description = "Get CPU info with pure Python";
longDescription = ''
Py-cpuinfo gets CPU info with pure Python and should work without any
extra programs or libraries, beyond what your OS provides. It does not
require any compilation (C/C++, assembly, etc.) to use and works with
- Python 2 and 3.
+ Python.
'';
- inherit (src.meta) homepage;
+ homepage = "https://github.com/workhorsy/py-cpuinfo";
changelog = "https://github.com/workhorsy/py-cpuinfo/blob/v${version}/ChangeLog";
- license = lib.licenses.mit;
- maintainers = with lib.maintainers; [ costrouc ];
+ license = licenses.mit;
+ maintainers = with maintainers; [ costrouc ];
};
}
diff --git a/pkgs/development/python-modules/py-ubjson/default.nix b/pkgs/development/python-modules/py-ubjson/default.nix
new file mode 100644
index 000000000000..4efa2b8b6fdb
--- /dev/null
+++ b/pkgs/development/python-modules/py-ubjson/default.nix
@@ -0,0 +1,32 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+ pname = "py-ubjson";
+ version = "0.16.1";
+
+ src = fetchFromGitHub {
+ owner = "Iotic-Labs";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1frn97xfa88zrfmpnvdk1pc03yihlchhph99bhjayvzlfcrhm5v3";
+ };
+
+ checkInputs = [
+ pytestCheckHook
+ ];
+
+ pytestFlagsArray = [ "test/test.py" ];
+
+ pythonImportsCheck = [ "ubjson" ];
+
+ meta = with lib; {
+ description = "Universal Binary JSON draft-12 serializer for Python";
+ homepage = "https://github.com/Iotic-Labs/py-ubjson";
+ license = with licenses; [ asl20 ];
+ maintainers = with maintainers; [ fab ];
+ };
+}
diff --git a/pkgs/development/python-modules/py3exiv2/default.nix b/pkgs/development/python-modules/py3exiv2/default.nix
index 236a38c7e69a..59d0cdb7299f 100644
--- a/pkgs/development/python-modules/py3exiv2/default.nix
+++ b/pkgs/development/python-modules/py3exiv2/default.nix
@@ -13,7 +13,7 @@ buildPythonPackage rec {
buildInputs = [ exiv2 boost ];
# work around python distutils compiling C++ with $CC (see issue #26709)
- NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
+ NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
meta = with lib; {
homepage = "https://launchpad.net/py3exiv2";
diff --git a/pkgs/development/python-modules/pycurl/default.nix b/pkgs/development/python-modules/pycurl/default.nix
index fe62d1be1ea1..e202d1928f21 100644
--- a/pkgs/development/python-modules/pycurl/default.nix
+++ b/pkgs/development/python-modules/pycurl/default.nix
@@ -1,11 +1,12 @@
-{ buildPythonPackage
+{ lib
+, buildPythonPackage
, isPyPy
, fetchPypi
, pythonOlder
, curl
, openssl
, bottle
-, pytest
+, pytestCheckHook
, nose
, flaky
}:
@@ -20,6 +21,11 @@ buildPythonPackage rec {
sha256 = "8301518689daefa53726b59ded6b48f33751c383cf987b0ccfbbc4ed40281325";
};
+ preConfigure = ''
+ substituteInPlace setup.py --replace '--static-libs' '--libs'
+ export PYCURL_SSL_LIBRARY=openssl
+ '';
+
buildInputs = [
curl
openssl.out
@@ -31,34 +37,48 @@ buildPythonPackage rec {
checkInputs = [
bottle
- pytest
+ pytestCheckHook
nose
flaky
];
- # skip impure or flakey tests
- # See also:
- # * https://github.com/NixOS/nixpkgs/issues/77304
- checkPhase = ''
- HOME=$TMPDIR pytest tests -k "not test_ssl_in_static_libs \
- and not test_keyfunction \
- and not test_keyfunction_bogus_return \
- and not test_libcurl_ssl_gnutls \
- and not test_libcurl_ssl_nss \
- and not test_libcurl_ssl_openssl" \
- --ignore=tests/getinfo_test.py \
- --ignore=tests/memory_mgmt_test.py \
- --ignore=tests/multi_memory_mgmt_test.py \
- --ignore=tests/multi_timer_test.py
+ pytestFlagsArray = [
+ # don't pick up the tests directory below examples/
+ "tests"
+ ];
+
+ preCheck = ''
+ export HOME=$TMPDIR
'';
- preConfigure = ''
- substituteInPlace setup.py --replace '--static-libs' '--libs'
- export PYCURL_SSL_LIBRARY=openssl
- '';
+ disabledTests = [
+ # libcurl stopped passing the reason phrase from the HTTP status line
+ # https://github.com/pycurl/pycurl/issues/679
+ "test_failonerror"
+ "test_failonerror_status_line_invalid_utf8_python3"
+ # bottle>=0.12.17 escapes utf8 properly, so these test don't work anymore
+ # https://github.com/pycurl/pycurl/issues/669
+ "test_getinfo_content_type_invalid_utf8_python3"
+ "test_getinfo_cookie_invalid_utf8_python3"
+ "test_getinfo_raw_content_type_invalid_utf8"
+ "test_getinfo_raw_cookie_invalid_utf8"
+ # tests that require network access
+ "test_keyfunction"
+ "test_keyfunction_bogus_return"
+ # OSError: tests/fake-curl/libcurl/with_openssl.so: cannot open shared object file: No such file or directory
+ "test_libcurl_ssl_openssl"
+ # OSError: tests/fake-curl/libcurl/with_nss.so: cannot open shared object file: No such file or directory
+ "test_libcurl_ssl_nss"
+ # OSError: tests/fake-curl/libcurl/with_gnutls.so: cannot open shared object file: No such file or directory
+ "test_libcurl_ssl_gnutls"
+ # AssertionError: assert 'crypto' in ['curl']
+ "test_ssl_in_static_libs"
+ ];
- meta = {
+ meta = with lib; {
homepage = "http://pycurl.sourceforge.net/";
description = "Python wrapper for libcurl";
+ license = licenses.lgpl2Only;
+ maintainers = with maintainers; [];
};
}
diff --git a/pkgs/development/python-modules/pygatt/default.nix b/pkgs/development/python-modules/pygatt/default.nix
new file mode 100644
index 000000000000..9d596e17236e
--- /dev/null
+++ b/pkgs/development/python-modules/pygatt/default.nix
@@ -0,0 +1,48 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, mock
+, nose
+, pexpect
+, pyserial
+, pytestCheckHook
+, pythonOlder
+}:
+
+buildPythonPackage rec {
+ pname = "pygatt";
+ version = "4.0.5";
+ disabled = pythonOlder "3.5";
+
+ src = fetchFromGitHub {
+ owner = "peplin";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1zdfxidiw0l8n498sy0l33n90lz49n25x889cx6jamjr7frlcihd";
+ };
+
+ propagatedBuildInputs = [
+ pexpect
+ pyserial
+ ];
+
+ checkInputs = [
+ mock
+ nose
+ pytestCheckHook
+ ];
+
+ postPatch = ''
+ # Not support for Python < 3.4
+ substituteInPlace setup.py --replace "'enum-compat'" ""
+ '';
+
+ pythonImportsCheck = [ "pygatt" ];
+
+ meta = with lib; {
+ description = "Python wrapper the BGAPI for accessing Bluetooth LE Devices";
+ homepage = "https://github.com/peplin/pygatt";
+ license = with licenses; [ asl20 mit ];
+ maintainers = with maintainers; [ fab ];
+ };
+}
diff --git a/pkgs/development/python-modules/pykdl/default.nix b/pkgs/development/python-modules/pykdl/default.nix
index 674a43f5f3e0..9a0431b2b859 100644
--- a/pkgs/development/python-modules/pykdl/default.nix
+++ b/pkgs/development/python-modules/pykdl/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, toPythonModule, fetchpatch, cmake, orocos-kdl, python, sip }:
+{ lib, stdenv, toPythonModule, fetchpatch, cmake, orocos-kdl, python, sip_4 }:
toPythonModule (stdenv.mkDerivation {
pname = "pykdl";
@@ -18,7 +18,7 @@ toPythonModule (stdenv.mkDerivation {
nativeBuildInputs = [ cmake ];
buildInputs = [ orocos-kdl ];
- propagatedBuildInputs = [ python sip ];
+ propagatedBuildInputs = [ python sip_4 ];
meta = with lib; {
description = "Kinematics and Dynamics Library (Python bindings)";
diff --git a/pkgs/development/python-modules/pynest2d/default.nix b/pkgs/development/python-modules/pynest2d/default.nix
index 7ca72293382d..f3b5b9ba6854 100644
--- a/pkgs/development/python-modules/pynest2d/default.nix
+++ b/pkgs/development/python-modules/pynest2d/default.nix
@@ -1,5 +1,5 @@
{ lib, buildPythonPackage, fetchFromGitHub, python3, cmake
-, pythonOlder, libnest2d, sip, clipper }:
+, pythonOlder, libnest2d, sip_4, clipper }:
buildPythonPackage rec {
version = "4.8.0";
@@ -13,7 +13,7 @@ buildPythonPackage rec {
sha256 = "18dn92vgr4gvf9scfh93yg9bwrhdjvq62di08rpi7pqjrrvq2nvp";
};
- propagatedBuildInputs = [ libnest2d sip clipper ];
+ propagatedBuildInputs = [ libnest2d sip_4 clipper ];
nativeBuildInputs = [ cmake ];
CLIPPER_PATH = "${clipper.out}";
diff --git a/pkgs/development/python-modules/pyqt-builder/default.nix b/pkgs/development/python-modules/pyqt-builder/default.nix
index d7f15d966b37..d371fd7bcee7 100644
--- a/pkgs/development/python-modules/pyqt-builder/default.nix
+++ b/pkgs/development/python-modules/pyqt-builder/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchPypi, buildPythonPackage, packaging, sip_5 }:
+{ lib, fetchPypi, buildPythonPackage, packaging, sip }:
buildPythonPackage rec {
pname = "pyqt-builder";
@@ -10,7 +10,7 @@ buildPythonPackage rec {
sha256 = "0g51yak53zzjs4gpq65i01cmpz7w8cjny9wfyxlgr2vi0wag107v";
};
- propagatedBuildInputs = [ packaging sip_5 ];
+ propagatedBuildInputs = [ packaging sip ];
pythonImportsCheck = [ "pyqtbuild" ];
diff --git a/pkgs/development/python-modules/pyqt/4.x.nix b/pkgs/development/python-modules/pyqt/4.x.nix
index 3427438b8a26..2652b5eb00b3 100644
--- a/pkgs/development/python-modules/pyqt/4.x.nix
+++ b/pkgs/development/python-modules/pyqt/4.x.nix
@@ -1,13 +1,13 @@
-{ lib, stdenv, fetchurl, buildPythonPackage, python, dbus-python, sip, qt4, pkg-config, lndir, dbus, makeWrapper }:
+{ lib, stdenv, fetchurl, buildPythonPackage, python, dbus-python, sip_4, qt4, pkg-config, lndir, dbus, makeWrapper }:
buildPythonPackage rec {
pname = "PyQt-x11-gpl";
- version = "4.12";
+ version = "4.12.3";
format = "other";
src = fetchurl {
url = "mirror://sourceforge/pyqt/PyQt4_gpl_x11-${version}.tar.gz";
- sha256 = "1nw8r88a5g2d550yvklawlvns8gd5slw53yy688kxnsa65aln79w";
+ sha256 = "0wnlasg62rm5d39nq1yw4namcx2ivxgzl93r5f2vb9s0yaz5l3x0";
};
postPatch = ''
@@ -45,7 +45,7 @@ buildPythonPackage rec {
nativeBuildInputs = [ pkg-config lndir makeWrapper qt4 ];
buildInputs = [ qt4 dbus ];
- propagatedBuildInputs = [ sip ];
+ propagatedBuildInputs = [ sip_4 ];
postInstall = ''
for i in $out/bin/*; do
diff --git a/pkgs/development/python-modules/pyqt/5.x.nix b/pkgs/development/python-modules/pyqt/5.x.nix
index 6e4b4d37f289..2671b27a6307 100644
--- a/pkgs/development/python-modules/pyqt/5.x.nix
+++ b/pkgs/development/python-modules/pyqt/5.x.nix
@@ -16,9 +16,9 @@ let
inherit (pythonPackages) buildPythonPackage python isPy3k dbus-python enum34;
sip = if isPy3k then
- pythonPackages.sip_5
+ pythonPackages.sip
else
- (pythonPackages.sip.override { sip-module = "PyQt5.sip"; }).overridePythonAttrs(oldAttrs: {
+ (pythonPackages.sip_4.override { sip-module = "PyQt5.sip"; }).overridePythonAttrs(oldAttrs: {
# If we install sip in another folder, then we need to create a __init__.py as well
# if we want to be able to import it with Python 2.
# Python 3 could rely on it being an implicit namespace package, however,
diff --git a/pkgs/development/python-modules/python-engineio/3.nix b/pkgs/development/python-modules/python-engineio/3.nix
index e4c71782f990..5deeec0bb573 100644
--- a/pkgs/development/python-modules/python-engineio/3.nix
+++ b/pkgs/development/python-modules/python-engineio/3.nix
@@ -13,6 +13,7 @@
, websocket_client
, websockets
, pytestCheckHook
+, pythonAtLeast
}:
buildPythonPackage rec {
@@ -63,5 +64,6 @@ buildPythonPackage rec {
homepage = "https://github.com/miguelgrinberg/python-engineio/";
license = with licenses; [ mit ];
maintainers = with maintainers; [ graham33 ];
+ broken = stdenv.isDarwin && (pythonAtLeast "3.9"); # See https://github.com/miguelgrinberg/python-socketio/issues/567
};
}
diff --git a/pkgs/development/python-modules/qscintilla-qt5/default.nix b/pkgs/development/python-modules/qscintilla-qt5/default.nix
index dcbe213966f9..05c12c1c62af 100644
--- a/pkgs/development/python-modules/qscintilla-qt5/default.nix
+++ b/pkgs/development/python-modules/qscintilla-qt5/default.nix
@@ -10,7 +10,7 @@ buildPythonPackage {
src = qscintilla.src;
format = "other";
- nativeBuildInputs = [ sip qtbase ];
+ nativeBuildInputs = [ sip_4 qtbase ];
buildInputs = [ qscintilla ];
propagatedBuildInputs = [ pyqt5 ];
@@ -40,7 +40,7 @@ buildPythonPackage {
--qsci-libdir=${qscintilla}/lib \
--pyqt-sipdir=${pyqt5}/share/sip/PyQt5 \
--qsci-sipdir=$out/share/sip/PyQt5 \
- --sip-incdir=${sip}/include
+ --sip-incdir=${sip_4}/include
'';
meta = with lib; {
diff --git a/pkgs/development/python-modules/random2/default.nix b/pkgs/development/python-modules/random2/default.nix
index 6845a5707da7..cb84d32ef414 100644
--- a/pkgs/development/python-modules/random2/default.nix
+++ b/pkgs/development/python-modules/random2/default.nix
@@ -2,6 +2,7 @@
, buildPythonPackage
, fetchPypi
, isPyPy
+, fetchpatch
}:
buildPythonPackage rec {
@@ -15,6 +16,14 @@ buildPythonPackage rec {
sha256 = "34ad30aac341039872401595df9ab2c9dc36d0b7c077db1cea9ade430ed1c007";
};
+ patches = [
+ # Patch test suite for python >= 3.9
+ (fetchpatch {
+ url = "https://github.com/strichter/random2/pull/3/commits/1bac6355d9c65de847cc445d782c466778b94fbd.patch";
+ sha256 = "064137pg1ilv3f9r10123lqbqz45070jca8pjjyp6gpfd0yk74pi";
+ })
+ ];
+
meta = with lib; {
homepage = "http://pypi.python.org/pypi/random2";
description = "Python 3 compatible Python 2 `random` Module";
diff --git a/pkgs/development/python-modules/sip/4.x.nix b/pkgs/development/python-modules/sip/4.x.nix
new file mode 100644
index 000000000000..5334d1196344
--- /dev/null
+++ b/pkgs/development/python-modules/sip/4.x.nix
@@ -0,0 +1,44 @@
+{ lib, fetchurl, buildPythonPackage, python, isPyPy, sip-module ? "sip" }:
+
+buildPythonPackage rec {
+ pname = sip-module;
+ version = "4.19.25";
+ format = "other";
+
+ disabled = isPyPy;
+
+ src = fetchurl {
+ url = "https://www.riverbankcomputing.com/static/Downloads/sip/${version}/sip-${version}.tar.gz";
+ sha256 = "04a23cgsnx150xq86w1z44b6vr2zyazysy9mqax0fy346zlr77dk";
+ };
+
+ configurePhase = ''
+ ${python.executable} ./configure.py \
+ --sip-module ${sip-module} \
+ -d $out/${python.sitePackages} \
+ -b $out/bin -e $out/include
+ '';
+
+ enableParallelBuilding = true;
+
+ installCheckPhase = let
+ modules = [
+ sip-module
+ "sipconfig"
+ ];
+ imports = lib.concatMapStrings (module: "import ${module};") modules;
+ in ''
+ echo "Checking whether modules can be imported..."
+ PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH ${python.interpreter} -c "${imports}"
+ '';
+
+ doCheck = true;
+
+ meta = with lib; {
+ description = "Creates C++ bindings for Python modules";
+ homepage = "http://www.riverbankcomputing.co.uk/";
+ license = licenses.gpl2Plus;
+ maintainers = with maintainers; [ lovek323 sander ];
+ platforms = platforms.all;
+ };
+}
diff --git a/pkgs/development/python-modules/sip/5.x.nix b/pkgs/development/python-modules/sip/5.x.nix
deleted file mode 100644
index c15589b77bc8..000000000000
--- a/pkgs/development/python-modules/sip/5.x.nix
+++ /dev/null
@@ -1,40 +0,0 @@
-{ lib, stdenv, fetchPypi, buildPythonPackage, packaging, toml }:
-
-buildPythonPackage rec {
- pname = "sip";
- version = "5.5.0";
-
- src = fetchPypi {
- pname = "sip";
- inherit version;
- sha256 = "1idaivamp1jvbbai9yzv471c62xbqxhaawccvskaizihkd0lq0jx";
- };
-
- propagatedBuildInputs = [ packaging toml ];
-
- # There aren't tests
- doCheck = false;
-
- pythonImportsCheck = [ "sipbuild" ];
-
- # FIXME: Why isn't this detected automatically?
- # Needs to be specified in pyproject.toml, e.g.:
- # [tool.sip.bindings.MODULE]
- # tags = [PLATFORM_TAG]
- platform_tag =
- if stdenv.targetPlatform.isLinux then
- "WS_X11"
- else if stdenv.targetPlatform.isDarwin then
- "WS_MACX"
- else if stdenv.targetPlatform.isWindows then
- "WS_WIN"
- else
- throw "unsupported platform";
-
- meta = with lib; {
- description = "Creates C++ bindings for Python modules";
- homepage = "http://www.riverbankcomputing.co.uk/";
- license = licenses.gpl3Only;
- maintainers = with maintainers; [ eduardosm ];
- };
-}
diff --git a/pkgs/development/python-modules/sip/default.nix b/pkgs/development/python-modules/sip/default.nix
index 0027c1c0ba5f..c15589b77bc8 100644
--- a/pkgs/development/python-modules/sip/default.nix
+++ b/pkgs/development/python-modules/sip/default.nix
@@ -1,44 +1,40 @@
-{ lib, fetchurl, buildPythonPackage, python, isPyPy, sip-module ? "sip" }:
+{ lib, stdenv, fetchPypi, buildPythonPackage, packaging, toml }:
buildPythonPackage rec {
- pname = sip-module;
- version = "4.19.24";
- format = "other";
+ pname = "sip";
+ version = "5.5.0";
- disabled = isPyPy;
-
- src = fetchurl {
- url = "https://www.riverbankcomputing.com/static/Downloads/sip/${version}/sip-${version}.tar.gz";
- sha256 = "1ra15vb5i9gkg2vdvh16cq9x2mmzw1yi3xphxs8q34q1pf83gkgd";
+ src = fetchPypi {
+ pname = "sip";
+ inherit version;
+ sha256 = "1idaivamp1jvbbai9yzv471c62xbqxhaawccvskaizihkd0lq0jx";
};
- configurePhase = ''
- ${python.executable} ./configure.py \
- --sip-module ${sip-module} \
- -d $out/${python.sitePackages} \
- -b $out/bin -e $out/include
- '';
+ propagatedBuildInputs = [ packaging toml ];
- enableParallelBuilding = true;
+ # There aren't tests
+ doCheck = false;
- installCheckPhase = let
- modules = [
- sip-module
- "sipconfig"
- ];
- imports = lib.concatMapStrings (module: "import ${module};") modules;
- in ''
- echo "Checking whether modules can be imported..."
- PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH ${python.interpreter} -c "${imports}"
- '';
+ pythonImportsCheck = [ "sipbuild" ];
- doCheck = true;
+ # FIXME: Why isn't this detected automatically?
+ # Needs to be specified in pyproject.toml, e.g.:
+ # [tool.sip.bindings.MODULE]
+ # tags = [PLATFORM_TAG]
+ platform_tag =
+ if stdenv.targetPlatform.isLinux then
+ "WS_X11"
+ else if stdenv.targetPlatform.isDarwin then
+ "WS_MACX"
+ else if stdenv.targetPlatform.isWindows then
+ "WS_WIN"
+ else
+ throw "unsupported platform";
meta = with lib; {
description = "Creates C++ bindings for Python modules";
homepage = "http://www.riverbankcomputing.co.uk/";
- license = licenses.gpl2Plus;
- maintainers = with maintainers; [ lovek323 sander ];
- platforms = platforms.all;
+ license = licenses.gpl3Only;
+ maintainers = with maintainers; [ eduardosm ];
};
}
diff --git a/pkgs/development/python-modules/sphinx/default.nix b/pkgs/development/python-modules/sphinx/default.nix
index 1c5cc29f4146..8d6567b3e916 100644
--- a/pkgs/development/python-modules/sphinx/default.nix
+++ b/pkgs/development/python-modules/sphinx/default.nix
@@ -1,24 +1,18 @@
{ lib
, buildPythonPackage
-, fetchPypi
-, pytest
-, simplejson
-, mock
-, glibcLocales
-, html5lib
, pythonOlder
-, enum34
-, python
-, docutils
-, jinja2
-, pygments
-, alabaster
+, fetchFromGitHub
+# propagatedBuildInputs
, Babel
-, snowballstemmer
-, six
-, whoosh
+, alabaster
+, docutils
, imagesize
+, jinja2
+, packaging
+, pygments
, requests
+, setuptools
+, snowballstemmer
, sphinxcontrib-applehelp
, sphinxcontrib-devhelp
, sphinxcontrib-htmlhelp
@@ -26,56 +20,70 @@
, sphinxcontrib-qthelp
, sphinxcontrib-serializinghtml
, sphinxcontrib-websupport
-, typing ? null
-, setuptools
-, packaging
+# check phase
+, html5lib
+, imagemagick
+, pytestCheckHook
+, typed-ast
}:
buildPythonPackage rec {
pname = "sphinx";
- version = "3.3.1";
- src = fetchPypi {
- pname = "Sphinx";
- inherit version;
- sha256 = "1e8d592225447104d1172be415bc2972bd1357e3e12fdc76edf2261105db4300";
- };
- LC_ALL = "en_US.UTF-8";
+ version = "3.5.4";
+ disabled = pythonOlder "3.5";
+
+ src = fetchFromGitHub {
+ owner = "sphinx-doc";
+ repo = pname;
+ rev = "v${version}";
+ sha256 = "1xjii3dl01rq8x2bsxc6zywiy1s7arfgxrg5l8ml54w1748shadd";
+ };
- checkInputs = [ pytest ];
- buildInputs = [ simplejson mock glibcLocales html5lib ] ++ lib.optional (pythonOlder "3.4") enum34;
- # Disable two tests that require network access.
- checkPhase = ''
- cd tests; ${python.interpreter} run.py --ignore py35 -k 'not test_defaults and not test_anchors_ignored'
- '';
propagatedBuildInputs = [
- docutils
- jinja2
- pygments
- alabaster
Babel
+ alabaster
+ docutils
+ imagesize
+ jinja2
packaging
+ pygments
+ requests
setuptools
snowballstemmer
- six
- whoosh
- imagesize
- requests
sphinxcontrib-applehelp
sphinxcontrib-devhelp
sphinxcontrib-htmlhelp
sphinxcontrib-jsmath
sphinxcontrib-qthelp
sphinxcontrib-serializinghtml
+ # extra[docs]
sphinxcontrib-websupport
- ] ++ lib.optional (pythonOlder "3.5") typing;
+ ];
- # Lots of tests. Needs network as well at some point.
- doCheck = false;
+ checkInputs = [
+ imagemagick
+ html5lib
+ pytestCheckHook
+ ] ++ lib.optionals (pythonOlder "3.8") [
+ typed-ast
+ ];
- meta = {
- description = "A tool that makes it easy to create intelligent and beautiful documentation for Python projects";
- homepage = "http://sphinx.pocoo.org/";
- license = lib.licenses.bsd3;
- maintainers = with lib.maintainers; [ nand0p ];
+ disabledTests = [
+ # requires network access
+ "test_anchors_ignored"
+ "test_defaults"
+ "test_defaults_json"
+ "test_latex_images"
+ ];
+
+ meta = with lib; {
+ description = "Python documentation generator";
+ longDescription = ''
+ A tool that makes it easy to create intelligent and beautiful
+ documentation for Python projects
+ '';
+ homepage = "https://www.sphinx-doc.org";
+ license = licenses.bsd3;
+ maintainers = with maintainers; [ nand0p ];
};
}
diff --git a/pkgs/development/python-modules/timeago/default.nix b/pkgs/development/python-modules/timeago/default.nix
new file mode 100644
index 000000000000..0c2a688f674e
--- /dev/null
+++ b/pkgs/development/python-modules/timeago/default.nix
@@ -0,0 +1,32 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+ pname = "timeago";
+ version = "1.0.15";
+
+ src = fetchFromGitHub {
+ owner = "hustcc";
+ repo = pname;
+ rev = version;
+ sha256 = "03vm7c02l4g2d1x33w382i1psk8i3an7xchk69yinha33fjj1cag";
+ };
+
+ checkInputs = [
+ pytestCheckHook
+ ];
+
+ pytestFlagsArray = [ "test/testcase.py" ];
+
+ pythonImportsCheck = [ "timeago" ];
+
+ meta = with lib; {
+ description = "Python module to format past datetime output";
+ homepage = "https://github.com/hustcc/timeago";
+ license = with licenses; [ mit ];
+ maintainers = with maintainers; [ fab ];
+ };
+}
diff --git a/pkgs/development/python-modules/txaio/default.nix b/pkgs/development/python-modules/txaio/default.nix
index c2f2c9451bdc..fa219a94513d 100644
--- a/pkgs/development/python-modules/txaio/default.nix
+++ b/pkgs/development/python-modules/txaio/default.nix
@@ -1,30 +1,55 @@
-{ lib, buildPythonPackage, fetchPypi, pytest, mock, six, twisted, isPy37, isPy27 }:
+{ lib
+, buildPythonPackage
+, fetchPypi
+, mock
+, pytest-asyncio
+, pytestCheckHook
+, pythonOlder
+, six
+, twisted
+, zope_interface
+}:
buildPythonPackage rec {
pname = "txaio";
version = "21.2.1";
- disabled = isPy27;
+ disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
- sha256 = "7d6f89745680233f1c4db9ddb748df5e88d2a7a37962be174c0fd04c8dba1dc8";
+ sha256 = "sha256-fW+JdFaAIz8cTbndt0jfXojSp6N5Yr4XTA/QTI26Hcg=";
};
- checkInputs = [ pytest mock ];
+ propagatedBuildInputs = [
+ six
+ twisted
+ zope_interface
+ ];
- propagatedBuildInputs = [ six twisted ];
+ checkInputs = [
+ mock
+ pytest-asyncio
+ pytestCheckHook
+ ];
- checkPhase = ''
- py.test -k "not test_sdist"
- '';
+ disabledTests = [
+ # No real value
+ "test_sdist"
+ # Some tests seems out-dated and require additional data
+ "test_as_future"
+ "test_errback"
+ "test_create_future"
+ "test_callback"
+ "test_immediate_result"
+ "test_cancel"
+ ];
- # Needs some fixing
- doCheck = false;
+ pythonImportsCheck = [ "txaio" ];
meta = with lib; {
- description = "Utilities to support code that runs unmodified on Twisted and asyncio.";
- homepage = "https://github.com/crossbario/txaio";
- license = licenses.mit;
+ description = "Utilities to support code that runs unmodified on Twisted and asyncio";
+ homepage = "https://github.com/crossbario/txaio";
+ license = licenses.mit;
maintainers = with maintainers; [ nand0p ];
};
}
diff --git a/pkgs/development/r-modules/generic-builder.nix b/pkgs/development/r-modules/generic-builder.nix
index a10c3628ff83..7201bab40e12 100644
--- a/pkgs/development/r-modules/generic-builder.nix
+++ b/pkgs/development/r-modules/generic-builder.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation ({
lib.optionals stdenv.isDarwin [Cocoa Foundation gfortran];
NIX_CFLAGS_COMPILE =
- lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
+ lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
configurePhase = ''
runHook preConfigure
diff --git a/pkgs/development/tools/analysis/include-what-you-use/default.nix b/pkgs/development/tools/analysis/include-what-you-use/default.nix
index db1cf9c6ead5..6cc9409e94ad 100644
--- a/pkgs/development/tools/analysis/include-what-you-use/default.nix
+++ b/pkgs/development/tools/analysis/include-what-you-use/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, cmake, llvmPackages, python2 }:
+{ lib, stdenv, fetchurl, cmake, llvmPackages, python3 }:
stdenv.mkDerivation rec {
pname = "include-what-you-use";
@@ -10,8 +10,8 @@ stdenv.mkDerivation rec {
url = "${meta.homepage}/downloads/${pname}-${version}.src.tar.gz";
};
- buildInputs = with llvmPackages; [ clang-unwrapped llvm python2 ];
- nativeBuildInputs = [ cmake ];
+ nativeBuildInputs = with llvmPackages; [ cmake llvm.dev llvm clang-unwrapped python3];
+ buildInputs = [ llvmPackages.libclang ];
cmakeFlags = [ "-DIWYU_LLVM_ROOT_PATH=${llvmPackages.clang-unwrapped}" ];
diff --git a/pkgs/development/tools/boomerang/default.nix b/pkgs/development/tools/boomerang/default.nix
index 4ac9159520fb..b37ab9a2d3f9 100644
--- a/pkgs/development/tools/boomerang/default.nix
+++ b/pkgs/development/tools/boomerang/default.nix
@@ -1,8 +1,11 @@
-{ mkDerivation, lib, fetchFromGitHub, cmake, qtbase, capstone, bison, flex }:
+{ mkDerivation, lib, fetchFromGitHub, fetchpatch, cmake, qtbase, capstone, bison, flex }:
mkDerivation rec {
pname = "boomerang";
version = "0.5.2";
+ # NOTE: When bumping version beyond 0.5.2, you likely need to remove
+ # the cstdint.patch below. The patch does a fix that has already
+ # been done upstream but is not yet part of a release
src = fetchFromGitHub {
owner = "BoomerangDecompiler";
@@ -13,6 +16,13 @@ mkDerivation rec {
nativeBuildInputs = [ cmake bison flex ];
buildInputs = [ qtbase capstone ];
+ patches = [
+ (fetchpatch {
+ name = "include-missing-cstdint.patch";
+ url = "https://github.com/BoomerangDecompiler/boomerang/commit/3342b0eac6b7617d9913226c06c1470820593e74.patch";
+ sha256 = "sha256-941IydcV3mqj7AWvXTM6GePW5VgawEcL0wrBCXqeWvc=";
+ })
+ ];
meta = with lib; {
homepage = "https://github.com/BoomerangDecompiler/boomerang";
diff --git a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix
index 5b20ece76803..fd29102b7e58 100644
--- a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix
+++ b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix
@@ -371,7 +371,7 @@ stdenv.mkDerivation rec {
# libcxx includes aren't added by libcxx hook
# https://github.com/NixOS/nixpkgs/pull/41589
- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${libcxx}/include/c++/v1"
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${lib.getDev libcxx}/include/c++/v1"
# don't use system installed Xcode to run clang, use Nix clang instead
sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
diff --git a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix
index 31dbc2779cde..7fc034220163 100644
--- a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix
+++ b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix
@@ -388,7 +388,7 @@ stdenv.mkDerivation rec {
# libcxx includes aren't added by libcxx hook
# https://github.com/NixOS/nixpkgs/pull/41589
- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${libcxx}/include/c++/v1"
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${lib.getDev libcxx}/include/c++/v1"
# don't use system installed Xcode to run clang, use Nix clang instead
sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
diff --git a/pkgs/development/tools/castxml/default.nix b/pkgs/development/tools/castxml/default.nix
index f3d9b74181aa..a233288a28e8 100644
--- a/pkgs/development/tools/castxml/default.nix
+++ b/pkgs/development/tools/castxml/default.nix
@@ -1,7 +1,6 @@
{ lib
, stdenv
, fetchFromGitHub
-, clang-unwrapped
, cmake
, libclang
, libffi
@@ -26,22 +25,22 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
cmake
- llvm
+ llvm.dev
] ++ lib.optionals (withManual || withHTML) [
sphinx
];
cmakeFlags = [
- "-DCLANG_RESOURCE_DIR=${clang-unwrapped}/lib/clang/${lib.getVersion clang-unwrapped}/"
+ "-DCLANG_RESOURCE_DIR=${libclang.dev}/"
"-DSPHINX_HTML=${if withHTML then "ON" else "OFF"}"
"-DSPHINX_MAN=${if withManual then "ON" else "OFF"}"
];
buildInputs = [
- clang-unwrapped
libffi
libxml2
zlib
+ libclang
];
propagatedBuildInputs = [
diff --git a/pkgs/development/tools/documentation/gtk-doc/default.nix b/pkgs/development/tools/documentation/gtk-doc/default.nix
index a735bdb5fed4..5951c8d71fd5 100644
--- a/pkgs/development/tools/documentation/gtk-doc/default.nix
+++ b/pkgs/development/tools/documentation/gtk-doc/default.nix
@@ -32,6 +32,13 @@ python3.pkgs.buildPythonApplication rec {
passthru.respect_xml_catalog_files_var_patch
];
+ strictDeps = true;
+
+ depsBuildBuild = [
+ python3
+ pkg-config
+ ];
+
nativeBuildInputs = [
pkg-config
gettext
diff --git a/pkgs/development/tools/irony-server/default.nix b/pkgs/development/tools/irony-server/default.nix
index 2f8afb176e6e..2a7a7b1a16a3 100644
--- a/pkgs/development/tools/irony-server/default.nix
+++ b/pkgs/development/tools/irony-server/default.nix
@@ -4,7 +4,7 @@ stdenv.mkDerivation {
pname = "irony-server";
inherit (irony) src version;
- nativeBuildInputs = [ cmake ];
+ nativeBuildInputs = [ cmake llvmPackages.llvm.dev ];
buildInputs = [ llvmPackages.libclang llvmPackages.llvm ];
dontUseCmakeBuildDir = true;
diff --git a/pkgs/development/tools/luaformatter/default.nix b/pkgs/development/tools/luaformatter/default.nix
index 991f1a377170..ee34886a063e 100644
--- a/pkgs/development/tools/luaformatter/default.nix
+++ b/pkgs/development/tools/luaformatter/default.nix
@@ -2,13 +2,13 @@
stdenv.mkDerivation rec {
pname = "luaformatter";
- version = "1.3.4";
+ version = "1.3.5";
src = fetchFromGitHub {
owner = "koihik";
repo = "luaformatter";
rev = version;
- sha256 = "163190g37r6npg5k5mhdwckdhv9nwy2gnfp5jjk8p0s6cyvydqjw";
+ sha256 = "sha256-TMo6zRfhVAXVh0tIC0PecaJCKr0ev45jOKm2+reTtS4=";
fetchSubmodules = true;
};
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index 995f3f7430cc..8042655a859d 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -107,8 +107,7 @@ stdenv.mkDerivation {
hardeningDisable = [ "format" "pie" ];
- # TODO(@Ericson2314): Always pass "--target" and always targetPrefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
configureFlags =
(if enableShared then [ "--enable-shared" "--disable-static" ]
@@ -126,7 +125,19 @@ stdenv.mkDerivation {
# RUNPATH instead of RPATH on binaries. This is important because
# RUNPATH can be overriden using LD_LIBRARY_PATH at runtime.
"--enable-new-dtags"
- ] ++ lib.optionals gold [ "--enable-gold" "--enable-plugins" ];
+
+ # force target prefix. Some versions of binutils will make it empty
+ # if `--host` and `--target` are too close, even if Nixpkgs thinks
+ # the platforms are different (e.g. because not all the info makes
+ # the `config`). Other versions of binutils will always prefix if
+ # `--target` is passed, even if `--host` and `--target` are the same.
+ # The easiest thing for us to do is not leave it to chance, and force
+ # the program prefix to be what we want it to be.
+ "--program-prefix=${targetPrefix}"
+ ] ++ lib.optionals gold [
+ "--enable-gold"
+ "--enable-plugins"
+ ];
doCheck = false; # fails
diff --git a/pkgs/development/tools/misc/ccls/default.nix b/pkgs/development/tools/misc/ccls/default.nix
index 06f3723509f5..986363b83ef3 100644
--- a/pkgs/development/tools/misc/ccls/default.nix
+++ b/pkgs/development/tools/misc/ccls/default.nix
@@ -12,8 +12,8 @@ stdenv.mkDerivation rec {
sha256 = "sha256-jipSipgD0avd7XODlpxnqjHK3s6nacaxbIQIddix7X8=";
};
- nativeBuildInputs = [ cmake ];
- buildInputs = with llvmPackages; [ clang-unwrapped llvm rapidjson ];
+ nativeBuildInputs = [ cmake llvmPackages.llvm.dev ];
+ buildInputs = with llvmPackages; [ libclang llvm rapidjson ];
cmakeFlags = [ "-DCCLS_VERSION=${version}" ];
diff --git a/pkgs/development/tools/misc/creduce/default.nix b/pkgs/development/tools/misc/creduce/default.nix
index 75234fde6ca5..0ae900060b97 100644
--- a/pkgs/development/tools/misc/creduce/default.nix
+++ b/pkgs/development/tools/misc/creduce/default.nix
@@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl, cmake, makeWrapper
-, llvm, clang-unwrapped
+, llvm, libclang
, flex
, zlib
, perlPackages
@@ -15,12 +15,12 @@ stdenv.mkDerivation rec {
sha256 = "1b833z0g1hich68kzbkpfc26xb8w2phfl5savy8c6ir9ihwy1a8w";
};
- nativeBuildInputs = [ cmake makeWrapper ];
+ nativeBuildInputs = [ cmake makeWrapper llvm.dev ];
buildInputs = [
# Ensure stdenv's CC is on PATH before clang-unwrapped
stdenv.cc
# Actual deps:
- llvm clang-unwrapped
+ llvm libclang
flex zlib
] ++ (with perlPackages; [ perl ExporterLite FileWhich GetoptTabular RegexpCommon TermReadKey ]);
diff --git a/pkgs/development/tools/misc/cvise/default.nix b/pkgs/development/tools/misc/cvise/default.nix
index fe33df530cfd..e24c133e8b90 100644
--- a/pkgs/development/tools/misc/cvise/default.nix
+++ b/pkgs/development/tools/misc/cvise/default.nix
@@ -1,5 +1,5 @@
{ lib, buildPythonApplication, fetchFromGitHub, cmake, flex
-, clang-unwrapped, llvm, unifdef
+, libclang, llvm, unifdef
, pebble, psutil, pytestCheckHook, pytest-flake8
}:
@@ -19,8 +19,8 @@ buildPythonApplication rec {
./unifdef.patch
];
- nativeBuildInputs = [ cmake flex ];
- buildInputs = [ clang-unwrapped llvm unifdef ];
+ nativeBuildInputs = [ cmake flex llvm.dev ];
+ buildInputs = [ libclang llvm llvm.dev unifdef ];
propagatedBuildInputs = [ pebble psutil ];
checkInputs = [ pytestCheckHook pytest-flake8 unifdef ];
diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix
index 6f9237789750..66d4e8bc0572 100644
--- a/pkgs/development/tools/misc/gdb/default.nix
+++ b/pkgs/development/tools/misc/gdb/default.nix
@@ -61,8 +61,7 @@ stdenv.mkDerivation rec {
NIX_CFLAGS_COMPILE = "-Wno-format-nonliteral";
- # TODO(@Ericson2314): Always pass "--target" and always prefix.
- configurePlatforms = [ "build" "host" ] ++ lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target";
+ configurePlatforms = [ "build" "host" "target" ];
# GDB have to be built out of tree.
preConfigure = ''
@@ -72,6 +71,13 @@ stdenv.mkDerivation rec {
configureScript = "../configure";
configureFlags = with lib; [
+ # Set the program prefix to the current targetPrefix.
+ # This ensures that the prefix always conforms to
+ # nixpkgs' expectations instead of relying on the build
+ # system which only receives `config` which is merely a
+ # subset of the platform description.
+ "--program-prefix=${targetPrefix}"
+
"--enable-targets=all" "--enable-64-bit-bfd"
"--disable-install-libbfd"
"--disable-shared" "--enable-static"
diff --git a/pkgs/development/tools/parinfer-rust/default.nix b/pkgs/development/tools/parinfer-rust/default.nix
index ce733b8a2131..2cd8ff4fdb63 100644
--- a/pkgs/development/tools/parinfer-rust/default.nix
+++ b/pkgs/development/tools/parinfer-rust/default.nix
@@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [ llvmPackages.clang ];
buildInputs = [ llvmPackages.libclang ];
- LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
+ LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
postInstall = ''
mkdir -p $out/share/kak/autoload/plugins
diff --git a/pkgs/development/tools/parsing/re2c/default.nix b/pkgs/development/tools/parsing/re2c/default.nix
index ebba9903a47c..a945f3bdde03 100644
--- a/pkgs/development/tools/parsing/re2c/default.nix
+++ b/pkgs/development/tools/parsing/re2c/default.nix
@@ -1,48 +1,16 @@
-{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "re2c";
- version = "1.3";
+ version = "2.1.1";
src = fetchFromGitHub {
owner = "skvadrik";
repo = "re2c";
rev = version;
- sha256 = "0aqlf2h6i2m3dq11dkq89p4w4c9kp4x66s5rhp84gmpz5xqv1x5h";
+ sha256 = "06nvk5sf4vrc2bvpj4vi2xwy3ggv548sn530drz5fi67nhzgga26";
};
- patches = [
- (fetchpatch {
- name = "CVE-2018-21232-part1.patch";
- url = "https://github.com/skvadrik/re2c/commit/fd634998f813340768c333cdad638498602856e5.patch";
- sha256 = "1blyg5lyhqd4ymisih65xl0g36ig71ijia4skkkd59rdvj78aiw6";
- })
-
- (fetchpatch {
- name = "CVE-2018-21232-part2.patch";
- url = "https://github.com/skvadrik/re2c/commit/7b5643476bd99c994c4f51b8143f942982d85521.patch";
- sha256 = "0rhmgqrinpk49r9x75ygrs14lz72aw5ad5kr6qp9bdyl8gs082qp";
- })
-
- (fetchpatch {
- name = "CVE-2018-21232-part3.patch";
- url = "https://github.com/skvadrik/re2c/commit/4d9c809355b574f2a58eac119f5e076c48e4d1e2.patch";
- sha256 = "0k86wg9icw1gkqpf7rq2w6xsq4caxw3rc0zfxf39liwa35027rai";
- })
-
- (fetchpatch {
- name = "CVE-2018-21232-part4.patch";
- url = "https://github.com/skvadrik/re2c/commit/89be91f3df00657261870adbc590209fdb2bc405.patch";
- sha256 = "1aygy9va7jwby93chlskwg7z90fn07x5hym0gziwlkx8k900p3a3";
- })
-
- (fetchpatch {
- name = "CVE-2020-11958.patch";
- url = "https://github.com/skvadrik/re2c/commit/c4603ba5ce229db83a2a4fb93e6d4b4e3ec3776a.patch";
- sha256 = "1d95ahxk92g7k87sda9gxgmr3blyfzwd2y7h9jxj8zkd74knd9zh";
- })
- ];
-
nativeBuildInputs = [ autoreconfHook ];
doCheck = true;
@@ -54,7 +22,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "Tool for writing very fast and very flexible scanners";
- homepage = "http://re2c.org";
+ homepage = "https://re2c.org";
license = licenses.publicDomain;
platforms = platforms.all;
maintainers = with maintainers; [ thoughtpolice ];
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
index aa58864fed78..f217aefc2d26 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
@@ -512,7 +512,7 @@ self: super:
# Set directory containing llvm-config binary
preConfigure = ''
- export LLVM_CONFIG=${pkgs.llvm}/bin/llvm-config
+ export LLVM_CONFIG=${pkgs.llvm.dev}/bin/llvm-config
'';
__impureHostDeps = lib.optionals pkgs.stdenv.isDarwin [ "/usr/lib/libm.dylib" ];
diff --git a/pkgs/development/tools/qtcreator/default.nix b/pkgs/development/tools/qtcreator/default.nix
index dc5699ed3739..2b0227407da2 100644
--- a/pkgs/development/tools/qtcreator/default.nix
+++ b/pkgs/development/tools/qtcreator/default.nix
@@ -64,7 +64,7 @@ mkDerivation rec {
# Fix paths to libclang library.
substituteInPlace src/shared/clang/clang_installation.pri \
- --replace 'LIBCLANG_LIBS = -L$${LLVM_LIBDIR}' 'LIBCLANG_LIBS = -L${llvmPackages_8.libclang}/lib' \
+ --replace 'LIBCLANG_LIBS = -L$${LLVM_LIBDIR}' 'LIBCLANG_LIBS = -L${llvmPackages_8.libclang.lib}/lib' \
--replace 'LIBCLANG_LIBS += $${CLANG_LIB}' 'LIBCLANG_LIBS += -lclang' \
--replace 'LIBTOOLING_LIBS = -L$${LLVM_LIBDIR}' 'LIBTOOLING_LIBS = -L${clang_qt_vendor}/lib' \
--replace 'LLVM_CXXFLAGS ~= s,-gsplit-dwarf,' '${lib.concatStringsSep "\n" ["LLVM_CXXFLAGS ~= s,-gsplit-dwarf," " LLVM_CXXFLAGS += -fno-rtti"]}'
diff --git a/pkgs/development/tools/rq/default.nix b/pkgs/development/tools/rq/default.nix
index 4dcc0b315632..c9e78650f607 100644
--- a/pkgs/development/tools/rq/default.nix
+++ b/pkgs/development/tools/rq/default.nix
@@ -20,11 +20,11 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "0c5vwy3c5ji602dj64z6jqvcpi2xff03zvjbnwihb3ydqwnb3v67";
- buildInputs = [ llvmPackages.clang-unwrapped v8 ]
+ buildInputs = [ llvmPackages.libclang v8 ]
++ lib.optionals stdenv.isDarwin [ libiconv ];
configurePhase = ''
- export LIBCLANG_PATH="${llvmPackages.clang-unwrapped}/lib"
+ export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"
export V8_SOURCE="${v8}"
'';
diff --git a/pkgs/development/tools/rtags/default.nix b/pkgs/development/tools/rtags/default.nix
index e5da0ddf59ac..6ecbe058328f 100644
--- a/pkgs/development/tools/rtags/default.nix
+++ b/pkgs/development/tools/rtags/default.nix
@@ -3,8 +3,8 @@
stdenv.mkDerivation rec {
pname = "rtags";
version = "2.38";
- nativeBuildInputs = [ cmake pkg-config ];
- buildInputs = [ llvmPackages.llvm openssl emacs ]
+ nativeBuildInputs = [ cmake pkg-config llvmPackages.llvm.dev ];
+ buildInputs = [ llvmPackages.llvm llvmPackages.libclang openssl emacs ]
++ lib.optionals stdenv.cc.isGNU [ llvmPackages.clang-unwrapped ]
++ lib.optionals stdenv.isDarwin [ apple_sdk.libs.xpc apple_sdk.frameworks.CoreServices ];
diff --git a/pkgs/development/tools/rust/bindgen/default.nix b/pkgs/development/tools/rust/bindgen/default.nix
index 962e8c562c74..9568d8efefc6 100644
--- a/pkgs/development/tools/rust/bindgen/default.nix
+++ b/pkgs/development/tools/rust/bindgen/default.nix
@@ -27,7 +27,7 @@ rustPlatform.buildRustPackage rec {
propagatedBuildInputs = [ clang ]; # to populate NIX_CXXSTDLIB_COMPILE
configurePhase = ''
- export LIBCLANG_PATH="${libclang}/lib"
+ export LIBCLANG_PATH="${libclang.lib}/lib"
'';
postInstall = ''
diff --git a/pkgs/development/tools/rust/cbindgen/default.nix b/pkgs/development/tools/rust/cbindgen/default.nix
index 5dad37d08168..2e3391de94e2 100644
--- a/pkgs/development/tools/rust/cbindgen/default.nix
+++ b/pkgs/development/tools/rust/cbindgen/default.nix
@@ -11,7 +11,7 @@ rustPlatform.buildRustPackage rec {
sha256 = "sha256-S3t1hv/mRn6vwyzT78DPIacqiJV3CnjGdOKsdSyYs8g=";
};
- cargoSha256 = "sha256-uaeJmGEQHVSuILlYlJOHmRWWdN6FPvrHu6CbJyb60MY=";
+ cargoSha256 = "1ycvbdgd50l1nahq63zi9yp3793smkswlwhsqjrmws5b1fqzv9w0";
buildInputs = lib.optional stdenv.isDarwin Security;
diff --git a/pkgs/development/web/nodejs/v12.nix b/pkgs/development/web/nodejs/v12.nix
index 54f4352c53ec..7fad6a020a88 100644
--- a/pkgs/development/web/nodejs/v12.nix
+++ b/pkgs/development/web/nodejs/v12.nix
@@ -1,8 +1,8 @@
-{ callPackage, openssl, icu, python2, lib, stdenv, enableNpm ? true }:
+{ callPackage, icu68, python2, lib, stdenv, enableNpm ? true }:
let
buildNodejs = callPackage ./nodejs.nix {
- inherit openssl icu;
+ icu = icu68;
python = python2;
};
in
diff --git a/pkgs/development/web/nodejs/v14.nix b/pkgs/development/web/nodejs/v14.nix
index 0d48003268c7..535bfab71239 100644
--- a/pkgs/development/web/nodejs/v14.nix
+++ b/pkgs/development/web/nodejs/v14.nix
@@ -1,8 +1,8 @@
-{ callPackage, openssl, python3, lib, stdenv, enableNpm ? true }:
+{ callPackage, icu68, python3, lib, stdenv, enableNpm ? true }:
let
buildNodejs = callPackage ./nodejs.nix {
- inherit openssl;
+ icu = icu68;
python = python3;
};
in
diff --git a/pkgs/development/web/nodejs/v15.nix b/pkgs/development/web/nodejs/v15.nix
index d22c2f213b91..e6903098b302 100644
--- a/pkgs/development/web/nodejs/v15.nix
+++ b/pkgs/development/web/nodejs/v15.nix
@@ -1,8 +1,8 @@
-{ callPackage, openssl, python3, enableNpm ? true }:
+{ callPackage, icu68, python3, enableNpm ? true }:
let
buildNodejs = callPackage ./nodejs.nix {
- inherit openssl;
+ icu = icu68;
python = python3;
};
in
diff --git a/pkgs/misc/drivers/hplip/3.18.5.nix b/pkgs/misc/drivers/hplip/3.18.5.nix
index c62161c96f80..3c2f8fa2a08f 100644
--- a/pkgs/misc/drivers/hplip/3.18.5.nix
+++ b/pkgs/misc/drivers/hplip/3.18.5.nix
@@ -75,7 +75,7 @@ python2Packages.buildPythonApplication {
pygobject2
reportlab
usbutils
- sip
+ sip_4
] ++ lib.optionals withQt5 [
pyqt5
];
diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix
index 6a7eb35ae52b..9fcdbd8c515e 100644
--- a/pkgs/misc/drivers/hplip/default.nix
+++ b/pkgs/misc/drivers/hplip/default.nix
@@ -79,7 +79,7 @@ python3Packages.buildPythonApplication {
pygobject3
reportlab
usbutils
- sip
+ sip_4
dbus-python
] ++ lib.optionals withQt5 [
pyqt5
diff --git a/pkgs/misc/emulators/caprice32/default.nix b/pkgs/misc/emulators/caprice32/default.nix
index 3e20ba616423..6c2932f7e10b 100644
--- a/pkgs/misc/emulators/caprice32/default.nix
+++ b/pkgs/misc/emulators/caprice32/default.nix
@@ -5,6 +5,9 @@ stdenv.mkDerivation rec {
pname = "caprice32";
version = "4.6.0";
+ # NOTE: When bumping version beyond 4.6.0, you likely need to remove
+ # string.patch below. The fix of this patch has already been
+ # done upstream but is not yet part of a release
src = fetchFromGitHub {
repo = "caprice32";
@@ -16,6 +19,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ desktop-file-utils pkg-config ];
buildInputs = [ libpng SDL freetype zlib ];
+ patches = [ ./string.patch ];
+
makeFlags = [
"APP_PATH=${placeholder "out"}/share/caprice32"
"RELEASE=1"
diff --git a/pkgs/misc/emulators/caprice32/string.patch b/pkgs/misc/emulators/caprice32/string.patch
new file mode 100644
index 000000000000..fabbbd80d5d3
--- /dev/null
+++ b/pkgs/misc/emulators/caprice32/string.patch
@@ -0,0 +1,12 @@
+diff --git a/src/configuration.h b/src/configuration.h
+index 34fd690..97fb0e5 100644
+--- a/src/configuration.h
++++ b/src/configuration.h
+@@ -2,6 +2,7 @@
+ #define CONFIGURATION_H
+
+ #include