Fix mg building on darwin.

I am not happy with this at all. It avoids using libbsd at all on
darwin because there are conflicting header files, particularly the
header string.h.

Ideally that would be the thing to fix. But in the meantime, this patch
should do the trick.

It declares a header file apple.h, which files include if target is
darwin (checks for presence of __APPLE__). This header file also
references the three source files futimens.c, reallocarray.c and
strtonum.c. The former and  latter are from https://github.com/ibara/mg
which is another portable fork, but building against more platforms.

From the OpenBSD source tree is _null.h and tree.h. There is a check so
that if __APPLE__ is present then it will include them from this source
tree.

Now,the makefile GNUMakefile will not link against libbsd on darwin, by
checking the output of uname in much the same way as it did already for
FreeBSD.
This commit is contained in:
D. Guthrie 2020-02-01 22:21:31 +00:00
parent 40e30f9652
commit a0c2892c06
2 changed files with 1409 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
{ stdenv, fetchurl, pkgconfig, libbsd, ncurses, buildPackages }:
{ stdenv, fetchurl, pkgconfig, ncurses, buildPackages, libbsd }:
stdenv.mkDerivation rec {
pname = "mg";
version = "20171014";
version = "20180927";
src = fetchurl {
url = "http://homepage.boetes.org/software/mg/${pname}-${version}.tar.gz";
sha256 = "0hakfikzsml7z0hja8m8mcahrmfy2piy81bq9nccsjplyfc9clai";
url = "https://github.com/hboetes/mg/archive/${version}.tar.gz";
sha256 = "fbb09729ea00fe42dcdbc96ac7fc1d2b89eac651dec49e4e7af52fad4f5788f6";
};
enableParallelBuilding = true;
@ -17,10 +17,11 @@ stdenv.mkDerivation rec {
install -m 555 -Dt $out/bin mg
install -m 444 -Dt $out/share/man/man1 mg.1
'';
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libbsd ncurses ];
patches = ./darwin_no_libbsd.patch;
buildInputs = [ ncurses ] ++ stdenv.lib.optional (!stdenv.isDarwin) libbsd;
meta = with stdenv.lib; {
description = "Micro GNU/emacs, a portable version of the mg maintained by the OpenBSD team";