2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
2023-03-24 00:07:29 +00:00
|
|
|
, stdenv
|
2021-05-20 23:08:51 +00:00
|
|
|
, mkDerivation
|
|
|
|
, fetchFromGitHub
|
2022-05-18 14:49:53 +00:00
|
|
|
, fetchpatch
|
2021-05-20 23:08:51 +00:00
|
|
|
, cmake
|
|
|
|
, pkg-config
|
2021-08-05 21:33:18 +00:00
|
|
|
, wrapQtAppsHook
|
2021-05-20 23:08:51 +00:00
|
|
|
, openscenegraph
|
|
|
|
, mygui
|
|
|
|
, bullet
|
|
|
|
, ffmpeg
|
|
|
|
, boost
|
|
|
|
, SDL2
|
|
|
|
, unshield
|
|
|
|
, openal
|
|
|
|
, libXt
|
2021-12-06 16:07:01 +00:00
|
|
|
, lz4
|
|
|
|
, recastnavigation
|
2023-03-24 00:07:29 +00:00
|
|
|
, VideoDecodeAcceleration
|
2021-05-20 23:08:51 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2021-12-06 16:07:01 +00:00
|
|
|
openscenegraph_openmw = (openscenegraph.override { colladaSupport = true; })
|
|
|
|
.overrideDerivation (self: {
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "OpenMW";
|
|
|
|
repo = "osg";
|
|
|
|
rev = "bbe61c3bc510a4f5bb4aea21cce506519c2d24e6";
|
|
|
|
sha256 = "sha256-t3smLqstp7wWfi9HXJoBCek+3acqt/ySBYF8RJOG6Mo=";
|
|
|
|
};
|
2023-03-24 00:07:29 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
# For Darwin, OSG doesn't build some plugins as they're redundant with QuickTime.
|
|
|
|
# OpenMW doesn't like this, and expects them to be there. Apply their patch for it.
|
|
|
|
name = "darwin-osg-plugins-fix.patch";
|
|
|
|
url = "https://gitlab.com/OpenMW/openmw-dep/-/raw/0abe3c9c3858211028d881d7706813d606335f72/macos/osg.patch";
|
|
|
|
sha256 = "sha256-/CLRZofZHot8juH78VG1/qhTHPhy5DoPMN+oH8hC58U=";
|
|
|
|
})
|
|
|
|
];
|
2021-12-06 16:07:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
bullet_openmw = bullet.overrideDerivation (old: rec {
|
|
|
|
version = "3.17";
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-12-06 16:07:01 +00:00
|
|
|
owner = "bulletphysics";
|
|
|
|
repo = "bullet3";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "sha256-uQ4X8F8nmagbcFh0KexrmnhHIXFSB3A1CCnjPVeHL3Q=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
patches = [];
|
|
|
|
cmakeFlags = (old.cmakeFlags or []) ++ [
|
|
|
|
"-DUSE_DOUBLE_PRECISION=ON"
|
|
|
|
"-DBULLET2_MULTITHREADING=ON"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
});
|
2021-01-15 22:18:51 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
in
|
|
|
|
mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "openmw";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "0.47.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "OpenMW";
|
|
|
|
repo = "openmw";
|
|
|
|
rev = "${pname}-${version}";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-Xq9hDUTCQr79Zzjk0CsiXclVTHK6nrSowukIQqVdrKY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/OpenMW/openmw/-/merge_requests/1239.diff";
|
|
|
|
sha256 = "sha256-RhbIGeE6GyqnipisiMTwWjcFnIiR055hUPL8IkjPgZw=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed '1i#include <memory>' -i components/myguiplatform/myguidatamanager.cpp # gcc12
|
2023-03-24 00:07:29 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Don't fix Darwin app bundle
|
|
|
|
sed -i '/fixup_bundle/d' CMakeLists.txt
|
2023-02-16 17:41:37 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook ];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
# If not set, OSG plugin .so files become shell scripts on Darwin.
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
|
|
|
boost
|
2021-12-06 16:07:01 +00:00
|
|
|
bullet_openmw
|
2021-05-20 23:08:51 +00:00
|
|
|
ffmpeg
|
|
|
|
libXt
|
|
|
|
mygui
|
|
|
|
openal
|
2021-12-06 16:07:01 +00:00
|
|
|
openscenegraph_openmw
|
2021-05-20 23:08:51 +00:00
|
|
|
unshield
|
2021-12-06 16:07:01 +00:00
|
|
|
lz4
|
|
|
|
recastnavigation
|
2023-03-24 00:07:29 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
VideoDecodeAcceleration
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-05-20 23:08:51 +00:00
|
|
|
# as of 0.46, openmw is broken with GLVND
|
|
|
|
"-DOpenGL_GL_PREFERENCE=LEGACY"
|
2021-12-06 16:07:01 +00:00
|
|
|
"-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=1"
|
2023-03-24 00:07:29 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
"-DOPENMW_OSX_DEPLOYMENT=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An unofficial open source engine reimplementation of the game Morrowind";
|
2021-12-06 16:07:01 +00:00
|
|
|
homepage = "https://openmw.org";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ abbradar marius851000 ];
|
2023-03-24 00:07:29 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|