2021-05-30 12:07:31 +02:00
|
|
|
{ stdenv, lib, buildFHSUserEnv, callPackage, makeDesktopItem, writeScript
|
|
|
|
, supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ]
|
|
|
|
, unwrapped ? callPackage ./quartus.nix { inherit supportedDevices; }
|
|
|
|
}:
|
2019-12-11 22:25:48 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
desktopItem = makeDesktopItem {
|
2020-03-13 23:44:24 +01:00
|
|
|
name = "quartus-prime-lite";
|
2019-12-11 22:25:48 +01:00
|
|
|
exec = "quartus";
|
|
|
|
icon = "quartus";
|
|
|
|
desktopName = "Quartus";
|
2020-03-13 23:44:24 +01:00
|
|
|
genericName = "Quartus Prime";
|
2019-12-11 22:25:48 +01:00
|
|
|
categories = "Development;";
|
|
|
|
};
|
|
|
|
# I think modelsim_ase/linux/vlm checksums itself, so use FHSUserEnv instead of `patchelf`
|
2020-03-13 23:44:24 +01:00
|
|
|
in buildFHSUserEnv rec {
|
|
|
|
name = "quartus-prime-lite"; # wrapped
|
2019-12-11 22:25:48 +01:00
|
|
|
|
|
|
|
targetPkgs = pkgs: with pkgs; [
|
|
|
|
# quartus requirements
|
|
|
|
glib
|
|
|
|
xorg.libICE
|
|
|
|
xorg.libSM
|
|
|
|
zlib
|
|
|
|
# qsys requirements
|
|
|
|
xorg.libXtst
|
|
|
|
xorg.libXi
|
|
|
|
];
|
|
|
|
multiPkgs = pkgs: with pkgs; let
|
|
|
|
# This seems ugly - can we override `libpng = libpng12` for all `pkgs`?
|
|
|
|
freetype = pkgs.freetype.override { libpng = libpng12; };
|
|
|
|
fontconfig = pkgs.fontconfig.override { inherit freetype; };
|
|
|
|
libXft = pkgs.xorg.libXft.override { inherit freetype fontconfig; };
|
|
|
|
in [
|
|
|
|
# modelsim requirements
|
|
|
|
libxml2
|
|
|
|
ncurses5
|
|
|
|
unixODBC
|
|
|
|
libXft
|
|
|
|
# common requirements
|
|
|
|
freetype
|
|
|
|
fontconfig
|
|
|
|
xorg.libX11
|
|
|
|
xorg.libXext
|
|
|
|
xorg.libXrender
|
|
|
|
];
|
|
|
|
|
2021-05-29 23:02:27 +02:00
|
|
|
passthru = { inherit unwrapped; };
|
2020-03-13 23:44:24 +01:00
|
|
|
|
|
|
|
extraInstallCommands = let
|
|
|
|
quartusExecutables = (map (c: "quartus/bin/quartus_${c}") [
|
|
|
|
"asm" "cdb" "cpf" "drc" "eda" "fit" "jbcc" "jli" "map" "pgm" "pow"
|
|
|
|
"sh" "si" "sim" "sta" "stp" "tan"
|
|
|
|
]) ++ [ "quartus/bin/quartus" ];
|
|
|
|
|
|
|
|
qsysExecutables = map (c: "quartus/sopc_builder/bin/qsys-${c}") [
|
|
|
|
"generate" "edit" "script"
|
|
|
|
];
|
|
|
|
# Should we install all executables ?
|
|
|
|
modelsimExecutables = map (c: "modelsim_ase/bin/${c}") [
|
|
|
|
"vsim" "vlog" "vlib"
|
|
|
|
];
|
|
|
|
in ''
|
|
|
|
mkdir -p $out/share/applications $out/share/icons/128x128
|
|
|
|
ln -s ${desktopItem}/share/applications/* $out/share/applications
|
2021-05-29 23:02:27 +02:00
|
|
|
ln -s ${unwrapped}/licenses/images/dc_quartus_panel_logo.png $out/share/icons/128x128/quartus.png
|
2020-03-13 23:44:24 +01:00
|
|
|
|
|
|
|
mkdir -p $out/quartus/bin $out/quartus/sopc_builder/bin $out/modelsim_ase/bin
|
|
|
|
WRAPPER=$out/bin/${name}
|
|
|
|
EXECUTABLES="${lib.concatStringsSep " " (quartusExecutables ++ qsysExecutables ++ modelsimExecutables)}"
|
|
|
|
for executable in $EXECUTABLES; do
|
|
|
|
echo "#!${stdenv.shell}" >> $out/$executable
|
2021-05-29 23:02:27 +02:00
|
|
|
echo "$WRAPPER ${unwrapped}/$executable \$@" >> $out/$executable
|
2020-03-13 23:44:24 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
cd $out
|
|
|
|
chmod +x $EXECUTABLES
|
|
|
|
# link into $out/bin so executables become available on $PATH
|
|
|
|
ln --symbolic --relative --target-directory ./bin $EXECUTABLES
|
2019-12-11 22:25:48 +01:00
|
|
|
'';
|
|
|
|
|
2020-03-13 23:44:24 +01:00
|
|
|
runScript = writeScript "${name}-wrapper" ''
|
|
|
|
exec $@
|
|
|
|
'';
|
2019-12-11 22:25:48 +01:00
|
|
|
}
|