diff mbox series

[bug#59716] Add tes3mp

Message ID 20221130035903.30800-1-michal_atlas+git@posteo.net
State New
Headers show
Series [bug#59716] Add tes3mp | expand

Commit Message

Michal Atlas Nov. 30, 2022, 3:59 a.m. UTC
* gnu/packages/game-development.scm (tes3mp-server, tes3mp, tes3mp-corescripts, crabnet): New variables
* gnu/packages/game-development.scm (tes3mp-common-arguments): New private variable

Hello,

here is a patch to add Morrowind Multiplayer packages.
I wasn't sure if the client and server should be outputs of one package,
or separated, but there were enough differences, so I added them separately.

The server setup is also not entirely plug&play so I figured I'd mention that in the description,
I'm unsure as to where else to put it, and it should be included,
since the original wiki isn't excellent and
doesn't talk about the option of running the binary from a different directory than the data is in.

Lastly, I'm unsure if the set-default-server-home phase should exist,
either the server starts and then kicks a player the moment they are supposed to be saved to disk
(since the store isn't writeable),
or the server just errors out right away if the default config isn't overriden,
neither sounds like a good outcome,
I guess we shouldn't include it since it might end up being confusing.

Hopefully this patch isn't too bad.
Cheers!

---
 gnu/packages/game-development.scm | 180 ++++++++++++++++++++++++++++++
 1 file changed, 180 insertions(+)


base-commit: b4be83b6ac7e2139bec5d3eaafcf8af6cbe50856
diff mbox series

Patch

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 66d0ca316f..8136b22b3e 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -53,6 +53,8 @@  (define-module (gnu packages game-development)
   #:use-module (guix git-download)
   #:use-module (guix svn-download)
   #:use-module (guix utils)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
@@ -66,6 +68,7 @@  (define-module (gnu packages game-development)
   #:use-module (gnu packages build-tools)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages commencement)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages fltk)
@@ -75,6 +78,7 @@  (define-module (gnu packages game-development)
   #:use-module (gnu packages fribidi)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages gawk)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
@@ -2838,3 +2842,179 @@  (define-public recastnavigation
 progresses the level, or you may regenerate tiles as the world changes.")
       (home-page "https://github.com/recastnavigation/recastnavigation")
       (license license:zlib))))
+
+(define-public crabnet
+  (package
+    (name "crabnet")
+    (version "1.001")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/TES3MP/CrabNet")
+                    (commit "19e66190e83f53bcdcbcd6513238ed2e54878a21")))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0l7sqz35jb5m40zqm82wpy1wvdwpjq4h7a5i9yyyk8174j8qk1jq"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:tests? #f))
+    (synopsis "CrabNet is a TES3MP specific fork of RakNet")
+    (description "CrabNet is a cross platform, open source,
+C++ networking engine for game programmers")
+    (home-page "https://github.com/TES3MP/CrabNet")
+    (license license:bsd-2)))
+
+(define-public tes3mp-corescripts
+  (package
+    (name "tes3mp-corescripts")
+    (version "0.8.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/TES3MP/CoreScripts")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "01p64494gsqyxx3v2nya5lfj9xyqz3bcviap257x2c0isapx4gzj"))))
+    (build-system copy-build-system)
+    (arguments
+     (list
+      #:install-plan #~`(("data" "/share/tes3mp/data")
+                         ("lib" "/share/tes3mp/lib")
+                         ("scripts" "/share/tes3mp/scripts"))))
+    (synopsis "Serverside Lua scripts used to implement core functionality in TES3MP")
+    (description "These are the scripts used to implement most
+of the essential server logic in TES3MP,
+including gameplay adjustments for multiplayer
+as well as state saving and loading")
+    (home-page "https://github.com/TES3MP/CoreScripts")
+    (license license:expat)))
+
+(define tes3mp-common-arguments
+  #~(list "-DBUILD_OPENCS=OFF"
+          "-DBUILD_BSATOOL=OFF"
+          "-DBUILD_ESMTOOL=OFF"
+          "-DBUILD_ESSIMPORTER=OFF"
+          "-DBUILD_LAUNCHER=OFF"
+          "-DBUILD_MWINIIMPORTER=OFF"
+          "-DBUILD_MYGUI_PLUGIN=OFF"
+          "-DBUILD_NIFTEST=OFF"
+          "-DBUILD_WIZARD=OFF"
+          (string-append
+           "-DLuaJit_INCLUDE_DIR="
+           #$(file-append
+              luajit
+              (string-append "/include/luajit-"
+                             (package-version luajit))))
+          (string-append
+           "-DRakNet_LIBRARY_DEBUG="
+           #$(file-append crabnet "/build/lib/libRakNetLibStatic.a"))
+          "-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=ON"))
+
+(define-public tes3mp-server
+  (package
+    (name "tes3mp-server")
+    (version "0.8.1")
+    (propagated-inputs (list tes3mp-corescripts))
+    (inputs (list
+             boost
+             crabnet
+             lua-5.1
+             luajit
+             openscenegraph
+             sdl2
+             lz4
+             ;; OpenGl and SDL2 are hard dependencies even for the server
+             ;; unless we do some patching
+             mesa
+             recastnavigation))
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/TES3MP/TES3MP")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "09gd1zia27fa5phz0xx375y89rdsvf9pgfmw4n38pp108gh6002c"))))
+    (arguments
+     (list
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'set-default-server-home
+            (lambda _
+                                        ; This lets the server always at least start up
+              (substitute* "files/tes3mp/tes3mp-server-default.cfg"
+                (("home = ./server")
+                 (string-append
+                  "home = "
+                  #$(file-append tes3mp-corescripts "/share/tes3mp")))))))
+      #:configure-flags
+      #~(cons* "-DBUILD_OPENMW_MP=ON"
+               "-DBUILD_BROWSER=OFF"
+               "-DBUILD_OPENMW=OFF"
+               #$tes3mp-common-arguments)))
+    (build-system (build-system-with-c-toolchain
+                   cmake-build-system `(("toolchain" ,gcc-toolchain-8))))
+    (synopsis "Multiplayer for OpenMW, a reimplementation of
+The Elder Scrolls 3: Morrowind's engine (Server Package)")
+    (description "TES3MP is a project adding multiplayer functionality to OpenMW,
+an open-source game engine that supports playing
+\"The Elder Scrolls III: Morrowind\" by Bethesda Softworks.
+To run the server copy /share/tes3mp/ into $XDG_CONFIG_HOME/openmw/
+(must be writeable),
+then copy /etc/openmw/tes3mp-server-default.cfg into this new directory
+under the name tes3mp-server.cfg.
+Set home to the $XDG_CONFIG_HOME/openmw/ directory, now run tes3mp-server and enjoy.
+Note that all server data is kept in this directory.")
+    (home-page "tes3mp.com")
+    (license license:gpl3)))
+
+(define-public tes3mp
+  (package
+    (name "tes3mp")
+    (version "0.8.1")
+    (source (package-source tes3mp-server))
+    (build-system cmake-build-system)
+    (inputs (list
+             boost
+             bullet
+             crabnet
+             ffmpeg
+             lz4
+             mesa
+             mygui
+             openal
+             openscenegraph
+             qtbase-5
+             recastnavigation
+             sdl2))
+    (arguments
+      (list
+       #:phases
+       #~(modify-phases %standard-phases
+           ;; The check always fails and reports
+           ;; version too old
+           (add-before 'configure 'remove-ffmpeg-version-check
+             (lambda _
+               (substitute* "CMakeLists.txt"
+                 (("NOT FFVER_OK")
+                  "FFVER_OK")))))
+       #:tests? #f
+       #:configure-flags
+       #~(cons* "-DBUILD_OPENMW_MP=OFF"
+                "-DBUILD_OPENMW=ON"
+                "-DBUILD_BROWSER=ON"
+                #$tes3mp-common-arguments)))
+    (synopsis "Multiplayer for OpenMW, a reimplementation of
+The Elder Scrolls 3: Morrowind's engine (Client Package)")
+    (description "TES3MP is a project adding multiplayer functionality to OpenMW,
+an open-source game engine that supports playing
+\"The Elder Scrolls III: Morrowind\" by Bethesda Softworks.
+For the setup wizard and general openmw tooling, use the openmw package.")
+    (home-page "tes3mp.com")
+    (license license:gpl3)))