shared/pkgs/mcuxpresso: fix LinkServer not being found

This commit is contained in:
Anthony Rodriguez 2025-01-01 13:51:40 +01:00
parent 8136d53ad7
commit 0bc8a83fd3
Signed by: nezia
GPG key ID: EE3BE97C040A86CE

View file

@ -1,8 +1,4 @@
{ {pkgs, ...}: let
pkgs,
onlyUdevRules ? false,
...
}: let
name = "mcuxpressoide"; name = "mcuxpressoide";
version = "24.9.25"; version = "24.9.25";
description = "MCUXpresso IDE"; description = "MCUXpresso IDE";
@ -21,21 +17,45 @@
sh $src --target deb || true sh $src --target deb || true
ar -xv deb/${filename} ar -xv deb/${filename}
tar xfvz data.tar.gz -C . tar xfvz data.tar.gz -C .
# Unpack LinkServer.
mkdir -p linkserver
sh deb/LinkServer_24.9.75.x86_64.deb.bin --target deb/linkserver || true
ar -xv deb/linkserver/LPCScrypt.deb
tar xfvz data.tar.gz -C linkserver
ar -xv deb/linkserver/MCU-Link.deb
tar xfvz data.tar.gz -C linkserver
ar -xv deb/linkserver/LinkServer_24.9.75.x86_64.deb
tar xfvz data.tar.gz -C linkserver
mkdir -p ./final/eclipse mkdir -p ./final/eclipse
mv ./usr/local/${name}-${version}/ide/* ./usr/local/${name}-${version}/ide/.* final/eclipse mv ./usr/local/${name}-${version}/ide/* ./usr/local/${name}-${version}/ide/.* final/eclipse
mv final/eclipse/mcuxpressoide final/eclipse/eclipse mv final/eclipse/mcuxpressoide final/eclipse/eclipse
mv final/eclipse/mcuxpressoide.ini final/eclipse/eclipse.ini mv final/eclipse/mcuxpressoide.ini final/eclipse/eclipse.ini
# Create custom .eclipseproduct file # Create custom .eclipseproduct file
rm final/eclipse/.eclipseproduct rm final/eclipse/.eclipseproduct
echo "name=${name} echo "name=${name}
id=com.nxp.${name} id=com.nxp.${name}
version=${version} version=${version}
" > final/eclipse/.eclipseproduct " > final/eclipse/.eclipseproduct
# Install udev rules # Install udev rules
mkdir -p final/lib/udev/rules.d mkdir -p final/lib/udev/rules.d
mv ./lib/udev/rules.d/56-pemicro.rules ./lib/udev/rules.d/85-mcuxpresso.rules final/lib/udev/rules.d/ mv ./lib/udev/rules.d/56-pemicro.rules ./lib/udev/rules.d/85-mcuxpresso.rules final/lib/udev/rules.d/
# Additional files # Additional files
mv ./usr/local/${name}-${version}/mcu_data final/mcu_data mv ./usr/local/${name}-${version}/mcu_data final/mcu_data
# Place LinkServer, lpcscrypt, and MCU-LINK_installer in /usr/local
mkdir -p ./final/usr/local
mv ./linkserver/usr/local/LinkServer_24.9.75 ./final/usr/local
mv ./linkserver/usr/local/lpcscrypt-2.1.3_83 ./final/usr/local
mv ./linkserver/usr/local/MCU-LINK_installer_3.148 ./final/usr/local
# Install LinkServer udev rules
# mv ./linkserver/lib/udev/rules.d/{85-linkserver_24.9.75.rules,85-mcu-link_3.148.rules,99-lpcscrypt.rules} final/lib/udev/rules.d
cd ./final cd ./final
tar -czf $out ./ tar -czf $out ./
''; '';
@ -70,8 +90,14 @@
pkgs.libxcrypt pkgs.libxcrypt
pkgs.libxcrypt-legacy pkgs.libxcrypt-legacy
pkgs.libusb-compat-0_1 pkgs.libusb-compat-0_1
pkgs.xorg.libxcb
pkgs.python3
]; ];
extraBuildCommands = ''
mkdir -p $out/usr/local
cp -r ${mcuxpressoide}/usr/local $out/usr
'';
runScript = "${mcuxpressoide}/bin/eclipse"; runScript = "${mcuxpressoide}/bin/eclipse";
}; };
in in
@ -89,21 +115,23 @@ in
exec = "mcuxpresso"; exec = "mcuxpresso";
}) })
]; ];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/lib/udev/rules.d
if [ ${toString onlyUdevRules} = "true" ]; then # Create necessary directories
# only copy udev rules mkdir -p $out/lib/udev/rules.d
cp ${mcuxpressoide}/lib/udev/rules.d/85-mcuxpresso.rules ${mcuxpressoide}/lib/udev/rules.d/56-pemicro.rules $out/lib/udev/rules.d/ mkdir -p $out/bin $out/eclipse $out/mcu_data
else
# copy full installation # Copy udev rules
mkdir -p $out/bin $out/eclipse $out/mcu_data cp ${mcuxpressoide}/lib/udev/rules.d/85-mcuxpresso.rules ${mcuxpressoide}/lib/udev/rules.d/56-pemicro.rules $out/lib/udev/rules.d/
cp ${mcuxpressoide}/lib/udev/rules.d/85-mcuxpresso.rules ${mcuxpressoide}/lib/udev/rules.d/56-pemicro.rules $out/lib/udev/rules.d/
cp -r ${mcuxpressoide}/eclipse $out/eclipse # Copy full installation
cp -r ${mcuxpressoide}/mcu_data $out/mcu_data cp -r ${mcuxpressoide}/eclipse $out/eclipse
ln -s ${mcuxpressoFhsEnv}/bin/mcuxpresso-env $out/bin/mcuxpresso cp -r ${mcuxpressoide}/mcu_data $out/mcu_data
fi
# Create symlink for the environment
ln -s ${mcuxpressoFhsEnv}/bin/mcuxpresso-env $out/bin/mcuxpresso
runHook postInstall runHook postInstall
''; '';