summaryrefslogtreecommitdiffstats
path: root/pkgs/shells/dash
diff options
context:
space:
mode:
authorAdrian Gierakowski <agierakowski@gmail.com>2020-07-21 10:57:28 +0100
committerAdrian Gierakowski <agierakowski@gmail.com>2020-07-21 11:14:06 +0100
commit3020abe5b591d201cc6b760f3a9c6e4b94cfca2d (patch)
tree4859094ae0575b136d1a55901b49da33ac4d1606 /pkgs/shells/dash
parentd0c12dc612bef680d129df40cbe7d80981a1e51c (diff)
dash: fix compilation on darwin
it has been broken since: https://github.com/NixOS/nixpkgs/commit/adbace3c212a64cfa151590f907965aa3eaabf8b
Diffstat (limited to 'pkgs/shells/dash')
-rw-r--r--pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch41
-rw-r--r--pkgs/shells/dash/default.nix6
2 files changed, 46 insertions, 1 deletions
diff --git a/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch b/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch
new file mode 100644
index 000000000000..f2e0802f7981
--- /dev/null
+++ b/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch
@@ -0,0 +1,41 @@
+From 7e75779eaeacdbb46a387a59d9aaf1481a1da3e5 Mon Sep 17 00:00:00 2001
+From: Adrian Gierakowski <agierakowski@gmail.com>
+Date: Sun, 19 Jul 2020 08:38:05 +0100
+Subject: [PATCH] fix dirent64 et al on darwin
+
+---
+ configure.ac | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index b8faca9..cee1e4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -139,6 +139,7 @@ if test "$ac_cv_func_signal" != yes; then
+ [klibc has bsd_signal instead of signal])])
+ fi
+
++dnl TODO: stat64 is deprecated since macOS 10.6
+ dnl Check for stat64 (dietlibc/klibc).
+ AC_CHECK_FUNC(stat64,, [
+ AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
+@@ -155,6 +156,16 @@ AC_CHECK_FUNC(open64,, [
+ AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
+ ])
+
++dnl OS X apparently has stat64 but not readdir64.
++AC_CHECK_FUNC(readdir64,, [
++ AC_DEFINE(readdir64, readdir, [64-bit operations are the same as 32-bit])
++])
++
++dnl OS X apparently has stat64 but not dirent64.
++AC_CHECK_TYPE(struct dirent64,, [
++ AC_DEFINE(dirent64, dirent, [64-bit operations are the same as 32-bit])
++],[#include <dirent.h>])
++
+ dnl Check if struct stat has st_mtim.
+ AC_MSG_CHECKING(for stat::st_mtim)
+ AC_COMPILE_IFELSE(
+--
+2.15.1
+
diff --git a/pkgs/shells/dash/default.nix b/pkgs/shells/dash/default.nix
index c76191cfd377..f9dd578ad98b 100644
--- a/pkgs/shells/dash/default.nix
+++ b/pkgs/shells/dash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ autoreconfHook, lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
name = "dash-0.5.11.1";
@@ -10,6 +10,10 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ];
+ # Temporary fix until a proper one is accepted upstream
+ patches = lib.lists.optional stdenv.isDarwin ./0001-fix-dirent64-et-al-on-darwin.patch;
+ nativeBuildInputs = lib.lists.optional stdenv.isDarwin autoreconfHook;
+
meta = with stdenv.lib; {
homepage = "http://gondor.apana.org.au/~herbert/dash/";
description = "A POSIX-compliant implementation of /bin/sh that aims to be as small as possible";