From c73d086a49f5792872a619671e63627415138305 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 20 Aug 2022 22:55:41 +0000 Subject: [PATCH] quartus-prime-lite: cleanup Fixes a few issues, listed below. Intel's website redesign broke the requireFile link, but fortunately files can now be downloaded without a user account. The derivation is modified to remove requireFile and download directly instead. Issues with quoting command line arguments are corrected. An issue causing crashes when running in containers is worked around with LD_PRELOAD. The meta.platforms attribute is corrected to the supported processors. --- .../editors/quartus-prime/default.nix | 11 ++++++++--- .../editors/quartus-prime/quartus.nix | 15 +++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/editors/quartus-prime/default.nix b/pkgs/applications/editors/quartus-prime/default.nix index 5a790e78090d..d8e57fdb508f 100644 --- a/pkgs/applications/editors/quartus-prime/default.nix +++ b/pkgs/applications/editors/quartus-prime/default.nix @@ -25,7 +25,6 @@ in buildFHSUserEnv rec { # qsys requirements xorg.libXtst xorg.libXi - libudev0-shim ]; multiPkgs = pkgs: with pkgs; let # This seems ugly - can we override `libpng = libpng12` for all `pkgs`? @@ -44,6 +43,7 @@ in buildFHSUserEnv rec { xorg.libX11 xorg.libXext xorg.libXrender + libudev0-shim ]; passthru = { inherit unwrapped; }; @@ -71,7 +71,7 @@ in buildFHSUserEnv rec { EXECUTABLES="${lib.concatStringsSep " " (quartusExecutables ++ qsysExecutables ++ modelsimExecutables)}" for executable in $EXECUTABLES; do echo "#!${stdenv.shell}" >> $out/$executable - echo "$WRAPPER ${unwrapped}/$executable \$@" >> $out/$executable + echo "$WRAPPER ${unwrapped}/$executable \"\$@\"" >> $out/$executable done cd $out @@ -80,7 +80,12 @@ in buildFHSUserEnv rec { ln --symbolic --relative --target-directory ./bin $EXECUTABLES ''; + # LD_PRELOAD fixes issues in the licensing system that cause memory corruption and crashes when + # starting most operations in many containerized environments, including WSL2, Docker, and LXC + # (a similiar fix involving LD_PRELOADing tcmalloc did not solve the issue in my situation) + # we use the name so that quartus can load the 64 bit verson and modelsim can load the 32 bit version + # https://community.intel.com/t5/Intel-FPGA-Software-Installation/Running-Quartus-Prime-Standard-on-WSL-crashes-in-libudev-so/m-p/1189032 runScript = writeScript "${name}-wrapper" '' - exec $@ + exec env LD_PRELOAD=libudev.so.0 "$@" ''; } diff --git a/pkgs/applications/editors/quartus-prime/quartus.nix b/pkgs/applications/editors/quartus-prime/quartus.nix index 4b5669860238..134a7807e0b3 100644 --- a/pkgs/applications/editors/quartus-prime/quartus.nix +++ b/pkgs/applications/editors/quartus-prime/quartus.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, unstick, requireFile +{ stdenv, lib, unstick, fetchurl , supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ] }: @@ -34,18 +34,18 @@ let }; version = "20.1.1.720"; - homepage = "https://fpgasoftware.intel.com"; - require = {name, sha256}: requireFile { + download = {name, sha256}: fetchurl { inherit name sha256; - url = "${homepage}/${lib.versions.majorMinor version}/?edition=lite&platform=linux"; + # e.g. "20.1.1.720" -> "20.1std.1/720" + url = "https://downloads.intel.com/akdlm/software/acdsinst/${lib.versions.majorMinor version}std.${lib.versions.patch version}/${lib.elemAt (lib.splitVersion version) 3}/ib_installers/${name}"; }; in stdenv.mkDerivation rec { inherit version; pname = "quartus-prime-lite-unwrapped"; - src = map require ([{ + src = map download ([{ name = "QuartusLiteSetup-${version}-linux.run"; sha256 = "0mjp1rg312dipr7q95pb4nf4b8fwvxgflnd1vafi3g9cshbb1c3k"; } { @@ -87,12 +87,11 @@ in stdenv.mkDerivation rec { ''; meta = with lib; { - inherit homepage; + homepage = "https://fpgasoftware.intel.com"; description = "FPGA design and simulation software"; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; - platforms = platforms.linux; - hydraPlatforms = [ ]; # requireFile srcs cannot be fetched by hydra, ignore + platforms = [ "x86_64-linux" ]; maintainers = with maintainers; [ kwohlfahrt ]; }; }