2022-07-14 12:49:19 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, patchelf
|
|
|
|
, unzip
|
|
|
|
, poco
|
|
|
|
, openssl
|
|
|
|
, SDL2
|
|
|
|
, SDL2_mixer
|
|
|
|
, ncurses
|
|
|
|
, libpng
|
|
|
|
, pngpp
|
|
|
|
, libwebp
|
|
|
|
}:
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
let
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "2.7.3";
|
2020-12-25 13:55:36 +00:00
|
|
|
craftos2-lua = fetchFromGitHub {
|
|
|
|
owner = "MCJack123";
|
|
|
|
repo = "craftos2-lua";
|
2023-02-02 18:25:31 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "sha256-lMqYfSA3sI7+glRE+eUf03uLfbf7lipmoqgt74FUaJQ=";
|
2022-07-14 12:49:19 +00:00
|
|
|
};
|
|
|
|
craftos2-rom = fetchFromGitHub {
|
|
|
|
owner = "McJack123";
|
|
|
|
repo = "craftos2-rom";
|
2023-02-02 18:25:31 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "sha256-t76Yltx7vHNoAAFvNpYLKuwFja4On6M20upmG6w3C1M=";
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "craftos-pc";
|
2023-02-02 18:25:31 +00:00
|
|
|
inherit version;
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MCJack123";
|
|
|
|
repo = "craftos2";
|
|
|
|
rev = "v${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
sha256 = "sha256-a7oMLfjZUkEWPjxDDywlSW4qLhcQrCXPPY2BEOgiafU=";
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
buildInputs = [ patchelf poco openssl SDL2 SDL2_mixer ncurses libpng pngpp libwebp ];
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
cp -R ${craftos2-lua}/* ./craftos2-lua/
|
|
|
|
chmod -R u+w ./craftos2-lua
|
|
|
|
make -C craftos2-lua linux
|
|
|
|
'';
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
dontStrip = true;
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
installPhase = ''
|
2022-07-14 12:49:19 +00:00
|
|
|
mkdir -p $out/bin $out/lib $out/share/craftos $out/include
|
2020-12-25 13:55:36 +00:00
|
|
|
DESTDIR=$out/bin make install
|
2022-07-14 12:49:19 +00:00
|
|
|
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
|
2020-12-25 13:55:36 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-12-25 13:55:36 +00:00
|
|
|
description = "An implementation of the CraftOS-PC API written in C++ using SDL";
|
|
|
|
homepage = "https://www.craftos-pc.cc";
|
2022-07-14 12:49:19 +00:00
|
|
|
license = with licenses; [ mit free ];
|
2020-12-25 13:55:36 +00:00
|
|
|
platforms = platforms.linux;
|
2023-02-02 18:25:31 +00:00
|
|
|
maintainers = with maintainers; [ siraben tomodachi94 ];
|
2022-07-14 12:49:19 +00:00
|
|
|
mainProgram = "craftos";
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
|
|
|
}
|