plan9port: use C compiler from Nix

The install script was escaping the Nix environment on Mac OS by using
`xcrun -sdk macos clang` as its C compiler.  Using the Nix compiler
required declaring the necessary frameworks as inputs and patching
build scripts to assume MacOS 10.12 (and not try to detect).

So cached derivations prior to this would probably not work on all
intended target machines.

This *might* also fix installCheck on Darwin on Hydra.

Other minor fixes:

* Disable parallel building due to a race with a missing y.tab.h
* Use NIX_CFLAGS_COMPILE/NIX_LDFLAGS instead of trying to synthesize
  something like them.
* X11 dependencies aren't used on Darwin when the windowing system
  is correctly detected
This commit is contained in:
Jason Felice
2019-08-09 16:29:51 -04:00
parent b044b6814f
commit 83c1e8c319
5 changed files with 181 additions and 30 deletions
+18 -22
View File
@@ -1,7 +1,11 @@
{ stdenv, fetchFromGitHub, which, libX11, libXt, fontconfig, freetype
{ stdenv, fetchFromGitHub, which
, darwin ? null
, xorgproto ? null
, libX11
, libXext ? null
, zlib ? null
, libXt ? null
, fontconfig ? null
, freetype ? null
, perl ? null # For building web manuals
}:
@@ -17,6 +21,12 @@ stdenv.mkDerivation rec {
sha256 = "1lp17948q7vpl8rc2bf5a45bc8jqyj0s3zffmks9r25ai42vgb43";
};
patches = [
./tmpdir.patch
./darwin-sw_vers.patch
./darwin-cfframework.patch
];
postPatch = ''
#hardcoded path
substituteInPlace src/cmd/acme/acme.c \
@@ -35,30 +45,16 @@ stdenv.mkDerivation rec {
'';
buildInputs = [
which perl libX11 fontconfig xorgproto libXt libXext
which perl
] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
xorgproto libX11 libXext libXt fontconfig
freetype # fontsrv wants ft2build.h provides system fonts for acme and sam.
];
] ++ stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
darwin.cf-private Carbon Cocoa IOKit Metal QuartzCore
]);
builder = ./builder.sh;
libX11_dev = libX11.dev;
libXt_dev = libXt.dev;
libXext_dev = libXext.dev;
fontconfig_dev = fontconfig.dev;
freetype_dev = freetype.dev;
zlib_dev = zlib.dev;
xorgproto_exp = xorgproto;
libX11_exp = libX11;
libXt_exp = libXt;
libXext_exp = libXext;
freetype_exp = freetype;
zlib_exp = zlib;
fontconfig_lib = fontconfig.lib;
NIX_LDFLAGS="-lgcc_s";
enableParallelBuilding = true;
doInstallCheck = true;
installCheckPhase = ''