uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,27 @@
{ lib, python }:
python.pkgs.buildPythonApplication rec {
pname = "alibuild";
version = "1.11.2";
src = python.pkgs.fetchPypi {
inherit pname version;
hash = "sha256-wq2H2inUf2CjPD45krCNdjw2s4FXsEDlfOHqW8VaVKg=";
};
doCheck = false;
propagatedBuildInputs = with python.pkgs; [
requests
pyyaml
boto3
jinja2
distro
];
meta = with lib; {
homepage = "https://alisw.github.io/alibuild/";
description = "Build tool for ALICE experiment software";
license = licenses.gpl3;
maintainers = with maintainers; [ ktf ];
};
}

View file

@ -0,0 +1,111 @@
{ fetchurl, lib, stdenv, coreutils, makeWrapper }:
stdenv.mkDerivation rec {
pname = "ant";
version = "1.9.16";
nativeBuildInputs = [ makeWrapper ];
src = fetchurl {
url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2";
sha256 = "0rif9kj6njajy951w3aapk27y1mbaxb08whs126v533h96rb1kjp";
};
contrib = fetchurl {
url = "mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2";
sha256 = "96effcca2581c1ab42a4828c770b48d54852edf9e71cefc9ed2ffd6590571ad1";
};
installPhase =
''
mkdir -p $out/bin $out/lib/ant
mv * $out/lib/ant/
# Get rid of the manual (35 MiB). Maybe we should put this in a
# separate output. Keep the antRun script since it's vanilla sh
# and needed for the <exec/> task (but since we set ANT_HOME to
# a weird value, we have to move antRun to a weird location).
# Get rid of the other Ant scripts since we provide our own.
mv $out/lib/ant/bin/antRun $out/bin/
rm -rf $out/lib/ant/{manual,bin,WHATSNEW}
mkdir $out/lib/ant/bin
mv $out/bin/antRun $out/lib/ant/bin/
# Install ant-contrib.
unpackFile $contrib
cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/
cat >> $out/bin/ant <<EOF
#! ${stdenv.shell} -e
ANT_HOME=$out/lib/ant
# Find the JDK by looking for javac. As a fall-back, find the
# JRE by looking for java. The latter allows just the JRE to be
# used with (say) ECJ as the compiler. Finally, allow the GNU
# JVM.
if [ -z "\''${JAVA_HOME-}" ]; then
for i in javac java gij; do
if p="\$(type -p \$i)"; then
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
break
fi
done
if [ -z "\''${JAVA_HOME-}" ]; then
echo "\$0: cannot find the JDK or JRE" >&2
exit 1
fi
fi
if [ -z \$NIX_JVM ]; then
if [ -e \$JAVA_HOME/bin/java ]; then
NIX_JVM=\$JAVA_HOME/bin/java
elif [ -e \$JAVA_HOME/bin/gij ]; then
NIX_JVM=\$JAVA_HOME/bin/gij
else
NIX_JVM=java
fi
fi
LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \
-Dant.home=\$ANT_HOME -Dant.library.dir="\$ANT_LIB" \
org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS \
-cp "\$CLASSPATH" "\$@"
EOF
chmod +x $out/bin/ant
''; # */
meta = {
homepage = "https://ant.apache.org/";
description = "A Java-based build tool";
longDescription = ''
Apache Ant is a Java-based build tool. In theory, it is kind of like
Make, but without Make's wrinkles.
Why another build tool when there is already make, gnumake, nmake, jam,
and others? Because all those tools have limitations that Ant's
original author couldn't live with when developing software across
multiple platforms. Make-like tools are inherently shell-based -- they
evaluate a set of dependencies, then execute commands not unlike what
you would issue in a shell. This means that you can easily extend
these tools by using or writing any program for the OS that you are
working on. However, this also means that you limit yourself to the
OS, or at least the OS type such as Unix, that you are working on.
Ant is different. Instead of a model where it is extended with
shell-based commands, Ant is extended using Java classes. Instead of
writing shell commands, the configuration files are XML-based, calling
out a target tree where various tasks get executed. Each task is run
by an object that implements a particular Task interface.
'';
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.eelco ];
platforms = lib.platforms.all;
};
}

View file

@ -0,0 +1,111 @@
{ fetchurl, lib, stdenv, coreutils, makeWrapper }:
stdenv.mkDerivation rec {
pname = "ant";
version = "1.10.11";
nativeBuildInputs = [ makeWrapper ];
src = fetchurl {
url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2";
sha256 = "19m8xb7h6xm4jykzb79kakbx1pa4awaglw6z31pbfg8m5pmwkipz";
};
contrib = fetchurl {
url = "mirror://sourceforge/ant-contrib/ant-contrib-1.0b3-bin.tar.bz2";
sha256 = "1l8say86bz9gxp4yy777z7nm4j6m905pg342li1aphc14p5grvwn";
};
installPhase =
''
mkdir -p $out/bin $out/lib/ant
mv * $out/lib/ant/
# Get rid of the manual (35 MiB). Maybe we should put this in a
# separate output. Keep the antRun script since it's vanilla sh
# and needed for the <exec/> task (but since we set ANT_HOME to
# a weird value, we have to move antRun to a weird location).
# Get rid of the other Ant scripts since we provide our own.
mv $out/lib/ant/bin/antRun $out/bin/
rm -rf $out/lib/ant/{manual,bin,WHATSNEW}
mkdir $out/lib/ant/bin
mv $out/bin/antRun $out/lib/ant/bin/
# Install ant-contrib.
unpackFile $contrib
cp -p ant-contrib/ant-contrib-*.jar $out/lib/ant/lib/
cat >> $out/bin/ant <<EOF
#! ${stdenv.shell} -e
ANT_HOME=$out/lib/ant
# Find the JDK by looking for javac. As a fall-back, find the
# JRE by looking for java. The latter allows just the JRE to be
# used with (say) ECJ as the compiler. Finally, allow the GNU
# JVM.
if [ -z "\''${JAVA_HOME-}" ]; then
for i in javac java gij; do
if p="\$(type -p \$i)"; then
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
break
fi
done
if [ -z "\''${JAVA_HOME-}" ]; then
echo "\$0: cannot find the JDK or JRE" >&2
exit 1
fi
fi
if [ -z \$NIX_JVM ]; then
if [ -e \$JAVA_HOME/bin/java ]; then
NIX_JVM=\$JAVA_HOME/bin/java
elif [ -e \$JAVA_HOME/bin/gij ]; then
NIX_JVM=\$JAVA_HOME/bin/gij
else
NIX_JVM=java
fi
fi
LOCALCLASSPATH="\$ANT_HOME/lib/ant-launcher.jar\''${LOCALCLASSPATH:+:}\$LOCALCLASSPATH"
exec \$NIX_JVM \$NIX_ANT_OPTS \$ANT_OPTS -classpath "\$LOCALCLASSPATH" \
-Dant.home=\$ANT_HOME -Dant.library.dir="\$ANT_LIB" \
org.apache.tools.ant.launch.Launcher \$NIX_ANT_ARGS \$ANT_ARGS \
-cp "\$CLASSPATH" "\$@"
EOF
chmod +x $out/bin/ant
''; # */
meta = {
homepage = "https://ant.apache.org/";
description = "A Java-based build tool";
longDescription = ''
Apache Ant is a Java-based build tool. In theory, it is kind of like
Make, but without Make's wrinkles.
Why another build tool when there is already make, gnumake, nmake, jam,
and others? Because all those tools have limitations that Ant's
original author couldn't live with when developing software across
multiple platforms. Make-like tools are inherently shell-based -- they
evaluate a set of dependencies, then execute commands not unlike what
you would issue in a shell. This means that you can easily extend
these tools by using or writing any program for the OS that you are
working on. However, this also means that you limit yourself to the
OS, or at least the OS type such as Unix, that you are working on.
Ant is different. Instead of a model where it is extended with
shell-based commands, Ant is extended using Java classes. Instead of
writing shell commands, the configuration files are XML-based, calling
out a target tree where various tasks get executed. Each task is run
by an object that implements a particular Task interface.
'';
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.eelco ];
platforms = lib.platforms.all;
};
}

View file

@ -0,0 +1,18 @@
source $stdenv/setup
unpackPhase
mkdir -p $out/maven
cp -r $name/* $out/maven
makeWrapper $out/maven/bin/mvn $out/bin/mvn --set-default JAVA_HOME "$jdk"
makeWrapper $out/maven/bin/mvnDebug $out/bin/mvnDebug --set-default JAVA_HOME "$jdk"
# Add the maven-axis and JIRA plugin by default when using maven 1.x
if [ -e $out/maven/bin/maven ]
then
export OLD_HOME=$HOME
export HOME=.
$out/maven/bin/maven plugin:download -DgroupId=maven-plugins -DartifactId=maven-axis-plugin -Dversion=0.7
export HOME=OLD_HOME
fi

View file

@ -0,0 +1,27 @@
{ lib, stdenv, fetchurl, jdk, makeWrapper }:
assert jdk != null;
stdenv.mkDerivation rec {
pname = "apache-maven";
version = "3.8.5";
builder = ./builder.sh;
src = fetchurl {
url = "mirror://apache/maven/maven-3/${version}/binaries/${pname}-${version}-bin.tar.gz";
sha256 = "sha256-iOMHAPMqP2Dg0o0PEqNSXSm3wgxy0TAVPfW11tiQxnM=";
};
nativeBuildInputs = [ makeWrapper ];
inherit jdk;
meta = with lib; {
description = "Build automation tool (used primarily for Java projects)";
homepage = "https://maven.apache.org/";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ cko ];
};
}

View file

@ -0,0 +1,33 @@
{ lib, stdenv, fetchFromGitLab, cmake }:
stdenv.mkDerivation rec {
pname = "arpa2cm";
version = "0.9.0";
src = fetchFromGitLab {
sha256 = "sha256-1z0fH8vZJiPkY/C654us9s2BULM1tlvvYcszNqk34yI=";
rev = "v${version}";
repo = pname;
owner = "arpa2";
};
nativeBuildInputs = [ cmake ];
meta = with lib; {
description = "CMake Module library for the ARPA2 project";
longDescription = ''
The CMake module library for the ARPA2 project, including the LillyDAP,
TLSPool and IdentityHub software stacks. Like the KDE Extra CMake Modules (ECM)
which is a large-ish collection of curated CMake modules of particular
interest to Qt-based and KDE Frameworks-based applications, the ARPA2
CMake Modules (ARPA2CM) is a collection of modules for the software
stack from the ARPA2 project. This is largely oriented towards
TLS, SSL, X509, DER and LDAP technologies. The ARPA2 CMake Modules
also include modules used for product release and deployment of
the ARPA2 software stack.
'';
homepage = "https://gitlab.com/arpa2/arpa2cm";
license = licenses.bsd2;
maintainers = with maintainers; [ leenaars fufexan ];
};
}

View file

@ -0,0 +1,39 @@
{ lib, stdenv, fetchFromGitHub, lua5_3, python3 }:
stdenv.mkDerivation rec {
pname = "bam";
version = "0.5.1";
src = fetchFromGitHub {
owner = "matricks";
repo = "bam";
rev = "v${version}";
sha256 = "13br735ig7lygvzyfd15fc2rdygrqm503j6xj5xkrl1r7w2wipq6";
};
nativeBuildInputs = [ lua5_3 python3 ];
buildPhase = "${stdenv.shell} make_unix.sh";
checkPhase = "${python3.interpreter} scripts/test.py";
strictDeps = true;
installPhase = ''
mkdir -p "$out/share/bam"
cp -r docs examples tests "$out/share/bam"
mkdir -p "$out/bin"
cp bam "$out/bin"
'';
meta = with lib; {
description = "Yet another build manager";
maintainers = with maintainers;
[
raskin
];
platforms = platforms.linux;
license = licenses.zlib;
downloadPage = "http://matricks.github.com/bam/";
};
}

View file

@ -0,0 +1,7 @@
# The Bazel build tool
https://bazel.build/
The bazel tool requires regular maintenance, especially under darwin, so we created a maintainers team.
Please ping @NixOS/bazel in your github PR/issue to increase your chance of a quick turnaround, thanks!

View file

@ -0,0 +1,44 @@
{ writeText, bazel, runLocal, bazelTest, distDir }:
# Tests that certain executables are available in bazel-executed bash shells.
let
WORKSPACE = writeText "WORKSPACE" ''
workspace(name = "our_workspace")
'';
fileIn = writeText "input.txt" ''
one
two
three
'';
fileBUILD = writeText "BUILD" ''
genrule(
name = "tool_usage",
srcs = [ ":input.txt" ],
outs = [ "output.txt" ],
cmd = "cat $(location :input.txt) | gzip - | gunzip - | awk '/t/' > $@",
)
'';
workspaceDir = runLocal "our_workspace" {} ''
mkdir $out
cp ${WORKSPACE} $out/WORKSPACE
cp ${fileIn} $out/input.txt
cp ${fileBUILD} $out/BUILD
'';
testBazel = bazelTest {
name = "bazel-test-bash-tools";
bazelPkg = bazel;
inherit workspaceDir;
bazelScript = ''
${bazel}/bin/bazel build :tool_usage --distdir=${distDir}
cp bazel-bin/output.txt $out
echo "Testing content" && [ "$(cat $out | wc -l)" == "2" ] && echo "OK"
'';
};
in testBazel

View file

@ -0,0 +1,28 @@
{ buildGoModule
, fetchFromGitHub
, lib
}:
buildGoModule rec {
pname = "bazel-remote";
version = "2.3.7";
src = fetchFromGitHub {
owner = "buchgr";
repo = pname;
rev = "v${version}";
sha256 = "sha256-5VxPCfartTRYCmjwNrH7SM0o7IQ4+Tq8Q2IM8hFWyVc=";
};
vendorSha256 = "sha256-wXgW7HigMIeUZAcZpm5TH9thfCHmpz+M42toWHgwIYo=";
doCheck = false;
meta = with lib; {
homepage = "https://github.com/buchgr/bazel-remote";
description = "A remote HTTP/1.1 cache for Bazel";
license = licenses.asl20;
maintainers = lib.teams.bazel.members;
platforms = platforms.darwin ++ platforms.linux;
};
}

View file

@ -0,0 +1,24 @@
From 3f5abd591b93ebdbc1ae82e5c29cf26024222f5f Mon Sep 17 00:00:00 2001
From: Uri Baghin <uri@canva.com>
Date: Thu, 30 Jan 2020 16:47:36 +1100
Subject: [PATCH] Disable build file generation for remote apis.
---
WORKSPACE | 1 +
1 file changed, 1 insertion(+)
diff --git a/WORKSPACE b/WORKSPACE
index f9ebafa..52e4e0b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -208,6 +208,7 @@ http_archive(
go_repository(
name = "com_github_bazelbuild_remote_apis",
+ build_file_generation = "off",
importpath = "github.com/bazelbuild/remote-apis",
sum = "h1:OPH+hf+ICw8WEp2CV2ncfdyWPC30Cmw8b5NKun0n5IQ=",
version = "v0.0.0-20191119143007-b5123b1bb285",
--
2.25.0

View file

@ -0,0 +1,628 @@
{ stdenv, callPackage, lib, fetchurl, fetchFromGitHub, installShellFiles
, runCommand, runCommandCC, makeWrapper, recurseIntoAttrs
# this package (through the fixpoint glass)
, bazel_self
, lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, gawk, gnused, gnutar, gnugrep, gzip, findutils
# updater
, python27, python3, writeScript
# Apple dependencies
, cctools, libcxx, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
, buildJdk, runJdk
, buildJdkName
, runtimeShell
# Downstream packages for tests
, bazel-watcher
# Always assume all markers valid (this is needed because we remove markers; they are non-deterministic).
# Also, don't clean up environment variables (so that NIX_ environment variables are passed to compilers).
, enableNixHacks ? false
, gcc-unwrapped
, autoPatchelfHook
, file
, substituteAll
, writeTextFile
}:
let
version = "3.7.2";
src = fetchurl {
url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip";
sha256 = "1cfrbs23lg0jnl22ddylx3clcjw7bdpbix7r5lqibab346s5n9fy";
};
# Update with `eval $(nix-build -A bazel.updater)`,
# then add new dependencies from the dict in ./src-deps.json as required.
srcDeps = lib.attrsets.attrValues srcDepsSet;
srcDepsSet =
let
srcs = lib.importJSON ./src-deps.json;
toFetchurl = d: lib.attrsets.nameValuePair d.name (fetchurl {
urls = d.urls;
sha256 = d.sha256;
});
in builtins.listToAttrs (map toFetchurl [
srcs.desugar_jdk_libs
srcs.io_bazel_skydoc
srcs.bazel_skylib
srcs.io_bazel_rules_sass
srcs.platforms
# `bazel query` wants all of these to be available regardless of platform.
srcs."java_tools_javac11_darwin-v10.0.zip"
srcs."java_tools_javac11_linux-v10.0.zip"
srcs."java_tools_javac11_windows-v10.0.zip"
srcs."coverage_output_generator-v2.5.zip"
srcs.build_bazel_rules_nodejs
srcs."android_tools_pkg-0.19.0rc3.tar.gz"
srcs."bazel-toolchains-3.1.0.tar.gz"
srcs."com_github_grpc_grpc"
srcs.upb
srcs.rules_pkg
srcs.rules_cc
srcs.rules_java
srcs.rules_proto
srcs.com_google_protobuf
]);
distDir = runCommand "bazel-deps" {} ''
mkdir -p $out
for i in ${builtins.toString srcDeps}; do cp $i $out/$(stripHash $i); done
'';
defaultShellPath = lib.makeBinPath
# Keep this list conservative. For more exotic tools, prefer to use
# @rules_nixpkgs to pull in tools from the nix repository. Example:
#
# WORKSPACE:
#
# nixpkgs_git_repository(
# name = "nixpkgs",
# revision = "def5124ec8367efdba95a99523dd06d918cb0ae8",
# )
#
# # This defines an external Bazel workspace.
# nixpkgs_package(
# name = "bison",
# repositories = { "nixpkgs": "@nixpkgs//:default.nix" },
# )
#
# some/BUILD.bazel:
#
# genrule(
# ...
# cmd = "$(location @bison//:bin/bison) -other -args",
# tools = [
# ...
# "@bison//:bin/bison",
# ],
# )
#
[ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip file zip ];
# Java toolchain used for the build and tests
javaToolchain = "@bazel_tools//tools/jdk:toolchain_${buildJdkName}";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
# This repository is fetched by bazel at runtime
# however it contains prebuilt java binaries, with wrong interpreter
# and libraries path.
# We prefetch it, patch it, and override it in a global bazelrc.
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
arch = stdenv.hostPlatform.parsed.cpu.name;
remote_java_tools = stdenv.mkDerivation {
name = "remote_java_tools_${system}";
src = srcDepsSet."java_tools_javac11_${system}-v10.0.zip";
nativeBuildInputs = [ unzip ]
++ lib.optional stdenv.isLinux autoPatchelfHook;
buildInputs = [ gcc-unwrapped ];
sourceRoot = ".";
buildPhase = ''
mkdir $out;
'';
installPhase = ''
cp -Ra * $out/
touch $out/WORKSPACE
'';
};
bazelRC = writeTextFile {
name = "bazel-rc";
text = ''
startup --server_javabase=${runJdk}
# Can't use 'common'; https://github.com/bazelbuild/bazel/issues/3054
# Most commands inherit from 'build' anyway.
build --distdir=${distDir}
fetch --distdir=${distDir}
query --distdir=${distDir}
build --override_repository=${remote_java_tools.name}=${remote_java_tools}
fetch --override_repository=${remote_java_tools.name}=${remote_java_tools}
query --override_repository=${remote_java_tools.name}=${remote_java_tools}
# Provide a default java toolchain, this will be the same as ${runJdk}
build --host_javabase='@local_jdk//:jdk'
# load default location for the system wide configuration
try-import /etc/bazel.bazelrc
'';
};
in
stdenv.mkDerivation rec {
pname = "bazel";
inherit version;
meta = with lib; {
homepage = "https://github.com/bazelbuild/bazel/";
description = "Build tool that builds code quickly and reliably";
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # source bundles dependencies as jars
];
license = licenses.asl20;
maintainers = lib.teams.bazel.members;
inherit platforms;
};
inherit src;
sourceRoot = ".";
patches = [
# On Darwin, the last argument to gcc is coming up as an empty string. i.e: ''
# This is breaking the build of any C target. This patch removes the last
# argument if it's found to be an empty string.
../trim-last-argument-to-gcc-if-empty.patch
# On Darwin, using clang 6 to build fails because of a linker error (see #105573),
# but using clang 7 fails because libarclite_macosx.a cannot be found when linking
# the xcode_locator tool.
# This patch removes using the -fobjc-arc compiler option and makes the code
# compile without automatic reference counting. Caveat: this leaks memory, but
# we accept this fact because xcode_locator is only a short-lived process used during the build.
./no-arc.patch
./gcc11.patch
# --experimental_strict_action_env (which may one day become the default
# see bazelbuild/bazel#2574) hardcodes the default
# action environment to a non hermetic value (e.g. "/usr/local/bin").
# This is non hermetic on non-nixos systems. On NixOS, bazel cannot find the required binaries.
# So we are replacing this bazel paths by defaultShellPath,
# improving hermeticity and making it work in nixos.
(substituteAll {
src = ../strict_action_env.patch;
strictActionEnvPatch = defaultShellPath;
})
# bazel reads its system bazelrc in /etc
# override this path to a builtin one
(substituteAll {
src = ../bazel_rc.patch;
bazelSystemBazelRCPath = bazelRC;
})
] ++ lib.optional enableNixHacks ../nix-hacks.patch;
# Additional tests that check bazels functionality. Execute
#
# nix-build . -A bazel.tests
#
# in the nixpkgs checkout root to exercise them locally.
passthru.tests =
let
runLocal = name: attrs: script:
let
attrs' = removeAttrs attrs [ "buildInputs" ];
buildInputs = [ python3 ] ++ (attrs.buildInputs or []);
in
runCommandCC name ({
inherit buildInputs;
preferLocalBuild = true;
meta.platforms = platforms;
} // attrs') script;
# bazel wants to extract itself into $install_dir/install every time it runs,
# so lets do that only once.
extracted = bazelPkg:
let install_dir =
# `install_base` field printed by `bazel info`, minus the hash.
# yes, this path is kinda magic. Sorry.
"$HOME/.cache/bazel/_bazel_nixbld";
in runLocal "bazel-extracted-homedir" { passthru.install_dir = install_dir; } ''
export HOME=$(mktemp -d)
touch WORKSPACE # yeah, everything sucks
install_base="$(${bazelPkg}/bin/bazel info | grep install_base)"
# assert its actually below install_dir
[[ "$install_base" =~ ${install_dir} ]] \
|| (echo "oh no! $install_base but we are \
trying to copy ${install_dir} to $out instead!"; exit 1)
cp -R ${install_dir} $out
'';
bazelTest = { name, bazelScript, workspaceDir, bazelPkg, buildInputs ? [] }:
let
be = extracted bazelPkg;
in runLocal name { inherit buildInputs; } (
# skip extraction caching on Darwin, because nobody knows how Darwin works
(lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
# set up home with pre-unpacked bazel
export HOME=$(mktemp -d)
mkdir -p ${be.install_dir}
cp -R ${be}/install ${be.install_dir}
# https://stackoverflow.com/questions/47775668/bazel-how-to-skip-corrupt-installation-on-centos6
# Bazel checks whether the mtime of the install dir files
# is >9 years in the future, otherwise it extracts itself again.
# see PosixFileMTime::IsUntampered in src/main/cpp/util
# What the hell bazel.
${lr}/bin/lr -0 -U ${be.install_dir} | ${xe}/bin/xe -N0 -0 touch --date="9 years 6 months" {}
'')
+
''
# Note https://github.com/bazelbuild/bazel/issues/5763#issuecomment-456374609
# about why to create a subdir for the workspace.
cp -r ${workspaceDir} wd && chmod u+w wd && cd wd
${bazelScript}
touch $out
'');
bazelWithNixHacks = bazel_self.override { enableNixHacks = true; };
bazel-examples = fetchFromGitHub {
owner = "bazelbuild";
repo = "examples";
rev = "5d8c8961a2516ebf875787df35e98cadd08d43dc";
sha256 = "03c1bwlq5bs3hg96v4g4pg2vqwhqq6w538h66rcpw02f83yy7fs8";
};
in (if !stdenv.hostPlatform.isDarwin then {
# `extracted` doesnt work on darwin
shebang = callPackage ../shebang-test.nix { inherit runLocal extracted bazelTest distDir; };
} else {}) // {
bashTools = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; };
cpp = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; };
java = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; };
protobuf = callPackage ../protobuf-test.nix { inherit runLocal bazelTest distDir; };
pythonBinPath = callPackage ../python-bin-path-test.nix { inherit runLocal bazelTest distDir; };
bashToolsWithNixHacks = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
cppWithNixHacks = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazelWithNixHacks; };
javaWithNixHacks = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazelWithNixHacks; };
protobufWithNixHacks = callPackage ../protobuf-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
pythonBinPathWithNixHacks = callPackage ../python-bin-path-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
# downstream packages using buildBazelPackage
# fixed-output hashes of the fetch phase need to be spot-checked manually
downstream = recurseIntoAttrs ({
inherit bazel-watcher;
});
};
# update the list of workspace dependencies
passthru.updater = writeScript "update-bazel-deps.sh" ''
#!${runtimeShell}
cat ${runCommand "bazel-deps.json" {} ''
${unzip}/bin/unzip ${src} WORKSPACE
${python3}/bin/python3 ${../update-srcDeps.py} ./WORKSPACE > $out
''} > ${builtins.toString ./src-deps.json}
'';
# Necessary for the tests to pass on Darwin with sandbox enabled.
# Bazel starts a local server and needs to bind a local address.
__darwinAllowLocalNetworking = true;
# Bazel expects several utils to be available in Bash even without PATH. Hence this hack.
customBash = writeCBin "bash" ''
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
extern char **environ;
int main(int argc, char *argv[]) {
char *path = getenv("PATH");
char *pathToAppend = "${defaultShellPath}";
char *newPath;
if (path != NULL) {
int length = strlen(path) + 1 + strlen(pathToAppend) + 1;
newPath = malloc(length * sizeof(char));
snprintf(newPath, length, "%s:%s", path, pathToAppend);
} else {
newPath = pathToAppend;
}
setenv("PATH", newPath, 1);
execve("${bash}/bin/bash", argv, environ);
return 0;
}
'';
postPatch = let
darwinPatches = ''
bazelLinkFlags () {
eval set -- "$NIX_LDFLAGS"
local flag
for flag in "$@"; do
printf ' -Wl,%s' "$flag"
done
}
# Disable Bazel's Xcode toolchain detection which would configure compilers
# and linkers from Xcode instead of from PATH
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
# Explicitly configure gcov since we don't have it on Darwin, so autodetection fails
export GCOV=${coreutils}/bin/false
# Framework search paths aren't added by bintools hook
# https://github.com/NixOS/nixpkgs/pull/41914
export NIX_LDFLAGS+=" -F${CoreFoundation}/Library/Frameworks -F${CoreServices}/Library/Frameworks -F${Foundation}/Library/Frameworks"
# libcxx includes aren't added by libcxx hook
# https://github.com/NixOS/nixpkgs/pull/41589
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${lib.getDev libcxx}/include/c++/v1"
# don't use system installed Xcode to run clang, use Nix clang instead
sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
scripts/bootstrap/compile.sh \
src/tools/xcode/realpath/BUILD \
src/tools/xcode/stdredirect/BUILD \
tools/osx/BUILD
substituteInPlace scripts/bootstrap/compile.sh --replace ' -mmacosx-version-min=10.9' ""
# nixpkgs's libSystem cannot use pthread headers directly, must import GCD headers instead
sed -i -e "/#include <pthread\/spawn.h>/i #include <dispatch/dispatch.h>" src/main/cpp/blaze_util_darwin.cc
# clang installed from Xcode has a compatibility wrapper that forwards
# invocations of gcc to clang, but vanilla clang doesn't
sed -i -e 's;_find_generic(repository_ctx, "gcc", "CC", overriden_tools);_find_generic(repository_ctx, "clang", "CC", overriden_tools);g' tools/cpp/unix_cc_configure.bzl
sed -i -e 's;/usr/bin/libtool;${cctools}/bin/libtool;g' tools/cpp/unix_cc_configure.bzl
wrappers=( tools/cpp/osx_cc_wrapper.sh tools/cpp/osx_cc_wrapper.sh.tpl )
for wrapper in "''${wrappers[@]}"; do
sed -i -e "s,/usr/bin/install_name_tool,${cctools}/bin/install_name_tool,g" $wrapper
done
'';
genericPatches = ''
# Substitute j2objc and objc wrapper's python shebang to plain python path.
# These scripts explicitly depend on Python 2.7, hence we use python27.
# See also `postFixup` where python27 is added to $out/nix-support
substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
# md5sum is part of coreutils
sed -i 's|/sbin/md5|md5sum|g' \
src/BUILD third_party/ijar/test/testenv.sh tools/objc/libtool.sh
# replace initial value of pythonShebang variable in BazelPythonSemantics.java
substituteInPlace src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java \
--replace '"#!/usr/bin/env " + pythonExecutableName' "\"#!${python3}/bin/python\""
# substituteInPlace is rather slow, so prefilter the files with grep
grep -rlZ /bin src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
# If you add more replacements here, you must change the grep above!
# Only files containing /bin are taken into account.
# We default to python3 where possible. See also `postFixup` where
# python3 is added to $out/nix-support
substituteInPlace "$path" \
--replace /bin/bash ${customBash}/bin/bash \
--replace "/usr/bin/env bash" ${customBash}/bin/bash \
--replace "/usr/bin/env python" ${python3}/bin/python \
--replace /usr/bin/env ${coreutils}/bin/env \
--replace /bin/true ${coreutils}/bin/true
done
# bazel test runner include references to /bin/bash
substituteInPlace tools/build_rules/test_rules.bzl \
--replace /bin/bash ${customBash}/bin/bash
for i in $(find tools/cpp/ -type f)
do
substituteInPlace $i \
--replace /bin/bash ${customBash}/bin/bash
done
# Fixup scripts that generate scripts. Not fixed up by patchShebangs below.
substituteInPlace scripts/bootstrap/compile.sh \
--replace /bin/bash ${customBash}/bin/bash
# add nix environment vars to .bazelrc
cat >> .bazelrc <<EOF
# Limit the resources Bazel is allowed to use during the build to 1/2 the
# available RAM and 3/4 the available CPU cores. This should help avoid
# overwhelming the build machine.
build --local_ram_resources=HOST_RAM*.5
build --local_cpu_resources=HOST_CPUS*.75
build --distdir=${distDir}
fetch --distdir=${distDir}
build --copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt="/g')"
build --host_copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt="/g')"
build --linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt="/g')"
build --host_linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt="/g')"
build --linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt="-Wl,/g')"
build --host_linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt="-Wl,/g')"
build --host_javabase='@local_jdk//:jdk'
build --host_java_toolchain='${javaToolchain}'
EOF
# add the same environment vars to compile.sh
sed -e "/\$command \\\\$/a --copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --host_copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --host_linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_javabase='@local_jdk//:jdk' \\\\" \
-e "/\$command \\\\$/a --host_java_toolchain='${javaToolchain}' \\\\" \
-i scripts/bootstrap/compile.sh
# This is necessary to avoid:
# "error: no visible @interface for 'NSDictionary' declares the selector
# 'initWithContentsOfURL:error:'"
# This can be removed when the apple_sdk is upgraded beyond 10.13+
sed -i '/initWithContentsOfURL:versionPlistUrl/ {
N
s/error:nil\];/\];/
}' tools/osx/xcode_locator.m
# append the PATH with defaultShellPath in tools/bash/runfiles/runfiles.bash
echo "PATH=\$PATH:${defaultShellPath}" >> runfiles.bash.tmp
cat tools/bash/runfiles/runfiles.bash >> runfiles.bash.tmp
mv runfiles.bash.tmp tools/bash/runfiles/runfiles.bash
patchShebangs .
'';
in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches
+ genericPatches;
buildInputs = [
buildJdk
python3
];
# when a command cant be found in a bazel build, you might also
# need to add it to `defaultShellPath`.
nativeBuildInputs = [
installShellFiles
zip
python3
unzip
makeWrapper
which
customBash
] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ];
# Bazel makes extensive use of symlinks in the WORKSPACE.
# This causes problems with infinite symlinks if the build output is in the same location as the
# Bazel WORKSPACE. This is why before executing the build, the source code is moved into a
# subdirectory.
# Failing to do this causes "infinite symlink expansion detected"
preBuildPhases = ["preBuildPhase"];
preBuildPhase = ''
mkdir bazel_src
shopt -s dotglob extglob
mv !(bazel_src) bazel_src
'';
buildPhase = ''
# Increasing memory during compilation might be necessary.
# export BAZEL_JAVAC_OPTS="-J-Xmx2g -J-Xms200m"
./bazel_src/compile.sh
./bazel_src/scripts/generate_bash_completion.sh \
--bazel=./bazel_src/output/bazel \
--output=./bazel_src/output/bazel-complete.bash \
--prepend=./bazel_src/scripts/bazel-complete-header.bash \
--prepend=./bazel_src/scripts/bazel-complete-template.bash
# need to change directory for bazel to find the workspace
cd ./bazel_src
# build execlog tooling
export HOME=$(mktemp -d)
./output/bazel build src/tools/execlog:parser_deploy.jar
cd -
'';
installPhase = ''
mkdir -p $out/bin
# official wrapper scripts that searches for $WORKSPACE_ROOT/tools/bazel
# if it cant find something in tools, it calls $out/bin/bazel-{version}-{os_arch}
# The binary _must_ exist with this naming if your project contains a .bazelversion
# file.
cp ./bazel_src/scripts/packages/bazel.sh $out/bin/bazel
mkdir $out/share
cp ./bazel_src/bazel-bin/src/tools/execlog/parser_deploy.jar $out/share/parser_deploy.jar
mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch}
cat <<EOF > $out/bin/bazel-execlog
#!${runtimeShell} -e
${runJdk}/bin/java -jar $out/share/parser_deploy.jar \$@
EOF
chmod +x $out/bin/bazel-execlog
# shell completion files
installShellCompletion --bash \
--name bazel.bash \
./bazel_src/output/bazel-complete.bash
installShellCompletion --zsh \
--name _bazel \
./bazel_src/scripts/zsh_completion/_bazel
installShellCompletion --fish \
--name bazel.fish \
./bazel_src/scripts/fish/completions/bazel.fish
'';
doInstallCheck = true;
installCheckPhase = ''
export TEST_TMPDIR=$(pwd)
hello_test () {
$out/bin/bazel test \
--test_output=errors \
--java_toolchain='${javaToolchain}' \
examples/cpp:hello-success_test \
examples/java-native/src/test/java/com/example/myproject:hello
}
cd ./bazel_src
# test whether $WORKSPACE_ROOT/tools/bazel works
mkdir -p tools
cat > tools/bazel <<"EOF"
#!${runtimeShell} -e
exit 1
EOF
chmod +x tools/bazel
# first call should fail if tools/bazel is used
! hello_test
cat > tools/bazel <<"EOF"
#!${runtimeShell} -e
exec "$BAZEL_REAL" "$@"
EOF
# second call succeeds because it defers to $out/bin/bazel-{version}-{os_arch}
hello_test
'';
# Save paths to hardcoded dependencies so Nix can detect them.
postFixup = ''
mkdir -p $out/nix-support
echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends
# The templates get tard up into a .jar,
# so nix cant detect python is needed in the runtime closure
# Some of the scripts explicitly depend on Python 2.7. Otherwise, we
# default to using python3. Therefore, both python27 and python3 are
# runtime dependencies.
echo "${python27}" >> $out/nix-support/depends
echo "${python3}" >> $out/nix-support/depends
# The string literal specifying the path to the bazel-rc file is sometimes
# stored non-contiguously in the binary due to gcc optimisations, which leads
# Nix to miss the hash when scanning for dependencies
echo "${bazelRC}" >> $out/nix-support/depends
'' + lib.optionalString stdenv.isDarwin ''
echo "${cctools}" >> $out/nix-support/depends
'';
dontStrip = true;
dontPatchELF = true;
}

View file

@ -0,0 +1,24 @@
diff --git a/third_party/ijar/mapped_file_unix.cc b/third_party/ijar/mapped_file_unix.cc
index 6e3a908..030e9ca 100644
--- a/third_party/ijar/mapped_file_unix.cc
+++ b/third_party/ijar/mapped_file_unix.cc
@@ -19,6 +19,7 @@
#include <sys/mman.h>
#include <algorithm>
+#include <limits>
#include "third_party/ijar/mapped_file.h"
diff --git a/third_party/ijar/zlib_client.h b/third_party/ijar/zlib_client.h
index ed66163..c4b051e 100644
--- a/third_party/ijar/zlib_client.h
+++ b/third_party/ijar/zlib_client.h
@@ -16,6 +16,7 @@
#define THIRD_PARTY_IJAR_ZLIB_CLIENT_H_
#include <limits.h>
+#include <limits>
#include "third_party/ijar/common.h"

View file

@ -0,0 +1,34 @@
--- a/tools/osx/xcode_locator.m 2020-12-10 13:27:29.000000000 +0100
+++ b/tools/osx/xcode_locator.m 2021-02-01 09:09:32.159557051 +0100
@@ -21,10 +21,6 @@
// 6,6.4,6.4.1 = 6.4.1
// 6.3,6.3.0 = 6.3
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
#import <CoreServices/CoreServices.h>
#import <Foundation/Foundation.h>
--- a/tools/osx/xcode_configure.bzl 1980-01-01 01:00:00.000000000 +0100
+++ b/tools/osx/xcode_configure.bzl 2021-02-01 09:36:57.773418444 +0100
@@ -123,7 +123,6 @@
"macosx",
"clang",
"-mmacosx-version-min=10.9",
- "-fobjc-arc",
"-framework",
"CoreServices",
"-framework",
--- a/tools/osx/BUILD 2021-02-01 11:01:02.191659553 +0100
+++ b/tools/osx/BUILD 2021-02-01 11:04:29.735071019 +0100
@@ -27,7 +27,7 @@
])
DARWIN_XCODE_LOCATOR_COMPILE_COMMAND = """
- /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices \
+ /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -framework CoreServices \
-framework Foundation -o $@ $<
"""

View file

@ -0,0 +1,861 @@
{
"1.25.0.zip": {
"name": "1.25.0.zip",
"sha256": "c78be58f5e0a29a04686b628cf54faaee0094322ae0ac99da5a8a8afca59a647",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.25.0.zip",
"https://github.com/bazelbuild/rules_sass/archive/1.25.0.zip"
]
},
"1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz": {
"name": "1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
"sha256": "5a725b777976b77aa122b707d1b6f0f39b6020f66cd427bb111a585599c857b1",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
"https://github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz"
]
},
"2d4c9528e0f453b5950eeaeac11d8d09f5a504d4.tar.gz": {
"name": "2d4c9528e0f453b5950eeaeac11d8d09f5a504d4.tar.gz",
"sha256": "c00ceec469dbcf7929972e3c79f20c14033824538038a554952f5c31d8832f96",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/archive/2d4c9528e0f453b5950eeaeac11d8d09f5a504d4.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/archive/2d4c9528e0f453b5950eeaeac11d8d09f5a504d4.tar.gz"
]
},
"46993efdd33b73649796c5fc5c9efb193ae19d51.zip": {
"name": "46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
"sha256": "66184688debeeefcc2a16a2f80b03f514deac8346fe888fb7e691a52c023dd88",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
"https://github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip"
]
},
"7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip": {
"name": "7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
"sha256": "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
"https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip"
]
},
"97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz": {
"name": "97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
"sha256": "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz"
]
},
"9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz": {
"name": "9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"sha256": "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454",
"urls": [
"https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz"
]
},
"android_tools_for_testing": {
"name": "android_tools_for_testing",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "ea5c0589a01e2a9f43c20e5c145d3530e3b3bdbe7322789bc5da38d0ca49b837",
"url": "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.19.0rc3.tar.gz"
},
"android_tools_pkg-0.19.0rc3.tar.gz": {
"name": "android_tools_pkg-0.19.0rc3.tar.gz",
"sha256": "ea5c0589a01e2a9f43c20e5c145d3530e3b3bdbe7322789bc5da38d0ca49b837",
"urls": [
"https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.19.0rc3.tar.gz"
]
},
"b1c40e1de81913a3c40e5948f78719c28152486d.zip": {
"name": "b1c40e1de81913a3c40e5948f78719c28152486d.zip",
"sha256": "d0c573b94a6ef20ef6ff20154a23d0efcb409fb0e1ff0979cec318dfe42f0cdd",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
"https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip"
]
},
"bazel-toolchains-3.1.0.tar.gz": {
"name": "bazel-toolchains-3.1.0.tar.gz",
"sha256": "726b5423e1c7a3866a3a6d68e7123b4a955e9fcbe912a51e0f737e6dab1d0af2",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/3.1.0/bazel-toolchains-3.1.0.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/releases/download/3.1.0/bazel-toolchains-3.1.0.tar.gz"
]
},
"bazel_j2objc": {
"name": "bazel_j2objc",
"sha256": "8d3403b5b7db57e347c943d214577f6879e5b175c2b59b7e075c0b6453330e9b",
"strip_prefix": "j2objc-2.5",
"urls": [
"https://mirror.bazel.build/github.com/google/j2objc/releases/download/2.5/j2objc-2.5.zip",
"https://github.com/google/j2objc/releases/download/2.5/j2objc-2.5.zip"
]
},
"bazel_skylib": {
"name": "bazel_skylib",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "c00ceec469dbcf7929972e3c79f20c14033824538038a554952f5c31d8832f96",
"strip_prefix": "bazel-skylib-2d4c9528e0f453b5950eeaeac11d8d09f5a504d4",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/archive/2d4c9528e0f453b5950eeaeac11d8d09f5a504d4.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/archive/2d4c9528e0f453b5950eeaeac11d8d09f5a504d4.tar.gz"
]
},
"bazel_toolchains": {
"name": "bazel_toolchains",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "726b5423e1c7a3866a3a6d68e7123b4a955e9fcbe912a51e0f737e6dab1d0af2",
"strip_prefix": "bazel-toolchains-3.1.0",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/3.1.0/bazel-toolchains-3.1.0.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/releases/download/3.1.0/bazel-toolchains-3.1.0.tar.gz"
]
},
"bazel_website": {
"build_file_content": "\nexports_files([\"_sass/style.scss\"])\n",
"name": "bazel_website",
"sha256": "a5f531dd1d62e6947dcfc279656ffc2fdf6f447c163914c5eabf7961b4cb6eb4",
"strip_prefix": "bazel-website-c174fa288aa079b68416d2ce2cc97268fa172f42",
"urls": [
"https://github.com/bazelbuild/bazel-website/archive/c174fa288aa079b68416d2ce2cc97268fa172f42.tar.gz"
]
},
"build_bazel_rules_nodejs": {
"name": "build_bazel_rules_nodejs",
"sha256": "b6670f9f43faa66e3009488bbd909bc7bc46a5a9661a33f6bc578068d1837f37",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_nodejs/releases/download/1.3.0/rules_nodejs-1.3.0.tar.gz",
"https://github.com/bazelbuild/rules_nodejs/releases/download/1.3.0/rules_nodejs-1.3.0.tar.gz"
]
},
"com_github_grpc_grpc": {
"name": "com_github_grpc_grpc",
"patch_args": [
"-p1"
],
"patches": [
"//third_party/grpc:grpc_1.26.0.patch"
],
"sha256": "2fcb7f1ab160d6fd3aaade64520be3e5446fc4c6fa7ba6581afdc4e26094bd81",
"strip_prefix": "grpc-1.26.0",
"urls": [
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.26.0.tar.gz",
"https://github.com/grpc/grpc/archive/v1.26.0.tar.gz"
]
},
"com_google_googletest": {
"name": "com_google_googletest",
"sha256": "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb",
"strip_prefix": "googletest-release-1.10.0",
"urls": [
"https://mirror.bazel.build/github.com/google/googletest/archive/release-1.10.0.tar.gz",
"https://github.com/google/googletest/archive/release-1.10.0.tar.gz"
]
},
"com_google_protobuf": {
"name": "com_google_protobuf",
"patch_args": [
"-p1"
],
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"patches": [
"//third_party/protobuf:3.13.0.patch"
],
"sha256": "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a",
"strip_prefix": "protobuf-3.13.0",
"urls": [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz"
]
},
"coverage_output_generator-v2.5.zip": {
"name": "coverage_output_generator-v2.5.zip",
"sha256": "cd14f1cb4559e4723e63b7e7b06d09fcc3bd7ba58d03f354cdff1439bd936a7d",
"urls": [
"https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.5.zip"
]
},
"desugar_jdk_libs": {
"name": "desugar_jdk_libs",
"sha256": "fe2e04f91ce8c59d49d91b8102edc6627c6fa2906c1b0e7346f01419ec4f419d",
"strip_prefix": "desugar_jdk_libs-e0b0291b2c51fbe5a7cfa14473a1ae850f94f021",
"urls": [
"https://mirror.bazel.build/github.com/google/desugar_jdk_libs/archive/e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip",
"https://github.com/google/desugar_jdk_libs/archive/e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip"
]
},
"e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip": {
"name": "e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip",
"sha256": "fe2e04f91ce8c59d49d91b8102edc6627c6fa2906c1b0e7346f01419ec4f419d",
"urls": [
"https://mirror.bazel.build/github.com/google/desugar_jdk_libs/archive/e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip",
"https://github.com/google/desugar_jdk_libs/archive/e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip"
]
},
"e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz": {
"name": "e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
"sha256": "e8c2751ddc70fed9dc6f999acd92e232d5846f009ee1674f8aee81f19b2b915a",
"urls": [
"https://mirror.bazel.build/github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
"https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz"
]
},
"io_bazel_rules_sass": {
"name": "io_bazel_rules_sass",
"sha256": "c78be58f5e0a29a04686b628cf54faaee0094322ae0ac99da5a8a8afca59a647",
"strip_prefix": "rules_sass-1.25.0",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.25.0.zip",
"https://github.com/bazelbuild/rules_sass/archive/1.25.0.zip"
]
},
"io_bazel_skydoc": {
"name": "io_bazel_skydoc",
"sha256": "5a725b777976b77aa122b707d1b6f0f39b6020f66cd427bb111a585599c857b1",
"strip_prefix": "stardoc-1ef781ced3b1443dca3ed05dec1989eca1a4e1cd",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz",
"https://github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz"
]
},
"java_tools_javac11_darwin-v10.0.zip": {
"name": "java_tools_javac11_darwin-v10.0.zip",
"sha256": "64e5de2175dfccb96831573946b80d106edf3801d9db38b564514bf3581d466b",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_darwin-v10.0.zip"
]
},
"java_tools_javac11_linux-v10.0.zip": {
"name": "java_tools_javac11_linux-v10.0.zip",
"sha256": "69e65353c2cd65780abcbcce4daae973599298273b0f8b4d469eed822cb220d1",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_linux-v10.0.zip"
]
},
"java_tools_javac11_windows-v10.0.zip": {
"name": "java_tools_javac11_windows-v10.0.zip",
"sha256": "d2f62af8daa0a3d55789b605f6582e37038329c64843337c71e64515468e55c4",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_windows-v10.0.zip"
]
},
"java_tools_langtools_javac11": {
"name": "java_tools_langtools_javac11",
"sha256": "cf0814fa002ef3d794582bb086516d8c9ed0958f83f19799cdb08949019fe4c7",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/jdk_langtools/langtools_jdk11_v2.zip"
]
},
"openjdk11_darwin_archive": {
"build_file_content": "\njava_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])\nexports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])\n",
"name": "openjdk11_darwin_archive",
"sha256": "e1fe56769f32e2aaac95e0a8f86b5a323da5af3a3b4bba73f3086391a6cc056f",
"strip_prefix": "zulu11.37.17-ca-jdk11.0.6-macosx_x64",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz"
]
},
"openjdk11_linux_archive": {
"build_file_content": "\njava_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])\nexports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])\n",
"name": "openjdk11_linux_archive",
"sha256": "360626cc19063bc411bfed2914301b908a8f77a7919aaea007a977fa8fb3cde1",
"strip_prefix": "zulu11.37.17-ca-jdk11.0.6-linux_x64",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz"
]
},
"openjdk11_windows_archive": {
"build_file_content": "\njava_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])\nexports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])\n",
"name": "openjdk11_windows_archive",
"sha256": "a9695617b8374bfa171f166951214965b1d1d08f43218db9a2a780b71c665c18",
"strip_prefix": "zulu11.37.17-ca-jdk11.0.6-win_x64",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip"
]
},
"openjdk14_darwin_archive": {
"build_file_content": "\njava_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])\nexports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])\n",
"name": "openjdk14_darwin_archive",
"sha256": "088bd4d0890acc9f032b738283bf0f26b2a55c50b02d1c8a12c451d8ddf080dd",
"strip_prefix": "zulu14.28.21-ca-jdk14.0.1-macosx_x64",
"urls": [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-macosx_x64.tar.gz"
]
},
"openjdk14_linux_archive": {
"build_file_content": "\njava_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])\nexports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])\n",
"name": "openjdk14_linux_archive",
"sha256": "48bb8947034cd079ad1ef83335e7634db4b12a26743a0dc314b6b861480777aa",
"strip_prefix": "zulu14.28.21-ca-jdk14.0.1-linux_x64",
"urls": [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz"
]
},
"openjdk14_windows_archive": {
"build_file_content": "\njava_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])\nexports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])\n",
"name": "openjdk14_windows_archive",
"sha256": "9cb078b5026a900d61239c866161f0d9558ec759aa15c5b4c7e905370e868284",
"strip_prefix": "zulu14.28.21-ca-jdk14.0.1-win_x64",
"urls": [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-win_x64.zip"
]
},
"openjdk_linux": {
"downloaded_file_path": "zulu-linux.tar.gz",
"name": "openjdk_linux",
"sha256": "65bfe4e0ffa74a680ee4410db46b17e30cd9397b664a92a886599fe1f3530969",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64-linux_x64-allmodules-b23d4e05466f2aa1fdcd72d3d3a8e962206b64bf-1581689070.tar.gz"
]
},
"openjdk_linux_aarch64": {
"downloaded_file_path": "zulu-linux-aarch64.tar.gz",
"name": "openjdk_linux_aarch64",
"sha256": "6b245793087300db3ee82ab0d165614f193a73a60f2f011e347756c1e6ca5bac",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.48-ca-jdk11.0.6/zulu11.37.48-ca-jdk11.0.6-linux_aarch64-allmodules-b23d4e05466f2aa1fdcd72d3d3a8e962206b64bf-1581690750.tar.gz"
]
},
"openjdk_linux_aarch64_minimal": {
"downloaded_file_path": "zulu-linux-aarch64-minimal.tar.gz",
"name": "openjdk_linux_aarch64_minimal",
"sha256": "06f6520a877704c77614bcfc4f846cc7cbcbf5eaad149bf7f19f4f16e285c9de",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.48-ca-jdk11.0.6/zulu11.37.48-ca-jdk11.0.6-linux_aarch64-minimal-b23d4e05466f2aa1fdcd72d3d3a8e962206b64bf-1581690750.tar.gz"
]
},
"openjdk_linux_aarch64_vanilla": {
"downloaded_file_path": "zulu-linux-aarch64-vanilla.tar.gz",
"name": "openjdk_linux_aarch64_vanilla",
"sha256": "a452f1b9682d9f83c1c14e54d1446e1c51b5173a3a05dcb013d380f9508562e4",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.48-ca-jdk11.0.6/zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz"
]
},
"openjdk_linux_minimal": {
"downloaded_file_path": "zulu-linux-minimal.tar.gz",
"name": "openjdk_linux_minimal",
"sha256": "91f7d52f695c681d4e21499b4319d548aadef249a6b3053e306308992e1e29ae",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64-minimal-b23d4e05466f2aa1fdcd72d3d3a8e962206b64bf-1581689068.tar.gz"
]
},
"openjdk_linux_ppc64le_vanilla": {
"downloaded_file_path": "adoptopenjdk-ppc64le-vanilla.tar.gz",
"name": "openjdk_linux_ppc64le_vanilla",
"sha256": "a417db0295b1f4b538ecbaf7c774f3a177fab9657a665940170936c0eca4e71a",
"urls": [
"https://mirror.bazel.build/openjdk/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.7_10.tar.gz",
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.7_10.tar.gz"
]
},
"openjdk_linux_s390x_vanilla": {
"downloaded_file_path": "adoptopenjdk-s390x-vanilla.tar.gz",
"name": "openjdk_linux_s390x_vanilla",
"sha256": "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
"urls": [
"https://mirror.bazel.build/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz"
]
},
"openjdk_linux_vanilla": {
"downloaded_file_path": "zulu-linux-vanilla.tar.gz",
"name": "openjdk_linux_vanilla",
"sha256": "360626cc19063bc411bfed2914301b908a8f77a7919aaea007a977fa8fb3cde1",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz"
]
},
"openjdk_macos": {
"downloaded_file_path": "zulu-macos.tar.gz",
"name": "openjdk_macos",
"sha256": "8e283cfd23c7555be8e17295ed76eb8f00324c88ab904b8de37bbe08f90e569b",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-macosx_x64-allmodules-b23d4e05466f2aa1fdcd72d3d3a8e962206b64bf-1581689066.tar.gz"
]
},
"openjdk_macos_minimal": {
"downloaded_file_path": "zulu-macos-minimal.tar.gz",
"name": "openjdk_macos_minimal",
"sha256": "1bacb1c07035d4066d79f0b65b4ea0ebd1954f3662bdfe3618da382ac8fd23a6",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-macosx_x64-minimal-b23d4e05466f2aa1fdcd72d3d3a8e962206b64bf-1581689063.tar.gz"
]
},
"openjdk_macos_vanilla": {
"downloaded_file_path": "zulu-macos-vanilla.tar.gz",
"name": "openjdk_macos_vanilla",
"sha256": "e1fe56769f32e2aaac95e0a8f86b5a323da5af3a3b4bba73f3086391a6cc056f",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz"
]
},
"openjdk_win": {
"downloaded_file_path": "zulu-win.zip",
"name": "openjdk_win",
"sha256": "8e1604b3a27dcf639bc6d1a73103f1211848139e4cceb081d0a74a99e1e6f995",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64-allmodules-b23d4e05466f2aa1fdcd72d3d3a8e962206b64bf-1581689080.zip"
]
},
"openjdk_win_minimal": {
"downloaded_file_path": "zulu-win-minimal.zip",
"name": "openjdk_win_minimal",
"sha256": "b90a713c9c2d9ea23cad44d2c2dfcc9af22faba9bde55dedc1c3bb9f556ac1ae",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64-minimal-b23d4e05466f2aa1fdcd72d3d3a8e962206b64bf-1581689080.zip"
]
},
"openjdk_win_vanilla": {
"downloaded_file_path": "zulu-win-vanilla.zip",
"name": "openjdk_win_vanilla",
"sha256": "a9695617b8374bfa171f166951214965b1d1d08f43218db9a2a780b71c665c18",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip"
]
},
"platforms": {
"name": "platforms",
"sha256": "66184688debeeefcc2a16a2f80b03f514deac8346fe888fb7e691a52c023dd88",
"strip_prefix": "platforms-46993efdd33b73649796c5fc5c9efb193ae19d51",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip",
"https://github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.zip"
]
},
"remote_coverage_tools_for_testing": {
"name": "remote_coverage_tools_for_testing",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "cd14f1cb4559e4723e63b7e7b06d09fcc3bd7ba58d03f354cdff1439bd936a7d",
"urls": [
"https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.5.zip"
]
},
"remote_java_tools_darwin_for_testing": {
"name": "remote_java_tools_darwin_for_testing",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "64e5de2175dfccb96831573946b80d106edf3801d9db38b564514bf3581d466b",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_darwin-v10.0.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.0/java_tools_javac11_darwin-v10.0.zip"
]
},
"remote_java_tools_javac11_test_darwin": {
"name": "remote_java_tools_javac11_test_darwin",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "64e5de2175dfccb96831573946b80d106edf3801d9db38b564514bf3581d466b",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_darwin-v10.0.zip"
]
},
"remote_java_tools_javac11_test_linux": {
"name": "remote_java_tools_javac11_test_linux",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "69e65353c2cd65780abcbcce4daae973599298273b0f8b4d469eed822cb220d1",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_linux-v10.0.zip"
]
},
"remote_java_tools_javac11_test_windows": {
"name": "remote_java_tools_javac11_test_windows",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "d2f62af8daa0a3d55789b605f6582e37038329c64843337c71e64515468e55c4",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_windows-v10.0.zip"
]
},
"remote_java_tools_linux_for_testing": {
"name": "remote_java_tools_linux_for_testing",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "69e65353c2cd65780abcbcce4daae973599298273b0f8b4d469eed822cb220d1",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_linux-v10.0.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.0/java_tools_javac11_linux-v10.0.zip"
]
},
"remote_java_tools_windows_for_testing": {
"name": "remote_java_tools_windows_for_testing",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "d2f62af8daa0a3d55789b605f6582e37038329c64843337c71e64515468e55c4",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_windows-v10.0.zip",
"https://github.com/bazelbuild/java_tools/releases/download/javac11_v10.0/java_tools_javac11_windows-v10.0.zip"
]
},
"remotejdk11_linux_aarch64_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk11_linux_aarch64_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "a452f1b9682d9f83c1c14e54d1446e1c51b5173a3a05dcb013d380f9508562e4",
"strip_prefix": "zulu11.37.48-ca-jdk11.0.6-linux_aarch64",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.48-ca-jdk11.0.6/zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz"
]
},
"remotejdk11_linux_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk11_linux_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "360626cc19063bc411bfed2914301b908a8f77a7919aaea007a977fa8fb3cde1",
"strip_prefix": "zulu11.37.17-ca-jdk11.0.6-linux_x64",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz"
]
},
"remotejdk11_linux_ppc64le_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk11_linux_ppc64le_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "a417db0295b1f4b538ecbaf7c774f3a177fab9657a665940170936c0eca4e71a",
"strip_prefix": "jdk-11.0.7+10",
"urls": [
"https://mirror.bazel.build/openjdk/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.7_10.tar.gz",
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.7_10.tar.gz"
]
},
"remotejdk11_linux_s390x_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk11_linux_s390x_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "d9b72e87a1d3ebc0c9552f72ae5eb150fffc0298a7cb841f1ce7bfc70dcd1059",
"strip_prefix": "jdk-11.0.7+10",
"urls": [
"https://mirror.bazel.build/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz",
"https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.7_10.tar.gz"
]
},
"remotejdk11_macos_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk11_macos_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "e1fe56769f32e2aaac95e0a8f86b5a323da5af3a3b4bba73f3086391a6cc056f",
"strip_prefix": "zulu11.37.17-ca-jdk11.0.6-macosx_x64",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz"
]
},
"remotejdk11_win_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk11_win_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "a9695617b8374bfa171f166951214965b1d1d08f43218db9a2a780b71c665c18",
"strip_prefix": "zulu11.37.17-ca-jdk11.0.6-win_x64",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip"
]
},
"remotejdk14_linux_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk14_linux_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "48bb8947034cd079ad1ef83335e7634db4b12a26743a0dc314b6b861480777aa",
"strip_prefix": "zulu14.28.21-ca-jdk14.0.1-linux_x64",
"urls": [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz"
]
},
"remotejdk14_macos_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk14_macos_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "088bd4d0890acc9f032b738283bf0f26b2a55c50b02d1c8a12c451d8ddf080dd",
"strip_prefix": "zulu14.28.21-ca-jdk14.0.1-macosx_x64",
"urls": [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-macosx_x64.tar.gz"
]
},
"remotejdk14_win_for_testing": {
"build_file": "@local_jdk//:BUILD.bazel",
"name": "remotejdk14_win_for_testing",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "9cb078b5026a900d61239c866161f0d9558ec759aa15c5b4c7e905370e868284",
"strip_prefix": "zulu14.28.21-ca-jdk14.0.1-win_x64",
"urls": [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-win_x64.zip"
]
},
"rules_cc": {
"name": "rules_cc",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "d0c573b94a6ef20ef6ff20154a23d0efcb409fb0e1ff0979cec318dfe42f0cdd",
"strip_prefix": "rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
"https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip"
]
},
"rules_java": {
"name": "rules_java",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
"strip_prefix": "rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
"https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip"
]
},
"rules_nodejs-1.3.0.tar.gz": {
"name": "rules_nodejs-1.3.0.tar.gz",
"sha256": "b6670f9f43faa66e3009488bbd909bc7bc46a5a9661a33f6bc578068d1837f37",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_nodejs/releases/download/1.3.0/rules_nodejs-1.3.0.tar.gz",
"https://github.com/bazelbuild/rules_nodejs/releases/download/1.3.0/rules_nodejs-1.3.0.tar.gz"
]
},
"rules_pkg": {
"name": "rules_pkg",
"patch_cmds": [
"test -f BUILD && chmod u+w BUILD || true",
"echo >> BUILD",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD"
],
"patch_cmds_win": [
"Add-Content -Path BUILD -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz"
]
},
"rules_pkg-0.2.4.tar.gz": {
"name": "rules_pkg-0.2.4.tar.gz",
"sha256": "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz"
]
},
"rules_proto": {
"name": "rules_proto",
"patch_cmds": [
"test -f BUILD.bazel && chmod u+w BUILD.bazel || true",
"echo >> BUILD.bazel",
"echo 'exports_files([\"WORKSPACE\"], visibility = [\"//visibility:public\"])' >> BUILD.bazel"
],
"patch_cmds_win": [
"Add-Content -Path BUILD.bazel -Value \"`nexports_files([`\"WORKSPACE`\"], visibility = [`\"//visibility:public`\"])`n\" -Force"
],
"sha256": "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
"strip_prefix": "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
"urls": [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz"
]
},
"upb": {
"name": "upb",
"patch_args": [
"-p1"
],
"patches": [
"//third_party/grpc:upb_gcc10_fix.patch"
],
"sha256": "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454",
"strip_prefix": "upb-9effcbcb27f0a665f9f345030188c0b291e32482",
"urls": [
"https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz"
]
},
"v1.26.0.tar.gz": {
"name": "v1.26.0.tar.gz",
"sha256": "2fcb7f1ab160d6fd3aaade64520be3e5446fc4c6fa7ba6581afdc4e26094bd81",
"urls": [
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.26.0.tar.gz",
"https://github.com/grpc/grpc/archive/v1.26.0.tar.gz"
]
},
"v3.13.0.tar.gz": {
"name": "v3.13.0.tar.gz",
"sha256": "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a",
"urls": [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz"
]
},
"zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz": {
"name": "zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz",
"sha256": "360626cc19063bc411bfed2914301b908a8f77a7919aaea007a977fa8fb3cde1",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-linux_x64.tar.gz"
]
},
"zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz": {
"name": "zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz",
"sha256": "e1fe56769f32e2aaac95e0a8f86b5a323da5af3a3b4bba73f3086391a6cc056f",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-macosx_x64.tar.gz"
]
},
"zulu11.37.17-ca-jdk11.0.6-win_x64.zip": {
"name": "zulu11.37.17-ca-jdk11.0.6-win_x64.zip",
"sha256": "a9695617b8374bfa171f166951214965b1d1d08f43218db9a2a780b71c665c18",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.17-ca-jdk11.0.6/zulu11.37.17-ca-jdk11.0.6-win_x64.zip"
]
},
"zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz": {
"name": "zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz",
"sha256": "a452f1b9682d9f83c1c14e54d1446e1c51b5173a3a05dcb013d380f9508562e4",
"urls": [
"https://mirror.bazel.build/openjdk/azul-zulu11.37.48-ca-jdk11.0.6/zulu11.37.48-ca-jdk11.0.6-linux_aarch64.tar.gz"
]
}
}

View file

@ -0,0 +1,41 @@
diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
index 6fff2af..7e2877e 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
@@ -47,6 +47,16 @@ public final class PosixLocalEnvProvider implements LocalEnvProvider {
Map<String, String> env, BinTools binTools, String fallbackTmpDir) {
ImmutableMap.Builder<String, String> result = ImmutableMap.builder();
result.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
+
+ // In case we are running on NixOS.
+ // If bash is called with an unset PATH on this platform,
+ // it will set it to /no-such-path and default tools will be missings.
+ // See, https://github.com/NixOS/nixpkgs/issues/94222
+ // So we ensure that minimal dependencies are present.
+ if (!env.containsKey("PATH")){
+ result.put("PATH", "@actionsPathPatch@");
+ }
+
String p = clientEnv.get("TMPDIR");
if (Strings.isNullOrEmpty(p)) {
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR
index 95642767c6..39d3c62461 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
@@ -74,6 +74,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider {
ImmutableMap.Builder<String, String> newEnvBuilder = ImmutableMap.builder();
newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
+
+ // In case we are running on NixOS.
+ // If bash is called with an unset PATH on this platform,
+ // it will set it to /no-such-path and default tools will be missings.
+ // See, https://github.com/NixOS/nixpkgs/issues/94222
+ // So we ensure that minimal dependencies are present.
+ if (!env.containsKey("PATH")){
+ newEnvBuilder.put("PATH", "@actionsPathPatch@");
+ }
+
String p = clientEnv.get("TMPDIR");
if (Strings.isNullOrEmpty(p)) {
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR

View file

@ -0,0 +1,670 @@
{ stdenv, callPackage, lib, fetchurl, fetchpatch, fetchFromGitHub, installShellFiles
, runCommand, runCommandCC, makeWrapper, recurseIntoAttrs
# this package (through the fixpoint glass)
, bazel_self
# needed only for the updater
, bazel_3
, lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, gawk, gnused, gnutar, gnugrep, gzip, findutils
# updater
, python27, python3, writeScript
# Apple dependencies
, cctools, libcxx, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
, buildJdk, runJdk
, buildJdkName
, runtimeShell
# Downstream packages for tests
, bazel-watcher
# Always assume all markers valid (this is needed because we remove markers; they are non-deterministic).
# Also, don't clean up environment variables (so that NIX_ environment variables are passed to compilers).
, enableNixHacks ? false
, gcc-unwrapped
, autoPatchelfHook
, file
, substituteAll
, writeTextFile
}:
let
version = "4.2.2";
sourceRoot = ".";
src = fetchurl {
url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip";
sha256 = "mYHQ1To1bE6HlihHdQqXyegFTkYIVHSABsgPDX4rLTM=";
};
# Update with `eval $(nix-build -A bazel.updater)`,
# then add new dependencies from the dict in ./src-deps.json as required.
srcDeps = lib.attrsets.attrValues srcDepsSet;
srcDepsSet =
let
srcs = lib.importJSON ./src-deps.json;
toFetchurl = d: lib.attrsets.nameValuePair d.name (fetchurl {
urls = d.urls;
sha256 = d.sha256;
});
in builtins.listToAttrs (map toFetchurl [
srcs.desugar_jdk_libs
srcs.io_bazel_skydoc
srcs.bazel_skylib
srcs.io_bazel_rules_sass
srcs.platforms
(if stdenv.hostPlatform.isDarwin
then srcs."java_tools_javac11_darwin-v10.6.zip"
else srcs."java_tools_javac11_linux-v10.6.zip")
srcs."coverage_output_generator-v2.5.zip"
srcs.build_bazel_rules_nodejs
srcs."android_tools_pkg-0.23.0.tar.gz"
srcs.bazel_toolchains
srcs.com_github_grpc_grpc
srcs.upb
srcs.com_google_protobuf
srcs.rules_pkg
srcs.rules_cc
srcs.rules_java
srcs.rules_proto
srcs.com_google_absl
srcs.com_github_google_re2
srcs.com_github_cares_cares
]);
distDir = runCommand "bazel-deps" {} ''
mkdir -p $out
for i in ${builtins.toString srcDeps}; do cp $i $out/$(stripHash $i); done
'';
defaultShellUtils =
# Keep this list conservative. For more exotic tools, prefer to use
# @rules_nixpkgs to pull in tools from the nix repository. Example:
#
# WORKSPACE:
#
# nixpkgs_git_repository(
# name = "nixpkgs",
# revision = "def5124ec8367efdba95a99523dd06d918cb0ae8",
# )
#
# # This defines an external Bazel workspace.
# nixpkgs_package(
# name = "bison",
# repositories = { "nixpkgs": "@nixpkgs//:default.nix" },
# )
#
# some/BUILD.bazel:
#
# genrule(
# ...
# cmd = "$(location @bison//:bin/bison) -other -args",
# tools = [
# ...
# "@bison//:bin/bison",
# ],
# )
#
# Some of the scripts explicitly depend on Python 2.7. Otherwise, we
# default to using python3. Therefore, both python27 and python3 are
# runtime dependencies.
[
bash
coreutils
file
findutils
gawk
gnugrep
gnused
gnutar
gzip
python27
python3
unzip
which
zip
];
defaultShellPath = lib.makeBinPath defaultShellUtils;
# Java toolchain used for the build and tests
javaToolchain = "@bazel_tools//tools/jdk:toolchain_${buildJdkName}";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
# This repository is fetched by bazel at runtime
# however it contains prebuilt java binaries, with wrong interpreter
# and libraries path.
# We prefetch it, patch it, and override it in a global bazelrc.
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
arch = stdenv.hostPlatform.parsed.cpu.name;
remote_java_tools = stdenv.mkDerivation {
name = "remote_java_tools_${system}";
src = srcDepsSet."java_tools_javac11_${system}-v10.6.zip";
nativeBuildInputs = [ unzip ]
++ lib.optional stdenv.isLinux autoPatchelfHook;
buildInputs = [ gcc-unwrapped ];
sourceRoot = ".";
buildPhase = ''
runHook preBuild
mkdir $out;
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -Ra * $out/
touch $out/WORKSPACE
runHook postInstall
'';
};
bazelRC = writeTextFile {
name = "bazel-rc";
text = ''
startup --server_javabase=${runJdk}
# Can't use 'common'; https://github.com/bazelbuild/bazel/issues/3054
# Most commands inherit from 'build' anyway.
build --distdir=${distDir}
fetch --distdir=${distDir}
query --distdir=${distDir}
build --override_repository=${remote_java_tools.name}=${remote_java_tools}
fetch --override_repository=${remote_java_tools.name}=${remote_java_tools}
query --override_repository=${remote_java_tools.name}=${remote_java_tools}
# Provide a default java toolchain, this will be the same as ${runJdk}
build --host_javabase='@local_jdk//:jdk'
# load default location for the system wide configuration
try-import /etc/bazel.bazelrc
'';
};
in
stdenv.mkDerivation rec {
pname = "bazel";
inherit version;
meta = with lib; {
homepage = "https://github.com/bazelbuild/bazel/";
description = "Build tool that builds code quickly and reliably";
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # source bundles dependencies as jars
];
license = licenses.asl20;
maintainers = lib.teams.bazel.members;
inherit platforms;
};
inherit src;
inherit sourceRoot;
patches = [
# On Darwin, the last argument to gcc is coming up as an empty string. i.e: ''
# This is breaking the build of any C target. This patch removes the last
# argument if it's found to be an empty string.
../trim-last-argument-to-gcc-if-empty.patch
# On Darwin, using clang 6 to build fails because of a linker error (see #105573),
# but using clang 7 fails because libarclite_macosx.a cannot be found when linking
# the xcode_locator tool.
# This patch removes using the -fobjc-arc compiler option and makes the code
# compile without automatic reference counting. Caveat: this leaks memory, but
# we accept this fact because xcode_locator is only a short-lived process used during the build.
./no-arc.patch
# --experimental_strict_action_env (which may one day become the default
# see bazelbuild/bazel#2574) hardcodes the default
# action environment to a non hermetic value (e.g. "/usr/local/bin").
# This is non hermetic on non-nixos systems. On NixOS, bazel cannot find the required binaries.
# So we are replacing this bazel paths by defaultShellPath,
# improving hermeticity and making it work in nixos.
(substituteAll {
src = ../strict_action_env.patch;
strictActionEnvPatch = defaultShellPath;
})
(substituteAll {
src = ./actions_path.patch;
actionsPathPatch = defaultShellPath;
})
# bazel reads its system bazelrc in /etc
# override this path to a builtin one
(substituteAll {
src = ../bazel_rc.patch;
bazelSystemBazelRCPath = bazelRC;
})
] ++ lib.optional enableNixHacks ../nix-hacks.patch;
# Additional tests that check bazels functionality. Execute
#
# nix-build . -A bazel.tests
#
# in the nixpkgs checkout root to exercise them locally.
passthru.tests =
let
runLocal = name: attrs: script:
let
attrs' = removeAttrs attrs [ "buildInputs" ];
buildInputs = [ python3 which ] ++ (attrs.buildInputs or []);
in
runCommandCC name ({
inherit buildInputs;
preferLocalBuild = true;
meta.platforms = platforms;
} // attrs') script;
# bazel wants to extract itself into $install_dir/install every time it runs,
# so lets do that only once.
extracted = bazelPkg:
let install_dir =
# `install_base` field printed by `bazel info`, minus the hash.
# yes, this path is kinda magic. Sorry.
"$HOME/.cache/bazel/_bazel_nixbld";
in runLocal "bazel-extracted-homedir" { passthru.install_dir = install_dir; } ''
export HOME=$(mktemp -d)
touch WORKSPACE # yeah, everything sucks
install_base="$(${bazelPkg}/bin/bazel info | grep install_base)"
# assert its actually below install_dir
[[ "$install_base" =~ ${install_dir} ]] \
|| (echo "oh no! $install_base but we are \
trying to copy ${install_dir} to $out instead!"; exit 1)
cp -R ${install_dir} $out
'';
bazelTest = { name, bazelScript, workspaceDir, bazelPkg, buildInputs ? [] }:
let
be = extracted bazelPkg;
in runLocal name { inherit buildInputs; } (
# skip extraction caching on Darwin, because nobody knows how Darwin works
(lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
# set up home with pre-unpacked bazel
export HOME=$(mktemp -d)
mkdir -p ${be.install_dir}
cp -R ${be}/install ${be.install_dir}
# https://stackoverflow.com/questions/47775668/bazel-how-to-skip-corrupt-installation-on-centos6
# Bazel checks whether the mtime of the install dir files
# is >9 years in the future, otherwise it extracts itself again.
# see PosixFileMTime::IsUntampered in src/main/cpp/util
# What the hell bazel.
${lr}/bin/lr -0 -U ${be.install_dir} | ${xe}/bin/xe -N0 -0 touch --date="9 years 6 months" {}
'')
+
''
# Note https://github.com/bazelbuild/bazel/issues/5763#issuecomment-456374609
# about why to create a subdir for the workspace.
cp -r ${workspaceDir} wd && chmod u+w wd && cd wd
${bazelScript}
touch $out
'');
bazelWithNixHacks = bazel_self.override { enableNixHacks = true; };
bazel-examples = fetchFromGitHub {
owner = "bazelbuild";
repo = "examples";
rev = "4183fc709c26a00366665e2d60d70521dc0b405d";
sha256 = "1mm4awx6sa0myiz9j4hwp71rpr7yh8vihf3zm15n2ii6xb82r31k";
};
in (if !stdenv.hostPlatform.isDarwin then {
# `extracted` doesnt work on darwin
shebang = callPackage ../shebang-test.nix { inherit runLocal extracted bazelTest distDir; };
} else {}) // {
bashTools = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; };
cpp = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; };
java = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; };
protobuf = callPackage ../protobuf-test.nix { inherit runLocal bazelTest distDir; };
pythonBinPath = callPackage ../python-bin-path-test.nix { inherit runLocal bazelTest distDir; };
bashToolsWithNixHacks = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
cppWithNixHacks = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazelWithNixHacks; };
javaWithNixHacks = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazelWithNixHacks; };
protobufWithNixHacks = callPackage ../protobuf-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
pythonBinPathWithNixHacks = callPackage ../python-bin-path-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
# downstream packages using buildBazelPackage
# fixed-output hashes of the fetch phase need to be spot-checked manually
downstream = recurseIntoAttrs ({
inherit bazel-watcher;
});
};
src_for_updater = stdenv.mkDerivation rec {
name = "updater-sources";
inherit src;
nativeBuildInputs = [ unzip ];
inherit sourceRoot;
installPhase = ''
runHook preInstall
cp -r . "$out"
runHook postInstall
'';
};
# update the list of workspace dependencies
passthru.updater = writeScript "update-bazel-deps.sh" ''
#!${runtimeShell}
(cd "${src_for_updater}" &&
BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 \
"${bazel_3}"/bin/bazel \
query 'kind(http_archive, //external:all) + kind(http_file, //external:all) + kind(distdir_tar, //external:all) + kind(git_repository, //external:all)' \
--loading_phase_threads=1 \
--output build) \
| "${python3}"/bin/python3 "${./update-srcDeps.py}" \
"${builtins.toString ./src-deps.json}"
'';
# Necessary for the tests to pass on Darwin with sandbox enabled.
# Bazel starts a local server and needs to bind a local address.
__darwinAllowLocalNetworking = true;
postPatch = let
darwinPatches = ''
bazelLinkFlags () {
eval set -- "$NIX_LDFLAGS"
local flag
for flag in "$@"; do
printf ' -Wl,%s' "$flag"
done
}
# Disable Bazel's Xcode toolchain detection which would configure compilers
# and linkers from Xcode instead of from PATH
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
# Explicitly configure gcov since we don't have it on Darwin, so autodetection fails
export GCOV=${coreutils}/bin/false
# Framework search paths aren't added by bintools hook
# https://github.com/NixOS/nixpkgs/pull/41914
export NIX_LDFLAGS+=" -F${CoreFoundation}/Library/Frameworks -F${CoreServices}/Library/Frameworks -F${Foundation}/Library/Frameworks"
# libcxx includes aren't added by libcxx hook
# https://github.com/NixOS/nixpkgs/pull/41589
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${lib.getDev libcxx}/include/c++/v1"
# don't use system installed Xcode to run clang, use Nix clang instead
sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
scripts/bootstrap/compile.sh \
src/tools/xcode/realpath/BUILD \
src/tools/xcode/stdredirect/BUILD \
tools/osx/BUILD
substituteInPlace scripts/bootstrap/compile.sh --replace ' -mmacosx-version-min=10.9' ""
# nixpkgs's libSystem cannot use pthread headers directly, must import GCD headers instead
sed -i -e "/#include <pthread\/spawn.h>/i #include <dispatch/dispatch.h>" src/main/cpp/blaze_util_darwin.cc
# clang installed from Xcode has a compatibility wrapper that forwards
# invocations of gcc to clang, but vanilla clang doesn't
sed -i -e 's;_find_generic(repository_ctx, "gcc", "CC", overriden_tools);_find_generic(repository_ctx, "clang", "CC", overriden_tools);g' tools/cpp/unix_cc_configure.bzl
sed -i -e 's;/usr/bin/libtool;${cctools}/bin/libtool;g' tools/cpp/unix_cc_configure.bzl
wrappers=( tools/cpp/osx_cc_wrapper.sh tools/cpp/osx_cc_wrapper.sh.tpl )
for wrapper in "''${wrappers[@]}"; do
sed -i -e "s,/usr/bin/install_name_tool,${cctools}/bin/install_name_tool,g" $wrapper
done
'';
genericPatches = ''
# Substitute j2objc and objc wrapper's python shebang to plain python path.
# These scripts explicitly depend on Python 2.7, hence we use python27.
# See also `postFixup` where python27 is added to $out/nix-support
substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
# md5sum is part of coreutils
sed -i 's|/sbin/md5|md5sum|g' \
src/BUILD third_party/ijar/test/testenv.sh tools/objc/libtool.sh
# replace initial value of pythonShebang variable in BazelPythonSemantics.java
substituteInPlace src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java \
--replace '"#!/usr/bin/env " + pythonExecutableName' "\"#!${python3}/bin/python\""
# substituteInPlace is rather slow, so prefilter the files with grep
grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
# If you add more replacements here, you must change the grep above!
# Only files containing /bin are taken into account.
# We default to python3 where possible. See also `postFixup` where
# python3 is added to $out/nix-support
substituteInPlace "$path" \
--replace /bin/bash ${bash}/bin/bash \
--replace "/usr/bin/env bash" ${bash}/bin/bash \
--replace "/usr/bin/env python" ${python3}/bin/python \
--replace /usr/bin/env ${coreutils}/bin/env \
--replace /bin/true ${coreutils}/bin/true
done
# bazel test runner include references to /bin/bash
substituteInPlace tools/build_rules/test_rules.bzl \
--replace /bin/bash ${bash}/bin/bash
for i in $(find tools/cpp/ -type f)
do
substituteInPlace $i \
--replace /bin/bash ${bash}/bin/bash
done
# Fixup scripts that generate scripts. Not fixed up by patchShebangs below.
substituteInPlace scripts/bootstrap/compile.sh \
--replace /bin/bash ${bash}/bin/bash
# add nix environment vars to .bazelrc
cat >> .bazelrc <<EOF
# Limit the resources Bazel is allowed to use during the build to 1/2 the
# available RAM and 3/4 the available CPU cores. This should help avoid
# overwhelming the build machine.
build --local_ram_resources=HOST_RAM*.5
build --local_cpu_resources=HOST_CPUS*.75
build --distdir=${distDir}
fetch --distdir=${distDir}
build --copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt="/g')"
build --host_copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt="/g')"
build --linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt="/g')"
build --host_linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt="/g')"
build --linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt="-Wl,/g')"
build --host_linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt="-Wl,/g')"
build --host_javabase='@local_jdk//:jdk'
build --host_java_toolchain='${javaToolchain}'
build --verbose_failures
build --curses=no
EOF
# add the same environment vars to compile.sh
sed -e "/\$command \\\\$/a --copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --host_copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --host_linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_javabase='@local_jdk//:jdk' \\\\" \
-e "/\$command \\\\$/a --host_java_toolchain='${javaToolchain}' \\\\" \
-e "/\$command \\\\$/a --verbose_failures \\\\" \
-e "/\$command \\\\$/a --curses=no \\\\" \
-i scripts/bootstrap/compile.sh
# This is necessary to avoid:
# "error: no visible @interface for 'NSDictionary' declares the selector
# 'initWithContentsOfURL:error:'"
# This can be removed when the apple_sdk is upgraded beyond 10.13+
sed -i '/initWithContentsOfURL:versionPlistUrl/ {
N
s/error:nil\];/\];/
}' tools/osx/xcode_locator.m
# append the PATH with defaultShellPath in tools/bash/runfiles/runfiles.bash
echo "PATH=\$PATH:${defaultShellPath}" >> runfiles.bash.tmp
cat tools/bash/runfiles/runfiles.bash >> runfiles.bash.tmp
mv runfiles.bash.tmp tools/bash/runfiles/runfiles.bash
patchShebangs .
'';
in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches
+ genericPatches;
buildInputs = [buildJdk] ++ defaultShellUtils;
# when a command cant be found in a bazel build, you might also
# need to add it to `defaultShellPath`.
nativeBuildInputs = [
installShellFiles
makeWrapper
python3
unzip
which
zip
python3.pkgs.absl-py # Needed to build fish completion
] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ];
# Bazel makes extensive use of symlinks in the WORKSPACE.
# This causes problems with infinite symlinks if the build output is in the same location as the
# Bazel WORKSPACE. This is why before executing the build, the source code is moved into a
# subdirectory.
# Failing to do this causes "infinite symlink expansion detected"
preBuildPhases = ["preBuildPhase"];
preBuildPhase = ''
mkdir bazel_src
shopt -s dotglob extglob
mv !(bazel_src) bazel_src
'';
buildPhase = ''
runHook preBuild
# Increasing memory during compilation might be necessary.
# export BAZEL_JAVAC_OPTS="-J-Xmx2g -J-Xms200m"
# If EMBED_LABEL isn't set, it'd be auto-detected from CHANGELOG.md
# and `git rev-parse --short HEAD` which would result in
# "3.7.0- (@non-git)" due to non-git build and incomplete changelog.
# Actual bazel releases use scripts/release/common.sh which is based
# on branch/tag information which we don't have with tarball releases.
# Note that .bazelversion is always correct and is based on bazel-*
# executable name, version checks should work fine
export EMBED_LABEL="${version}- (@non-git)"
${bash}/bin/bash ./bazel_src/compile.sh
./bazel_src/scripts/generate_bash_completion.sh \
--bazel=./bazel_src/output/bazel \
--output=./bazel_src/output/bazel-complete.bash \
--prepend=./bazel_src/scripts/bazel-complete-header.bash \
--prepend=./bazel_src/scripts/bazel-complete-template.bash
${python3}/bin/python3 ./bazel_src/scripts/generate_fish_completion.py \
--bazel=./bazel_src/output/bazel \
--output=./bazel_src/output/bazel-complete.fish
# need to change directory for bazel to find the workspace
cd ./bazel_src
# build execlog tooling
export HOME=$(mktemp -d)
./output/bazel build src/tools/execlog:parser_deploy.jar
cd -
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
# official wrapper scripts that searches for $WORKSPACE_ROOT/tools/bazel
# if it cant find something in tools, it calls $out/bin/bazel-{version}-{os_arch}
# The binary _must_ exist with this naming if your project contains a .bazelversion
# file.
cp ./bazel_src/scripts/packages/bazel.sh $out/bin/bazel
mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch}
mkdir $out/share
cp ./bazel_src/bazel-bin/src/tools/execlog/parser_deploy.jar $out/share/parser_deploy.jar
cat <<EOF > $out/bin/bazel-execlog
#!${runtimeShell} -e
${runJdk}/bin/java -jar $out/share/parser_deploy.jar \$@
EOF
chmod +x $out/bin/bazel-execlog
# shell completion files
installShellCompletion --bash \
--name bazel.bash \
./bazel_src/output/bazel-complete.bash
installShellCompletion --zsh \
--name _bazel \
./bazel_src/scripts/zsh_completion/_bazel
installShellCompletion --fish \
--name bazel.fish \
./bazel_src/output/bazel-complete.fish
'';
# Install check fails on `aarch64-darwin`
# https://github.com/NixOS/nixpkgs/issues/145587
doInstallCheck = stdenv.hostPlatform.system != "aarch64-darwin";
installCheckPhase = ''
export TEST_TMPDIR=$(pwd)
hello_test () {
$out/bin/bazel test \
--test_output=errors \
--java_toolchain='${javaToolchain}' \
examples/cpp:hello-success_test \
examples/java-native/src/test/java/com/example/myproject:hello
}
cd ./bazel_src
# test whether $WORKSPACE_ROOT/tools/bazel works
mkdir -p tools
cat > tools/bazel <<"EOF"
#!${runtimeShell} -e
exit 1
EOF
chmod +x tools/bazel
# first call should fail if tools/bazel is used
! hello_test
cat > tools/bazel <<"EOF"
#!${runtimeShell} -e
exec "$BAZEL_REAL" "$@"
EOF
# second call succeeds because it defers to $out/bin/bazel-{version}-{os_arch}
hello_test
runHook postInstall
'';
# Save paths to hardcoded dependencies so Nix can detect them.
# This is needed because the templates get tard up into a .jar.
postFixup = ''
mkdir -p $out/nix-support
echo "${defaultShellPath}" >> $out/nix-support/depends
# The string literal specifying the path to the bazel-rc file is sometimes
# stored non-contiguously in the binary due to gcc optimisations, which leads
# Nix to miss the hash when scanning for dependencies
echo "${bazelRC}" >> $out/nix-support/depends
'' + lib.optionalString stdenv.isDarwin ''
echo "${cctools}" >> $out/nix-support/depends
'';
dontStrip = true;
dontPatchELF = true;
}

View file

@ -0,0 +1,34 @@
--- a/tools/osx/xcode_locator.m 2020-12-10 13:27:29.000000000 +0100
+++ b/tools/osx/xcode_locator.m 2021-02-01 09:09:32.159557051 +0100
@@ -21,10 +21,6 @@
// 6,6.4,6.4.1 = 6.4.1
// 6.3,6.3.0 = 6.3
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
#import <CoreServices/CoreServices.h>
#import <Foundation/Foundation.h>
--- a/tools/osx/xcode_configure.bzl 1980-01-01 01:00:00.000000000 +0100
+++ b/tools/osx/xcode_configure.bzl 2021-02-01 09:36:57.773418444 +0100
@@ -123,7 +123,6 @@
"macosx",
"clang",
"-mmacosx-version-min=10.9",
- "-fobjc-arc",
"-framework",
"CoreServices",
"-framework",
--- a/tools/osx/BUILD 2021-02-01 11:01:02.191659553 +0100
+++ b/tools/osx/BUILD 2021-02-01 11:04:29.735071019 +0100
@@ -27,7 +27,7 @@
])
DARWIN_XCODE_LOCATOR_COMPILE_COMMAND = """
- /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices \
+ /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -framework CoreServices \
-framework Foundation -o $@ $<
"""

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
#!/usr/bin/env python3
import sys
import json
if len(sys.argv) != 2:
print("usage: ./this-script src-deps.json < WORKSPACE", file=sys.stderr)
print("Takes the bazel WORKSPACE file and reads all archives into a json dict (by evaling it as python code)", file=sys.stderr)
print("Hail Eris.", file=sys.stderr)
sys.exit(1)
http_archives = []
# just the kw args are the dict { name, sha256, urls … }
def http_archive(**kw):
http_archives.append(kw)
# like http_file
def http_file(**kw):
http_archives.append(kw)
# this is inverted from http_archive/http_file and bundles multiple archives
def distdir_tar(**kw):
for archive_name in kw['archives']:
http_archives.append({
"name": archive_name,
"sha256": kw['sha256'][archive_name],
"urls": kw['urls'][archive_name]
})
# TODO?
def git_repository(**kw):
print(json.dumps(kw, sort_keys=True, indent=4), file=sys.stderr)
sys.exit(1)
# execute the WORKSPACE like it was python code in this module,
# using all the function stubs from above.
exec(sys.stdin.read())
# transform to a dict with the names as keys
d = { el['name']: el for el in http_archives }
def has_urls(el):
return ('url' in el and el['url']) or ('urls' in el and el['urls'])
def has_sha256(el):
return 'sha256' in el and el['sha256']
bad_archives = list(filter(lambda el: not has_urls(el) or not has_sha256(el), d.values()))
if bad_archives:
print('Following bazel dependencies are missing url or sha256', file=sys.stderr)
print('Check bazel sources for master or non-checksummed dependencies', file=sys.stderr)
for el in bad_archives:
print(json.dumps(el, sort_keys=True, indent=4), file=sys.stderr)
sys.exit(1)
with open(sys.argv[1], "w") as f:
print(json.dumps(d, sort_keys=True, indent=4), file=f)

View file

@ -0,0 +1,41 @@
diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
index 6fff2af..7e2877e 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
@@ -47,6 +47,16 @@ public final class PosixLocalEnvProvider implements LocalEnvProvider {
Map<String, String> env, BinTools binTools, String fallbackTmpDir) {
ImmutableMap.Builder<String, String> result = ImmutableMap.builder();
result.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
+
+ // In case we are running on NixOS.
+ // If bash is called with an unset PATH on this platform,
+ // it will set it to /no-such-path and default tools will be missings.
+ // See, https://github.com/NixOS/nixpkgs/issues/94222
+ // So we ensure that minimal dependencies are present.
+ if (!env.containsKey("PATH")){
+ result.put("PATH", "@actionsPathPatch@");
+ }
+
String p = clientEnv.get("TMPDIR");
if (Strings.isNullOrEmpty(p)) {
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR
index 95642767c6..39d3c62461 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
@@ -74,6 +74,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider {
ImmutableMap.Builder<String, String> newEnvBuilder = ImmutableMap.builder();
newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
+
+ // In case we are running on NixOS.
+ // If bash is called with an unset PATH on this platform,
+ // it will set it to /no-such-path and default tools will be missings.
+ // See, https://github.com/NixOS/nixpkgs/issues/94222
+ // So we ensure that minimal dependencies are present.
+ if (!env.containsKey("PATH")){
+ newEnvBuilder.put("PATH", "@actionsPathPatch@");
+ }
+
String p = clientEnv.get("TMPDIR");
if (Strings.isNullOrEmpty(p)) {
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR

View file

@ -0,0 +1,665 @@
{ stdenv, callPackage, lib, fetchurl, fetchpatch, fetchFromGitHub, installShellFiles
, runCommand, runCommandCC, makeWrapper, recurseIntoAttrs
# this package (through the fixpoint glass)
, bazel_self
# needed only for the updater
, bazel_4
, lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, gawk, gnused, gnutar, gnugrep, gzip, findutils
# updater
, python27, python3, writeScript
# Apple dependencies
, cctools, libcxx, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
, buildJdk, runJdk
, runtimeShell
# Downstream packages for tests
, bazel-watcher
# Always assume all markers valid (this is needed because we remove markers; they are non-deterministic).
# Also, don't clean up environment variables (so that NIX_ environment variables are passed to compilers).
, enableNixHacks ? false
, gcc-unwrapped
, autoPatchelfHook
, file
, substituteAll
, writeTextFile
}:
let
version = "5.1.1";
sourceRoot = ".";
src = fetchurl {
url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip";
sha256 = "f107wdNEaSskAPN2X9S1wLY26056insXkjCVx7VqT3g=";
};
# Update with `eval $(nix-build -A bazel.updater)`,
# then add new dependencies from the dict in ./src-deps.json as required.
srcDeps = lib.attrsets.attrValues srcDepsSet;
srcDepsSet =
let
srcs = lib.importJSON ./src-deps.json;
toFetchurl = d: lib.attrsets.nameValuePair d.name (fetchurl {
urls = d.urls;
sha256 = d.sha256;
});
in builtins.listToAttrs (map toFetchurl [
srcs.desugar_jdk_libs
srcs.io_bazel_skydoc
srcs.bazel_skylib
srcs.bazelci_rules
srcs.io_bazel_rules_sass
srcs.platforms
srcs."remote_java_tools_for_testing"
srcs."coverage_output_generator-v2.5.zip"
srcs.build_bazel_rules_nodejs
srcs."android_tools_pkg-0.23.0.tar.gz"
srcs.bazel_toolchains
srcs.com_github_grpc_grpc
srcs.upb
srcs.com_google_protobuf
srcs.rules_pkg
srcs.rules_cc
srcs.rules_java
srcs.rules_proto
srcs.com_google_absl
srcs.com_googlesource_code_re2
srcs.com_github_cares_cares
]);
distDir = runCommand "bazel-deps" {} ''
mkdir -p $out
for i in ${builtins.toString srcDeps}; do cp $i $out/$(stripHash $i); done
'';
defaultShellUtils =
# Keep this list conservative. For more exotic tools, prefer to use
# @rules_nixpkgs to pull in tools from the nix repository. Example:
#
# WORKSPACE:
#
# nixpkgs_git_repository(
# name = "nixpkgs",
# revision = "def5124ec8367efdba95a99523dd06d918cb0ae8",
# )
#
# # This defines an external Bazel workspace.
# nixpkgs_package(
# name = "bison",
# repositories = { "nixpkgs": "@nixpkgs//:default.nix" },
# )
#
# some/BUILD.bazel:
#
# genrule(
# ...
# cmd = "$(location @bison//:bin/bison) -other -args",
# tools = [
# ...
# "@bison//:bin/bison",
# ],
# )
#
# Some of the scripts explicitly depend on Python 2.7. Otherwise, we
# default to using python3. Therefore, both python27 and python3 are
# runtime dependencies.
[
bash
coreutils
file
findutils
gawk
gnugrep
gnused
gnutar
gzip
python27
python3
unzip
which
zip
];
defaultShellPath = lib.makeBinPath defaultShellUtils;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
arch = stdenv.hostPlatform.parsed.cpu.name;
bazelRC = writeTextFile {
name = "bazel-rc";
text = ''
startup --server_javabase=${runJdk}
# Can't use 'common'; https://github.com/bazelbuild/bazel/issues/3054
# Most commands inherit from 'build' anyway.
build --distdir=${distDir}
fetch --distdir=${distDir}
query --distdir=${distDir}
build --extra_toolchains=@bazel_tools//tools/jdk:nonprebuilt_toolchain_definition
build --tool_java_runtime_version=local_jdk_11
build --java_runtime_version=local_jdk_11
# load default location for the system wide configuration
try-import /etc/bazel.bazelrc
'';
};
in
stdenv.mkDerivation rec {
pname = "bazel";
inherit version;
meta = with lib; {
homepage = "https://github.com/bazelbuild/bazel/";
description = "Build tool that builds code quickly and reliably";
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # source bundles dependencies as jars
];
license = licenses.asl20;
maintainers = lib.teams.bazel.members;
inherit platforms;
};
inherit src;
inherit sourceRoot;
patches = [
# On Darwin, the last argument to gcc is coming up as an empty string. i.e: ''
# This is breaking the build of any C target. This patch removes the last
# argument if it's found to be an empty string.
../trim-last-argument-to-gcc-if-empty.patch
# On Darwin, using clang 6 to build fails because of a linker error (see #105573),
# but using clang 7 fails because libarclite_macosx.a cannot be found when linking
# the xcode_locator tool.
# This patch removes using the -fobjc-arc compiler option and makes the code
# compile without automatic reference counting. Caveat: this leaks memory, but
# we accept this fact because xcode_locator is only a short-lived process used during the build.
(substituteAll {
src = ./no-arc.patch;
multiBinPatch = if stdenv.hostPlatform.system == "aarch64-darwin" then "arm64" else "x86_64";
})
# --experimental_strict_action_env (which may one day become the default
# see bazelbuild/bazel#2574) hardcodes the default
# action environment to a non hermetic value (e.g. "/usr/local/bin").
# This is non hermetic on non-nixos systems. On NixOS, bazel cannot find the required binaries.
# So we are replacing this bazel paths by defaultShellPath,
# improving hermeticity and making it work in nixos.
(substituteAll {
src = ../strict_action_env.patch;
strictActionEnvPatch = defaultShellPath;
})
(substituteAll {
src = ./actions_path.patch;
actionsPathPatch = defaultShellPath;
})
# bazel reads its system bazelrc in /etc
# override this path to a builtin one
(substituteAll {
src = ../bazel_rc.patch;
bazelSystemBazelRCPath = bazelRC;
})
] ++ lib.optional enableNixHacks ../nix-hacks.patch;
# Additional tests that check bazels functionality. Execute
#
# nix-build . -A bazel.tests
#
# in the nixpkgs checkout root to exercise them locally.
passthru.tests =
let
runLocal = name: attrs: script:
let
attrs' = removeAttrs attrs [ "buildInputs" ];
buildInputs = [ python3 which ] ++ (attrs.buildInputs or []);
in
runCommandCC name ({
inherit buildInputs;
preferLocalBuild = true;
meta.platforms = platforms;
} // attrs') script;
# bazel wants to extract itself into $install_dir/install every time it runs,
# so lets do that only once.
extracted = bazelPkg:
let install_dir =
# `install_base` field printed by `bazel info`, minus the hash.
# yes, this path is kinda magic. Sorry.
"$HOME/.cache/bazel/_bazel_nixbld";
in runLocal "bazel-extracted-homedir" { passthru.install_dir = install_dir; } ''
export HOME=$(mktemp -d)
touch WORKSPACE # yeah, everything sucks
install_base="$(${bazelPkg}/bin/bazel info | grep install_base)"
# assert its actually below install_dir
[[ "$install_base" =~ ${install_dir} ]] \
|| (echo "oh no! $install_base but we are \
trying to copy ${install_dir} to $out instead!"; exit 1)
cp -R ${install_dir} $out
'';
bazelTest = { name, bazelScript, workspaceDir, bazelPkg, buildInputs ? [] }:
let
be = extracted bazelPkg;
in runLocal name { inherit buildInputs; } (
# skip extraction caching on Darwin, because nobody knows how Darwin works
(lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
# set up home with pre-unpacked bazel
export HOME=$(mktemp -d)
mkdir -p ${be.install_dir}
cp -R ${be}/install ${be.install_dir}
# https://stackoverflow.com/questions/47775668/bazel-how-to-skip-corrupt-installation-on-centos6
# Bazel checks whether the mtime of the install dir files
# is >9 years in the future, otherwise it extracts itself again.
# see PosixFileMTime::IsUntampered in src/main/cpp/util
# What the hell bazel.
${lr}/bin/lr -0 -U ${be.install_dir} | ${xe}/bin/xe -N0 -0 touch --date="9 years 6 months" {}
'')
+
''
# Note https://github.com/bazelbuild/bazel/issues/5763#issuecomment-456374609
# about why to create a subdir for the workspace.
cp -r ${workspaceDir} wd && chmod u+w wd && cd wd
${bazelScript}
touch $out
'');
bazelWithNixHacks = bazel_self.override { enableNixHacks = true; };
bazel-examples = fetchFromGitHub {
owner = "bazelbuild";
repo = "examples";
rev = "4183fc709c26a00366665e2d60d70521dc0b405d";
sha256 = "1mm4awx6sa0myiz9j4hwp71rpr7yh8vihf3zm15n2ii6xb82r31k";
};
in (if !stdenv.hostPlatform.isDarwin then {
# `extracted` doesnt work on darwin
shebang = callPackage ../shebang-test.nix { inherit runLocal extracted bazelTest distDir; };
} else {}) // {
bashTools = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; };
cpp = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; };
java = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; };
protobuf = callPackage ../protobuf-test.nix { inherit runLocal bazelTest distDir; };
pythonBinPath = callPackage ../python-bin-path-test.nix { inherit runLocal bazelTest distDir; };
bashToolsWithNixHacks = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
cppWithNixHacks = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazelWithNixHacks; };
javaWithNixHacks = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazelWithNixHacks; };
protobufWithNixHacks = callPackage ../protobuf-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
pythonBinPathWithNixHacks = callPackage ../python-bin-path-test.nix { inherit runLocal bazelTest distDir; bazel = bazelWithNixHacks; };
# downstream packages using buildBazelPackage
# fixed-output hashes of the fetch phase need to be spot-checked manually
downstream = recurseIntoAttrs ({
inherit bazel-watcher;
});
};
src_for_updater = stdenv.mkDerivation rec {
name = "updater-sources";
inherit src;
nativeBuildInputs = [ unzip ];
inherit sourceRoot;
installPhase = ''
runHook preInstall
cp -r . "$out"
runHook postInstall
'';
};
# update the list of workspace dependencies
passthru.updater = writeScript "update-bazel-deps.sh" ''
#!${runtimeShell}
(cd "${src_for_updater}" &&
BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 \
"${bazel_4}"/bin/bazel \
query 'kind(http_archive, //external:all) + kind(http_file, //external:all) + kind(distdir_tar, //external:all) + kind(git_repository, //external:all)' \
--loading_phase_threads=1 \
--output build) \
| "${python3}"/bin/python3 "${./update-srcDeps.py}" \
"${builtins.toString ./src-deps.json}"
'';
# Necessary for the tests to pass on Darwin with sandbox enabled.
# Bazel starts a local server and needs to bind a local address.
__darwinAllowLocalNetworking = true;
postPatch = let
darwinPatches = ''
bazelLinkFlags () {
eval set -- "$NIX_LDFLAGS"
local flag
for flag in "$@"; do
printf ' -Wl,%s' "$flag"
done
}
# Disable Bazel's Xcode toolchain detection which would configure compilers
# and linkers from Xcode instead of from PATH
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
# Explicitly configure gcov since we don't have it on Darwin, so autodetection fails
export GCOV=${coreutils}/bin/false
# Framework search paths aren't added by bintools hook
# https://github.com/NixOS/nixpkgs/pull/41914
export NIX_LDFLAGS+=" -F${CoreFoundation}/Library/Frameworks -F${CoreServices}/Library/Frameworks -F${Foundation}/Library/Frameworks"
# libcxx includes aren't added by libcxx hook
# https://github.com/NixOS/nixpkgs/pull/41589
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${lib.getDev libcxx}/include/c++/v1"
# don't use system installed Xcode to run clang, use Nix clang instead
sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
scripts/bootstrap/compile.sh \
tools/osx/BUILD
substituteInPlace scripts/bootstrap/compile.sh --replace ' -mmacosx-version-min=10.9' ""
# nixpkgs's libSystem cannot use pthread headers directly, must import GCD headers instead
sed -i -e "/#include <pthread\/spawn.h>/i #include <dispatch/dispatch.h>" src/main/cpp/blaze_util_darwin.cc
# clang installed from Xcode has a compatibility wrapper that forwards
# invocations of gcc to clang, but vanilla clang doesn't
sed -i -e 's;_find_generic(repository_ctx, "gcc", "CC", overriden_tools);_find_generic(repository_ctx, "clang", "CC", overriden_tools);g' tools/cpp/unix_cc_configure.bzl
sed -i -e 's;/usr/bin/libtool;${cctools}/bin/libtool;g' tools/cpp/unix_cc_configure.bzl
wrappers=( tools/cpp/osx_cc_wrapper.sh tools/cpp/osx_cc_wrapper.sh.tpl )
for wrapper in "''${wrappers[@]}"; do
sed -i -e "s,/usr/bin/install_name_tool,${cctools}/bin/install_name_tool,g" $wrapper
done
'';
genericPatches = ''
# Substitute j2objc and objc wrapper's python shebang to plain python path.
# These scripts explicitly depend on Python 2.7, hence we use python27.
# See also `postFixup` where python27 is added to $out/nix-support
substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
# md5sum is part of coreutils
sed -i 's|/sbin/md5|md5sum|g' \
src/BUILD third_party/ijar/test/testenv.sh tools/objc/libtool.sh
# replace initial value of pythonShebang variable in BazelPythonSemantics.java
substituteInPlace src/main/java/com/google/devtools/build/lib/bazel/rules/python/BazelPythonSemantics.java \
--replace '"#!/usr/bin/env " + pythonExecutableName' "\"#!${python3}/bin/python\""
substituteInPlace src/main/java/com/google/devtools/build/lib/starlarkbuildapi/python/PyRuntimeInfoApi.java \
--replace '"#!/usr/bin/env python3"' "\"#!${python3}/bin/python\""
# substituteInPlace is rather slow, so prefilter the files with grep
grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
# If you add more replacements here, you must change the grep above!
# Only files containing /bin are taken into account.
# We default to python3 where possible. See also `postFixup` where
# python3 is added to $out/nix-support
substituteInPlace "$path" \
--replace /bin/bash ${bash}/bin/bash \
--replace "/usr/bin/env bash" ${bash}/bin/bash \
--replace "/usr/bin/env python" ${python3}/bin/python \
--replace /usr/bin/env ${coreutils}/bin/env \
--replace /bin/true ${coreutils}/bin/true
done
grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do
substituteInPlace "$path" \
--replace "/usr/bin/env python2" ${python27}/bin/python \
--replace "/usr/bin/env python3" ${python3}/bin/python \
--replace /usr/bin/env ${coreutils}/bin/env
done
# bazel test runner include references to /bin/bash
substituteInPlace tools/build_rules/test_rules.bzl \
--replace /bin/bash ${bash}/bin/bash
for i in $(find tools/cpp/ -type f)
do
substituteInPlace $i \
--replace /bin/bash ${bash}/bin/bash
done
# Fixup scripts that generate scripts. Not fixed up by patchShebangs below.
substituteInPlace scripts/bootstrap/compile.sh \
--replace /bin/bash ${bash}/bin/bash
# add nix environment vars to .bazelrc
cat >> .bazelrc <<EOF
# Limit the resources Bazel is allowed to use during the build to 1/2 the
# available RAM and 3/4 the available CPU cores. This should help avoid
# overwhelming the build machine.
build --local_ram_resources=HOST_RAM*.5
build --local_cpu_resources=HOST_CPUS*.75
build --distdir=${distDir}
fetch --distdir=${distDir}
build --copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt="/g')"
build --host_copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt="/g')"
build --linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt="/g')"
build --host_linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt="/g')"
build --linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt="-Wl,/g')"
build --host_linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt="-Wl,/g')"
build --extra_toolchains=@bazel_tools//tools/jdk:nonprebuilt_toolchain_definition
build --verbose_failures
build --curses=no
build --features=-layering_check
EOF
cat >> tools/jdk/BUILD.tools <<EOF
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain", "NONPREBUILT_TOOLCHAIN_CONFIGURATION")
default_java_toolchain(
name = "nonprebuilt_toolchain",
configuration = NONPREBUILT_TOOLCHAIN_CONFIGURATION,
java_runtime = "@local_jdk//:jdk",
)
EOF
cat >> third_party/grpc/bazel_1.41.0.patch <<EOF
diff --git a/third_party/grpc/BUILD b/third_party/grpc/BUILD
index 39ee9f97c6..9128d20c85 100644
--- a/third_party/grpc/BUILD
+++ b/third_party/grpc/BUILD
@@ -28,7 +28,6 @@ licenses(["notice"])
package(
default_visibility = ["//visibility:public"],
features = [
- "layering_check",
"-parse_headers",
],
)
EOF
# add the same environment vars to compile.sh
sed -e "/\$command \\\\$/a --copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --host_copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --host_linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --tool_java_runtime_version=local_jdk_11 \\\\" \
-e "/\$command \\\\$/a --java_runtime_version=local_jdk_11 \\\\" \
-e "/\$command \\\\$/a --verbose_failures \\\\" \
-e "/\$command \\\\$/a --curses=no \\\\" \
-e "/\$command \\\\$/a --features=-layering_check \\\\" \
-i scripts/bootstrap/compile.sh
# This is necessary to avoid:
# "error: no visible @interface for 'NSDictionary' declares the selector
# 'initWithContentsOfURL:error:'"
# This can be removed when the apple_sdk is upgraded beyond 10.13+
sed -i '/initWithContentsOfURL:versionPlistUrl/ {
N
s/error:nil\];/\];/
}' tools/osx/xcode_locator.m
# append the PATH with defaultShellPath in tools/bash/runfiles/runfiles.bash
echo "PATH=\$PATH:${defaultShellPath}" >> runfiles.bash.tmp
cat tools/bash/runfiles/runfiles.bash >> runfiles.bash.tmp
mv runfiles.bash.tmp tools/bash/runfiles/runfiles.bash
patchShebangs .
'';
in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches
+ genericPatches;
buildInputs = [buildJdk] ++ defaultShellUtils;
# when a command cant be found in a bazel build, you might also
# need to add it to `defaultShellPath`.
nativeBuildInputs = [
installShellFiles
makeWrapper
python3
unzip
which
zip
python3.pkgs.absl-py # Needed to build fish completion
] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ];
# Bazel makes extensive use of symlinks in the WORKSPACE.
# This causes problems with infinite symlinks if the build output is in the same location as the
# Bazel WORKSPACE. This is why before executing the build, the source code is moved into a
# subdirectory.
# Failing to do this causes "infinite symlink expansion detected"
preBuildPhases = ["preBuildPhase"];
preBuildPhase = ''
mkdir bazel_src
shopt -s dotglob extglob
mv !(bazel_src) bazel_src
'';
buildPhase = ''
runHook preBuild
# Increasing memory during compilation might be necessary.
# export BAZEL_JAVAC_OPTS="-J-Xmx2g -J-Xms200m"
# If EMBED_LABEL isn't set, it'd be auto-detected from CHANGELOG.md
# and `git rev-parse --short HEAD` which would result in
# "3.7.0- (@non-git)" due to non-git build and incomplete changelog.
# Actual bazel releases use scripts/release/common.sh which is based
# on branch/tag information which we don't have with tarball releases.
# Note that .bazelversion is always correct and is based on bazel-*
# executable name, version checks should work fine
export EMBED_LABEL="${version}- (@non-git)"
${bash}/bin/bash ./bazel_src/compile.sh
./bazel_src/scripts/generate_bash_completion.sh \
--bazel=./bazel_src/output/bazel \
--output=./bazel_src/output/bazel-complete.bash \
--prepend=./bazel_src/scripts/bazel-complete-header.bash \
--prepend=./bazel_src/scripts/bazel-complete-template.bash
${python3}/bin/python3 ./bazel_src/scripts/generate_fish_completion.py \
--bazel=./bazel_src/output/bazel \
--output=./bazel_src/output/bazel-complete.fish
# need to change directory for bazel to find the workspace
cd ./bazel_src
# build execlog tooling
export HOME=$(mktemp -d)
./output/bazel build src/tools/execlog:parser_deploy.jar
cd -
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
# official wrapper scripts that searches for $WORKSPACE_ROOT/tools/bazel
# if it cant find something in tools, it calls $out/bin/bazel-{version}-{os_arch}
# The binary _must_ exist with this naming if your project contains a .bazelversion
# file.
cp ./bazel_src/scripts/packages/bazel.sh $out/bin/bazel
mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch}
mkdir $out/share
cp ./bazel_src/bazel-bin/src/tools/execlog/parser_deploy.jar $out/share/parser_deploy.jar
cat <<EOF > $out/bin/bazel-execlog
#!${runtimeShell} -e
${runJdk}/bin/java -jar $out/share/parser_deploy.jar \$@
EOF
chmod +x $out/bin/bazel-execlog
# shell completion files
installShellCompletion --bash \
--name bazel.bash \
./bazel_src/output/bazel-complete.bash
installShellCompletion --zsh \
--name _bazel \
./bazel_src/scripts/zsh_completion/_bazel
installShellCompletion --fish \
--name bazel.fish \
./bazel_src/output/bazel-complete.fish
'';
# Install check fails on `aarch64-darwin`
# https://github.com/NixOS/nixpkgs/issues/145587
doInstallCheck = stdenv.hostPlatform.system != "aarch64-darwin";
installCheckPhase = ''
export TEST_TMPDIR=$(pwd)
hello_test () {
$out/bin/bazel test \
--test_output=errors \
examples/cpp:hello-success_test \
examples/java-native/src/test/java/com/example/myproject:hello
}
cd ./bazel_src
# test whether $WORKSPACE_ROOT/tools/bazel works
mkdir -p tools
cat > tools/bazel <<"EOF"
#!${runtimeShell} -e
exit 1
EOF
chmod +x tools/bazel
# first call should fail if tools/bazel is used
! hello_test
cat > tools/bazel <<"EOF"
#!${runtimeShell} -e
exec "$BAZEL_REAL" "$@"
EOF
# second call succeeds because it defers to $out/bin/bazel-{version}-{os_arch}
hello_test
runHook postInstall
'';
# Save paths to hardcoded dependencies so Nix can detect them.
# This is needed because the templates get tard up into a .jar.
postFixup = ''
mkdir -p $out/nix-support
echo "${defaultShellPath}" >> $out/nix-support/depends
# The string literal specifying the path to the bazel-rc file is sometimes
# stored non-contiguously in the binary due to gcc optimisations, which leads
# Nix to miss the hash when scanning for dependencies
echo "${bazelRC}" >> $out/nix-support/depends
'' + lib.optionalString stdenv.isDarwin ''
echo "${cctools}" >> $out/nix-support/depends
'';
dontStrip = true;
dontPatchELF = true;
}

View file

@ -0,0 +1,42 @@
diff --git a/tools/osx/BUILD b/tools/osx/BUILD
index 990afe3e8c..cd5b7b1b7a 100644
--- a/tools/osx/BUILD
+++ b/tools/osx/BUILD
@@ -28,8 +28,8 @@ exports_files([
])
DARWIN_XCODE_LOCATOR_COMPILE_COMMAND = """
- /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices \
- -framework Foundation -arch arm64 -arch x86_64 -Wl,-no_adhoc_codesign -Wl,-no_uuid -o $@ $< && \
+ /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -framework CoreServices \
+ -framework Foundation -arch @multiBinPatch@ -Wl,-no_uuid -o $@ $< && \
env -i codesign --identifier $@ --force --sign - $@
"""
diff --git a/tools/osx/xcode_configure.bzl b/tools/osx/xcode_configure.bzl
index 2b819f07ec..a98ce37673 100644
--- a/tools/osx/xcode_configure.bzl
+++ b/tools/osx/xcode_configure.bzl
@@ -127,7 +127,6 @@ def run_xcode_locator(repository_ctx, xcode_locator_src_label):
"macosx",
"clang",
"-mmacosx-version-min=10.9",
- "-fobjc-arc",
"-framework",
"CoreServices",
"-framework",
diff --git a/tools/osx/xcode_locator.m b/tools/osx/xcode_locator.m
index ed2ef87453..e0ce6dbdd1 100644
--- a/tools/osx/xcode_locator.m
+++ b/tools/osx/xcode_locator.m
@@ -21,10 +21,6 @@
// 6,6.4,6.4.1 = 6.4.1
// 6.3,6.3.0 = 6.3
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
#import <CoreServices/CoreServices.h>
#import <Foundation/Foundation.h>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
#!/usr/bin/env python3
import sys
import json
if len(sys.argv) != 2:
print("usage: ./this-script src-deps.json < WORKSPACE", file=sys.stderr)
print("Takes the bazel WORKSPACE file and reads all archives into a json dict (by evaling it as python code)", file=sys.stderr)
print("Hail Eris.", file=sys.stderr)
sys.exit(1)
http_archives = []
# just the kw args are the dict { name, sha256, urls … }
def http_archive(**kw):
http_archives.append(kw)
# like http_file
def http_file(**kw):
http_archives.append(kw)
# this is inverted from http_archive/http_file and bundles multiple archives
def _distdir_tar(**kw):
for archive_name in kw['archives']:
http_archives.append({
"name": archive_name,
"sha256": kw['sha256'][archive_name],
"urls": kw['urls'][archive_name]
})
# TODO?
def git_repository(**kw):
print(json.dumps(kw, sort_keys=True, indent=4), file=sys.stderr)
sys.exit(1)
# execute the WORKSPACE like it was python code in this module,
# using all the function stubs from above.
exec(sys.stdin.read())
# transform to a dict with the names as keys
d = { el['name']: el for el in http_archives }
def has_urls(el):
return ('url' in el and el['url']) or ('urls' in el and el['urls'])
def has_sha256(el):
return 'sha256' in el and el['sha256']
bad_archives = list(filter(lambda el: not has_urls(el) or not has_sha256(el), d.values()))
if bad_archives:
print('Following bazel dependencies are missing url or sha256', file=sys.stderr)
print('Check bazel sources for master or non-checksummed dependencies', file=sys.stderr)
for el in bad_archives:
print(json.dumps(el, sort_keys=True, indent=4), file=sys.stderr)
sys.exit(1)
with open(sys.argv[1], "w") as f:
print(json.dumps(d, sort_keys=True, indent=4), file=f)

View file

@ -0,0 +1,13 @@
diff --git a/src/main/cpp/option_processor.cc b/src/main/cpp/option_processor.cc
index 8f8f15685f..a7ae52d1e4 100644
--- a/src/main/cpp/option_processor.cc
+++ b/src/main/cpp/option_processor.cc
@@ -56,7 +56,7 @@ OptionProcessor::OptionProcessor(
: workspace_layout_(workspace_layout),
startup_options_(std::move(default_startup_options)),
parse_options_called_(false),
- system_bazelrc_path_(BAZEL_SYSTEM_BAZELRC_PATH) {}
+ system_bazelrc_path_("@bazelSystemBazelRCPath@") {}
OptionProcessor::OptionProcessor(
const WorkspaceLayout* workspace_layout,

View file

@ -0,0 +1,34 @@
{ lib, buildGoModule, fetchFromGitHub }:
buildGoModule rec {
pname = "bazel-buildtools";
version = "5.1.0";
src = fetchFromGitHub {
owner = "bazelbuild";
repo = "buildtools";
rev = version;
sha256 = "sha256-PNIqsP5p+OdYH0JgOmjqvge9zVOrAcNg0FMflXFJHwQ=";
};
vendorSha256 = "sha256-9WUjQhXWkpSEJj9Xq+9rOe3I1VZ7nqMTnX7DPl+rxsU=";
preBuild = ''
rm -r warn/docs
'';
doCheck = false;
excludedPackages = [ "generatetables" ];
ldflags = [ "-s" "-w" "-X main.buildVersion=${version}" "-X main.buildScmRevision=${src.rev}" ];
meta = with lib; {
description = "Tools for working with Google's bazel buildtool. Includes buildifier, buildozer, and unused_deps";
homepage = "https://github.com/bazelbuild/buildtools";
license = licenses.asl20;
maintainers = with maintainers;
[ elasticdog uri-canva marsam ]
++ lib.teams.bazel.members;
};
}

View file

@ -0,0 +1,53 @@
{
bazel
, bazelTest
, bazel-examples
, gccStdenv
, lib
, runLocal
, runtimeShell
, writeScript
, writeText
, distDir
}:
let
toolsBazel = writeScript "bazel" ''
#! ${runtimeShell}
export CXX='${gccStdenv.cc}/bin/g++'
export LD='${gccStdenv.cc}/bin/ld'
export CC='${gccStdenv.cc}/bin/gcc'
# XXX: hack for macosX, this flags disable bazel usage of xcode
# See: https://github.com/bazelbuild/bazel/issues/4231
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
exec "$BAZEL_REAL" "$@"
'';
workspaceDir = runLocal "our_workspace" {} (''
cp -r ${bazel-examples}/cpp-tutorial/stage3 $out
find $out -type d -exec chmod 755 {} \;
''
+ (lib.optionalString gccStdenv.isDarwin ''
mkdir $out/tools
cp ${toolsBazel} $out/tools/bazel
''));
testBazel = bazelTest {
name = "bazel-test-cpp";
inherit workspaceDir;
bazelPkg = bazel;
bazelScript = ''
${bazel}/bin/bazel \
build --verbose_failures \
--distdir=${distDir} \
--curses=no \
--sandbox_debug \
//...
'';
};
in testBazel

View file

@ -0,0 +1,62 @@
{
bazel
, bazelTest
, bazel-examples
, gccStdenv
, lib
, openjdk8
, jdk11_headless
, runLocal
, runtimeShell
, writeScript
, writeText
, distDir
}:
let
toolsBazel = writeScript "bazel" ''
#! ${runtimeShell}
export CXX='${gccStdenv.cc}/bin/g++'
export LD='${gccStdenv.cc}/bin/ld'
export CC='${gccStdenv.cc}/bin/gcc'
# XXX: hack for macosX, this flags disable bazel usage of xcode
# See: https://github.com/bazelbuild/bazel/issues/4231
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
exec "$BAZEL_REAL" "$@"
'';
workspaceDir = runLocal "our_workspace" {} (''
cp -r ${bazel-examples}/java-tutorial $out
find $out -type d -exec chmod 755 {} \;
''
+ (lib.optionalString gccStdenv.isDarwin ''
mkdir $out/tools
cp ${toolsBazel} $out/tools/bazel
''));
testBazel = bazelTest {
name = "bazel-test-java";
inherit workspaceDir;
bazelPkg = bazel;
buildInputs = [ (if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless) ];
bazelScript = ''
${bazel}/bin/bazel \
run \
--distdir=${distDir} \
--verbose_failures \
--curses=no \
--sandbox_debug \
//:ProjectRunner \
'' + lib.optionalString (lib.strings.versionOlder bazel.version "5.0.0") ''
--host_javabase='@local_jdk//:jdk' \
--java_toolchain='@bazel_tools//tools/jdk:toolchain_hostjdk8' \
--javabase='@local_jdk//:jdk' \
'';
};
in testBazel

View file

@ -0,0 +1,43 @@
diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
index 8e772005cd..6ffa1c919c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
@@ -432,25 +432,7 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
String content;
try {
content = FileSystemUtils.readContent(markerPath, StandardCharsets.UTF_8);
- String markerRuleKey = readMarkerFile(content, markerData);
- boolean verified = false;
- if (Preconditions.checkNotNull(ruleKey).equals(markerRuleKey)
- && Objects.equals(
- markerData.get(MANAGED_DIRECTORIES_MARKER),
- this.markerData.get(MANAGED_DIRECTORIES_MARKER))) {
- verified = handler.verifyMarkerData(rule, markerData, env);
- if (env.valuesMissing()) {
- return null;
- }
- }
-
- if (verified) {
- return new Fingerprint().addString(content).digestAndReset();
- } else {
- // So that we are in a consistent state if something happens while fetching the repository
- markerPath.delete();
- return null;
- }
+ return new Fingerprint().addString(content).digestAndReset();
} catch (IOException e) {
throw new RepositoryFunctionException(e, Transience.TRANSIENT);
}
diff --git a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
index c282d57ab6..f9b0c08627 100644
--- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
@@ -146,7 +146,6 @@ public class JavaSubprocessFactory implements SubprocessFactory {
ProcessBuilder builder = new ProcessBuilder();
builder.command(params.getArgv());
if (params.getEnv() != null) {
- builder.environment().clear();
builder.environment().putAll(params.getEnv());
}

View file

@ -0,0 +1,180 @@
{
bazel
, bazelTest
, fetchFromGitHub
, fetchurl
, gccStdenv
, lib
, openjdk8
, jdk11_headless
, runLocal
, runtimeShell
, writeScript
, writeText
, distDir
}:
let
com_google_protobuf = fetchFromGitHub {
owner = "protocolbuffers";
repo = "protobuf";
rev = "v3.13.0";
sha256 = "1nqsvi2yfr93kiwlinz8z7c68ilg1j75b2vcpzxzvripxx5h6xhd";
};
bazel_skylib = fetchFromGitHub {
owner = "bazelbuild";
repo = "bazel-skylib";
rev = "2ec2e6d715e993d96ad6222770805b5bd25399ae";
sha256 = "1z2r2vx6kj102zvp3j032djyv99ski1x1sl4i3p6mswnzrzna86s";
};
rules_python = fetchFromGitHub {
owner = "bazelbuild";
repo = "rules_python";
rev = "c8c79aae9aa1b61d199ad03d5fe06338febd0774";
sha256 = "1zn58wv5wcylpi0xj7riw34i1jjpqahanxx8y9srwrv0v93b6pqz";
};
rules_proto = fetchFromGitHub {
owner = "bazelbuild";
repo = "rules_proto";
rev = "a0761ed101b939e19d83b2da5f59034bffc19c12";
sha256 = "09lqfj5fxm1fywxr5w8pnpqd859gb6751jka9fhxjxjzs33glhqf";
};
net_zlib = fetchurl rec {
url = "https://zlib.net/zlib-1.2.11.tar.gz";
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1";
passthru.sha256 = sha256;
};
WORKSPACE = writeText "WORKSPACE" ''
workspace(name = "our_workspace")
load("//:proto-support.bzl", "protobuf_deps")
protobuf_deps()
load("@rules_proto//proto:repositories.bzl", "rules_proto_toolchains")
rules_proto_toolchains()
'';
protoSupport = writeText "proto-support.bzl" ''
"""Load dependencies needed to compile the protobuf library as a 3rd-party consumer."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def protobuf_deps():
"""Loads common dependencies needed to compile the protobuf library."""
if "zlib" not in native.existing_rules():
# proto_library, cc_proto_library, and java_proto_library rules implicitly
# depend on @com_google_protobuf for protoc and proto runtimes.
# This statement defines the @com_google_protobuf repo.
native.local_repository(
name = "com_google_protobuf",
path = "${com_google_protobuf}",
)
native.local_repository(
name = "bazel_skylib",
path = "${bazel_skylib}",
)
native.local_repository(
name = "rules_proto",
path = "${rules_proto}",
)
native.local_repository(
name = "rules_python",
path = "${rules_python}",
)
http_archive(
name = "zlib",
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
sha256 = "${net_zlib.sha256}",
strip_prefix = "zlib-1.2.11",
urls = ["file://${net_zlib}"],
)
'';
personProto = writeText "person.proto" ''
syntax = "proto3";
package person;
message Person {
string name = 1;
int32 id = 2;
string email = 3;
}
'';
personBUILD = writeText "BUILD" ''
load("@rules_proto//proto:defs.bzl", "proto_library")
proto_library(
name = "person_proto",
srcs = ["person.proto"],
visibility = ["//visibility:public"],
)
java_proto_library(
name = "person_java_proto",
deps = [":person_proto"],
)
cc_proto_library(
name = "person_cc_proto",
deps = [":person_proto"],
)
'';
toolsBazel = writeScript "bazel" ''
#! ${runtimeShell}
export CXX='${gccStdenv.cc}/bin/g++'
export LD='${gccStdenv.cc}/bin/ld'
export CC='${gccStdenv.cc}/bin/gcc'
# XXX: hack for macosX, this flags disable bazel usage of xcode
# See: https://github.com/bazelbuild/bazel/issues/4231
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
exec "$BAZEL_REAL" "$@"
'';
workspaceDir = runLocal "our_workspace" {} (''
mkdir $out
cp ${WORKSPACE} $out/WORKSPACE
touch $out/BUILD.bazel
cp ${protoSupport} $out/proto-support.bzl
mkdir $out/person
cp ${personProto} $out/person/person.proto
cp ${personBUILD} $out/person/BUILD.bazel
''
+ (lib.optionalString gccStdenv.isDarwin ''
mkdir $out/tools
cp ${toolsBazel} $out/tools/bazel
''));
testBazel = bazelTest {
name = "bazel-test-protocol-buffers";
inherit workspaceDir;
bazelPkg = bazel;
buildInputs = [ (if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless) ];
bazelScript = ''
${bazel}/bin/bazel \
build \
--distdir=${distDir} \
--verbose_failures \
--curses=no \
--sandbox_debug \
//... \
'' + lib.optionalString (lib.strings.versionOlder bazel.version "5.0.0") ''
--host_javabase='@local_jdk//:jdk' \
--java_toolchain='@bazel_tools//tools/jdk:toolchain_hostjdk8' \
--javabase='@local_jdk//:jdk' \
'';
};
in testBazel

View file

@ -0,0 +1,53 @@
{ writeText, bazel, bazelTest, runLocal, distDir }:
let
WORKSPACE = writeText "WORKSPACE" ''
workspace(name = "our_workspace")
'';
pythonLib = writeText "lib.py" ''
def foo():
return 43
'';
pythonBin = writeText "bin.py" ''
from lib import foo
assert foo() == 43
'';
pythonBUILD = writeText "BUILD" ''
py_library(
name = "lib",
srcs = [ "lib.py" ],
)
py_binary(
name = "bin",
srcs = [ "bin.py" ],
deps = [ ":lib" ],
)
'';
workspaceDir = runLocal "our_workspace" {} ''
mkdir $out
cp ${WORKSPACE} $out/WORKSPACE
mkdir $out/python
cp ${pythonLib} $out/python/lib.py
cp ${pythonBin} $out/python/bin.py
cp ${pythonBUILD} $out/python/BUILD.bazel
'';
testBazel = bazelTest {
name = "bazel-test-builtin-rules";
inherit workspaceDir;
bazelPkg = bazel;
bazelScript = ''
${bazel}/bin/bazel \
run \
--distdir=${distDir} \
//python:bin
'';
};
in testBazel

View file

@ -0,0 +1,49 @@
{
bazel
, bazelTest
, distDir
, extracted
, runLocal
, unzip
}:
# Tests that all shebangs are patched appropriately.
# #!/usr/bin/... should be replaced by Nix store references.
# #!.../bin/env python should be replaced by Nix store reference to the python interpreter.
let
workspaceDir = runLocal "our_workspace" {} "mkdir $out";
testBazel = bazelTest {
name = "bazel-test-shebangs";
inherit workspaceDir;
bazelPkg = bazel;
bazelScript = ''
set -ueo pipefail
FAIL=
check_shebangs() {
local dir="$1"
{ grep -Re '#!/usr/bin' $dir && FAIL=1; } || true
{ grep -Re '#![^[:space:]]*/bin/env' $dir && FAIL=1; } || true
}
BAZEL_EXTRACTED=${extracted bazel}/install
check_shebangs $BAZEL_EXTRACTED
while IFS= read -r -d "" zip; do
unzipped="./$zip/UNPACKED"
mkdir -p "$unzipped"
unzip -qq $zip -d "$unzipped"
check_shebangs "$unzipped"
rm -rf unzipped
done < <(find $BAZEL_EXTRACTED -type f -name '*.zip' -or -name '*.jar' -print0)
if [[ $FAIL = 1 ]]; then
echo "Found files in the bazel distribution with illegal shebangs." >&2
echo "Replace those by explicit Nix store paths." >&2
echo "Python scripts should not use \`bin/env python' but the Python interpreter's store path." >&2
exit 1
fi
'';
buildInputs = [ unzip ];
};
in testBazel

View file

@ -0,0 +1,13 @@
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
index a70b5559bc..10bdffe961 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
@@ -466,7 +466,7 @@ public class BazelRuleClassProvider {
// Note that --action_env does not propagate to the host config, so it is not a viable
// workaround when a genrule is itself built in the host config (e.g. nested genrules). See
// #8536.
- return "/bin:/usr/bin:/usr/local/bin";
+ return "@strictActionEnvPatch@";
}
String newPath = "";

View file

@ -0,0 +1,37 @@
From 177b4720d6fbaa7fdd17e5e11b2c79ac8f246786 Mon Sep 17 00:00:00 2001
From: "Wael M. Nasreddine" <wael.nasreddine@gmail.com>
Date: Thu, 27 Jun 2019 21:08:51 -0700
Subject: [PATCH] Trim last argument to gcc if empty, on Darwin
On Darwin, the last argument to GCC is coming up as an empty string.
This is breaking the build of proto_library targets. However, I was not
able to reproduce with the example cpp project[0].
This commit removes the last argument if it's an empty string. This is
not a problem on Linux.
[0]: https://github.com/bazelbuild/examples/tree/master/cpp-tutorial/stage3
---
tools/cpp/osx_cc_wrapper.sh.tpl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/cpp/osx_cc_wrapper.sh.tpl b/tools/cpp/osx_cc_wrapper.sh.tpl
index 4c85cd9b6b..6c611e3d25 100644
--- a/tools/cpp/osx_cc_wrapper.sh.tpl
+++ b/tools/cpp/osx_cc_wrapper.sh.tpl
@@ -53,7 +53,11 @@ done
%{env}
# Call the C++ compiler
-%{cc} "$@"
+if [[ ${*: -1} = "" ]]; then
+ %{cc} "${@:0:$#}"
+else
+ %{cc} "$@"
+fi
function get_library_path() {
for libdir in ${LIB_DIRS}; do
--
2.19.2

View file

@ -0,0 +1,62 @@
#!/usr/bin/env python3
import sys
import json
if len(sys.argv) == 1:
print("usage: ./this-script WORKSPACE", file=sys.stderr)
print("Takes the bazel WORKSPACE file and reads all archives into a json dict (by evaling it as python code)", file=sys.stderr)
print("Hail Eris.", file=sys.stderr)
sys.exit(1)
http_archives = []
# just the kw args are the dict { name, sha256, urls … }
def http_archive(**kw):
http_archives.append(kw)
# like http_file
def http_file(**kw):
http_archives.append(kw)
# this is inverted from http_archive/http_file and bundles multiple archives
def distdir_tar(**kw):
for archive_name in kw['archives']:
http_archives.append({
"name": archive_name,
"sha256": kw['sha256'][archive_name],
"urls": kw['urls'][archive_name]
})
# stubs for symbols we are not interested in
# might need to be expanded if new bazel releases add symbols to the workspace
def workspace(name): pass
def load(*args): pass
def bind(**kw): pass
def list_source_repository(**kw): pass
def new_local_repository(**kw): pass
def local_repository(**kw): pass
DOC_VERSIONS = []
def stardoc_repositories(**kw): pass
def skydoc_repositories(**kw): pass
def rules_sass_dependencies(**kw): pass
def node_repositories(**kw): pass
def sass_repositories(**kw): pass
def register_execution_platforms(*args): pass
def rbe_autoconfig(*args, **kw): pass
def rules_pkg_dependencies(*args, **kw): pass
def winsdk_configure(*args, **kw): pass
def register_local_rc_exe_toolchains(*args, **kw): pass
def register_toolchains(*args, **kw): pass
def debian_deps(): pass
def grpc_deps(): pass
def grpc_extra_deps(): pass
def bazel_skylib_workspace(): pass
# execute the WORKSPACE like it was python code in this module,
# using all the function stubs from above.
with open(sys.argv[1]) as f:
exec(f.read())
# transform to a dict with the names as keys
d = { el['name']: el for el in http_archives }
print(json.dumps(d, sort_keys=True, indent=4))

View file

@ -0,0 +1,62 @@
{ lib, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, grpc
, protobuf
, openssl
, nlohmann_json
, gtest
, spdlog
, c-ares
, abseil-cpp
, zlib
, sqlite
, re2
}:
stdenv.mkDerivation rec {
pname = "bear";
version = "3.0.14";
src = fetchFromGitHub {
owner = "rizsotto";
repo = pname;
rev = version;
sha256 = "0qy96dyd29bjvfhi46y30hli5cvshw8am0spvcv9v43660wbczd7";
};
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [
grpc
protobuf
openssl
nlohmann_json
gtest
spdlog
c-ares
abseil-cpp
zlib
sqlite
re2
];
patches = [
# Default libexec would be set to /nix/store/*-bear//nix/store/*-bear/libexec/...
./no-double-relative.patch
];
meta = with lib; {
description = "Tool that generates a compilation database for clang tooling";
longDescription = ''
Note: the bear command is very useful to generate compilation commands
e.g. for YouCompleteMe. You just enter your development nix-shell
and run `bear make`. It's not perfect, but it gets a long way.
'';
homepage = "https://github.com/rizsotto/Bear";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ babariviere qyliss ];
};
}

View file

@ -0,0 +1,22 @@
diff --git i/source/config.h.in w/source/config.h.in
index ffcce3a..0caba6d 100644
--- i/source/config.h.in
+++ w/source/config.h.in
@@ -107,7 +107,7 @@ namespace cmd {
}
namespace wrapper {
- constexpr char DEFAULT_PATH[] = "@ROOT_INSTALL_PREFIX@/@PRIVATE_INSTALLDIR@/wrapper";
+ constexpr char DEFAULT_PATH[] = "@PRIVATE_INSTALLDIR@/wrapper";
constexpr char DEFAULT_DIR_PATH[] = "@ROOT_INSTALL_PREFIX@/@PRIVATE_INSTALLDIR@/wrapper.d";
constexpr char FLAG_VERBOSE[] = "--verbose";
@@ -120,7 +120,7 @@ namespace cmd {
}
namespace library {
- constexpr char DEFAULT_PATH[] = "@ROOT_INSTALL_PREFIX@/@PRIVATE_INSTALLDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@exec@CMAKE_SHARED_LIBRARY_SUFFIX@";
+ constexpr char DEFAULT_PATH[] = "@PRIVATE_INSTALLDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@exec@CMAKE_SHARED_LIBRARY_SUFFIX@";
constexpr char KEY_REPORTER[] = "INTERCEPT_REPORT_COMMAND";
constexpr char KEY_DESTINATION[] = "INTERCEPT_REPORT_DESTINATION";

View file

@ -0,0 +1,71 @@
{ stdenv
, fetchurl
, autoPatchelfHook
, installShellFiles
, makeWrapper
, jre
, lib
, zlib
}:
stdenv.mkDerivation rec {
pname = "bloop";
version = "1.5.0";
platform =
if stdenv.isLinux && stdenv.isx86_64 then "x86_64-pc-linux"
else if stdenv.isDarwin && stdenv.isx86_64 then "x86_64-apple-darwin"
else throw "unsupported platform";
bloop-bash = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bash-completions";
sha256 = "sha256-2mt+zUEJvQ/5ixxFLZ3Z0m7uDSj/YE9sg/uNMjamvdE=";
};
bloop-fish = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/fish-completions";
sha256 = "sha256-eFESR6iPHRDViGv+Fk3sCvPgVAhk2L1gCG4LnfXO/v4=";
};
bloop-zsh = fetchurl {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/zsh-completions";
sha256 = "sha256-WNMsPwBfd5EjeRbRtc06lCEVI2FVoLfrqL82OR0G7/c=";
};
bloop-binary = fetchurl rec {
url = "https://github.com/scalacenter/bloop/releases/download/v${version}/bloop-${platform}";
sha256 =
if stdenv.isLinux && stdenv.isx86_64 then "sha256-jif9z05W17vjFgb146qWC3o44HmbnX05gWPlbXttYsE="
else if stdenv.isDarwin && stdenv.isx86_64 then "sha256-YOnXgKXsGrTu9P4I0NZW6ollZVQUXnbW8WtZTJmy+w0="
else throw "unsupported platform";
};
dontUnpack = true;
nativeBuildInputs = [ installShellFiles makeWrapper ]
++ lib.optional stdenv.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib zlib ];
propagatedBuildInputs = [ jre ];
installPhase = ''
runHook preInstall
install -D -m 0755 ${bloop-binary} $out/.bloop-wrapped
makeWrapper $out/.bloop-wrapped $out/bin/bloop
#Install completions
installShellCompletion --name bloop --bash ${bloop-bash}
installShellCompletion --name _bloop --zsh ${bloop-zsh}
installShellCompletion --name bloop.fish --fish ${bloop-fish}
runHook postInstall
'';
meta = with lib; {
homepage = "https://scalacenter.github.io/bloop/";
license = licenses.asl20;
description = "A Scala build server and command-line tool to make the compile and test developer workflows fast and productive in a build-tool-agnostic way";
platforms = [ "x86_64-linux" "x86_64-darwin" ];
maintainers = with maintainers; [ kubukoz tomahna ];
};
}

View file

@ -0,0 +1,10 @@
--- bmake/make-bootstrap.sh.in.orig 2019-02-19 10:55:21.733606117 -0800
+++ bmake/make-bootstrap.sh.in 2019-02-19 10:56:02.150771541 -0800
@@ -4,6 +4,7 @@
srcdir=@srcdir@
+prefix="@prefix@"
DEFAULT_SYS_PATH="@default_sys_path@"
case "@use_meta@" in

View file

@ -0,0 +1,113 @@
{ lib
, stdenv
, fetchurl
, fetchpatch
, getopt
, tzdata
, ksh
, pkgsMusl # for passthru.tests
}:
stdenv.mkDerivation rec {
pname = "bmake";
version = "20220208";
src = fetchurl {
url = "http://www.crufty.net/ftp/pub/sjg/${pname}-${version}.tar.gz";
hash = "sha256-ewDB4UYrLh5Upk2ND88n/HfursPxOSDv+NlST/BZ1to=";
};
# Make tests work with musl
# * Disable deptgt-delete_on_error test (alpine does this too)
# * Disable shell-ksh test (ksh doesn't compile with musl)
# * Fix test failing due to different strerror(3) output for musl and glibc
postPatch = lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
sed -i unit-tests/Makefile \
-e '/deptgt-delete_on_error/d' \
-e '/shell-ksh/d'
substituteInPlace unit-tests/opt-chdir.exp --replace "File name" "Filename"
'';
nativeBuildInputs = [ getopt ];
patches = [
# make bootstrap script aware of the prefix in /nix/store
./bootstrap-fix.patch
# preserve PATH from build env in unit tests
./fix-unexport-env-test.patch
# Always enable ksh test since it checks in a impure location /bin/ksh
./unconditional-ksh-test.patch
# decouple tests from build phase
(fetchpatch {
name = "separate-tests.patch";
url = "https://raw.githubusercontent.com/alpinelinux/aports/2a36f7b79df44136c4d2b8e9512f908af65adfee/community/bmake/separate-tests.patch";
sha256 = "00s76jwyr83c6rkvq67b1lxs8jhm0gj2rjgy77xazqr5400slj9a";
})
# add a shebang to bmake's install(1) replacement
(fetchpatch {
name = "install-sh.patch";
url = "https://raw.githubusercontent.com/alpinelinux/aports/34cd8c45397c63c041cf3cbe1ba5232fd9331196/community/bmake/install-sh.patch";
sha256 = "0z8icd6akb96r4cksqnhynkn591vbxlmrrs4w6wil3r6ggk6mwa6";
})
];
# The generated makefile is a small wrapper for calling ./boot-strap with a
# given op. On a case-insensitive filesystem this generated makefile clobbers
# a distinct, shipped, Makefile and causes infinite recursion during tests
# which eventually fail with "fork: Resource temporarily unavailable"
configureFlags = [
"--without-makefile"
];
# Disabled tests:
# varmod-localtime: musl doesn't support TZDIR and this test relies on impure,
# implicit paths
# opt-chdir: ofborg complains about it somehow
BROKEN_TESTS = "varmod-localtime opt-chdir";
buildPhase = ''
runHook preBuild
./boot-strap --prefix=$out -o . op=build
runHook postBuild
'';
installPhase = ''
runHook preInstall
./boot-strap --prefix=$out -o . op=install
runHook postInstall
'';
doCheck = true;
checkInputs = [
tzdata
] ++ lib.optionals (stdenv.hostPlatform.libc != "musl") [
ksh
];
checkPhase = ''
runHook preCheck
./boot-strap -o . op=test
runHook postCheck
'';
setupHook = ./setup-hook.sh;
meta = with lib; {
homepage = "http://www.crufty.net/help/sjg/bmake.html";
description = "Portable version of NetBSD 'make'";
license = licenses.bsd3;
maintainers = with maintainers; [ thoughtpolice AndersonTorres ];
platforms = platforms.unix;
broken = stdenv.isAarch64; # ofborg complains
};
passthru.tests.bmakeMusl = pkgsMusl.bmake;
}
# TODO: report the quirks and patches to bmake devteam (especially the Musl one)

View file

@ -0,0 +1,23 @@
--- bmake/unit-tests/Makefile.orig 2021-05-30 14:24:38.822484317 +0200
+++ bmake/unit-tests/Makefile 2021-05-31 13:25:21.645751428 +0200
@@ -455,7 +455,8 @@
ENV.varmisc= FROM_ENV=env
ENV.varmisc+= FROM_ENV_BEFORE=env
ENV.varmisc+= FROM_ENV_AFTER=env
-ENV.varmod-localtime+= TZ=Europe/Berlin
+# Set absolute path to tz file since musl doesn't support TZDIR
+ENV.varmod-localtime+= TZDIR=${TZDIR} TZ=:${TZDIR}/Europe/Berlin
ENV.varname-vpath+= VPATH=varname-vpath.dir:varname-vpath.dir2
# Override make flags for some of the tests; default is -k.
--- bmake/unit-tests/varmod-localtime.mk.orig 2021-05-30 14:30:34.397986246 +0200
+++ bmake/unit-tests/varmod-localtime.mk 2021-05-31 13:24:41.430906606 +0200
@@ -3,7 +3,7 @@
# Tests for the :localtime variable modifier, which formats a timestamp
# using strftime(3) in local time.
-.if ${TZ} != "Europe/Berlin" # see unit-tests/Makefile
+.if ${TZ} != ":${TZDIR}/Europe/Berlin" # see unit-tests/Makefile
. error
.endif

View file

@ -0,0 +1,13 @@
--- bmake/unit-tests/unexport-env.mk.orig 2021-05-27 14:44:45.263392298 +0200
+++ bmake/unit-tests/unexport-env.mk 2021-05-27 14:46:46.188881996 +0200
@@ -4,8 +4,8 @@
FILTER_CMD= grep ^UT_
.include "export.mk"
-# an example of setting up a minimal environment.
-PATH= /bin:/usr/bin:/sbin:/usr/sbin
+# preserve PATH so commands used in the "all" target are still available
+PATH := ${PATH}
# now clobber the environment to just PATH and UT_TEST
UT_TEST= unexport-env

View file

@ -0,0 +1,127 @@
addMakeFlags() {
export prefix="$out"
export MANDIR="${!outputMan}/share/man"
export MANTARGET=man
export BINOWN=
export STRIP_FLAG=
}
preConfigureHooks+=(addMakeFlags)
bmakeBuildPhase() {
runHook preBuild
local flagsArray=(
${enableParallelBuilding:+-j${NIX_BUILD_CORES}}
SHELL=$SHELL
$makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
$buildFlags ${buildFlagsArray+"${buildFlagsArray[@]}"}
)
echoCmd 'build flags' "${flagsArray[@]}"
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
unset flagsArray
runHook postBuild
}
if [ -z "${dontUseBmakeBuild-}" -a -z "${buildPhase-}" ]; then
buildPhase=bmakeBuildPhase
fi
bmakeCheckPhase() {
runHook preCheck
if [ -z "${checkTarget:-}" ]; then
#TODO(@oxij): should flagsArray influence make -n?
if bmake -n ${makefile:+-f $makefile} check >/dev/null 2>&1; then
checkTarget=check
elif bmake -n ${makefile:+-f $makefile} test >/dev/null 2>&1; then
checkTarget=test
fi
fi
if [ -z "${checkTarget:-}" ]; then
echo "no test target found in bmake, doing nothing"
else
# shellcheck disable=SC2086
local flagsArray=(
${enableParallelChecking:+-j${NIX_BUILD_CORES}}
SHELL=$SHELL
# Old bash empty array hack
$makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"}
${checkTarget}
)
echoCmd 'check flags' "${flagsArray[@]}"
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
unset flagsArray
fi
runHook postCheck
}
if [ -z "${dontUseBmakeCheck-}" -a -z "${checkPhase-}" ]; then
checkPhase=bmakeCheckPhase
fi
bmakeInstallPhase() {
runHook preInstall
if [ -n "$prefix" ]; then
mkdir -p "$prefix"
fi
# shellcheck disable=SC2086
local flagsArray=(
SHELL=$SHELL
# Old bash empty array hack
$makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
$installFlags ${installFlagsArray+"${installFlagsArray[@]}"}
${installTargets:-install}
)
echoCmd 'install flags' "${flagsArray[@]}"
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
unset flagsArray
runHook postInstall
}
if [ -z "${dontUseBmakeInstall-}" -a -z "${installPhase-}" ]; then
installPhase=bmakeInstallPhase
fi
bmakeDistPhase() {
runHook preDist
if [ -n "$prefix" ]; then
mkdir -p "$prefix"
fi
# Old bash empty array hack
# shellcheck disable=SC2086
local flagsArray=(
$distFlags ${distFlagsArray+"${distFlagsArray[@]}"} ${distTarget:-dist}
)
echo 'dist flags: %q' "${flagsArray[@]}"
bmake ${makefile:+-f $makefile} "${flagsArray[@]}"
if [ "${dontCopyDist:-0}" != 1 ]; then
mkdir -p "$out/tarballs"
# Note: don't quote $tarballs, since we explicitly permit
# wildcards in there.
# shellcheck disable=SC2086
cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs"
fi
runHook postDist
}
if [ -z "${dontUseBmakeDist-}" -a -z "${distPhase-}" ]; then
distPhase=bmakeDistPhase
fi

View file

@ -0,0 +1,12 @@
--- bmake/unit-tests/Makefile.orig 2021-07-04 19:13:09.068094922 +0200
+++ bmake/unit-tests/Makefile 2021-07-04 19:13:14.630080696 +0200
@@ -295,9 +295,7 @@
TESTS+= sh-single-line
TESTS+= shell-csh
TESTS+= shell-custom
-.if exists(/bin/ksh)
TESTS+= shell-ksh
-.endif
TESTS+= shell-sh
TESTS+= suff-add-later
TESTS+= suff-clear-regular

View file

@ -0,0 +1,13 @@
source $stdenv/setup
boot_bin=$out/bin/boot
mkdir -pv $(dirname $boot_bin)
cp -v $src $boot_bin
chmod -v 755 $boot_bin
patchShebangs $boot_bin
sed -i \
-e "s;\${BOOT_JAVA_COMMAND:-java};\${BOOT_JAVA_COMMAND:-${jdk}/bin/java};g" \
$boot_bin

View file

@ -0,0 +1,25 @@
{ lib, stdenv, fetchurl, jdk }:
stdenv.mkDerivation rec {
version = "2.7.2";
pname = "boot";
src = fetchurl {
url = "https://github.com/boot-clj/boot-bin/releases/download/${version}/boot.sh";
sha256 = "1hqp3xxmsj5vkym0l3blhlaq9g3w0lhjgmp37g6y3rr741znkk8c";
};
inherit jdk;
builder = ./builder.sh;
propagatedBuildInputs = [ jdk ];
meta = with lib; {
description = "Build tooling for Clojure";
homepage = "https://boot-clj.github.io/";
license = licenses.epl10;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ ragge ];
};
}

View file

@ -0,0 +1,44 @@
{ lib, stdenv, fetchFromGitHub, jdk8, ant, python3, watchman, bash, makeWrapper }:
stdenv.mkDerivation rec {
pname = "buck";
version = "2021.05.05.01";
src = fetchFromGitHub {
owner = "facebook";
repo = pname;
rev = "v${version}";
sha256 = "sha256-mASJCLxW7320MXYUUWYfaxs9AbSdltxlae8OQsPUZJc=";
};
patches = [ ./pex-mtime.patch ];
postPatch = ''
grep -l -r '/bin/bash' --null | xargs -0 sed -i -e "s!/bin/bash!${bash}/bin/bash!g"
'';
nativeBuildInputs = [ makeWrapper python3 jdk8 ant watchman ];
buildPhase = ''
# Set correct version, see https://github.com/facebook/buck/issues/2607
echo v${version} > .buckrelease
ant
PYTHONDONTWRITEBYTECODE=true ./bin/buck build -c buck.release_version=${version} buck
'';
installPhase = ''
install -D -m755 buck-out/gen/*/programs/buck.pex $out/bin/buck
wrapProgram $out/bin/buck \
--prefix PATH : "${lib.makeBinPath [ jdk8 watchman python3 ]}"
'';
meta = with lib; {
homepage = "https://buck.build/";
description = "A high-performance build tool";
maintainers = [ maintainers.jgertm maintainers.marsam ];
license = licenses.asl20;
platforms = platforms.all;
};
}

View file

@ -0,0 +1,13 @@
diff --git a/third-party/py/pex/pex/common.py b/third-party/py/pex/pex/common.py
index 76459ce23..eff411b20 100644
--- a/third-party/py/pex/pex/common.py
+++ b/third-party/py/pex/pex/common.py
@@ -328,4 +328,7 @@ class Chroot(object):
def zip(self, filename, mode='wb'):
with contextlib.closing(zipfile.ZipFile(filename, mode)) as zf:
for f in sorted(self.files()):
- zf.write(os.path.join(self.chroot, f), arcname=f, compress_type=zipfile.ZIP_DEFLATED)
+ path = os.path.join(self.chroot, f)
+ instant = 615532801
+ os.utime(path, (instant, instant))
+ zf.write(path, arcname=f, compress_type=zipfile.ZIP_DEFLATED)

View file

@ -0,0 +1,50 @@
{ lib, stdenv
, build2
, fetchurl
, libbpkg
, libbutl
, libodb
, libodb-sqlite
, enableShared ? !stdenv.hostPlatform.isStatic
, enableStatic ? !enableShared
}:
stdenv.mkDerivation rec {
pname = "bdep";
version = "0.14.0";
outputs = [ "out" "doc" "man" ];
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/bdep-${version}.tar.gz";
sha256 = "sha256-sizrGmSixkkJL9nocA4B1I5n9OySxyuZ2bNc1Z4zmPg=";
};
strictDeps = true;
nativeBuildInputs = [
build2
];
buildInputs = [
libbpkg
libbutl
libodb
libodb-sqlite
];
build2ConfigureFlags = [
"config.bin.lib=${build2.configSharedStatic enableShared enableStatic}"
];
meta = with lib; {
description = "build2 project dependency manager";
# https://build2.org/bdep/doc/bdep.xhtml
longDescription = ''
The build2 project dependency manager is used to manage the dependencies
of a project during development.
'';
homepage = "https://build2.org/";
changelog = "https://git.build2.org/cgit/bdep/tree/NEWS";
license = licenses.mit;
maintainers = with maintainers; [ r-burns ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,44 @@
{ lib, stdenv
, fetchurl
, pkgs
, fixDarwinDylibNames
}:
stdenv.mkDerivation rec {
pname = "build2-bootstrap";
version = "0.14.0";
src = fetchurl {
url = "https://download.build2.org/${version}/build2-toolchain-${version}.tar.xz";
sha256 = "sha256-GO/GstQUmPdRbnqKXJECP2GCyGfUI3kjmDkN0MAEz90=";
};
patches = [
# Pick up sysdirs from NIX_LDFLAGS
./nix-ldflags-sysdirs.patch
];
sourceRoot = "build2-toolchain-${version}/build2";
makefile = "bootstrap.gmake";
enableParallelBuilding = true;
setupHook = ./setup-hook.sh;
strictDeps = true;
propagatedBuildInputs = lib.optionals stdenv.targetPlatform.isDarwin [
fixDarwinDylibNames
];
doCheck = true;
checkPhase = ''
runHook preCheck
build2/b-boot --version
runHook postCheck
'';
installPhase = ''
runHook preInstall
install -D build2/b-boot $out/bin/b
runHook postInstall
'';
inherit (pkgs.build2) passthru;
}

View file

@ -0,0 +1,64 @@
{ lib, stdenv
, build2
, fetchurl
, git
, libbpkg
, libbutl
, libodb
, libodb-sqlite
, openssl
, enableShared ? !stdenv.hostPlatform.isStatic
, enableStatic ? !enableShared
}:
stdenv.mkDerivation rec {
pname = "bpkg";
version = "0.14.0";
outputs = [ "out" "doc" "man" ];
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/bpkg-${version}.tar.gz";
sha256 = "sha256-4WTFm0NYZOujxQ3PR9MyjXEJ4ql4qZ9OM5BePuHIK1M=";
};
strictDeps = true;
nativeBuildInputs = [
build2
];
buildInputs = [
libbpkg
libbutl
libodb
libodb-sqlite
];
checkInputs = [
git
openssl
];
doCheck = !stdenv.isDarwin; # tests hang
# Failing test
postPatch = ''
rm tests/rep-create.testscript
'';
build2ConfigureFlags = [
"config.bin.lib=${build2.configSharedStatic enableShared enableStatic}"
];
meta = with lib; {
description = "build2 package dependency manager";
# https://build2.org/bpkg/doc/bpkg.xhtml
longDescription = ''
The build2 package dependency manager is used to manipulate build
configurations, packages, and repositories.
'';
homepage = "https://build2.org/";
changelog = "https://git.build2.org/cgit/bpkg/tree/NEWS";
license = licenses.mit;
maintainers = with maintainers; [ r-burns ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,99 @@
{ stdenv, lib
, build2
, fetchurl
, fixDarwinDylibNames
, libbutl
, libpkgconf
, enableShared ? !stdenv.hostPlatform.isStatic
, enableStatic ? !enableShared
}:
let
configSharedStatic = enableShared: enableStatic:
if enableShared && enableStatic then "both"
else if enableShared then "shared"
else if enableStatic then "static"
else throw "neither shared nor static libraries requested";
in
stdenv.mkDerivation rec {
pname = "build2";
version = "0.14.0";
outputs = [ "out" "dev" "doc" "man" ];
setupHook = ./setup-hook.sh;
src = fetchurl {
url = "https://pkg.cppget.org/1/alpha/build2/build2-${version}.tar.gz";
sha256 = "sha256-/pWj68JmBthOJ2CTQHo9Ww3MCv4xBOw0SusJpMfX5Y8=";
};
patches = [
# Remove any build/host config entries which refer to nix store paths
./remove-config-store-paths.patch
# Pick up sysdirs from NIX_LDFLAGS
./nix-ldflags-sysdirs.patch
];
strictDeps = true;
nativeBuildInputs = [
build2
];
disallowedReferences = [
build2
libbutl.dev
libpkgconf.dev
];
buildInputs = [
libbutl
libpkgconf
];
# Build2 uses @rpath on darwin
# https://github.com/build2/build2/issues/166
# N.B. this only adjusts the install_name after all libraries are installed;
# packages containing multiple interdependent libraries may have
# LC_LOAD_DYLIB entries containing @rpath, requiring manual fixup
propagatedBuildInputs = lib.optionals stdenv.targetPlatform.isDarwin [
fixDarwinDylibNames
];
postPatch = ''
patchShebangs --build tests/bash/testscript
'';
build2ConfigureFlags = [
"config.bin.lib=${configSharedStatic enableShared enableStatic}"
"config.cc.poptions+=-I${lib.getDev libpkgconf}/include/pkgconf"
];
postInstall = lib.optionalString stdenv.isDarwin ''
install_name_tool -add_rpath "''${!outputLib}/lib" "''${!outputBin}/bin/b"
'';
passthru = {
bootstrap = build2;
inherit configSharedStatic;
};
meta = with lib; {
homepage = "https://www.build2.org/";
description = "build2 build system";
license = licenses.mit;
longDescription = ''
build2 is an open source (MIT), cross-platform build toolchain
that aims to approximate Rust Cargo's convenience for developing
and packaging C/C++ projects while providing more depth and
flexibility, especially in the build system.
build2 is a hierarchy of tools consisting of a general-purpose
build system, package manager (for package consumption), and
project manager (for project development). It is primarily aimed
at C/C++ projects as well as mixed-language projects involving
one of these languages (see bash and rust modules, for example).
'';
changelog = "https://git.build2.org/cgit/build2/tree/NEWS";
platforms = platforms.all;
maintainers = with maintainers; [ hiro98 r-burns ];
mainProgram = "b";
};
}

View file

@ -0,0 +1,42 @@
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index f848003c..0f14f9a5 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -966,6 +966,17 @@ namespace build2
void
msvc_extract_library_search_dirs (const strings&, dir_paths&); // msvc.cxx
+ static strings split (const string& s, const char delim) {
+ stringstream ss (s);
+ string item;
+ strings result;
+
+ while (getline (ss, item, delim)) {
+ result.push_back (item);
+ }
+ return result;
+ }
+
dir_paths common::
extract_library_search_dirs (const scope& bs) const
{
@@ -987,8 +998,19 @@ namespace build2
msvc_extract_library_search_dirs (v, r);
else
gcc_extract_library_search_dirs (v, r);
+
};
+ // NIX_LDFLAGS are implicitly used when linking,
+ // so its -L flags effectively specify system dirs.
+ // However, they are only enabled when actually linking and are thus
+ // not detected by build2, so we need to manually pick them up here.
+ if (auto s = getenv ("NIX_LDFLAGS")) {
+ // TODO: do we need more robust args splitting here? e.g. shlex.split
+ auto args = split (s.value (), ' ');
+ gcc_extract_library_search_dirs (args, r);
+ }
+
// Note that the compiler mode options are in sys_lib_dirs.
//
if (auto l = bs[c_loptions]) extract (*l, c_loptions);

View file

@ -0,0 +1,14 @@
--- a/libbuild2/buildfile
+++ b/libbuild2/buildfile
@@ -73,7 +73,11 @@ config/cxx{host-config}: config/in{host-config}
#
build2_config = $regex.replace_lines( \
+ $regex.replace_lines( \
$config.save(), \
'^ *(#|(config\.(dist\.|install\.chroot|config\.hermetic))).*$', \
[null], \
+ return_lines), \
+ '^.*'$getenv(NIX_STORE)'/[a-z0-9]{32}-.*$', \
+ [null], \
return_lines)

View file

@ -0,0 +1,85 @@
build2ConfigurePhase() {
runHook preConfigure
local flagsArray=(
"config.c=$CC"
"config.cxx=$CXX"
"config.cc.coptions+=-O2"
"config.cc.poptions+=-DNDEBUG"
"config.install.root=$prefix"
"config.install.bin=${!outputBin}/bin"
"config.install.doc=${!outputDoc}/share/doc/${shareDocName}"
"config.install.exec_root=${!outputBin}"
"config.install.include=${!outputInclude}/include"
"config.install.lib=${!outputLib}/lib"
"config.install.libexec=${!outputLib}/libexec"
"config.install.man=${!outputDoc}/share/man"
"config.install.sbin=${!outputBin}/sbin"
"config.install.bin.mode=755"
$build2ConfigureFlags "${build2ConfigureFlagsArray[@]}"
)
echo 'configure flags' "${flagsArray[@]}"
b configure "${flagsArray[@]}"
runHook postConfigure
}
build2BuildPhase() {
runHook preBuild
local flagsArray=(
$build2BuildFlags "${build2BuildFlagsArray[@]}"
)
echo 'build flags' "${flagsArray[@]}"
b "${flagsArray[@]}"
runHook postBuild
}
build2CheckPhase() {
runHook preCheck
local flagsArray=(
$build2CheckFlags "${build2CheckFlags[@]}"
)
echo 'check flags' "${flagsArray[@]}"
b test ${build2Dir:-.} "${flagsArray[@]}"
runHook postCheck
}
build2InstallPhase() {
runHook preInstall
local flagsArray=(
$build2InstallFlags "${build2InstallFlagsArray[@]}"
${installTargets:-}
)
echo 'install flags' "${flagsArray[@]}"
b install "${flagsArray[@]}"
runHook postInstall
}
if [ -z "${dontUseBuild2Configure-}" -a -z "${configurePhase-}" ]; then
setOutputFlags=
configurePhase=build2ConfigurePhase
fi
if [ -z "${dontUseBuild2Build-}" -a -z "${buildPhase-}" ]; then
buildPhase=build2BuildPhase
fi
if [ -z "${dontUseBuild2Check-}" -a -z "${checkPhase-}" ]; then
checkPhase=build2CheckPhase
fi
if [ -z "${dontUseBuild2Install-}" -a -z "${installPhase-}" ]; then
installPhase=build2InstallPhase
fi

View file

@ -0,0 +1,274 @@
--- cmake-3.2.2/Source/cmFileCommand.cxx 2015-04-13 19:09:00.000000000 +0200
+++ cmake-3.2.2/Source/ccmFileCommand.cxx 2015-06-10 11:02:27.345598700 +0200
@@ -1179,7 +1179,7 @@
MatchProperties CollectMatchProperties(const char* file)
{
// Match rules are case-insensitive on some platforms.
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__APPLE__)
std::string lower = cmSystemTools::LowerCase(file);
const char* file_to_match = lower.c_str();
#else
--- cmake-3.2.2/Source/cmInstallCommand.cxx 2015-04-13 19:09:00.000000000 +0200
+++ cmake-3.2.2/Source/cmInstallCommand.cxx 2015-06-10 11:04:19.257935200 +0200
@@ -1138,7 +1138,7 @@
{
literal_args += " REGEX \"";
// Match rules are case-insensitive on some platforms.
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__APPLE__)
std::string regex = cmSystemTools::LowerCase(args[i]);
#else
std::string regex = args[i];
--- cmake-3.2.2/Source/kwsys/Glob.cxx 2015-04-13 19:09:00.000000000 +0200
+++ cmake-3.2.2/Source/kwsys/Glob.cxx 2015-06-10 11:05:51.602674000 +0200
@@ -37,7 +37,7 @@
#include <string.h>
namespace KWSYS_NAMESPACE
{
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__APPLE__)
// On Windows and apple, no difference between lower and upper case
# define KWSYS_GLOB_CASE_INDEPENDENT
#endif
--- cmake-3.2.2/Source/kwsys/SystemInformation.cxx 2015-04-13 19:09:00.000000000 +0200
+++ cmake-3.2.2/Source/kwsys/SystemInformation.cxx 2015-06-10 11:13:00.308303500 +0200
@@ -911,7 +911,7 @@
// Hide implementation details in an anonymous namespace.
namespace {
// *****************************************************************************
-#if defined(__linux) || defined(__APPLE__)
+#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
int LoadLines(
FILE *file,
kwsys_stl::vector<kwsys_stl::string> &lines)
@@ -947,7 +947,7 @@
return nRead;
}
-# if defined(__linux)
+# if defined(__linux) || defined(__CYGWIN__)
// *****************************************************************************
int LoadLines(
const char *fileName,
@@ -986,7 +986,7 @@
}
#endif
-#if defined(__linux)
+#if defined(__linux) || defined(__CYGWIN__)
// ****************************************************************************
template<typename T>
int GetFieldsFromFile(
@@ -3132,7 +3132,6 @@
pos = buffer.find("processor\t",pos+1);
}
-#ifdef __linux
// Find the largest physical id.
int maxId = -1;
kwsys_stl::string idc =
@@ -3165,14 +3164,6 @@
atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str());
}
-#else // __CYGWIN__
- // does not have "physical id" entries, neither "cpu cores"
- // this has to be fixed for hyper-threading.
- kwsys_stl::string cpucount =
- this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
- this->NumberOfPhysicalCPU=
- this->NumberOfLogicalCPU = atoi(cpucount.c_str());
-#endif
// gotta have one, and if this is 0 then we get a / by 0n
// better to have a bad answer than a crash
if(this->NumberOfPhysicalCPU <= 0)
@@ -3370,7 +3361,7 @@
GlobalMemoryStatusEx(&statex);
return statex.ullTotalPhys/1024;
# endif
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
SystemInformation::LongLong memTotal=0;
int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal);
if (ierr)
@@ -3501,7 +3492,7 @@
GlobalMemoryStatusEx(&statex);
return (statex.ullTotalPhys - statex.ullAvailPhys)/1024;
# endif
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
const char *names[3]={"MemTotal:","MemFree:",NULL};
SystemInformation::LongLong values[2]={SystemInformation::LongLong(0)};
int ierr=GetFieldsFromFile("/proc/meminfo",names,values);
@@ -3560,7 +3551,7 @@
return -2;
}
return pmc.WorkingSetSize/1024;
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
SystemInformation::LongLong memUsed=0;
int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed);
if (ierr)
@@ -3612,7 +3603,7 @@
{
#if defined(_WIN32)
return GetCurrentProcessId();
-#elif defined(__linux) || defined(__APPLE__)
+#elif defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
return getpid();
#else
return -1;
--- cmake-3.2.2/Source/kwsys/SystemTools.cxx 2015-04-13 19:09:00.000000000 +0200
+++ cmake-3.2.2/Source/kwsys/SystemTools.cxx 2015-06-10 11:21:58.980443200 +0200
@@ -93,19 +93,12 @@
# if defined(_MSC_VER) && _MSC_VER >= 1800
# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
# endif
-#elif defined (__CYGWIN__)
-# include <windows.h>
-# undef _WIN32
#endif
#if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
extern char **environ;
#endif
-#ifdef __CYGWIN__
-# include <sys/cygwin.h>
-#endif
-
// getpwnam doesn't exist on Windows and Cray Xt3/Catamount
// same for TIOCGWINSZ
#if defined(_WIN32) || defined (__LIBCATAMOUNT__)
@@ -1148,15 +1141,7 @@
{
return false;
}
-#if defined(__CYGWIN__)
- // Convert filename to native windows path if possible.
- char winpath[MAX_PATH];
- if(SystemTools::PathCygwinToWin32(filename.c_str(), winpath))
- {
- return (GetFileAttributesA(winpath) != INVALID_FILE_ATTRIBUTES);
- }
- return access(filename.c_str(), R_OK) == 0;
-#elif defined(_WIN32)
+#if defined(_WIN32)
return (GetFileAttributesW(
SystemTools::ConvertToWindowsExtendedPath(filename).c_str())
!= INVALID_FILE_ATTRIBUTES);
@@ -1190,28 +1175,6 @@
}
//----------------------------------------------------------------------------
-#ifdef __CYGWIN__
-bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
-{
- SystemToolsTranslationMap::iterator i =
- SystemTools::Cyg2Win32Map->find(path);
-
- if (i != SystemTools::Cyg2Win32Map->end())
- {
- strncpy(win32_path, i->second.c_str(), MAX_PATH);
- }
- else
- {
- if(cygwin_conv_path(CCP_POSIX_TO_WIN_A, path, win32_path, MAX_PATH) != 0)
- {
- win32_path[0] = 0;
- }
- SystemToolsTranslationMap::value_type entry(path, win32_path);
- SystemTools::Cyg2Win32Map->insert(entry);
- }
- return win32_path[0] != 0;
-}
-#endif
bool SystemTools::Touch(const kwsys_stl::string& filename, bool create)
{
@@ -4307,7 +4270,7 @@
bool SystemTools::FileIsFullPath(const char* in_name, size_t len)
{
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
// On Windows, the name must be at least two characters long.
if(len < 2)
{
@@ -5078,9 +5041,6 @@
static unsigned int SystemToolsManagerCount;
SystemToolsTranslationMap *SystemTools::TranslationMap;
SystemToolsTranslationMap *SystemTools::LongPathMap;
-#ifdef __CYGWIN__
-SystemToolsTranslationMap *SystemTools::Cyg2Win32Map;
-#endif
// SystemToolsManager manages the SystemTools singleton.
// SystemToolsManager should be included in any translation unit
@@ -5126,9 +5086,6 @@
// Allocate the translation map first.
SystemTools::TranslationMap = new SystemToolsTranslationMap;
SystemTools::LongPathMap = new SystemToolsTranslationMap;
-#ifdef __CYGWIN__
- SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap;
-#endif
// Add some special translation paths for unix. These are not added
// for windows because drive letters need to be maintained. Also,
@@ -5183,9 +5140,6 @@
{
delete SystemTools::TranslationMap;
delete SystemTools::LongPathMap;
-#ifdef __CYGWIN__
- delete SystemTools::Cyg2Win32Map;
-#endif
}
--- cmake-3.2.2/Source/kwsys/SystemTools.hxx.in 2015-04-13 19:09:00.000000000 +0200
+++ cmake-3.2.2/Source/kwsys/SystemTools.hxx.in 2015-06-10 11:24:24.271286600 +0200
@@ -298,15 +298,6 @@
static bool FileExists(const kwsys_stl::string& filename);
/**
- * Converts Cygwin path to Win32 path. Uses dictionary container for
- * caching and calls to cygwin_conv_to_win32_path from Cygwin dll
- * for actual translation. Returns true on success, else false.
- */
-#ifdef __CYGWIN__
- static bool PathCygwinToWin32(const char *path, char *win32_path);
-#endif
-
- /**
* Return file length
*/
static unsigned long FileLength(const kwsys_stl::string& filename);
@@ -942,9 +933,6 @@
*/
static SystemToolsTranslationMap *TranslationMap;
static SystemToolsTranslationMap *LongPathMap;
-#ifdef __CYGWIN__
- static SystemToolsTranslationMap *Cyg2Win32Map;
-#endif
friend class SystemToolsManager;
};
--- cmake-3.2.2/Modules/FindCurses.cmake 2015-04-13 19:09:00.000000000 +0200
+++ cmake-3.2.2/Modules/FindCurses.cmake 2015-06-10 12:10:19.682030300 +0200
@@ -60,15 +60,6 @@
if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES))
set(CURSES_USE_NCURSES TRUE)
endif()
-# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html
-# cygwin ncurses stopped providing curses.h symlinks see above
-# message. Cygwin is an ncurses package, so force ncurses on
-# cygwin if the curses.h is missing
-if(CYGWIN)
- if(NOT EXISTS /usr/include/curses.h)
- set(CURSES_USE_NCURSES TRUE)
- endif()
-endif()
# Not sure the logic is correct here.

View file

@ -0,0 +1,43 @@
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 9a18184fd3..278d146dd1 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -933,7 +933,6 @@ endif()
# On Apple we need CoreFoundation and CoreServices
if(APPLE)
target_link_libraries(CMakeLib "-framework CoreFoundation")
- target_link_libraries(CMakeLib "-framework CoreServices")
endif()
if(WIN32 AND NOT UNIX)
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 77403b076a..d5aac95e1e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -49,10 +49,6 @@ struct cmLinkImplementation;
#if !defined(CMAKE_BOOTSTRAP) && defined(__APPLE__)
# include <CoreFoundation/CoreFoundation.h>
-# if !TARGET_OS_IPHONE
-# define HAVE_APPLICATION_SERVICES
-# include <ApplicationServices/ApplicationServices.h>
-# endif
#endif
#if !defined(CMAKE_BOOTSTRAP)
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index 79452ffff6..a848731b7e 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -2013,11 +2013,6 @@ IF(ENABLE_TEST)
ENDIF(ENABLE_TEST)
ENDIF()
-# We need CoreServices on Mac OS.
-IF(APPLE)
- LIST(APPEND ADDITIONAL_LIBS "-framework CoreServices")
-ENDIF(APPLE)
-
add_subdirectory(libarchive)
IF(0) # CMake does not build libarchive's command-line tools.
add_subdirectory(cat)

View file

@ -0,0 +1,14 @@
Revert of commit 1af23c4de2c7d58c06171d70b37794b5c860d5f4.
--- b/Modules/Platform/Darwin.cmake
+++ a/Modules/Platform/Darwin.cmake
@@ -47,9 +47,7 @@
set(CMAKE_SHARED_MODULE_SUFFIX ".so")
set(CMAKE_MODULE_EXISTS 1)
set(CMAKE_DL_LIBS "")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
-if(NOT "${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5")
- set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
-endif()
foreach(lang C CXX OBJC OBJCXX)
set(CMAKE_${lang}_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")

View file

@ -0,0 +1,136 @@
{ stdenv, lib, fetchurl, pkg-config
, bzip2, curlMinimal, expat, libarchive, xz, zlib, libuv, rhash
, buildPackages
# darwin attributes
, SystemConfiguration
, ps
, isBootstrap ? false
, useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin)
, useOpenSSL ? !isBootstrap, openssl
, useNcurses ? false, ncurses
, withQt5 ? false, qtbase, wrapQtAppsHook
, buildDocs ? (!isBootstrap && (useNcurses || withQt5)), sphinx, texinfo
}:
stdenv.mkDerivation rec {
pname = "cmake"
+ lib.optionalString isBootstrap "-boot"
+ lib.optionalString useNcurses "-cursesUI"
+ lib.optionalString withQt5 "-qt5UI";
version = "3.22.3";
src = fetchurl {
url = "https://cmake.org/files/v${lib.versions.majorMinor version}/cmake-${version}.tar.gz";
sha256 = "sha256-n4RpFm+UVTtpeKFu4pIn7Emi61zrYIJ13sQNiuDRtaA=";
};
patches = [
# Don't search in non-Nix locations such as /usr, but do search in our libc.
./search-path.patch
# Don't depend on frameworks.
./application-services.patch
# Derived from https://github.com/libuv/libuv/commit/1a5d4f08238dd532c3718e210078de1186a5920d
./libuv-application-services.patch
] ++ lib.optional stdenv.isCygwin ./3.2.2-cygwin.patch
# Derived from https://github.com/curl/curl/commit/31f631a142d855f069242f3e0c643beec25d1b51
++ lib.optional (stdenv.isDarwin && isBootstrap) ./remove-systemconfiguration-dep.patch
# On Darwin, always set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG.
++ lib.optional stdenv.isDarwin ./darwin-always-set-runtime-c-flag.patch;
outputs = [ "out" ]
++ lib.optionals buildDocs [ "man" "info" ];
setOutputFlags = false;
setupHook = ./setup-hook.sh;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ setupHook pkg-config ]
++ lib.optionals buildDocs [ texinfo ]
++ lib.optionals withQt5 [ wrapQtAppsHook ];
buildInputs = lib.optionals useSharedLibraries [ bzip2 curlMinimal expat libarchive xz zlib libuv rhash ]
++ lib.optional useOpenSSL openssl
++ lib.optional useNcurses ncurses
++ lib.optional withQt5 qtbase
++ lib.optional (stdenv.isDarwin && !isBootstrap) SystemConfiguration;
propagatedBuildInputs = lib.optional stdenv.isDarwin ps;
preConfigure = ''
fixCmakeFiles .
substituteInPlace Modules/Platform/UnixPaths.cmake \
--subst-var-by libc_bin ${lib.getBin stdenv.cc.libc} \
--subst-var-by libc_dev ${lib.getDev stdenv.cc.libc} \
--subst-var-by libc_lib ${lib.getLib stdenv.cc.libc}
# CC_FOR_BUILD and CXX_FOR_BUILD are used to bootstrap cmake
configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD $configureFlags"
'';
configureFlags = [
"CXXFLAGS=-Wno-elaborated-enum-base"
"--docdir=share/doc/${pname}${version}"
] ++ (if useSharedLibraries then [ "--no-system-jsoncpp" "--system-libs" ] else [ "--no-system-libs" ]) # FIXME: cleanup
++ lib.optional withQt5 "--qt-gui"
++ lib.optionals buildDocs [
"--sphinx-build=${sphinx}/bin/sphinx-build"
"--sphinx-man"
"--sphinx-info"
]
# Workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20568
++ lib.optionals stdenv.hostPlatform.is32bit [
"CFLAGS=-D_FILE_OFFSET_BITS=64"
"CXXFLAGS=-D_FILE_OFFSET_BITS=64"
] ++ [
"--"
# We should set the proper `CMAKE_SYSTEM_NAME`.
# http://www.cmake.org/Wiki/CMake_Cross_Compiling
#
# Unfortunately cmake seems to expect absolute paths for ar, ranlib, and
# strip. Otherwise they are taken to be relative to the source root of the
# package being built.
"-DCMAKE_CXX_COMPILER=${stdenv.cc.targetPrefix}c++"
"-DCMAKE_C_COMPILER=${stdenv.cc.targetPrefix}cc"
"-DCMAKE_AR=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
"-DCMAKE_RANLIB=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
"-DCMAKE_STRIP=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip"
"-DCMAKE_USE_OPENSSL=${if useOpenSSL then "ON" else "OFF"}"
# Avoid depending on frameworks.
"-DBUILD_CursesDialog=${if useNcurses then "ON" else "OFF"}"
];
# make install attempts to use the just-built cmake
preInstall = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
sed -i 's|bin/cmake|${buildPackages.cmakeMinimal}/bin/cmake|g' Makefile
'';
dontUseCmakeConfigure = true;
enableParallelBuilding = true;
# This isn't an autoconf configure script; triples are passed via
# CMAKE_SYSTEM_NAME, etc.
configurePlatforms = [ ];
doCheck = false; # fails
meta = with lib; {
broken = (withQt5 && stdenv.isDarwin);
homepage = "https://cmake.org/";
changelog = "https://cmake.org/cmake/help/v${lib.versions.majorMinor version}/release/${lib.versions.majorMinor version}.html";
description = "Cross-Platform Makefile Generator";
longDescription = ''
CMake is an open-source, cross-platform family of tools designed to
build, test and package software. CMake is used to control the software
compilation process using simple platform and compiler independent
configuration files, and generate native makefiles and workspaces that
can be used in the compiler environment of your choice.
'';
platforms = platforms.all;
maintainers = with maintainers; [ ttuegel lnl7 ];
license = licenses.bsd3;
};
}

View file

@ -0,0 +1,55 @@
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
index 7625cf65d9..167903e309 100644
--- a/Utilities/cmlibuv/CMakeLists.txt
+++ b/Utilities/cmlibuv/CMakeLists.txt
@@ -193,6 +193,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
src/unix/kqueue.c
src/unix/proctitle.c
)
+
+ include(CheckIncludeFile)
+
+ check_include_file("ApplicationServices/ApplicationServices.h" HAVE_ApplicationServices)
+ if (HAVE_ApplicationServices)
+ list(APPEND uv_defines
+ HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H=1
+ )
+ endif()
+
+ check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices)
+ if (HAVE_CoreServices)
+ list(APPEND uv_defines
+ HAVE_CORESERVICES_CORESERVICES_H=1
+ )
+ endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
diff --git a/Utilities/cmlibuv/src/unix/fsevents.c b/Utilities/cmlibuv/src/unix/fsevents.c
index a51f29b3f6..3f6bf01968 100644
--- a/Utilities/cmlibuv/src/unix/fsevents.c
+++ b/Utilities/cmlibuv/src/unix/fsevents.c
@@ -21,7 +21,7 @@
#include "uv.h"
#include "internal.h"
-#if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+#if !HAVE_CORESERVICES_CORESERVICES_H || MAC_OS_X_VERSION_MAX_ALLOWED < 1070
/* iOS (currently) doesn't provide the FSEvents-API (nor CoreServices) */
/* macOS prior to 10.7 doesn't provide the full FSEvents API so use kqueue */
@@ -39,7 +39,7 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
void uv__fsevents_loop_delete(uv_loop_t* loop) {
}
-#else /* TARGET_OS_IPHONE */
+#else /* !HAVE_CORESERVICES_CORESERVICES_H */
#include "darwin-stub.h"
@@ -920,4 +920,4 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
return 0;
}
-#endif /* TARGET_OS_IPHONE */
+#endif /* !HAVE_CORESERVICES_CORESERVICES_H */

View file

@ -0,0 +1,73 @@
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 9eef01aaf0..d141d4086c 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -537,12 +537,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(FATAL_ERROR "CoreFoundation framework not found")
endif()
- find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration")
- if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
- message(FATAL_ERROR "SystemConfiguration framework not found")
- endif()
-
- list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework SystemConfiguration")
+ list(APPEND CURL_LIBS "-framework CoreFoundation")
if(CMAKE_USE_SECTRANSP)
find_library(SECURITY_FRAMEWORK "Security")
diff --git a/Utilities/cmcurl/lib/curl_setup.h b/Utilities/cmcurl/lib/curl_setup.h
index 554dcc1e67..059f14e632 100644
--- a/Utilities/cmcurl/lib/curl_setup.h
+++ b/Utilities/cmcurl/lib/curl_setup.h
@@ -257,11 +257,7 @@
* performing this task will result in a synthesized IPv6 address.
*/
#if defined(__APPLE__) && !defined(USE_ARES)
-#include <TargetConditionals.h>
#define USE_RESOLVE_ON_IPS 1
-# if defined(TARGET_OS_OSX) && TARGET_OS_OSX
-# define CURL_OSX_CALL_COPYPROXIES 1
-# endif
#endif
#ifdef USE_LWIPSOCK
diff --git a/Utilities/cmcurl/lib/hostip.c b/Utilities/cmcurl/lib/hostip.c
index 117caa2957..9f7c709e44 100644
--- a/Utilities/cmcurl/lib/hostip.c
+++ b/Utilities/cmcurl/lib/hostip.c
@@ -68,10 +68,6 @@
#include "curl_memory.h"
#include "memdebug.h"
-#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES)
-#include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
-#endif
-
#if defined(CURLRES_SYNCH) && \
defined(HAVE_ALARM) && defined(SIGALRM) && defined(HAVE_SIGSETJMP)
/* alarm-based timeouts can only be used with all the dependencies satisfied */
@@ -653,23 +649,6 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
return CURLRESOLV_ERROR;
}
-#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES)
- {
- /*
- * The automagic conversion from IPv4 literals to IPv6 literals only
- * works if the SCDynamicStoreCopyProxies system function gets called
- * first. As Curl currently doesn't support system-wide HTTP proxies, we
- * therefore don't use any value this function might return.
- *
- * This function is only available on a macOS and is not needed for
- * IPv4-only builds, hence the conditions above.
- */
- CFDictionaryRef dict = SCDynamicStoreCopyProxies(NULL);
- if(dict)
- CFRelease(dict);
- }
-#endif
-
#ifndef USE_RESOLVE_ON_IPS
/* First check if this is an IPv4 address string */
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)

View file

@ -0,0 +1,74 @@
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
index b9381c3d7d..cecc40a89e 100644
--- a/Modules/Platform/UnixPaths.cmake
+++ b/Modules/Platform/UnixPaths.cmake
@@ -26,9 +26,6 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
# please make sure to keep Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
# synchronized
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
- # Standard
- /usr/local /usr /
-
# CMake install location
"${_CMAKE_INSTALL_DIR}"
)
@@ -47,24 +44,19 @@ endif()
# Non "standard" but common install prefixes
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
- /usr/X11R6
- /usr/pkg
- /opt
)
# List common include file locations not under the common prefixes.
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
- # X11
- /usr/include/X11
+ @libc_dev@/include
)
list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
- # X11
- /usr/lib/X11
+ @libc_lib@/lib
)
list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
- /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
+ @libc_lib@/lib
)
if(CMAKE_SYSROOT_COMPILE)
@@ -77,15 +69,15 @@ endif()
# parsing the implicit directory information from compiler output.
set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT
${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
- "${_cmake_sysroot_compile}/usr/include"
+ @libc_dev@/include
)
set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
- "${_cmake_sysroot_compile}/usr/include"
+ @libc_dev@/include
)
set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT
${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES}
- "${_cmake_sysroot_compile}/usr/include"
+ @libc_dev@/include
)
unset(_cmake_sysroot_compile)
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
index b9e2f17979..ab517cd4a7 100644
--- a/Modules/Platform/WindowsPaths.cmake
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -70,7 +70,7 @@ endif()
if(CMAKE_CROSSCOMPILING AND NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
# MinGW (useful when cross compiling from linux with CMAKE_FIND_ROOT_PATH set)
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH /)
+ # list(APPEND CMAKE_SYSTEM_PREFIX_PATH /)
endif()
list(APPEND CMAKE_SYSTEM_INCLUDE_PATH

View file

@ -0,0 +1,175 @@
addCMakeParams() {
addToSearchPath CMAKE_PREFIX_PATH $1
}
fixCmakeFiles() {
# Replace occurences of /usr and /opt by /var/empty.
echo "fixing cmake files..."
find "$1" \( -type f -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print |
while read fn; do
sed -e 's^/usr\([ /]\|$\)^/var/empty\1^g' -e 's^/opt\([ /]\|$\)^/var/empty\1^g' < "$fn" > "$fn.tmp"
mv "$fn.tmp" "$fn"
done
}
cmakeConfigurePhase() {
runHook preConfigure
export CTEST_OUTPUT_ON_FAILURE=1
if [ -n "${enableParallelChecking-1}" ]; then
export CTEST_PARALLEL_LEVEL=$NIX_BUILD_CORES
fi
if [ -z "${dontFixCmake-}" ]; then
fixCmakeFiles .
fi
if [ -z "${dontUseCmakeBuildDir-}" ]; then
mkdir -p build
cd build
cmakeDir=${cmakeDir:-..}
fi
if [ -z "${dontAddPrefix-}" ]; then
cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags"
fi
# We should set the proper `CMAKE_SYSTEM_NAME`.
# http://www.cmake.org/Wiki/CMake_Cross_Compiling
#
# Unfortunately cmake seems to expect absolute paths for ar, ranlib, and
# strip. Otherwise they are taken to be relative to the source root of the
# package being built.
cmakeFlags="-DCMAKE_CXX_COMPILER=$CXX $cmakeFlags"
cmakeFlags="-DCMAKE_C_COMPILER=$CC $cmakeFlags"
cmakeFlags="-DCMAKE_AR=$(command -v $AR) $cmakeFlags"
cmakeFlags="-DCMAKE_RANLIB=$(command -v $RANLIB) $cmakeFlags"
cmakeFlags="-DCMAKE_STRIP=$(command -v $STRIP) $cmakeFlags"
# on macOS we want to prefer Unix-style headers to Frameworks
# because we usually do not package the framework
cmakeFlags="-DCMAKE_FIND_FRAMEWORK=LAST $cmakeFlags"
# we never want to use the global macOS SDK
cmakeFlags="-DCMAKE_OSX_SYSROOT= $cmakeFlags"
# correctly detect our clang compiler
cmakeFlags="-DCMAKE_POLICY_DEFAULT_CMP0025=NEW $cmakeFlags"
# This installs shared libraries with a fully-specified install
# name. By default, cmake installs shared libraries with just the
# basename as the install name, which means that, on Darwin, they
# can only be found by an executable at runtime if the shared
# libraries are in a system path or in the same directory as the
# executable. This flag makes the shared library accessible from its
# nix/store directory.
cmakeFlags="-DCMAKE_INSTALL_NAME_DIR=${!outputLib}/lib $cmakeFlags"
# The docdir flag needs to include PROJECT_NAME as per GNU guidelines,
# try to extract it from CMakeLists.txt.
if [[ -z "$shareDocName" ]]; then
local cmakeLists="${cmakeDir}/CMakeLists.txt"
if [[ -f "$cmakeLists" ]]; then
local shareDocName="$(grep --only-matching --perl-regexp --ignore-case '\bproject\s*\(\s*"?\K([^[:space:]")]+)' < "$cmakeLists" | head -n1)"
fi
# The argument sometimes contains garbage or variable interpolation.
# When that is the case, lets fall back to the derivation name.
if [[ -z "$shareDocName" ]] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_+-]'; then
if [[ -n "${pname-}" ]]; then
shareDocName="$pname"
else
shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"
fi
fi
fi
# This ensures correct paths with multiple output derivations
# It requires the project to use variables from GNUInstallDirs module
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
cmakeFlags="-DCMAKE_INSTALL_BINDIR=${!outputBin}/bin $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_SBINDIR=${!outputBin}/sbin $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_INCLUDEDIR=${!outputInclude}/include $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_OLDINCLUDEDIR=${!outputInclude}/include $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_MANDIR=${!outputMan}/share/man $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_INFODIR=${!outputInfo}/share/info $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_DOCDIR=${!outputDoc}/share/doc/${shareDocName} $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_LIBDIR=${!outputLib}/lib $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_LIBEXECDIR=${!outputLib}/libexec $cmakeFlags"
cmakeFlags="-DCMAKE_INSTALL_LOCALEDIR=${!outputLib}/share/locale $cmakeFlags"
# Dont build tests when doCheck = false
if [ -z "${doCheck-}" ]; then
cmakeFlags="-DBUILD_TESTING=OFF $cmakeFlags"
fi
# Avoid cmake resetting the rpath of binaries, on make install
# And build always Release, to ensure optimisation flags
cmakeFlags="-DCMAKE_BUILD_TYPE=${cmakeBuildType:-Release} -DCMAKE_SKIP_BUILD_RPATH=ON $cmakeFlags"
# Disable user package registry to avoid potential side effects
# and unecessary attempts to access non-existent home folder
# https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#disabling-the-package-registry
cmakeFlags="-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON $cmakeFlags"
cmakeFlags="-DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF $cmakeFlags"
cmakeFlags="-DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF $cmakeFlags"
if [ "${buildPhase-}" = ninjaBuildPhase ]; then
cmakeFlags="-GNinja $cmakeFlags"
fi
echo "cmake flags: $cmakeFlags ${cmakeFlagsArray[@]}"
cmake ${cmakeDir:-.} $cmakeFlags "${cmakeFlagsArray[@]}"
if ! [[ -v enableParallelBuilding ]]; then
enableParallelBuilding=1
echo "cmake: enabled parallel building"
fi
runHook postConfigure
}
if [ -z "${dontUseCmakeConfigure-}" -a -z "${configurePhase-}" ]; then
setOutputFlags=
configurePhase=cmakeConfigurePhase
fi
addEnvHooks "$targetOffset" addCMakeParams
makeCmakeFindLibs(){
isystem_seen=
iframework_seen=
for flag in ${NIX_CFLAGS_COMPILE-} ${NIX_LDFLAGS-}; do
if test -n "$isystem_seen" && test -d "$flag"; then
isystem_seen=
export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH-}${CMAKE_INCLUDE_PATH:+:}${flag}"
elif test -n "$iframework_seen" && test -d "$flag"; then
iframework_seen=
export CMAKE_FRAMEWORK_PATH="${CMAKE_FRAMEWORK_PATH-}${CMAKE_FRAMEWORK_PATH:+:}${flag}"
else
isystem_seen=
iframework_seen=
case $flag in
-I*)
export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH-}${CMAKE_INCLUDE_PATH:+:}${flag:2}"
;;
-L*)
export CMAKE_LIBRARY_PATH="${CMAKE_LIBRARY_PATH-}${CMAKE_LIBRARY_PATH:+:}${flag:2}"
;;
-F*)
export CMAKE_FRAMEWORK_PATH="${CMAKE_FRAMEWORK_PATH-}${CMAKE_FRAMEWORK_PATH:+:}${flag:2}"
;;
-isystem)
isystem_seen=1
;;
-iframework)
iframework_seen=1
;;
esac
fi
done
}
# not using setupHook, because it could be a setupHook adding additional
# include flags to NIX_CFLAGS_COMPILE
postHooks+=(makeCmakeFindLibs)

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchFromGitHub, perl }:
stdenv.mkDerivation {
pname = "colormake";
version = "2.1.0";
buildInputs = [ perl ];
src = fetchFromGitHub {
owner = "pagekite";
repo = "Colormake";
rev = "66544f40d";
sha256 = "8e714c5540305d169989d9387dbac47b8b9fb2cfb424af7bcd412bfe684dc6d7";
};
installPhase = ''
mkdir -p $out/bin
cp -fa colormake.pl colormake colormake-short clmake clmake-short $out/bin
'';
meta = with lib; {
description = "Simple wrapper around make to colorize the output";
homepage = "https://bre.klaki.net/programs/colormake/";
license = licenses.gpl2;
platforms = platforms.unix;
maintainers = with maintainers; [ bhipple ];
};
}

View file

@ -0,0 +1,103 @@
{ lib, stdenv, python3, fetchFromGitHub, git, pkg-config }:
# Note:
# Conan has specific dependency demands; check
# https://github.com/conan-io/conan/blob/master/conans/requirements.txt
# https://github.com/conan-io/conan/blob/master/conans/requirements_server.txt
# on the release branch/commit we're packaging.
#
# Two approaches are used here to deal with that:
# Pinning the specific versions it wants in `newPython`,
# and using `substituteInPlace conans/requirements.txt ...`
# in `postPatch` to allow newer versions when we know
# (e.g. from changelogs) that they are compatible.
let newPython = python3.override {
packageOverrides = self: super: {
node-semver = super.node-semver.overridePythonAttrs (oldAttrs: rec {
version = "0.6.1";
src = oldAttrs.src.override {
inherit version;
sha256 = "1dv6mjsm67l1razcgmq66riqmsb36wns17mnipqr610v0z0zf5j0";
};
});
# https://github.com/conan-io/conan/issues/8876
pyjwt = super.pyjwt.overridePythonAttrs (oldAttrs: rec {
version = "1.7.1";
src = oldAttrs.src.override {
inherit version;
sha256 = "8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96";
};
disabledTests = [
"test_ec_verify_should_return_false_if_signature_invalid"
];
});
distro = super.distro.overridePythonAttrs (oldAttrs: rec {
version = "1.5.0";
src = oldAttrs.src.override {
inherit version;
sha256 = "14nz51cqlnxmgfqqilxyvjwwa5xfivdvlm0d0b1qzgcgwdm7an0f";
};
});
};
};
in newPython.pkgs.buildPythonApplication rec {
version = "1.47.0";
pname = "conan";
src = fetchFromGitHub {
owner = "conan-io";
repo = "conan";
rev = version;
sha256 = "1zs2xb22rsy5fsc0fd7c95vrx1mfz7vasyg1lqkzyfimvn5zah6n";
};
propagatedBuildInputs = with newPython.pkgs; [
bottle
colorama
python-dateutil
deprecation
distro
fasteners
future
jinja2
node-semver
patch-ng
pluginbase
pygments
pyjwt
pylint # Not in `requirements.txt` but used in hooks, see https://github.com/conan-io/conan/pull/6152
pyyaml
requests
six
tqdm
urllib3
] ++ lib.optionals stdenv.isDarwin [ idna cryptography pyopenssl ];
checkInputs = [
pkg-config
git
] ++ (with newPython.pkgs; [
codecov
mock
nose
parameterized
webtest
]);
# TODO: reenable tests now that we fetch tests w/ the source from GitHub.
# Not enabled right now due to time constraints/failing tests that I didn't have time to track down
doCheck = false;
postPatch = ''
substituteInPlace conans/requirements.txt --replace 'PyYAML>=3.11, <6.0' 'PyYAML>=3.11'
'';
meta = with lib; {
homepage = "https://conan.io";
description = "Decentralized and portable C/C++ package manager";
license = licenses.mit;
maintainers = with maintainers; [ HaoZeke ];
};
}

View file

@ -0,0 +1,18 @@
diff --git a/cmake/CorrosionConfig.cmake.in b/cmake/CorrosionConfig.cmake.in
index c042a00..491f53c 100644
--- a/cmake/CorrosionConfig.cmake.in
+++ b/cmake/CorrosionConfig.cmake.in
@@ -4,11 +4,11 @@ if (Corrosion_FOUND)
return()
endif()
-list(APPEND CMAKE_MODULE_PATH "${PACKAGE_PREFIX_DIR}/@CORROSION_INSTALL_PREFIX@@CMAKE_INSTALL_DATADIR@/cmake")
+list(APPEND CMAKE_MODULE_PATH "@CMAKE_INSTALL_FULL_DATADIR@/cmake")
add_executable(Corrosion::Generator IMPORTED GLOBAL)
set_property(
TARGET Corrosion::Generator
- PROPERTY IMPORTED_LOCATION "${PACKAGE_PREFIX_DIR}/@CORROSION_INSTALL_PREFIX@@CMAKE_INSTALL_LIBEXECDIR@/corrosion-generator")
+ PROPERTY IMPORTED_LOCATION "@CMAKE_INSTALL_FULL_LIBEXECDIR@/corrosion-generator")
include(Corrosion)

View file

@ -0,0 +1,53 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, rustPlatform
, libiconv
}:
stdenv.mkDerivation rec {
pname = "corrosion";
version = "0.2.1";
src = fetchFromGitHub {
owner = "corrosion-rs";
repo = "corrosion";
rev = "v${version}";
hash = "sha256-nJ4ercNykECDBqecuL8cdCl4DHgbgIUmbiFBG/jiOaA=";
};
cargoRoot = "generator";
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
sourceRoot = "${src.name}/${cargoRoot}";
name = "${pname}-${version}";
hash = "sha256-4JVbHYlMOKztWPYW7tXQdvdNh/ygfpi0CY6Ly93VxsI=";
};
buildInputs = lib.optional stdenv.isDarwin libiconv;
nativeBuildInputs = [
cmake
] ++ (with rustPlatform; [
cargoSetupHook
rust.cargo
rust.rustc
]);
cmakeFlags = [
"-DRust_CARGO=${rustPlatform.rust.cargo}/bin/cargo"
# tests cannot find cargo because Rust_CARGO is unset before tests
"-DCORROSION_BUILD_TESTS=OFF"
];
meta = with lib; {
description = "Tool for integrating Rust into an existing CMake project";
homepage = "https://github.com/corrosion-rs/corrosion";
changelog = "https://github.com/corrosion-rs/corrosion/blob/${src.rev}/RELEASES.md";
license = licenses.mit;
maintainers = with maintainers; [ dotlambda ];
};
}

View file

@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'drake'

View file

@ -0,0 +1,15 @@
GEM
remote: https://rubygems.org/
specs:
comp_tree (1.1.3)
drake (0.9.2.0.3.1)
comp_tree (>= 1.1.3)
PLATFORMS
ruby
DEPENDENCIES
drake
BUNDLED WITH
2.1.4

View file

@ -0,0 +1,17 @@
{ lib, bundlerApp, bundlerUpdateScript }:
bundlerApp {
pname = "drake";
gemdir = ./.;
exes = [ "drake" ];
passthru.updateScript = bundlerUpdateScript "drake";
meta = with lib; {
description = "A branch of Rake supporting automatic parallelizing of tasks";
homepage = "http://quix.github.io/rake/";
maintainers = with maintainers; [ romildo manveru nicknovitski ];
license = licenses.mit;
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,23 @@
{
comp_tree = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0dj9lkfxcczn67l1j12dcxswrfxxd1zgxa344zk6vqs2gwwhy9m9";
type = "gem";
};
version = "1.1.3";
};
drake = {
dependencies = ["comp_tree"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "09gkmdshwdmdnkdxi03dv4rk1dip0wdv6dx14wscrmi0jyk86yag";
type = "gem";
};
version = "0.9.2.0.3.1";
};
}

View file

@ -0,0 +1,155 @@
{ lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc, dcompiler ? ldc }:
assert dcompiler != null;
stdenv.mkDerivation rec {
pname = "dub";
version = "1.23.0";
enableParallelBuilding = true;
src = fetchFromGitHub {
owner = "dlang";
repo = "dub";
rev = "v${version}";
sha256 = "06a4whsl1m600k096nwif83n7za3vr7pj1xwapncy5fcad1gmady";
};
postUnpack = ''
patchShebangs .
'';
# Can be removed with https://github.com/dlang/dub/pull/1368
dubvar = "\\$DUB";
postPatch = ''
substituteInPlace test/fetchzip.sh \
--replace "dub remove" "\"${dubvar}\" remove"
'';
nativeBuildInputs = [ dcompiler libevent rsync ];
buildInputs = [ curl ];
buildPhase = ''
for dc_ in dmd ldmd2 gdmd; do
echo "... check for D compiler $dc_ ..."
dc=$(type -P $dc_ || echo "")
if [ ! "$dc" == "" ]; then
break
fi
done
if [ "$dc" == "" ]; then
exit "Error: could not find D compiler"
fi
echo "$dc_ found and used as D compiler to build $pname"
$dc ./build.d
./build
'';
doCheck = !stdenv.isDarwin;
checkPhase = ''
export DUB=$NIX_BUILD_TOP/source/bin/dub
export PATH=$PATH:$NIX_BUILD_TOP/source/bin/
export DC=${dcompiler.out}/bin/${dcompiler.pname}
echo "DC out --> $DC"
export HOME=$TMP
rm -rf test/issue502-root-import
rm test/issue674-concurrent-dub.sh
rm test/issue672-upgrade-optional.sh
rm test/issue990-download-optional-selected.sh
rm test/issue877-auto-fetch-package-on-run.sh
rm test/issue1037-better-dependency-messages.sh
rm test/issue1416-maven-repo-pkg-supplier.sh
rm test/issue1180-local-cache-broken.sh
rm test/issue1574-addcommand.sh
rm test/issue1524-maven-upgrade-dependency-tree.sh
rm test/issue1773-lint.sh
rm test/ddox.sh
rm test/fetchzip.sh
rm test/feat663-search.sh
rm -rf test/git-dependency
rm test/interactive-remove.sh
rm test/timeout.sh
rm test/version-spec.sh
rm test/0-init-multi.sh
rm test/0-init-multi-json.sh
rm test/4-describe-data-1-list.sh
rm test/4-describe-data-3-zero-delim.sh
rm test/4-describe-import-paths.sh
rm test/4-describe-string-import-paths.sh
rm test/4-describe-json.sh
rm test/5-convert-stdout.sh
rm test/issue1003-check-empty-ld-flags.sh
rm test/issue103-single-file-package.sh
rm test/issue1040-run-with-ver.sh
rm test/issue1091-bogus-rebuild.sh
rm test/issue1194-warn-wrong-subconfig.sh
rm test/issue1277.sh
rm test/issue1372-ignore-files-in-hidden-dirs.sh
rm test/issue1447-build-settings-vars.sh
rm test/issue1531-toolchain-requirements.sh
rm test/issue346-redundant-flags.sh
rm test/issue361-optional-deps.sh
rm test/issue564-invalid-upgrade-dependency.sh
rm test/issue586-subpack-dep.sh
rm test/issue616-describe-vs-generate-commands.sh
rm test/issue686-multiple-march.sh
rm test/issue813-fixed-dependency.sh
rm test/issue813-pure-sub-dependency.sh
rm test/issue820-extra-fields-after-convert.sh
rm test/issue923-subpackage-deps.sh
rm test/single-file-sdl-default-name.sh
rm test/subpackage-common-with-sourcefile-globbing.sh
rm test/issue934-path-dep.sh
rm -r test/1-dynLib-simple
rm -r test/1-exec-simple-package-json
rm -r test/1-exec-simple
rm -r test/1-staticLib-simple
rm -r test/2-dynLib-dep
rm -r test/2-staticLib-dep
rm -r test/2-dynLib-with-staticLib-dep
rm -r test/2-sourceLib-dep/
rm -r test/3-copyFiles
rm -r test/custom-source-main-bug487
rm -r test/custom-unittest
rm -r test/issue1262-version-inheritance-diamond
rm -r test/issue1003-check-empty-ld-flags
rm -r test/ignore-hidden-1
rm -r test/ignore-hidden-2
rm -r test/issue1427-betterC
rm -r test/issue130-unicode-*
rm -r test/issue1262-version-inheritance
rm -r test/issue1372-ignore-files-in-hidden-dirs
rm -r test/issue1350-transitive-none-deps
rm -r test/issue1775
rm -r test/issue1447-build-settings-vars
rm -r test/issue1408-inherit-linker-files
rm -r test/issue1551-var-escaping
rm -r test/issue754-path-selection-fail
rm -r test/issue1788-incomplete-string-import-override
rm -r test/subpackage-ref
rm -r test/issue777-bogus-path-dependency
rm -r test/issue959-path-based-subpack-dep
rm -r test/issue97-targettype-none-nodeps
rm -r test/issue97-targettype-none-onerecipe
rm -r test/path-subpackage-ref
rm -r test/sdl-package-simple
./test/run-unittest.sh
'';
installPhase = ''
mkdir -p $out/bin
cp bin/dub $out/bin
'';
meta = with lib; {
description = "Package and build manager for D applications and libraries";
homepage = "https://code.dlang.org/";
license = licenses.mit;
maintainers = with maintainers; [ ThomasMader ];
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-darwin" ];
};
}

View file

@ -0,0 +1,67 @@
{ lib, stdenv, fetchFromGitHub, capnproto }:
stdenv.mkDerivation {
pname = "ekam";
version = "unstable-2021-09-18";
src = fetchFromGitHub {
owner = "capnproto";
repo = "ekam";
rev = "77c338f8bd8f4a2ce1e6199b2a52363f1fccf388";
sha256 = "0q4bizlb1ykzdp4ca0kld6xm5ml9q866xrj3ijffcnyiyqr51qr8";
};
# The capnproto *source* is required to build ekam.
# https://github.com/capnproto/ekam/issues/5
#
# Specifically, the git version of the source is required, as
# capnproto release tarballs do not include ekam rule files.
postUnpack = ''
mkdir -p $sourceRoot/deps
cp -r ${capnproto.src} $sourceRoot/deps/capnproto
'';
postPatch = ''
# A single capnproto test file expects to be able to write to
# /var/tmp. We change it to use /tmp because /var is not available
# under nix-build.
substituteInPlace deps/capnproto/c++/src/kj/filesystem-disk-test.c++ \
--replace "/var/tmp" "/tmp"
'';
# NIX_ENFORCE_PURITY prevents ld from linking against anything outside
# of the nix store -- but ekam builds capnp locally and links against it,
# so that causes the build to fail. So, we turn this off.
#
# See: https://nixos.wiki/wiki/Development_environment_with_nix-shell#Troubleshooting
preBuild = ''
unset NIX_ENFORCE_PURITY
'';
makeFlags = [
"PARALLEL=$(NIX_BUILD_CORES)"
];
installPhase = ''
mkdir $out
cp -r bin $out
# Remove capnproto tools; there's a separate nix package for that.
rm $out/bin/capnp*
# Don't distribute ekam-bootstrap, which is not needed outside this build.
rm $out/bin/ekam-bootstrap
'';
meta = with lib; {
description = ''Build system ("make" in reverse)'';
longDescription = ''
Ekam ("make" spelled backwards) is a build system which automatically
figures out what to build and how to build it purely based on the
source code. No separate "makefile" is needed.
'';
homepage = "https://github.com/capnproto/ekam";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = [ maintainers.garrison ];
};
}

View file

@ -0,0 +1,50 @@
{ lib, stdenv, rustPlatform, fetchCrate, git, CoreServices }:
rustPlatform.buildRustPackage rec {
pname = "fac-build";
version = "0.5.4";
src = fetchCrate {
inherit version;
crateName = "fac";
sha256 = "sha256-+JJVuKUdnjJoQJ4a2EE0O6jZdVoFxPwbPgfD2LfiDPI=";
};
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
cargoSha256 = "sha256-XT4FQVE+buORuZAFZK5Qnf/Fl3QSvw4SHUuCzWhxUdk=";
# fac includes a unit test called ls_files_works which assumes it's
# running in a git repo. Nix's sandbox runs cargo build outside git,
# so this test won't work.
checkFlagsArray = [ "--skip=ls_files_works" ];
# fac calls git at runtime, expecting it to be in the PATH,
# so we need to patch it to call git by absolute path instead.
postPatch = ''
substituteInPlace src/git.rs \
--replace 'std::process::Command::new("git")' \
'std::process::Command::new("${git}/bin/git")'
'';
meta = with lib; {
broken = (stdenv.isLinux && stdenv.isAarch64);
description = ''
A build system that uses ptrace to handle dependencies automatically
'';
longDescription = ''
Fac is a general-purpose build system inspired by make that utilizes
ptrace to ensure that all dependences are enumerated and that all
source files are added to a (git) repo. An important feature of fac
is that it automatically handles dependencies, rather than either
complaining about them or giving an incorrect build. Currently, fac
only runs on linux systems, but on those systems it is incredibly
easy to use!
'';
homepage = "https://physics.oregonstate.edu/~roundyd/fac";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ dpercy ];
mainProgram = "fac";
};
}

View file

@ -0,0 +1,10 @@
{ callPackage, ... } @ args:
callPackage ./generic.nix args {
# Note: Please use the recommended version for Chromium, e.g.:
# https://git.archlinux.org/svntogit/packages.git/tree/trunk/chromium-gn-version.sh?h=packages/gn
rev = "fd3d768bcfd44a8d9639fe278581bd9851d0ce3a";
revNum = "1718"; # git describe HEAD --match initial-commit | cut -d- -f3
version = "2020-03-09";
sha256 = "1asc14y8by7qcn10vbk467hvx93s30pif8r0brissl0sihsaqazr";
}

View file

@ -0,0 +1,60 @@
{ stdenv, lib, fetchgit, darwin, writeText
, ninja, python3
, ...
}:
{ rev, revNum, version, sha256 }:
let
revShort = builtins.substring 0 7 rev;
lastCommitPosition = writeText "last_commit_position.h" ''
#ifndef OUT_LAST_COMMIT_POSITION_H_
#define OUT_LAST_COMMIT_POSITION_H_
#define LAST_COMMIT_POSITION_NUM ${revNum}
#define LAST_COMMIT_POSITION "${revNum} (${revShort})"
#endif // OUT_LAST_COMMIT_POSITION_H_
'';
in stdenv.mkDerivation {
pname = "gn-unstable";
inherit version;
src = fetchgit {
# Note: The TAR-Archives (+archive/${rev}.tar.gz) are not deterministic!
url = "https://gn.googlesource.com/gn";
inherit rev sha256;
};
nativeBuildInputs = [ ninja python3 ];
buildInputs = lib.optionals stdenv.isDarwin (with darwin; with apple_sdk.frameworks; [
libobjc
cctools
# frameworks
ApplicationServices
Foundation
AppKit
]);
buildPhase = ''
python build/gen.py --no-last-commit-position
ln -s ${lastCommitPosition} out/last_commit_position.h
ninja -j $NIX_BUILD_CORES -C out gn
'';
installPhase = ''
install -vD out/gn "$out/bin/gn"
'';
setupHook = ./setup-hook.sh;
meta = with lib; {
description = "A meta-build system that generates build files for Ninja";
homepage = "https://gn.googlesource.com/gn";
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = with maintainers; [ stesie matthewbauer primeos ];
};
}

View file

@ -0,0 +1,8 @@
{ callPackage, ... } @ args:
callPackage ./generic.nix args {
rev = "24e2f7df92641de0351a96096fb2c490b2436bb8";
revNum = "1924"; # git describe HEAD --match initial-commit | cut -d- -f3
version = "2021-08-08";
sha256 = "1lwkyhfhw0zd7daqz466n7x5cddf0danr799h4jg3s0yvd4galjl";
}

View file

@ -0,0 +1,14 @@
gnConfigurePhase() {
runHook preConfigure
echo "gn flags: $gnFlags ${gnFlagsArray[@]}"
gn gen out/Release --args="$gnFlags ${gnFlagsArray[@]}"
cd out/Release/
runHook postConfigure
}
if [ -z "${dontUseGnConfigure-}" -a -z "${configurePhase-}" ]; then
configurePhase=gnConfigurePhase
fi

View file

@ -0,0 +1,35 @@
From e00a5257a6ca5fedbf68b09eee7df3502971a057 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:11:40 +0200
Subject: [PATCH 1/2] No impure bin sh
default_shell is used to populuate default shell used to execute jobs.
Unless SHELL is set to a different value this would be /bin/sh.
Our stdenv provides sh in form of bash anyway. Having this value not
hard-coded has some advantages:
- It would ensure that on all systems it uses sh from its PATH rather
than /bin/sh, which helps as different systems might have different
shells there (bash vs. dash)
- In the past I had issues with LD_PRELOAD with BEAR, where /bin/sh
used a different glibc than BEAR which came from my development shell.
---
src/job.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/job.c b/src/job.c
index ae1f18b..6b4ddb3 100644
--- a/src/job.c
+++ b/src/job.c
@@ -77,7 +77,7 @@ char * vms_strsignal (int status);
#else
-const char *default_shell = "/bin/sh";
+const char *default_shell = "sh";
int batch_mode_shell = 0;
#endif
--
2.31.1

View file

@ -0,0 +1,40 @@
From 795d63d3c8b5c0dbb7e544954f75507b371b7228 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:20:16 +0200
Subject: [PATCH 2/2] remove impure dirs
---
src/read.c | 3 ---
src/remake.c | 2 --
2 files changed, 5 deletions(-)
diff --git a/src/read.c b/src/read.c
index fa197fb..defacfb 100644
--- a/src/read.c
+++ b/src/read.c
@@ -109,9 +109,6 @@ static const char *default_include_directories[] =
#endif
INCLUDEDIR,
#ifndef _AMIGA
- "/usr/gnu/include",
- "/usr/local/include",
- "/usr/include",
#endif
0
};
diff --git a/src/remake.c b/src/remake.c
index fb237c5..94bff7d 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -1601,8 +1601,6 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
static const char *dirs[] =
{
#ifndef _AMIGA
- "/lib",
- "/usr/lib",
#endif
#if defined(WINDOWS32) && !defined(LIBDIR)
/*
--
2.31.1

View file

@ -0,0 +1,61 @@
{ lib, stdenv, fetchurl, guileSupport ? false, pkg-config ? null , guile ? null }:
assert guileSupport -> ( pkg-config != null && guile != null );
stdenv.mkDerivation rec {
pname = "gnumake";
version = "4.2.1";
src = fetchurl {
url = "mirror://gnu/make/make-${version}.tar.bz2";
sha256 = "12f5zzyq2w56g95nni65hc0g5p7154033y2f3qmjvd016szn5qnn";
};
patchFlags = [ "-p0" ];
patches = [
# Purity: don't look for library dependencies (of the form `-lfoo') in /lib
# and /usr/lib. It's a stupid feature anyway. Likewise, when searching for
# included Makefiles, don't look in /usr/include and friends.
./impure-dirs.patch
./pselect.patch
# Fix support for glibc 2.27's glob, inspired by http://www.linuxfromscratch.org/lfs/view/8.2/chapter05/make.html
./glibc-2.27-glob.patch
./glibc-2.33-glob.patch
];
nativeBuildInputs = lib.optionals guileSupport [ pkg-config ];
buildInputs = lib.optionals guileSupport [ guile ];
configureFlags = lib.optional guileSupport "--with-guile"
# Make uses this test to decide whether it should keep track of
# subseconds. Apple made this possible with APFS and macOS 10.13.
# However, we still support macOS 10.11 and 10.12. Binaries built
# in Nixpkgs will be unable to use futimens to set mtime less than
# a second. So, tell Make to ignore nanoseconds in mtime here by
# overriding the autoconf test for the struct.
# See https://github.com/NixOS/nixpkgs/issues/51221 for discussion.
++ lib.optional stdenv.isDarwin "ac_cv_struct_st_mtim_nsec=no";
outputs = [ "out" "man" "info" ];
meta = with lib; {
description = "A tool to control the generation of non-source files from sources";
longDescription = ''
Make is a tool which controls the generation of executables and
other non-source files of a program from the program's source files.
Make gets its knowledge of how to build your program from a file
called the makefile, which lists each of the non-source files and
how to compute it from other files. When you write a program, you
should write a makefile for it, so that it is possible to use Make
to build and install the program.
'';
homepage = "https://www.gnu.org/software/make/";
license = licenses.gpl3Plus;
maintainers = [ maintainers.vrthra ];
mainProgram = "make";
platforms = platforms.all;
};
}

View file

@ -0,0 +1,32 @@
diff -Naur glob/glob.c glob/glob.c
--- glob/glob.c 2013-10-20 13:14:38.000000000 -0400
+++ glob/glob.c 2018-03-16 14:32:38.483496170 -0400
@@ -208,28 +208,9 @@
#endif /* __GNU_LIBRARY__ || __DJGPP__ */
-#if !defined __alloca && !defined __GNU_LIBRARY__
-
-# ifdef __GNUC__
-# undef alloca
-# define alloca(n) __builtin_alloca (n)
-# else /* Not GCC. */
-# ifdef HAVE_ALLOCA_H
# include <alloca.h>
-# else /* Not HAVE_ALLOCA_H. */
-# ifndef _AIX
-# ifdef WINDOWS32
-# include <malloc.h>
-# else
-extern char *alloca ();
-# endif /* WINDOWS32 */
-# endif /* Not _AIX. */
-# endif /* sparc or HAVE_ALLOCA_H. */
-# endif /* GCC. */
-
# define __alloca alloca
-#endif
#ifndef __GNU_LIBRARY__
# define __stat stat

View file

@ -0,0 +1,17 @@
diff --git glob/glob.c glob/glob.c
index 924f2b3..d4ef0c5 100644
--- glob/glob.c
+++ glob/glob.c
@@ -212,8 +212,8 @@ my_realloc (p, n)
# define __alloca alloca
-#ifndef __GNU_LIBRARY__
# define __stat stat
+#ifndef __GNU_LIBRARY__
# ifdef STAT_MACROS_BROKEN
# undef S_ISDIR
# endif
--
2.31.1

View file

@ -0,0 +1,34 @@
diff -rc read.c read.c
*** read.c 2006-03-17 15:24:20.000000000 +0100
--- read.c 2007-05-24 17:16:31.000000000 +0200
***************
*** 99,107 ****
--- 99,109 ----
#endif
INCLUDEDIR,
#ifndef _AMIGA
+ #if 0
"/usr/gnu/include",
"/usr/local/include",
"/usr/include",
+ #endif
#endif
0
};
diff -rc reremake.c
*** remake.c 2006-03-20 03:36:37.000000000 +0100
--- remake.c 2007-05-24 17:06:54.000000000 +0200
***************
*** 1452,1460 ****
--- 1452,1462 ----
static char *dirs[] =
{
#ifndef _AMIGA
+ #if 0
"/lib",
"/usr/lib",
#endif
+ #endif
#if defined(WINDOWS32) && !defined(LIBDIR)
/*
* This is completely up to the user at product install time. Just define

View file

@ -0,0 +1,170 @@
From b552b05251980f693c729e251f93f5225b400714 Mon Sep 17 00:00:00 2001
From: Paul Smith <psmith@gnu.org>
Date: Sat, 3 Jun 2017 16:20:51 -0400
Subject: [SV 51159] Use a non-blocking read with pselect to avoid hangs.
* posixos.c (set_blocking): Set blocking on a file descriptor.
(jobserver_setup): Set non-blocking on the jobserver read side.
(jobserver_parse_auth): Ditto.
(jobserver_acquire_all): Set blocking to avoid a busy-wait loop.
(jobserver_acquire): If the non-blocking read() returns without
taking a token then try again.
---
posixos.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 71 insertions(+), 26 deletions(-)
diff --git posixos.c posixos.c
index e642d7f..dbafa51 100644
--- posixos.c
+++ posixos.c
@@ -62,6 +62,24 @@ make_job_rfd (void)
#endif
}
+static void
+set_blocking (int fd, int blocking)
+{
+ // If we're not using pselect() don't change the blocking
+#ifdef HAVE_PSELECT
+ int flags;
+ EINTRLOOP (flags, fcntl (fd, F_GETFL));
+ if (flags >= 0)
+ {
+ int r;
+ flags = blocking ? (flags & ~O_NONBLOCK) : (flags | O_NONBLOCK);
+ EINTRLOOP (r, fcntl (fd, F_SETFL, flags));
+ if (r < 0)
+ pfatal_with_name ("fcntl(O_NONBLOCK)");
+ }
+#endif
+}
+
unsigned int
jobserver_setup (int slots)
{
@@ -86,6 +104,9 @@ jobserver_setup (int slots)
pfatal_with_name (_("init jobserver pipe"));
}
+ /* When using pselect() we want the read to be non-blocking. */
+ set_blocking (job_fds[0], 0);
+
return 1;
}
@@ -121,6 +142,9 @@ jobserver_parse_auth (const char *auth)
return 0;
}
+ /* When using pselect() we want the read to be non-blocking. */
+ set_blocking (job_fds[0], 0);
+
return 1;
}
@@ -169,7 +193,10 @@ jobserver_acquire_all (void)
{
unsigned int tokens = 0;
- /* Close the write side, so the read() won't hang. */
+ /* Use blocking reads to wait for all outstanding jobs. */
+ set_blocking (job_fds[0], 1);
+
+ /* Close the write side, so the read() won't hang forever. */
close (job_fds[1]);
job_fds[1] = -1;
@@ -236,18 +263,12 @@ jobserver_pre_acquire (void)
unsigned int
jobserver_acquire (int timeout)
{
- sigset_t empty;
- fd_set readfds;
struct timespec spec;
struct timespec *specp = NULL;
- int r;
- char intake;
+ sigset_t empty;
sigemptyset (&empty);
- FD_ZERO (&readfds);
- FD_SET (job_fds[0], &readfds);
-
if (timeout)
{
/* Alarm after one second (is this too granular?) */
@@ -256,28 +277,52 @@ jobserver_acquire (int timeout)
specp = &spec;
}
- r = pselect (job_fds[0]+1, &readfds, NULL, NULL, specp, &empty);
-
- if (r == -1)
+ while (1)
{
- /* Better be SIGCHLD. */
- if (errno != EINTR)
- pfatal_with_name (_("pselect jobs pipe"));
- return 0;
- }
+ fd_set readfds;
+ int r;
+ char intake;
- if (r == 0)
- /* Timeout. */
- return 0;
+ FD_ZERO (&readfds);
+ FD_SET (job_fds[0], &readfds);
- /* The read FD is ready: read it! */
- EINTRLOOP (r, read (job_fds[0], &intake, 1));
- if (r < 0)
- pfatal_with_name (_("read jobs pipe"));
+ r = pselect (job_fds[0]+1, &readfds, NULL, NULL, specp, &empty);
+ if (r < 0)
+ switch (errno)
+ {
+ case EINTR:
+ /* SIGCHLD will show up as an EINTR. */
+ return 0;
+
+ case EBADF:
+ /* Someone closed the jobs pipe.
+ That shouldn't happen but if it does we're done. */
+ O (fatal, NILF, _("job server shut down"));
- /* What does it mean if read() returns 0? It shouldn't happen because only
- the master make can reap all the tokens and close the write side...?? */
- return r > 0;
+ default:
+ pfatal_with_name (_("pselect jobs pipe"));
+ }
+
+ if (r == 0)
+ /* Timeout. */
+ return 0;
+
+ /* The read FD is ready: read it! This is non-blocking. */
+ EINTRLOOP (r, read (job_fds[0], &intake, 1));
+
+ if (r < 0)
+ {
+ /* Someone sniped our token! Try again. */
+ if (errno == EAGAIN)
+ continue;
+
+ pfatal_with_name (_("read jobs pipe"));
+ }
+
+ /* read() should never return 0: only the master make can reap all the
+ tokens and close the write side...?? */
+ return r > 0;
+ }
}
#else
--
cgit v1.0-41-gc330

View file

@ -0,0 +1,58 @@
{ lib, stdenv, fetchurl, guileSupport ? false, pkg-config, guile }:
stdenv.mkDerivation rec {
pname = "gnumake";
version = "4.3";
src = fetchurl {
url = "mirror://gnu/make/make-${version}.tar.gz";
sha256 = "06cfqzpqsvdnsxbysl5p2fgdgxgl9y4p7scpnrfa8z2zgkjdspz0";
};
# to update apply these patches with `git am *.patch` to https://git.savannah.gnu.org/git/make.git
patches = [
# Replaces /bin/sh with sh, see patch file for reasoning
./0001-No-impure-bin-sh.patch
# Purity: don't look for library dependencies (of the form `-lfoo') in /lib
# and /usr/lib. It's a stupid feature anyway. Likewise, when searching for
# included Makefiles, don't look in /usr/include and friends.
./0002-remove-impure-dirs.patch
];
nativeBuildInputs = lib.optionals guileSupport [ pkg-config ];
buildInputs = lib.optionals guileSupport [ guile ];
configureFlags = lib.optional guileSupport "--with-guile"
# Make uses this test to decide whether it should keep track of
# subseconds. Apple made this possible with APFS and macOS 10.13.
# However, we still support macOS 10.11 and 10.12. Binaries built
# in Nixpkgs will be unable to use futimens to set mtime less than
# a second. So, tell Make to ignore nanoseconds in mtime here by
# overriding the autoconf test for the struct.
# See https://github.com/NixOS/nixpkgs/issues/51221 for discussion.
++ lib.optional stdenv.isDarwin "ac_cv_struct_st_mtim_nsec=no";
outputs = [ "out" "man" "info" ];
separateDebugInfo = true;
meta = with lib; {
description = "A tool to control the generation of non-source files from sources";
longDescription = ''
Make is a tool which controls the generation of executables and
other non-source files of a program from the program's source files.
Make gets its knowledge of how to build your program from a file
called the makefile, which lists each of the non-source files and
how to compute it from other files. When you write a program, you
should write a makefile for it, so that it is possible to use Make
to build and install the program.
'';
homepage = "https://www.gnu.org/software/make/";
license = licenses.gpl3Plus;
maintainers = [ maintainers.vrthra ];
mainProgram = "make";
platforms = platforms.all;
};
}

View file

@ -0,0 +1,90 @@
{ stdenv
, lib
, fetchFromGitHub
, gnat
, which
, xmlada # for src
}:
let
version = "22.0.0";
gprConfigKbSrc = fetchFromGitHub {
name = "gprconfig-kb-${version}-src";
owner = "AdaCore";
repo = "gprconfig_kb";
rev = "v${version}";
sha256 = "0zvd0v5cz0zd1hfnhdd91c6sr3bbv1w715j2gvzx3vxlpx1c2q4n";
};
in
stdenv.mkDerivation {
pname = "gprbuild-boot";
inherit version;
src = fetchFromGitHub {
name = "gprbuild-${version}";
owner = "AdaCore";
repo = "gprbuild";
rev = "v${version}";
sha256 = "0rv0ha0kxzab5hhv0jzkjkmchhlvlx8fci8xalnngrgb9nd4r3v8";
};
nativeBuildInputs = [
gnat
which
];
postPatch = ''
# The Makefile uses gprbuild to build gprbuild which
# we can't do at this point, delete it to prevent the
# default phases from failing.
rm Makefile
# make sure bootstrap script runs
patchShebangs --build bootstrap.sh
'';
# This setupHook populates GPR_PROJECT_PATH which is used by
# gprbuild to find dependencies. It works quite similar to
# the pkg-config setupHook in the sense that it also splits
# dependencies into GPR_PROJECT_PATH and GPR_PROJECT_PATH_FOR_BUILD,
# but gprbuild itself doesn't support this, so we'll need to
# introducing a wrapper for it in the future remains TODO.
# For the moment this doesn't matter since we have no situation
# were gprbuild is used to build something used at build time.
setupHook = ./gpr-project-path-hook.sh;
installPhase = ''
runHook preInstall
./bootstrap.sh \
--with-xmlada=${xmlada.src} \
--with-kb=${gprConfigKbSrc} \
--prefix=$out
# Install custom compiler description which can detect nixpkgs'
# GNAT wrapper as a proper Ada compiler. The default compiler
# description expects the runtime library to be installed in
# the same prefix which isn't the case for nixpkgs. As a
# result, it would detect the unwrapped GNAT as a proper
# compiler which is unable to produce working binaries.
#
# Our compiler description is very similar to the upstream
# GNAT description except that we use a symlink in $out/nix-support
# created by the cc-wrapper to find the associated runtime
# libraries and use gnatmake instead of gnatls to find GNAT's
# bin directory.
install -m644 ${./nixpkgs-gnat.xml} $out/share/gprconfig/nixpkgs-gnat.xml
runHook postInstall
'';
meta = with lib; {
description = "Multi-language extensible build tool";
homepage = "https://github.com/AdaCore/gprbuild";
license = licenses.gpl3Plus;
maintainers = [ maintainers.sternenseemann ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,65 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, gprbuild-boot
, which
, gnat
, xmlada
}:
stdenv.mkDerivation {
pname = "gprbuild";
# See ./boot.nix for an explanation of the gprbuild setupHook,
# our custom knowledge base entry and the situation wrt a
# (future) gprbuild wrapper.
inherit (gprbuild-boot)
version
src
setupHook
meta
;
nativeBuildInputs = [
gnat
gprbuild-boot
which
];
propagatedBuildInputs = [
xmlada
];
makeFlags = [
"ENABLE_SHARED=${if stdenv.hostPlatform.isStatic then "no" else "yes"}"
"PROCESSORS=$(NIX_BUILD_CORES)"
# confusingly, for gprbuild --target is autoconf --host
"TARGET=${stdenv.hostPlatform.config}"
"prefix=${placeholder "out"}"
] ++ lib.optionals (!stdenv.hostPlatform.isStatic) [
"LIBRARY_TYPE=relocatable"
];
# Fixes gprbuild being linked statically always
patches = lib.optional (!stdenv.hostPlatform.isStatic) (fetchpatch {
name = "gprbuild-relocatable-build.patch";
url = "https://aur.archlinux.org/cgit/aur.git/plain/relocatable-build.patch?h=gprbuild&id=1d4e8a5cb982e79135a0aaa3ef87654bed1fe4f0";
sha256 = "1r3xsp1pk9h666mm8mdravkybmd5gv2f751x2ffb1kxnwq1rwiyn";
});
buildFlags = [ "all" "libgpr.build" ];
installFlags = [ "all" "libgpr.install" ];
# link gprconfig_kb db from gprbuild-boot into build dir,
# the install process copies its contents to $out
preInstall = ''
ln -sf ${gprbuild-boot}/share/gprconfig share/gprconfig
'';
# no need for the install script
postInstall = ''
rm $out/doinstall
'';
}

View file

@ -0,0 +1,8 @@
addAdaObjectsPath() {
local role_post
getHostRoleEnvHook
addToSearchPath "GPR_PROJECT_PATH${role_post}" "$1/share/gpr"
}
addEnvHooks "$targetOffset" addAdaObjectsPath

View file

@ -0,0 +1,56 @@
<?xml version="1.0" ?>
<gprconfig>
<!-- This differs from the default GNAT compiler description
in the following ways:
* gnatmake is used over gnatls to detect the GNAT version
since the latter is not part of the wrapper.
* to find the runtime libraries, we rely on the symlink
../nix-support/gprconfig-gnat-unwrapped which is a
gprconfig-specific addition to the cc-wrapper we employ
for Ada compilers (which is only GNAT at the moment).
For documentation on this file format and its use refer to
https://docs.adacore.com/gprbuild-docs/html/gprbuild_ug/companion_tools.html#the-gprconfig-knowledge-base
-->
<compiler_description>
<!-- We would like to name this something different, so users
of gprconfig know this is something custom, nixpkgs-related,
but unfortunately the knowledge base depends on the name of
the compiler for e. g. linker settings.
-->
<name>GNAT</name>
<executable prefix="1">(.*-.*-.*)?gnatmake</executable>
<version>
<external>${PREFIX}gnatmake -v</external>
<grep regexp="^GNATMAKE.+?(\d+(\.\d+)?)" group="1"></grep>
</version>
<languages>Ada</languages>
<variable name="gcc_version">
<external>${PREFIX}gcc -v</external>
<grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
</variable>
<!-- The ada runtime libraries and objects are only part of the unwrapped
GNAT derivation. We can't symlink them into the wrapper derivation
(at least not the canonical location) since that screws with linking
against libraries distributed with gcc.
As a workaround, we create a symlink to the unwrapped GNAT's "out"
output in the cc-wrapper which we can read into a variable here and
use to find GNAT's Ada runtime.
-->
<variable name="gnat_unwrapped">
<external>readlink -n ${PATH}/../nix-support/gprconfig-gnat-unwrapped</external>
</variable>
<runtimes default="default,kernel,native">
<directory group="default" >$gnat_unwrapped/lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
<directory group="default" contents="^rts-">$gnat_unwrapped/lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
<directory group="2" >$gnat_unwrapped/lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
<directory group="1" >$gnat_unwrapped/$TARGET/lib/gnat/(.*)/adalib/</directory>
</runtimes>
<target>
<external>${PREFIX}gcc -dumpmachine</external>
<grep regexp="[^\r\n]+"></grep>
</target>
</compiler_description>
</gprconfig>

View file

@ -0,0 +1,133 @@
{ jdk8, jdk11, jdk17 }:
rec {
gen =
{ version, nativeVersion, sha256, defaultJava ? jdk8, supportedPlatforms ? null }:
{ lib, stdenv, fetchurl, makeWrapper, unzip, java ? defaultJava
, javaToolchains ? [ ], ncurses5, ncurses6 }:
stdenv.mkDerivation rec {
pname = "gradle";
inherit version;
src = fetchurl {
inherit sha256;
url =
"https://services.gradle.org/distributions/gradle-${version}-bin.zip";
};
dontBuild = true;
nativeBuildInputs = [ makeWrapper unzip ];
buildInputs = [ java ];
# NOTE: For more information on toolchains,
# see https://docs.gradle.org/current/userguide/toolchains.html
installPhase = with builtins;
let
toolchain = rec {
var = x: "JAVA_TOOLCHAIN_NIX_${toString x}";
vars = (lib.imap0 (i: x: ("${var i} ${x}")) javaToolchains);
varNames = lib.imap0 (i: x: var i) javaToolchains;
property = " -Porg.gradle.java.installations.fromEnv='${
concatStringsSep "," varNames
}'";
};
vars = concatStringsSep "\n" (map (x: " --set ${x} \\")
([ "JAVA_HOME ${java}" ] ++ toolchain.vars));
in ''
mkdir -pv $out/lib/gradle/
cp -rv lib/ $out/lib/gradle/
gradle_launcher_jar=$(echo $out/lib/gradle/lib/gradle-launcher-*.jar)
test -f $gradle_launcher_jar
makeWrapper ${java}/bin/java $out/bin/gradle \
${vars}
--add-flags "-classpath $gradle_launcher_jar org.gradle.launcher.GradleMain${toolchain.property}"
'';
dontFixup = !stdenv.isLinux;
fixupPhase = let arch = if stdenv.is64bit then "amd64" else "i386";
in ''
for variant in "" "-ncurses5" "-ncurses6"; do
mkdir "patching$variant"
pushd "patching$variant"
jar xf $out/lib/gradle/lib/native-platform-linux-${arch}$variant-${nativeVersion}.jar
patchelf \
--set-rpath "${stdenv.cc.cc.lib}/lib64:${lib.makeLibraryPath [ stdenv.cc.cc ncurses5 ncurses6 ]}" \
net/rubygrapefruit/platform/linux-${arch}$variant/libnative-platform*.so
jar cf native-platform-linux-${arch}$variant-${nativeVersion}.jar .
mv native-platform-linux-${arch}$variant-${nativeVersion}.jar $out/lib/gradle/lib/
popd
done
# The scanner doesn't pick up the runtime dependency in the jar.
# Manually add a reference where it will be found.
mkdir $out/nix-support
echo ${stdenv.cc.cc} > $out/nix-support/manual-runtime-dependencies
# Gradle will refuse to start without _both_ 5 and 6 versions of ncurses.
echo ${ncurses5} >> $out/nix-support/manual-runtime-dependencies
echo ${ncurses6} >> $out/nix-support/manual-runtime-dependencies
'';
meta = with lib; {
description = "Enterprise-grade build system";
longDescription = ''
Gradle is a build system which offers you ease, power and freedom.
You can choose the balance for yourself. It has powerful multi-project
build support. It has a layer on top of Ivy that provides a
build-by-convention integration for Ivy. It gives you always the choice
between the flexibility of Ant and the convenience of a
build-by-convention behavior.
'';
homepage = "https://www.gradle.org/";
changelog = "https://docs.gradle.org/${version}/release-notes.html";
downloadPage = "https://gradle.org/next-steps/?version=${version}";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
platforms = if (supportedPlatforms != null) then supportedPlatforms else platforms.unix;
maintainers = with maintainers; [ lorenzleutgeb liff ];
};
};
# NOTE: Default JDKs are LTS versions and according to
# https://docs.gradle.org/current/userguide/compatibility.html
gradle_7 = gen {
version = "7.4.2";
nativeVersion = "0.22-milestone-23";
sha256 = "1nkz9gn1vb5l94dkf9yzb1j3hkll5x2vrl5p320msn2fk089pr19";
defaultJava = jdk17;
# Gradle 7 ships some binaries that are only available for some platforms
# See https://github.com/gradle/native-platform#supported-platforms
supportedPlatforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-cygwin" "x86_64-windows" "i686-windows" ];
};
gradle_6 = gen {
version = "6.9.2";
nativeVersion = "0.22-milestone-20";
sha256 = "13qyk3f6namw27ynh6nxljxpk9r3l12vxl3f0qpglprdf3c6ydcb";
defaultJava = jdk11;
# Gradle 6 ships some binaries that are only available for some platforms
# See https://github.com/gradle/native-platform#supported-platforms
supportedPlatforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-cygwin" "x86_64-windows" "i686-windows" ];
};
# NOTE: No GitHub Release for the following versions. `update.sh` will not work.
gradle_5 = gen {
version = "5.6.4";
nativeVersion = "0.18";
sha256 = "03d86bbqd19h9xlanffcjcy3vg1k5905vzhf9mal9g21603nfc0z";
defaultJava = jdk11;
};
gradle_4 = gen {
version = "4.10.3";
nativeVersion = "0.14";
sha256 = "0vhqxnk0yj3q9jam5w4kpia70i4h0q4pjxxqwynh3qml0vrcn9l6";
defaultJava = jdk8;
};
}

View file

@ -0,0 +1,67 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix-prefetch curl jq
# Generates Gradle release specs from GitHub Releases.
#
# As of 2021-11, this script has very poor error handling,
# it is expected to be run by maintainers as one-off job
# only.
#
# NOTE: The earliest Gradle release that has a
# corresponding entry as GitHub Release is 6.8-rc-1.
for v in $(curl -s "https://api.github.com/repos/gradle/gradle/releases" | jq -r '.[].tag_name' | sort -n -r)
do
# Tag names and download filenames are not the same,
# we modify the tag name slightly to translate it
# to the naming scheme of download filenames.
# This translation assumes a tag naming scheme.
# As of 2021-11 it works from 6.8-rc-1 to 7.3-rc-3.
# Remove first letter (assumed to be "v").
v=${v:1}
# To lower case.
v=${v,,}
# Add dash after "rc".
v=${v/-rc/-rc-}
# Remove trailing ".0"
v=${v%.0}
# Remove trailing ".0" for release candidates.
v=${v/.0-rc/-rc}
f="gradle-${v}-spec.nix"
if [[ -n "$1" && "$1" != "$v" ]]
then
echo "$v SKIP (nomatch)"
continue
elif [ "$1" == "" ] && [ -f "$f" ]
then
echo "$v SKIP (exists)"
continue
fi
url="https://services.gradle.org/distributions/gradle-${v}-bin.zip"
read -d "\n" gradle_hash gradle_path < <(nix-prefetch-url --print-path $url)
# Prefix and suffix for "native-platform" dependency.
gradle_native_prefix="gradle-$v/lib/native-platform-"
gradle_native_suffix=".jar"
tmp=$(mktemp)
zipinfo -1 "$gradle_path" "$gradle_native_prefix*$gradle_native_suffix" > $tmp
gradle_native=$(cat $tmp | head -n1)
gradle_native=${gradle_native#"$gradle_native_prefix"}
gradle_native=${gradle_native%"$gradle_native_suffix"}
# Supported architectures
#grep -Pho "(linux|osx)-\w+" $tmp | sort | uniq
rm -f $tmp
echo -e "{\\n version = \"$v\";\\n nativeVersion = \"$gradle_native\";\\n sha256 = \"$gradle_hash\";\\n}" > $f
echo "$v DONE"
done

View file

@ -0,0 +1,45 @@
{ stdenv, fetchFromGitHub, nix-update-source, lib, python3
, which, runtimeShell, pychecker ? null }:
stdenv.mkDerivation rec {
version = "0.8.0";
src = fetchFromGitHub {
owner = "timbertson";
repo = "gup";
rev = "version-${version}";
sha256 = "1zjd76jyb5zc9w3l368723bjmxjl05s096g8ipwncfks1p9hdgf3";
};
pname = "gup";
nativeBuildInputs = [ python3 which pychecker ];
buildInputs = [ python3 ];
strictDeps = true;
SKIP_PYCHECKER = pychecker == null;
buildPhase = "make python";
installPhase = ''
mkdir $out
cp -r python/bin $out/bin
'';
passthru.updateScript = [
runtimeShell
"-c"
''
set -e
echo
cd ${toString ./.}
${nix-update-source}/bin/nix-update-source \
--prompt version \
--replace-attr version \
--set owner timbertson \
--set repo gup \
--set type fetchFromGitHub \
--set rev 'version-{version}' \
--modify-nix default.nix
''
];
meta = {
inherit (src.meta) homepage;
description = "A better make, inspired by djb's redo";
license = lib.licenses.lgpl2Plus;
maintainers = [ lib.maintainers.timbertson ];
platforms = lib.platforms.all;
};
}

View file

@ -0,0 +1,46 @@
{ lib, stdenv, fetchFromGitLab, makeWrapper, gcc, ncurses }:
stdenv.mkDerivation rec {
pname = "icmake";
version = "9.03.01";
src = fetchFromGitLab {
sha256 = "05r0a69w0hv2qhjpb2bxd0lmp2vv5r2d4iggg6ly4miam0i318jy";
rev = version;
repo = "icmake";
owner = "fbb-git";
};
setSourceRoot = ''
sourceRoot=$(echo */icmake)
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ gcc ];
preConfigure = ''
patchShebangs ./
substituteInPlace INSTALL.im --replace "usr/" ""
'';
buildPhase = ''
./icm_prepare $out
./icm_bootstrap x
'';
installPhase = ''
./icm_install all /
wrapProgram $out/bin/icmbuild \
--prefix PATH : ${ncurses}/bin
'';
meta = with lib; {
description = "A program maintenance (make) utility using a C-like grammar";
homepage = "https://fbb-git.gitlab.io/icmake/";
license = licenses.gpl3;
maintainers = with maintainers; [ pSub ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,45 @@
{ lib, stdenv, fetchurl, bison }:
stdenv.mkDerivation rec {
pname = "jam";
version = "2.6.1";
src = fetchurl {
url = "https://swarm.workshop.perforce.com/projects/perforce_software-jam/download/main/${pname}-${version}.tar";
sha256 = "19xkvkpycxfsncxvin6yqrql3x3z9ypc1j8kzls5k659q4kv5rmc";
};
nativeBuildInputs = [ bison ];
preConfigure = ''
unset AR
'';
buildPhase = ''
runHook preBuild
make jam0
runHook postBuild
'';
installPhase = ''
runHook preInstall
./jam0 -j$NIX_BUILD_CORES -sBINDIR=$out/bin install
mkdir -p $out/doc/jam
cp *.html $out/doc/jam
runHook postInstall
'';
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://www.perforce.com/resources/documentation/jam";
license = licenses.free;
description = "Just Another Make";
maintainers = with maintainers; [ orivej ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,53 @@
{ lib
, stdenv
, fetchurl
, bison
}:
stdenv.mkDerivation rec {
pname = "ftjam";
version = "2.5.2";
src = fetchurl {
url = "https://downloads.sourceforge.net/project/freetype/${pname}/${version}/${pname}-${version}.tar.bz2";
hash = "sha256-6JdzUAqSkS3pGOn+v/q+S2vOedaa8ZRDX04DK4ptZqM=";
};
nativeBuildInputs = [
bison
];
preConfigure = ''
unset AR
'';
buildPhase = ''
runHook preBuild
make jam0
runHook postBuild
'';
installPhase = ''
runHook preInstall
./jam0 -j$NIX_BUILD_CORES -sBINDIR=$out/bin install
mkdir -p $out/doc/jam
cp *.html $out/doc/jam
runHook postInstall
'';
enableParallelBuilding = true;
meta = with lib; {
description = "Freetype's enhanced, backwards-compatible Jam clone";
homepage = "https://freetype.org/jam/";
license = licenses.free;
maintainers = with maintainers; [ AndersonTorres ];
mainProgram = "jam";
platforms = platforms.unix;
};
}
# TODO: setup hook for Jam

View file

@ -0,0 +1,27 @@
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation {
pname = "kati-unstable";
version = "2019-09-23";
src = fetchFromGitHub {
owner = "google";
repo = "kati";
rev = "9da3296746a0cd55b38ebebf91e7f57105a4c36f";
sha256 = "0s5dfhgpcbx12b1fqmm8p0jpvrhgrnl9qywv1ksbwhw3pfp7j866";
};
patches = [ ./version.patch ];
installPhase = ''
install -D ckati $out/bin/ckati
'';
meta = with lib; {
description = "An experimental GNU make clone";
homepage = "https://github.com/google/kati";
platforms = platforms.all;
license = licenses.asl20;
maintainers = with maintainers; [ danielfullmer ];
};
}

View file

@ -0,0 +1,19 @@
diff --git a/Makefile.ckati b/Makefile.ckati
index e4067bb..15518f3 100644
--- a/Makefile.ckati
+++ b/Makefile.ckati
@@ -102,14 +102,8 @@ $(KATI_CXX_TEST_EXES): $(KATI_BIN_PATH)/%: $(KATI_INTERMEDIATES_PATH)/%.o
$(KATI_LD) $^ -o $@ $(KATI_LIBS)
# Rule to generate version.cc
-KATI_GIT_DIR := $(shell git -C $(KATI_SRC_PATH) rev-parse --show-toplevel)
-ifneq ($(KATI_GIT_DIR),)
-KATI_VERSION_DEPS := $(KATI_GIT_DIR)/.git/HEAD $(KATI_GIT_DIR)/.git/index
-KATI_VERSION := $(shell git -C $(KATI_GIT_DIR) rev-parse HEAD)
-else
KATI_VERSION_DEPS :=
KATI_VERSION := unknown
-endif
$(KATI_INTERMEDIATES_PATH)/version.cc: $(KATI_VERSION_DEPS)
@mkdir -p $(dir $@)
echo '// +build ignore' > $@

View file

@ -0,0 +1,54 @@
{ lib, stdenv, fetchurl, makeWrapper
, coreutils, jdk, rlwrap, gnupg }:
stdenv.mkDerivation rec {
pname = "leiningen";
version = "2.9.8";
src = fetchurl {
url = "https://raw.github.com/technomancy/leiningen/${version}/bin/lein-pkg";
sha256 = "1sgnxw58srjxqnskl700p7r7n23pfpjvqpiqnz1m8r6c76jwnllr";
};
jarsrc = fetchurl {
url = "https://github.com/technomancy/leiningen/releases/download/${version}/${pname}-${version}-standalone.jar";
sha256 = "13f4n15i0gsk9jq52gxivnsk32qjahmxgrddm54cf8ynw0a923ia";
};
JARNAME = "${pname}-${version}-standalone.jar";
dontUnpack = true;
nativeBuildInputs = [ makeWrapper ];
propagatedBuildInputs = [ jdk ];
# the jar is not in share/java, because it's a standalone jar and should
# never be picked up by set-java-classpath.sh
installPhase = ''
mkdir -p $out/bin $out/share
cp -v $src $out/bin/lein
cp -v $jarsrc $out/share/$JARNAME
'';
fixupPhase = ''
chmod +x $out/bin/lein
patchShebangs $out/bin/lein
substituteInPlace $out/bin/lein \
--replace 'LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar' "LEIN_JAR=$out/share/$JARNAME"
wrapProgram $out/bin/lein \
--prefix PATH ":" "${lib.makeBinPath [ rlwrap coreutils ]}" \
--set LEIN_GPG ${gnupg}/bin/gpg \
--set JAVA_CMD ${jdk}/bin/java
'';
meta = {
homepage = "https://leiningen.org/";
description = "Project automation for Clojure";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.epl10;
platforms = lib.platforms.linux ++ lib.platforms.darwin;
maintainers = with lib.maintainers; [ thiagokokada ];
mainProgram = "lein";
};
}

Some files were not shown because too many files have changed in this diff Show more