diff options
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r-- | pkgs/development/tools/build-managers/bazel/bazel-deps/default.nix | 80 | ||||
-rw-r--r-- | pkgs/development/tools/continuous-integration/drone-cli/default.nix | 24 | ||||
-rw-r--r-- | pkgs/development/tools/continuous-integration/drone-cli/deps.nix | 274 | ||||
-rw-r--r-- | pkgs/development/tools/documentation/mkdocs/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/tools/misc/babeltrace/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/tools/vim-vint/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/platforms.nix (renamed from pkgs/development/tools/xcbuild/platform.nix) | 28 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/sdks.nix (renamed from pkgs/development/tools/xcbuild/sdk.nix) | 13 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/setup-hook.sh | 8 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/toolchain.nix | 69 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/toolchains.nix | 71 | ||||
-rw-r--r-- | pkgs/development/tools/xcbuild/wrapper.nix | 158 |
12 files changed, 585 insertions, 152 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/bazel-deps/default.nix b/pkgs/development/tools/build-managers/bazel/bazel-deps/default.nix new file mode 100644 index 000000000000..76e2ad1e7cac --- /dev/null +++ b/pkgs/development/tools/build-managers/bazel/bazel-deps/default.nix @@ -0,0 +1,80 @@ +{ stdenv, buildBazelPackage, lib, fetchFromGitHub, git, jre, makeWrapper }: + +buildBazelPackage rec { + name = "bazel-deps-${version}"; + version = "2018-05-31"; + + meta = with stdenv.lib; { + homepage = "https://github.com/johnynek/bazel-deps"; + description = "Generate bazel dependencies for maven artifacts"; + license = licenses.mit; + maintainers = [ maintainers.uri-canva ]; + platforms = platforms.all; + }; + + src = fetchFromGitHub { + owner = "johnynek"; + repo = "bazel-deps"; + rev = "dd7d0086d3a61c1d5c3370a0300824d0c75946e4"; + sha256 = "1h9ddgk6vn0bhnnkwwz4n1iqv2rcdj521dxhdwj5wwpndbciw855"; + }; + + bazelTarget = "//src/scala/com/github/johnynek/bazel_deps:parseproject_deploy.jar"; + + buildInputs = [ git makeWrapper ]; + + fetchAttrs = { + preInstall = '' + # Remove all built in external workspaces, Bazel will recreate them when building + rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker,local_*,\@local_*} + # For each external workspace, remove all files that aren't referenced by Bazel + # Many of these files are non-hermetic (for example .git/refs/remotes/origin/HEAD) + files_to_delete=() + for workspace in $(find $bazelOut/external -maxdepth 2 -name "WORKSPACE" -print0 | xargs -0L1 dirname); do + workspaceOut="$NIX_BUILD_TOP/workspaces/$(basename workspace)/output" + workspaceUserRoot="$NIX_BUILD_TOP/workspaces/$(basename workspace)/tmp" + rm -rf $workspace/.git + if ! targets_and_files=$(cd "$workspace" && bazel --output_base="$workspaceOut" --output_user_root="$workspaceUserRoot" query '//...:*' 2> /dev/null | sort -u); then + continue + fi + if ! targets=$(cd "$workspace" && bazel --output_base="$workspaceOut" --output_user_root="$workspaceUserRoot" query '//...:all' 2> /dev/null | sort -u); then + continue + fi + mapfile -t referenced_files < <(comm -23 <(printf '%s' "$targets_and_files") <(printf '%s' "$targets") | sed -e 's,^//:,,g' | sed -e 's,^//,,g' | sed -e 's,:,/,g') + referenced_files+=( "WORKSPACE" ) + for referenced_file in "''${referenced_files[@]}"; do + # Some of the referenced files are symlinks to non-referenced files. + # The symlink targets have deterministic contents, but non-deterministic + # paths. Copy them to the referenced path, which is deterministic. + if target=$(readlink "$workspace/$referenced_file"); then + rm "$workspace/$referenced_file" + cp -a "$target" "$workspace/$referenced_file" + fi + done + mapfile -t workspace_files_to_delete < <(find "$workspace" -type f -or -type l | sort -u | comm -23 - <(printf "$workspace/%s\n" "''${referenced_files[@]}" | sort -u)) + for workspace_file_to_delete in "''${workspace_files_to_delete[@]}"; do + files_to_delete+=("$workspace_file_to_delete") + done + # We're running bazel in many different workspaces in a loop. Letting the + # daemon shut down on its own would leave several daemons alive at the + # same time, using up a lot of memory. Shut them down explicitly instead. + bazel --output_base="$workspaceOut" --output_user_root="$workspaceUserRoot" shutdown 2> /dev/null + done + for file_to_delete in "''${files_to_delete[@]}"; do + rm "$file_to_delete" + done + find . -type d -empty -delete + ''; + + sha256 = "0fh9jjwk3aq0kklhl9zyy8hj8gjm1y1fy4ygjinm0469w9jdgc3g"; + }; + + buildAttrs = { + installPhase = '' + mkdir -p $out/bin/bazel-bin/src/scala/com/github/johnynek/bazel_deps + cp gen_maven_deps.sh $out/bin + wrapProgram "$out/bin/gen_maven_deps.sh" --set JAVA_HOME "${jre}" --prefix PATH : ${lib.makeBinPath [ jre ]} + cp bazel-bin/src/scala/com/github/johnynek/bazel_deps/parseproject_deploy.jar $out/bin/bazel-bin/src/scala/com/github/johnynek/bazel_deps + ''; + }; +} diff --git a/pkgs/development/tools/continuous-integration/drone-cli/default.nix b/pkgs/development/tools/continuous-integration/drone-cli/default.nix new file mode 100644 index 000000000000..4a4708df32dd --- /dev/null +++ b/pkgs/development/tools/continuous-integration/drone-cli/default.nix @@ -0,0 +1,24 @@ +# with import <nixpkgs>{}; +{ stdenv, fetchFromGitHub, buildGoPackage }: + +buildGoPackage rec { + name = "drone-cli-${version}"; + version = "0.8.6"; + revision = "v${version}"; + goPackagePath = "github.com/drone/drone-cli"; + + goDeps= ./deps.nix; + + src = fetchFromGitHub { + owner = "drone"; + repo = "drone-cli"; + rev = revision; + sha256 = "1vvilpqyx9jl0lc9hr73qxngwhwbyk81fycal7ys1w59gv9hxrh9"; + }; + + meta = with stdenv.lib; { + maintainers = with maintainers; [ bricewge ]; + license = licenses.asl20; + description = "Command line client for the Drone continuous integration server."; + }; +} diff --git a/pkgs/development/tools/continuous-integration/drone-cli/deps.nix b/pkgs/development/tools/continuous-integration/drone-cli/deps.nix new file mode 100644 index 000000000000..d6486db13951 --- /dev/null +++ b/pkgs/development/tools/continuous-integration/drone-cli/deps.nix @@ -0,0 +1,274 @@ +# file generated from Gopkg.lock using dep2nix (https://github.com/nixcloud/dep2nix) +[ + { + goPackagePath = "github.com/Microsoft/go-winio"; + fetch = { + type = "git"; + url = "https://github.com/Microsoft/go-winio"; + rev = "7da180ee92d8bd8bb8c37fc560e673e6557c392f"; + sha256 = "19gjjhmzswhm11wzj38r5alxypmflmy0z42flhc3czhmmwv7b1av"; + }; + } + { + goPackagePath = "github.com/Sirupsen/logrus"; + fetch = { + type = "git"; + url = "https://github.com/Sirupsen/logrus"; + rev = "d682213848ed68c0a260ca37d6dd5ace8423f5ba"; + sha256 = "0nzyqwzx3k7nqfq8q7yv32gaf3ymq3bpwhkmw1hj2zakq5a93d8x"; + }; + } + { + goPackagePath = "github.com/cncd/pipeline"; + fetch = { + type = "git"; + url = "https://github.com/cncd/pipeline"; + rev = "3a09486affc9215ba52f55b1f6e10182458d1aba"; + sha256 = "17v9bwmqhr9pqppsqpb2qg7klip5jmks5c5kq6lxw6iq75q3p5zm"; + }; + } + { + goPackagePath = "github.com/docker/distribution"; + fetch = { + type = "git"; + url = "https://github.com/docker/distribution"; + rev = "7dba427612198a11b161a27f9d40bb2dca1ccd20"; + sha256 = "0sv2044znv2cjcll0lc45wbjhsy0hpfkbczhl07m81i62r929l27"; + }; + } + { + goPackagePath = "github.com/docker/docker"; + fetch = { + type = "git"; + url = "https://github.com/docker/docker"; + rev = "f645ffca04abf2dd6c89ac9057a1eb7d2b0ac338"; + sha256 = "0ic848invzfyzj9psbd8d3wvqddxbxbpj8vy2dbdqcwl26qabaqf"; + }; + } + { + goPackagePath = "github.com/docker/go-connections"; + fetch = { + type = "git"; + url = "https://github.com/docker/go-connections"; + rev = "eb315e36415380e7c2fdee175262560ff42359da"; + sha256 = "0jsci3f0dc3bd0bab7byq24qvwpd6dw34hnd2kmvvgrg31xzb73f"; + }; + } + { + goPackagePath = "github.com/docker/go-units"; + fetch = { + type = "git"; + url = "https://github.com/docker/go-units"; + rev = "f2145db703495b2e525c59662db69a7344b00bb8"; + sha256 = "0ql76imazd27h1dnnala49qsaw2dl6hspcwzh20bgm9ajcv0fwd0"; + }; + } + { + goPackagePath = "github.com/docker/libcompose"; + fetch = { + type = "git"; + url = "https://github.com/docker/libcompose"; + rev = "1c4bd4542afb20db0b51afd71d9ebceaf206e2dd"; + sha256 = "1prm5w6d0zvc39jq7wxdgis3pzzra2wdqxqn68ip5dhf3m32c8vn"; + }; + } + { + goPackagePath = "github.com/drone/drone-go"; + fetch = { + type = "git"; + url = "https://github.com/drone/drone-go"; + rev = "7f20e6c113d3ffa2af80401c4eba7d510c8fd875"; + sha256 = "1qm5nmzqmvjl8c2nfhhbp5a4ij1zfw4dinx278ns9qb0w973614k"; + }; + } + { + goPackagePath = "github.com/drone/envsubst"; + fetch = { + type = "git"; + url = "https://github.com/drone/envsubst"; + rev = "f4d1a8ef8670afc9eea1fb95ee09a979fd2763a3"; + sha256 = "10rj5zskp6f0bw648c1fn76v18jlidjd7ri76kk3csz2bwjm3m9c"; + }; + } + { + goPackagePath = "github.com/fatih/color"; + fetch = { + type = "git"; + url = "https://github.com/fatih/color"; + rev = "507f6050b8568533fb3f5504de8e5205fa62a114"; + sha256 = "0k1v9dkhrxiqhg48yqkwzpd7x40xx38gv2pgknswbsy4r8w644i7"; + }; + } + { + goPackagePath = "github.com/flynn/go-shlex"; + fetch = { + type = "git"; + url = "https://github.com/flynn/go-shlex"; + rev = "3f9db97f856818214da2e1057f8ad84803971cff"; + sha256 = "1j743lysygkpa2s2gii2xr32j7bxgc15zv4113b0q9jhn676ysia"; + }; + } + { + goPackagePath = "github.com/ghodss/yaml"; + fetch = { + type = "git"; + url = "https://github.com/ghodss/yaml"; + rev = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7"; + sha256 = "0skwmimpy7hlh7pva2slpcplnm912rp3igs98xnqmn859kwa5v8g"; + }; + } + { + goPackagePath = "github.com/golang/protobuf"; + fetch = { + type = "git"; + url = "https://github.com/golang/protobuf"; + rev = "925541529c1fa6821df4e44ce2723319eb2be768"; + sha256 = "1d3zjvhl115l23xakj0014qpjchivlg098h10v5nfirkk1i9f9sa"; + }; + } + { + goPackagePath = "github.com/google/go-jsonnet"; + fetch = { + type = "git"; + url = "https://github.com/drone/go-jsonnet.git"; + rev = "0274286eef945e5e24be6ebfc13a9deefdd312ee"; + # sha256 = "105jqawa401z5kcsbpan3cg9lryxlnnrclg6s9xnzslwd9wxyfrl"; + sha256 = "0crbsmwgy9iav7rnhkgkqv8cbyl6q60bjkbfcaqxb6m47q3d544a"; + }; + } + { + goPackagePath = "github.com/jackspirou/syscerts"; + fetch = { + type = "git"; + url = "https://github.com/jackspirou/syscerts"; + rev = "b68f5469dff16e102bd6a2d5b3e79341c938d736"; + sha256 = "0mjz64qnysmy9lh0hrjvwir5ndlh5li13m6zvfrl0s5gi7m9v0kd"; + }; + } + { + goPackagePath = "github.com/joho/godotenv"; + fetch = { + type = "git"; + url = "https://github.com/joho/godotenv"; + rev = "a79fa1e548e2c689c241d10173efd51e5d689d5b"; + sha256 = "09610yqswxa02905mp9cqgsm50r76saagzddc55sqav4ad04j6qm"; + }; + } + { + goPackagePath = "github.com/mattn/go-colorable"; + fetch = { + type = "git"; + url = "https://github.com/mattn/go-colorable"; + rev = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"; + sha256 = "1nwjmsppsjicr7anq8na6md7b1z84l9ppnlr045hhxjvbkqwalvx"; + }; + } + { + goPackagePath = "github.com/mattn/go-isatty"; + fetch = { + type = "git"; + url = "https://github.com/mattn/go-isatty"; + rev = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"; + sha256 = "06w45aqz2a6yrk25axbly2k5wmsccv8cspb94bfmz4izvw8h927n"; + }; + } + { + goPackagePath = "github.com/opencontainers/go-digest"; + fetch = { + type = "git"; + url = "https://github.com/opencontainers/go-digest"; + rev = "279bed98673dd5bef374d3b6e4b09e2af76183bf"; + sha256 = "01gc7fpn8ax429024p2fcx3yb18axwz5bjf2hqxlii1jbsgw4bh9"; + }; + } + { + goPackagePath = "github.com/pkg/browser"; + fetch = { + type = "git"; + url = "https://github.com/pkg/browser"; + rev = "c90ca0c84f15f81c982e32665bffd8d7aac8f097"; + sha256 = "05xpqsns08blmwdh8aw5kpq2d9x4fl91535j6np1ylw1q2b67b8i"; + }; + } + { + goPackagePath = "github.com/pkg/errors"; + fetch = { + type = "git"; + url = "https://github.com/pkg/errors"; + rev = "645ef00459ed84a119197bfb8d8205042c6df63d"; + sha256 = "001i6n71ghp2l6kdl3qq1v2vmghcz3kicv9a5wgcihrzigm75pp5"; + }; + } + { + goPackagePath = "github.com/urfave/cli"; + fetch = { + type = "git"; + url = "https://github.com/urfave/cli"; + rev = "cfb38830724cc34fedffe9a2a29fb54fa9169cd1"; + sha256 = "0y6f4sbzkiiwrxbl15biivj8c7qwxnvm3zl2dd3mw4wzg4x10ygj"; + }; + } + { + goPackagePath = "golang.org/x/crypto"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/crypto"; + rev = "650f4a345ab4e5b245a3034b110ebc7299e68186"; + sha256 = "0r1ij3lq07d6kg3dlpj508vwkwmz0qpwcrbismisw6vkl7ls7w89"; + }; + } + { + goPackagePath = "golang.org/x/net"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/net"; + rev = "f5dfe339be1d06f81b22525fe34671ee7d2c8904"; + sha256 = "01y9j7pjnnld4ipmzjvs0hls0hh698f2sga8cxaw5y6r5j7igaah"; + }; + } + { + goPackagePath = "golang.org/x/oauth2"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/oauth2"; + rev = "543e37812f10c46c622c9575afd7ad22f22a12ba"; + sha256 = "0kc816fq1zj5wdw4mfa7w2q26rnh273157w8n0d30xpzl8ba2isr"; + }; + } + { + goPackagePath = "golang.org/x/sync"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/sync"; + rev = "fd80eb99c8f653c847d294a001bdf2a3a6f768f5"; + sha256 = "12lzldlj1cqc1babp1hkkn76fglzn5abkqvmbpr4f2j95mf9x836"; + }; + } + { + goPackagePath = "golang.org/x/sys"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/sys"; + rev = "37707fdb30a5b38865cfb95e5aab41707daec7fd"; + sha256 = "1abrr2507a737hdqv4q7pw7hv6ls9pdiq9crhdi52r3gcz6hvizg"; + }; + } + { + goPackagePath = "google.golang.org/appengine"; + fetch = { + type = "git"; + url = "https://github.com/golang/appengine"; + rev = "150dc57a1b433e64154302bdc40b6bb8aefa313a"; + sha256 = "0w3knznv39k8bm85ri62f83czcrxknql7dv6p9hk1a5jx3xljgxq"; + }; + } + { + goPackagePath = "gopkg.in/yaml.v2"; + fetch = { + type = "git"; + url = "https://github.com/go-yaml/yaml"; + rev = "d670f9405373e636a5a2765eea47fac0c9bc91a4"; + sha256 = "1w1xid51n8v1mydn2m3vgggw8qgpd5a5sr62snsc77d99fpjsrs0"; + }; + } +] diff --git a/pkgs/development/tools/documentation/mkdocs/default.nix b/pkgs/development/tools/documentation/mkdocs/default.nix index c03de09de11a..925d0a786af0 100644 --- a/pkgs/development/tools/documentation/mkdocs/default.nix +++ b/pkgs/development/tools/documentation/mkdocs/default.nix @@ -4,13 +4,13 @@ with python.pkgs; buildPythonApplication rec { pname = "mkdocs"; - version = "0.17.4"; + version = "0.17.5"; src = fetchFromGitHub { owner = "mkdocs"; repo = "mkdocs"; rev = version; - sha256 = "1hwvy6lnqqmzjia5vqd45jx6gwd9cvf7p5vw245c0cg27zkgpazp"; + sha256 = "1l1dahpwqikmww3yx2m6j2134npk8vcikg9klsmpqjpza8nigwzw"; }; postPatch = '' diff --git a/pkgs/development/tools/misc/babeltrace/default.nix b/pkgs/development/tools/misc/babeltrace/default.nix index b2130118fed9..cb00111b2b46 100644 --- a/pkgs/development/tools/misc/babeltrace/default.nix +++ b/pkgs/development/tools/misc/babeltrace/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, pkgconfig, glib, libuuid, popt, elfutils }: stdenv.mkDerivation rec { - name = "babeltrace-1.5.5"; + name = "babeltrace-1.5.6"; src = fetchurl { url = "https://www.efficios.com/files/babeltrace/${name}.tar.bz2"; - sha256 = "1b78fam1gbsalga5pppn8ka461q35a9svz3mlbv82ssakdw4d4a0"; + sha256 = "1dxv2pwyqx2p7kzhcfansij40m9kanl85x2r68dmgp98g0hvq22k"; }; nativeBuildInputs = [ pkgconfig ]; diff --git a/pkgs/development/tools/vim-vint/default.nix b/pkgs/development/tools/vim-vint/default.nix index 96307c8d134c..0db25f88d768 100644 --- a/pkgs/development/tools/vim-vint/default.nix +++ b/pkgs/development/tools/vim-vint/default.nix @@ -4,13 +4,13 @@ with python3Packages; buildPythonApplication rec { name = "vim-vint-${version}"; - version = "0.3.18"; + version = "0.3.19"; src = fetchFromGitHub { owner = "kuniwak"; repo = "vint"; rev = "v${version}"; - sha256 = "0qrlimg385sxq4y6vqbanby31inaa1q47w9qcw5knwffbz96whrs"; + sha256 = "0fb0vkmn5fv4mwk6riw08hb3vsh1pivvrfwm90b95yhksq4pfi12"; }; # For python 3.5 > version > 2.7 , a nested dependency (pythonPackages.hypothesis) fails. diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platforms.nix index bb91df474aae..bc60af9e1a5c 100644 --- a/pkgs/development/tools/xcbuild/platform.nix +++ b/pkgs/development/tools/xcbuild/platforms.nix @@ -1,13 +1,13 @@ -{ runCommand, lib, sdk, platformName, writeText }: +{ runCommand, lib, sdks, xcodePlatform, writeText }: let inherit (lib.generators) toPlist; Info = { - CFBundleIdentifier = platformName; + CFBundleIdentifier = "com.apple.platform.${lib.toLower xcodePlatform}"; Type = "Platform"; - Name = "macosx"; + Name = lib.toLower xcodePlatform; }; Version = { @@ -285,14 +285,18 @@ let in -runCommand "MacOSX.platform" {} '' - install -D ${writeText "Info.plist" (toPlist {} Info)} $out/Info.plist - install -D ${writeText "version.plist" (toPlist {} Version)} $out/version.plist - install -D ${writeText "Architectures.xcspec" (toPlist {} Architectures)} $out/Developer/Library/Xcode/Specifications/Architectures.xcspec - install -D ${writeText "PackageTypes.xcspec" (toPlist {} PackageTypes)} $out/Developer/Library/Xcode/Specifications/PackageTypes.xcspec - install -D ${writeText "ProductTypes.xcspec" (toPlist {} ProductTypes)} $out/Developer/Library/Xcode/Specifications/ProductTypes.xcspec +runCommand "Platforms" {} '' + platform=$out/${xcodePlatform}.platform - mkdir -p $out/Developer/SDKs/ - cd $out/Developer/SDKs/ - cp -r ${sdk} ${sdk.name} + install -D ${writeText "Info.plist" (toPlist {} Info)} $platform/Info.plist + install -D ${writeText "version.plist" (toPlist {} Version)} $platform/version.plist + install -D ${writeText "Architectures.xcspec" (toPlist {} Architectures)} $platform/Developer/Library/Xcode/Specifications/Architectures.xcspec + install -D ${writeText "PackageTypes.xcspec" (toPlist {} PackageTypes)} $platform/Developer/Library/Xcode/Specifications/PackageTypes.xcspec + install -D ${writeText "ProductTypes.xcspec" (toPlist {} ProductTypes)} $platform/Developer/Library/Xcode/Specifications/ProductTypes.xcspec + + # per-platform bins go here + mkdir -p $platform/usr/bin + + mkdir -p $platform/Developer + ln -s ${sdks} $platform/Developer/SDKs '' diff --git a/pkgs/development/tools/xcbuild/sdk.nix b/pkgs/development/tools/xcbuild/sdks.nix index c97d17d739ba..b0af26e87c12 100644 --- a/pkgs/development/tools/xcbuild/sdk.nix +++ b/pkgs/development/tools/xcbuild/sdks.nix @@ -1,11 +1,8 @@ -{ runCommand, lib, toolchainName, sdkName, writeText }: +{ runCommand, lib, toolchainName, sdkName, writeText, version, xcodePlatform }: let inherit (lib.generators) toPlist; - # TODO: expose MACOSX_DEPLOYMENT_TARGET in nix so we can use it here. - version = "10.10"; - SDKSettings = { CanonicalName = sdkName; DisplayName = sdkName; @@ -21,9 +18,11 @@ let }; in -runCommand "MacOSX${version}.sdk" { +runCommand "SDKs" { inherit version; } '' - install -D ${writeText "SDKSettings.plist" (toPlist {} SDKSettings)} $out/SDKSettings.plist - install -D ${writeText "SystemVersion.plist" (toPlist {} SystemVersion)} $out/System/Library/CoreServices/SystemVersion.plist + sdk=$out/${sdkName}.sdk + install -D ${writeText "SDKSettings.plist" (toPlist {} SDKSettings)} $sdk/SDKSettings.plist + install -D ${writeText "SystemVersion.plist" (toPlist {} SystemVersion)} $sdk/System/Library/CoreServices/SystemVersion.plist + ln -s $sdk $out/${xcodePlatform}.sdk '' diff --git a/pkgs/development/tools/xcbuild/setup-hook.sh b/pkgs/development/tools/xcbuild/setup-hook.sh index 70100c196973..9dc03a61f62e 100644 --- a/pkgs/development/tools/xcbuild/setup-hook.sh +++ b/pkgs/development/tools/xcbuild/setup-hook.sh @@ -19,11 +19,9 @@ xcbuildInstallPhase () { runHook postInstall } -if [ -z "$dontUseXcbuild" ]; then - buildPhase=xcbuildBuildPhase - if [ -z "$installPhase" ]; then - installPhase=xcbuildInstallPhase - fi +buildPhase=xcbuildBuildPhase +if [ -z "$installPhase" ]; then + installPhase=xcbuildInstallPhase fi # if [ -d "*.xcodeproj" ]; then diff --git a/pkgs/development/tools/xcbuild/toolchain.nix b/pkgs/development/tools/xcbuild/toolchain.nix deleted file mode 100644 index 3c20b510c3b5..000000000000 --- a/pkgs/development/tools/xcbuild/toolchain.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ runCommand, toolchainName, fetchurl, makeWrapper, stdenv -, buildPackages, lib, writeText }: - -let - - inherit (lib) getBin optionalString; - inherit (lib.generators) toPlist; - - ToolchainInfo = { - Identifier = toolchainName; - }; - - # We could pull this out of developer_cmds but it adds an annoying - # loop if we want to bootstrap and this is just a tiny script so I'm - # not going to bother. - mkdep-darwin-src = fetchurl { - url = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh"; - sha256 = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541"; - executable = true; - }; -in - -runCommand "nixpkgs.xctoolchain" { - nativeBuildInputs = [ makeWrapper ]; -} ('' - mkdir -p $out - install -D ${writeText "ToolchainInfo.plist" (toPlist {} ToolchainInfo)} $out/ToolchainInfo.plist - - mkdir -p $out/usr/include - mkdir -p $out/usr/lib - mkdir -p $out/usr/libexec - mkdir -p $out/usr/share - mkdir -p $out/usr/bin - - for bin in ${getBin stdenv.cc}/bin/*; do - ln -s $bin $out/usr/bin - done - - for bin in ${getBin stdenv.cc.bintools.bintools}/bin/*; do - if ! [ -e "$out/usr/bin/$(basename $bin)" ]; then - ln -s $bin $out/usr/bin - fi - done - - ln -s ${buildPackages.yacc}/bin/yacc $out/usr/bin/yacc - ln -s ${buildPackages.yacc}/bin/bison $out/usr/bin/bison - ln -s ${buildPackages.flex}/bin/flex $out/usr/bin/flex - ln -s ${buildPackages.flex}/bin/flex++ $out/usr/bin/flex++ - ln -s $out/bin/flex $out/usr/bin/lex - - ln -s ${buildPackages.m4}/bin/m4 $out/usr/bin/m4 - ln -s $out/usr/bin/m4 $out/usr/bin/gm4 - - ln -s ${buildPackages.unifdef}/bin/unifdef $out/usr/bin/unifdef - ln -s ${buildPackages.unifdef}/bin/unifdefall $out/usr/bin/unifdefall - - ln -s ${buildPackages.gperf}/bin/gperf $out/usr/bin/gperf - ln -s ${buildPackages.indent}/bin/indent $out/usr/bin/indent - ln -s ${buildPackages.ctags}/bin/ctags $out/usr/bin/ctags -'' + optionalString stdenv.isDarwin '' - for bin in ${getBin buildPackages.darwin.cctools}/bin/*; do - if ! [ -e "$out/usr/bin/$(basename $bin)" ]; then - ln -s $bin $out/usr/bin - fi - done - - ln -s ${buildPackages.darwin.bootstrap_cmds}/bin/mig $out/usr/bin - ln -s ${mkdep-darwin-src} $out/usr/bin/mkdep -'') diff --git a/pkgs/development/tools/xcbuild/toolchains.nix b/pkgs/development/tools/xcbuild/toolchains.nix new file mode 100644 index 000000000000..01a8fbdb0b06 --- /dev/null +++ b/pkgs/development/tools/xcbuild/toolchains.nix @@ -0,0 +1,71 @@ +{ runCommand, toolchainName, fetchurl, makeWrapper, stdenv +, buildPackages, lib, writeText }: + +let + + inherit (lib) getBin optionalString; + inherit (lib.generators) toPlist; + + ToolchainInfo = { + Identifier = toolchainName; + }; + + # We could pull this out of developer_cmds but it adds an annoying + # loop if we want to bootstrap and this is just a tiny script so I'm + # not going to bother. + mkdep-darwin-src = fetchurl { + url = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh"; + sha256 = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541"; + executable = true; + }; +in + +runCommand "Toolchains" { + nativeBuildInputs = [ makeWrapper ]; +} ('' + toolchain=$out/XcodeDefault.xctoolchain + mkdir -p $toolchain + + install -D ${writeText "ToolchainInfo.plist" (toPlist {} ToolchainInfo)} $toolchain/ToolchainInfo.plist + + mkdir -p $toolchain/usr/include + mkdir -p $toolchain/usr/lib + mkdir -p $toolchain/usr/libexec + mkdir -p $toolchain/usr/share + mkdir -p $toolchain/usr/bin + + for bin in ${getBin stdenv.cc}/bin/*; do + ln -s $bin $toolchain/usr/bin + done + + for bin in ${getBin stdenv.cc.bintools.bintools}/bin/*; do + if ! [ -e "$toolchain/usr/bin/$(basename $bin)" ]; then + ln -s $bin $toolchain/usr/bin + fi + done + + ln -s ${buildPackages.yacc}/bin/yacc $toolchain/usr/bin/yacc + ln -s ${buildPackages.yacc}/bin/bison $toolchain/usr/bin/bison + ln -s ${buildPackages.flex}/bin/flex $toolchain/usr/bin/flex + ln -s ${buildPackages.flex}/bin/flex++ $toolchain/usr/bin/flex++ + ln -s $toolchain/bin/flex $toolchain/usr/bin/lex + + ln -s ${buildPackages.m4}/bin/m4 $toolchain/usr/bin/m4 + ln -s $toolchain/usr/bin/m4 $toolchain/usr/bin/gm4 + + ln -s ${buildPackages.unifdef}/bin/unifdef $toolchain/usr/bin/unifdef + ln -s ${buildPackages.unifdef}/bin/unifdefall $toolchain/usr/bin/unifdefall + + ln -s ${buildPackages.gperf}/bin/gperf $toolchain/usr/bin/gperf + ln -s ${buildPackages.indent}/bin/indent $toolchain/usr/bin/indent + ln -s ${buildPackages.ctags}/bin/ctags $toolchain/usr/bin/ctags +'' + optionalString stdenv.isDarwin '' + for bin in ${getBin buildPackages.darwin.cctools}/bin/*; do + if ! [ -e "$toolchain/usr/bin/$(basename $bin)" ]; then + ln -s $bin $toolchain/usr/bin + fi + done + + ln -s ${buildPackages.darwin.bootstrap_cmds}/bin/mig $toolchain/usr/bin + ln -s ${mkdep-darwin-src} $toolchain/usr/bin/mkdep +'') diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix index cfa855e23cd8..f8b1c1bf31e9 100644 --- a/pkgs/development/tools/xcbuild/wrapper.nix +++ b/pkgs/development/tools/xcbuild/wrapper.nix @@ -1,80 +1,132 @@ -{ stdenv, buildPackages, makeWrapper, writeText, runCommand -, CoreServices, ImageIO, CoreGraphics }: +{ stdenv, lib, buildPackages, makeWrapper, writeText, runCommand +, CoreServices, ImageIO, CoreGraphics +, targetPlatform +, xcodePlatform ? targetPlatform.xcodePlatform or "MacOSX" +, xcodeVer ? targetPlatform.xcodeVer or "9.4.1" +, sdkVer ? targetPlatform.sdkVer or "10.10" }: let + inherit (lib) toLower; + toolchainName = "com.apple.dt.toolchain.XcodeDefault"; - platformName = "com.apple.platform.macosx"; - sdkName = "macosx10.10"; + sdkName = "${xcodePlatform}${sdkVer}"; + + # TODO: expose MACOSX_DEPLOYMENT_TARGET in nix so we can use it here. + sdkBuildVersion = "17E189"; + xcodeSelectVersion = "2349"; xcbuild = buildPackages.callPackage ./default.nix { inherit CoreServices ImageIO CoreGraphics; }; - toolchain = buildPackages.callPackage ./toolchain.nix { + toolchains = buildPackages.callPackage ./toolchains.nix { inherit toolchainName; }; - sdk = buildPackages.callPackage ./sdk.nix { - inherit toolchainName sdkName; + sdks = buildPackages.callPackage ./sdks.nix { + inherit toolchainName sdkName xcodePlatform; + version = sdkVer; }; - platform = buildPackages.callPackage ./platform.nix { - inherit sdk platformName; + platforms = buildPackages.callPackage ./platforms.nix { + inherit sdks xcodePlatform; }; xcconfig = writeText "nix.xcconfig" '' SDKROOT=${sdkName} ''; -in - -stdenv.mkDerivation { - name = "xcbuild-wrapper-${xcbuild.version}"; - - nativeBuildInputs = [ makeWrapper ]; - - setupHook = ./setup-hook.sh; - - phases = [ "installPhase" "fixupPhase" ]; - - installPhase = '' - mkdir -p $out/bin - - for file in ${xcbuild}/bin/*; do - ln -s $file $out/bin - done - - mkdir -p $out/usr - ln -s $out/bin $out/usr/bin - - mkdir -p $out/Library/Xcode - ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications - - mkdir -p $out/Platforms - ln -s ${platform} $out/Platforms/nixpkgs.platform - - mkdir -p $out/Toolchains - ln -s ${toolchain} $out/Toolchains/nixpkgs.xctoolchain + xcode-select = writeText "xcode-select" '' +#!/usr/bin/env sh +while [ $# -gt 0 ]; do + case "$1" in + -h | --help) ;; # noop + -s | --switch) shift;; # noop + -r | --reset) ;; # noop + -v | --version) echo xcode-select version ${xcodeSelectVersion} ;; + -p | --print-path) echo @DEVELOPER_DIR@ ;; + --install) ;; # noop + esac + shift +done + ''; - wrapProgram $out/bin/xcodebuild \ - --add-flags "-xcconfig ${xcconfig}" \ - --add-flags "DERIVED_DATA_DIR=." \ - --set DEVELOPER_DIR "$out" \ - --set SDKROOT ${sdkName} - wrapProgram $out/bin/xcrun \ - --set DEVELOPER_DIR "$out" \ - --set SDKROOT ${sdkName} - wrapProgram $out/bin/xcode-select \ - --set DEVELOPER_DIR "$out" \ - --set SDKROOT ${sdkName} + xcrun = writeText "xcrun" '' +#!/usr/bin/env sh +while [ $# -gt 0 ]; do + case "$1" in + --sdk | -sdk) shift ;; + --find | -find) + shift + command -v $1 ;; + --log | -log) ;; # noop + --verbose | -verbose) ;; # noop + --no-cache | -no-cache) ;; # noop + --kill-cache | -kill-cache) ;; # noop + --show-sdk-path | -show-sdk-path) + echo ${sdks}/${sdkName}.sdk ;; + --show-sdk-platform-path | -show-sdk-platform-path) + echo ${platforms}/${xcodePlatform}.platform ;; + --show-sdk-version | -show-sdk-version) + echo ${sdkVer} ;; + --show-sdk-build-version | -show-sdk-build-version) + echo ${sdkBuildVersion} ;; + *) break ;; + esac + shift +done +if ! [[ -z "$@" ]]; then + exec "$@" +fi ''; +in + +runCommand "xcodebuild-${xcbuild.version}" { + nativeBuildInputs = [ makeWrapper ]; inherit (xcbuild) meta; - passthru = { - raw = xcbuild; - }; + # ensure that the toolchain goes in PATH + propagatedBuildInputs = [ "${toolchains}/XcodeDefault.xctoolchain/usr" ]; + + passthru = { inherit xcbuild; }; preferLocalBuild = true; -} +} '' + mkdir -p $out/bin + + mkdir -p $out/usr + ln -s $out/bin $out/usr/bin + + mkdir -p $out/Library/Xcode + ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications + + ln -s ${platforms} $out/Platforms + ln -s ${toolchains} $out/Toolchains + + makeWrapper ${xcbuild}/bin/xcodebuild $out/bin/xcodebuild \ + --add-flags "-xcconfig ${xcconfig}" \ + --add-flags "DERIVED_DATA_DIR=." \ + --set DEVELOPER_DIR "$out" \ + --set SDKROOT ${sdkName} \ + --run '[ "$1" = "-version" ] && (echo Xcode ${xcodeVer}; echo Build version ${sdkBuildVersion}) && exit 0' + + substitute ${xcode-select} $out/bin/xcode-select \ + --subst-var-by DEVELOPER_DIR $out + chmod +x $out/bin/xcode-select + + substitute ${xcrun} $out/bin/xcrun + chmod +x $out/bin/xcrun + + for bin in PlistBuddy actool builtin-copy builtin-copyPlist \ + builtin-copyStrings builtin-copyTiff \ + builtin-embeddedBinaryValidationUtility \ + builtin-infoPlistUtility builtin-lsRegisterURL \ + builtin-productPackagingUtility builtin-validationUtility \ + lsbom plutil; do + ln -s ${xcbuild}/bin/$bin $out/bin/$bin + done + + fixupPhase +'' |