segger-jlink: add headless variant

This commit is contained in:
h7x4 2024-06-12 17:38:33 +02:00
parent 96a3646589
commit 66fc9e60cf
No known key found for this signature in database
GPG Key ID: 9F2F7D8250F35146
2 changed files with 52 additions and 43 deletions

93
pkgs/by-name/se/segger-jlink/package.nix Executable file → Normal file
View File

@ -5,6 +5,7 @@
, udev
, config
, acceptLicense ? config.segger-jlink.acceptLicense or false
, headless ? false
, fontconfig
, xorg
, makeDesktopItem
@ -120,10 +121,11 @@ in stdenv.mkDerivation {
nativeBuildInputs = [
autoPatchelfHook
] ++ lib.optionals (!headless) [
copyDesktopItems
];
buildInputs = [
buildInputs = lib.optionals (!headless) [
qt4-bundled
];
@ -135,55 +137,60 @@ in stdenv.mkDerivation {
dontConfigure = true;
dontBuild = true;
desktopItems = map (entry:
(makeDesktopItem {
name = entry;
exec = entry;
icon = "applications-utilities";
desktopName = entry;
genericName = "SEGGER ${entry}";
categories = [ "Development" ];
type = "Application";
terminal = false;
startupNotify = false;
})
) [
"JFlash"
"JFlashLite"
"JFlashSPI"
"JLinkConfig"
"JLinkGDBServer"
"JLinkLicenseManager"
"JLinkRTTViewer"
"JLinkRegistration"
"JLinkRemoteServer"
"JLinkSWOViewer"
"JLinkUSBWebServer"
"JMem"
];
desktopItems = lib.optionals (!headless) (
map (entry:
(makeDesktopItem {
name = entry;
exec = entry;
icon = "applications-utilities";
desktopName = entry;
genericName = "SEGGER ${entry}";
categories = [ "Development" ];
type = "Application";
terminal = false;
startupNotify = false;
})
) [
"JFlash"
"JFlashLite"
"JFlashSPI"
"JLinkConfig"
"JLinkGDBServer"
"JLinkLicenseManager"
"JLinkRTTViewer"
"JLinkRegistration"
"JLinkRemoteServer"
"JLinkSWOViewer"
"JLinkUSBWebServer"
"JMem"
]
);
installPhase = ''
runHook preInstall
# Install binaries and runtime files into /opt/
mkdir -p $out/opt
mv J* ETC GDBServer Firmwares $out/opt
# Link executables into /bin/
mkdir -p $out/bin
for binr in $out/opt/*Exe; do
binrlink=''${binr#"$out/opt/"}
ln -s $binr $out/bin/$binrlink
# Create additional symlinks without "Exe" suffix
binrlink=''${binrlink/%Exe}
ln -s $binr $out/bin/$binrlink
done
${lib.optionalString (!headless) ''
# Install binaries and runtime files into /opt/
mv J* ETC GDBServer Firmwares $out/opt
# Copy special alias symlinks
for slink in $(find $out/opt/. -type l); do
cp -P -n $slink $out/bin || true
rm $slink
done
# Link executables into /bin/
mkdir -p $out/bin
for binr in $out/opt/*Exe; do
binrlink=''${binr#"$out/opt/"}
ln -s $binr $out/bin/$binrlink
# Create additional symlinks without "Exe" suffix
binrlink=''${binrlink/%Exe}
ln -s $binr $out/bin/$binrlink
done
# Copy special alias symlinks
for slink in $(find $out/opt/. -type l); do
cp -P -n $slink $out/bin || true
rm $slink
done
''}
# Install libraries
install -Dm444 libjlinkarm.so* -t $out/lib

View File

@ -12758,6 +12758,8 @@ with pkgs;
seehecht = callPackage ../tools/text/seehecht { };
segger-jlink-headless = callPackage ../by-name/se/segger-jlink/package.nix { headless = true; };
selectdefaultapplication = libsForQt5.callPackage ../applications/misc/selectdefaultapplication { };
semantic-release = callPackage ../development/tools/semantic-release {