Unverified Commit 01eb2720 authored by Gergő Gutyina's avatar Gergő Gutyina Committed by GitHub
Browse files

frotz: 2.54 -> 2.55, modernize, and merge with sfrotz (#463841)

parents 22251d23 fb853700
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
From 8b1db0c6724640ff995c24145a9777bd49da1ce4 Mon Sep 17 00:00:00 2001
From: Marcin Serwin <marcin@serwin.dev>
Date: Fri, 21 Nov 2025 19:11:48 +0100
Subject: [PATCH] Fix SDL_SOUND_CFLAGS usage

The flags were quried but unused during compilation. Also, there was a
typo in the else branch.

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
---
 src/sdl/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sdl/Makefile b/src/sdl/Makefile
index e21477e..84a2136 100644
--- a/src/sdl/Makefile
+++ b/src/sdl/Makefile
@@ -22,7 +22,7 @@ SDL_CFLAGS += $(shell $(PKGCONF) $(SDL_PKGS) --cflags)
 SDL_SOUND_CFLAGS += $(shell $(PKGCONF) $(SDL_SOUND_PKGS) --cflags)
 else
 SDL_CFLAGS += $(SDL_CFLAGS_DEF)
-SD_SOUND_CFLAGS += $(SDL_SOUND_CFLAGS_DEF)
+SDL_SOUND_CFLAGS += $(SDL_SOUND_CFLAGS_DEF)
 endif
 
 
@@ -32,7 +32,7 @@ $(TARGET): $(DEFINES) $(OBJECTS) | $(DEFINES)
 	@echo "** Done with SDL interface."
 
 %.o: %.c
-	$(CC) $(CFLAGS) $(SDL_CFLAGS) -fPIC -fpic -o $@ -c $<
+	$(CC) $(CFLAGS) $(SDL_CFLAGS) $(SDL_SOUND_CFLAGS) -fPIC -fpic -o $@ -c $<
 
 $(DEFINES):
 	@echo "** Generating $@"
-- 
2.51.2
+48 −14
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
  lib,
  stdenv,
  fetchFromGitLab,
  fetchpatch,
  libao,
  libmodplug,
  libsamplerate,
@@ -11,28 +10,42 @@
  ncurses,
  which,
  pkg-config,
  SDL2,
  SDL2_mixer,
  zlib,
  libjpeg,
  libpng,
  freetype,
  frontend ? "ncurses",
}:

assert lib.assertOneOf "frontend" frontend [
  "ncurses"
  "sdl"
  # NOTE: more options are present in the Makefile, e.g., x11, dumb, nosound, ...
];
let
  progName = if frontend == "ncurses" then "frotz" else "sfrotz";
in
stdenv.mkDerivation (finalAttrs: {
  pname = "frotz";
  version = "2.54";
  pname = progName;
  version = "2.55";

  src = fetchFromGitLab {
    domain = "gitlab.com";
    owner = "DavidGriffith";
    repo = "frotz";
    rev = finalAttrs.version;
    hash = "sha256-GvGxojD8d5GVy/d8h3q6K7KJroz2lsKbfE0F0acjBl8=";
    tag = finalAttrs.version;
    hash = "sha256-XZjimskjupTtYdgfVaOS2QnQrDIBSwkJqxrffdjgZk0=";
  };

  patches = [
    (fetchpatch {
      url = "https://github.com/macports/macports-ports/raw/496e5b91e3b6c9dc6820d77ab60dbe400d1924ee/games/frotz/files/Makefile.patch";
      extraPrefix = "";
      hash = "sha256-P83ZzSi3bhncQ52Y38Q3F/7v1SJKr5614tytt862HRg=";
    })
    # https://gitlab.com/DavidGriffith/frotz/-/merge_requests/226
    ./0001-Fix-SDL_SOUND_CFLAGS-usage.patch
  ];

  strictDeps = true;
  enableParallelBuilding = true;
  nativeBuildInputs = [
    which
    pkg-config
@@ -43,16 +56,37 @@ stdenv.mkDerivation (finalAttrs: {
    libsamplerate
    libsndfile
    libvorbis
    ncurses
  ]
  ++ (
    if frontend == "ncurses" then
      [ ncurses ]
    else
      [
        freetype
        libjpeg
        libpng
        SDL2
        SDL2_mixer
        zlib
      ]
  );

  makeFlags = [
    "PREFIX=${placeholder "out"}"
    "HOMEBREW_PREFIX=/var/empty"
  ];
  preConfigure = ''
    makeFlagsArray+=(CURSES_CONFIG="$PKG_CONFIG ncurses")
  '';

  installFlags = [ "PREFIX=$(out)" ];
  buildFlags = [ frontend ];
  installTargets = if frontend == "ncurses" then "install-frotz" else "install-${frontend}";

  meta = {
    homepage = "https://davidgriffith.gitlab.io/frotz/";
    changelog = "https://gitlab.com/DavidGriffith/frotz/-/raw/${finalAttrs.version}/NEWS";
    description = "Z-machine interpreter for Infocom games and other interactive fiction";
    mainProgram = "frotz";
    description = "Z-machine interpreter for Infocom games and other interactive fiction (${frontend})";
    mainProgram = progName;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [
      nicknovitski
+1 −72
Original line number Diff line number Diff line
{
  fetchFromGitLab,
  freetype,
  libao,
  libjpeg,
  libmodplug,
  libpng,
  libsamplerate,
  libsndfile,
  libvorbis,
  pkg-config,
  SDL2,
  SDL2_mixer,
  lib,
  stdenv,
  zlib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "sfrotz";
  version = "2.54";

  src = fetchFromGitLab {
    domain = "gitlab.com";
    owner = "DavidGriffith";
    repo = "frotz";
    rev = finalAttrs.version;
    hash = "sha256-GvGxojD8d5GVy/d8h3q6K7KJroz2lsKbfE0F0acjBl8=";
  };

  buildInputs = [
    freetype
    libao
    libjpeg
    libmodplug
    libpng
    libsamplerate
    libsndfile
    libvorbis
    SDL2
    SDL2_mixer
    zlib
  ];
  nativeBuildInputs = [ pkg-config ];
  makeFlags = [ "PREFIX=${placeholder "out"}" ];
  buildPhase = "make sdl";
  installTargets = [ "install_sfrotz" ];

  meta = {
    description = "Interpreter for Infocom and other Z-Machine games (SDL interface)";
    mainProgram = "sfrotz";
    longDescription = ''
      Frotz is a Z-Machine interpreter. The Z-machine is a virtual machine
      designed by Infocom to run all of their text adventures. It went through
      multiple revisions during the lifetime of the company, and two further
      revisions (V7 and V8) were created by Graham Nelson after the company's
      demise. The specification is now quite well documented; this version of
      Frotz supports version 1.0.

      This version of Frotz fully supports all these versions of the Z-Machine
      including the graphical version 6. Graphics and sound are created through
      the use of the SDL libraries. AIFF sound effects and music in MOD and OGG
      formats are supported when packaged in Blorb container files or optionally
      from individual files.
    '';
    homepage = "https://davidgriffith.gitlab.io/frotz/";
    changelog = "https://gitlab.com/DavidGriffith/frotz/-/raw/${finalAttrs.version}/NEWS";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ ddelabru ];
    platforms = lib.platforms.linux;
  };
})
{ frotz }: frotz.override { frontend = "sdl"; }