Commit 08170dd5 authored by Joshua Trees's avatar Joshua Trees Committed by Peter Hoeg
Browse files

openmw: 0.47.0 -> 0.48.0



Co-authored-by: default avatarPeter Hoeg <peter@hoeg.com>
parent f9d06580
Loading
Loading
Loading
Loading
+48 −55
Original line number Diff line number Diff line
{ lib
, stdenv
, mkDerivation
, fetchFromGitHub
, fetchFromGitLab
, fetchpatch
, cmake
, pkg-config
, wrapQtAppsHook
, openscenegraph
, mygui
, SDL2
, CoreMedia
, VideoToolbox
, VideoDecodeAcceleration
, boost
, bullet
, ffmpeg
, boost
, SDL2
, unshield
, openal
, libXt
, luajit
, lz4
, mygui
, openal
, openscenegraph
, recastnavigation
, VideoDecodeAcceleration
, unshield
, yaml-cpp
}:

let
  openscenegraph_openmw = (openscenegraph.override { colladaSupport = true; })
    .overrideDerivation (self: {
      src = fetchFromGitHub {
        owner = "OpenMW";
        repo = "osg";
        rev = "bbe61c3bc510a4f5bb4aea21cce506519c2d24e6";
        sha256 = "sha256-t3smLqstp7wWfi9HXJoBCek+3acqt/ySBYF8RJOG6Mo=";
      };
  GL = "GLVND"; # or "LEGACY";

  osg' = (openscenegraph.override { colladaSupport = true; }).overrideDerivation (old: {
    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.
        # Darwin: Without this patch, OSG won't build osgdb_png.so, which is required by OpenMW.
        name = "darwin-osg-plugins-fix.patch";
        url = "https://gitlab.com/OpenMW/openmw-dep/-/raw/0abe3c9c3858211028d881d7706813d606335f72/macos/osg.patch";
        sha256 = "sha256-/CLRZofZHot8juH78VG1/qhTHPhy5DoPMN+oH8hC58U=";
      })
    ];
    cmakeFlags = (old.cmakeFlags or [ ]) ++ [
      "-Wno-dev"
      "-DOpenGL_GL_PREFERENCE=${GL}"
      "-DBUILD_OSG_PLUGINS_BY_DEFAULT=0"
      "-DBUILD_OSG_DEPRECATED_SERIALIZERS=0"
    ] ++ (map (e: "-DBUILD_OSG_PLUGIN_${e}=1") [ "BMP" "DAE" "DDS" "FREETYPE" "JPEG" "OSG" "PNG" "TGA" ]);
  });

  bullet_openmw = bullet.overrideDerivation (old: rec {
    version = "3.17";
    src = fetchFromGitHub {
      owner = "bulletphysics";
      repo = "bullet3";
      rev = version;
      sha256 = "sha256-uQ4X8F8nmagbcFh0KexrmnhHIXFSB3A1CCnjPVeHL3Q=";
    };
    patches = [];
  bullet' = bullet.overrideDerivation (old: {
    cmakeFlags = (old.cmakeFlags or [ ]) ++ [
      "-Wno-dev"
      "-DOpenGL_GL_PREFERENCE=${GL}"
      "-DUSE_DOUBLE_PRECISION=ON"
      "-DBULLET2_MULTITHREADING=ON"
    ];
  });

in
mkDerivation rec {
stdenv.mkDerivation rec {
  pname = "openmw";
  version = "0.47.0";
  version = "0.48.0";

  src = fetchFromGitHub {
  src = fetchFromGitLab {
    owner = "OpenMW";
    repo = "openmw";
    rev = "${pname}-${version}";
    sha256 = "sha256-Xq9hDUTCQr79Zzjk0CsiXclVTHK6nrSowukIQqVdrKY=";
    hash = "sha256-zkjVt3GfQZsFXl2Ht3lCuQtDMYQWxhdFO4aGSb3rsyo=";
  };

  patches = [
    (fetchpatch {
      url = "https://gitlab.com/OpenMW/openmw/-/merge_requests/1239.diff";
      sha256 = "sha256-RhbIGeE6GyqnipisiMTwWjcFnIiR055hUPL8IkjPgZw=";
    })
  ];

  postPatch = ''
    sed '1i#include <memory>' -i components/myguiplatform/myguidatamanager.cpp # gcc12
  '' + lib.optionalString stdenv.isDarwin ''
@@ -84,27 +74,30 @@ mkDerivation rec {
  nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook ];

  # If not set, OSG plugin .so files become shell scripts on Darwin.
  dontWrapQtApps = true;
  dontWrapQtApps = stdenv.isDarwin;

  buildInputs = [
    SDL2
    boost
    bullet_openmw
    bullet'
    ffmpeg
    libXt
    luajit
    lz4
    mygui
    openal
    openscenegraph_openmw
    unshield
    lz4
    osg'
    recastnavigation
    unshield
    yaml-cpp
  ] ++ lib.optionals stdenv.isDarwin [
    CoreMedia
    VideoDecodeAcceleration
    VideoToolbox
  ];

  cmakeFlags = [
    # as of 0.46, openmw is broken with GLVND
    "-DOpenGL_GL_PREFERENCE=LEGACY"
    "-DOpenGL_GL_PREFERENCE=${GL}"
    "-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=1"
  ] ++ lib.optionals stdenv.isDarwin [
    "-DOPENMW_OSX_DEPLOYMENT=ON"
+10 −2
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
, cmake
, openmw
, fetchFromGitHub
, fetchpatch
, luajit
, makeWrapper
, symlinkJoin
@@ -85,8 +86,15 @@ let
        --replace "\"./\"" "\"$out/bin/\""
    '';

    patches = [
      (fetchpatch {
        url = "https://gitlab.com/OpenMW/openmw/-/commit/98a7d90ee258ceef9c70b0b2955d0458ec46f048.patch";
        sha256 = "sha256-RhbIGeE6GyqnipisiMTwWjcFnIiR055hUPL8IkjPgZw=";
      })

      # https://github.com/TES3MP/openmw-tes3mp/issues/552
    patches = oldAttrs.patches ++ [ ./tes3mp.patch ];
      ./tes3mp.patch
    ];

    env.NIX_CFLAGS_COMPILE = "-fpermissive";

+1 −1
Original line number Diff line number Diff line
@@ -38330,7 +38330,7 @@ with pkgs;
  openloco = pkgsi686Linux.callPackage ../games/openloco { };
  openmw = libsForQt5.callPackage ../games/openmw {
    inherit (darwin.apple_sdk.frameworks) VideoDecodeAcceleration;
    inherit (darwin.apple_sdk.frameworks) CoreMedia VideoDecodeAcceleration VideoToolbox;
  };
  openmw-tes3mp = libsForQt5.callPackage ../games/openmw/tes3mp.nix { };