about summary refs log tree commit diff
path: root/pkgs/applications/editors/quartus-prime
diff options
context:
space:
mode:
authorThomas Watson <twatson52@icloud.com>2024-04-06 16:07:35 -0500
committerBjørn Forsman <bjorn.forsman@gmail.com>2024-04-10 19:27:03 +0200
commit0355aaa7d29f6e4c990a52c119766a09d3e4371c (patch)
tree204c3395f689a218b4fabaf1c66d0093a676a745 /pkgs/applications/editors/quartus-prime
parent4d46279ad98b238bcb7c0c08b53a9e1aba1cf6d6 (diff)
quartus-prime-lite: add option to disable Questa simulator
Saves ~5GB of closure size and eliminates dependency on 32 bit
libraries.
Diffstat (limited to 'pkgs/applications/editors/quartus-prime')
-rw-r--r--pkgs/applications/editors/quartus-prime/default.nix11
-rw-r--r--pkgs/applications/editors/quartus-prime/quartus.nix26
2 files changed, 20 insertions, 17 deletions
diff --git a/pkgs/applications/editors/quartus-prime/default.nix b/pkgs/applications/editors/quartus-prime/default.nix
index b08bd7a6b365f..51a1a2925e92d 100644
--- a/pkgs/applications/editors/quartus-prime/default.nix
+++ b/pkgs/applications/editors/quartus-prime/default.nix
@@ -1,5 +1,6 @@
 { lib, buildFHSEnv, callPackage, makeDesktopItem, writeScript, runtimeShell
 , runCommand, unstick, quartus-prime-lite
+, withQuesta ? true
 , supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ]
 , unwrapped ? callPackage ./quartus.nix { inherit unstick supportedDevices withQuesta; }
 }:
@@ -18,11 +19,12 @@ in buildFHSEnv rec {
   name = "quartus-prime-lite"; # wrapped
 
   targetPkgs = pkgs: with pkgs; [
-    (runCommand "ld-lsb-compat" {} ''
+    (runCommand "ld-lsb-compat" {} (''
       mkdir -p "$out/lib"
       ln -sr "${glibc}/lib/ld-linux-x86-64.so.2" "$out/lib/ld-lsb-x86-64.so.3"
+    '' + lib.optionalString withQuesta ''
       ln -sr "${pkgsi686Linux.glibc}/lib/ld-linux.so.2" "$out/lib/ld-lsb.so.3"
-    '')
+    ''))
     # quartus requirements
     glib
     xorg.libICE
@@ -41,9 +43,10 @@ in buildFHSEnv rec {
     gnumake
   ];
 
-  # Also support 32-bit executables.
-  multiArch = true;
+  # Also support 32-bit executables used by simulator.
+  multiArch = withQuesta;
 
+  # these libs are installed as 64 bit, plus as 32 bit when multiArch is true
   multiPkgs = pkgs: with pkgs; let
     # This seems ugly - can we override `libpng = libpng12` for all `pkgs`?
     freetype = pkgs.freetype.override { libpng = libpng12; };
diff --git a/pkgs/applications/editors/quartus-prime/quartus.nix b/pkgs/applications/editors/quartus-prime/quartus.nix
index 5b9a9dc879fcb..12c7039563c1e 100644
--- a/pkgs/applications/editors/quartus-prime/quartus.nix
+++ b/pkgs/applications/editors/quartus-prime/quartus.nix
@@ -1,4 +1,5 @@
 { stdenv, lib, unstick, fetchurl
+, withQuesta ? true
 , supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ]
 }:
 
@@ -41,26 +42,25 @@ let
     url = "https://downloads.intel.com/akdlm/software/acdsinst/${lib.versions.majorMinor version}std/${lib.elemAt (lib.splitVersion version) 4}/ib_installers/${name}";
   };
 
-in stdenv.mkDerivation rec {
-  inherit version;
-  pname = "quartus-prime-lite-unwrapped";
-
-  src = map download ([{
+  installers = map download ([{
     name = "QuartusLiteSetup-${version}-linux.run";
     sha256 = "1mg4db56rg407kdsvpzys96z59bls8djyddfzxi6bdikcklxz98h";
-  } {
+  }] ++ lib.optional withQuesta {
     name = "QuestaSetup-${version}-linux.run";
     sha256 = "0f9lyphk4vf4ijif3kb4iqf18jl357z9h8g16kwnzaqwfngh2ixk";
-  }] ++ (map (id: {
+  });
+  components = map (id: download {
     name = "${id}-${version}.qdz";
     sha256 = lib.getAttr id componentHashes;
-  }) (lib.attrValues supportedDeviceIds)));
+  }) (lib.attrValues supportedDeviceIds);
+
+in stdenv.mkDerivation rec {
+  inherit version;
+  pname = "quartus-prime-lite-unwrapped";
 
   nativeBuildInputs = [ unstick ];
 
   buildCommand = let
-    installers = lib.sublist 0 2 src;
-    components = lib.sublist 2 ((lib.length src) - 2) src;
     copyInstaller = installer: ''
         # `$(cat $NIX_CC/nix-support/dynamic-linker) $src[0]` often segfaults, so cp + patchelf
         cp ${installer} $TEMP/${installer.name}
@@ -68,13 +68,13 @@ in stdenv.mkDerivation rec {
         patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $TEMP/${installer.name}
       '';
     copyComponent = component: "cp ${component} $TEMP/${component.name}";
-    # leaves enabled: quartus, questa_fse, devinfo
+    # leaves enabled: quartus, devinfo
     disabledComponents = [
       "quartus_help"
       "quartus_update"
-      # not questa_fse
       "questa_fe"
-    ] ++ (lib.attrValues unsupportedDeviceIds);
+    ] ++ (lib.optional (!withQuesta) "questa_fse")
+      ++ (lib.attrValues unsupportedDeviceIds);
   in ''
       echo "setting up installer..."
       ${lib.concatMapStringsSep "\n" copyInstaller installers}