Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jlink software tools: init at V7.92k #263487

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10037,6 +10037,12 @@
githubId = 1769386;
name = "Liam Diprose";
};
liarokapisv = {
email = "[email protected]";
github = "liarokapisv";
githubId = 19633626;
name = "Alexandros Liarokapis";
};
liberatys = {
email = "[email protected]";
name = "Nick Anthony Flueckiger";
Expand Down
49 changes: 49 additions & 0 deletions pkgs/by-name/jl/jlink-software-tools/JLink.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
157 changes: 157 additions & 0 deletions pkgs/by-name/jl/jlink-software-tools/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{ acceptLicense ? false
, lib
, stdenvNoCC
, requireFile
, fetchurl
, autoPatchelfHook
, patchelf
, dpkg
, xorg
, fontconfig
, libudev0-shim
}:

let
meta = {
homepage = "https://www.segger.com/downloads/jlink/";
description = "Segger JLink Software and Documentation pack";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = [
{
shortName = "segger-sfl";
fullName = "SEGGER's Friendly License";
url = "https://www.segger.com/purchase/licensing/license-sfl/";
free = false;
redistributable = false;
deprecated = false;

}
{
shortName = "segger-cul";
fullName = "SEGGER's Commercial-use License";
url = "https://www.segger.com/purchase/licensing/license-cul/";
free = false;
redistributable = false;
deprecated = false;
}
];
platforms = [ "x86_64-linux" ];
maintainers = with lib.maintainers; [ liarokapisv ];
};

version = "V7.92k";
versionNoDots = lib.strings.replaceStrings [ "." ] [ "" ] version;

platformSpecific = {
x86_64-linux = {
fileName = "JLink_Linux_${versionNoDots}_x86_64.deb";
sha256 = "sha256-MTPG0HeAcwOTHEHtqR/uOjuEu13UrTxQyX6zvwrDAoA=";
};
};

src =
let
system = stdenvNoCC.hostPlatform.system;
fileName = platformSpecific.${system}.fileName;
sha256 = platformSpecific.${system}.sha256;
url = " https://www.segger.com/downloads/jlink/${fileName}";
in
if acceptLicense then
(fetchurl {
inherit sha256;
inherit url;
curlOpts = "-d accept_license_agreement=accepted";
}) else
(requireFile {
name = fileName;
inherit sha256;
inherit url;
});
in
stdenvNoCC.mkDerivation
{
pname = "jlink-software-tools";

inherit version;
inherit src;
inherit meta;

nativeBuildInputs = [
dpkg
autoPatchelfHook
patchelf
];

buildInputs = [
xorg.libXrandr
xorg.libXfixes
xorg.libXcursor
xorg.libX11
xorg.libSM
xorg.libICE
fontconfig.lib
];

desktopApps = [
"JFlash"
"JFlashLite"
"JFlashSPI"
"JLinkConfig"
"JLink"
"JLinkGDBServer"
"JLinkGUIServer"
"JLinkLicenseManager"
"JLinkRegistration"
"JLinkRemoteServer"
"JLinkRTTClient"
"JLinkRTTLogger"
"JLinkRTTViewer"
"JLinkSTM32"
"JLinkSWOViewer"
"JMem"
"JRun"
"JTAGLoad"
];

installPhase = ''
dpkg-deb -x $src $out

# Soothe nix-build suspicions
chmod -R g-w $out

# Remove and recreate symlinks
rm -R $out/usr
mkdir -p $out/bin
for path in $out/opt/SEGGER/JLink_${versionNoDots}/J*
do
name=$(basename "$path")
ln -s "$out/opt/SEGGER/JLink_${versionNoDots}/$name" "$out/bin/$name"
done

# Add desktop entries icon
mkdir -p $out/share/pixmaps
ln -s ${./JLink.svg} $out/share/pixmaps/JLink.svg

# Create desktop entries
mkdir -p $out/share/applications
for name in $desktopApps
do
cat << EOF > "$out/share/applications/$name.desktop"
[Desktop Entry]
Type=Application
Name=$name
Exec=''${name}Exe
Icon=JLink
Terminal=false
StartupNotify=false
Categories=Development
EOF
chmod +x "$out/share/applications/$name.desktop"
done
'';

postFixup = ''
# needed due to dlopen
patchelf --add-rpath "${libudev0-shim}/lib" $out/opt/SEGGER/JLink_${versionNoDots}/libjlinkarm.so
'';
}