2015-06-22 04:29:33 +01:00
|
|
|
{ appleDerivation_, applePackage, pkgs, stdenv }:
|
|
|
|
name: version: sha256: args: let
|
|
|
|
n = stdenv.lib.removePrefix "lib" name;
|
|
|
|
makeFile = ../. + builtins.toPath "/${name}/GNUmakefile";
|
|
|
|
appleDerivation = appleDerivation_ name version sha256;
|
|
|
|
in applePackage name version sha256 (args // {
|
|
|
|
appleDerivation = a:
|
|
|
|
appleDerivation (stdenv.lib.mergeAttrsConcatenateValues {
|
|
|
|
__impureHostDeps = import ./impure_deps.nix;
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
# allows including <Security/some-private-header.h>
|
2017-10-30 12:45:36 +00:00
|
|
|
cp -R ${pkgs.darwin.osx_private_sdk}/include/SecurityPrivateHeaders Security
|
2015-06-22 04:29:33 +01:00
|
|
|
|
|
|
|
grep -Rl MacErrors.h . | while read file; do
|
|
|
|
substituteInPlace "''$file" --replace \
|
|
|
|
'<CoreServices/../Frameworks/CarbonCore.framework/Headers/MacErrors.h>' \
|
2018-06-09 04:57:36 +01:00
|
|
|
'"${pkgs.darwin.apple_sdk.sdk.out}/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h"'
|
2015-06-22 04:29:33 +01:00
|
|
|
done || true # grep returns 1 if it can't find the string
|
2018-06-09 04:57:36 +01:00
|
|
|
|
2015-06-22 04:29:33 +01:00
|
|
|
grep -Rl MacTypes.h . | while read file; do
|
|
|
|
substituteInPlace "''$file" --replace \
|
|
|
|
'<CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>' \
|
2018-06-26 18:25:06 +01:00
|
|
|
'"${stdenv.lib.getDev pkgs.darwin.apple_sdk.sdk}/include/MacTypes.h"'
|
2015-06-22 04:29:33 +01:00
|
|
|
done || true # grep returns 1 if it can't find the string
|
|
|
|
'';
|
|
|
|
preBuild = ''
|
|
|
|
ln -s lib ${n}
|
2018-07-02 22:48:29 +01:00
|
|
|
makeFlagsArray=(-j$NIX_BUILD_CORES)
|
2015-06-22 04:29:33 +01:00
|
|
|
'';
|
2018-07-02 22:49:24 +01:00
|
|
|
outputs = [ "out" "dev" ];
|
2015-06-22 04:29:33 +01:00
|
|
|
buildInputs = [
|
2016-08-20 12:30:01 +01:00
|
|
|
pkgs.gnustep.make
|
2015-11-13 02:59:17 +00:00
|
|
|
pkgs.darwin.apple_sdk.frameworks.AppKit
|
|
|
|
pkgs.darwin.apple_sdk.frameworks.Foundation
|
|
|
|
pkgs.darwin.cf-private
|
2015-06-22 04:29:33 +01:00
|
|
|
];
|
|
|
|
makeFlags = [
|
|
|
|
"-f${makeFile}"
|
|
|
|
"MAKEFILE_NAME=${makeFile}"
|
|
|
|
"GNUSTEP_ABSOLUTE_INSTALL_PATHS=yes"
|
2016-08-20 12:30:01 +01:00
|
|
|
"GNUSTEP_MAKEFILES=${pkgs.gnustep.make}/share/GNUstep/Makefiles"
|
2015-06-22 04:29:33 +01:00
|
|
|
"LIB_LINK_INSTALL_DIR=\$(out)/lib"
|
|
|
|
];
|
|
|
|
installFlags = [
|
|
|
|
"${n}_INSTALL_DIR=\$(out)/lib"
|
|
|
|
"${n}_HEADER_FILES_INSTALL_DIR=\$(out)/include/${n}"
|
|
|
|
"GNUSTEP_HEADERS="
|
|
|
|
];
|
|
|
|
NIX_CFLAGS_COMPILE = [
|
|
|
|
"-isystem lib"
|
|
|
|
"-iframework ${pkgs.darwin.Security}/Library/Frameworks"
|
|
|
|
"-I."
|
|
|
|
"-Wno-deprecated-declarations"
|
2018-07-02 22:50:40 +01:00
|
|
|
"-DNDEBUG"
|
2015-06-22 04:29:33 +01:00
|
|
|
];
|
|
|
|
NIX_LDFLAGS = with pkgs.darwin; with apple_sdk.frameworks; [
|
|
|
|
"-L${libobjc}/lib"
|
|
|
|
"-F${Foundation}/Library/Frameworks"
|
|
|
|
"-F${AppKit}/Library/Frameworks"
|
|
|
|
"-no_dtrace_dof"
|
|
|
|
];
|
|
|
|
} a);
|
|
|
|
})
|