1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
{
lib,
stdenv,
fetchpatch,
callPackage,
cmake,
ninja,
swift,
Dispatch,
icu,
libxml2,
curl,
}:
let
sources = callPackage ../sources.nix { };
in
stdenv.mkDerivation {
pname = "swift-corelibs-foundation";
inherit (sources) version;
src = sources.swift-corelibs-foundation;
outputs = [
"out"
"dev"
];
nativeBuildInputs = [
cmake
ninja
swift
];
buildInputs = [
icu
libxml2
curl
];
propagatedBuildInputs = [ Dispatch ];
preConfigure = ''
# Fails to build with -D_FORTIFY_SOURCE.
NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/}
'';
postInstall = ''
# Split up the output.
mkdir $dev
mv $out/lib/swift/${swift.swiftOs} $out/swiftlibs
mv $out/lib/swift $dev/include
mkdir $out/lib/swift
mv $out/swiftlibs $out/lib/swift/${swift.swiftOs}
# Provide a CMake module. This is primarily used to glue together parts of
# the Swift toolchain. Modifying the CMake config to do this for us is
# otherwise more trouble.
mkdir -p $dev/lib/cmake/Foundation
export dylibExt="${stdenv.hostPlatform.extensions.sharedLibrary}"
export swiftOs="${swift.swiftOs}"
substituteAll ${./glue.cmake} $dev/lib/cmake/Foundation/FoundationConfig.cmake
'';
meta = {
description = "Core utilities, internationalization, and OS independence for Swift";
mainProgram = "plutil";
homepage = "https://github.com/apple/swift-corelibs-foundation";
platforms = lib.platforms.linux;
license = lib.licenses.asl20;
teams = [ lib.teams.swift ];
};
}
|