Merge pull request #297381 from emilytrau/logisim-darwin

logisim,logisim-evolution,mars-mips: add darwin bundle
This commit is contained in:
Weijia Wang 2024-03-22 16:17:30 +01:00 committed by GitHub
commit fed21ab52c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 107 additions and 57 deletions

View File

@ -1,25 +1,45 @@
{ lib, stdenv, fetchurl, jre, makeWrapper, copyDesktopItems, makeDesktopItem, unzip }:
{ lib
, stdenv
, fetchurl
, jre
, makeBinaryWrapper
, copyDesktopItems
, makeDesktopItem
, desktopToDarwinBundle
, unzip
}:
stdenv.mkDerivation rec {
let
icon = fetchurl {
url = "https://github.com/logisim-evolution/logisim-evolution/raw/9e0afa3cd6a8bfa75dab61830822cde83c70bb4b/artwork/logisim-evolution-icon.svg";
hash = "sha256-DNRimhNFt6jLdjqv7o2cNz38K6XnevxD0rGymym3xBs=";
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "logisim-evolution";
version = "3.8.0";
src = fetchurl {
url = "https://github.com/logisim-evolution/logisim-evolution/releases/download/v${version}/logisim-evolution-${version}-all.jar";
sha256 = "sha256-TFm+fa3CMp0OMhnKBc6cLIWGQbIG/OpOOCG7ea7wbCw=";
url = "https://github.com/logisim-evolution/logisim-evolution/releases/download/v${finalAttrs.version}/logisim-evolution-${finalAttrs.version}-all.jar";
hash = "sha256-TFm+fa3CMp0OMhnKBc6cLIWGQbIG/OpOOCG7ea7wbCw=";
};
dontUnpack = true;
nativeBuildInputs = [ makeWrapper copyDesktopItems unzip ];
nativeBuildInputs = [
makeBinaryWrapper
copyDesktopItems
unzip
] ++ lib.optionals stdenv.isDarwin [
desktopToDarwinBundle
];
desktopItems = [
(makeDesktopItem {
name = pname;
name = "logisim-evolution";
desktopName = "Logisim-evolution";
exec = "logisim-evolution";
icon = "logisim-evolution";
comment = meta.description;
comment = finalAttrs.meta.description;
categories = [ "Education" ];
})
];
@ -29,23 +49,19 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin
makeWrapper ${jre}/bin/java $out/bin/logisim-evolution --add-flags "-jar $src"
# Create icons
unzip $src "resources/logisim/img/*"
for size in 16 32 48 128 256; do
install -D "./resources/logisim/img/logisim-icon-$size.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/logisim-evolution.png"
done
install -Dm444 ${icon} $out/share/icons/hicolor/scalable/apps/logisim-evolution.svg
runHook postInstall
'';
meta = with lib; {
meta = {
changelog = "https://github.com/logisim-evolution/logisim-evolution/releases/tag/v${finalAttrs.version}";
homepage = "https://github.com/logisim-evolution/logisim-evolution";
description = "Digital logic designer and simulator";
mainProgram = "logisim-evolution";
maintainers = with maintainers; [ emilytrau ];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with lib.maintainers; [ emilytrau ];
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.gpl3Only;
platforms = lib.platforms.unix;
};
}
})

View File

@ -1,25 +1,39 @@
{ lib, stdenv, fetchurl, jre, makeWrapper, copyDesktopItems, makeDesktopItem, unzip }:
{ lib
, stdenv
, fetchurl
, jre
, makeBinaryWrapper
, copyDesktopItems
, makeDesktopItem
, desktopToDarwinBundle
, unzip
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "logisim";
version = "2.7.1";
src = fetchurl {
url = "mirror://sourceforge/project/circuit/${lib.versions.majorMinor version}.x/${version}/logisim-generic-${version}.jar";
sha256 = "1hkvc9zc7qmvjbl9579p84hw3n8wl3275246xlzj136i5b0phain";
url = "mirror://sourceforge/project/circuit/${lib.versions.majorMinor finalAttrs.version}.x/${finalAttrs.version}/logisim-generic-${finalAttrs.version}.jar";
hash = "sha256-Nip4wSrRjCA/7YaIcsSgHNnBIUE3nZLokrviw35ie8I=";
};
dontUnpack = true;
nativeBuildInputs = [ makeWrapper copyDesktopItems unzip ];
nativeBuildInputs = [
makeBinaryWrapper
copyDesktopItems
unzip
] ++ lib.optionals stdenv.isDarwin [
desktopToDarwinBundle
];
desktopItems = [
(makeDesktopItem {
name = pname;
name = "logisim";
desktopName = "Logisim";
exec = "logisim";
icon = "logisim";
comment = meta.description;
comment = finalAttrs.meta.description;
categories = [ "Education" ];
})
];
@ -34,19 +48,19 @@ stdenv.mkDerivation rec {
unzip $src "resources/logisim/img/*"
for size in 16 20 24 48 64 128
do
install -D "./resources/logisim/img/logisim-icon-$size.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/logisim.png"
install -Dm444 "./resources/logisim/img/logisim-icon-$size.png" "$out/share/icons/hicolor/''${size}x''${size}/apps/logisim.png"
done
runHook postInstall
'';
meta = with lib; {
meta = {
homepage = "http://www.cburch.com/logisim/";
description = "Educational tool for designing and simulating digital logic circuits";
mainProgram = "logisim";
maintainers = with maintainers; [ emilytrau ];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with lib.maintainers; [ emilytrau ];
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.gpl2Only;
platforms = lib.platforms.unix;
};
}
})

View File

@ -1,25 +1,42 @@
{ lib, stdenvNoCC, fetchurl, makeWrapper, copyDesktopItems, makeDesktopItem, unzip, imagemagick, jre }:
{ lib
, stdenv
, fetchurl
, makeBinaryWrapper
, copyDesktopItems
, makeDesktopItem
, desktopToDarwinBundle
, unzip
, imagemagick
, jre
}:
stdenvNoCC.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "mars-mips";
version = "4.5";
src = fetchurl {
url = "https://courses.missouristate.edu/KenVollmar/MARS/MARS_${lib.replaceStrings ["."] ["_"] version}_Aug2014/Mars${lib.replaceStrings ["."] ["_"] version}.jar";
sha256 = "15kh1fahkkbbf4wvb6ijzny4fi5dh4pycxyzp5325dm2ddkhnd5c";
url = "https://courses.missouristate.edu/KenVollmar/MARS/MARS_${lib.replaceStrings ["."] ["_"] finalAttrs.version}_Aug2014/Mars${lib.replaceStrings ["."] ["_"] finalAttrs.version}.jar";
hash = "sha256-rDQLZ2uitiJGud935i+BrURHvP0ymrU5cWvNCZULcJY=";
};
dontUnpack = true;
nativeBuildInputs = [ makeWrapper copyDesktopItems unzip imagemagick ];
nativeBuildInputs = [
makeBinaryWrapper
copyDesktopItems
unzip
imagemagick
] ++ lib.optionals stdenv.isDarwin [
desktopToDarwinBundle
];
desktopItems = [
(makeDesktopItem {
name = pname;
name = "mars";
desktopName = "MARS";
exec = "mars-mips";
icon = "mars-mips";
comment = "An IDE for programming in MIPS assembly language";
exec = "Mars";
icon = "mars";
comment = finalAttrs.meta.description;
categories = [ "Development" "IDE" ];
})
];
@ -27,25 +44,28 @@ stdenvNoCC.mkDerivation rec {
installPhase = ''
runHook preInstall
export JAR=$out/share/java/${pname}/${pname}.jar
install -D $src $JAR
makeWrapper ${jre}/bin/java $out/bin/${pname} \
export JAR=$out/share/java/mars/Mars.jar
install -Dm444 $src $JAR
makeWrapper ${jre}/bin/java $out/bin/Mars \
--add-flags "-jar $JAR"
unzip ${src} images/MarsThumbnail.gif
mkdir -p $out/share/pixmaps
convert images/MarsThumbnail.gif $out/share/pixmaps/mars-mips.png
unzip $src images/MarsThumbnail.gif
for size in 16 24 32 48 64 128 256 512
do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert -resize "$size"x"$size" images/MarsThumbnail.gif $out/share/icons/hicolor/"$size"x"$size"/apps/mars.png
done
runHook postInstall
'';
meta = with lib; {
meta = {
description = "An IDE for programming in MIPS assembly language intended for educational-level use";
mainProgram = "mars-mips";
mainProgram = "Mars";
homepage = "https://courses.missouristate.edu/KenVollmar/MARS/";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.mit;
maintainers = with maintainers; [ emilytrau ];
platforms = platforms.all;
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ emilytrau ];
platforms = lib.platforms.all;
};
}
})