at master 1.5 kB view raw
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 42 ./disable-swift-overlay.patch 43 ]; 44 45 cmakeFlags = lib.optional useSwift "-DENABLE_SWIFT=ON"; 46 47 postInstall = '' 48 # Provide a CMake module. This is primarily used to glue together parts of 49 # the Swift toolchain. Modifying the CMake config to do this for us is 50 # otherwise more trouble. 51 mkdir -p $dev/lib/cmake/dispatch 52 export dylibExt="${stdenv.hostPlatform.extensions.sharedLibrary}" 53 substituteAll ${./glue.cmake} $dev/lib/cmake/dispatch/dispatchConfig.cmake 54 ''; 55 56 meta = { 57 description = "Grand Central Dispatch"; 58 homepage = "https://github.com/apple/swift-corelibs-libdispatch"; 59 platforms = lib.platforms.linux; 60 license = lib.licenses.asl20; 61 maintainers = with lib.maintainers; [ cmm ]; 62 teams = [ lib.teams.swift ]; 63 }; 64}