remove a small amount of LLVM bloat

Also avoids libffi.dll dependency on Windows.
This commit is contained in:
Sebastien Bourdeauducq 2021-12-08 17:41:34 +08:00
parent ddb4c548ae
commit 3f73896477
5 changed files with 8 additions and 22 deletions

View File

@ -47,7 +47,7 @@
src = self; src = self;
inherit cargoSha256; inherit cargoSha256;
nativeBuildInputs = [ pkgs.python3 llvm-nac3 ]; nativeBuildInputs = [ pkgs.python3 llvm-nac3 ];
buildInputs = [ pkgs.python3 pkgs.libffi pkgs.libxml2 llvm-nac3 ]; buildInputs = [ pkgs.python3 llvm-nac3 ];
cargoBuildFlags = [ "--package" "nac3artiq" ]; cargoBuildFlags = [ "--package" "nac3artiq" ];
cargoTestFlags = [ "--package" "nac3ast" "--package" "nac3parser" "--package" "nac3core" "--package" "nac3artiq" ]; cargoTestFlags = [ "--package" "nac3ast" "--package" "nac3parser" "--package" "nac3core" "--package" "nac3artiq" ];
installPhase = installPhase =
@ -68,7 +68,7 @@
src = self; src = self;
inherit cargoSha256; inherit cargoSha256;
nativeBuildInputs = [ pkgs.zip ]; nativeBuildInputs = [ pkgs.zip ];
buildInputs = [ pkgs-mingw.libffi pkgs-mingw.zlib ]; buildInputs = [ pkgs-mingw.zlib ];
configurePhase = configurePhase =
'' ''
export PYO3_CONFIG_FILE=${pyo3-mingw-config} export PYO3_CONFIG_FILE=${pyo3-mingw-config}
@ -109,8 +109,6 @@
cargo cargo
cargo-insta cargo-insta
rustc rustc
libffi
libxml2
clippy clippy
(python3.withPackages(ps: [ ps.numpy ])) (python3.withPackages(ps: [ ps.numpy ]))
]; ];

View File

@ -4,21 +4,13 @@
, fetchpatch , fetchpatch
, cmake , cmake
, python3 , python3
, libffi
, libbfd , libbfd
, libpfm
, libxml2
, ncurses , ncurses
, zlib , zlib
, llvmPackages_12 , llvmPackages_12
, debugVersion ? false , debugVersion ? false
, enableManpages ? false , enableManpages ? false
, enableSharedLibraries ? (!stdenv.hostPlatform.isStatic && !stdenv.targetPlatform.isMinGW) , enableSharedLibraries ? false
, 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
)
, enablePolly ? false , enablePolly ? false
}: }:
@ -59,8 +51,7 @@ in stdenv.mkDerivation (rec {
nativeBuildInputs = [ cmake python3 ] nativeBuildInputs = [ cmake python3 ]
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ]; ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
buildInputs = [ libxml2 libffi ] buildInputs = [ ];
++ optional enablePFM libpfm; # exegesis
propagatedBuildInputs = optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ ncurses ] propagatedBuildInputs = optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ ncurses ]
++ [ zlib ]; ++ [ zlib ];
@ -128,13 +119,10 @@ in stdenv.mkDerivation (rec {
cmakeFlags = with stdenv; [ cmakeFlags = with stdenv; [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/" "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}" "-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_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_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_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" "-DLLVM_TARGETS_TO_BUILD=X86;ARM;RISCV"
] ++ optionals enableSharedLibraries [ ] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON" "-DLLVM_LINK_LLVM_DYLIB=ON"

View File

@ -19,4 +19,4 @@ nac3core = { path = "../nac3core" }
git = "https://github.com/TheDan64/inkwell" git = "https://github.com/TheDan64/inkwell"
branch = "master" branch = "master"
default-features = false default-features = false
features = ["llvm12-0", "target-x86", "target-arm", "target-riscv"] features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]

View File

@ -17,7 +17,7 @@ nac3parser = { path = "../nac3parser" }
git = "https://github.com/TheDan64/inkwell" git = "https://github.com/TheDan64/inkwell"
branch = "master" branch = "master"
default-features = false 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] [dev-dependencies]
test-case = "1.2.0" test-case = "1.2.0"

View File

@ -13,4 +13,4 @@ nac3core = { path = "../nac3core" }
git = "https://github.com/TheDan64/inkwell" git = "https://github.com/TheDan64/inkwell"
branch = "master" branch = "master"
default-features = false default-features = false
features = ["llvm12-0", "target-x86", "target-arm", "target-riscv"] features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]