From 82f4659c4779862bb45bded7ac25257b00e24f57 Mon Sep 17 00:00:00 2001 From: Glowpelt Date: Thu, 30 Jun 2022 13:34:25 -0600 Subject: [PATCH] (craftos-pc): 2.4.5 -> 2.6.6 Update to the newest version. Also: * Adds in most optional dependencies (besides `libharu`) * Bundles the rom files (under ComputerCraft Public License, so `free`) * packages the headers --- .../emulators/craftos-pc/default.nix | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/emulators/craftos-pc/default.nix b/pkgs/applications/emulators/craftos-pc/default.nix index 3bc9e0b81cc0..d2668c473a62 100644 --- a/pkgs/applications/emulators/craftos-pc/default.nix +++ b/pkgs/applications/emulators/craftos-pc/default.nix @@ -1,26 +1,45 @@ -{ lib, stdenv, fetchFromGitHub, poco, openssl, SDL2, SDL2_mixer }: +{ lib +, stdenv +, fetchFromGitHub +, patchelf +, unzip +, poco +, openssl +, SDL2 +, SDL2_mixer +, ncurses +, libpng +, pngpp +, libwebp +}: let craftos2-lua = fetchFromGitHub { owner = "MCJack123"; repo = "craftos2-lua"; - rev = "v2.4.4"; - sha256 = "1q63ki4sxx8bxaa6ag3xj153p7a8a12ivm0k33k935p41k6y2k64"; + rev = "v2.6.6"; + sha256 = "cCXH1GTRqJQ57/6sWIxik366YBx/ii3nzQwx4YpEh1w="; + }; + craftos2-rom = fetchFromGitHub { + owner = "McJack123"; + repo = "craftos2-rom"; + rev = "v2.6.6"; + sha256 = "VzIqvf83k121DxuH5zgZfFS9smipDonyqqhVgj2kgYw="; }; in stdenv.mkDerivation rec { pname = "craftos-pc"; - version = "2.4.5"; + version = "2.6.6"; src = fetchFromGitHub { owner = "MCJack123"; repo = "craftos2"; rev = "v${version}"; - sha256 = "00a4p365krbdprlv4979d13mm3alhxgzzj3vqz2g67795plf64j4"; + sha256 = "9lpAWYFli3/OBfmu2dQxKi+/TaHaBQNpZsCURvl0h/E="; }; - buildInputs = [ poco openssl SDL2 SDL2_mixer ]; + buildInputs = [ patchelf poco openssl SDL2 SDL2_mixer ncurses libpng pngpp libwebp ]; preBuild = '' cp -R ${craftos2-lua}/* ./craftos2-lua/ @@ -28,16 +47,23 @@ stdenv.mkDerivation rec { make -C craftos2-lua linux ''; + dontStrip = true; + installPhase = '' - mkdir -p $out/bin + mkdir -p $out/bin $out/lib $out/share/craftos $out/include DESTDIR=$out/bin make install + cp ./craftos2-lua/src/liblua.so $out/lib + patchelf --replace-needed craftos2-lua/src/liblua.so liblua.so $out/bin/craftos + cp -R api $out/include/CraftOS-PC + cp -R ${craftos2-rom}/* $out/share/craftos ''; meta = with lib; { description = "An implementation of the CraftOS-PC API written in C++ using SDL"; homepage = "https://www.craftos-pc.cc"; - license = licenses.mit; + license = with licenses; [ mit free ]; platforms = platforms.linux; maintainers = [ maintainers.siraben ]; + mainProgram = "craftos"; }; }