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