1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00

simulide: migrate to pkgs/by-name

This commit is contained in:
TomaSajt 2024-11-27 12:25:31 +01:00
parent 34ae6ed370
commit 17f173dd44
No known key found for this signature in database
GPG key ID: F011163C050122A1
3 changed files with 145 additions and 142 deletions

View file

@ -1,138 +0,0 @@
{
lib,
stdenv,
fetchbzr,
libsForQt5,
}:
let
generic =
{
version,
release,
rev,
src,
extraPostPatch ? "",
extraBuildInputs ? [ ],
iconPath ? "resources/icons/simulide.png",
installFiles ? ''
cp -r data examples $out/share/simulide
cp simulide $out/bin/simulide
'',
}:
stdenv.mkDerivation {
pname = "simulide";
version = "${version}-${release}";
inherit src;
postPatch = ''
sed -i resources/simulide.desktop \
-e "s|^Exec=.*$|Exec=simulide|" \
-e "s|^Icon=.*$|Icon=simulide|"
# Note: older versions don't have REV_NO
sed -i SimulIDE.pro \
-e "s|^VERSION = .*$|VERSION = ${version}|" \
-e "s|^RELEASE = .*$|RELEASE = -${release}|" \
-e "s|^REV_NO = .*$|REV_NO = ${rev}|" \
-e "s|^BUILD_DATE = .*$|BUILD_DATE = ??-??-??|"
${extraPostPatch}
'';
preConfigure = ''
cd build_XX
'';
nativeBuildInputs = with libsForQt5; [
qmake
wrapQtAppsHook
];
buildInputs =
(with libsForQt5; [
qtserialport
qtmultimedia
qttools
])
++ extraBuildInputs;
installPhase = ''
runHook preInstall
install -Dm644 ../resources/simulide.desktop $out/share/applications/simulide.desktop
install -Dm644 ../${iconPath} $out/share/icons/hicolor/256x256/apps/simulide.png
mkdir -p $out/share/simulide $out/bin
pushd executables/SimulIDE_*
${installFiles}
popd
runHook postInstall
'';
meta = {
description = "Simple real time electronic circuit simulator";
longDescription = ''
SimulIDE is a simple real time electronic circuit simulator, intended for hobbyist or students
to learn and experiment with analog and digital electronic circuits and microcontrollers.
It supports PIC, AVR, Arduino and other MCUs and MPUs.
'';
homepage = "https://simulide.com/";
license = lib.licenses.gpl3Only;
mainProgram = "simulide";
maintainers = with lib.maintainers; [
carloscraveiro
tomasajt
];
platforms = [ "x86_64-linux" ];
};
};
in
{
simulide_0_4_15 = generic rec {
version = "0.4.15";
release = "SR10";
rev = "291";
src = fetchbzr {
# the branch name does not mach the version for some reason
url = "https://code.launchpad.net/~arcachofo/simulide/simulide_0.4.14";
sha256 = "sha256-BBoZr/S2pif0Jft5wrem8y00dXl08jq3kFiIUtOr3LM=";
inherit rev;
};
extraPostPatch = ''
# GCC 13 needs the <cstdint> header explicitly included
sed -i src/gpsim/value.h -e '1i #include <cstdint>'
sed -i src/gpsim/modules/watchdog.h -e '1i #include <cstdint>'
'';
extraBuildInputs = [ libsForQt5.qtscript ];
iconPath = "resources/icons/hicolor/256x256/simulide.png"; # upstream had a messed up icon path in this release
installFiles = ''
cp -r share/simulide/* $out/share/simulide
cp bin/simulide $out/bin/simulide
'';
};
simulide_1_0_0 = generic rec {
version = "1.0.0";
release = "SR2";
rev = "1449";
src = fetchbzr {
url = "https://code.launchpad.net/~arcachofo/simulide/1.0.0";
sha256 = "sha256-rJWZvnjVzaKXU2ktbde1w8LSNvu0jWkDIk4dq2l7t5g=";
inherit rev;
};
extraBuildInputs = [ libsForQt5.qtscript ];
};
simulide_1_1_0 = generic rec {
version = "1.1.0";
release = "SR0";
rev = "1917";
src = fetchbzr {
url = "https://code.launchpad.net/~arcachofo/simulide/1.1.0";
sha256 = "sha256-qNBaGWl89Le9uC1VFK+xYhrLzIvOIWjkQbutnrAmZ2M=";
inherit rev;
};
};
}

View file

@ -0,0 +1,142 @@
{
lib,
stdenv,
fetchbzr,
libsForQt5,
versionNum ? "1.0.0",
}:
let
versionInfo = {
"0.4.15" = rec {
release = "SR10";
rev = "291";
src = fetchbzr {
# the branch name does not mach the version for some reason
url = "https://code.launchpad.net/~arcachofo/simulide/simulide_0.4.14";
sha256 = "sha256-BBoZr/S2pif0Jft5wrem8y00dXl08jq3kFiIUtOr3LM=";
inherit rev;
};
};
"1.0.0" = rec {
release = "SR2";
rev = "1449";
src = fetchbzr {
url = "https://code.launchpad.net/~arcachofo/simulide/1.0.0";
sha256 = "sha256-rJWZvnjVzaKXU2ktbde1w8LSNvu0jWkDIk4dq2l7t5g=";
inherit rev;
};
};
"1.1.0" = rec {
release = "SR0";
rev = "1917";
src = fetchbzr {
url = "https://code.launchpad.net/~arcachofo/simulide/1.1.0";
sha256 = "sha256-qNBaGWl89Le9uC1VFK+xYhrLzIvOIWjkQbutnrAmZ2M=";
inherit rev;
};
};
};
in
let
inherit (versionInfo.${versionNum} or (throw "Unsupported versionNum")) release rev src;
extraPostPatch = lib.optionalString (lib.versionOlder versionNum "1.0.0") ''
# GCC 13 needs the <cstdint> header explicitly included
sed -i src/gpsim/value.h -e '1i #include <cstdint>'
sed -i src/gpsim/modules/watchdog.h -e '1i #include <cstdint>'
'';
extraBuildInputs = lib.optionals (lib.versionOlder versionNum "1.1.0") [
libsForQt5.qtscript
];
iconPath =
if lib.versionOlder versionNum "1.0.0" then
"resources/icons/hicolor/256x256/simulide.png" # upstream had a messed up icon path in this release
else
"resources/icons/simulide.png";
installFiles =
if lib.versionOlder versionNum "1.0.0" then
''
cp -r share/simulide/* $out/share/simulide
cp bin/simulide $out/bin/simulide
''
else
''
cp -r data examples $out/share/simulide
cp simulide $out/bin/simulide
'';
in
stdenv.mkDerivation {
pname = "simulide";
version = "${versionNum}-${release}";
inherit src;
postPatch = ''
sed -i resources/simulide.desktop \
-e "s|^Exec=.*$|Exec=simulide|" \
-e "s|^Icon=.*$|Icon=simulide|"
# Note: older versions don't have REV_NO
sed -i SimulIDE.pro \
-e "s|^VERSION = .*$|VERSION = ${versionNum}|" \
-e "s|^RELEASE = .*$|RELEASE = -${release}|" \
-e "s|^REV_NO = .*$|REV_NO = ${rev}|" \
-e "s|^BUILD_DATE = .*$|BUILD_DATE = ??-??-??|"
${extraPostPatch}
'';
preConfigure = ''
cd build_XX
'';
nativeBuildInputs = with libsForQt5; [
qmake
wrapQtAppsHook
];
buildInputs =
(with libsForQt5; [
qtserialport
qtmultimedia
qttools
])
++ extraBuildInputs;
installPhase = ''
runHook preInstall
install -Dm644 ../resources/simulide.desktop $out/share/applications/simulide.desktop
install -Dm644 ../${iconPath} $out/share/icons/hicolor/256x256/apps/simulide.png
mkdir -p $out/share/simulide $out/bin
pushd executables/SimulIDE_*
${installFiles}
popd
runHook postInstall
'';
meta = {
description = "Simple real time electronic circuit simulator";
longDescription = ''
SimulIDE is a simple real time electronic circuit simulator, intended for hobbyist or students
to learn and experiment with analog and digital electronic circuits and microcontrollers.
It supports PIC, AVR, Arduino and other MCUs and MPUs.
'';
homepage = "https://simulide.com/";
license = lib.licenses.gpl3Only;
mainProgram = "simulide";
maintainers = with lib.maintainers; [
carloscraveiro
tomasajt
];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -17878,10 +17878,9 @@ with pkgs;
appcsxcad = libsForQt5.callPackage ../applications/science/electronics/appcsxcad { };
inherit (callPackage ../applications/science/electronics/simulide { })
simulide_0_4_15 simulide_1_0_0 simulide_1_1_0;
simulide = simulide_1_0_0;
simulide_0_4_15 = simulide.override { versionNum = "0.4.15"; };
simulide_1_0_0 = simulide.override { versionNum = "1.0.0"; };
simulide_1_1_0 = simulide.override { versionNum = "1.1.0"; };
eagle = libsForQt5.callPackage ../applications/science/electronics/eagle/eagle.nix { };