Unverified Commit 6d1abecc authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

freesweep: 1.0.2 -> 1.0.2-unstable-2024-04-19 (#373800)

parents b4d01816 d43db786
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
diff --git a/sweep.h b/sweep.h
index 198349d..549f39f 100644
--- a/sweep.h
+++ b/sweep.h
@@ -32,6 +32,10 @@
 #include <string.h>
 #endif /* HAVE_STRING_H */
 
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif /* HAVE_STRINGS_H */
+
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #endif /* HAVE_GETOPT_H */
+13 −0
Original line number Diff line number Diff line
diff --git a/logs.c b/logs.c
index 5e87f52..29ad433 100644
--- a/logs.c
+++ b/logs.c
@@ -128,7 +128,7 @@ static void log_display(const char *mesg) {
   // Display the message on the screen.
   if (log_win) {
     wclear(log_win);
-    mvwprintw(log_win, 0, 0, mesg);
+    mvwprintw(log_win, 0, 0, "%s", mesg);
     wnoutrefresh(log_win);
     wrefresh(log_win);
   }
+12 −0
Original line number Diff line number Diff line
diff --git a/configure.ac b/configure.ac
index ae08308..5262e56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,6 @@ AC_TYPE_SIZE_T
 AC_TYPE_UID_T
 
 # Checks for library functions.
-AC_FUNC_MALLOC
 AC_CHECK_FUNCS([alarm getcwd memset mkdir setlocale strdup strncasecmp
                 fileno flock lockf getopt getopt_long])
 
+31 −12
Original line number Diff line number Diff line
@@ -3,31 +3,50 @@
  ncurses,
  lib,
  stdenv,
  updateAutotoolsGnuConfigScriptsHook,
  autoconf,
  automake,
  pkg-config,
  installShellFiles,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation {
  pname = "freesweep";
  version = "1.0.2";
  version = "1.0.2-unstable-2024-04-19";

  src = fetchFromGitHub {
    owner = "rwestlund";
    repo = "freesweep";
    rev = "v${version}";
    hash = "sha256-iuu81yHbNrjdPsimBrPK58PJ0d8i3ySM7rFUG/d8NJM";
    rev = "68c0ee5b29d1087d216d95875a7036713cd25fc0";
    hash = "sha256-ZnAH7mIuBMFLdrtJOY8PzNbxv+GDEFAgyEtWCpTH2Us=";
  };

  # These patches are sent upstream in github:rwestlund/freesweep#18
  patches = [
    # strncasecmp and friends are declared in strings.h and not string.h on
    # systems with HAVE_STRINGS_H
    ./0001-include-strings.h.patch
    # Fixes a potential format string vulnerability and makes it compile with
    # -Wformat-security
    ./0002-fix-Wformat-security.patch
    # autoconf believes systems that handle malloc(0) differently from glibc
    # have a bad malloc implementation and will replace calls to malloc with
    # rpl_malloc. freesweep does not define rpl_malloc so this macro prevents
    # building for such systems, the easiest solution is to remove this macro
    ./0003-remove-ac_func_malloc.patch
  ];

  nativeBuildInputs = [
    updateAutotoolsGnuConfigScriptsHook
    autoconf
    automake
    pkg-config
    installShellFiles
  ];
  buildInputs = [ ncurses ];

  configureFlags = [ "--with-prefsdir=$out/share" ];

  enableParallelBuilding = true;

  preConfigure = "./autogen.sh";

  installPhase = ''
    runHook preInstall
    install -D -m 0555 freesweep $out/bin/freesweep
@@ -36,12 +55,12 @@ stdenv.mkDerivation rec {
    runHook postInstall
  '';

  meta = with lib; {
  meta = {
    description = "Console minesweeper-style game written in C for Unix-like systems";
    mainProgram = "freesweep";
    homepage = "https://github.com/rwestlund/freesweep";
    license = licenses.gpl2Only;
    maintainers = with maintainers; [ ];
    platforms = platforms.unix;
    license = lib.licenses.gpl2Only;
    maintainers = with lib.maintainers; [ sanana ];
    platforms = lib.platforms.unix;
  };
}