about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorDaniel McCarney <daniel@binaryparadox.net>2022-09-10 09:59:53 -0400
committerDaniel McCarney <daniel@binaryparadox.net>2022-09-22 17:58:18 -0400
commit0650000314d6a3bff5d63a74f14a2094946126f6 (patch)
treefc19c966393a9e0dd452546d88c6e843dd6704f1 /pkgs/games
parent8a593acea81b2824316991ac79e8053670fc570f (diff)
ldmud: init at 3.6.6
LDMud is a game engine for text based multi-user dungeon games (MUDs),
in the "LP" heritage. In essence it is a virtual machine that allows
developers to implement MUD games ("mudlibs" in LD parlance) using the
LPC programming language.

In the project's own words:
> This is 'LDMud', a gamedriver for LPMuds. (LPC compiler, interpreter
> and runtime environment.)
>
> LDMud started as a project to clean up and modernize Amylaar's LPMud
> gamedriver. Primary goals are full documentation, a commented source
> body and out-of-the-box support for the major mudlibs, of which the
> commented source body has been pretty much completed. During the course
> of work a lot of bug fixes and improvements found their way into the
> driver - much more than originally expected, and definitely enough to
> make LDMud a driver in its own right.

For nixpkgs the new LDMud addition is largely a standard derivation for
an autoreconf/automake based project. Some small tweaks are required to
get everything lined up between the Nix environment and the LDMud build
system.

The new LDMud derivation is placed in `pkgs/games/ldmud/` alongside
other MUD-related projects in the games category (e.g. `mudlet`,
`blightmud`).

LD offers a variety of optional features, some of which require heavier
dependencies (e.g. MySQL/Postgres client libraries). To support both
a minimal default build equal to what one gets using the upstream build
with no customization, and to also support a more useful fully featured
build, the LDMud derivation is added to `all-packages.nix` twice:

1. the `ldmud` attribute builds the minimal default configuration (just
   the optional gcrypt and pcre options enabled, matching upstream).
2. the `ldmud-full` attribute builds LDMud with all of the optional
   features enabled (database support, Python support, TLS support,
   etc).
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/ldmud/default.nix100
1 files changed, 100 insertions, 0 deletions
diff --git a/pkgs/games/ldmud/default.nix b/pkgs/games/ldmud/default.nix
new file mode 100644
index 0000000000000..fa7b3c4e0b50a
--- /dev/null
+++ b/pkgs/games/ldmud/default.nix
@@ -0,0 +1,100 @@
+{ lib
+, fetchFromGitHub
+, stdenv
+, autoreconfHook
+, pkg-config
+, bison
+, libiconv
+, pcre
+, libgcrypt
+, json_c
+, libxml2
+, ipv6Support ? false
+, mccpSupport ? false
+, zlib
+, mysqlSupport ? false
+, libmysqlclient
+, postgresSupport ? false
+, postgresql
+, sqliteSupport ? false
+, sqlite
+, tlsSupport ? false
+, openssl
+, pythonSupport ? false
+, python310
+, ...
+}:
+
+stdenv.mkDerivation rec {
+  pname = "ldmud";
+  version = "3.6.6";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-2TaFt+T9B5Df6KWRQcbhY1E1D6NISb0oqLgyX47f5lI=";
+  };
+
+  sourceRoot = "${src.name}/src";
+
+  nativeBuildInputs =
+    [ autoreconfHook pkg-config bison libgcrypt pcre json_c libxml2 ]
+    ++ lib.optional mccpSupport zlib ++ lib.optional mysqlSupport libmysqlclient
+    ++ lib.optional postgresSupport postgresql
+    ++ lib.optional sqliteSupport sqlite ++ lib.optional tlsSupport openssl
+    ++ lib.optional pythonSupport python310;
+  buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
+
+  # To support systems without autoconf LD puts its configure.ac in a non-default
+  # location and uses a helper script. We skip that script and symlink the .ac
+  # file to where the autoreconfHook find it.
+  preAutoreconf = ''
+    ln -fs ./autoconf/configure.ac ./
+  '';
+
+  configureFlags = [
+    "--enable-erq=xerq"
+    "--enable-filename-spaces"
+    "--enable-use-json"
+    "--enable-use-xml=xml2"
+    (lib.enableFeature ipv6Support "use-ipv6")
+    (lib.enableFeature mccpSupport "use-mccp")
+    (lib.enableFeature mysqlSupport "use-mysql")
+    (lib.enableFeature postgresSupport "use-pgsql")
+    (lib.enableFeature sqliteSupport "use-sqlite")
+    (lib.enableFeatureAs tlsSupport "use-tls" "ssl")
+    (lib.enableFeature pythonSupport "use-python")
+  ];
+
+  preConfigure = lib.optionalString mysqlSupport ''
+    export CPPFLAGS="-I${lib.getDev libmysqlclient}/include/mysql"
+    export LDFLAGS="-L${libmysqlclient}/lib/mysql"
+  '';
+
+  installTargets = [ "install-driver" "install-utils" "install-headers" ];
+
+  postInstall = ''
+    mkdir -p "$out/share/"
+    cp -v ../COPYRIGHT $out/share/
+  '';
+
+  meta = with lib; {
+    description = "A gamedriver for LPMuds including a LPC compiler, interpreter and runtime";
+    homepage = "https://ldmud.eu";
+    changelog = "https://github.com/ldmud/ldmud/blob/${version}/HISTORY";
+    longDescription = ''
+      LDMud started as a project to clean up and modernize Amylaar's LPMud
+      gamedriver. Primary goals are full documentation, a commented source body
+      and out-of-the-box support for the major mudlibs, of which the commented
+      source body has been pretty much completed. During the course of work
+      a lot of bug fixes and improvements found their way into the driver - much
+      more than originally expected, and definitely enough to make LDMud
+      a driver in its own right.
+    '';
+    # See https://github.com/ldmud/ldmud/blob/master/COPYRIGHT
+    license = licenses.unfreeRedistributable;
+    platforms = with platforms; linux ++ darwin;
+    maintainers = with maintainers; [ cpu ];
+  };
+}