From 1d38981ba5264f5de1530d9762fcf2eb1dd8e128 Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Thu, 29 May 2025 15:43:00 +0800 Subject: [PATCH] wol: build on aarch64-darwin --- pkgs/by-name/wo/wol/macos-10_7-getline.patch | 64 ++++++++++++++++++++ pkgs/by-name/wo/wol/package.nix | 7 ++- 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/wo/wol/macos-10_7-getline.patch diff --git a/pkgs/by-name/wo/wol/macos-10_7-getline.patch b/pkgs/by-name/wo/wol/macos-10_7-getline.patch new file mode 100644 index 000000000000..07ff7ff26a09 --- /dev/null +++ b/pkgs/by-name/wo/wol/macos-10_7-getline.patch @@ -0,0 +1,64 @@ +From f78508f9803de42faf6e578d89ce08ea31a62b0d Mon Sep 17 00:00:00 2001 +From: Bryan Lai +Date: Thu, 29 May 2025 15:38:11 +0800 +Subject: [PATCH] fix: build for darwin (conflicting getline) + +Previously failing with: + + In file included from getpass4.c:7: + ./getline.h:32:1: error: conflicting types for 'getline' + 32 | getline PARAMS ((char **_lineptr, size_t *_n, FILE *_stream)); + | ^ + /nix/store/w41ks2baj649algkjnbh9746cprrnr1k-apple-sdk-11.3/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:355:9: note: previous declaration is here + 355 | ssize_t getline(char ** __restrict __linep, size_t * __restrict __linecapp, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); + | ^ + In file included from getpass4.c:7: + ./getline.h:35:1: error: conflicting types for 'getdelim' + 35 | getdelim PARAMS ((char **_lineptr, size_t *_n, int _delimiter, FILE *_stream)); + | ^ + /nix/store/w41ks2baj649algkjnbh9746cprrnr1k-apple-sdk-11.3/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:354:9: note: previous declaration is here + 354 | ssize_t getdelim(char ** __restrict __linep, size_t * __restrict __linecapp, int __delimiter, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); + | ^ + 4 warnings generated. + 2 errors generated. +--- + configure.ac | 2 +- + lib/getline.h | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 99dc73d..fd0b0dc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -193,7 +193,7 @@ gl_MD5 dnl for GNU md5 + AM_FUNC_GETLINE dnl for GNU getline + AC_CHECK_FUNCS(usleep) + AC_CHECK_FUNCS(getopt_long) dnl for GNU getopt +-AC_CHECK_FUNCS(getdelim) ++AC_CHECK_FUNCS([getline getdelim]) + AC_CHECK_FUNC(inet_aton, [], [ + dnl check libresolv for inet_aton() as seen on solaris + AC_CHECK_LIB(resolv, inet_aton, +diff --git a/lib/getline.h b/lib/getline.h +index 991184c..34a0247 100644 +--- a/lib/getline.h ++++ b/lib/getline.h +@@ -28,11 +28,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + # endif + + # if __GLIBC__ < 2 ++ ++#include "config.h" ++#ifndef HAVE_GETLINE + int + getline PARAMS ((char **_lineptr, size_t *_n, FILE *_stream)); ++#endif + ++#ifndef HAVE_GETDELIM + int + getdelim PARAMS ((char **_lineptr, size_t *_n, int _delimiter, FILE *_stream)); ++#endif ++ + # endif + + #endif /* not GETLINE_H_ */ diff --git a/pkgs/by-name/wo/wol/package.nix b/pkgs/by-name/wo/wol/package.nix index ffc0ff554326..5de294a59cbd 100644 --- a/pkgs/by-name/wo/wol/package.nix +++ b/pkgs/by-name/wo/wol/package.nix @@ -15,7 +15,10 @@ stdenv.mkDerivation rec { sha256 = "08i6l5lr14mh4n3qbmx6kyx7vjqvzdnh3j9yfvgjppqik2dnq270"; }; - patches = [ ./gcc-14.patch ]; + patches = [ + ./gcc-14.patch + ./macos-10_7-getline.patch + ]; nativeBuildInputs = [ perl # for pod2man in order to get a manpage @@ -30,6 +33,6 @@ stdenv.mkDerivation rec { license = licenses.gpl2Plus; maintainers = with maintainers; [ makefu ]; mainProgram = "wol"; - platforms = platforms.linux; + platforms = platforms.unix; }; }