From 3f7389647762417263527b911fd9ce0ec72d93a7 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 8 Dec 2021 17:41:34 +0800 Subject: [PATCH] remove a small amount of LLVM bloat Also avoids libffi.dll dependency on Windows. --- flake.nix | 6 ++---- llvm/default.nix | 18 +++--------------- nac3artiq/Cargo.toml | 2 +- nac3core/Cargo.toml | 2 +- nac3standalone/Cargo.toml | 2 +- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/flake.nix b/flake.nix index 7b7198d9..e61f9f24 100644 --- a/flake.nix +++ b/flake.nix @@ -47,7 +47,7 @@ src = self; inherit cargoSha256; nativeBuildInputs = [ pkgs.python3 llvm-nac3 ]; - buildInputs = [ pkgs.python3 pkgs.libffi pkgs.libxml2 llvm-nac3 ]; + buildInputs = [ pkgs.python3 llvm-nac3 ]; cargoBuildFlags = [ "--package" "nac3artiq" ]; cargoTestFlags = [ "--package" "nac3ast" "--package" "nac3parser" "--package" "nac3core" "--package" "nac3artiq" ]; installPhase = @@ -68,7 +68,7 @@ src = self; inherit cargoSha256; nativeBuildInputs = [ pkgs.zip ]; - buildInputs = [ pkgs-mingw.libffi pkgs-mingw.zlib ]; + buildInputs = [ pkgs-mingw.zlib ]; configurePhase = '' export PYO3_CONFIG_FILE=${pyo3-mingw-config} @@ -109,8 +109,6 @@ cargo cargo-insta rustc - libffi - libxml2 clippy (python3.withPackages(ps: [ ps.numpy ])) ]; diff --git a/llvm/default.nix b/llvm/default.nix index 8f65dfda..ca372677 100644 --- a/llvm/default.nix +++ b/llvm/default.nix @@ -4,21 +4,13 @@ , fetchpatch , cmake , python3 -, libffi , libbfd -, libpfm -, libxml2 , ncurses , zlib , llvmPackages_12 , debugVersion ? false , enableManpages ? false -, enableSharedLibraries ? (!stdenv.hostPlatform.isStatic && !stdenv.targetPlatform.isMinGW) -, enablePFM ? !(stdenv.isDarwin - || stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245 - || stdenv.isAarch32 # broken for the armv7l builder - || stdenv.targetPlatform.isMinGW -) +, enableSharedLibraries ? false , enablePolly ? false }: @@ -59,8 +51,7 @@ in stdenv.mkDerivation (rec { nativeBuildInputs = [ cmake python3 ] ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ]; - buildInputs = [ libxml2 libffi ] - ++ optional enablePFM libpfm; # exegesis + buildInputs = [ ]; propagatedBuildInputs = optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ ncurses ] ++ [ zlib ]; @@ -128,13 +119,10 @@ in stdenv.mkDerivation (rec { cmakeFlags = with stdenv; [ "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/" "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}" - "-DLLVM_INSTALL_UTILS=ON" # Needed by rustc "-DLLVM_BUILD_TESTS=${if stdenv.targetPlatform.isMinGW then "OFF" else "ON"}" - "-DLLVM_ENABLE_FFI=ON" - "-DLLVM_ENABLE_RTTI=ON" "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" - "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_ENABLE_UNWIND_TABLES=OFF" "-DLLVM_TARGETS_TO_BUILD=X86;ARM;RISCV" ] ++ optionals enableSharedLibraries [ "-DLLVM_LINK_LLVM_DYLIB=ON" diff --git a/nac3artiq/Cargo.toml b/nac3artiq/Cargo.toml index b527b92e..8b4c8e13 100644 --- a/nac3artiq/Cargo.toml +++ b/nac3artiq/Cargo.toml @@ -19,4 +19,4 @@ nac3core = { path = "../nac3core" } git = "https://github.com/TheDan64/inkwell" branch = "master" default-features = false -features = ["llvm12-0", "target-x86", "target-arm", "target-riscv"] +features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] diff --git a/nac3core/Cargo.toml b/nac3core/Cargo.toml index 5aae208f..d69f4c0a 100644 --- a/nac3core/Cargo.toml +++ b/nac3core/Cargo.toml @@ -17,7 +17,7 @@ nac3parser = { path = "../nac3parser" } git = "https://github.com/TheDan64/inkwell" branch = "master" default-features = false -features = ["llvm12-0", "target-x86", "target-arm", "target-riscv"] +features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] [dev-dependencies] test-case = "1.2.0" diff --git a/nac3standalone/Cargo.toml b/nac3standalone/Cargo.toml index 41f33069..c538886a 100644 --- a/nac3standalone/Cargo.toml +++ b/nac3standalone/Cargo.toml @@ -13,4 +13,4 @@ nac3core = { path = "../nac3core" } git = "https://github.com/TheDan64/inkwell" branch = "master" default-features = false -features = ["llvm12-0", "target-x86", "target-arm", "target-riscv"] +features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]