Merge pull request #154708 from NixOS/staging-next

Staging next 2022-01-12
This commit is contained in:
Jonathan Ringer 2022-01-25 11:54:52 -08:00 committed by GitHub
commit e74ccf2d72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
236 changed files with 2219 additions and 1445 deletions

View File

@ -513,6 +513,12 @@
githubId = 38869148;
name = "Alex Eyre";
};
algorith = {
email = "dries_van_daele@telenet.be";
github = "DriesVanDaele";
githubId = 1141488;
name = "Dries Van Daele";
};
alibabzo = {
email = "alistair.bill@gmail.com";
github = "alibabzo";

View File

@ -356,6 +356,19 @@
loaded.
</para>
</listitem>
<listitem>
<para>
The iputils package, which is installed by default, no longer
provides the legacy tools <literal>tftpd</literal> and
<literal>traceroute6</literal>. More tools
(<literal>ninfod</literal>, <literal>rarpd</literal>, and
<literal>rdisc</literal>) are going to be removed in the next
release. See
<link xlink:href="https://github.com/iputils/iputils/releases/tag/20211215">upstreams
release notes</link> for more details and available
replacements.
</para>
</listitem>
<listitem>
<para>
<literal>services.thelounge.private</literal> was removed in

View File

@ -116,6 +116,12 @@ In addition to numerous new and upgraded packages, this release has the followin
- `idris2` now requires `--package` when using packages `contrib` and `network`, while previously these idris2 packages were automatically loaded.
- The iputils package, which is installed by default, no longer provides the
legacy tools `tftpd` and `traceroute6`. More tools (`ninfod`, `rarpd`, and
`rdisc`) are going to be removed in the next release. See
[upstream's release notes](https://github.com/iputils/iputils/releases/tag/20211215)
for more details and available replacements.
- `services.thelounge.private` was removed in favor of `services.thelounge.public`, to follow with upstream changes.
- `pkgs.docbookrx` was removed since it's unmaintained

View File

@ -1035,7 +1035,7 @@ in
setuid = true;
owner = "root";
group = "root";
source = "${pkgs.pam}/sbin/unix_chkpwd.orig";
source = "${pkgs.pam}/bin/unix_chkpwd";
};
};

View File

@ -55,8 +55,8 @@ let
substituteInPlace $out/dry-activate --subst-var out
chmod u+x $out/activate $out/dry-activate
unset activationScript dryActivationScript
${pkgs.stdenv.shell} -n $out/activate
${pkgs.stdenv.shell} -n $out/dry-activate
${pkgs.stdenv.shellDryRun} $out/activate
${pkgs.stdenv.shellDryRun} $out/dry-activate
cp ${config.system.build.bootStage2} $out/init
substituteInPlace $out/init --subst-var-by systemConfig $out

View File

@ -210,20 +210,14 @@ let
makeJobScript = name: text:
let
scriptName = replaceChars [ "\\" "@" ] [ "-" "_" ] (shellEscape name);
out = pkgs.writeTextFile {
out = (pkgs.writeShellScriptBin scriptName ''
set -e
${text}
'').overrideAttrs (_: {
# The derivation name is different from the script file name
# to keep the script file name short to avoid cluttering logs.
name = "unit-script-${scriptName}";
executable = true;
destination = "/bin/${scriptName}";
text = ''
#!${pkgs.runtimeShell} -e
${text}
'';
checkPhase = ''
${pkgs.stdenv.shell} -n "$out/bin/${scriptName}"
'';
};
});
in "${out}/bin/${scriptName}";
unitConfig = { config, options, ... }: {

View File

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, installShellFiles
, libiconv
, libmpdclient
@ -21,6 +22,14 @@ stdenv.mkDerivation rec {
hash = "sha256-2FjYBfak0IjibuU+CNQ0y9Ei8hTZhynS/BK2DNerhVw=";
};
patches = [
# fix the build with meson 0.60 (https://github.com/MusicPlayerDaemon/mpc/pull/76)
(fetchpatch {
url = "https://github.com/MusicPlayerDaemon/mpc/commit/b656ca4b6c2a0d5b6cebd7f7daa679352f664e0e.patch";
sha256 = "sha256-fjjSlCKxgkz7Em08CaK7+JAzl8YTzLcpGGMz2HJlsVw=";
})
];
buildInputs = [
libmpdclient
]

View File

@ -40,8 +40,6 @@ stdenv.mkDerivation rec {
hicolor-icon-theme
];
mesonFlags = [ "-Dlibreoffice=false" ];
postPatch = ''
chmod +x data/meson_post_install.py
patchShebangs data/meson_post_install.py

View File

@ -80,6 +80,7 @@ stdenv.mkDerivation rec {
desktop. It is the successor to the older Gradio application.
'';
maintainers = with maintainers; [ lasandell ];
broken = true; # incompatible with latest libadwaita
license = licenses.gpl3Plus;
platforms = platforms.linux;
};

View File

@ -16,8 +16,6 @@ stdenv.mkDerivation rec {
buildInputs = [ flac libao libvorbis ncurses opusfile ];
NIX_CFLAGS_COMPILE = "-DNCURSES_INTERNALS";
patches = [ ./gnu-screen.patch ];
postInstall = ''

View File

@ -13,7 +13,6 @@
, curl
, dconf
, libepoxy
, ffmpeg
, fftw
, fftwFloat
, flex
@ -95,7 +94,6 @@ stdenv.mkDerivation rec {
curl
dconf
libepoxy
ffmpeg
fftw
fftwFloat
flex
@ -133,10 +131,9 @@ stdenv.mkDerivation rec {
];
mesonFlags = [
"-Denable_ffmpeg=true"
"-Denable_rtmidi=true"
"-Denable_rtaudio=true"
"-Denable_sdl=true"
"-Drtmidi=enabled"
"-Drtaudio=enabled"
"-Dsdl=enabled"
"-Dcarla=enabled"
"-Dmanpage=true"
# "-Duser_manual=true" # needs sphinx-intl

View File

@ -5,6 +5,7 @@
, appstream-glib
, desktop-file-utils
, fetchurl
, fetchpatch
, flatpak
, gnome
, libgit2-glib
@ -18,7 +19,7 @@
, jsonrpc-glib
, libdazzle
, libpeas
, libportal
, libportal-gtk3
, libxml2
, meson
, ninja
@ -48,6 +49,15 @@ stdenv.mkDerivation rec {
sha256 = "4iUPyOnp8gAsRS5ZUNgmhXNNPESAs1Fnq1CKyHAlCeE=";
};
patches = [
# Fix build with latest libportal
# https://gitlab.gnome.org/GNOME/gnome-builder/-/merge_requests/486
(fetchpatch {
url = "https://gitlab.gnome.org/GNOME/gnome-builder/-/commit/b3bfa0df53a3749c3b73cb6c4bad5cab3fa549a1.patch";
sha256 = "B/uCcYavFvOAPhLHZ4MRNENDd6VytILiGYwDZRUSxTE=";
})
];
nativeBuildInputs = [
appstream-glib
desktop-file-utils
@ -69,7 +79,7 @@ stdenv.mkDerivation rec {
glade
libgit2-glib
libpeas
libportal
libportal-gtk3
vte
gspell
gtk3

View File

@ -1,12 +1,12 @@
{ lib, fetchFromGitHub }:
rec {
version = "8.2.3877";
version = "8.2.4186";
src = fetchFromGitHub {
owner = "vim";
repo = "vim";
rev = "v${version}";
sha256 = "sha256-NqTO2TdhOs63eP7CdWY9U9nbR7No3hqPV5rGhYF9arA=";
sha256 = "0g276mbmq69z7c4kgj59r0azxmx9ih2sd8v83dx2gfph6wgw65ph";
};
enableParallelBuilding = true;

View File

@ -6,7 +6,7 @@
, pkg-config
, libxml2
, gtk3
, libportal
, libportal-gtk3
, wrapGAppsHook
}:
@ -33,12 +33,16 @@ stdenv.mkDerivation rec {
buildInputs = [
gtk3
libportal
libportal-gtk3
];
postPatch = ''
chmod +x meson_install.sh # patchShebangs requires executable file
patchShebangs meson_install.sh
# https://gitlab.gnome.org/World/gcolor3/merge_requests/151
substituteInPlace meson.build --replace "dependency(${"\n"} 'libportal'" "dependency(${"\n"} 'libportal-gtk3'"
substituteInPlace src/gcolor3-color-selection.c --replace "libportal/portal-gtk3.h" "libportal-gtk3/portal-gtk3.h"
'';
meta = with lib; {

View File

@ -4,11 +4,11 @@
stdenv.mkDerivation rec {
pname = "graphicsmagick";
version = "1.3.36";
version = "1.3.37";
src = fetchurl {
url = "mirror://sourceforge/graphicsmagick/GraphicsMagick-${version}.tar.xz";
sha256 = "0ilg6fkppb4avzais1dvi3qf6ln7v3mzj7gjm83w7pwwfpg3ynsx";
sha256 = "sha256-kNwi8ae9JA5MkGWpQJYr8T2kPJm8w2yxEcw8Gg10d9Q=";
};
patches = [

View File

@ -34,7 +34,7 @@ mkDerivation {
];
qtWrapperArgs = [
"--prefix GST_PLUGIN_PATH : ${lib.makeSearchPath "lib/gstreamer-1.0" gst}"
"--prefix GST_PLUGIN_PATH : ${lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" gst}"
];
meta = {

View File

@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
--replace "install_dir: rulesdir" "install_dir: datadir" \
'';
mesonFlags = [
"-Dsystemd=true"
"-Dservice_manager=systemd"
"-Dsample_config=false"
"-Ddebug_tool=false"
];

View File

@ -9,7 +9,7 @@
, itstool
, libadwaita
, librsvg
, meson_0_60
, meson
, ninja
, pkg-config
, poppler_gi
@ -35,7 +35,7 @@ python3.pkgs.buildPythonApplication rec {
glib
gtk4
itstool
meson_0_60
meson
ninja
pkg-config
wrapGAppsHook

View File

@ -17,21 +17,27 @@
stdenv.mkDerivation rec {
pname = "notejot";
version = "3.2.0";
version = "3.3.3"; # make sure to recheck src.rev
src = fetchFromGitHub {
owner = "lainsce";
repo = pname;
rev = version;
hash = "sha256-WyW1tGhO3+OykNa8BRavi93cBMOSBJw0M+0bwQHJOjU=";
# Note from Fedora spec file:
# https://src.fedoraproject.org/rpms/notejot/blob/bbe621cef4d5a2c27eed029063b8e8cfd7c8d400/f/notejot.spec
# Upstream confusingly made several bugfix post-releases of version 3.3.3,
# tagged as 3.4.x, but with prominent notices like "This is still 3.3.3". We
# respect upstreams wishes (and the version numbers inside the source tarball)
# by packaging these releases as 3.3.3 with appropriate snapshot info.
# https://github.com/lainsce/notejot/releases/tag/3.4.9
#
# Note that sometimes upstream don't update their version in meson.build
# (https://github.com/lainsce/notejot/issues/236), always follow the version
# from Fedora Rawhide.
# https://github.com/lainsce/notejot/blob/3.4.9/meson.build#L1
rev = "3.4.9";
hash = "sha256-42k9CAnXAb7Ic580SIa95MDCkCWtso1F+0eD69HX8WI=";
};
patches = [
# build: use gtk4-update-icon-cache
# https://github.com/lainsce/notejot/pull/307
./use-gtk4-update-icon-cache.patch
];
nativeBuildInputs = [
meson
ninja

View File

@ -1,20 +0,0 @@
diff --git a/build-aux/post_install.py b/build-aux/post_install.py
index 1278304..fface6d 100644
--- a/build-aux/post_install.py
+++ b/build-aux/post_install.py
@@ -2,11 +2,13 @@
import os
import subprocess
-schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
+install_prefix = os.environ['MESON_INSTALL_PREFIX']
+icondir = os.path.join(install_prefix, 'share', 'icons', 'hicolor')
+schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas')
if not os.environ.get('DESTDIR'):
print('Compiling gsettings schemas…')
subprocess.call(['glib-compile-schemas', schemadir], shell=False)
print('Rebuilding desktop icons cache...')
- subprocess.call(['gtk-update-icon-cache', '/usr/share/icons/hicolor/'], shell=False)
+ subprocess.call(['gtk4-update-icon-cache', '-qtf', icondir], shell=False)

View File

@ -1,6 +1,6 @@
{ stdenv, lib, fetchFromGitHub, pkg-config, meson, ninja, wayland, pixman, cairo, librsvg, wayland-protocols, wlroots, libxkbcommon, gst_all_1, wrapQtAppsHook, qtbase, qtmultimedia }:
let
gstreamerPath = with gst_all_1; lib.makeSearchPath "lib/gstreamer-1.0" [
gstreamerPath = with gst_all_1; lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" [
gstreamer
gst-plugins-base
gst-plugins-good

View File

@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
xclip notify-osd enchant
] ++ gstBuildInputs;
GST_PLUGIN_SYSTEM_PATH_1_0 = lib.concatMapStringsSep ":" (p: "${p}/lib/gstreamer-1.0") gstBuildInputs;
GST_PLUGIN_SYSTEM_PATH_1_0 = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" gstBuildInputs;
dontWrapGApps = true;
installPhase = ''

View File

@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
done
'';
mesonFlags = [ "-Dwith-lua=lua" "-Dwith-text=true" ];
mesonFlags = [ "-Dwith-lua=lua" "-Dtext-frontend=true" ];
postInstall = ''
wrapProgram $out/bin/hexchat --prefix PYTHONPATH : "$PYTHONPATH"

View File

@ -1,5 +1,6 @@
{ lib
, fetchFromGitHub
, fetchpatch
, meson
, python3Packages
, ninja
@ -25,6 +26,13 @@ python3Packages.buildPythonApplication rec {
sha256 = "0b2slm7kjq6q8c7v4m7aqc8m1ynjxn3bl7445srpv1xc0dilq403";
};
patches = [
# fix build with meson 0.60 (https://github.com/getting-things-gnome/gtg/pull/729)
(fetchpatch {
url = "https://github.com/getting-things-gnome/gtg/commit/1809d10663ae3d8f69c04138b66f9b4e66ee14f6.patch";
sha256 = "sha256-bYr5PAsuvcSqTf0vaJj2APtuBrwHdhXJxtXoAb7CfGk=";
})
];
nativeBuildInputs = [
meson

View File

@ -0,0 +1,49 @@
{ buildPythonApplication
, lib
, fetchFromGitHub
, poetry
, termcolor
, questionary
, colorama
, decli
, tomlkit
, jinja2
, pyyaml
, argcomplete
, typing-extensions
}:
buildPythonApplication rec {
pname = "commitizen";
version = "2.20.3";
src = fetchFromGitHub {
owner = "commitizen-tools";
repo = pname;
rev = "v${version}";
sha256 = "sha256-rAm2GTRxZIHQmn/FM0IwwH/2h+oOvzGmeVr5xkvD/zA=";
};
format = "pyproject";
nativeBuildInputs = [ poetry ];
propagatedBuildInputs = [
termcolor
questionary
colorama
decli
tomlkit
jinja2
pyyaml
argcomplete
typing-extensions
];
meta = with lib; {
description = "Tool to create committing rules for projects, auto bump versions, and generate changelogs";
homepage = "https://github.com/commitizen-tools/commitizen";
license = licenses.mit;
maintainers = with maintainers; [ lovesegfault ];
};
}

View File

@ -68,6 +68,7 @@ stdenv.mkDerivation rec {
# Fixes https://github.com/NixOS/nixpkgs/issues/31168
postPatch = ''
patchShebangs build-aux/meson_post_install.py
substituteInPlace meson.build --replace '>= 1.0.0-alpha.1' '>= 1.0.0'
'';
installCheckPhase = ''

View File

@ -1,5 +1,5 @@
{ lib, stdenv, fetchFromGitHub, substituteAll, swaybg
, meson_0_60, ninja, pkg-config, wayland-scanner, scdoc
, meson, ninja, pkg-config, wayland-scanner, scdoc
, wayland, libxkbcommon, pcre, json_c, dbus, libevdev
, pango, cairo, libinput, libcap, pam, gdk-pixbuf, librsvg
, wlroots, wayland-protocols, libdrm
@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
];
nativeBuildInputs = [
meson_0_60 ninja pkg-config wayland-scanner scdoc
meson ninja pkg-config wayland-scanner scdoc
];
buildInputs = [

View File

@ -30,7 +30,7 @@ expandResponseParams "$@"
if [[ -n "${NIX_LINK_TYPE_@suffixSalt@:-}" ]]; then
linkType=$NIX_LINK_TYPE_@suffixSalt@
else
linkType=$(checkLinkType "$@")
linkType=$(checkLinkType "${params[@]}")
fi
if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}"

View File

@ -31,7 +31,7 @@ cxxLibrary=1
cInclude=1
expandResponseParams "$@"
linkType=$(checkLinkType "$@")
linkType=$(checkLinkType "${params[@]}")
declare -i n=0
nParams=${#params[@]}

View File

@ -1,4 +1,4 @@
{ stdenv, runCommand, lib, coreutils }:
{ lib, stdenv, bintools-unwrapped, llvmPackages_13, coreutils }:
if stdenv.hostPlatform.isStatic
then throw ''
@ -25,17 +25,36 @@ else stdenv.mkDerivation rec {
cp ${./test.c} test.c
'';
libName = "libredirect" + stdenv.targetPlatform.extensions.sharedLibrary;
outputs = ["out" "hook"];
libName = "libredirect" + stdenv.targetPlatform.extensions.sharedLibrary;
buildPhase = ''
runHook preBuild
$CC -Wall -std=c99 -O3 -fPIC -ldl -shared \
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/$libName"} \
-o "$libName" \
libredirect.c
${if stdenv.isDarwin && stdenv.isAarch64 then ''
# We need the unwrapped binutils and clang:
# We also want to build a fat library with x86_64, arm64, arm64e in there.
# Because we use the unwrapped tools, we need to provide -isystem for headers
# and the library search directory for libdl.
# We can't build this on x86_64, because the libSystem we point to doesn't
# like arm64(e).
PATH=${bintools-unwrapped}/bin:${llvmPackages_13.clang-unwrapped}/bin:$PATH \
clang -arch x86_64 -arch arm64 -arch arm64e \
-isystem ${llvmPackages_13.clang.libc}/include \
-isystem ${llvmPackages_13.libclang.lib}/lib/clang/*/include \
-L${llvmPackages_13.clang.libc}/lib \
-Wl,-install_name,$libName \
-Wall -std=c99 -O3 -fPIC libredirect.c \
-ldl -shared -o "$libName"
'' else if stdenv.isDarwin then ''
$CC -Wall -std=c99 -O3 -fPIC libredirect.c \
-Wl,-install_name,$out/lib/$libName \
-ldl -shared -o "$libName"
'' else ''
$CC -Wall -std=c99 -O3 -fPIC libredirect.c \
-ldl -shared -o "$libName"
''}
if [ -n "$doInstallCheck" ]; then
$CC -Wall -std=c99 -O3 test.c -o test
@ -54,6 +73,12 @@ else stdenv.mkDerivation rec {
install -vD "$libName" "$out/lib/$libName"
'' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
# dylib will be rejected unless dylib rpath gets explictly set
install_name_tool \
-change $libName $out/lib/$libName \
$out/lib/$libName
'' + ''
# Provide a setup hook that injects our library into every process.
mkdir -p "$hook/nix-support"
cat <<SETUP_HOOK > "$hook/nix-support/setup-hook"

View File

@ -112,7 +112,8 @@ WRAPPER(int, open)(const char * path, int flags, ...)
}
WRAPPER_DEF(open)
#ifndef __APPLE__
// In musl libc, open64 is simply a macro for open
#if !defined(__APPLE__) && !defined(open64)
WRAPPER(int, open64)(const char * path, int flags, ...)
{
int (*open64_real) (const char *, int, mode_t) = LOOKUP_REAL(open64);
@ -152,7 +153,7 @@ WRAPPER(FILE *, fopen)(const char * path, const char * mode)
}
WRAPPER_DEF(fopen)
#ifndef __APPLE__
#ifdef __GLIBC__
WRAPPER(FILE *, __nss_files_fopen)(const char * path)
{
FILE * (*__nss_files_fopen_real) (const char *) = LOOKUP_REAL(__nss_files_fopen);
@ -162,7 +163,8 @@ WRAPPER(FILE *, __nss_files_fopen)(const char * path)
WRAPPER_DEF(__nss_files_fopen)
#endif
#ifndef __APPLE__
// In musl libc, fopen64 is simply a macro for fopen
#if !defined(__APPLE__) && !defined(fopen64)
WRAPPER(FILE *, fopen64)(const char * path, const char * mode)
{
FILE * (*fopen64_real) (const char *, const char *) = LOOKUP_REAL(fopen64);
@ -172,7 +174,7 @@ WRAPPER(FILE *, fopen64)(const char * path, const char * mode)
WRAPPER_DEF(fopen64)
#endif
#ifndef __APPLE__
#ifdef __linux__
WRAPPER(int, __xstat)(int ver, const char * path, struct stat * st)
{
int (*__xstat_real) (int ver, const char *, struct stat *) = LOOKUP_REAL(__xstat);
@ -182,7 +184,7 @@ WRAPPER(int, __xstat)(int ver, const char * path, struct stat * st)
WRAPPER_DEF(__xstat)
#endif
#ifndef __APPLE__
#ifdef __linux__
WRAPPER(int, __xstat64)(int ver, const char * path, struct stat64 * st)
{
int (*__xstat64_real) (int ver, const char *, struct stat64 *) = LOOKUP_REAL(__xstat64);

View File

@ -6,6 +6,9 @@ cargoBuildHook() {
runHook preBuild
if [ ! -z "${buildAndTestSubdir-}" ]; then
# ensure the output doesn't end up in the subdirectory
export CARGO_TARGET_DIR="$(pwd)/target"
pushd "${buildAndTestSubdir}"
fi

View File

@ -23,6 +23,7 @@ assertExecutable() {
# --prefix ENV SEP VAL : suffix/prefix ENV with VAL, separated by SEP
# --suffix
# --prefix-each ENV SEP VALS : like --prefix, but VALS is a list
# --suffix-each ENV SEP VALS : like --suffix, but VALS is a list
# --prefix-contents ENV SEP FILES : like --suffix-each, but contents of FILES
# are read first and used as VALS
@ -73,6 +74,14 @@ makeWrapper() {
echo "export $varName=${value@Q}\${$varName:+${separator@Q}}\$$varName" >> "$wrapper"
fi
fi
elif [[ "$p" == "--prefix-each" ]]; then
varName="${params[$((n + 1))]}"
separator="${params[$((n + 2))]}"
values="${params[$((n + 3))]}"
n=$((n + 3))
for value in $values; do
echo "export $varName=${value@Q}\${$varName:+${separator@Q}}\$$varName" >> "$wrapper"
done
elif [[ "$p" == "--suffix-each" ]]; then
varName="${params[$((n + 1))]}"
separator="${params[$((n + 2))]}"

View File

@ -121,18 +121,18 @@ rec {
allowSubstitutes = false;
}
''
n=$out${destination}
mkdir -p "$(dirname "$n")"
target=$out${destination}
mkdir -p "$(dirname "$target")"
if [ -e "$textPath" ]; then
mv "$textPath" "$n"
mv "$textPath" "$target"
else
echo -n "$text" > "$n"
echo -n "$text" > "$target"
fi
eval "$checkPhase"
(test -n "$executable" && chmod +x "$n") || true
(test -n "$executable" && chmod +x "$target") || true
'';
/*
@ -219,7 +219,7 @@ rec {
${text}
'';
checkPhase = ''
${stdenv.shell} -n $out
${stdenv.shellDryRun} "$target"
'';
};
@ -246,7 +246,7 @@ rec {
${text}
'';
checkPhase = ''
${stdenv.shell} -n $out/bin/${name}
${stdenv.shellDryRun} "$target"
'';
};
@ -295,8 +295,8 @@ rec {
checkPhase =
if checkPhase == null then ''
runHook preCheck
${stdenv.shell} -n $out/bin/${name}
${shellcheck}/bin/shellcheck $out/bin/${name}
${stdenv.shellDryRun} "$target"
${shellcheck}/bin/shellcheck "$target"
runHook postCheck
''
else checkPhase;

View File

@ -1,10 +1,11 @@
# Check that overriding works for trivial-builders like
# `writeShellScript` via `overrideAttrs`. This is useful
# to override the `checkPhase`, e. g. when you want
# to enable extglob in `writeShellScript`.
# to override the `checkPhase`, e. g. if you want
# to disable extglob in `writeShellScript`.
#
# Run using `nix-build -A tests.trivial-overriding`.
# Run using `nix-build -A tests.trivial-builders.overriding`.
{ lib
, stdenv
, runtimeShell
, runCommand
, callPackage
@ -21,33 +22,6 @@ let
rm success
'';
# Reuse the old `checkPhase` of `writeShellScript`, but enable extglob.
allowExtglob = old: {
checkPhase = ''
# make sure we don't change the settings for
# the rest of the derivation's build
(
export BASHOPTS
shopt -s extglob
${old.checkPhase}
)
'';
};
# Run old checkPhase, but only succeed if it fails.
# This HACK is required because we can't introspect build failures
# in nix: With `assertFail` we want to make sure that the default
# `checkPhase` would fail if extglob was used in the script.
assertFail = old: {
# write old checkPhase into a shell script, so we can check for
# the phase to fail even though we have `set -e`.
checkPhase = ''
if source ${writeShellScript "old-check-phase" old.checkPhase} 2>/dev/null; then
exit 1
fi
'';
};
simpleCase = case:
writeShellScript "test-trivial-overriding-${case}" extglobScript;
@ -70,16 +44,33 @@ let
executable = true;
};
mkCase = f: type: isBin:
disallowExtglob = x: x.overrideAttrs (_: {
checkPhase = ''
${stdenv.shell} -n "$target"
'';
});
# Run old checkPhase, but only succeed if it fails.
# This HACK is required because we can't introspect build failures
# in nix: With `assertFail` we want to make sure that the default
# `checkPhase` would fail if extglob was used in the script.
assertFail = x: x.overrideAttrs (old: {
checkPhase = ''
if
${old.checkPhase}
then exit 1; fi
'';
});
mkCase = case: outcome: isBin:
let
drv = (f type).overrideAttrs
(if type == "succ" then allowExtglob else assertFail);
drv = lib.pipe outcome ([ case ] ++ lib.optionals (outcome == "fail") [ disallowExtglob assertFail ]);
in if isBin then "${drv}/bin/${drv.name}" else drv;
writeTextOverrides = {
# Enabling globbing in checkPhase
# Make sure extglob works by default
simpleSucc = mkCase simpleCase "succ" false;
# Ensure it's possible to fail; in this case globbing is not enabled.
# Ensure it's possible to fail; in this case extglob is not enabled
simpleFail = mkCase simpleCase "fail" false;
# Do the same checks after wrapping with callPackage
# to make sure callPackage doesn't mess with the override
@ -103,7 +94,7 @@ let
name = script.name or (builtins.baseNameOf script);
in writeShellScript "run-${name}" ''
if [ "$(${script})" != "success" ]; then
echo "Failed in ${script}"
echo "Failed in ${name}"
exit 1
fi
'';

View File

@ -20,7 +20,7 @@ let
blocklist = writeText "cacert-blocklist.txt" (lib.concatStringsSep "\n" blacklist);
extraCertificatesBundle = writeText "cacert-extra-certificates-bundle.crt" (lib.concatStringsSep "\n\n" extraCertificateStrings);
srcVersion = "3.71";
srcVersion = "3.74";
version = if nssOverride != null then nssOverride.version else srcVersion;
meta = with lib; {
homepage = "https://curl.haxx.se/docs/caextract.html";
@ -35,7 +35,7 @@ let
src = if nssOverride != null then nssOverride.src else fetchurl {
url = "mirror://mozilla/security/nss/releases/NSS_${lib.replaceStrings ["."] ["_"] version}_RTM/src/nss-${version}.tar.gz";
sha256 = "0ly2l3dv6z5hlxs72h5x6796ni3x1bq60saavaf42ddgv4ax7b4r";
sha256 = "0mnhdkm4galhpvfz4rv0918jwmjlwkvcvb1f5va8f3zlz48qi4l8";
};
dontBuild = true;

View File

@ -13,34 +13,24 @@
}:
stdenv.mkDerivation rec {
pname = "shared-mime-info";
version = "2.1";
pname = "shared-mime-info-unstable";
version = "2021-12-03";
outputs = [ "out" "dev" ];
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "xdg";
repo = pname;
rev = version;
sha256 = "07bxv44p43pqq4ymfnyy50yli7lwdqymhvclna42rkn1cazq3vb5";
repo = "shared-mime-info";
rev = "5a406b06792e26a83c7346b3c2443c0bd8d4cdb2";
sha256 = "1v7dx7mr0m4lcff1aasg9gxn280zn0ffn6fjg9xc44pnllg01n6s";
};
patches = [
# xmlto is only used for building the docs, which are not installed anyways.
(fetchpatch {
name = "xmlto-optional.patch";
url = "https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/110.patch";
sha256 = "0p5gxlcmn8ji5bc7pd105s1halqwa1d28lfx9yj43rn6mav7allx";
})
];
nativeBuildInputs = [
meson
ninja
pkg-config
gettext
itstool
libxml2
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) shared-mime-info;

View File

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, arcan
, audit
, dbus
@ -46,6 +47,14 @@ stdenv.mkDerivation rec {
hash = "sha256-UTIVDKnYD/q0K6G7NJUKh1tHcqnsuiJ/cQxWuPMJ2G4=";
};
patches = [
# fix build with meson 0.60
(fetchpatch {
url = "https://github.com/letoram/xarcan/commit/b67e514dbb59bffc23b75d47ca7f24e96c4aeb05.patch";
sha256 = "sha256-tSQmNy1Id6nDIN+03dc1+rEEF8fMq0yJBiscNM60xic=";
})
];
nativeBuildInputs = [
meson
ninja

View File

@ -1,6 +1,6 @@
{ lib
, stdenv
, fetchurl
, fetchFromGitLab
, fetchpatch
, meson
, ninja
@ -16,21 +16,25 @@
, libpeas
, gnome-online-accounts
, gsettings-desktop-schemas
, libportal
, libportal-gtk4
, evolution-data-server
, libical
, librest
, json-glib
, itstool
, unstableGitUpdater
}:
stdenv.mkDerivation rec {
pname = "gnome-todo";
version = "41.0";
version = "unstable-2022-01-01";
src = fetchurl {
url = "mirror://gnome/sources/${pname}/${lib.versions.major version}/${pname}-${version}.tar.xz";
sha256 = "1r94880d4khbjhhfnhaba3y3d4hv2bri82rzfzxn27s5iybpqras";
src = fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "gnome-todo";
rev = "4a6be8c38510d909a9f94ec34c4da1f31ac9f1ab";
sha256 = "5UGo9vMb8scPWK91gftYOjqkJs9tGMiH1lqyEqedF2A=";
};
patches = [
@ -64,7 +68,7 @@ stdenv.mkDerivation rec {
gnome.adwaita-icon-theme
# Plug-ins
libportal # background
libportal-gtk4 # background
evolution-data-server # eds
libical
librest # todoist
@ -77,9 +81,8 @@ stdenv.mkDerivation rec {
'';
passthru = {
updateScript = gnome.updateScript {
packageName = pname;
attrPath = "gnome.${pname}";
updateScript = unstableGitUpdater {
url = "https://gitlab.gnome.org/GNOME/gnome-todo.git";
};
};

View File

@ -1,5 +1,6 @@
{ lib, stdenv
, fetchurl
, fetchpatch
, meson
, ninja
, gettext
@ -8,7 +9,7 @@
, libxml2
, libjpeg
, libpeas
, libportal
, libportal-gtk3
, gnome
, gtk3
, glib
@ -35,6 +36,15 @@ stdenv.mkDerivation rec {
sha256 = "sha256-huG5ujnaz3QiavpFermDtBJTuJ9he/VBOcrQiS0C2Kk=";
};
patches = [
# Fix build with latest libportal
# https://gitlab.gnome.org/GNOME/eog/-/merge_requests/115
(fetchpatch {
url = "https://gitlab.gnome.org/GNOME/eog/-/commit/a06e6325907e136678b0bbe7058c25d688034afd.patch";
sha256 = "ttcsfHubfmIbxA51YLnxXDagLLNutXYmoQyMQ4sHRak=";
})
];
nativeBuildInputs = [
meson
ninja
@ -49,7 +59,7 @@ stdenv.mkDerivation rec {
buildInputs = [
libjpeg
libportal
libportal-gtk3
gtk3
gdk-pixbuf
glib

View File

@ -12,7 +12,7 @@
, wrapGAppsHook
, gnome
, pantheon
, libportal
, libportal-gtk3
, libxml2
, libxslt
, itstool
@ -65,6 +65,13 @@ stdenv.mkDerivation rec {
url = "https://raw.githubusercontent.com/elementary/browser/cc17559a7ac6effe593712b4f3d0bbefde6e3b62/navigation-buttons.patch";
sha256 = "sha256-G1/JUjn/8DyO9sgL/5Kq205KbTOs4EMi4Vf3cJ8FHXU=";
})
] ++ [
# Fix build with latest libportal
# https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1051
(fetchpatch {
url = "https://gitlab.gnome.org/GNOME/epiphany/-/commit/84474398f6e59266b73170838219aa896729ce93.patch";
sha256 = "SeiLTo3FcOxuml5sJX9GqyGdyGf1jm1A76SOI0JJvoo=";
})
];
nativeBuildInputs = [
@ -100,7 +107,7 @@ stdenv.mkDerivation rec {
json-glib
libdazzle
libhandy
libportal
libportal-gtk3
libnotify
libarchive
libsecret

View File

@ -68,6 +68,12 @@ stdenv.mkDerivation rec {
url = "https://gitlab.gnome.org/GNOME/gnome-settings-daemon/commit/82d88014dfca2df7e081712870e1fb017c16b808.patch";
sha256 = "H5k/v+M2bRaswt5nrDJFNn4gS4BdB0UfzdjUCT4yLKg=";
})
# Fix build with new meson
(fetchpatch {
url = "https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/commit/28e28e9e598342c897ae5ca350d0da6f4aea057b.diff";
sha256 = "U+suR7wYjLWPqmkJpHm6pPOWL7sjL6GhIFX8MHrBRAY=";
})
];
nativeBuildInputs = [

View File

@ -1,5 +1,6 @@
{ lib, stdenv
, fetchurl
, fetchpatch
, meson
, ninja
, pkg-config
@ -10,7 +11,7 @@
, wrapGAppsHook
, gtk3
, libhandy
, libportal
, libportal-gtk3
, gnome
, gnome-autoar
, glib-networking
@ -52,6 +53,17 @@ stdenv.mkDerivation rec {
src = ./fix-paths.patch;
inherit tracker;
})
# Fix build with latest libportal
# https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/749
(fetchpatch {
url = "https://gitlab.gnome.org/GNOME/nautilus/-/commit/55cfd66ccca391fc144f5863ff6bfc1f3b137e2d.patch";
sha256 = "xSb9l7xxEYpAwmdmeWT/t7Z9Ck3DPtsODzbReQW/Q70=";
excludes = [
"build-aux/flatpak/org.gnome.Nautilus.json"
"build-aux/flatpak/org.gnome.Nautilus.yml"
];
})
];
nativeBuildInputs = [
@ -76,7 +88,7 @@ stdenv.mkDerivation rec {
gst_all_1.gst-plugins-base
gtk3
libhandy
libportal
libportal-gtk3
libexif
libnotify
libseccomp

View File

@ -29,7 +29,6 @@ let
"-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"

View File

@ -89,7 +89,11 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -57,6 +57,12 @@ in stdenv.mkDerivation (rec {
propagatedBuildInputs = [ ncurses zlib ];
patches = [
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
./gnu-install-dirs.patch
# On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
(fetchpatch {
@ -93,11 +99,6 @@ in stdenv.mkDerivation (rec {
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--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}.
+ ''
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 \
@ -122,6 +123,32 @@ in stdenv.mkDerivation (rec {
rm test/ExecutionEngine/frem.ll
'' + ''
patchShebangs test/BugPoint/compile-custom.ll.py
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
test/Transforms/SCCP/preserve-analysis.ll \
test/Transforms/SROA/dead-inst.ll \
test/tools/gold/X86/new-pm.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
# hacky fix: created binaries need to be run before installation
@ -130,18 +157,28 @@ in stdenv.mkDerivation (rec {
ln -sv $PWD/lib $out
'';
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -167,7 +204,21 @@ in stdenv.mkDerivation (rec {
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -197,7 +248,8 @@ in stdenv.mkDerivation (rec {
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32);
doCheck = stdenv.isLinux && (!stdenv.isx86_32)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -31,7 +31,6 @@ let
"-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"

View File

@ -104,7 +104,11 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -57,6 +57,12 @@ in stdenv.mkDerivation (rec {
propagatedBuildInputs = [ ncurses zlib ];
patches = [
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
./gnu-install-dirs.patch
# On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
(fetchpatch {
@ -91,11 +97,6 @@ in stdenv.mkDerivation (rec {
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--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}.
+ ''
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 \
@ -120,6 +121,32 @@ in stdenv.mkDerivation (rec {
rm test/ExecutionEngine/frem.ll
'' + ''
patchShebangs test/BugPoint/compile-custom.ll.py
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
test/Transforms/SCCP/preserve-analysis.ll \
test/Transforms/SROA/dead-inst.ll \
test/tools/gold/X86/new-pm.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
# hacky fix: created binaries need to be run before installation
@ -131,18 +158,38 @@ in stdenv.mkDerivation (rec {
# E.g. mesa.drivers use the build-id as a cache key (see #93946):
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals stdenv.hostPlatform.isStatic [
# Disables building of shared libs, -fPIC is still injected by cc-wrapper
"-DLLVM_ENABLE_PIC=OFF"
"-DLLVM_BUILD_STATIC=ON"
# libxml2 needs to be disabled because the LLVM build system ignores its .la
# file and doesn't link zlib as well.
# https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
"-DLLVM_ENABLE_LIBXML2=OFF"
# This is a Shared Library not tied to LLVM_ENABLE_PIC
"-DLLVM_TOOL_REMARKS_SHLIB_BUILD=OFF"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -168,7 +215,21 @@ in stdenv.mkDerivation (rec {
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -198,7 +259,8 @@ in stdenv.mkDerivation (rec {
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl) && (!stdenv.hostPlatform.isRiscV);
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl) && (!stdenv.hostPlatform.isRiscV)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -32,7 +32,6 @@ let
"-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"

View File

@ -92,7 +92,11 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -58,6 +58,15 @@ in stdenv.mkDerivation (rec {
++ [ zlib ];
patches = [
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
# Fix llvm being miscompiled by some gccs. See llvm/llvm-project#49955
# Fix llvm being miscompiled by some gccs. See https://github.com/llvm/llvm-project/issues/49955
./fix-llvm-issue-49955.patch
./gnu-install-dirs.patch
# On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test.
(fetchpatch {
@ -72,11 +81,6 @@ in stdenv.mkDerivation (rec {
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--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}.
+ ''
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 \
@ -105,6 +109,33 @@ in stdenv.mkDerivation (rec {
rm test/ExecutionEngine/frem.ll
'' + ''
patchShebangs test/BugPoint/compile-custom.ll.py
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-O0-defaults.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
test/Transforms/SCCP/preserve-analysis.ll \
test/Transforms/SROA/dead-inst.ll \
test/tools/gold/X86/new-pm.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
# hacky fix: created binaries need to be run before installation
@ -116,18 +147,36 @@ in stdenv.mkDerivation (rec {
# E.g. mesa.drivers use the build-id as a cache key (see #93946):
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals stdenv.hostPlatform.isStatic [
# Disables building of shared libs, -fPIC is still injected by cc-wrapper
"-DLLVM_ENABLE_PIC=OFF"
"-DLLVM_BUILD_STATIC=ON"
# libxml2 needs to be disabled because the LLVM build system ignores its .la
# file and doesn't link zlib as well.
# https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
"-DLLVM_ENABLE_LIBXML2=OFF"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -153,7 +202,21 @@ in stdenv.mkDerivation (rec {
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -183,7 +246,8 @@ in stdenv.mkDerivation (rec {
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -0,0 +1,13 @@
diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt b/lib/CodeGen/AsmPrinter/CMakeLists.txt
index eb924282..c77c140b 100644
--- a/lib/CodeGen/AsmPrinter/CMakeLists.txt
+++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt
@@ -44,3 +44,8 @@ add_llvm_component_library(LLVMAsmPrinter
Support
Target
)
+
+if (CMAKE_COMPILER_IS_GNUCXX)
+ set_source_files_properties(DwarfCompileUnit.cpp PROPERTIES
+ COMPILE_FLAGS -fno-strict-aliasing)
+endif()

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -22,7 +22,6 @@ let
"-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"

View File

@ -93,7 +93,11 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -52,6 +52,12 @@ in stdenv.mkDerivation (rec {
checkInputs = [ which ];
patches = [
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
./gnu-install-dirs.patch
# Fix random compiler crashes: https://bugs.llvm.org/show_bug.cgi?id=50611
@ -66,11 +72,6 @@ in stdenv.mkDerivation (rec {
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--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}.
+ ''
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 \
@ -109,18 +110,36 @@ in stdenv.mkDerivation (rec {
# E.g. mesa.drivers use the build-id as a cache key (see #93946):
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals stdenv.hostPlatform.isStatic [
# Disables building of shared libs, -fPIC is still injected by cc-wrapper
"-DLLVM_ENABLE_PIC=OFF"
"-DLLVM_BUILD_STATIC=ON"
# libxml2 needs to be disabled because the LLVM build system ignores its .la
# file and doesn't link zlib as well.
# https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
"-DLLVM_ENABLE_LIBXML2=OFF"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -146,7 +165,21 @@ in stdenv.mkDerivation (rec {
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -176,7 +209,8 @@ in stdenv.mkDerivation (rec {
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -65,7 +65,11 @@ let
python3 = pkgs.python3; # don't use python-boot
});
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -27,7 +27,7 @@ let
imap (i: _: concatStringsSep "." (take i parts)) parts;
in
stdenv.mkDerivation ({
stdenv.mkDerivation (rec {
pname = "llvm";
inherit version;
@ -65,6 +65,13 @@ stdenv.mkDerivation ({
# sha256 = "0injj1hqgrbcbihhwp2nbal88jfykad30r54f2cdcx7gws2fcy8i";
# stripLen = 1;
#})
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
./gnu-install-dirs.patch
# Fix invalid std::string(nullptr) for GCC 12
@ -80,11 +87,6 @@ stdenv.mkDerivation ({
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ ''
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 \
@ -100,6 +102,27 @@ stdenv.mkDerivation ({
substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
# hacky fix: created binaries need to be run before installation
@ -108,20 +131,30 @@ stdenv.mkDerivation ({
ln -sv $PWD/lib $out
'';
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
]
++ lib.optional enableSharedLibraries
"-DLLVM_LINK_LLVM_DYLIB=ON"
++ lib.optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -148,7 +181,21 @@ stdenv.mkDerivation ({
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -179,7 +226,8 @@ stdenv.mkDerivation ({
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isi686);
doCheck = stdenv.isLinux && (!stdenv.isi686)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -66,7 +66,11 @@ let
python3 = pkgs.python3; # don't use python-boot
});
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -27,7 +27,7 @@ let
imap (i: _: concatStringsSep "." (take i parts)) parts;
in
stdenv.mkDerivation ({
stdenv.mkDerivation (rec {
pname = "llvm";
inherit version;
@ -63,6 +63,13 @@ stdenv.mkDerivation ({
includes = [ "test/tools/gold/X86/common.ll" ];
sha256 = "0fxgrxmfnjx17w3lcq19rk68b2xksh1bynz3ina784kma7hp4wdb";
})
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
./gnu-install-dirs.patch
# Fix invalid std::string(nullptr) for GCC 12
@ -78,11 +85,6 @@ stdenv.mkDerivation ({
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ ''
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 \
@ -93,6 +95,29 @@ stdenv.mkDerivation ({
substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
test/Transforms/SROA/dead-inst.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
# hacky fix: created binaries need to be run before installation
@ -101,19 +126,29 @@ stdenv.mkDerivation ({
ln -sv $PWD/lib $out
'';
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -139,7 +174,21 @@ stdenv.mkDerivation ({
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -170,7 +219,8 @@ stdenv.mkDerivation ({
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isi686);
doCheck = stdenv.isLinux && (!stdenv.isi686)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -96,7 +96,11 @@ let
python3 = pkgs.python3; # don't use python-boot
});
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -31,7 +31,7 @@ let
let parts = splitVersion release_version; in
imap (i: _: concatStringsSep "." (take i parts)) parts;
in stdenv.mkDerivation ({
in stdenv.mkDerivation (rec {
pname = "llvm";
inherit version;
@ -67,6 +67,13 @@ in stdenv.mkDerivation ({
url = "https://github.com/llvm-mirror/llvm/commit/cc1f2a595ead516812a6c50398f0f3480ebe031f.patch";
sha256 = "0k6k1p5yisgwx417a67s7sr9930rqh1n0zv5jvply8vjjy4b3kf8";
})
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
./gnu-install-dirs.patch
# Fix invalid std::string(nullptr) for GCC 12
@ -82,11 +89,6 @@ in stdenv.mkDerivation ({
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ ''
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 \
@ -110,6 +112,31 @@ in stdenv.mkDerivation ({
rm test/ExecutionEngine/frem.ll
'' + ''
patchShebangs test/BugPoint/compile-custom.ll.py
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
test/Transforms/SCCP/preserve-analysis.ll \
test/Transforms/SROA/dead-inst.ll \
test/tools/gold/X86/new-pm.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
# hacky fix: created binaries need to be run before installation
@ -118,19 +145,29 @@ in stdenv.mkDerivation ({
ln -sv $PWD/lib $out
'';
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -156,7 +193,21 @@ in stdenv.mkDerivation ({
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -187,7 +238,8 @@ in stdenv.mkDerivation ({
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32);
doCheck = stdenv.isLinux && (!stdenv.isx86_32)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -30,7 +30,6 @@ let
"-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"

View File

@ -97,7 +97,11 @@ let
python3 = pkgs.python3; # don't use python-boot
});
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -30,7 +30,7 @@ let
shortVersion = with lib;
concatStringsSep "." (take 1 (splitVersion release_version));
in stdenv.mkDerivation ({
in stdenv.mkDerivation (rec {
pname = "llvm";
inherit version;
@ -57,6 +57,12 @@ in stdenv.mkDerivation ({
propagatedBuildInputs = [ ncurses zlib ];
patches = [
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
# Fix missing includes for GCC 10
(fetchpatch {
url = "https://bugs.gentoo.org/attachment.cgi?id=612792";
@ -85,11 +91,6 @@ in stdenv.mkDerivation ({
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ ''
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 \
@ -104,6 +105,32 @@ in stdenv.mkDerivation ({
rm test/CodeGen/AArch64/wineh4.mir
'' + ''
patchShebangs test/BugPoint/compile-custom.ll.py
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
test/Transforms/SCCP/preserve-analysis.ll \
test/Transforms/SROA/dead-inst.ll \
test/tools/gold/X86/new-pm.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
# hacky fix: created binaries need to be run before installation
@ -112,18 +139,28 @@ in stdenv.mkDerivation ({
ln -sv $PWD/lib $out
'';
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -149,7 +186,21 @@ in stdenv.mkDerivation ({
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -179,7 +230,8 @@ in stdenv.mkDerivation ({
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32);
doCheck = stdenv.isLinux && (!stdenv.isx86_32)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -30,7 +30,6 @@ let
"-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"

View File

@ -97,7 +97,11 @@ let
python3 = pkgs.python3; # don't use python-boot
});
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -57,6 +57,12 @@ in stdenv.mkDerivation (rec {
propagatedBuildInputs = [ ncurses zlib ];
patches = [
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
./gnu-install-dirs.patch
# Force a test to evaluate the saved benchmark for a CPU for which LLVM has
# an execution model. See NixOS/nixpkgs#119673.
@ -83,11 +89,6 @@ in stdenv.mkDerivation (rec {
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ ''
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 \
@ -119,6 +120,32 @@ in stdenv.mkDerivation (rec {
# Fix x86 gold test on non-x86 platforms
# (similar fix made to others in this directory previously, FWIW)
patch -p1 -i ${./fix-test-on-non-x86-like-others.patch}
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
test/Transforms/SCCP/preserve-analysis.ll \
test/Transforms/SROA/dead-inst.ll \
test/tools/gold/X86/new-pm.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
# hacky fix: created binaries need to be run before installation
@ -127,18 +154,28 @@ in stdenv.mkDerivation (rec {
ln -sv $PWD/lib $out
'';
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -164,7 +201,21 @@ in stdenv.mkDerivation (rec {
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -194,7 +245,8 @@ in stdenv.mkDerivation (rec {
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isRiscV);
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isRiscV)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -22,7 +22,6 @@ let
"-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"

View File

@ -93,7 +93,11 @@ let
# python3 = pkgs.python3; # don't use python-boot
# });
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;

View File

@ -51,6 +51,12 @@ in stdenv.mkDerivation (rec {
checkInputs = [ which ];
patches = [
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../llvm-config-link-static.patch
./gnu-install-dirs.patch
] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
@ -58,11 +64,6 @@ in stdenv.mkDerivation (rec {
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--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}.
+ ''
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 \
@ -101,18 +102,36 @@ in stdenv.mkDerivation (rec {
# E.g. mesa.drivers use the build-id as a cache key (see #93946):
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ optionals stdenv.hostPlatform.isStatic [
# Disables building of shared libs, -fPIC is still injected by cc-wrapper
"-DLLVM_ENABLE_PIC=OFF"
"-DLLVM_BUILD_STATIC=ON"
# libxml2 needs to be disabled because the LLVM build system ignores its .la
# file and doesn't link zlib as well.
# https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
"-DLLVM_ENABLE_LIBXML2=OFF"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
@ -138,7 +157,21 @@ in stdenv.mkDerivation (rec {
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
@ -168,7 +201,8 @@ in stdenv.mkDerivation (rec {
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl)
&& (stdenv.hostPlatform == stdenv.buildPlatform);
checkTarget = "check-all";

View File

@ -1,16 +0,0 @@
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 94d426b..37f7794 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
+ /// Nix-specific multiple-output handling: override ActiveLibDir
+ if (!IsInDevelopmentTree) {
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
+ }
+
/// We only use `shared library` mode in cases where the static library form
/// of the components provided are not available; note however that this is
/// skipped if we're run from within the build dir. However, once installed,

View File

@ -0,0 +1,12 @@
diff --git llvm/tools/llvm-config/CMakeLists.txt llvm/tools/llvm-config/CMakeLists.txt
index 16ba54c0cf2f..20b017195e84 100644
--- llvm/tools/llvm-config/CMakeLists.txt
+++ llvm/tools/llvm-config/CMakeLists.txt
@@ -6,6 +6,7 @@ set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc)
# Add the llvm-config tool.
add_llvm_tool(llvm-config
llvm-config.cpp
+ DISABLE_LLVM_LINK_LLVM_DYLIB
)
# Compute the substitution values for various items.

View File

@ -15,6 +15,9 @@ in stdenv.mkDerivation rec {
postPatch = lib.optionalString stdenv.isAarch32 ''
# https://gitlab.freedesktop.org/gstreamer/orc/-/issues/20
sed -i '/exec_opcodes_sys/d' testsuite/meson.build
'' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
# This benchmark times out on Hydra.nixos.org
sed -i '/memcpy_speed/d' testsuite/meson.build
'';
outputs = [ "out" "dev" ]

View File

@ -100,6 +100,9 @@ in stdenv.mkDerivation rec {
"${setHost}.musl-root=${pkgsBuildHost.targetPackages.stdenv.cc.libc}"
] ++ optionals stdenv.targetPlatform.isMusl [
"${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}"
] ++ optionals (stdenv.isDarwin && stdenv.isx86_64) [
# https://github.com/rust-lang/rust/issues/92173
"--set rust.jemalloc"
];
# The bootstrap.py will generated a Makefile that then executes the build.

View File

@ -97,8 +97,8 @@ in rec {
};
vala_0_54 = generic {
version = "0.54.3";
sha256 = "7R1f5MvAzShF0N5PH/77Fa+waJLSMMfMppV4FnLo+2A=";
version = "0.54.6";
sha256 = "SdYNlqP99sQoc5dEK8bW2Vv0CqffZ47kkSjEsRum5Gk=";
};
vala = vala_0_54;

View File

@ -219,6 +219,7 @@ in {
sqlite = null;
configd = null;
tzdata = null;
libffi = pkgs.libffiBoot; # without test suite
stripConfig = true;
stripIdlelib = true;
stripTests = true;

View File

@ -35,6 +35,15 @@ stdenv.mkDerivation rec {
url = "https://salsa.debian.org/mozilla-team/firefox/commit/fd6847c9416f9eebde636e21d794d25d1be8791d.patch";
sha256 = "02b7zwm6vxmk61aj79a6m32s1k5sr0hwm3q1j4v6np9jfyd10g1j";
})
# Remove this when updating to 79 - The patches are already applied upstream
# https://bugzilla.mozilla.org/show_bug.cgi?id=1318905
# Combination of 3 changesets, modified to apply on 78:
# - https://hg.mozilla.org/mozilla-central/rev/06d7e1b6b7e7
# - https://hg.mozilla.org/mozilla-central/rev/ec48f15d085c
# - https://hg.mozilla.org/mozilla-central/rev/6803dda74d33
./add-riscv64-support.patch
];
outputs = [ "out" "dev" ];
@ -98,6 +107,10 @@ stdenv.mkDerivation rec {
depsBuildBuild = [ buildPackages.stdenv.cc ];
# cc-rs insists on using -mabi=lp64 (soft-float) for riscv64,
# while we have a double-float toolchain
NIX_CFLAGS_COMPILE = lib.optionalString (with stdenv.hostPlatform; isRiscV && is64bit) "-mabi=lp64d";
# Remove unnecessary static lib
preFixup = ''
moveToOutput bin/js78-config "$dev"

View File

@ -0,0 +1,123 @@
# HG changeset patch
# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
# Date 1592464269 0
# Thu Jun 18 07:11:09 2020 +0000
# Node ID 5de7d747a962df5f8aefc016a62d7270ac18879e
# Parent e4b11f027efc1f8c2710ae3f52487a8f10a8fb39
Bug 1318905 - build: Add riscv64 as target architecture to mozbuild r=glandium
Adds the basic definitions for riscv64 to mozbuild, allowing to build Spidermonkey.
Differential Revision: https://phabricator.services.mozilla.com/D78623
diff -r e4b11f027efc -r 5de7d747a962 build/moz.configure/init.configure
--- a/build/moz.configure/init.configure Sun May 31 17:11:57 2020 +0000
+++ b/build/moz.configure/init.configure Thu Jun 18 07:11:09 2020 +0000
@@ -741,6 +741,9 @@
elif cpu.startswith('aarch64'):
canonical_cpu = 'aarch64'
endianness = 'little'
+ elif cpu in ('riscv64', 'riscv64gc'):
+ canonical_cpu = 'riscv64'
+ endianness = 'little'
elif cpu == 'sh4':
canonical_cpu = 'sh4'
endianness = 'little'
diff -r e4b11f027efc -r 5de7d747a962 python/mozbuild/mozbuild/configure/constants.py
--- a/python/mozbuild/mozbuild/configure/constants.py Sun May 31 17:11:57 2020 +0000
+++ b/python/mozbuild/mozbuild/configure/constants.py Thu Jun 18 07:11:09 2020 +0000
@@ -49,6 +49,7 @@
'mips64': 64,
'ppc': 32,
'ppc64': 64,
+ 'riscv64': 64,
's390': 32,
's390x': 64,
'sh4': 32,
@@ -87,6 +88,7 @@
('sparc', '__sparc__'),
('mips64', '__mips64'),
('mips32', '__mips__'),
+ ('riscv64', '__riscv && __riscv_xlen == 64'),
('sh4', '__sh__'),
))
diff -r e4b11f027efc -r 5de7d747a962 python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py Sun May 31 17:11:57 2020 +0000
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py Thu Jun 18 07:11:09 2020 +0000
@@ -1208,6 +1208,10 @@
'mips-unknown-linux-gnu': big_endian + {
'__mips__': 1,
},
+ 'riscv64-unknown-linux-gnu': little_endian + {
+ '__riscv': 1,
+ '__riscv_xlen': 64,
+ },
'sh4-unknown-linux-gnu': little_endian + {
'__sh__': 1,
},
# HG changeset patch
# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
# Date 1592464269 0
# Thu Jun 18 07:11:09 2020 +0000
# Node ID e3d924797cb2d508ff938414168e98ccf66f07fe
# Parent 5de7d747a962df5f8aefc016a62d7270ac18879e
Bug 1318905 - js:jit: Enable AtomicOperations-feeling-lucky.h on riscv64 r=lth
This allows the build on riscv64 to use the atomic operations provided by GCC.
Differential Revision: https://phabricator.services.mozilla.com/D78624
diff -r 5de7d747a962 -r e3d924797cb2 js/src/jit/AtomicOperations.h
--- a/js/src/jit/AtomicOperations.h Thu Jun 18 07:11:09 2020 +0000
+++ b/js/src/jit/AtomicOperations.h Thu Jun 18 07:11:09 2020 +0000
@@ -391,7 +391,7 @@
#elif defined(__ppc__) || defined(__PPC__) || defined(__sparc__) || \
defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \
defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) || \
- defined(__sh__) || defined(__s390__) || defined(__s390x__)
+ defined(__sh__) || defined(__s390__) || defined(__s390x__) || defined(__riscv)
# include "jit/shared/AtomicOperations-feeling-lucky.h"
#else
# error "No AtomicOperations support provided for this platform"
diff -r 5de7d747a962 -r e3d924797cb2 js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
--- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h Thu Jun 18 07:11:09 2020 +0000
+++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h Thu Jun 18 07:11:09 2020 +0000
@@ -63,6 +63,11 @@
# define HAS_64BIT_LOCKFREE
#endif
+#if defined(__riscv) && __riscv_xlen == 64
+# define HAS_64BIT_ATOMICS
+# define HAS_64BIT_LOCKFREE
+#endif
+
#ifdef __sparc__
# ifdef __LP64__
# define HAS_64BIT_ATOMICS
# HG changeset patch
# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
# Date 1592464269 0
# Thu Jun 18 07:11:09 2020 +0000
# Node ID 3f652d12b8bc0bd213020d488ecb4d3710bb11fa
# Parent e3d924797cb2d508ff938414168e98ccf66f07fe
Bug 1318905 - mfbt:tests: Define RETURN_INSTR for riscv64 in TestPoisonArea r=glandium
Define RETURN_INSTR for riscv64 in TestPoisonArea, i.e. the riscv64 assembly
opcodes for "ret ; ret".
Differential Revision: https://phabricator.services.mozilla.com/D78625
diff -r e3d924797cb2 -r 3f652d12b8bc mfbt/tests/TestPoisonArea.cpp
--- a/mfbt/tests/TestPoisonArea.cpp Thu Jun 18 07:11:09 2020 +0000
+++ b/mfbt/tests/TestPoisonArea.cpp Thu Jun 18 07:11:09 2020 +0000
@@ -132,6 +132,9 @@
#elif defined _ARCH_PPC || defined _ARCH_PWR || defined _ARCH_PWR2
# define RETURN_INSTR 0x4E800020 /* blr */
+#elif defined __riscv
+# define RETURN_INSTR 0x80828082 /* ret; ret */
+
#elif defined __sparc || defined __sparcv9
# define RETURN_INSTR 0x81c3e008 /* retl */

View File

@ -18,13 +18,13 @@ in
stdenv.mkDerivation rec {
pname = "aws-sdk-cpp";
version = "1.9.121";
version = "1.9.150";
src = fetchFromGitHub {
owner = "aws";
repo = "aws-sdk-cpp";
rev = version;
sha256 = "sha256-VQpWauk0tdJ1QU0HmtdTwQdKbiAuTTXXsUo2cqpqmdU=";
sha256 = "sha256-fgLdXWQKHaCwulrw9KV3vpQ71DjnQAL4heIRW7Rk7UY=";
};
postPatch = ''

View File

@ -132,6 +132,7 @@
, xavs ? null # AVS encoder
, xvidcore ? null # Xvid encoder, native encoder exists
, zeromq4 ? null # Message passing
, zimg ? null
, zlib ? null
, vulkan-loader ? null
, glslang ? null
@ -403,6 +404,7 @@ stdenv.mkDerivation rec {
(enableFeature (xavs != null && gplLicensing) "libxavs")
(enableFeature (xvidcore != null && gplLicensing) "libxvid")
(enableFeature (zeromq4 != null) "libzmq")
(enableFeature (zimg != null) "libzimg")
(enableFeature (zlib != null) "zlib")
(enableFeature (isLinux && vulkan-loader != null) "vulkan")
(enableFeature (isLinux && vulkan-loader != null && glslang != null) "libglslang")
@ -431,7 +433,7 @@ stdenv.mkDerivation rec {
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 x264 x265 xavs xvidcore
zeromq4 zlib
zeromq4 zimg zlib
] ++ optionals openglExtlib [ libGL libGLU ]
++ optionals nonfreeLicensing [ fdk_aac openssl ]
++ optional ((isLinux || isFreeBSD) && libva != null) libva

View File

@ -1,7 +1,7 @@
{ lib, stdenv, buildPackages, fetchurl, pkg-config, addOpenGLRunpath, perl, texinfo, yasm
, alsa-lib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
, libssh, libtheora, libva, libdrm, libvorbis, libvpx, xz, libpulseaudio, soxr
, x264, x265, xvidcore, zlib, libopus, speex, nv-codec-headers, dav1d
, x264, x265, xvidcore, zimg, zlib, libopus, speex, nv-codec-headers, dav1d
, srt ? null
, openglSupport ? false, libGLU ? null, libGL ? null
, libmfxSupport ? false, intel-media-sdk ? null
@ -154,6 +154,7 @@ stdenv.mkDerivation rec {
(ifMinVer "1.2" "--enable-libsoxr")
"--enable-libx264"
"--enable-libxvid"
"--enable-libzimg"
"--enable-zlib"
(ifMinVer "2.8" "--enable-libopus")
"--enable-libspeex"
@ -176,7 +177,7 @@ stdenv.mkDerivation rec {
buildInputs = [
bzip2 fontconfig freetype gnutls libiconv lame libass libogg libssh libtheora
libvorbis xz soxr x264 x265 xvidcore zlib libopus speex srt nv-codec-headers
libvorbis xz soxr x264 x265 xvidcore zimg zlib libopus speex srt nv-codec-headers
] ++ optionals openglSupport [ libGL libGLU ]
++ optional libmfxSupport intel-media-sdk
++ optional libaomSupport libaom

View File

@ -44,7 +44,7 @@
let
version = "2.33";
patchSuffix = "-59";
patchSuffix = "-62";
sha256 = "sha256-LiVWAA4QXb1X8Layoy/yzxc73k8Nhd/8z9i35RoGd/8=";
in
@ -63,7 +63,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.33/master && git describe
glibc-2.33-59-gf9592d65f2
glibc-2.33-62-gc493f6a0e4
$ git show --minimal --reverse glibc-2.33.. | gzip -9n --rsyncable - > 2.33-master.patch.gz
To compare the archive contents zdiff can be used.

View File

@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
# * chromaprint (gst-plugins-bad)
(substituteAll {
src = ./chromaprint-gst-plugins.patch;
load_plugins = lib.concatMapStrings (plugin: ''gst_registry_scan_path(gst_registry_get(), "${plugin}/lib/gstreamer-1.0");'') (with gst_all_1; [
load_plugins = lib.concatMapStrings (plugin: ''gst_registry_scan_path(gst_registry_get(), "${lib.getLib plugin}/lib/gstreamer-1.0");'') (with gst_all_1; [
gstreamer
gst-plugins-base
gst-plugins-bad

View File

@ -1,7 +1,6 @@
{ lib
, stdenv
, fetchurl
, fetchpatch
, meson
, ninja
, gettext
@ -93,26 +92,18 @@
stdenv.mkDerivation rec {
pname = "gst-plugins-bad";
version = "1.18.2";
version = "1.18.5";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
sha256 = "06ildd4rl6cynirv3p00d2ddf5is9svj4i7mkahldzhq24pq5mca";
sha256 = "sha256-oWSSO5Tw0IV4pvyuqsbgwF2niKRpA6EIaHDpykWtZ44=";
};
patches = [
# Use pkgconfig to inject the includedirs
./fix_pkgconfig_includedir.patch
# Fix “error: cannot initialize a parameter of type 'unsigned long *' with an rvalue of type 'typename std::remove_reference<decltype(*(&opencv_dilate_erode_type))>::type *' (aka 'volatile unsigned long *')” on Darwin.
(fetchpatch {
url = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/commit/640a65bf966df065d41a511e2d76d1f26a2e770c.patch";
sha256 = "E5pig+qEfR58Jticr6ydFxZOhM3ZJ8zgrf5K4BdiB/Y=";
includes = [
"ext/opencv/gstcvdilateerode.cpp"
];
})
];
nativeBuildInputs = [

View File

@ -41,13 +41,13 @@
stdenv.mkDerivation rec {
pname = "gst-plugins-base";
version = "1.18.4";
version = "1.18.5";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
sha256 = "08w3ivbc6n4vdds2ap6q7l8zdk9if8417nznyqidf0adm0lk5r99";
sha256 = "sha256-lgt69FhXANsP3VuENVThHiVk/tngYfWR+uiKe+ZEb6M=";
};
patches = [

View File

@ -21,20 +21,20 @@
stdenv.mkDerivation rec {
pname = "gstreamer";
version = "1.18.4";
version = "1.18.5";
outputs = [
"bin"
"out"
"dev"
# "devdoc" # disabled until `hotdoc` is packaged in nixpkgs, see:
# - https://github.com/NixOS/nixpkgs/pull/98767
# - https://github.com/NixOS/nixpkgs/issues/98769#issuecomment-702296551
];
outputBin = "dev";
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
sha256 = "1igv9l4hm21kp1jmlwlagzs7ly1vaxv1sbda29q8247372dwkvls";
sha256 = "sha256-VYYiMqY0Wbv1ar694whcqa7CEbR46JHazqTW34yv6Ao=";
};
patches = [
@ -94,14 +94,14 @@ stdenv.mkDerivation rec {
'';
postInstall = ''
for prog in "$dev/bin/"*; do
for prog in "$bin/bin/"*; do
# We can't use --suffix here due to quoting so we craft the export command by hand
wrapProgram "$prog" --run 'export GST_PLUGIN_SYSTEM_PATH_1_0=$GST_PLUGIN_SYSTEM_PATH_1_0''${GST_PLUGIN_SYSTEM_PATH_1_0:+:}$(unset _tmp; for profile in $NIX_PROFILES; do _tmp="$profile/lib/gstreamer-1.0''${_tmp:+:}$_tmp"; done; printf '%s' "$_tmp")'
done
'';
preFixup = ''
moveToOutput "share/bash-completion" "$dev"
moveToOutput "share/bash-completion" "$bin"
'';
setupHook = ./setup-hook.sh;

View File

@ -12,11 +12,11 @@
stdenv.mkDerivation rec {
pname = "gst-devtools";
version = "1.18.4";
version = "1.18.5";
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
sha256 = "1kvcabcfzm7wqih3lzgrg9xjbn4xpx43d1m2zkkvab4i8161kggz";
sha256 = "sha256-/s/8hkR9r1wqBoQ8dXqZHXRcqiBpRGoNdG6ZsT98sHk=";
};
patches = [

View File

@ -16,7 +16,7 @@
stdenv.mkDerivation rec {
pname = "gst-editing-services";
version = "1.18.4";
version = "1.18.5";
outputs = [
"out"
@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
sha256 = "010xg960qsh5dwmf0y9l1q13h0cymmrgapzla2zsw66ylxqbi1s6";
sha256 = "sha256-ivSoOU0FHz4YKAaG20mm76zMlcDFmhfw9WTjIABZDfU=";
};
patches = [

View File

@ -48,13 +48,13 @@ assert raspiCameraSupport -> (stdenv.isLinux && stdenv.isAarch64);
stdenv.mkDerivation rec {
pname = "gst-plugins-good";
version = "1.18.4";
version = "1.18.5";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz";
sha256 = "1c1rpq709cy8maaykyn1n0kckj9c6fl3mhvixkk6xmdwkcx0xrdn";
sha256 = "sha256-Oq7up3Zfv4gBrM5KUDqbBfc/BOijU1Lp0AIyz9VVeWs=";
};
nativeBuildInputs = [

Some files were not shown because too many files have changed in this diff Show More