2023-04-12 12:48:02 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-07-18 16:21:45 +00:00
|
|
|
|
|
|
|
, SDL2
|
|
|
|
, cmake
|
|
|
|
, curl
|
|
|
|
, discord-rpc
|
|
|
|
, duktape
|
|
|
|
, flac
|
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, gbenchmark
|
|
|
|
, icu
|
|
|
|
, jansson
|
|
|
|
, libGLU
|
|
|
|
, libiconv
|
|
|
|
, libogg
|
|
|
|
, libpng
|
|
|
|
, libpthreadstubs
|
|
|
|
, libvorbis
|
|
|
|
, libzip
|
|
|
|
, nlohmann_json
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
|
|
|
, speexdsp
|
|
|
|
, zlib
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2023-07-15 17:15:38 +00:00
|
|
|
openrct2-version = "0.4.5";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
# Those versions MUST match the pinned versions within the CMakeLists.txt
|
|
|
|
# file. The REPLAYS repository from the CMakeLists.txt is not necessary.
|
2023-07-15 17:15:38 +00:00
|
|
|
objects-version = "1.3.11";
|
|
|
|
openmsx-version = "1.3.0";
|
|
|
|
opensfx-version = "1.0.3";
|
2022-04-27 09:35:20 +00:00
|
|
|
title-sequences-version = "0.4.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
openrct2-src = fetchFromGitHub {
|
|
|
|
owner = "OpenRCT2";
|
|
|
|
repo = "OpenRCT2";
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = "v${openrct2-version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-TMtaEqui3gUd+j3LwF7VsHiBtbYZMu6Rvo1aMkkU9LY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
objects-src = fetchFromGitHub {
|
|
|
|
owner = "OpenRCT2";
|
|
|
|
repo = "objects";
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = "v${objects-version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-fA2Kz4GALu6IP7ulbwpAFt3dz6NCPgyB0CWy5uOLBQY=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
openmsx-src = fetchFromGitHub {
|
|
|
|
owner = "OpenRCT2";
|
|
|
|
repo = "OpenMusic";
|
|
|
|
rev = "v${openmsx-version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-bp+uwTy2ZFMCK8Dq4YVACpQSwo8v1te+NQGwdqViIjU=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
opensfx-src = fetchFromGitHub {
|
|
|
|
owner = "OpenRCT2";
|
|
|
|
repo = "OpenSoundEffects";
|
|
|
|
rev = "v${opensfx-version}";
|
|
|
|
sha256 = "sha256-AMuCpq1Hszi2Vikto/cX9g81LwBDskaRMTLxNzU0/Gk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
title-sequences-src = fetchFromGitHub {
|
|
|
|
owner = "OpenRCT2";
|
|
|
|
repo = "title-sequences";
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = "v${title-sequences-version}";
|
2022-04-27 09:35:20 +00:00
|
|
|
sha256 = "sha256-anqCZkhYoaxPu3MYCYSsFFngOmPp2wnx2MGb0hj6W5U=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "openrct2";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = openrct2-version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = openrct2-src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
|
|
|
curl
|
2022-07-18 16:21:45 +00:00
|
|
|
discord-rpc
|
2020-08-20 17:08:02 +00:00
|
|
|
duktape
|
2022-07-18 16:21:45 +00:00
|
|
|
flac
|
2020-04-24 23:36:52 +00:00
|
|
|
fontconfig
|
|
|
|
freetype
|
2022-07-18 16:21:45 +00:00
|
|
|
gbenchmark
|
2020-04-24 23:36:52 +00:00
|
|
|
icu
|
|
|
|
jansson
|
2020-08-20 17:08:02 +00:00
|
|
|
libGLU
|
2020-04-24 23:36:52 +00:00
|
|
|
libiconv
|
2022-07-18 16:21:45 +00:00
|
|
|
libogg
|
2020-04-24 23:36:52 +00:00
|
|
|
libpng
|
|
|
|
libpthreadstubs
|
2022-07-18 16:21:45 +00:00
|
|
|
libvorbis
|
2020-04-24 23:36:52 +00:00
|
|
|
libzip
|
2020-11-24 20:58:05 +00:00
|
|
|
nlohmann_json
|
2020-04-24 23:36:52 +00:00
|
|
|
openssl
|
|
|
|
speexdsp
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DDOWNLOAD_OBJECTS=OFF"
|
2023-04-12 12:48:02 +00:00
|
|
|
"-DDOWNLOAD_OPENMSX=OFF"
|
|
|
|
"-DDOWNLOAD_OPENSFX=OFF"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DDOWNLOAD_TITLE_SEQUENCES=OFF"
|
|
|
|
];
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [
|
2023-02-16 17:41:37 +00:00
|
|
|
# Needed with GCC 12
|
|
|
|
"-Wno-error=maybe-uninitialized"
|
|
|
|
];
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
postUnpack = ''
|
2023-04-12 12:48:02 +00:00
|
|
|
mkdir -p $sourceRoot/data/assetpack
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
cp -r ${objects-src} $sourceRoot/data/object
|
2023-04-12 12:48:02 +00:00
|
|
|
cp -r ${openmsx-src} $sourceRoot/data/assetpack/openrct2.music.alternative.parkap
|
|
|
|
cp -r ${opensfx-src} $sourceRoot/data/assetpack/openrct2.sound.parkap
|
2021-07-21 07:28:18 +00:00
|
|
|
cp -r ${title-sequences-src} $sourceRoot/data/sequence
|
|
|
|
'';
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
preConfigure =
|
2021-12-06 16:07:01 +00:00
|
|
|
# Verify that the correct version of each third party repository is used.
|
2023-04-12 12:48:02 +00:00
|
|
|
(let
|
|
|
|
versionCheck = cmakeKey: version: ''
|
|
|
|
grep -q '^set(${cmakeKey}_VERSION "${version}")$' CMakeLists.txt \
|
|
|
|
|| (echo "${cmakeKey} differs from expected version!"; exit 1)
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
(versionCheck "OBJECTS" objects-version) +
|
|
|
|
(versionCheck "OPENMSX" openmsx-version) +
|
|
|
|
(versionCheck "OPENSFX" opensfx-version) +
|
2023-07-15 17:15:38 +00:00
|
|
|
(versionCheck "TITLE_SEQUENCE" title-sequences-version));
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preFixup = "ln -s $out/share/openrct2 $out/bin/data";
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-07-21 07:28:18 +00:00
|
|
|
description = "Open source re-implementation of RollerCoaster Tycoon 2 (original game required)";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://openrct2.io/";
|
2021-12-06 16:07:01 +00:00
|
|
|
downloadPage = "https://github.com/OpenRCT2/OpenRCT2/releases";
|
2021-07-21 07:28:18 +00:00
|
|
|
license = licenses.gpl3Only;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
2020-08-20 17:08:02 +00:00
|
|
|
maintainers = with maintainers; [ oxzi ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|