Merge pull request #179753 from celestefox/craftos

This commit is contained in:
Ben Siraphob 2022-07-12 22:22:58 -07:00 committed by GitHub
commit 08dfccb401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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";
};
}