nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 callPackage,
5 fetchpatch,
6 cmake,
7 ninja,
8 useSwift ? true,
9 swift,
10}:
11
12let
13 sources = callPackage ../sources.nix { };
14in
15stdenv.mkDerivation {
16 pname = "swift-corelibs-libdispatch";
17
18 inherit (sources) version;
19 src = sources.swift-corelibs-libdispatch;
20
21 outputs = [
22 "out"
23 "dev"
24 "man"
25 ];
26
27 nativeBuildInputs = [
28 cmake
29 ]
30 ++ lib.optionals useSwift [
31 ninja
32 swift
33 ];
34
35 patches = [
36 # Fix the build with modern Clang.
37 (fetchpatch {
38 url = "https://github.com/swiftlang/swift-corelibs-libdispatch/commit/30bb8019ba79cdae0eb1dc0c967c17996dd5cc0a.patch";
39 hash = "sha256-wPZQ4wtEWk8HaKMfzjamlU6p/IW5EFiTssY63rGM+ZA=";
40 })
41 (fetchpatch {
42 url = "https://github.com/swiftlang/swift-corelibs-libdispatch/commit/38872e2d44d66d2fb94186988509defc734888a5.patch";
43 hash = "sha256-GABwDeTjciV36Sa0FS10mCfFCqRoBBstgW/OiKdPahA=";
44 })
45
46 ./disable-swift-overlay.patch
47 ];
48
49 cmakeFlags = lib.optional useSwift "-DENABLE_SWIFT=ON";
50
51 postInstall = ''
52 # Provide a CMake module. This is primarily used to glue together parts of
53 # the Swift toolchain. Modifying the CMake config to do this for us is
54 # otherwise more trouble.
55 mkdir -p $dev/lib/cmake/dispatch
56 export dylibExt="${stdenv.hostPlatform.extensions.sharedLibrary}"
57 substituteAll ${./glue.cmake} $dev/lib/cmake/dispatch/dispatchConfig.cmake
58 '';
59
60 meta = {
61 description = "Grand Central Dispatch";
62 homepage = "https://github.com/apple/swift-corelibs-libdispatch";
63 platforms = lib.platforms.linux;
64 license = lib.licenses.asl20;
65 maintainers = with lib.maintainers; [ cmm ];
66 teams = [ lib.teams.swift ];
67 };
68}