Merge branch 'staging' into staging-next
This commit is contained in:
@@ -101,7 +101,23 @@ let
|
||||
pre-down = "pre-down.d/";
|
||||
};
|
||||
|
||||
macAddressOpt = mkOption {
|
||||
macAddressOptWifi = mkOption {
|
||||
type = types.either types.str (types.enum [ "permanent" "preserve" "random" "stable" "stable-ssid" ]);
|
||||
default = "preserve";
|
||||
example = "00:11:22:33:44:55";
|
||||
description = lib.mdDoc ''
|
||||
Set the MAC address of the interface.
|
||||
|
||||
- `"XX:XX:XX:XX:XX:XX"`: MAC address of the interface
|
||||
- `"permanent"`: Use the permanent MAC address of the device
|
||||
- `"preserve"`: Don’t change the MAC address of the device upon activation
|
||||
- `"random"`: Generate a randomized value upon each connect
|
||||
- `"stable"`: Generate a stable, hashed MAC address
|
||||
- `"stable-ssid"`: Generate a stable MAC addressed based on Wi-Fi network
|
||||
'';
|
||||
};
|
||||
|
||||
macAddressOptEth = mkOption {
|
||||
type = types.either types.str (types.enum [ "permanent" "preserve" "random" "stable" ]);
|
||||
default = "preserve";
|
||||
example = "00:11:22:33:44:55";
|
||||
@@ -258,10 +274,10 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
ethernet.macAddress = macAddressOpt;
|
||||
ethernet.macAddress = macAddressOptEth;
|
||||
|
||||
wifi = {
|
||||
macAddress = macAddressOpt;
|
||||
macAddress = macAddressOptWifi;
|
||||
|
||||
backend = mkOption {
|
||||
type = types.enum [ "wpa_supplicant" "iwd" ];
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
, scons
|
||||
, boost
|
||||
, ladspaH
|
||||
, libcxxabi
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
@@ -23,7 +22,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
--replace "-fomit-frame-pointer -ffast-math -mfpmath=sse" "-I${boost.dev}/include -I${ladspaH}/include" \
|
||||
--replace "env.has_key('cxx')" "True" \
|
||||
--replace "env['cxx']" "'${stdenv.cc.targetPrefix}c++'" \
|
||||
--replace "-Wl,--strip-all" "${lib.optionalString stdenv.isDarwin "-L${libcxxabi}/lib"}"
|
||||
--replace "-Wl,--strip-all" ""
|
||||
|
||||
substituteInPlace filters.cpp \
|
||||
--replace "LADSPA_HINT_SAMPLE_RATE, 0, 0.5" "LADSPA_HINT_SAMPLE_RATE, 0.0001, 0.5"
|
||||
|
||||
@@ -83,6 +83,18 @@ self: let
|
||||
rm $outd/xapian-lite.cc $outd/emacs-module.h $outd/emacs-module-prelude.h $outd/demo.gif $outd/Makefile
|
||||
'';
|
||||
});
|
||||
|
||||
# native compilation for tests/seq-tests.el never ends
|
||||
# delete tests/seq-tests.el to workaround this
|
||||
seq = super.seq.overrideAttrs (old: {
|
||||
dontUnpack = false;
|
||||
postUnpack = (old.postUnpack or "") + "\n" + ''
|
||||
local content_directory=$(echo seq-*)
|
||||
rm --verbose $content_directory/tests/seq-tests.el
|
||||
src=$PWD/$content_directory.tar
|
||||
tar --create --verbose --file=$src $content_directory
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
elpaDevelPackages = super // overrides;
|
||||
|
||||
@@ -63,9 +63,6 @@ self: let
|
||||
cl-print = null; # builtin
|
||||
tle = null; # builtin
|
||||
advice = null; # builtin
|
||||
seq = if lib.versionAtLeast self.emacs.version "27"
|
||||
then null
|
||||
else super.seq;
|
||||
# Compilation instructions for the Ada executables:
|
||||
# https://www.nongnu.org/ada-mode/
|
||||
ada-mode = super.ada-mode.overrideAttrs (old: {
|
||||
@@ -174,6 +171,18 @@ self: let
|
||||
'';
|
||||
});
|
||||
|
||||
# native compilation for tests/seq-tests.el never ends
|
||||
# delete tests/seq-tests.el to workaround this
|
||||
seq = super.seq.overrideAttrs (old: {
|
||||
dontUnpack = false;
|
||||
postUnpack = (old.postUnpack or "") + "\n" + ''
|
||||
local content_directory=$(echo seq-*)
|
||||
rm --verbose $content_directory/tests/seq-tests.el
|
||||
src=$PWD/$content_directory.tar
|
||||
tar --create --verbose --file=$src $content_directory
|
||||
'';
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
, withAlsaLib ? false
|
||||
, withAthena ? false
|
||||
, withCsrc ? true
|
||||
, withDbus ? stdenv.isLinux
|
||||
, withGTK2 ? false
|
||||
, withGTK3 ? withPgtk && !noGui
|
||||
, withGconf ? false
|
||||
@@ -77,6 +78,7 @@
|
||||
, withMotif ? false
|
||||
, withNS ? stdenv.isDarwin && !(variant == "macport" || noGui)
|
||||
, withPgtk ? false
|
||||
, withSelinux ? stdenv.isLinux
|
||||
, withSQLite3 ? lib.versionAtLeast version "29"
|
||||
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
|
||||
, withToolkitScrollBars ? true
|
||||
@@ -227,8 +229,9 @@ mkDerivation (finalAttrs: {
|
||||
alsa-lib
|
||||
] ++ lib.optionals withGpm [
|
||||
gpm
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
] ++ lib.optionals withDbus [
|
||||
dbus
|
||||
] ++ lib.optionals withSelinux [
|
||||
libselinux
|
||||
] ++ lib.optionals (!stdenv.isDarwin && withGTK3) [
|
||||
gsettings-desktop-schemas
|
||||
@@ -338,6 +341,8 @@ mkDerivation (finalAttrs: {
|
||||
(lib.withFeature withTreeSitter "tree-sitter")
|
||||
(lib.withFeature withXinput2 "xinput2")
|
||||
(lib.withFeature withXwidgets "xwidgets")
|
||||
(lib.withFeature withDbus "dbus")
|
||||
(lib.withFeature withSelinux "selinux")
|
||||
];
|
||||
|
||||
env = lib.optionalAttrs withNativeCompilation {
|
||||
|
||||
@@ -75,10 +75,6 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
# This variable is read by build script, so that Lapce editor knows its version
|
||||
RELEASE_TAG_NAME = "v${version}";
|
||||
|
||||
} // lib.optionalAttrs stdenv.cc.isClang {
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
|
||||
@@ -78,11 +78,6 @@ rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec {
|
||||
darwin.apple_sdk.frameworks.AppKit
|
||||
];
|
||||
|
||||
env = lib.optionalAttrs stdenv.isDarwin {
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
postFixup = let
|
||||
libPath = lib.makeLibraryPath ([
|
||||
libglvnd
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib, fetchFromGitHub }:
|
||||
rec {
|
||||
version = "9.1.0075";
|
||||
version = "9.1.0148";
|
||||
|
||||
outputs = [ "out" "xxd" ];
|
||||
|
||||
@@ -8,7 +8,7 @@ rec {
|
||||
owner = "vim";
|
||||
repo = "vim";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-rirPSh0rFg25JHl4idADLz6fIRmEALzp2Oa7De6uuGU=";
|
||||
hash = "sha256-lBs9PwNE3GoxtMka9oftYx3gegjCv6D3sEyAWK6RZzM=";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
@@ -62,8 +62,6 @@ stdenv.mkDerivation rec {
|
||||
|
||||
env = lib.optionalAttrs stdenv.isDarwin {
|
||||
GETTEXT_DIR = gettext;
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
|
||||
@@ -38,6 +38,16 @@ let
|
||||
hash = "sha256-7e6bCn/yZiG9WowQ/0hK4oc3okENmbC7mmhQx/uXeqA=";
|
||||
};
|
||||
});
|
||||
|
||||
netaddr = super.netaddr.overridePythonAttrs (oldAttrs: rec {
|
||||
version = "0.9.0";
|
||||
|
||||
src = fetchPypi {
|
||||
pname = "netaddr";
|
||||
inherit version;
|
||||
hash = "sha256-e0b6mxotcf1d6eSjeE7zOXAKU6CMgEDwi69fEZTaASg=";
|
||||
};
|
||||
});
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ lib, stdenv, fetchurl, fetchpatch }:
|
||||
{ lib, stdenv, fetchurl, fetchpatch, buildPackages }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "procmail";
|
||||
@@ -30,8 +30,19 @@ stdenv.mkDerivation rec {
|
||||
sed -e "3i\
|
||||
.PHONY: install
|
||||
" -i Makefile
|
||||
'' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
substituteInPlace src/Makefile.0 \
|
||||
--replace-fail '@./_autotst' '@${stdenv.hostPlatform.emulator buildPackages} ./_autotst'
|
||||
sed -e '3i\
|
||||
_autotst() { ${stdenv.hostPlatform.emulator buildPackages} ./_autotst "$@"; } \
|
||||
_locktst() { ${stdenv.hostPlatform.emulator buildPackages} ./_locktst "$@"; } \
|
||||
' -i src/autoconf
|
||||
'';
|
||||
|
||||
# default target is binaries + manpages; manpages don't cross compile without more work.
|
||||
makeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "bins" ];
|
||||
installTargets = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ "install.bin" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Mail processing and filtering utility";
|
||||
homepage = "https://github.com/BuGlessRB/procmail/";
|
||||
|
||||
@@ -183,7 +183,7 @@ let
|
||||
# We only link c++ libs here, our compiler wrapper can find wasi libc and crt itself.
|
||||
wasiSysRoot = runCommand "wasi-sysroot" {} ''
|
||||
mkdir -p $out/lib/wasm32-wasi
|
||||
for lib in ${pkgsCross.wasi32.llvmPackages.libcxx}/lib/* ${pkgsCross.wasi32.llvmPackages.libcxxabi}/lib/*; do
|
||||
for lib in ${pkgsCross.wasi32.llvmPackages.libcxx}/lib/*; do
|
||||
ln -s $lib $out/lib/wasm32-wasi
|
||||
done
|
||||
'';
|
||||
|
||||
@@ -42,7 +42,7 @@ python3.pkgs.buildPythonApplication rec {
|
||||
loguru
|
||||
more-itertools
|
||||
packaging
|
||||
pendulum_3
|
||||
pendulum
|
||||
psutil
|
||||
pynzb
|
||||
pyrsistent
|
||||
|
||||
@@ -13,7 +13,7 @@ let
|
||||
[ zlib glib libpng freetype xorg.libSM xorg.libICE xorg.libXrender openssl
|
||||
xorg.libXrandr xorg.libXfixes xorg.libXcursor xorg.libXinerama
|
||||
xorg.libxcb fontconfig xorg.libXext xorg.libX11 alsa-lib qtbase qtwebengine qtwebchannel qtsvg
|
||||
qtwebsockets libpulseaudio quazip llvmPackages.libcxx llvmPackages.libcxxabi
|
||||
qtwebsockets libpulseaudio quazip llvmPackages.libcxx
|
||||
];
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
|
||||
@@ -35,10 +35,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
++ lib.optional stdenv.isLinux alsa-lib
|
||||
++ lib.optionals stdenv.isDarwin [ AppKit CoreFoundation Security ];
|
||||
|
||||
env = lib.optionalAttrs (stdenv.cc.libcxx != null) {
|
||||
# work around https://github.com/NixOS/nixpkgs/issues/166205
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
} // lib.optionalAttrs stdenv.cc.isClang {
|
||||
env = lib.optionalAttrs stdenv.cc.isClang {
|
||||
CXXFLAGS = "-std=c++11";
|
||||
} // lib.optionalAttrs stdenv.isDarwin {
|
||||
NIX_CFLAGS_LINK = "-headerpad_max_install_names";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
, file, atk, alsa-lib, cairo, fontconfig, gdk-pixbuf, glib, webkitgtk, gtk2-x11, gtk3
|
||||
, heimdal, krb5, libsoup, libvorbis, speex, openssl, zlib, xorg, pango, gtk2
|
||||
, gnome2, mesa, nss, nspr, gtk_engines, freetype, dconf, libpng12, libxml2
|
||||
, libjpeg, libredirect, tzdata, cacert, systemd, libcxxabi, libcxx, e2fsprogs, symlinkJoin
|
||||
, libjpeg, libredirect, tzdata, cacert, systemd, libcxx, e2fsprogs, symlinkJoin
|
||||
, libpulseaudio, pcsclite, glib-networking, llvmPackages_12, opencv4
|
||||
, libfaketime
|
||||
, libinput, libcap, libjson, libsecret, libcanberra-gtk3
|
||||
@@ -96,7 +96,6 @@ stdenv.mkDerivation rec {
|
||||
libcap
|
||||
libcanberra-gtk3
|
||||
libcxx
|
||||
libcxxabi
|
||||
libinput
|
||||
libjpeg
|
||||
libjson
|
||||
|
||||
@@ -120,11 +120,6 @@ rustPlatform.buildRustPackage rec {
|
||||
--replace '"/usr/local/bin/espanso"' '"${placeholder "out"}/bin/espanso"'
|
||||
'';
|
||||
|
||||
env = lib.optionalAttrs stdenv.cc.isClang {
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
# Some tests require networking
|
||||
doCheck = false;
|
||||
|
||||
|
||||
@@ -50,11 +50,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
"-DINSTALL_LICENSE=OFF"
|
||||
];
|
||||
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
env = lib.optionalAttrs stdenv.cc.isClang {
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
passthru.tests = {
|
||||
version = testers.testVersion {
|
||||
package = finalAttrs.finalPackage;
|
||||
|
||||
@@ -55,7 +55,7 @@ python3.pkgs.buildPythonApplication rec {
|
||||
pytest-freezer
|
||||
pytest-mock
|
||||
pytest-regressions
|
||||
pytestCheckHook
|
||||
(pytestCheckHook.override { pytest = pytest_7; })
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
@@ -29,7 +29,7 @@ assert sendEmailSupport -> perlSupport;
|
||||
assert svnSupport -> perlSupport;
|
||||
|
||||
let
|
||||
version = "2.43.2";
|
||||
version = "2.44.0";
|
||||
svn = subversionClient.override { perlBindings = perlSupport; };
|
||||
gitwebPerlLibs = with perlPackages; [ CGI HTMLParser CGIFast FCGI FCGIProcManager HTMLTagCloud ];
|
||||
in
|
||||
@@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz";
|
||||
hash = "sha256-9hLBq8Y1V9UK04SYY/yRCWcBOfyZAeV0Rg7HbgURrbk=";
|
||||
hash = "sha256-41hzjctbXqNAzpAKABXAOuhugE5/9k5HqkYx3e5oHeM=";
|
||||
};
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional withManual "doc";
|
||||
@@ -318,25 +318,20 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
disable_test t0001-init 'shared overrides system'
|
||||
disable_test t0001-init 'init honors global core.sharedRepository'
|
||||
disable_test t1301-shared-repo
|
||||
# git-completion.bash: line 405: compgen: command not found:
|
||||
disable_test t9902-completion 'option aliases are shown with GIT_COMPLETION_SHOW_ALL'
|
||||
# /build/git-2.44.0/contrib/completion/git-completion.bash: line 452: compgen: command not found
|
||||
disable_test t9902-completion
|
||||
|
||||
# Our patched gettext never fallbacks
|
||||
disable_test t0201-gettext-fallbacks
|
||||
|
||||
${lib.optionalString (!sendEmailSupport) ''
|
||||
# Disable sendmail tests
|
||||
disable_test t9001-send-email
|
||||
''}
|
||||
|
||||
'' + lib.optionalString (!sendEmailSupport) ''
|
||||
# Disable sendmail tests
|
||||
disable_test t9001-send-email
|
||||
'' + ''
|
||||
# XXX: I failed to understand why this one fails.
|
||||
# Could someone try to re-enable it on the next release ?
|
||||
# Tested to fail: 2.18.0 and 2.19.0
|
||||
disable_test t1700-split-index "null sha1"
|
||||
|
||||
# Tested to fail: 2.18.0
|
||||
disable_test t9902-completion "sourcing the completion script clears cached --options"
|
||||
|
||||
# Flaky tests:
|
||||
disable_test t5319-multi-pack-index
|
||||
disable_test t6421-merge-partial-clone
|
||||
@@ -345,12 +340,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
disable_test t0021-conversion
|
||||
disable_test t3910-mac-os-precompose
|
||||
|
||||
${lib.optionalString (!perlSupport) ''
|
||||
# request-pull is a Bash script that invokes Perl, so it is not available
|
||||
# when NO_PERL=1, and the test should be skipped, but the test suite does
|
||||
# not check for the Perl prerequisite.
|
||||
disable_test t5150-request-pull
|
||||
''}
|
||||
'' + lib.optionalString (!perlSupport) ''
|
||||
# request-pull is a Bash script that invokes Perl, so it is not available
|
||||
# when NO_PERL=1, and the test should be skipped, but the test suite does
|
||||
# not check for the Perl prerequisite.
|
||||
disable_test t5150-request-pull
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
# XXX: Some tests added in 2.24.0 fail.
|
||||
# Please try to re-enable on the next release.
|
||||
@@ -358,8 +352,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# fail (as of 2.33.0)
|
||||
#===( 18623;1208 8/? 224/? 2/? )= =fatal: Not a valid object name refs/tags/signed-empty
|
||||
disable_test t6300-for-each-ref
|
||||
#===( 22665;1651 9/? 1/? 0/? 0/? )= =/private/tmp/nix-build-git-2.33.0.drv-2/git-2.33.0/t/../contrib/completion/git-completion.bash: line 405: compgen: command not found
|
||||
disable_test t9902-completion
|
||||
# not ok 1 - populate workdir (with 2.33.1 on x86_64-darwin)
|
||||
disable_test t5003-archive-zip
|
||||
'' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
|
||||
|
||||
@@ -4,10 +4,7 @@
|
||||
, lib
|
||||
, emptyDirectory
|
||||
, linkFarm
|
||||
, symlinkJoin
|
||||
, jam
|
||||
, libcxx
|
||||
, libcxxabi
|
||||
, openssl
|
||||
, xcbuild
|
||||
, CoreServices
|
||||
@@ -33,10 +30,6 @@ let
|
||||
# cone-based Git sparse checkout, either.)
|
||||
{ name = "contrib"; path = "${src}/contrib"; }
|
||||
];
|
||||
libcxxUnified = symlinkJoin {
|
||||
inherit (libcxx) name;
|
||||
paths = [ libcxx libcxxabi ];
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "p4";
|
||||
@@ -70,7 +63,7 @@ stdenv.mkDerivation rec {
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
"-sOSVER=1013"
|
||||
"-sMACOSX_SDK=${emptyDirectory}"
|
||||
"-sLIBC++DIR=${libcxxUnified}/lib"
|
||||
"-sLIBC++DIR=${lib.getLib stdenv.cc.libcxx}/lib"
|
||||
];
|
||||
|
||||
CCFLAGS =
|
||||
|
||||
@@ -55,31 +55,48 @@
|
||||
, includeFortifyHeaders ? null
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
assert nativeTools -> !propagateDoc && nativePrefix != "";
|
||||
assert !nativeTools ->
|
||||
cc != null && coreutils != null && gnugrep != null;
|
||||
assert !nativeTools -> cc != null && coreutils != null && gnugrep != null;
|
||||
assert !(nativeLibc && noLibc);
|
||||
assert (noLibc || nativeLibc) == (libc == null);
|
||||
|
||||
let
|
||||
stdenv = stdenvNoCC;
|
||||
inherit (lib)
|
||||
attrByPath
|
||||
concatMapStrings
|
||||
concatStringsSep
|
||||
escapeShellArg
|
||||
getBin
|
||||
getDev
|
||||
getLib
|
||||
getName
|
||||
getVersion
|
||||
mapAttrsToList
|
||||
optional
|
||||
optionalAttrs
|
||||
optionals
|
||||
optionalString
|
||||
removePrefix
|
||||
replaceStrings
|
||||
toList
|
||||
versionAtLeast
|
||||
;
|
||||
|
||||
inherit (stdenv) hostPlatform targetPlatform;
|
||||
|
||||
stdenv = stdenvNoCC;
|
||||
|
||||
includeFortifyHeaders' = if includeFortifyHeaders != null
|
||||
then includeFortifyHeaders
|
||||
else (targetPlatform.libc == "musl" && isGNU);
|
||||
|
||||
# Prefix for binaries. Customarily ends with a dash separator.
|
||||
#
|
||||
# TODO(@Ericson2314) Make unconditional, or optional but always true by
|
||||
# default.
|
||||
targetPrefix = lib.optionalString (targetPlatform != hostPlatform)
|
||||
(targetPlatform.config + "-");
|
||||
# TODO(@Ericson2314) Make unconditional, or optional but always true by default.
|
||||
targetPrefix = optionalString (targetPlatform != hostPlatform) (targetPlatform.config + "-");
|
||||
|
||||
ccVersion = lib.getVersion cc;
|
||||
ccName = lib.removePrefix targetPrefix (lib.getName cc);
|
||||
ccVersion = getVersion cc;
|
||||
ccName = removePrefix targetPrefix (getName cc);
|
||||
|
||||
libc_bin = optionalString (libc != null) (getBin libc);
|
||||
libc_dev = optionalString (libc != null) (getDev libc);
|
||||
@@ -98,7 +115,7 @@ let
|
||||
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
|
||||
|
||||
expand-response-params =
|
||||
lib.optionalString ((buildPackages.stdenv.hasCC or false) && buildPackages.stdenv.cc != "/dev/null") (import ../expand-response-params { inherit (buildPackages) stdenv; });
|
||||
optionalString ((buildPackages.stdenv.hasCC or false) && buildPackages.stdenv.cc != "/dev/null") (import ../expand-response-params { inherit (buildPackages) stdenv; });
|
||||
|
||||
useGccForLibs = useCcForLibs
|
||||
&& libcxx == null
|
||||
@@ -111,7 +128,7 @@ let
|
||||
+ optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}";
|
||||
|
||||
# Analogously to cc_solib and gccForLibs_solib
|
||||
libcxx_solib = "${lib.getLib libcxx}/lib";
|
||||
libcxx_solib = "${getLib libcxx}/lib";
|
||||
|
||||
# The following two functions, `isGccArchSupported` and
|
||||
# `isGccTuneSupported`, only handle those situations where a flag
|
||||
@@ -407,9 +424,9 @@ stdenv.mkDerivation {
|
||||
|
||||
setupHooks = [
|
||||
../setup-hooks/role.bash
|
||||
] ++ lib.optional (cc.langC or true) ./setup-hook.sh
|
||||
++ lib.optional (cc.langFortran or false) ./fortran-hook.sh
|
||||
++ lib.optional (targetPlatform.isWindows) (stdenv.mkDerivation {
|
||||
] ++ optional (cc.langC or true) ./setup-hook.sh
|
||||
++ optional (cc.langFortran or false) ./fortran-hook.sh
|
||||
++ optional (targetPlatform.isWindows) (stdenv.mkDerivation {
|
||||
name = "win-dll-hook.sh";
|
||||
dontUnpack = true;
|
||||
installPhase = ''
|
||||
@@ -476,7 +493,7 @@ stdenv.mkDerivation {
|
||||
# when building e.g. firefox), lld is able to find libgcc_s.so
|
||||
+ concatMapStrings (libgcc: ''
|
||||
echo "-L${libgcc}/lib" >> $out/nix-support/cc-ldflags
|
||||
'') (lib.toList (gccForLibs.libgcc or [])))
|
||||
'') (toList (gccForLibs.libgcc or [])))
|
||||
|
||||
##
|
||||
## General libc support
|
||||
@@ -542,9 +559,12 @@ stdenv.mkDerivation {
|
||||
done
|
||||
''
|
||||
+ optionalString (libcxx.isLLVM or false) ''
|
||||
echo "-isystem ${lib.getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem ${lib.getDev libcxx.cxxabi}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem ${getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
|
||||
''
|
||||
# can remove once LLVM9 and LLVM11 are dropped from nixpkgs
|
||||
+ optionalString (libcxx.isLLVM or false && lib.versionOlder (lib.getVersion libcxx) "12" && libcxx ? cxxabi.libName) ''
|
||||
echo "-isystem ${lib.getDev libcxx.cxxabi}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-l${libcxx.cxxabi.libName}" >> $out/nix-support/libcxx-ldflags
|
||||
''
|
||||
|
||||
@@ -593,7 +613,7 @@ stdenv.mkDerivation {
|
||||
## Hardening support
|
||||
##
|
||||
+ ''
|
||||
export hardening_unsupported_flags="${builtins.concatStringsSep " " ccHardeningUnsupportedFlags}"
|
||||
export hardening_unsupported_flags="${concatStringsSep " " ccHardeningUnsupportedFlags}"
|
||||
''
|
||||
|
||||
# Machine flags. These are necessary to support
|
||||
@@ -698,9 +718,9 @@ stdenv.mkDerivation {
|
||||
##
|
||||
+ optionalString isClang ''
|
||||
# Escape twice: once for this script, once for the one it gets substituted into.
|
||||
export march=${lib.escapeShellArg
|
||||
(lib.optionalString (targetPlatform ? gcc.arch)
|
||||
(lib.escapeShellArg "-march=${targetPlatform.gcc.arch}"))}
|
||||
export march=${escapeShellArg
|
||||
(optionalString (targetPlatform ? gcc.arch)
|
||||
(escapeShellArg "-march=${targetPlatform.gcc.arch}"))}
|
||||
export defaultTarget=${targetPlatform.config}
|
||||
substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh
|
||||
''
|
||||
@@ -709,8 +729,8 @@ stdenv.mkDerivation {
|
||||
## Extra custom steps
|
||||
##
|
||||
+ extraBuildCommands
|
||||
+ lib.strings.concatStringsSep "; "
|
||||
(lib.attrsets.mapAttrsToList
|
||||
+ concatStringsSep "; "
|
||||
(mapAttrsToList
|
||||
(name: value: "echo ${toString value} >> $out/nix-support/${name}")
|
||||
nixSupport);
|
||||
|
||||
@@ -733,11 +753,9 @@ stdenv.mkDerivation {
|
||||
};
|
||||
|
||||
meta =
|
||||
let cc_ = lib.optionalAttrs (cc != null) cc; in
|
||||
(lib.optionalAttrs (cc_ ? meta) (removeAttrs cc.meta ["priority"])) //
|
||||
{ description =
|
||||
lib.attrByPath ["meta" "description"] "System C compiler" cc_
|
||||
+ " (wrapper script)";
|
||||
let cc_ = optionalAttrs (cc != null) cc; in
|
||||
(optionalAttrs (cc_ ? meta) (removeAttrs cc.meta ["priority"])) //
|
||||
{ description = attrByPath ["meta" "description"] "System C compiler" cc_ + " (wrapper script)";
|
||||
priority = 10;
|
||||
mainProgram = if name != "" then name else ccName;
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
|
||||
FILE *testfp;
|
||||
int testfd;
|
||||
struct stat testsb;
|
||||
#ifndef __APPLE__
|
||||
#ifdef __GLIBC__
|
||||
struct stat64 testsb64;
|
||||
#endif
|
||||
#if defined(__linux__) && defined(STATX_TYPE)
|
||||
@@ -93,11 +93,11 @@ int main(int argc, char *argv[])
|
||||
assert(access(TESTPATH, X_OK) == 0);
|
||||
|
||||
assert(stat(TESTPATH, &testsb) != -1);
|
||||
#ifndef __APPLE__
|
||||
#ifdef __GLIBC__
|
||||
assert(stat64(TESTPATH, &testsb64) != -1);
|
||||
#endif
|
||||
assert(fstatat(123, TESTPATH, &testsb, 0) != -1);
|
||||
#ifndef __APPLE__
|
||||
#ifdef __GLIBC__
|
||||
assert(fstatat64(123, TESTPATH, &testsb64, 0) != -1);
|
||||
#endif
|
||||
#if defined(__linux__) && defined(STATX_TYPE)
|
||||
|
||||
@@ -18,11 +18,6 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
cargoHash = "sha256-Fli97ANWHZvvBC6hImymELkpBqqrAOm006LROj3R3sM=";
|
||||
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
env = lib.optionalAttrs stdenv.cc.isClang {
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
# error: linker `aarch64-linux-gnu-gcc` not found
|
||||
|
||||
@@ -59,11 +59,6 @@ buildGoModule rec {
|
||||
flags = [ "-a -trimpath" ];
|
||||
ldflags = [ "-s" "-w" "-X github.com/richardwilkes/toolbox/cmdline.AppVersion=${version}" ];
|
||||
|
||||
# Workaround for https://github.com/NixOS/nixpkgs/issues/166205
|
||||
env = lib.optionalAttrs (stdenv.cc.libcxx != null) {
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 $GOPATH/bin/gcs -t $out/bin
|
||||
|
||||
@@ -14,19 +14,16 @@
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "jasper";
|
||||
version = "4.2.1";
|
||||
version = "4.2.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "jasper-software";
|
||||
repo = "jasper";
|
||||
rev = "version-${finalAttrs.version}";
|
||||
hash = "sha256-SE3zB+8zZuuT+W6QYTuQhM+dBgYuFzYK4a7QaquGB60=";
|
||||
hash = "sha256-dcE9Cc+L/nLp/JCvYuGLRnkxL1i3dLIB9cSILWaZWn4=";
|
||||
};
|
||||
|
||||
# Splitting outputs going bad on Darwin
|
||||
outputs = if stdenv.isDarwin
|
||||
then [ "out" ]
|
||||
else [ "out" "dev" "doc" "lib" "man" ];
|
||||
outputs = [ "out" "dev" "doc" "lib" "man" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
|
||||
@@ -36,11 +36,6 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
cargoBuildFlags = [ "-p nickel-lang-cli" "-p nickel-lang-lsp" ];
|
||||
|
||||
env = lib.optionalAttrs stdenv.cc.isClang {
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
];
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, rustPlatform
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "selenium-manager";
|
||||
version = "4.18.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "SeleniumHQ";
|
||||
repo = "selenium";
|
||||
rev = "selenium-${version}";
|
||||
hash = "sha256-1C9Epsk9rFlShxHGGzbWl6smrMzPn2h3yCWlzUIMpY8=";
|
||||
};
|
||||
|
||||
sourceRoot = "${src.name}/rust";
|
||||
|
||||
cargoHash = "sha256-BystESOFIitw3ER2K1TPOf5luOBvKXFuqc/unL93yRY=";
|
||||
|
||||
# TODO: enable tests
|
||||
# The test suite depends on a number of browsers and network requests,
|
||||
# check the Gentoo package for inspiration
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description = "A browser automation framework and ecosystem";
|
||||
homepage = "https://github.com/SeleniumHQ/selenium";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ ];
|
||||
mainProgram = "selenium-manager";
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
@@ -47,9 +47,6 @@ rustPlatform.buildRustPackage rec {
|
||||
SYMBOLICATOR_GIT_VERSION = src.rev;
|
||||
SYMBOLICATOR_RELEASE = version;
|
||||
ZSTD_SYS_USE_PKG_CONFIG = true;
|
||||
} // lib.optionalAttrs stdenv.cc.isClang {
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
# tests require network access
|
||||
|
||||
@@ -97,8 +97,6 @@ let
|
||||
cudaBuildInputs = [ llamaccpPackage ];
|
||||
rocmBuildInputs = [ llamaccpPackage ];
|
||||
|
||||
LLAMA_CPP_LIB = "${llamaccpPackage.outPath}/lib";
|
||||
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
inherit pname version;
|
||||
@@ -148,11 +146,7 @@ rustPlatform.buildRustPackage {
|
||||
++ optionals enableRocm rocmBuildInputs
|
||||
;
|
||||
|
||||
env = lib.mergeAttrsList [
|
||||
{ inherit LLAMA_CPP_LIB; }
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205
|
||||
(lib.optionalAttrs stdenv.cc.isClang { NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}"; })
|
||||
];
|
||||
env.LLAMA_CPP_LIB = "${lib.getLib llamaccpPackage}/lib";
|
||||
patches = [ ./0001-nix-build-use-nix-native-llama-cpp-package.patch ];
|
||||
|
||||
# Fails with:
|
||||
|
||||
@@ -50,11 +50,6 @@ buildGoModule rec {
|
||||
"no_adodb"
|
||||
];
|
||||
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
env = lib.optionalAttrs stdenv.cc.isClang {
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{ lib
|
||||
, fetchPypi
|
||||
, buildPythonApplication
|
||||
, pythonRelaxDepsHook
|
||||
, poetry-core
|
||||
, colorama
|
||||
, more-itertools
|
||||
, packaging
|
||||
, pydantic
|
||||
, pydantic_1
|
||||
, requests
|
||||
, pygobject3
|
||||
, gobject-introspection
|
||||
@@ -27,13 +28,18 @@ buildPythonApplication rec {
|
||||
gobject-introspection
|
||||
poetry-core
|
||||
wrapGAppsNoGuiHook
|
||||
pythonRelaxDepsHook
|
||||
];
|
||||
|
||||
pythonRelaxDeps = [
|
||||
"more-itertools"
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
colorama
|
||||
more-itertools
|
||||
packaging
|
||||
pydantic
|
||||
pydantic_1
|
||||
requests
|
||||
pygobject3
|
||||
];
|
||||
|
||||
@@ -27,12 +27,7 @@ rustPlatform.buildRustPackage rec {
|
||||
zlib
|
||||
];
|
||||
|
||||
env = {
|
||||
LLVM_SYS_130_PREFIX = llvmPackages_13.llvm.dev;
|
||||
} // lib.optionalAttrs stdenv.cc.isClang {
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
};
|
||||
env.LLVM_SYS_130_PREFIX = llvmPackages_13.llvm.dev;
|
||||
|
||||
# process didn't exit successfully: <...> SIGSEGV
|
||||
doCheck = false;
|
||||
|
||||
@@ -152,7 +152,7 @@ let
|
||||
# Darwin links against libc++ not libstdc++. Newer versions of clang (12+) require
|
||||
# libc++abi to be linked explicitly (see https://github.com/NixOS/nixpkgs/issues/166205).
|
||||
substituteInPlace src/llvm/lib_llvm.cr \
|
||||
--replace '@[Link("stdc++")]' '@[Link("c++", "-l${stdenv.cc.libcxx.cxxabi.libName}")]'
|
||||
--replace '@[Link("stdc++")]' '@[Link("c++")]'
|
||||
'';
|
||||
|
||||
# Defaults are 4
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "glslang";
|
||||
version = "14.0.0";
|
||||
version = "14.1.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "KhronosGroup";
|
||||
repo = "glslang";
|
||||
rev = version;
|
||||
hash = "sha256-7kIIU45pe+IF7lGltpIKSvQBmcXR+TWFvmx7ztMNrpc=";
|
||||
hash = "sha256-trm5bR3/2w+oQppHQBB+b6l0N0sLjTk5+rRGDfnGb+8=";
|
||||
};
|
||||
|
||||
# These get set at all-packages, keep onto them for child drvs
|
||||
|
||||
@@ -46,11 +46,11 @@ let
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "go";
|
||||
version = "1.21.7";
|
||||
version = "1.21.8";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://go.dev/dl/go${finalAttrs.version}.src.tar.gz";
|
||||
hash = "sha256-ABl6sg8zgTgyv/Yv2TzKHEKgjMaJoypmcspJWRlZv/Y=";
|
||||
hash = "sha256-3IBs91qH4UFLW0w9y53T6cyY9M/M7EK3r2F9WmWKPEM=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ lib, stdenv, llvm_meta, version, fetch
|
||||
, cmake, python3, xcbuild, libllvm, linuxHeaders, libcxxabi, libxcrypt
|
||||
, cmake, python3, xcbuild, libllvm, linuxHeaders, libxcrypt
|
||||
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
|
||||
}:
|
||||
|
||||
@@ -20,8 +20,7 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ cmake python3 libllvm.dev ]
|
||||
++ lib.optional stdenv.isDarwin xcbuild.xcrun;
|
||||
buildInputs =
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
|
||||
@@ -109,7 +109,6 @@ let
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@@ -163,7 +162,6 @@ let
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
@@ -257,24 +255,13 @@ let
|
||||
|
||||
libcxx = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
libcxxabi = callPackage ./libcxxabi {
|
||||
inherit llvm_meta;
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||
else stdenv;
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
|
||||
};
|
||||
|
||||
libunwind = callPackage ./libunwind {
|
||||
inherit llvm_meta;
|
||||
inherit (buildLlvmTools) llvm;
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||
else stdenv;
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
|
||||
};
|
||||
|
||||
openmp = callPackage ./openmp {
|
||||
|
||||
@@ -1,68 +1,127 @@
|
||||
{ lib, stdenv, llvm_meta, fetch, cmake, python3, llvm, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
|
||||
, libcxxabi, libcxxrt
|
||||
{ lib, stdenv, llvm_meta
|
||||
, fetchFromGitHub, runCommand, substitute
|
||||
, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
|
||||
, libcxxrt, libunwind
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
}:
|
||||
|
||||
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
|
||||
# external cxxabi is not supported on Darwin as the build will not link libcxx
|
||||
# properly and not re-export the cxxabi symbols into libcxx
|
||||
# https://github.com/NixOS/nixpkgs/issues/166205
|
||||
# https://github.com/NixOS/nixpkgs/issues/269548
|
||||
assert cxxabi == null || !stdenv.hostPlatform.isDarwin;
|
||||
let
|
||||
basename = "libcxx";
|
||||
cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}";
|
||||
runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi";
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "libcxx";
|
||||
inherit version;
|
||||
# Note: useLLVM is likely false for Darwin but true under pkgsLLVM
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
|
||||
src = fetch "libcxx" "05cx39ldlxchck454lgfly1xj0c7x65iyx4hqhiihrlg6p6qj854";
|
||||
cxxabiCMakeFlags = lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile ${libcxxabi.src}
|
||||
mv libcxxabi-* libcxxabi
|
||||
unpackFile ${llvm.src}
|
||||
mv llvm-* llvm
|
||||
'';
|
||||
cxxCMakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=${cxxabiName}"
|
||||
] ++ lib.optionals (cxxabi != null) [
|
||||
"-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
] ++ lib.optionals useLLVM [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}"
|
||||
] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ cxxCMakeFlags
|
||||
++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = basename;
|
||||
inherit version cmakeFlags;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "llvm";
|
||||
repo = "llvm-project";
|
||||
rev = "refs/tags/llvmorg-${version}";
|
||||
sparseCheckout = [
|
||||
"libcxx"
|
||||
"libcxxabi"
|
||||
"llvm/cmake"
|
||||
"llvm/utils"
|
||||
"runtimes"
|
||||
];
|
||||
hash = "sha256-etxgXIdWxMTmbZ83Hsc0w6Jt5OSQSUEPVEWqLkHsNBY=";
|
||||
};
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
(substitute {
|
||||
src = ../../common/libcxxabi/wasm.patch;
|
||||
replacements = [
|
||||
"--replace-fail" "/cmake/" "/llvm/cmake/"
|
||||
];
|
||||
})
|
||||
] ++ lib.optionals stdenv.hostPlatform.isMusl [
|
||||
../../common/libcxx/libcxx-0001-musl-hacks.patch
|
||||
(substitute {
|
||||
src = ../../common/libcxx/libcxx-0001-musl-hacks.patch;
|
||||
replacements = [
|
||||
"--replace-fail" "/include/" "/libcxx/include/"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd runtimes
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patchShebangs utils/cat_files.py
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
nativeBuildInputs = [ cmake ninja python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames
|
||||
++ lib.optional (cxxabi != null) lndir;
|
||||
|
||||
buildInputs = [ cxxabi ];
|
||||
buildInputs = [ cxxabi ]
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
|
||||
] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
||||
|
||||
preInstall = lib.optionalString (stdenv.isDarwin) ''
|
||||
for file in lib/*.dylib; do
|
||||
if [ -L "$file" ]; then continue; fi
|
||||
|
||||
baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
|
||||
installName="$out/lib/$baseName"
|
||||
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
|
||||
|
||||
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
|
||||
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
|
||||
done
|
||||
done
|
||||
# libc++.so is a linker script which expands to multiple libraries,
|
||||
# libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
|
||||
# support linker scripts so the external cxxabi needs to be symlinked in
|
||||
postInstall = lib.optionalString (cxxabi != null) ''
|
||||
lndir ${lib.getDev cxxabi}/include $out/include/c++/v1
|
||||
lndir ${lib.getLib cxxabi}/lib $out/lib
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
inherit cxxabi;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 9bf1a02f0908..612cd4aab76c 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -28,6 +28,8 @@ set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
|
||||
project(libcxx CXX C)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION 12.0.0)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -402,7 +404,7 @@ endif ()
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
||||
set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
|
||||
string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
|
||||
@@ -410,11 +412,11 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
|
||||
else()
|
||||
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
|
||||
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
index 5d2764e870e9..bb1ec5de6ca2 100644
|
||||
--- a/cmake/Modules/HandleLibCXXABI.cmake
|
||||
+++ b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
@@ -63,7 +63,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
|
||||
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
|
||||
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
|
||||
COMPONENT cxx-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
||||
index 29a317b8ae9a..4747263cfd1b 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
||||
foreach(file ${files})
|
||||
get_filename_component(dir ${file} DIRECTORY)
|
||||
install(FILES ${file}
|
||||
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
|
||||
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
|
||||
COMPONENT cxx-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
@@ -260,7 +260,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
||||
|
||||
# Install the generated header as __config.
|
||||
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
|
||||
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
|
||||
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
RENAME __config
|
||||
COMPONENT cxx-headers)
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 9965104cb5b2..9b55dbb1d822 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -352,21 +352,21 @@ if (LIBCXX_INSTALL_SHARED_LIBRARY)
|
||||
install(TARGETS cxx_shared
|
||||
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
|
||||
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_INSTALL_STATIC_LIBRARY)
|
||||
install(TARGETS cxx_static
|
||||
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
|
||||
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
||||
endif()
|
||||
|
||||
if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
|
||||
install(TARGETS cxx_experimental
|
||||
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
|
||||
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
||||
endif()
|
||||
|
||||
# NOTE: This install command must go after the cxx install command otherwise
|
||||
@@ -1,87 +0,0 @@
|
||||
{ lib, stdenv, llvm_meta, cmake, python3, fetch, libcxx, libunwind, llvm, version
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
, standalone ? stdenv.hostPlatform.useLLVM or false
|
||||
, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "libcxxabi";
|
||||
inherit version;
|
||||
|
||||
src = fetch "libcxxabi" "1l4idd8npbkm168d26kqn529yv3npsd8f2dm8a7iwyknj7iyivw8";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile ${libcxx.src}
|
||||
mv libcxx-* libcxx
|
||||
unpackFile ${llvm.src}
|
||||
mv llvm-* llvm
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patch -p1 -d libcxx -i ${../../common/libcxx/libcxx-0001-musl-hacks.patch}
|
||||
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch}
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ];
|
||||
buildInputs = lib.optional withLibunwind libunwind;
|
||||
|
||||
cmakeFlags = lib.optionals standalone [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
preInstall = lib.optionalString stdenv.isDarwin ''
|
||||
for file in lib/*.dylib; do
|
||||
if [ -L "$file" ]; then continue; fi
|
||||
|
||||
# Fix up the install name. Preserve the basename, just replace the path.
|
||||
installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
|
||||
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
|
||||
|
||||
# cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
|
||||
# libcxxabi to sometimes link against a different version of itself.
|
||||
# Here we simply make that second reference point to ourselves.
|
||||
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
|
||||
${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
|
||||
done
|
||||
done
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$dev/include"
|
||||
install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
libName = "c++abi";
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "Provides C++ standard library support";
|
||||
longDescription = ''
|
||||
libc++abi is a new implementation of low level support for a standard C++ library.
|
||||
'';
|
||||
# "All of the code in libc++abi is dual licensed under the MIT license and
|
||||
# the UIUC License (a BSD-like license)":
|
||||
license = with lib.licenses; [ mit ncsa ];
|
||||
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
|
||||
};
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 426c855288fc..a9812a994f53 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -27,6 +27,8 @@ set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD)
|
||||
project(libcxxabi CXX C)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(PACKAGE_NAME libcxxabi)
|
||||
set(PACKAGE_VERSION 11.0.0)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -180,17 +182,17 @@ set(CMAKE_MODULE_PATH
|
||||
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
endif()
|
||||
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
else()
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
|
||||
set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.")
|
||||
@@ -9,10 +9,8 @@ stdenv.mkDerivation rec {
|
||||
src = fetch pname "192ww6n81lj2mb9pj4043z79jp3cf58a9c2qrxjwm5c3a64n1shb";
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile ${libcxx.src}
|
||||
mv libcxx-* libcxx
|
||||
unpackFile ${llvm.src}
|
||||
mv llvm-* llvm
|
||||
ln -s ${libcxx.src}/libcxx .
|
||||
ln -s ${libcxx.src}/llvm .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
|
||||
@@ -184,6 +184,10 @@ in stdenv.mkDerivation (rec {
|
||||
--replace 'Starting llvm::' 'Starting {{.*}}' \
|
||||
--replace 'Finished llvm::' 'Finished {{.*}}'
|
||||
done
|
||||
'' + ''
|
||||
# gcc-13 fix
|
||||
sed -i '/#include <string>/i#include <cstdint>' \
|
||||
include/llvm/DebugInfo/Symbolize/DIPrinter.h
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{ lib, stdenv, llvm_meta, version, src
|
||||
, cmake, python3, xcbuild, libllvm, linuxHeaders, libcxxabi, libxcrypt
|
||||
, cmake, python3, xcbuild, libllvm, linuxHeaders, libxcrypt
|
||||
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
|
||||
}:
|
||||
|
||||
@@ -22,8 +22,7 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ cmake python3 libllvm.dev ]
|
||||
++ lib.optional stdenv.isDarwin xcbuild.xcrun;
|
||||
buildInputs =
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
|
||||
@@ -137,7 +137,6 @@ in let
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@@ -203,7 +202,6 @@ in let
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
@@ -297,28 +295,8 @@ in let
|
||||
|
||||
libcxx = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||
else (
|
||||
# libcxx >= 13 does not build on gcc9
|
||||
if stdenv.cc.isGNU && lib.versionOlder stdenv.cc.version "10"
|
||||
then pkgs.gcc10Stdenv
|
||||
else stdenv
|
||||
);
|
||||
};
|
||||
|
||||
libcxxabi = let
|
||||
stdenv_ = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||
else stdenv;
|
||||
cxx-headers = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
stdenv = stdenv_;
|
||||
headersOnly = true;
|
||||
};
|
||||
in callPackage ./libcxxabi {
|
||||
stdenv = stdenv_;
|
||||
inherit llvm_meta cxx-headers;
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
|
||||
monorepoSrc = src;
|
||||
};
|
||||
|
||||
libunwind = callPackage ./libunwind {
|
||||
|
||||
@@ -1,80 +1,123 @@
|
||||
{ lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
|
||||
, libcxxabi, libcxxrt
|
||||
{ lib, stdenv, llvm_meta
|
||||
, monorepoSrc, runCommand, substitute
|
||||
, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
|
||||
, libcxxrt, libunwind
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
|
||||
# If headersOnly is true, the resulting package would only include the headers.
|
||||
# Use this to break the circular dependency between libcxx and libcxxabi.
|
||||
#
|
||||
# Some context:
|
||||
# https://reviews.llvm.org/rG1687f2bbe2e2aaa092f942d4a97d41fad43eedfb
|
||||
, headersOnly ? false
|
||||
}:
|
||||
|
||||
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
|
||||
# external cxxabi is not supported on Darwin as the build will not link libcxx
|
||||
# properly and not re-export the cxxabi symbols into libcxx
|
||||
# https://github.com/NixOS/nixpkgs/issues/166205
|
||||
# https://github.com/NixOS/nixpkgs/issues/269548
|
||||
assert cxxabi == null || !stdenv.hostPlatform.isDarwin;
|
||||
let
|
||||
basename = "libcxx";
|
||||
cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}";
|
||||
runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi";
|
||||
|
||||
# Note: useLLVM is likely false for Darwin but true under pkgsLLVM
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
|
||||
cxxabiCMakeFlags = lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cxxCMakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=${cxxabiName}"
|
||||
] ++ lib.optionals (cxxabi != null) [
|
||||
"-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
] ++ lib.optionals useLLVM [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}"
|
||||
] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ cxxCMakeFlags
|
||||
++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = if headersOnly then "cxx-headers" else "libcxx";
|
||||
inherit version;
|
||||
pname = basename;
|
||||
inherit version cmakeFlags;
|
||||
|
||||
inherit src;
|
||||
sourceRoot = "${src.name}/libcxx";
|
||||
src = runCommand "${pname}-src-${version}" {} (''
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/libcxx "$out"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'' + lib.optionalString (cxxabi == null) ''
|
||||
cp -r ${monorepoSrc}/libcxxabi "$out"
|
||||
'');
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
(substitute {
|
||||
src = ../../common/libcxxabi/wasm.patch;
|
||||
replacements = [
|
||||
"--replace-fail" "/cmake/" "/llvm/cmake/"
|
||||
];
|
||||
})
|
||||
] ++ lib.optionals stdenv.hostPlatform.isMusl [
|
||||
../../common/libcxx/libcxx-0001-musl-hacks.patch
|
||||
(substitute {
|
||||
src = ../../common/libcxx/libcxx-0001-musl-hacks.patch;
|
||||
replacements = [
|
||||
"--replace-fail" "/include/" "/libcxx/include/"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd runtimes
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patchShebangs utils/cat_files.py
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
nativeBuildInputs = [ cmake ninja python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames
|
||||
++ lib.optional (cxxabi != null) lndir;
|
||||
|
||||
buildInputs = lib.optionals (!headersOnly) [ cxxabi ];
|
||||
buildInputs = [ cxxabi ]
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
|
||||
cmakeFlags = [ "-DLIBCXX_CXX_ABI=${cxxabi.pname}" ]
|
||||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
||||
|
||||
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||
|
||||
preInstall = lib.optionalString (stdenv.isDarwin && !headersOnly) ''
|
||||
for file in lib/*.dylib; do
|
||||
if [ -L "$file" ]; then continue; fi
|
||||
|
||||
baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
|
||||
installName="$out/lib/$baseName"
|
||||
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
|
||||
|
||||
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
|
||||
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
|
||||
done
|
||||
done
|
||||
'';
|
||||
|
||||
# At this point, cxxabi headers would be installed in the dev output, which
|
||||
# prevents moveToOutput from doing its job later in the build process.
|
||||
postInstall = lib.optionalString (!headersOnly) ''
|
||||
mv "$dev/include/c++/v1/"* "$out/include/c++/v1/"
|
||||
pushd "$dev"
|
||||
rmdir -p include/c++/v1
|
||||
popd
|
||||
# libc++.so is a linker script which expands to multiple libraries,
|
||||
# libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
|
||||
# support linker scripts so the external cxxabi needs to be symlinked in
|
||||
postInstall = lib.optionalString (cxxabi != null) ''
|
||||
lndir ${lib.getDev cxxabi}/include ''${!outputDev}/include/c++/v1
|
||||
lndir ${lib.getLib cxxabi}/lib ''${!outputLib}/lib
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
inherit cxxabi;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
@@ -84,7 +127,6 @@ stdenv.mkDerivation rec {
|
||||
libc++ is an implementation of the C++ standard library, targeting C++11,
|
||||
C++14 and above.
|
||||
'';
|
||||
|
||||
# "All of the code in libc++ is dual licensed under the MIT license and the
|
||||
# UIUC License (a BSD-like license)":
|
||||
license = with lib.licenses; [ mit ncsa ];
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b1e25358d41a..7fe1f4d85401 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -26,6 +26,8 @@ set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
|
||||
project(libcxx CXX C)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION 13.0.0git)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -412,7 +414,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
|
||||
"Path where target-agnostic libc++ headers should be installed.")
|
||||
@@ -426,7 +428,7 @@ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
|
||||
"Path where target-agnostic libc++ headers should be installed.")
|
||||
@@ -436,7 +438,7 @@ else()
|
||||
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
|
||||
"Path where target-agnostic libc++ headers should be installed.")
|
||||
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
index 5a8a4a270a1a..c06bae0001aa 100644
|
||||
--- a/cmake/Modules/HandleLibCXXABI.cmake
|
||||
+++ b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
@@ -63,7 +63,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
|
||||
- DESTINATION include/c++/v1/${dstdir}
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
|
||||
COMPONENT cxx-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 496429f3841e..1a0c9c0a3159 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -376,21 +376,21 @@ if (LIBCXX_INSTALL_SHARED_LIBRARY)
|
||||
install(TARGETS cxx_shared
|
||||
ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
- RUNTIME DESTINATION bin COMPONENT cxx)
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_INSTALL_STATIC_LIBRARY)
|
||||
install(TARGETS cxx_static
|
||||
ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
- RUNTIME DESTINATION bin COMPONENT cxx)
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
||||
endif()
|
||||
|
||||
if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
|
||||
install(TARGETS cxx_experimental
|
||||
LIBRARY DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
ARCHIVE DESTINATION ${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
|
||||
- RUNTIME DESTINATION bin COMPONENT cxx)
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
|
||||
endif()
|
||||
|
||||
# NOTE: This install command must go after the cxx install command otherwise
|
||||
@@ -1,84 +0,0 @@
|
||||
{ lib, stdenv, llvm_meta, cmake, python3, src, cxx-headers, libunwind, version
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
, standalone ? stdenv.hostPlatform.useLLVM or false
|
||||
, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libcxxabi";
|
||||
inherit version;
|
||||
|
||||
inherit src;
|
||||
sourceRoot = "${src.name}/${pname}";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch}
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ];
|
||||
buildInputs = lib.optional withLibunwind libunwind;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
|
||||
] ++ lib.optionals standalone [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
] ++ lib.optionals (standalone && withLibunwind) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
preInstall = lib.optionalString stdenv.isDarwin ''
|
||||
for file in lib/*.dylib; do
|
||||
if [ -L "$file" ]; then continue; fi
|
||||
|
||||
# Fix up the install name. Preserve the basename, just replace the path.
|
||||
installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
|
||||
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
|
||||
|
||||
# cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
|
||||
# libcxxabi to sometimes link against a different version of itself.
|
||||
# Here we simply make that second reference point to ourselves.
|
||||
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
|
||||
${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
|
||||
done
|
||||
done
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$dev/include"
|
||||
install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
libName = "c++abi";
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "Provides C++ standard library support";
|
||||
longDescription = ''
|
||||
libc++abi is a new implementation of low level support for a standard C++ library.
|
||||
'';
|
||||
# "All of the code in libc++abi is dual licensed under the MIT license and
|
||||
# the UIUC License (a BSD-like license)":
|
||||
license = with lib.licenses; [ mit ncsa ];
|
||||
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
|
||||
};
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 9fb35860d483..5739d9e8af62 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -27,6 +27,8 @@ set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD)
|
||||
project(libcxxabi CXX C)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(PACKAGE_NAME libcxxabi)
|
||||
set(PACKAGE_VERSION 11.0.0git)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -195,7 +197,7 @@ set(CMAKE_MODULE_PATH
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
@@ -204,12 +206,12 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
else()
|
||||
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
endif()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib, stdenv, llvm_meta, version
|
||||
, monorepoSrc, runCommand
|
||||
, cmake, python3, xcbuild, libllvm, linuxHeaders, libcxxabi, libxcrypt
|
||||
, cmake, python3, xcbuild, libllvm, linuxHeaders, libxcrypt
|
||||
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
|
||||
}:
|
||||
|
||||
@@ -30,8 +30,7 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ cmake python3 libllvm.dev ]
|
||||
++ lib.optional stdenv.isDarwin xcbuild.xcrun;
|
||||
buildInputs =
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
|
||||
@@ -134,7 +134,6 @@ in let
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@@ -200,7 +199,6 @@ in let
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
@@ -296,23 +294,7 @@ in let
|
||||
|
||||
libcxx = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
libcxxabi = let
|
||||
stdenv_ = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||
else stdenv;
|
||||
cxx-headers = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
stdenv = stdenv_;
|
||||
headersOnly = true;
|
||||
};
|
||||
in callPackage ./libcxxabi {
|
||||
stdenv = stdenv_;
|
||||
inherit llvm_meta cxx-headers;
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
|
||||
};
|
||||
|
||||
libunwind = callPackage ./libunwind {
|
||||
|
||||
@@ -1,87 +1,129 @@
|
||||
{ lib, stdenv, llvm_meta
|
||||
, monorepoSrc, runCommand
|
||||
, cmake, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
|
||||
, libcxxabi, libcxxrt
|
||||
, monorepoSrc, runCommand, substitute
|
||||
, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
|
||||
, libcxxrt, libunwind
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
|
||||
# If headersOnly is true, the resulting package would only include the headers.
|
||||
# Use this to break the circular dependency between libcxx and libcxxabi.
|
||||
#
|
||||
# Some context:
|
||||
# https://reviews.llvm.org/rG1687f2bbe2e2aaa092f942d4a97d41fad43eedfb
|
||||
, headersOnly ? false
|
||||
}:
|
||||
|
||||
# external cxxabi is not supported on Darwin as the build will not link libcxx
|
||||
# properly and not re-export the cxxabi symbols into libcxx
|
||||
# https://github.com/NixOS/nixpkgs/issues/166205
|
||||
# https://github.com/NixOS/nixpkgs/issues/269548
|
||||
assert cxxabi == null || !stdenv.hostPlatform.isDarwin;
|
||||
let
|
||||
basename = "libcxx";
|
||||
cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}";
|
||||
runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi";
|
||||
|
||||
# Note: useLLVM is likely false for Darwin but true under pkgsLLVM
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
|
||||
cxxabiCMakeFlags = lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cxxCMakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=${cxxabiName}"
|
||||
] ++ lib.optionals (cxxabi != null) [
|
||||
"-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
] ++ lib.optionals useLLVM [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}"
|
||||
] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ cxxCMakeFlags
|
||||
++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
|
||||
|
||||
in
|
||||
|
||||
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = basename + lib.optionalString headersOnly "-headers";
|
||||
inherit version;
|
||||
pname = basename;
|
||||
inherit version cmakeFlags;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${basename} "$out"
|
||||
mkdir -p "$out/libcxxabi"
|
||||
cp -r ${monorepoSrc}/libcxxabi/include "$out/libcxxabi"
|
||||
src = runCommand "${pname}-src-${version}" {} (''
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/libcxx "$out"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
'';
|
||||
cp -r ${monorepoSrc}/third-party "$out"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'' + lib.optionalString (cxxabi == null) ''
|
||||
cp -r ${monorepoSrc}/libcxxabi "$out"
|
||||
'');
|
||||
|
||||
sourceRoot = "${src.name}/${basename}";
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
(substitute {
|
||||
src = ../../common/libcxxabi/wasm.patch;
|
||||
replacements = [
|
||||
"--replace-fail" "/cmake/" "/llvm/cmake/"
|
||||
];
|
||||
})
|
||||
] ++ lib.optionals stdenv.hostPlatform.isMusl [
|
||||
../../common/libcxx/libcxx-0001-musl-hacks.patch
|
||||
(substitute {
|
||||
src = ../../common/libcxx/libcxx-0001-musl-hacks.patch;
|
||||
replacements = [
|
||||
"--replace-fail" "/include/" "/libcxx/include/"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# fix CMake error when static and LIBCXXABI_USE_LLVM_UNWINDER=ON. aren't
|
||||
# building unwind so don't need to depend on it
|
||||
substituteInPlace libcxx/src/CMakeLists.txt \
|
||||
--replace-fail "add_dependencies(cxx_static unwind)" "# add_dependencies(cxx_static unwind)"
|
||||
cd runtimes
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patchShebangs utils/cat_files.py
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
nativeBuildInputs = [ cmake ninja python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames
|
||||
++ lib.optional (cxxabi != null) lndir;
|
||||
|
||||
buildInputs = lib.optionals (!headersOnly) [ cxxabi ];
|
||||
buildInputs = [ cxxabi ]
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
|
||||
cmakeFlags = [ "-DLIBCXX_CXX_ABI=${cxxabi.pname}" ]
|
||||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
||||
|
||||
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||
|
||||
preInstall = lib.optionalString (stdenv.isDarwin && !headersOnly) ''
|
||||
for file in lib/*.dylib; do
|
||||
if [ -L "$file" ]; then continue; fi
|
||||
|
||||
baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
|
||||
installName="$out/lib/$baseName"
|
||||
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
|
||||
|
||||
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
|
||||
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
|
||||
done
|
||||
done
|
||||
# libc++.so is a linker script which expands to multiple libraries,
|
||||
# libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
|
||||
# support linker scripts so the external cxxabi needs to be symlinked in
|
||||
postInstall = lib.optionalString (cxxabi != null) ''
|
||||
lndir ${lib.getDev cxxabi}/include ''${!outputDev}/include/c++/v1
|
||||
lndir ${lib.getLib cxxabi}/lib ''${!outputLib}/lib
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
inherit cxxabi;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -436,7 +436,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
@@ -453,7 +453,7 @@ else()
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
|
||||
endif()
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
@@ -1,103 +0,0 @@
|
||||
{ lib, stdenv, llvm_meta, cmake, python3
|
||||
, monorepoSrc, runCommand
|
||||
, cxx-headers, libunwind, version
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libcxxabi";
|
||||
inherit version;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
mkdir -p "$out/libcxx/src"
|
||||
cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/include "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/src/include "$out/libcxx/src"
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/${pname}";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch}
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
then ''
|
||||
for file in lib/*.dylib; do
|
||||
if [ -L "$file" ]; then continue; fi
|
||||
|
||||
# Fix up the install name. Preserve the basename, just replace the path.
|
||||
installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
|
||||
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
|
||||
|
||||
# cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
|
||||
# libcxxabi to sometimes link against a different version of itself.
|
||||
# Here we simply make that second reference point to ourselves.
|
||||
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
|
||||
${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
|
||||
done
|
||||
done
|
||||
|
||||
make install
|
||||
install -d 755 $out/include
|
||||
install -m 644 ../include/*.h $out/include
|
||||
''
|
||||
else ''
|
||||
install -d -m 755 $out/include $out/lib
|
||||
install -m 644 lib/libc++abi.a $out/lib
|
||||
install -m 644 ../include/cxxabi.h $out/include
|
||||
'' + lib.optionalString enableShared ''
|
||||
install -m 644 lib/libc++abi.so.1.0 $out/lib
|
||||
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
|
||||
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
libName = "c++abi";
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "Provides C++ standard library support";
|
||||
longDescription = ''
|
||||
libc++abi is a new implementation of low level support for a standard C++ library.
|
||||
'';
|
||||
# "All of the code in libc++abi is dual licensed under the MIT license and
|
||||
# the UIUC License (a BSD-like license)":
|
||||
license = with lib.licenses; [ mit ncsa ];
|
||||
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
|
||||
};
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ecbc7091864e..53ba2dbc3bd1 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -216,7 +216,7 @@ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
@@ -230,7 +230,7 @@ else()
|
||||
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
endif()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib, stdenv, llvm_meta, version
|
||||
, monorepoSrc, runCommand
|
||||
, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libcxxabi, libxcrypt
|
||||
, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libxcrypt
|
||||
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
|
||||
}:
|
||||
|
||||
@@ -30,8 +30,7 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ cmake ninja python3 libllvm.dev ]
|
||||
++ lib.optional stdenv.isDarwin xcbuild.xcrun;
|
||||
buildInputs =
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
|
||||
@@ -139,7 +139,6 @@ in let
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@@ -205,7 +204,6 @@ in let
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
@@ -309,45 +307,7 @@ in let
|
||||
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
|
||||
libcxxabi = let
|
||||
# CMake will "require" a compiler capable of compiling C++ programs
|
||||
# cxx-header's build does not actually use one so it doesn't really matter
|
||||
# what stdenv we use here, as long as CMake is happy.
|
||||
cxx-headers = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
# Note that if we use the regular stdenv here we'll get cycle errors
|
||||
# when attempting to use this compiler in the stdenv.
|
||||
#
|
||||
# The final stdenv pulls `cxx-headers` from the package set where
|
||||
# hostPlatform *is* the target platform which means that `stdenv` at
|
||||
# that point attempts to use this toolchain.
|
||||
#
|
||||
# So, we use `stdenv_` (the stdenv containing `clang` from this package
|
||||
# set, defined below) to sidestep this issue.
|
||||
#
|
||||
# Because we only use `cxx-headers` in `libcxxabi` (which depends on the
|
||||
# clang stdenv _anyways_), this is okay.
|
||||
stdenv = stdenv_;
|
||||
headersOnly = true;
|
||||
};
|
||||
|
||||
# `libcxxabi` *doesn't* need a compiler with a working C++ stdlib but it
|
||||
# *does* need a relatively modern C++ compiler (see:
|
||||
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/index.html#platform-and-compiler-support).
|
||||
#
|
||||
# So, we use the clang from this LLVM package set, like libc++
|
||||
# "boostrapping builds" do:
|
||||
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/BuildingLibcxx.html#bootstrapping-build
|
||||
#
|
||||
# We cannot use `clangNoLibcxx` because that contains `compiler-rt` which,
|
||||
# on macOS, depends on `libcxxabi`, thus forming a cycle.
|
||||
stdenv_ = overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc;
|
||||
in callPackage ./libcxxabi {
|
||||
stdenv = stdenv_;
|
||||
inherit llvm_meta cxx-headers;
|
||||
};
|
||||
|
||||
# Like `libcxxabi` above, `libcxx` requires a fairly modern C++ compiler,
|
||||
# `libcxx` requires a fairly modern C++ compiler,
|
||||
# so: we use the clang from this LLVM package set instead of the regular
|
||||
# stdenv's compiler.
|
||||
libcxx = callPackage ./libcxx {
|
||||
|
||||
@@ -1,75 +1,110 @@
|
||||
{ lib, stdenv, llvm_meta
|
||||
, monorepoSrc, runCommand, fetchpatch
|
||||
, cmake, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
|
||||
, libcxxabi, libcxxrt, libunwind
|
||||
, monorepoSrc, runCommand, fetchpatch, substitute
|
||||
, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
|
||||
, libcxxrt, libunwind
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
|
||||
# If headersOnly is true, the resulting package would only include the headers.
|
||||
# Use this to break the circular dependency between libcxx and libcxxabi.
|
||||
#
|
||||
# Some context:
|
||||
# https://reviews.llvm.org/rG1687f2bbe2e2aaa092f942d4a97d41fad43eedfb
|
||||
, headersOnly ? false
|
||||
}:
|
||||
|
||||
# external cxxabi is not supported on Darwin as the build will not link libcxx
|
||||
# properly and not re-export the cxxabi symbols into libcxx
|
||||
# https://github.com/NixOS/nixpkgs/issues/166205
|
||||
# https://github.com/NixOS/nixpkgs/issues/269548
|
||||
assert cxxabi == null || !stdenv.hostPlatform.isDarwin;
|
||||
let
|
||||
basename = "libcxx";
|
||||
cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}";
|
||||
runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi";
|
||||
|
||||
# Note: useLLVM is likely false for Darwin but true under pkgsLLVM
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
|
||||
cxxabiCMakeFlags = lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cxxCMakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=${cxxabiName}"
|
||||
] ++ lib.optionals (cxxabi != null) [
|
||||
"-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
] ++ lib.optionals useLLVM [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}"
|
||||
] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ cxxCMakeFlags
|
||||
++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
|
||||
|
||||
in
|
||||
|
||||
assert stdenv.isDarwin -> cxxabi.libName == "c++abi";
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = basename + lib.optionalString headersOnly "-headers";
|
||||
inherit version;
|
||||
pname = basename;
|
||||
inherit version cmakeFlags;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${basename} "$out"
|
||||
mkdir -p "$out/libcxxabi"
|
||||
cp -r ${monorepoSrc}/libcxxabi/include "$out/libcxxabi"
|
||||
src = runCommand "${pname}-src-${version}" {} (''
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/libcxx "$out"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/third-party "$out"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
'' + lib.optionalString (cxxabi == null) ''
|
||||
cp -r ${monorepoSrc}/libcxxabi "$out"
|
||||
'');
|
||||
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";
|
||||
|
||||
prePatch = ''
|
||||
cd ../${basename}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
# See:
|
||||
# - https://reviews.llvm.org/D133566
|
||||
# - https://github.com/NixOS/nixpkgs/issues/214524#issuecomment-1429146432
|
||||
# !!! Drop in LLVM 16+
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/57c7bb3ec89565c68f858d316504668f9d214d59.patch";
|
||||
hash = "sha256-AaM9A6tQ4YAw7uDqCIV4VaiUyLZv+unwcOqbakwW9/k=";
|
||||
relative = "libcxx";
|
||||
hash = "sha256-B07vHmSjy5BhhkGSj3e1E0XmMv5/9+mvC/k70Z29VwY=";
|
||||
})
|
||||
# fix for https://github.com/NixOS/nixpkgs/issues/269548
|
||||
# https://github.com/llvm/llvm-project/pull/77218
|
||||
(fetchpatch {
|
||||
name = "darwin-system-libcxxabi-link-flags.patch";
|
||||
url = "https://github.com/llvm/llvm-project/commit/c5b89b29ee6e3c444a355fd1cf733ce7ab2e316a.patch";
|
||||
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
|
||||
relative = "libcxx";
|
||||
(substitute {
|
||||
src = ../../common/libcxxabi/wasm.patch;
|
||||
replacements = [
|
||||
"--replace-fail" "/cmake/" "/llvm/cmake/"
|
||||
];
|
||||
})
|
||||
] ++ lib.optionals stdenv.hostPlatform.isMusl [
|
||||
../../common/libcxx/libcxx-0001-musl-hacks.patch
|
||||
(substitute {
|
||||
src = ../../common/libcxx/libcxx-0001-musl-hacks.patch;
|
||||
replacements = [
|
||||
"--replace-fail" "/include/" "/libcxx/include/"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
cd runtimes
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
@@ -77,52 +112,22 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames
|
||||
++ lib.optional (cxxabi != null) lndir;
|
||||
|
||||
buildInputs =
|
||||
lib.optionals (!headersOnly) [ cxxabi ]
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [ libunwind ];
|
||||
buildInputs = [ cxxabi ]
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
|
||||
cmakeFlags = let
|
||||
# See: https://libcxx.llvm.org/BuildingLibcxx.html#cmdoption-arg-libcxx-cxx-abi-string
|
||||
libcxx_cxx_abi_opt = {
|
||||
"c++abi" = "system-libcxxabi";
|
||||
"cxxrt" = "libcxxrt";
|
||||
}.${cxxabi.libName} or (throw "unknown cxxabi: ${cxxabi.libName} (${cxxabi.pname})");
|
||||
in [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxx"
|
||||
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_opt}"
|
||||
] ++ lib.optional (!headersOnly && cxxabi.libName == "c++abi") "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi.dev}/include/c++/v1"
|
||||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
# (Backport fix from 16, which has LIBCXX_ADDITIONAL_LIBRARIES, but 15
|
||||
# does not appear to)
|
||||
# There's precedent for this in llvm-project/libcxx/cmake/caches.
|
||||
# In a monorepo build you might do the following in the libcxxabi build:
|
||||
# -DLLVM_ENABLE_PROJECTS=libcxxabi;libunwind
|
||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=On
|
||||
# libcxx appears to require unwind and doesn't pull it in via other means.
|
||||
# "-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-lunwind"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
# If we're only building the headers we don't actually *need* a functioning
|
||||
# C/C++ compiler:
|
||||
++ lib.optionals (headersOnly) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
];
|
||||
|
||||
ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||
# libc++.so is a linker script which expands to multiple libraries,
|
||||
# libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
|
||||
# support linker scripts so the external cxxabi needs to be symlinked in
|
||||
postInstall = lib.optionalString (cxxabi != null) ''
|
||||
lndir ${lib.getDev cxxabi}/include ''${!outputDev}/include/c++/v1
|
||||
lndir ${lib.getLib cxxabi}/lib ''${!outputLib}/lib
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
inherit cxxabi;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 74eff2002fc9..c935d10878bb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -419,7 +419,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
@@ -436,7 +436,7 @@ else()
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
|
||||
endif()
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
@@ -1,113 +0,0 @@
|
||||
{ lib, stdenv, llvm_meta, cmake, ninja, python3
|
||||
, monorepoSrc, runCommand, fetchpatch
|
||||
, cxx-headers, libunwind, version
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libcxxabi";
|
||||
inherit version;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
mkdir -p "$out/libcxx/src"
|
||||
cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/include "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/src/include "$out/libcxx/src"
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d llvm -i ${../../common/libcxxabi/wasm.patch}
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
cd ../${pname}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
|
||||
# https://reviews.llvm.org/D132298, Allow building libcxxabi alone
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/e6a0800532bb409f6d1c62f3698bdd6994a877dc.patch";
|
||||
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
|
||||
stripLen = 1;
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxxabi"
|
||||
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
|
||||
|
||||
# `libcxxabi`'s build does not need a toolchain with a c++ stdlib attached
|
||||
# (we specify the headers it should use explicitly above).
|
||||
#
|
||||
# CMake however checks for this anyways; this flag tells it not to. See:
|
||||
# https://github.com/llvm/llvm-project/blob/4bd3f3759259548e159aeba5c76efb9a0864e6fa/llvm/runtimes/CMakeLists.txt#L243
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
preInstall = lib.optionalString stdenv.isDarwin ''
|
||||
for file in lib/*.dylib; do
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
install_name_tool -id $out/$file $file
|
||||
done
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$dev/include"
|
||||
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
libName = "c++abi";
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "Provides C++ standard library support";
|
||||
longDescription = ''
|
||||
libc++abi is a new implementation of low level support for a standard C++ library.
|
||||
'';
|
||||
# "All of the code in libc++abi is dual licensed under the MIT license and
|
||||
# the UIUC License (a BSD-like license)":
|
||||
license = with lib.licenses; [ mit ncsa ];
|
||||
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
|
||||
};
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b8326d08d23a..a1e36f713161 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -187,7 +187,7 @@ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
@@ -201,7 +201,7 @@ else()
|
||||
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
endif()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib, stdenv, llvm_meta, version
|
||||
, monorepoSrc, runCommand
|
||||
, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libcxxabi, libxcrypt
|
||||
, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libxcrypt
|
||||
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
|
||||
}:
|
||||
|
||||
@@ -31,8 +31,7 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ cmake ninja python3 libllvm.dev ]
|
||||
++ lib.optional stdenv.isDarwin xcbuild.xcrun;
|
||||
buildInputs =
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString ([
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
|
||||
@@ -139,7 +139,6 @@ in let
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@@ -214,7 +213,6 @@ in let
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
@@ -324,45 +322,7 @@ in let
|
||||
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
|
||||
libcxxabi = let
|
||||
# CMake will "require" a compiler capable of compiling C++ programs
|
||||
# cxx-header's build does not actually use one so it doesn't really matter
|
||||
# what stdenv we use here, as long as CMake is happy.
|
||||
cxx-headers = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
# Note that if we use the regular stdenv here we'll get cycle errors
|
||||
# when attempting to use this compiler in the stdenv.
|
||||
#
|
||||
# The final stdenv pulls `cxx-headers` from the package set where
|
||||
# hostPlatform *is* the target platform which means that `stdenv` at
|
||||
# that point attempts to use this toolchain.
|
||||
#
|
||||
# So, we use `stdenv_` (the stdenv containing `clang` from this package
|
||||
# set, defined below) to sidestep this issue.
|
||||
#
|
||||
# Because we only use `cxx-headers` in `libcxxabi` (which depends on the
|
||||
# clang stdenv _anyways_), this is okay.
|
||||
stdenv = stdenv_;
|
||||
headersOnly = true;
|
||||
};
|
||||
|
||||
# `libcxxabi` *doesn't* need a compiler with a working C++ stdlib but it
|
||||
# *does* need a relatively modern C++ compiler (see:
|
||||
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/index.html#platform-and-compiler-support).
|
||||
#
|
||||
# So, we use the clang from this LLVM package set, like libc++
|
||||
# "boostrapping builds" do:
|
||||
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/BuildingLibcxx.html#bootstrapping-build
|
||||
#
|
||||
# We cannot use `clangNoLibcxx` because that contains `compiler-rt` which,
|
||||
# on macOS, depends on `libcxxabi`, thus forming a cycle.
|
||||
stdenv_ = overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc;
|
||||
in callPackage ./libcxxabi {
|
||||
stdenv = stdenv_;
|
||||
inherit llvm_meta cxx-headers;
|
||||
};
|
||||
|
||||
# Like `libcxxabi` above, `libcxx` requires a fairly modern C++ compiler,
|
||||
# `libcxx` requires a fairly modern C++ compiler,
|
||||
# so: we use the clang from this LLVM package set instead of the regular
|
||||
# stdenv's compiler.
|
||||
libcxx = callPackage ./libcxx {
|
||||
|
||||
@@ -1,115 +1,113 @@
|
||||
{ lib, stdenv, llvm_meta
|
||||
, monorepoSrc, runCommand, fetchpatch
|
||||
, cmake, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
|
||||
, libcxxabi, libcxxrt, libunwind
|
||||
, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
|
||||
, libcxxrt, libunwind
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
|
||||
# If headersOnly is true, the resulting package would only include the headers.
|
||||
# Use this to break the circular dependency between libcxx and libcxxabi.
|
||||
#
|
||||
# Some context:
|
||||
# https://reviews.llvm.org/rG1687f2bbe2e2aaa092f942d4a97d41fad43eedfb
|
||||
, headersOnly ? false
|
||||
}:
|
||||
|
||||
# external cxxabi is not supported on Darwin as the build will not link libcxx
|
||||
# properly and not re-export the cxxabi symbols into libcxx
|
||||
# https://github.com/NixOS/nixpkgs/issues/166205
|
||||
# https://github.com/NixOS/nixpkgs/issues/269548
|
||||
assert cxxabi == null || !stdenv.hostPlatform.isDarwin;
|
||||
let
|
||||
basename = "libcxx";
|
||||
cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}";
|
||||
runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi";
|
||||
|
||||
# Note: useLLVM is likely false for Darwin but true under pkgsLLVM
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
|
||||
cxxabiCMakeFlags = lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cxxCMakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=${cxxabiName}"
|
||||
] ++ lib.optionals (cxxabi != null) [
|
||||
"-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
] ++ lib.optionals useLLVM [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
# There's precedent for this in llvm-project/libcxx/cmake/caches.
|
||||
# In a monorepo build you might do the following in the libcxxabi build:
|
||||
# -DLLVM_ENABLE_PROJECTS=libcxxabi;libunwinder
|
||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=On
|
||||
# libcxx appears to require unwind and doesn't pull it in via other means.
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}"
|
||||
] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ cxxCMakeFlags
|
||||
++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
|
||||
|
||||
in
|
||||
|
||||
assert stdenv.isDarwin -> cxxabi.libName == "c++abi";
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = basename + lib.optionalString headersOnly "-headers";
|
||||
inherit version;
|
||||
pname = basename;
|
||||
inherit version cmakeFlags;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${basename} "$out"
|
||||
mkdir -p "$out/libcxxabi"
|
||||
cp -r ${monorepoSrc}/libcxxabi/include "$out/libcxxabi"
|
||||
src = runCommand "${pname}-src-${version}" {} (''
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/libcxx "$out"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/third-party "$out"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
'' + lib.optionalString (cxxabi == null) ''
|
||||
cp -r ${monorepoSrc}/libcxxabi "$out"
|
||||
'');
|
||||
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";
|
||||
|
||||
prePatch = ''
|
||||
cd ../${basename}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
# fix for https://github.com/NixOS/nixpkgs/issues/269548
|
||||
# https://github.com/llvm/llvm-project/pull/77218
|
||||
(fetchpatch {
|
||||
name = "darwin-system-libcxxabi-link-flags.patch";
|
||||
url = "https://github.com/llvm/llvm-project/commit/c5b89b29ee6e3c444a355fd1cf733ce7ab2e316a.patch";
|
||||
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
|
||||
relative = "libcxx";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
'';
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patchShebangs utils/cat_files.py
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames
|
||||
++ lib.optional (cxxabi != null) lndir;
|
||||
|
||||
buildInputs =
|
||||
lib.optionals (!headersOnly) [ cxxabi ]
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
buildInputs = [ cxxabi ]
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
|
||||
cmakeFlags = let
|
||||
# See: https://libcxx.llvm.org/BuildingLibcxx.html#cmdoption-arg-libcxx-cxx-abi-string
|
||||
libcxx_cxx_abi_opt = {
|
||||
"c++abi" = "system-libcxxabi";
|
||||
"cxxrt" = "libcxxrt";
|
||||
}.${cxxabi.libName} or (throw "unknown cxxabi: ${cxxabi.libName} (${cxxabi.pname})");
|
||||
in [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxx"
|
||||
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_opt}"
|
||||
] ++ lib.optional (!headersOnly && cxxabi.libName == "c++abi") "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi.dev}/include/c++/v1"
|
||||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
# There's precedent for this in llvm-project/libcxx/cmake/caches.
|
||||
# In a monorepo build you might do the following in the libcxxabi build:
|
||||
# -DLLVM_ENABLE_PROJECTS=libcxxabi;libunwinder
|
||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=On
|
||||
# libcxx appears to require unwind and doesn't pull it in via other means.
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
# If we're only building the headers we don't actually *need* a functioning
|
||||
# C/C++ compiler:
|
||||
++ lib.optionals (headersOnly) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
];
|
||||
|
||||
ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||
# libc++.so is a linker script which expands to multiple libraries,
|
||||
# libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
|
||||
# support linker scripts so the external cxxabi needs to be symlinked in
|
||||
postInstall = lib.optionalString (cxxabi != null) ''
|
||||
lndir ${lib.getDev cxxabi}/include ''${!outputDev}/include/c++/v1
|
||||
lndir ${lib.getLib cxxabi}/lib ''${!outputLib}/lib
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
inherit cxxabi;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 74eff2002fc9..c935d10878bb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -419,7 +419,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
@@ -436,7 +436,7 @@ else()
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
|
||||
endif()
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
@@ -1,114 +0,0 @@
|
||||
{ lib, stdenv, llvm_meta, cmake, ninja, python3
|
||||
, monorepoSrc, runCommand, fetchpatch
|
||||
, cxx-headers, libunwind, version
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libcxxabi";
|
||||
inherit version;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
mkdir -p "$out/libcxx/src"
|
||||
cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/include "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/src/include "$out/libcxx/src"
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
cd ../${pname}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
|
||||
# https://reviews.llvm.org/D132298, Allow building libcxxabi alone
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/e6a0800532bb409f6d1c62f3698bdd6994a877dc.patch";
|
||||
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
|
||||
stripLen = 1;
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxxabi"
|
||||
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
|
||||
|
||||
# `libcxxabi`'s build does not need a toolchain with a c++ stdlib attached
|
||||
# (we specify the headers it should use explicitly above).
|
||||
#
|
||||
# CMake however checks for this anyways; this flag tells it not to. See:
|
||||
# https://github.com/llvm/llvm-project/blob/4bd3f3759259548e159aeba5c76efb9a0864e6fa/llvm/runtimes/CMakeLists.txt#L243
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
preInstall = lib.optionalString stdenv.isDarwin ''
|
||||
for file in lib/*.dylib; do
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
install_name_tool -id $out/$file $file
|
||||
done
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$dev/include"
|
||||
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
libName = "c++abi";
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "Provides C++ standard library support";
|
||||
longDescription = ''
|
||||
libc++abi is a new implementation of low level support for a standard C++ library.
|
||||
'';
|
||||
# "All of the code in libc++abi is dual licensed under the MIT license and
|
||||
# the UIUC License (a BSD-like license)":
|
||||
license = with lib.licenses; [ mit ncsa ];
|
||||
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
|
||||
};
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b8326d08d23a..a1e36f713161 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -187,7 +187,7 @@ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
@@ -201,7 +201,7 @@ else()
|
||||
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
endif()
|
||||
|
||||
@@ -220,6 +220,11 @@ in
|
||||
--replace "PassBuilderCallbacksTest.cpp" ""
|
||||
rm unittests/IR/PassBuilderCallbacksTest.cpp
|
||||
rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
|
||||
|
||||
# Fails in the presence of anti-virus software or other intrusion-detection software that
|
||||
# modifies the atime when run. See #284056.
|
||||
rm test/tools/llvm-objcopy/ELF/strip-preserve-atime.test
|
||||
|
||||
# timing-based tests are trouble
|
||||
rm utils/lit/tests/googletest-timeout.py
|
||||
'' + optionalString stdenv.hostPlatform.isMusl ''
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib, stdenv, llvm_meta, version
|
||||
, monorepoSrc, runCommand
|
||||
, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libcxxabi, libxcrypt
|
||||
, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libxcrypt
|
||||
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
|
||||
}:
|
||||
|
||||
@@ -31,8 +31,7 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ cmake ninja python3 libllvm.dev ]
|
||||
++ lib.optional stdenv.isDarwin xcbuild.xcrun;
|
||||
buildInputs =
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString ([
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
|
||||
@@ -134,7 +134,6 @@ in let
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@@ -199,7 +198,6 @@ in let
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
@@ -308,45 +306,7 @@ in let
|
||||
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
|
||||
libcxxabi = let
|
||||
# CMake will "require" a compiler capable of compiling C++ programs
|
||||
# cxx-header's build does not actually use one so it doesn't really matter
|
||||
# what stdenv we use here, as long as CMake is happy.
|
||||
cxx-headers = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
# Note that if we use the regular stdenv here we'll get cycle errors
|
||||
# when attempting to use this compiler in the stdenv.
|
||||
#
|
||||
# The final stdenv pulls `cxx-headers` from the package set where
|
||||
# hostPlatform *is* the target platform which means that `stdenv` at
|
||||
# that point attempts to use this toolchain.
|
||||
#
|
||||
# So, we use `stdenv_` (the stdenv containing `clang` from this package
|
||||
# set, defined below) to sidestep this issue.
|
||||
#
|
||||
# Because we only use `cxx-headers` in `libcxxabi` (which depends on the
|
||||
# clang stdenv _anyways_), this is okay.
|
||||
stdenv = stdenv_;
|
||||
headersOnly = true;
|
||||
};
|
||||
|
||||
# `libcxxabi` *doesn't* need a compiler with a working C++ stdlib but it
|
||||
# *does* need a relatively modern C++ compiler (see:
|
||||
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/index.html#platform-and-compiler-support).
|
||||
#
|
||||
# So, we use the clang from this LLVM package set, like libc++
|
||||
# "boostrapping builds" do:
|
||||
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/BuildingLibcxx.html#bootstrapping-build
|
||||
#
|
||||
# We cannot use `clangNoLibcxx` because that contains `compiler-rt` which,
|
||||
# on macOS, depends on `libcxxabi`, thus forming a cycle.
|
||||
stdenv_ = overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc;
|
||||
in callPackage ./libcxxabi {
|
||||
stdenv = stdenv_;
|
||||
inherit llvm_meta cxx-headers;
|
||||
};
|
||||
|
||||
# Like `libcxxabi` above, `libcxx` requires a fairly modern C++ compiler,
|
||||
# `libcxx` requires a fairly modern C++ compiler,
|
||||
# so: we use the clang from this LLVM package set instead of the regular
|
||||
# stdenv's compiler.
|
||||
libcxx = callPackage ./libcxx {
|
||||
|
||||
@@ -1,71 +1,101 @@
|
||||
{ lib, stdenv, llvm_meta
|
||||
, monorepoSrc, runCommand, fetchpatch
|
||||
, cmake, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
|
||||
, libcxxabi, libcxxrt, libunwind
|
||||
, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
|
||||
, libcxxrt, libunwind
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
|
||||
# If headersOnly is true, the resulting package would only include the headers.
|
||||
# Use this to break the circular dependency between libcxx and libcxxabi.
|
||||
#
|
||||
# Some context:
|
||||
# https://reviews.llvm.org/rG1687f2bbe2e2aaa092f942d4a97d41fad43eedfb
|
||||
, headersOnly ? false
|
||||
}:
|
||||
|
||||
# external cxxabi is not supported on Darwin as the build will not link libcxx
|
||||
# properly and not re-export the cxxabi symbols into libcxx
|
||||
# https://github.com/NixOS/nixpkgs/issues/166205
|
||||
# https://github.com/NixOS/nixpkgs/issues/269548
|
||||
assert cxxabi == null || !stdenv.hostPlatform.isDarwin;
|
||||
let
|
||||
basename = "libcxx";
|
||||
cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}";
|
||||
runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi";
|
||||
|
||||
# Note: useLLVM is likely false for Darwin but true under pkgsLLVM
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
|
||||
cxxabiCMakeFlags = lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cxxCMakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=${cxxabiName}"
|
||||
] ++ lib.optionals (cxxabi != null) [
|
||||
"-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
] ++ lib.optionals useLLVM [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
# There's precedent for this in llvm-project/libcxx/cmake/caches.
|
||||
# In a monorepo build you might do the following in the libcxxabi build:
|
||||
# -DLLVM_ENABLE_PROJECTS=libcxxabi;libunwinder
|
||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=On
|
||||
# libcxx appears to require unwind and doesn't pull it in via other means.
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}"
|
||||
] ++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ cxxCMakeFlags
|
||||
++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
|
||||
|
||||
in
|
||||
|
||||
assert stdenv.isDarwin -> cxxabi.libName == "c++abi";
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = basename + lib.optionalString headersOnly "-headers";
|
||||
inherit version;
|
||||
pname = basename;
|
||||
inherit version cmakeFlags;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${basename} "$out"
|
||||
mkdir -p "$out/libcxxabi"
|
||||
cp -r ${monorepoSrc}/libcxxabi/include "$out/libcxxabi"
|
||||
src = runCommand "${pname}-src-${version}" {} (''
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/libcxx "$out"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/third-party "$out"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
'' + lib.optionalString (cxxabi == null) ''
|
||||
cp -r ${monorepoSrc}/libcxxabi "$out"
|
||||
'');
|
||||
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";
|
||||
|
||||
prePatch = ''
|
||||
cd ../${basename}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
# fix for https://github.com/NixOS/nixpkgs/issues/269548
|
||||
# https://github.com/llvm/llvm-project/pull/77218
|
||||
(fetchpatch {
|
||||
name = "darwin-system-libcxxabi-link-flags.patch";
|
||||
url = "https://github.com/llvm/llvm-project/commit/c5b89b29ee6e3c444a355fd1cf733ce7ab2e316a.patch";
|
||||
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
|
||||
relative = "libcxx";
|
||||
})
|
||||
] ++ lib.optionals (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [
|
||||
patches = lib.optionals (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [
|
||||
# https://github.com/llvm/llvm-project/issues/64226
|
||||
(fetchpatch {
|
||||
name = "0042-mbstate_t-not-defined.patch";
|
||||
url = "https://github.com/macports/macports-ports/raw/acd8acb171f1658596ed1cf25da48d5b932e2d19/lang/llvm-17/files/0042-mbstate_t-not-defined.patch";
|
||||
relative = "libcxx";
|
||||
hash = "sha256-fVbX99W1gQrSaMFeBkzsJmNWNy0xVSw+oFvDe4AYXL0=";
|
||||
hash = "sha256-jo+DYA6zuSv9OH3A0bYwY5TlkWprup4OKQ7rfK1WHBI=";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
cd runtimes
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
@@ -73,50 +103,22 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames
|
||||
++ lib.optional (cxxabi != null) lndir;
|
||||
|
||||
buildInputs =
|
||||
lib.optionals (!headersOnly) [ cxxabi ]
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
buildInputs = [ cxxabi ]
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
|
||||
cmakeFlags = let
|
||||
# See: https://libcxx.llvm.org/BuildingLibcxx.html#cmdoption-arg-libcxx-cxx-abi-string
|
||||
libcxx_cxx_abi_opt = {
|
||||
"c++abi" = "system-libcxxabi";
|
||||
"cxxrt" = "libcxxrt";
|
||||
}.${cxxabi.libName} or (throw "unknown cxxabi: ${cxxabi.libName} (${cxxabi.pname})");
|
||||
in [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxx"
|
||||
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_opt}"
|
||||
] ++ lib.optional (!headersOnly && cxxabi.libName == "c++abi") "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi.dev}/include/c++/v1"
|
||||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
# There's precedent for this in llvm-project/libcxx/cmake/caches.
|
||||
# In a monorepo build you might do the following in the libcxxabi build:
|
||||
# -DLLVM_ENABLE_PROJECTS=libcxxabi;libunwinder
|
||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=On
|
||||
# libcxx appears to require unwind and doesn't pull it in via other means.
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
# If we're only building the headers we don't actually *need* a functioning
|
||||
# C/C++ compiler:
|
||||
++ lib.optionals (headersOnly) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
];
|
||||
|
||||
ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||
# libc++.so is a linker script which expands to multiple libraries,
|
||||
# libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
|
||||
# support linker scripts so the external cxxabi needs to be symlinked in
|
||||
postInstall = lib.optionalString (cxxabi != null) ''
|
||||
lndir ${lib.getDev cxxabi}/include ''${!outputDev}/include/c++/v1
|
||||
lndir ${lib.getLib cxxabi}/lib ''${!outputLib}/lib
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
inherit cxxabi;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
{ lib, stdenv, llvm_meta, cmake, ninja, python3
|
||||
, monorepoSrc, runCommand, fetchpatch
|
||||
, cxx-headers, libunwind, version
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libcxxabi";
|
||||
inherit version;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
mkdir -p "$out/libcxx/src"
|
||||
cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/include "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/src/include "$out/libcxx/src"
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
cd ../${pname}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
|
||||
# https://reviews.llvm.org/D132298, Allow building libcxxabi alone
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/e6a0800532bb409f6d1c62f3698bdd6994a877dc.patch";
|
||||
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
|
||||
stripLen = 1;
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxxabi"
|
||||
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
|
||||
|
||||
# `libcxxabi`'s build does not need a toolchain with a c++ stdlib attached
|
||||
# (we specify the headers it should use explicitly above).
|
||||
#
|
||||
# CMake however checks for this anyways; this flag tells it not to. See:
|
||||
# https://github.com/llvm/llvm-project/blob/4bd3f3759259548e159aeba5c76efb9a0864e6fa/llvm/runtimes/CMakeLists.txt#L243
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
"-DUNIX=ON"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
preInstall = lib.optionalString stdenv.isDarwin ''
|
||||
for file in lib/*.dylib; do
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
install_name_tool -id $out/$file $file
|
||||
done
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$dev/include"
|
||||
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
libName = "c++abi";
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "Provides C++ standard library support";
|
||||
longDescription = ''
|
||||
libc++abi is a new implementation of low level support for a standard C++ library.
|
||||
'';
|
||||
# "All of the code in libc++abi is dual licensed under the MIT license and
|
||||
# the UIUC License (a BSD-like license)":
|
||||
license = with lib.licenses; [ mit ncsa ];
|
||||
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
|
||||
};
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
|
||||
index f380fe6b6b92..a9656258c38e 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -188,7 +188,7 @@ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
@@ -202,7 +202,7 @@ else()
|
||||
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE STRING
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
endif()
|
||||
|
||||
@@ -219,6 +219,10 @@ stdenv.mkDerivation (rec {
|
||||
--replace "PassBuilderCallbacksTest.cpp" ""
|
||||
rm unittests/IR/PassBuilderCallbacksTest.cpp
|
||||
rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
|
||||
|
||||
# Fails in the presence of anti-virus software or other intrusion-detection software that
|
||||
# modifies the atime when run. See #284056.
|
||||
rm test/tools/llvm-objcopy/ELF/strip-preserve-atime.test
|
||||
'' + optionalString stdenv.hostPlatform.isMusl ''
|
||||
patch -p1 -i ${../../common/llvm/TLI-musl.patch}
|
||||
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ lib, stdenv, llvm_meta, version
|
||||
, monorepoSrc, runCommand
|
||||
, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libcxxabi, libxcrypt
|
||||
, cmake, ninja, python3, xcbuild, libllvm, linuxHeaders, libxcrypt
|
||||
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
|
||||
}:
|
||||
|
||||
@@ -31,8 +31,7 @@ stdenv.mkDerivation {
|
||||
nativeBuildInputs = [ cmake ninja python3 libllvm.dev ]
|
||||
++ lib.optional stdenv.isDarwin xcbuild.xcrun;
|
||||
buildInputs =
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isRiscV) linuxHeaders;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString ([
|
||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||
|
||||
@@ -134,7 +134,6 @@ in let
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
@@ -199,7 +198,6 @@ in let
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = bintools';
|
||||
extraPackages = [
|
||||
libcxx.cxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
@@ -309,45 +307,7 @@ in let
|
||||
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
|
||||
libcxxabi = let
|
||||
# CMake will "require" a compiler capable of compiling C++ programs
|
||||
# cxx-header's build does not actually use one so it doesn't really matter
|
||||
# what stdenv we use here, as long as CMake is happy.
|
||||
cxx-headers = callPackage ./libcxx {
|
||||
inherit llvm_meta;
|
||||
# Note that if we use the regular stdenv here we'll get cycle errors
|
||||
# when attempting to use this compiler in the stdenv.
|
||||
#
|
||||
# The final stdenv pulls `cxx-headers` from the package set where
|
||||
# hostPlatform *is* the target platform which means that `stdenv` at
|
||||
# that point attempts to use this toolchain.
|
||||
#
|
||||
# So, we use `stdenv_` (the stdenv containing `clang` from this package
|
||||
# set, defined below) to sidestep this issue.
|
||||
#
|
||||
# Because we only use `cxx-headers` in `libcxxabi` (which depends on the
|
||||
# clang stdenv _anyways_), this is okay.
|
||||
stdenv = stdenv_;
|
||||
headersOnly = true;
|
||||
};
|
||||
|
||||
# `libcxxabi` *doesn't* need a compiler with a working C++ stdlib but it
|
||||
# *does* need a relatively modern C++ compiler (see:
|
||||
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/index.html#platform-and-compiler-support).
|
||||
#
|
||||
# So, we use the clang from this LLVM package set, like libc++
|
||||
# "boostrapping builds" do:
|
||||
# https://releases.llvm.org/15.0.0/projects/libcxx/docs/BuildingLibcxx.html#bootstrapping-build
|
||||
#
|
||||
# We cannot use `clangNoLibcxx` because that contains `compiler-rt` which,
|
||||
# on macOS, depends on `libcxxabi`, thus forming a cycle.
|
||||
stdenv_ = overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc;
|
||||
in callPackage ./libcxxabi {
|
||||
stdenv = stdenv_;
|
||||
inherit llvm_meta cxx-headers;
|
||||
};
|
||||
|
||||
# Like `libcxxabi` above, `libcxx` requires a fairly modern C++ compiler,
|
||||
# `libcxx` requires a fairly modern C++ compiler,
|
||||
# so: we use the clang from this LLVM package set instead of the regular
|
||||
# stdenv's compiler.
|
||||
libcxx = callPackage ./libcxx {
|
||||
|
||||
@@ -9,13 +9,13 @@ removes space from
|
||||
https://github.com/macports/macports-ports/raw/acd8acb171f1658596ed1cf25da48d5b932e2d19/lang/llvm-17/files/0042-mbstate_t-not-defined.patch
|
||||
so it applies cleanly
|
||||
---
|
||||
include/__mbstate_t.h | 3 +++
|
||||
libcxx/include/__mbstate_t.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/include/__mbstate_t.h b/include/__mbstate_t.h
|
||||
diff --git a/libcxx/include/__mbstate_t.h b/libcxx/include/__mbstate_t.h
|
||||
index bfa6d61..5f51112 100644
|
||||
--- a/include/__mbstate_t.h
|
||||
+++ b/include/__mbstate_t.h
|
||||
--- a/libcxx/include/__mbstate_t.h
|
||||
+++ b/libcxx/include/__mbstate_t.h
|
||||
@@ -42,6 +42,9 @@
|
||||
#elif __has_include(<bits/types/mbstate_t.h>)
|
||||
# include <bits/types/mbstate_t.h> // works on most Unixes
|
||||
|
||||
@@ -1,57 +1,107 @@
|
||||
{ lib, stdenv, llvm_meta
|
||||
, monorepoSrc, runCommand, fetchpatch
|
||||
, cmake, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
|
||||
, libcxxabi, libcxxrt, libunwind
|
||||
, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
|
||||
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
|
||||
, libcxxrt, libunwind
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
|
||||
# If headersOnly is true, the resulting package would only include the headers.
|
||||
# Use this to break the circular dependency between libcxx and libcxxabi.
|
||||
#
|
||||
# Some context:
|
||||
# https://reviews.llvm.org/rG1687f2bbe2e2aaa092f942d4a97d41fad43eedfb
|
||||
, headersOnly ? false
|
||||
}:
|
||||
|
||||
# external cxxabi is not supported on Darwin as the build will not link libcxx
|
||||
# properly and not re-export the cxxabi symbols into libcxx
|
||||
# https://github.com/NixOS/nixpkgs/issues/166205
|
||||
# https://github.com/NixOS/nixpkgs/issues/269548
|
||||
assert cxxabi == null || !stdenv.hostPlatform.isDarwin;
|
||||
let
|
||||
basename = "libcxx";
|
||||
cxxabiName = "lib${if cxxabi == null then "cxxabi" else cxxabi.libName}";
|
||||
runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi";
|
||||
|
||||
# Note: useLLVM is likely false for Darwin but true under pkgsLLVM
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
|
||||
cxxabiCMakeFlags = lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
] ++ lib.optionals (lib.versionAtLeast version "18" && !(useLLVM && !stdenv.hostPlatform.isWasm)) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=OFF"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cxxCMakeFlags = [
|
||||
"-DLIBCXX_CXX_ABI=${cxxabiName}"
|
||||
] ++ lib.optionals (cxxabi != null) [
|
||||
"-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${lib.getDev cxxabi}/include"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) [
|
||||
"-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
] ++ lib.optionals (lib.versionAtLeast version "18" && !useLLVM && stdenv.hostPlatform.libc == "glibc" && !stdenv.hostPlatform.isStatic) [
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=gcc_s"
|
||||
] ++ lib.optionals useLLVM [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
# There's precedent for this in llvm-project/libcxx/cmake/caches.
|
||||
# In a monorepo build you might do the following in the libcxxabi build:
|
||||
# -DLLVM_ENABLE_PROJECTS=libcxxabi;libunwinder
|
||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=On
|
||||
# libcxx appears to require unwind and doesn't pull it in via other means.
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" runtimes}"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ cxxCMakeFlags
|
||||
++ lib.optionals (cxxabi == null) cxxabiCMakeFlags;
|
||||
|
||||
in
|
||||
|
||||
assert stdenv.isDarwin -> cxxabi.libName == "c++abi";
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = basename + lib.optionalString headersOnly "-headers";
|
||||
inherit version;
|
||||
pname = basename;
|
||||
inherit version cmakeFlags;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${basename} "$out"
|
||||
mkdir -p "$out/libcxxabi"
|
||||
cp -r ${monorepoSrc}/libcxxabi/include "$out/libcxxabi"
|
||||
src = runCommand "${pname}-src-${version}" {} (''
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/libcxx "$out"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/third-party "$out"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
'' + lib.optionalString (cxxabi == null) ''
|
||||
cp -r ${monorepoSrc}/libcxxabi "$out"
|
||||
'');
|
||||
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";
|
||||
|
||||
prePatch = ''
|
||||
cd ../${basename}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = lib.optionals (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13") [
|
||||
# https://github.com/llvm/llvm-project/issues/64226
|
||||
./0001-darwin-10.12-mbstate_t-fix.patch
|
||||
] ++ lib.optionals (cxxabi == null && lib.versionAtLeast version "18") [
|
||||
# Allow building libcxxabi alone when using LLVM unwinder
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/77610dd10454e87bb387040d2b51100a17ac5755.patch";
|
||||
revert = true;
|
||||
hash = "sha256-jFbC3vBY3nKfjknJ7UzaPyoy0iSYdD3+jUmOFeOaVcA=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/48e5b5ea92674ded69b998cf35724d9012c0f57d.patch";
|
||||
revert = true;
|
||||
hash = "sha256-WN63L4T3GxVozPZb6kx21AgNe4rwwSUOeeryIGsvQYY=";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
cd runtimes
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
@@ -59,52 +109,22 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ]
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames
|
||||
++ lib.optional (cxxabi != null) lndir;
|
||||
|
||||
buildInputs =
|
||||
lib.optionals (!headersOnly) [ cxxabi ]
|
||||
++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
buildInputs = [ cxxabi ]
|
||||
++ lib.optionals (useLLVM && !stdenv.hostPlatform.isWasm) [ libunwind ];
|
||||
|
||||
cmakeFlags = let
|
||||
# See: https://libcxx.llvm.org/BuildingLibcxx.html#cmdoption-arg-libcxx-cxx-abi-string
|
||||
libcxx_cxx_abi_opt = {
|
||||
"c++abi" = "system-libcxxabi";
|
||||
"cxxrt" = "libcxxrt";
|
||||
}.${cxxabi.libName} or (throw "unknown cxxabi: ${cxxabi.libName} (${cxxabi.pname})");
|
||||
in [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxx"
|
||||
"-DLIBCXX_CXX_ABI=${if headersOnly then "none" else libcxx_cxx_abi_opt}"
|
||||
] ++ lib.optional (!headersOnly && cxxabi.libName == "c++abi") "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi.dev}/include/c++/v1"
|
||||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optionals (lib.versionAtLeast version "18" && !(stdenv.hostPlatform.useLLVM or false) && stdenv.hostPlatform.libc == "glibc" && !stdenv.hostPlatform.isStatic) [
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=gcc_s"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
"-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
# There's precedent for this in llvm-project/libcxx/cmake/caches.
|
||||
# In a monorepo build you might do the following in the libcxxabi build:
|
||||
# -DLLVM_ENABLE_PROJECTS=libcxxabi;libunwinder
|
||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=On
|
||||
# libcxx appears to require unwind and doesn't pull it in via other means.
|
||||
"-DLIBCXX_ADDITIONAL_LIBRARIES=unwind"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||
"-DUNIX=ON" # Required otherwise libc++ fails to detect the correct linker
|
||||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
|
||||
# If we're only building the headers we don't actually *need* a functioning
|
||||
# C/C++ compiler:
|
||||
++ lib.optionals (headersOnly) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
];
|
||||
|
||||
ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||
# libc++.so is a linker script which expands to multiple libraries,
|
||||
# libc++.so.1 and libc++abi.so or the external cxxabi. ld-wrapper doesn't
|
||||
# support linker scripts so the external cxxabi needs to be symlinked in
|
||||
postInstall = lib.optionalString (cxxabi != null) ''
|
||||
lndir ${lib.getDev cxxabi}/include ''${!outputDev}/include/c++/v1
|
||||
lndir ${lib.getLib cxxabi}/lib ''${!outputLib}/lib
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
inherit cxxabi;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
{ lib, stdenv, llvm_meta, cmake, ninja, python3
|
||||
, monorepoSrc, runCommand, fetchpatch
|
||||
, cxx-headers, libunwind, version
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libcxxabi";
|
||||
inherit version;
|
||||
|
||||
src = runCommand "${pname}-src-${version}" {} ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
mkdir -p "$out/libcxx/src"
|
||||
cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/include "$out/libcxx"
|
||||
cp -r ${monorepoSrc}/libcxx/src/include "$out/libcxx/src"
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = lib.optionalString stdenv.isDarwin ''
|
||||
export TRIPLE=x86_64-apple-darwin
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
cd ../${pname}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
|
||||
# https://reviews.llvm.org/D132298, Allow building libcxxabi alone
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/e6a0800532bb409f6d1c62f3698bdd6994a877dc.patch";
|
||||
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
|
||||
stripLen = 1;
|
||||
})
|
||||
] ++ lib.optionals (lib.versionAtLeast version "18") [
|
||||
# Allow building libcxxabi alone when using LLVM unwinder
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/77610dd10454e87bb387040d2b51100a17ac5755.patch";
|
||||
stripLen = 1;
|
||||
revert = true;
|
||||
hash = "sha256-Jogx/cvTJ6fdyprTD1QzMIeRWcBlZZMWE/y9joOtVH0=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/llvm/llvm-project/commit/48e5b5ea92674ded69b998cf35724d9012c0f57d.patch";
|
||||
stripLen = 1;
|
||||
revert = true;
|
||||
hash = "sha256-7VeBFjG7CnEMWn0hpBvyNOyhRfz50PnD3zyQNDhNChk=";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake ninja python3 ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxxabi"
|
||||
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
|
||||
|
||||
# `libcxxabi`'s build does not need a toolchain with a c++ stdlib attached
|
||||
# (we specify the headers it should use explicitly above).
|
||||
#
|
||||
# CMake however checks for this anyways; this flag tells it not to. See:
|
||||
# https://github.com/llvm/llvm-project/blob/4bd3f3759259548e159aeba5c76efb9a0864e6fa/llvm/runtimes/CMakeLists.txt#L243
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
] ++ lib.optionals (lib.versionAtLeast version "18" && !(stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm)) [
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=OFF"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false && !stdenv.hostPlatform.isWasm) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
|
||||
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib,
|
||||
# but that does not appear to be the case for example when building
|
||||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc).
|
||||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib"
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||
"-DUNIX=ON"
|
||||
] ++ lib.optionals (!enableShared) [
|
||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
preInstall = lib.optionalString stdenv.isDarwin ''
|
||||
for file in lib/*.dylib; do
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
install_name_tool -id $out/$file $file
|
||||
done
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$dev/include"
|
||||
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
libName = "c++abi";
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
description = "Provides C++ standard library support";
|
||||
longDescription = ''
|
||||
libc++abi is a new implementation of low level support for a standard C++ library.
|
||||
'';
|
||||
# "All of the code in libc++abi is dual licensed under the MIT license and
|
||||
# the UIUC License (a BSD-like license)":
|
||||
license = with lib.licenses; [ mit ncsa ];
|
||||
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
|
||||
};
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
|
||||
index f380fe6b6b92..a9656258c38e 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -188,7 +188,7 @@ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
@@ -202,7 +202,7 @@ else()
|
||||
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE STRING
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
endif()
|
||||
|
||||
@@ -223,6 +223,10 @@ stdenv.mkDerivation (rec {
|
||||
--replace "PassBuilderCallbacksTest.cpp" ""
|
||||
rm unittests/IR/PassBuilderCallbacksTest.cpp
|
||||
rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
|
||||
|
||||
# Fails in the presence of anti-virus software or other intrusion-detection software that
|
||||
# modifies the atime when run. See #284056.
|
||||
rm test/tools/llvm-objcopy/ELF/strip-preserve-atime.test
|
||||
'' + optionalString stdenv.hostPlatform.isMusl ''
|
||||
patch -p1 -i ${../../common/llvm/TLI-musl.patch}
|
||||
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||
|
||||
@@ -47,9 +47,6 @@ stdenv.mkDerivation rec {
|
||||
ghostscript
|
||||
];
|
||||
|
||||
# Work around https://github.com/NixOS/nixpkgs/issues/166205
|
||||
env.NIX_LDFLAGS = lib.optionalString (stdenv.cc.isClang && stdenv.cc.libcxx != null) "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
let
|
||||
args = rec {
|
||||
pname = "cargo-auditable";
|
||||
version = "0.6.1";
|
||||
version = "0.6.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rust-secure-code";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-MKMPLv8jeST0l4tq+MMPC18qfZMmBixdj6Ng19YKepU=";
|
||||
sha256 = "sha256-ERIzx9Fveanq7/aWcB2sviTxIahvSu0sTwgpGf/aYE8=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-6/f7pNaTL+U6bI6jMakU/lfwYYxN/EM3WkKZcydsyLk=";
|
||||
cargoHash = "sha256-4o3ctun/8VcBRuj+j0Yaawdkyn6Z6LPp+FTyhPxQWU8=";
|
||||
|
||||
# Cargo.lock is outdated
|
||||
preConfigure = ''
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
, llvm
|
||||
, spirv-headers
|
||||
, spirv-tools
|
||||
, disable-warnings-if-gcc13
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -42,7 +41,7 @@ let
|
||||
hash = "sha256-NoIoa20+2sH41rEnr8lsMhtfesrtdPINiXtUnxYVm8s=";
|
||||
} else throw "Incompatible LLVM version.";
|
||||
in
|
||||
disable-warnings-if-gcc13 (stdenv.mkDerivation {
|
||||
stdenv.mkDerivation {
|
||||
pname = "SPIRV-LLVM-Translator";
|
||||
inherit (branch) version;
|
||||
|
||||
@@ -118,4 +117,4 @@ disable-warnings-if-gcc13 (stdenv.mkDerivation {
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ gloaming ];
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
@@ -284,7 +284,6 @@ in stdenv.mkDerivation {
|
||||
patch -p1 -d swift -i ${./patches/swift-linux-fix-libc-paths.patch}
|
||||
patch -p1 -d swift -i ${./patches/swift-linux-fix-linking.patch}
|
||||
patch -p1 -d swift -i ${./patches/swift-darwin-libcxx-flags.patch}
|
||||
patch -p1 -d swift -i ${./patches/swift-darwin-link-cxxabi.patch}
|
||||
patch -p1 -d swift -i ${substituteAll {
|
||||
src = ./patches/swift-darwin-plistbuddy-workaround.patch;
|
||||
inherit swiftArch;
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
This patches the stdlib backdeploy static lib to have its users link c++abi.
|
||||
Without this, later steps that try to link this fail looking for global
|
||||
new/delete operators (__Znwm/__ZdlPv).
|
||||
|
||||
--- a/stdlib/toolchain/Compatibility56/Overrides.cpp
|
||||
+++ b/stdlib/toolchain/Compatibility56/Overrides.cpp
|
||||
@@ -23,6 +23,7 @@
|
||||
using namespace swift;
|
||||
|
||||
__asm__ (".linker_option \"-lc++\"");
|
||||
+__asm__ (".linker_option \"-lc++abi\"");
|
||||
|
||||
#define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \
|
||||
Override_ ## name name;
|
||||
@@ -35,14 +35,6 @@ let
|
||||
# that can happen when a Swift application dynamically links different versions
|
||||
# of libc++ and libc++abi than libraries it links are using.
|
||||
inherit (llvmPackages) libcxx;
|
||||
extraPackages = [
|
||||
llvmPackages.libcxxabi
|
||||
# Use the compiler-rt associated with clang, but use the libc++abi from the stdenv
|
||||
# to avoid linking against two different versions (for the same reasons as above).
|
||||
(swiftLlvmPackages.compiler-rt.override {
|
||||
inherit (llvmPackages) libcxxabi;
|
||||
})
|
||||
];
|
||||
}
|
||||
else
|
||||
swiftLlvmPackages.clang;
|
||||
|
||||
@@ -817,12 +817,5 @@ stdenv.mkDerivation ({
|
||||
// lib.optionalAttrs (stdenv.hasCC && stdenv.cc.isClang) {
|
||||
NIX_CFLAGS_COMPILE = "-Wno-error=int-conversion";
|
||||
}
|
||||
|
||||
# Ensure libc++abi is linked even when clang is invoked as just `clang` or `cc`.
|
||||
# Works around https://github.com/NixOS/nixpkgs/issues/166205.
|
||||
# This can be dropped once a fix has been committed to cc-wrapper.
|
||||
// lib.optionalAttrs (stdenv.hasCC && stdenv.cc.isClang && stdenv.cc.libcxx != null) {
|
||||
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -78,13 +78,15 @@ let
|
||||
if hdf5-forced != null
|
||||
then hdf5-forced
|
||||
else
|
||||
hdf5.override {
|
||||
hdf5.override ({
|
||||
usev110Api = useHdf5v110Api;
|
||||
mpiSupport = enableMPI;
|
||||
inherit mpi;
|
||||
szipSupport = enableSzip;
|
||||
inherit szip;
|
||||
};
|
||||
} // lib.optionalAttrs enableMPI {
|
||||
cppSupport = false;
|
||||
});
|
||||
netcdf-custom =
|
||||
if netcdf-forced != null
|
||||
then netcdf-forced
|
||||
|
||||
@@ -22,6 +22,11 @@ addToLuaSearchPathWithCustomDelimiter() {
|
||||
# export only if we haven't already got this dir in the search path
|
||||
if [[ ${!varName-} == *"$absPattern"* ]]; then return; fi
|
||||
|
||||
# if the path variable has not yet been set, initialize it to ";;"
|
||||
# this is a magic value that will be replaced by the default,
|
||||
# allowing relative modules to be used even when there are system modules.
|
||||
if [[ ! -v "${varName}" ]]; then export "${varName}=;;"; fi
|
||||
|
||||
export "${varName}=${!varName:+${!varName};}${absPattern}"
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ stdenv.mkDerivation (rec {
|
||||
|
||||
dontAddPrefix = !crossCompiling;
|
||||
|
||||
enableParallelBuilding = false;
|
||||
enableParallelBuilding = !crossCompiling;
|
||||
|
||||
# perl includes the build date, the uname of the build system and the
|
||||
# username of the build user in some files.
|
||||
|
||||
@@ -58,13 +58,13 @@
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "SDL2";
|
||||
version = "2.30.0";
|
||||
version = "2.30.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "libsdl-org";
|
||||
repo = "SDL";
|
||||
rev = "release-${finalAttrs.version}";
|
||||
hash = "sha256-uKL9/T6vCEqMqmD3Q3rCMtKPRJZ4fRYVUr+4628/Ajg=";
|
||||
hash = "sha256-nwmmyJK1/5Mu7l1YCk4PsasJIrx3jdiM5f/Cu3n0paA=";
|
||||
};
|
||||
dontDisableStatic = if withStatic then 1 else 0;
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "SDL2_mixer";
|
||||
version = "2.6.3";
|
||||
version = "2.8.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.libsdl.org/projects/SDL_mixer/release/${pname}-${version}.tar.gz";
|
||||
sha256 = "sha256-emuoakeGSM5hfjpekncYG8Z/fOmHZgXupq/9Sg1u6o8=";
|
||||
sha256 = "sha256-HPs0yHsm29vHr9aMT1RcARarX5C7/sxa6+Kpy0uzFUk=";
|
||||
};
|
||||
|
||||
configureFlags = [
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "SDL2_ttf";
|
||||
version = "2.20.2";
|
||||
version = "2.22.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.libsdl.org/projects/SDL_ttf/release/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
|
||||
sha256 = "sha256-ncce2TSHUhsQeixKnKa/Q/ti9r3dXCawVea5FBiiIFM=";
|
||||
sha256 = "sha256-1Iy9HOR1ueF4IGvzty1Wtm2E1E9krAWAMyg5YjTWdyM=";
|
||||
};
|
||||
|
||||
configureFlags = [ "--disable-harfbuzz-builtin" ]
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
, mesonEmulatorHook
|
||||
, ninja
|
||||
, pkg-config
|
||||
, cmake
|
||||
, gettext
|
||||
, xmlto
|
||||
, docbook-xsl-nons
|
||||
@@ -23,6 +24,10 @@
|
||||
, gperf
|
||||
, vala
|
||||
, curl
|
||||
, cairo
|
||||
, gdk-pixbuf
|
||||
, pango
|
||||
, librsvg
|
||||
, systemd
|
||||
, nixosTests
|
||||
, testers
|
||||
@@ -31,7 +36,7 @@
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "appstream";
|
||||
version = "1.0.1";
|
||||
version = "1.0.2";
|
||||
|
||||
outputs = [ "out" "dev" "installedTests" ];
|
||||
|
||||
@@ -39,7 +44,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
owner = "ximion";
|
||||
repo = "appstream";
|
||||
rev = "v${finalAttrs.version}";
|
||||
sha256 = "sha256-ULqRHepWVuAluXsXJUoqxqJfrN168MGlwdVkoLLwSN0=";
|
||||
sha256 = "sha256-0NzZku6TQyyaTOAMWZD459RayhsH8cotlOaSKkVY/EQ=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
@@ -63,6 +68,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
cmake
|
||||
gettext
|
||||
libxslt
|
||||
xmlto
|
||||
@@ -85,6 +91,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
libxmlb
|
||||
libyaml
|
||||
curl
|
||||
cairo
|
||||
gdk-pixbuf
|
||||
pango
|
||||
librsvg
|
||||
] ++ lib.optionals withSystemd [
|
||||
systemd
|
||||
];
|
||||
@@ -94,6 +104,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
"-Ddocs=false"
|
||||
"-Dvapi=true"
|
||||
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
|
||||
"-Dcompose=true"
|
||||
] ++ lib.optionals (!withSystemd) [
|
||||
"-Dsystemd=false"
|
||||
];
|
||||
|
||||
@@ -15,7 +15,10 @@ stdenv.mkDerivation {
|
||||
|
||||
nativeBuildInputs = appstream.nativeBuildInputs ++ [ qttools ];
|
||||
|
||||
mesonFlags = appstream.mesonFlags ++ [ "-Dqt${qtSuffix}=true" ];
|
||||
mesonFlags = appstream.mesonFlags ++ [
|
||||
(lib.mesonBool "qt" true)
|
||||
(lib.mesonOption "qt-versions" (lib.versions.major qtbase.version))
|
||||
];
|
||||
|
||||
patches = appstream.patches;
|
||||
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "at-spi2-core";
|
||||
version = "2.50.0";
|
||||
version = "2.50.1";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
separateDebugInfo = true;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
|
||||
sha256 = "6fWoyCNcndljshcd6RIDARKcZ33ekzlV4d9hi5ScStw=";
|
||||
sha256 = "Vye1wGh6xXuoBA55vWcxtxSja4/PMhkPI2uPs2mHiec=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libopenmpt";
|
||||
version = "0.7.3";
|
||||
version = "0.7.4";
|
||||
|
||||
outputs = [ "out" "dev" "bin" ];
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-${version}+release.autotools.tar.gz";
|
||||
hash = "sha256-LPg2m3kWsJJk8/FLn7bO81pum+4DKN7E9J2YIRzP1yI=";
|
||||
hash = "sha256-FgD5M16uOQQImmKG9SWBKWHFTONqBd/m7qpXbdkyjz8=";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From: Emil Lerch <emil@lerch.org>
|
||||
Date: Wed, 28 Apr 2021 17:46:24 -0700
|
||||
Subject: [PATCH] Allow dlopen to fail on musl systems
|
||||
|
||||
Now that references are forced when linking statically, the assertion is
|
||||
no longer necessary. See https://github.com/awslabs/aws-c-cal/pull/54
|
||||
---
|
||||
source/unix/openssl_platform_init.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/source/unix/openssl_platform_init.c b/source/unix/openssl_platform_init.c
|
||||
index 5266ecc1..99f210bd 100644
|
||||
--- a/source/unix/openssl_platform_init.c
|
||||
+++ b/source/unix/openssl_platform_init.c
|
||||
@@ -496,7 +502,6 @@ static enum aws_libcrypto_version s_resolve_libcrypto(void) {
|
||||
/* Try to auto-resolve against what's linked in/process space */
|
||||
FLOGF("searching process and loaded modules");
|
||||
void *process = dlopen(NULL, RTLD_NOW);
|
||||
- AWS_FATAL_ASSERT(process && "Unable to load symbols from process space");
|
||||
enum aws_libcrypto_version result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_LC, process);
|
||||
if (result == AWS_LIBCRYPTO_NONE) {
|
||||
result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_1_0_2, process);
|
||||
@@ -504,7 +509,9 @@ static enum aws_libcrypto_version s_resolve_libcrypto(void) {
|
||||
if (result == AWS_LIBCRYPTO_NONE) {
|
||||
result = s_resolve_libcrypto_symbols(AWS_LIBCRYPTO_1_1_1, process);
|
||||
}
|
||||
- dlclose(process);
|
||||
+ if (process) {
|
||||
+ dlclose(process);
|
||||
+ }
|
||||
|
||||
if (result == AWS_LIBCRYPTO_NONE) {
|
||||
FLOGF("libcrypto symbols were not statically linked, searching for shared libraries");
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user