Merge pull request #203422 from prtzl/stm32cubemx

This commit is contained in:
Janik 2023-07-08 17:23:42 +02:00 committed by GitHub
commit ed6afb10df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
{ lib, stdenv, makeDesktopItem, copyDesktopItems, icoutils, fdupes, imagemagick, jdk11, fetchzip }:
{ lib, stdenv, makeDesktopItem, icoutils, fdupes, imagemagick, jdk11, fetchzip }:
# TODO: JDK16 causes STM32CubeMX to crash right now, so we fixed the version to JDK11
# This may be fixed in a future version of STM32CubeMX. This issue has been reported to ST:
# https://community.st.com/s/question/0D53W00000jnOzPSAU/stm32cubemx-crashes-on-launch-with-openjdk16
@ -17,22 +17,28 @@ stdenv.mkDerivation rec {
stripRoot = false;
};
nativeBuildInputs = [ icoutils fdupes imagemagick copyDesktopItems];
desktopItems = [
(makeDesktopItem {
name = "stm32CubeMX";
exec = "stm32cubemx";
desktopName = "STM32CubeMX";
categories = [ "Development" ];
comment = "STM32Cube initialization code generator";
icon = "stm32cubemx";
})
];
nativeBuildInputs = [ icoutils fdupes imagemagick ];
desktopItem = makeDesktopItem {
name = "STM32CubeMX";
exec = "stm32cubemx";
desktopName = "STM32CubeMX";
categories = [ "Development" ];
icon = "stm32cubemx";
comment = meta.description;
terminal = false;
startupNotify = false;
mimeTypes = [
"x-scheme-handler/sgnl"
"x-scheme-handler/signalcaptcha"
];
};
buildCommand = ''
mkdir -p $out/{bin,opt/STM32CubeMX}
mkdir -p $out/{bin,opt/STM32CubeMX,share/applications}
cp -r $src/MX/. $out/opt/STM32CubeMX/
chmod +rx $out/opt/STM32CubeMX/STM32CubeMX
cat << EOF > $out/bin/${pname}
#!${stdenv.shell}
${jdk11}/bin/java -jar $out/opt/STM32CubeMX/STM32CubeMX
@ -52,6 +58,8 @@ stdenv.mkDerivation rec {
$out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png
fi
done;
cp ${desktopItem}/share/applications/*.desktop $out/share/applications
'';
meta = with lib; {