mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 05:33:23 +00:00
a0c2892c06
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.
33 lines
941 B
Nix
33 lines
941 B
Nix
{ stdenv, fetchurl, pkgconfig, ncurses, buildPackages, libbsd }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "mg";
|
|
version = "20180927";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/hboetes/mg/archive/${version}.tar.gz";
|
|
sha256 = "fbb09729ea00fe42dcdbc96ac7fc1d2b89eac651dec49e4e7af52fad4f5788f6";
|
|
};
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
makeFlags = [ "PKG_CONFIG=${buildPackages.pkgconfig}/bin/pkg-config" ];
|
|
|
|
installPhase = ''
|
|
install -m 555 -Dt $out/bin mg
|
|
install -m 444 -Dt $out/share/man/man1 mg.1
|
|
'';
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
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";
|
|
homepage = "https://homepage.boetes.org/software/mg";
|
|
license = licenses.publicDomain;
|
|
platforms = platforms.all;
|
|
};
|
|
}
|