Unverified Commit 6e1a464f authored by Sam's avatar Sam
Browse files

swiftPackages.swiftpm: patch swift-crypto as needed

parent 0800438f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -88,6 +88,11 @@ lib.mapAttrs mkInstallScript {
  SwiftCrypto = ''
    add_library(Crypto SHARED IMPORTED)
    set_property(TARGET Crypto PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libCrypto@sharedLibExt@")

    add_library(_CryptoExtras SHARED IMPORTED)
    # this can't possibly be right... I really think it should be `libCryptoExtras`
    # swift-certificates did build with this though.....
    set_property(TARGET _CryptoExtras PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libCrypto@sharedLibExt@")
  '';

  SwiftASN1 = ''
+19 −1
Original line number Diff line number Diff line
@@ -23,7 +23,11 @@

let

  inherit (swift) swiftOs swiftModuleSubdir swiftStaticModuleSubdir;
  inherit (swift)
    swiftOs
    swiftModuleSubdir
    swiftStaticModuleSubdir
    ;
  sharedLibraryExt = stdenv.hostPlatform.extensions.sharedLibrary;

  sources = callPackage ../sources.nix { };
@@ -322,6 +326,14 @@ let
      fetchSubmodules = true;
    };

    buildInputs = [
      swift-asn1
    ];

    patches = [
      ./patches/install-crypto-extras.patch
    ];

    postPatch = ''
      # Fix use of hardcoded tool paths on Darwin.
      substituteInPlace CMakeLists.txt \
@@ -336,6 +348,12 @@ let

      # Headers are not installed.
      cp -r ../Sources/CCryptoBoringSSL/include $out/include

      # Swift modules are put in the wrong place by default (and not all are linked)
      mkdir -p $out/${swiftModuleSubdir}
      rm -rf $out/${swiftModuleSubdir}/*.swift{module,doc}
      # I assume we don't care about .swiftsourceinfo
      cp swift/*.swift{module,doc} $out/${swiftModuleSubdir}/
    '';
  };

+10 −0
Original line number Diff line number Diff line
Install _CryptoExtras target when building with CMake

--- a/Sources/_CryptoExtras/CMakeLists.txt
+++ b/Sources/_CryptoExtras/CMakeLists.txt
@@ -42,4 +42,5 @@ target_link_options(_CryptoExtras PRIVATE
 set_target_properties(_CryptoExtras PROPERTIES
   INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})

+_install_target(_CryptoExtras)
 set_property(GLOBAL APPEND PROPERTY SWIFT_CRYPTO_EXPORTS _CryptoExtras)