2023-04-12 12:48:02 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2024-01-25 14:12:00 +00:00
|
|
|
, fetchpatch
|
2022-07-18 16:21:45 +00:00
|
|
|
|
|
|
|
, SDL2
|
|
|
|
, cmake
|
|
|
|
, curl
|
|
|
|
, discord-rpc
|
|
|
|
, duktape
|
2024-01-25 14:12:00 +00:00
|
|
|
, expat
|
2022-07-18 16:21:45 +00:00
|
|
|
, 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
|
2024-02-29 20:09:43 +00:00
|
|
|
openrct2-version = "0.4.8";
|
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.
|
2024-01-25 14:12:00 +00:00
|
|
|
objects-version = "1.3.13";
|
|
|
|
openmsx-version = "1.5";
|
2023-07-15 17:15:38 +00:00
|
|
|
opensfx-version = "1.0.3";
|
2024-01-25 14:12:00 +00:00
|
|
|
title-sequences-version = "0.4.6";
|
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}";
|
2024-02-29 20:09:43 +00:00
|
|
|
hash = "sha256-jSKAgohNMHuyOu4gUHyyZf1I7UrsXGDV5XwwK1DQPyM=";
|
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}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-7RvRe7skXH5x8RbkQgtKs1YMBwq8dHInVo/4FAJwUD0=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
openmsx-src = fetchFromGitHub {
|
|
|
|
owner = "OpenRCT2";
|
|
|
|
repo = "OpenMusic";
|
|
|
|
rev = "v${openmsx-version}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-p/wlvQFfu3R+jIuCcRbTMvxt0VKGGwJw0NDIsf6URWI=";
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
opensfx-src = fetchFromGitHub {
|
|
|
|
owner = "OpenRCT2";
|
|
|
|
repo = "OpenSoundEffects";
|
|
|
|
rev = "v${opensfx-version}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "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}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-HWp2ecClNM/7O3oaydVipOnEsYNP/bZnZFS+SDidPi0=";
|
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;
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
patches = [
|
|
|
|
# https://github.com/OpenRCT2/OpenRCT2/pull/21043
|
|
|
|
#
|
|
|
|
# Basically <https://github.com/OpenRCT2/OpenRCT2/pull/19785> has broken
|
|
|
|
# OpenRCT2 - at least with older maps, as were used for testing - as stated
|
|
|
|
# in <https://github.com/NixOS/nixpkgs/issues/263025>.
|
|
|
|
(fetchpatch {
|
|
|
|
name = "remove-openrct2-music.patch";
|
|
|
|
url = "https://github.com/OpenRCT2/OpenRCT2/commit/9ea13848be0b974336c34e6eb119c49ba42a907c.patch";
|
|
|
|
hash = "sha256-2PPRqUZf4+ys89mdzp5nvdtdv00V9Vzj3v/95rmlf1c=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2024-01-25 14:12:00 +00:00
|
|
|
expat
|
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
|
|
|
};
|
|
|
|
}
|