From 37aefe329d5a2761e5b5e72411fb3bea80396f11 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Wed, 12 Jan 2022 19:50:24 -0300 Subject: [PATCH] ace-of-penguins: init at 1.4 Plus patches! --- pkgs/games/ace-of-penguins/default.nix | 78 ++++++++++++++++++ .../fixup-miscompilations.patch | 80 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 160 insertions(+) create mode 100644 pkgs/games/ace-of-penguins/default.nix create mode 100644 pkgs/games/ace-of-penguins/fixup-miscompilations.patch diff --git a/pkgs/games/ace-of-penguins/default.nix b/pkgs/games/ace-of-penguins/default.nix new file mode 100644 index 000000000000..fb15aedc1df8 --- /dev/null +++ b/pkgs/games/ace-of-penguins/default.nix @@ -0,0 +1,78 @@ +{ lib +, stdenv +, fetchurl +, copyDesktopItems +, libX11 +, libXpm +, libpng +, makeDesktopItem +, zlib +}: + +stdenv.mkDerivation rec { + pname = "ace-of-penguins"; + version = "1.4"; + + src = fetchurl { + url = "http://www.delorie.com/store/ace/ace-${version}.tar.gz"; + hash = "sha256-H+47BTOSGkKHPAYj8z2HOgZ7HuxY8scMAUSRRueaTM4="; + }; + + patches = [ + # Fixes a bunch of miscompilations in modern environments + ./fixup-miscompilations.patch + ]; + + nativeBuildInputs = [ + copyDesktopItems + ]; + + buildInputs = [ + libX11 + libXpm + libpng + zlib + ]; + + desktopItems = let + generateItem = gameName: { + name = "${pname}-${gameName}"; + exec = "${placeholder "out"}/bin/${gameName}"; + comment = "Ace of Penguins ${gameName} Card Game"; + desktopName = gameName; + genericName = gameName; + }; + in + map (x: makeDesktopItem (generateItem x)) [ + "canfield" + "freecell" + "golf" + "mastermind" + "merlin" + "minesweeper" + "pegged" + "penguins" + "solitaire" + "spider" + "taipedit" + "taipei" + "thornq" + ]; + + meta = with lib; { + homepage = "http://www.delorie.com/store/ace/"; + description = "Solitaire games in X11"; + longDescription = '' + The Ace of Penguins is a set of Unix/X solitaire games based on the ones + available for Windows(tm) but with a number of enhancements that my wife + says make my versions better :-) + + The latest version includes clones of freecell, golf, mastermind, merlin, + minesweeper, pegged, solitaire, taipei (with editor!), and thornq (by + Martin Thornquist). + ''; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/games/ace-of-penguins/fixup-miscompilations.patch b/pkgs/games/ace-of-penguins/fixup-miscompilations.patch new file mode 100644 index 000000000000..599b4a137d79 --- /dev/null +++ b/pkgs/games/ace-of-penguins/fixup-miscompilations.patch @@ -0,0 +1,80 @@ +--- ace-1.4/lib/xwin.c ++++ ace-1.4/lib/xwin.c +@@ -89,10 +89,10 @@ + /* Motif window hints */ + typedef struct + { +- unsigned flags; +- unsigned functions; +- unsigned decorations; +- int inputMode; ++ unsigned long flags; ++ unsigned long functions; ++ unsigned long decorations; ++ long inputMode; + } PropMotifWmHints; + + typedef PropMotifWmHints PropMwmHints; +@@ -841,13 +841,13 @@ + png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, 0, 0, 0); + info_ptr = png_create_info_struct (png_ptr); + +- if (setjmp (png_ptr->jmpbuf)) { ++ if (setjmp (png_jmpbuf (png_ptr))) { + fprintf(stderr, "Invalid PNG image!\n"); + return; + } + + file_bytes = src->file_data; +- png_set_read_fn (png_ptr, (voidp)&file_bytes, (png_rw_ptr)png_reader); ++ png_set_read_fn (png_ptr, (void *)&file_bytes, (png_rw_ptr)png_reader); + + png_read_info (png_ptr, info_ptr); + +--- ace-1.4/lib/make-imglib.c ++++ ace-1.4/lib/make-imglib.c +@@ -86,7 +86,7 @@ + png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, 0, 0, 0); + info_ptr = png_create_info_struct (png_ptr); + +- if (setjmp (png_ptr->jmpbuf)) { ++ if (setjmp (png_jmpbuf (png_ptr))) { + fclose (f); + continue; + } + +--- ace-1.4/lib/Makefile.am ++++ ace-1.4/lib/Makefile.am +@@ -6,7 +6,7 @@ + CLEANFILES = images.c images.d + + INCLUDES = $(X_CFLAGS) @PDA@ +-AM_LDFLAGS = $(X_LIBS) ++AM_LDFLAGS = $(X_LIBS) -lpng -lz -lm + + BUILD_CC = @BUILD_CC@ + AR = @AR@ + +--- ace-1.4/lib/xwin.c 2020-10-07 02:07:59.000000000 +0300 ++++ ace-1.4/lib/xwin.c 2020-10-07 02:15:05.941784967 +0300 +@@ -55,7 +55,6 @@ + { "-visual", OPTION_INTEGER, &visual_id }, + { 0, 0, 0 } + }; +-OptionDesc *xwin_options = xwin_options_list; + + Display *display=0; + int screen=0; +--- ace-1.4/config.guess 2012-03-24 19:00:49.000000000 +0100 ++++ ace-1.4/config.guess 2021-07-05 11:02:16.685843793 +0200 +@@ -882,6 +882,9 @@ + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; ++ aarch64*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index de8a3228ea57..877a5b0f82ed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30235,6 +30235,8 @@ with pkgs; _90secondportraits = callPackage ../games/90secondportraits { love = love_0_10; }; + ace-of-penguins = callPackage ../games/ace-of-penguins { }; + among-sus = callPackage ../games/among-sus { }; antsimulator = callPackage ../games/antsimulator { };