From 2cb203a61d6e4856f2ed84e4bfea9e7ccf563ed9 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 4 Jan 2023 00:37:35 +0100 Subject: [PATCH] pkgsCross.mingwW64.popt: Fix build First it fails to compile: popthelp.c:15:10: fatal error: sys/ioctl.h: No such file or directory 15 | #include | ^~~~~~~~~~~~~ And then it does not want to link: /nix/store/k35kvfyhzhlpx71gf05zm6gy23alg571-x86_64-w64-mingw32-binutils-2.39/bin/x86_64-w64-mingw32-ld: .libs/popt.o: in function `execCommand': /build/popt-1.19/src/popt.c:521: undefined reference to `getuid' /nix/store/k35kvfyhzhlpx71gf05zm6gy23alg571-x86_64-w64-mingw32-binutils-2.39/bin/x86_64-w64-mingw32-ld: /build/popt-1.19/src/popt.c:521: undefined reference to `geteuid' /nix/store/k35kvfyhzhlpx71gf05zm6gy23alg571-x86_64-w64-mingw32-binutils-2.39/bin/x86_64-w64-mingw32-ld: /build/popt-1.19/src/popt.c:521: undefined reference to `getgid' /nix/store/k35kvfyhzhlpx71gf05zm6gy23alg571-x86_64-w64-mingw32-binutils-2.39/bin/x86_64-w64-mingw32-ld: /build/popt-1.19/src/popt.c:521: undefined reference to `getegid' --- pkgs/development/libraries/popt/default.nix | 23 ++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/popt/default.nix b/pkgs/development/libraries/popt/default.nix index 37d83ff5b2b..fdccb4d0933 100644 --- a/pkgs/development/libraries/popt/default.nix +++ b/pkgs/development/libraries/popt/default.nix @@ -1,4 +1,8 @@ -{ lib, stdenv, fetchurl }: +{ lib +, stdenv +, fetchurl +, fetchpatch2 +}: stdenv.mkDerivation rec { pname = "popt"; @@ -12,6 +16,23 @@ stdenv.mkDerivation rec { patches = lib.optionals stdenv.isCygwin [ ./1.16-cygwin.patch ./1.16-vpath.patch + ] ++ lib.optionals stdenv.hostPlatform.isMinGW [ + # Do not require + (fetchpatch2 { + url = "https://aur.archlinux.org/cgit/aur.git/plain/get-w32-console-maxcols.mingw32.patch?h=mingw-w64-popt&id=63f2cdb0de116362c49681cef20f7a8b4355e85a"; + sha256 = "zv43l1RBqNzT/JG+jQaMVFaFv+ZYPuIiAtKUDzJJBbc="; + stripLen = 1; + extraPrefix = "src/"; + }) + + # Do not try to detect setuid, it is not a thing. + (fetchpatch2 { + url = "https://github.com/rpm-software-management/popt/commit/905544c5d9767894edaf71a1e3ce5126944c5695.patch"; + sha256 = "3PmcxeiEZ/Hof0zoVFSytEXvQ8gE8Sp5UdagExPVICU="; + stripLen = 1; + extraPrefix = "src/"; + revert = true; + }) ]; doCheck = false; # fails