git.iko.soy/typeable/nixpkgs
on master help sign in
stm32cubemx: 6.0.1 -> 6.2.1

Fixes: STM32CubeMX uses an outdated version of xstream that is not compatible with JDK16. The derivation uses JDK11 (LTS) explicitly now. Additionally, the desktop file wasn't generated by copyDesktopItems before. This is now fixed as well. Upstream changes: - Main files moved from . to MX - JAR file has no .exe extension anymore - Icon format changed from icns to ico - There is now a bundled JRE, but we prefer not to use it Additional changes: - Move version definition into mkDerivation

commitbe1392dbd9debfe1d9a72b6aeb01a7a3c625623f authorFelix Uhl <felix.uhl@outlook.de> dateTue 27 Apr 2021, 18:23 (6 years ago) parent1e4cba2
1 file changed+31−26
pkgs/development/tools/misc/stm32cubemx/default.nix+31−26
pkgs/development/tools/misc/stm32cubemx/default.nix+31−26
@@ -1,52 +1,57 @@
1−{ lib, stdenv, requireFile, makeDesktopItem, libicns, imagemagick, jre, fetchzip }:
2−
1+{ lib, stdenv, makeDesktopItem, copyDesktopItems, icoutils, fdupes, imagemagick, jdk11, fetchzip }:
2+# TODO: JDK16 causes STM32CubeMX to crash right now, so we fixed the version to JDK11
3+# This may be fixed in a future version of STM32CubeMX. This issue has been reported to ST:
4+# https://community.st.com/s/question/0D53W00000jnOzPSAU/stm32cubemx-crashes-on-launch-with-openjdk16
5+# If you're updating this derivation, check the link above to see if it's been fixed upstream
6+# and try replacing all occurrences of jdk11 with jre and test whether it works.
37let
4− version = "6.0.1";
5− desktopItem = makeDesktopItem {
6− name = "stm32CubeMX";
7− exec = "stm32cubemx";
8− desktopName = "STM32CubeMX";
9− categories = "Development;";
10− icon = "stm32cubemx";
11− };
8+ iconame = "STM32CubeMX";
129in
1310stdenv.mkDerivation rec {
1411 pname = "stm32cubemx";
15− inherit version;
16−
12+ version = "6.2.1";
1713
1814 src = fetchzip {
19− url = "https://sw-center.st.com/packs/resource/library/stm32cube_mx_v${builtins.replaceStrings ["."] [""] version}.zip";
20− sha256 = "15vxca1pgpgxgiz4wisrw0lylffdwnn4n46z9n0q37f8hmzlrk8f";
21− stripRoot= false;
15+ url = "https://sw-center.st.com/packs/resource/library/stm32cube_mx_v${builtins.replaceStrings ["."] [""] version}-lin.zip";
16+ sha256 = "0m5h01iq0mgrr9svj4gmykfi9lsyjpqzrkvlizff26c8dqad59c5";
17+ stripRoot = false;
2218 };
2319
24− nativeBuildInputs = [ libicns imagemagick ];
20+ nativeBuildInputs = [ icoutils fdupes imagemagick copyDesktopItems];
21+ desktopItems = [
22+ (makeDesktopItem {
23+ name = "stm32CubeMX";
24+ exec = "stm32cubemx";
25+ desktopName = "STM32CubeMX";
26+ categories = "Development;";
27+ comment = "STM32Cube initialization code generator";
28+ icon = "stm32cubemx";
29+ })
30+ ];
2531
2632 buildCommand = ''
27− mkdir -p $out/{bin,opt/STM32CubeMX,share/applications}
28− cp -r $src/. $out/opt/STM32CubeMX/
29− chmod +rx $out/opt/STM32CubeMX/STM32CubeMX.exe
33+ mkdir -p $out/{bin,opt/STM32CubeMX}
34+ cp -r $src/MX/. $out/opt/STM32CubeMX/
35+ chmod +rx $out/opt/STM32CubeMX/STM32CubeMX
3036 cat << EOF > $out/bin/${pname}
3137 #!${stdenv.shell}
32− ${jre}/bin/java -jar $out/opt/STM32CubeMX/STM32CubeMX.exe
38+ ${jdk11}/bin/java -jar $out/opt/STM32CubeMX/STM32CubeMX
3339 EOF
3440 chmod +x $out/bin/${pname}
3541
36− icns2png --extract $out/opt/STM32CubeMX/${pname}.icns
42+ icotool --extract $out/opt/STM32CubeMX/help/${iconame}.ico
43+ fdupes -dN . > /dev/null
3744 ls
3845 for size in 16 24 32 48 64 128 256; do
3946 mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps
40− if [ -e ${pname}_"$size"x"$size"x32.png ]; then
41− mv ${pname}_"$size"x"$size"x32.png \
47+ if [ $size -eq 256 ]; then
48+ mv ${iconame}_*_"$size"x"$size"x32.png \
4249 $out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png
4350 else
44− convert -resize "$size"x"$size" ${pname}_256x256x32.png \
51+ convert -resize "$size"x"$size" ${iconame}_*_256x256x32.png \
4552 $out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png
4653 fi
4754 done;
48−
49− ln -s ${desktopItem}/share/applications/* $out/share/applications
5055 '';
5156
5257 meta = with lib; {