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"; pname = "logisim-evolution";
version = "3.8.0"; version = "3.8.0";
src = fetchurl { src = fetchurl {
url = "https://github.com/logisim-evolution/logisim-evolution/releases/download/v${version}/logisim-evolution-${version}-all.jar"; url = "https://github.com/logisim-evolution/logisim-evolution/releases/download/v${finalAttrs.version}/logisim-evolution-${finalAttrs.version}-all.jar";
sha256 = "sha256-TFm+fa3CMp0OMhnKBc6cLIWGQbIG/OpOOCG7ea7wbCw="; hash = "sha256-TFm+fa3CMp0OMhnKBc6cLIWGQbIG/OpOOCG7ea7wbCw=";
}; };
dontUnpack = true; dontUnpack = true;
nativeBuildInputs = [ makeWrapper copyDesktopItems unzip ]; nativeBuildInputs = [
makeBinaryWrapper
copyDesktopItems
unzip
] ++ lib.optionals stdenv.isDarwin [
desktopToDarwinBundle
];
desktopItems = [ desktopItems = [
(makeDesktopItem { (makeDesktopItem {
name = pname; name = "logisim-evolution";
desktopName = "Logisim-evolution"; desktopName = "Logisim-evolution";
exec = "logisim-evolution"; exec = "logisim-evolution";
icon = "logisim-evolution"; icon = "logisim-evolution";
comment = meta.description; comment = finalAttrs.meta.description;
categories = [ "Education" ]; categories = [ "Education" ];
}) })
]; ];
@ -29,23 +49,19 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin mkdir -p $out/bin
makeWrapper ${jre}/bin/java $out/bin/logisim-evolution --add-flags "-jar $src" makeWrapper ${jre}/bin/java $out/bin/logisim-evolution --add-flags "-jar $src"
install -Dm444 ${icon} $out/share/icons/hicolor/scalable/apps/logisim-evolution.svg
# 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
runHook postInstall 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"; homepage = "https://github.com/logisim-evolution/logisim-evolution";
description = "Digital logic designer and simulator"; description = "Digital logic designer and simulator";
mainProgram = "logisim-evolution"; mainProgram = "logisim-evolution";
maintainers = with maintainers; [ emilytrau ]; maintainers = with lib.maintainers; [ emilytrau ];
sourceProvenance = with sourceTypes; [ binaryBytecode ]; sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = licenses.gpl2Plus; license = lib.licenses.gpl3Only;
platforms = platforms.unix; 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"; pname = "logisim";
version = "2.7.1"; version = "2.7.1";
src = fetchurl { src = fetchurl {
url = "mirror://sourceforge/project/circuit/${lib.versions.majorMinor version}.x/${version}/logisim-generic-${version}.jar"; url = "mirror://sourceforge/project/circuit/${lib.versions.majorMinor finalAttrs.version}.x/${finalAttrs.version}/logisim-generic-${finalAttrs.version}.jar";
sha256 = "1hkvc9zc7qmvjbl9579p84hw3n8wl3275246xlzj136i5b0phain"; hash = "sha256-Nip4wSrRjCA/7YaIcsSgHNnBIUE3nZLokrviw35ie8I=";
}; };
dontUnpack = true; dontUnpack = true;
nativeBuildInputs = [ makeWrapper copyDesktopItems unzip ]; nativeBuildInputs = [
makeBinaryWrapper
copyDesktopItems
unzip
] ++ lib.optionals stdenv.isDarwin [
desktopToDarwinBundle
];
desktopItems = [ desktopItems = [
(makeDesktopItem { (makeDesktopItem {
name = pname; name = "logisim";
desktopName = "Logisim"; desktopName = "Logisim";
exec = "logisim"; exec = "logisim";
icon = "logisim"; icon = "logisim";
comment = meta.description; comment = finalAttrs.meta.description;
categories = [ "Education" ]; categories = [ "Education" ];
}) })
]; ];
@ -34,19 +48,19 @@ stdenv.mkDerivation rec {
unzip $src "resources/logisim/img/*" unzip $src "resources/logisim/img/*"
for size in 16 20 24 48 64 128 for size in 16 20 24 48 64 128
do 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 done
runHook postInstall runHook postInstall
''; '';
meta = with lib; { meta = {
homepage = "http://www.cburch.com/logisim/"; homepage = "http://www.cburch.com/logisim/";
description = "Educational tool for designing and simulating digital logic circuits"; description = "Educational tool for designing and simulating digital logic circuits";
mainProgram = "logisim"; mainProgram = "logisim";
maintainers = with maintainers; [ emilytrau ]; maintainers = with lib.maintainers; [ emilytrau ];
sourceProvenance = with sourceTypes; [ binaryBytecode ]; sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = licenses.gpl2Plus; license = lib.licenses.gpl2Only;
platforms = platforms.unix; 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"; pname = "mars-mips";
version = "4.5"; version = "4.5";
src = fetchurl { src = fetchurl {
url = "https://courses.missouristate.edu/KenVollmar/MARS/MARS_${lib.replaceStrings ["."] ["_"] version}_Aug2014/Mars${lib.replaceStrings ["."] ["_"] version}.jar"; url = "https://courses.missouristate.edu/KenVollmar/MARS/MARS_${lib.replaceStrings ["."] ["_"] finalAttrs.version}_Aug2014/Mars${lib.replaceStrings ["."] ["_"] finalAttrs.version}.jar";
sha256 = "15kh1fahkkbbf4wvb6ijzny4fi5dh4pycxyzp5325dm2ddkhnd5c"; hash = "sha256-rDQLZ2uitiJGud935i+BrURHvP0ymrU5cWvNCZULcJY=";
}; };
dontUnpack = true; dontUnpack = true;
nativeBuildInputs = [ makeWrapper copyDesktopItems unzip imagemagick ]; nativeBuildInputs = [
makeBinaryWrapper
copyDesktopItems
unzip
imagemagick
] ++ lib.optionals stdenv.isDarwin [
desktopToDarwinBundle
];
desktopItems = [ desktopItems = [
(makeDesktopItem { (makeDesktopItem {
name = pname; name = "mars";
desktopName = "MARS"; desktopName = "MARS";
exec = "mars-mips"; exec = "Mars";
icon = "mars-mips"; icon = "mars";
comment = "An IDE for programming in MIPS assembly language"; comment = finalAttrs.meta.description;
categories = [ "Development" "IDE" ]; categories = [ "Development" "IDE" ];
}) })
]; ];
@ -27,25 +44,28 @@ stdenvNoCC.mkDerivation rec {
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
export JAR=$out/share/java/${pname}/${pname}.jar export JAR=$out/share/java/mars/Mars.jar
install -D $src $JAR install -Dm444 $src $JAR
makeWrapper ${jre}/bin/java $out/bin/${pname} \ makeWrapper ${jre}/bin/java $out/bin/Mars \
--add-flags "-jar $JAR" --add-flags "-jar $JAR"
unzip ${src} images/MarsThumbnail.gif unzip $src images/MarsThumbnail.gif
mkdir -p $out/share/pixmaps for size in 16 24 32 48 64 128 256 512
convert images/MarsThumbnail.gif $out/share/pixmaps/mars-mips.png 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 runHook postInstall
''; '';
meta = with lib; { meta = {
description = "An IDE for programming in MIPS assembly language intended for educational-level use"; 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/"; homepage = "https://courses.missouristate.edu/KenVollmar/MARS/";
sourceProvenance = with sourceTypes; [ binaryBytecode ]; sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ emilytrau ]; maintainers = with lib.maintainers; [ emilytrau ];
platforms = platforms.all; platforms = lib.platforms.all;
}; };
} })