nixpkgs/pkgs/os-specific/darwin/apple-sdk
Daiderd Jordan 3987ea9a9d
mpv: add flag for swift on darwin
While we currently don't have a pure swift build on macOS it's possible
to build mpv using the swift compiler from CLT. eg.

    self: super:
    let
      CommandLineTools = "/Library/Developer/CommandLineTools";
    in
    {
      swift = super.stdenv.mkDerivation {
        name = "swift-CommandLineTools-0.0.0";
        phases = [ "installPhase" "fixupPhase" ];

        propagatedBuildInputs = [ self.darwin.DarwinTools ];

        installPhase = ''
            mkdir -p $out/bin $out/lib
            ln -s ${CommandLineTools}/usr/bin/swift $out/bin
            ln -s ${CommandLineTools}/usr/lib/swift $out/lib
            ln -s ${CommandLineTools}/SDKs $out
        '';

        setupHook = builtins.toFile "hook" ''
            addCommandLineTools() {
                echo >&2
                echo "WARNING: this is impure and unreliable, make sure the CommandLineTools are installed!" >&2
                echo "  $ xcode-select --install" >&2
                echo >&2
                [ -d ${CommandLineTools} ]
                export NIX_LDFLAGS+=" -L@out@/lib/swift/macosx"
                export SWIFT=swift
                export SWIFT_LIB_DYNAMIC=@out@/lib/swift/macosx
                export MACOS_SDK_VERSION=$(sw_vers -productVersion | awk -F. '{print $1 "." $2}')
                export MACOS_SDK=@out@/SDKs/MacOSX$MACOS_SDK_VERSION.sdk
            }

            prePhases+=" addCommandLineTools"
        '';

        __impureHostDeps = [ CommandLineTools ];
      };

      mpv = super.mpv.override { swiftSupport = true; };
    }
2020-02-06 14:15:35 +01:00
..
cf-setup-hook.sh apple-sdk setup hooks: NIX_CFLAGS_COMPILE may be undefined 2019-11-08 13:28:59 -05:00
default.nix stdenv: introduce appleSdkVersion and macosVersionMin 2020-01-31 21:52:11 +01:00
framework-setup-hook.sh treewide: Don't use envHook anymore 2017-12-30 22:04:22 -05:00
frameworks.nix mpv: add flag for swift on darwin 2020-02-06 14:15:35 +01:00
impure-deps.nix darwin: remove references to Ubiquity.framework 2019-02-17 15:30:30 +01:00
private-frameworks-setup-hook.sh darwin private frameworks setup hook: NIX_CFLAGS_COMPILE may be undefined 2019-11-08 13:24:20 -05:00
security-setup-hook.sh apple-sdk setup hooks: NIX_CFLAGS_COMPILE may be undefined 2019-11-08 13:28:59 -05:00