xcur2png: fix cross-build (#343074)
This commit is contained in:
commit
69c6b47ea1
@ -1,4 +1,12 @@
|
||||
{ lib, stdenv, fetchFromGitHub, pkg-config, libpng, xorg }:
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
pkg-config,
|
||||
libpng,
|
||||
xorg,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "xcur2png";
|
||||
@ -11,6 +19,17 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "0858wn2p14bxpv9lvaz2bz1rk6zk0g8zgxf8iy595m8fqv4q2fya";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# https://github.com/eworm-de/xcur2png/pull/3
|
||||
./malloc.diff
|
||||
|
||||
# fix byte overflows due to off-by-one error
|
||||
(fetchpatch {
|
||||
url = "https://github.com/eworm-de/xcur2png/commit/aa035462d950fab35d322cb87fd2f0d702251e82.patch";
|
||||
hash = "sha256-hlmJ/bcDSl1ADs0jp+JrAgAaMzielUSRVPad+plnSZg=";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
];
|
||||
|
33
pkgs/tools/graphics/xcur2png/malloc.diff
Normal file
33
pkgs/tools/graphics/xcur2png/malloc.diff
Normal file
@ -0,0 +1,33 @@
|
||||
--- a/xcur2png.c
|
||||
+++ b/xcur2png.c
|
||||
@@ -16,7 +16,10 @@
|
||||
/* Todo: atoi error handling */
|
||||
/* help is -h in manual */
|
||||
|
||||
+#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
+#endif
|
||||
+#undef malloc
|
||||
|
||||
#define _ATFILE_SOURCE
|
||||
#include <stdio.h>
|
||||
@@ -34,6 +37,19 @@
|
||||
#include <png.h>
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
|
||||
+
|
||||
+void *malloc ();
|
||||
+
|
||||
+/* Allocate an N-byte block of memory from the heap.
|
||||
+ If N is zero, allocate a 1-byte block. */
|
||||
+
|
||||
+void* rpl_malloc (size_t n)
|
||||
+{
|
||||
+ if (n == 0)
|
||||
+ n = 1;
|
||||
+ return malloc (n);
|
||||
+}
|
||||
+
|
||||
#define PNG_SETJMP_NOT_SUPPORTED 1
|
||||
|
||||
#define PROGRESS_SHARPS 50 /* total number of progress sharps */
|
Loading…
Reference in New Issue
Block a user