Last active
April 23, 2018 20:17
-
-
Save siepkes/989ac0267082b1a2df6aafa222964358 to your computer and use it in GitHub Desktop.
Patch to make Bazel 0.11.1 dist build on SmartOS (aka Illumos, aka Solaris)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/scripts/bootstrap/buildenv.sh bazel/scripts/bootstrap/buildenv.sh | |
--- bazel-orig/scripts/bootstrap/buildenv.sh 2018-04-01 14:52:36.150686900 +0000 | |
+++ bazel/scripts/bootstrap/buildenv.sh 2018-04-16 15:39:12.323691231 +0000 | |
@@ -83,6 +83,10 @@ | |
JAVA_HOME="${JAVA_HOME:-/usr/local/openjdk8}" | |
;; | |
+solaris) | |
+ JAVA_HOME="${JAVA_HOME:-/opt/local/java/openjdk8}" | |
+ ;; | |
+ | |
darwin) | |
if [[ -z "$JAVA_HOME" ]]; then | |
JAVA_HOME="$(/usr/libexec/java_home -v ${JAVA_VERSION}+ 2> /dev/null)" \ | |
@@ -162,6 +166,7 @@ | |
mkdir -p "${DIR}" | |
local DIRBASE=$(basename "${DIR}") | |
eval "cleanup_tempdir_${DIRBASE}() { rm -rf '${DIR}' >&/dev/null || true ; }" | |
+ # Comment out to prevent deletion of Bazel tempdir when bootstrapping. | |
atexit cleanup_tempdir_${DIRBASE} | |
NEW_TMPDIR="${DIR}" | |
} | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/scripts/packages/BUILD bazel/scripts/packages/BUILD | |
--- bazel-orig/scripts/packages/BUILD 2018-04-01 14:52:36.152851396 +0000 | |
+++ bazel/scripts/packages/BUILD 2018-04-01 14:53:02.525363493 +0000 | |
@@ -20,6 +20,7 @@ | |
":zip-bazel-exe_with_jdk", | |
], | |
"//src/conditions:freebsd": [], | |
+ "//src/conditions:solaris": [], | |
"//src/conditions:darwin": [ | |
":with-jdk/install.sh", | |
":without-jdk/install.sh", | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/scripts/packages/template_bin.sh bazel/scripts/packages/template_bin.sh | |
--- bazel-orig/scripts/packages/template_bin.sh 2018-04-01 14:52:36.153891624 +0000 | |
+++ bazel/scripts/packages/template_bin.sh 2018-04-01 16:09:31.609314786 +0000 | |
@@ -109,6 +109,10 @@ | |
JAVA_HOME="/usr/local/openjdk8" | |
BASHRC="~/.bashrc" | |
;; | |
+ solaris) | |
+ JAVA_HOME="/opt/local/java/openjdk8" | |
+ BASHRC="~/.bashrc" | |
+ ;; | |
darwin) | |
JAVA_HOME="$(/usr/libexec/java_home -v ${JAVA_VERSION}+ 2> /dev/null)" || true | |
BASHRC="~/.bash_profile" | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/conditions/BUILD bazel/src/conditions/BUILD | |
--- bazel-orig/src/conditions/BUILD 2018-04-01 14:52:36.170223015 +0000 | |
+++ bazel/src/conditions/BUILD 2018-04-01 14:53:02.525807667 +0000 | |
@@ -41,6 +41,12 @@ | |
) | |
config_setting( | |
+ name = "solaris", | |
+ values = {"cpu": "solaris"}, | |
+ visibility = ["//visibility:public"], | |
+) | |
+ | |
+config_setting( | |
name = "windows", | |
values = {"cpu": "x64_windows"}, | |
visibility = ["//visibility:public"], | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/conditions/BUILD.tools bazel/src/conditions/BUILD.tools | |
--- bazel-orig/src/conditions/BUILD.tools 2018-04-01 14:52:36.170282808 +0000 | |
+++ bazel/src/conditions/BUILD.tools 2018-04-01 14:53:02.526128210 +0000 | |
@@ -5,6 +5,12 @@ | |
) | |
config_setting( | |
+ name = "solaris", | |
+ values = {"cpu": "solaris"}, | |
+ visibility = ["//visibility:public"], | |
+) | |
+ | |
+config_setting( | |
name = "darwin", | |
values = {"cpu": "darwin"}, | |
visibility = ["//visibility:public"], | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/cpp/BUILD bazel/src/main/cpp/BUILD | |
--- bazel-orig/src/main/cpp/BUILD 2018-04-01 14:52:36.197713025 +0000 | |
+++ bazel/src/main/cpp/BUILD 2018-04-08 13:16:32.270017910 +0000 | |
@@ -30,6 +30,10 @@ | |
"blaze_util_freebsd.cc", | |
"blaze_util_posix.cc", | |
], | |
+ "//src/conditions:solaris": [ | |
+ "blaze_util_solaris.cc", | |
+ "blaze_util_posix.cc", | |
+ ], | |
"//src/conditions:windows": [ | |
"blaze_util_windows.cc", | |
], | |
@@ -51,6 +55,8 @@ | |
], | |
"//src/conditions:freebsd": [ | |
], | |
+ "//src/conditions:solaris": [ | |
+ ], | |
"//src/conditions:windows": WIN_LINK_OPTS, | |
"//conditions:default": [ | |
"-lrt", | |
@@ -90,6 +96,8 @@ | |
"-lprocstat", | |
"-lm", | |
], | |
+ "//src/conditions:solaris": [ | |
+ ], | |
"//src/conditions:windows": [ | |
], | |
"//conditions:default": [ | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/cpp/blaze_util_posix.cc bazel/src/main/cpp/blaze_util_posix.cc | |
--- bazel-orig/src/main/cpp/blaze_util_posix.cc 2018-04-01 14:52:36.198483300 +0000 | |
+++ bazel/src/main/cpp/blaze_util_posix.cc 2018-04-08 13:49:26.334619776 +0000 | |
@@ -31,6 +31,9 @@ | |
#include <sys/wait.h> | |
#include <time.h> | |
#include <unistd.h> | |
+#if defined(__sun) | |
+#include <sys/termios.h> // TIOCGWINSZ | |
+#endif | |
#include <cassert> | |
#include <cinttypes> | |
@@ -674,12 +677,16 @@ | |
// Arguably we should ensure this fits in the 4KB we lock. In practice no one | |
// will have a cwd long enough to overflow that, and nothing currently uses | |
// the rest of the lock file anyway. | |
+#if defined(__sun) | |
+// TODO: Implement for Illumos / Solaris. Illumos does not support dprintf (POSIX 2008). | |
+#else | |
dprintf(lockfd, "pid=%d\nowner=client\n", getpid()); | |
string cwd = blaze_util::GetCwd(); | |
dprintf(lockfd, "cwd=%s\n", cwd.c_str()); | |
if (const char *tty = ttyname(STDIN_FILENO)) { // NOLINT (single-threaded) | |
dprintf(lockfd, "tty=%s\n", tty); | |
} | |
+#endif | |
blaze_lock->lockfd = lockfd; | |
return wait_time; | |
} | |
@@ -814,7 +821,9 @@ | |
bool UnlimitResources() { | |
bool success = true; | |
success &= UnlimitResource(RLIMIT_NOFILE); | |
+#if defined(RLIMIT_NPROC) | |
success &= UnlimitResource(RLIMIT_NPROC); | |
+#endif | |
return success; | |
} | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/cpp/blaze_util_solaris.cc bazel/src/main/cpp/blaze_util_solaris.cc | |
--- bazel-orig/src/main/cpp/blaze_util_solaris.cc 1970-01-01 00:00:00.000000000 +0000 | |
+++ bazel/src/main/cpp/blaze_util_solaris.cc 2018-04-17 14:15:16.542039977 +0000 | |
@@ -0,0 +1,257 @@ | |
+// Copyright 2014 The Bazel Authors. All rights reserved. | |
+// | |
+// Licensed under the Apache License, Version 2.0 (the "License"); | |
+// you may not use this file except in compliance with the License. | |
+// You may obtain a copy of the License at | |
+// | |
+// http://www.apache.org/licenses/LICENSE-2.0 | |
+// | |
+// Unless required by applicable law or agreed to in writing, software | |
+// distributed under the License is distributed on an "AS IS" BASIS, | |
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+// See the License for the specific language governing permissions and | |
+// limitations under the License. | |
+ | |
+// Copied from the Linux version since Solaris also supports /proc. | |
+// | |
+// TODO: Needs to be checked for correctness. | |
+// | |
+// Following methods implemented specifically for Solaris: | |
+// - GetSelfPath | |
+// - GetStartTime (internal) | |
+// - WriteSystemSpecificProcessIdentifier | |
+// - VerifyServerProcess | |
+// - GetProcessCWD | |
+ | |
+#include <errno.h> // errno, ENAMETOOLONG | |
+#include <limits.h> | |
+#include <pwd.h> | |
+#include <signal.h> | |
+#include <stdio.h> | |
+#include <stdlib.h> | |
+#include <string.h> // strerror | |
+#include <sys/socket.h> | |
+#include <sys/stat.h> | |
+#include <sys/statfs.h> | |
+#include <sys/types.h> | |
+#include <unistd.h> | |
+#include <procfs.h> // psinfo | |
+#include <time.h> | |
+ | |
+ | |
+#include "src/main/cpp/blaze_util.h" | |
+#include "src/main/cpp/blaze_util_platform.h" | |
+#include "src/main/cpp/util/errors.h" | |
+#include "src/main/cpp/util/exit_code.h" | |
+#include "src/main/cpp/util/file.h" | |
+#include "src/main/cpp/util/port.h" | |
+#include "src/main/cpp/util/strings.h" | |
+ | |
+namespace blaze { | |
+ | |
+using blaze_util::die; | |
+using blaze_util::pdie; | |
+using blaze_util::PrintWarning; | |
+using std::string; | |
+using std::vector; | |
+ | |
+string GetOutputRoot() { | |
+ string base; | |
+ string home = GetHomeDir(); | |
+ if (!home.empty()) { | |
+ base = home; | |
+ } else { | |
+ char buf[2048]; | |
+ struct passwd pwbuf; | |
+ struct passwd *pw = NULL; | |
+ int uid = getuid(); | |
+ int r = getpwuid_r(uid, &pwbuf, buf, 2048, &pw); | |
+ if (r != -1 && pw != NULL) { | |
+ base = pw->pw_dir; | |
+ } | |
+ } | |
+ | |
+ if (!base.empty()) { | |
+ return blaze_util::JoinPath(base, ".cache/bazel"); | |
+ } | |
+ | |
+ return "/tmp"; | |
+} | |
+ | |
+void WarnFilesystemType(const string& output_base) { | |
+ // TODO: Implement on Solaris | |
+} | |
+ | |
+string GetSelfPath() { | |
+ char buffer_link[PATH_MAX] = {}; | |
+ char buffer_target[PATH_MAX] = {}; | |
+ auto pid = getpid(); | |
+ if (kill(pid, 0) < 0) return ""; | |
+ | |
+ snprintf(buffer_link, PATH_MAX, "/proc/%u/path/a.out", pid); | |
+ ssize_t bytes = readlink(buffer_link, buffer_target, PATH_MAX - 1); | |
+ if (bytes == PATH_MAX - 1) { | |
+ // symlink contents truncated | |
+ bytes = -1; | |
+ errno = ENAMETOOLONG; | |
+ } | |
+ if (bytes == -1) { | |
+ pdie(blaze_exit_code::INTERNAL_ERROR, "error reading /proc/PID/path/a.out"); | |
+ } | |
+ buffer_target[bytes] = '\0'; // readlink does not NUL-terminate | |
+ return string(buffer_target); | |
+} | |
+ | |
+uint64_t GetMillisecondsMonotonic() { | |
+ struct timespec ts = {}; | |
+ clock_gettime(CLOCK_MONOTONIC, &ts); | |
+ return ts.tv_sec * 1000LL + (ts.tv_nsec / 1000000LL); | |
+} | |
+ | |
+uint64_t GetMillisecondsSinceProcessStart() { | |
+ struct timespec ts = {}; | |
+ clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); | |
+ return ts.tv_sec * 1000LL + (ts.tv_nsec / 1000000LL); | |
+} | |
+ | |
+void SetScheduling(bool batch_cpu_scheduling, int io_nice_level) { | |
+ // TODO: Implement setting CPU and IO scheduling hints. | |
+} | |
+ | |
+string GetProcessCWD(int pid) { | |
+ char server_cwd[PATH_MAX] = {}; | |
+ if (readlink( | |
+ ("/proc/" + ToString(pid) + "/cwd").c_str(), | |
+ server_cwd, sizeof(server_cwd)) < 0) { | |
+ return ""; | |
+ } | |
+ | |
+ return string(server_cwd); | |
+} | |
+ | |
+bool IsSharedLibrary(const string &filename) { | |
+ return blaze_util::ends_with(filename, ".so"); | |
+} | |
+ | |
+static string Which(const string &executable) { | |
+ string path(GetEnv("PATH")); | |
+ if (path.empty()) { | |
+ die(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, | |
+ "Could not get PATH to find %s", executable.c_str()); | |
+ } | |
+ | |
+ vector<string> pieces = blaze_util::Split(path, ':'); | |
+ for (auto piece : pieces) { | |
+ if (piece.empty()) { | |
+ piece = "."; | |
+ } | |
+ | |
+ struct stat file_stat; | |
+ string candidate = blaze_util::JoinPath(piece, executable); | |
+ if (access(candidate.c_str(), X_OK) == 0 && | |
+ stat(candidate.c_str(), &file_stat) == 0 && | |
+ S_ISREG(file_stat.st_mode)) { | |
+ return candidate; | |
+ } | |
+ } | |
+ return ""; | |
+} | |
+ | |
+string GetDefaultHostJavabase() { | |
+ // if JAVA_HOME is defined, then use it as default. | |
+ string javahome = GetEnv("JAVA_HOME"); | |
+ if (!javahome.empty()) { | |
+ return javahome; | |
+ } | |
+ | |
+ // which javac | |
+ string javac_dir = Which("javac"); | |
+ if (javac_dir.empty()) { | |
+ die(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, "Could not find javac"); | |
+ } | |
+ | |
+ // Resolve all symlinks. | |
+ char resolved_path[PATH_MAX]; | |
+ if (realpath(javac_dir.c_str(), resolved_path) == NULL) { | |
+ pdie(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, | |
+ "Could not resolve javac directory"); | |
+ } | |
+ javac_dir = resolved_path; | |
+ | |
+ // dirname dirname | |
+ return blaze_util::Dirname(blaze_util::Dirname(javac_dir)); | |
+} | |
+ | |
+// Called from a signal handler! | |
+static bool GetStartTime(const string& pid, string* start_time) { | |
+ // TODO: Threw this together somewhat quick. Needs to be checked | |
+ // for correctness. | |
+ char filename [PATH_MAX]; | |
+ FILE *f; | |
+ bool time_set = false; | |
+ psinfo_t info; | |
+ | |
+ snprintf(filename, sizeof(filename), "/proc/%s/psinfo", pid.c_str()); | |
+ | |
+ f = fopen(filename, "r"); | |
+ if (f) { | |
+ if (fread(&info, sizeof(info), 1, f) > 0) { | |
+ char buffer [128]; | |
+ sprintf (buffer, "%lu", info.pr_start.tv_nsec); | |
+ *start_time = string(buffer); | |
+ time_set = true; | |
+ } | |
+ | |
+ fclose(f); | |
+ } | |
+ | |
+ return time_set; | |
+} | |
+ | |
+void WriteSystemSpecificProcessIdentifier( | |
+ const string& server_dir, pid_t server_pid) { | |
+ string pid_string = ToString(server_pid); | |
+ | |
+ string start_time; | |
+ if (!GetStartTime(pid_string, &start_time)) { | |
+ pdie(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, | |
+ "Cannot get start time of process %s", pid_string.c_str()); | |
+ } | |
+ | |
+ string start_time_file = blaze_util::JoinPath(server_dir, "server.starttime"); | |
+ if (!blaze_util::WriteFile(start_time, start_time_file)) { | |
+ pdie(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, | |
+ "Cannot write start time in server dir %s", server_dir.c_str()); | |
+ } | |
+} | |
+ | |
+// On Linux we use a combination of PID and start time to identify the server | |
+// process. That is supposed to be unique unless one can start more processes | |
+// than there are PIDs available within a single jiffy. | |
+bool VerifyServerProcess(int pid, const string& output_base) { | |
+ string start_time; | |
+ if (!GetStartTime(ToString(pid), &start_time)) { | |
+ // Cannot read PID file from /proc . Process died meantime, all is good. No | |
+ // stale server is present. | |
+ return false; | |
+ } | |
+ | |
+ string recorded_start_time; | |
+ bool file_present = blaze_util::ReadFile( | |
+ blaze_util::JoinPath(output_base, "server/server.starttime"), | |
+ &recorded_start_time); | |
+ | |
+ // If start time file got deleted, but PID file didn't, assume that this is an | |
+ // old Blaze process that doesn't know how to write start time files yet. | |
+ return !file_present || recorded_start_time == start_time; | |
+} | |
+ | |
+// Not supported. | |
+void ExcludePathFromBackup(const string &path) { | |
+} | |
+ | |
+int32_t GetExplicitSystemLimit(const int resource) { | |
+ return -1; | |
+} | |
+ | |
+} // namespace blaze | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/cpp/util/file_posix.cc bazel/src/main/cpp/util/file_posix.cc | |
--- bazel-orig/src/main/cpp/util/file_posix.cc 2018-04-01 14:52:36.200286825 +0000 | |
+++ bazel/src/main/cpp/util/file_posix.cc 2018-04-05 12:45:22.707574682 +0000 | |
@@ -440,14 +440,17 @@ | |
string filename(blaze_util::JoinPath(path, ent->d_name)); | |
bool is_directory; | |
- if (ent->d_type == DT_UNKNOWN) { | |
- struct stat buf; | |
- if (lstat(filename.c_str(), &buf) == -1) { | |
- die(blaze_exit_code::INTERNAL_ERROR, "stat failed"); | |
- } | |
- is_directory = S_ISDIR(buf.st_mode); | |
- } else { | |
+ | |
+ // d_type isn't part of the POSIX spec. | |
+ #ifdef _DIRENT_HAVE_D_TYPE | |
+ if (ent->d_type != DT_UNKNOWN) { | |
is_directory = (ent->d_type == DT_DIR); | |
+ } else | |
+ #endif | |
+ { | |
+ struct stat stbuf; | |
+ stat(ent->d_name, &stbuf); | |
+ is_directory = S_ISDIR(stbuf.st_mode); | |
} | |
consume->Consume(filename, is_directory); | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java bazel/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java | |
--- bazel-orig/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java 2018-04-01 14:52:36.216707875 +0000 | |
+++ bazel/src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java 2018-04-07 15:49:27.433880557 +0000 | |
@@ -37,6 +37,8 @@ | |
return "darwin"; | |
case FREEBSD: | |
return "freebsd"; | |
+ case SOLARIS: | |
+ return "solaris"; | |
case WINDOWS: | |
switch (CPU.getCurrent()) { | |
case X86_64: | |
@@ -79,6 +81,8 @@ | |
return Pair.of(CPU.getCurrent(), OS.DARWIN); | |
} else if (input.startsWith("freebsd")) { | |
return Pair.of(CPU.getCurrent(), OS.FREEBSD); | |
+ } else if (input.startsWith("solaris")) { | |
+ return Pair.of(CPU.getCurrent(), OS.SOLARIS); | |
} else if (input.startsWith("x64_windows")) { | |
return Pair.of(CPU.getCurrent(), OS.WINDOWS); | |
} | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE | |
--- bazel-orig/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE 2018-04-01 14:52:36.237999974 +0000 | |
+++ bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE 2018-04-05 13:19:29.185509099 +0000 | |
@@ -40,6 +40,11 @@ | |
) | |
bind( | |
+ name = "jni_md_header-solaris", | |
+ actual = "@local_jdk//:jni_md_header-solaris", | |
+) | |
+ | |
+bind( | |
name = "java", | |
actual = "@local_jdk//:java", | |
) | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt | |
--- bazel-orig/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt 2018-04-01 14:52:36.239423752 +0000 | |
+++ bazel/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt 2018-04-12 08:18:56.583228910 +0000 | |
@@ -38,7 +38,7 @@ | |
# Find a file in a given search path. | |
def SearchPath(name): | |
- search_path = os.getenv('PATH', os.defpath).split(os.pathsep) | |
+ search_path = os.getenv('PATH', os.defpath + ":/opt/local/bin").split(os.pathsep) | |
for directory in search_path: | |
if directory == '': continue | |
path = os.path.join(directory, name) | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java | |
--- bazel-orig/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java 2018-04-01 14:52:36.280856404 +0000 | |
+++ bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java 2018-04-16 09:38:48.069840042 +0000 | |
@@ -28,6 +28,7 @@ | |
/** A platform for C++ tool invocations. */ | |
public enum CppPlatform { | |
LINUX, | |
+ SOLARIS, | |
MAC | |
} | |
@@ -709,6 +710,59 @@ | |
" expand_if_true: 'libraries_to_link.is_whole_archive'", | |
" flag: '-Wl,-no-whole-archive'", | |
" }"), | |
+ ifSolaris( | |
+ platform, | |
+ " flag_group {", | |
+ " expand_if_true: 'libraries_to_link.is_whole_archive'", | |
+ " flag: '-Wl,--whole-archive'", | |
+ " }", | |
+ " flag_group {", | |
+ " expand_if_equal: {", | |
+ " variable: 'libraries_to_link.type'", | |
+ " value: 'object_file_group'", | |
+ " }", | |
+ " iterate_over: 'libraries_to_link.object_files'", | |
+ " flag: '%{libraries_to_link.object_files}'", | |
+ " }", | |
+ " flag_group {", | |
+ " expand_if_equal: {", | |
+ " variable: 'libraries_to_link.type'", | |
+ " value: 'object_file'", | |
+ " }", | |
+ " flag: '%{libraries_to_link.name}'", | |
+ " }", | |
+ " flag_group {", | |
+ " expand_if_equal: {", | |
+ " variable: 'libraries_to_link.type'", | |
+ " value: 'interface_library'", | |
+ " }", | |
+ " flag: '%{libraries_to_link.name}'", | |
+ " }", | |
+ " flag_group {", | |
+ " expand_if_equal: {", | |
+ " variable: 'libraries_to_link.type'", | |
+ " value: 'static_library'", | |
+ " }", | |
+ " flag: '%{libraries_to_link.name}'", | |
+ " }", | |
+ " flag_group {", | |
+ " expand_if_equal: {", | |
+ " variable: 'libraries_to_link.type'", | |
+ " value: 'dynamic_library'", | |
+ " }", | |
+ " flag: '-l%{libraries_to_link.name}'", | |
+ " }", | |
+ " flag_group {", | |
+ " expand_if_equal: {", | |
+ " variable: 'libraries_to_link.type'", | |
+ " value: 'versioned_dynamic_library'", | |
+ " }", | |
+ " flag: '-l:%{libraries_to_link.name}'", | |
+ " }", | |
+ " flag_group {", | |
+ " expand_if_true: 'libraries_to_link.is_whole_archive'", | |
+ " flag: '-Wl,--no-whole-archive'", | |
+ " }"), | |
ifMac( | |
platform, | |
" flag_group {", | |
@@ -846,7 +900,11 @@ | |
" action: 'c++-link-interface-dynamic-library'", | |
" flag_group {", | |
" expand_if_all_available: 'strip_debug_symbols'", | |
- " flag: '-Wl,-S'", | |
+ ifLinux(platform, " flag: '-Wl,-S'"), | |
+ ifMac(platform, " flag: '-Wl,-S'"), | |
+ // TODO: Figure out how to only strib debug symbols on Solaris. | |
+ // 'zstrip-class' is not present on Illumos I think? | |
+ //ifSolaris(platform, " flag: '-Wl,zstrip-class=debug'"), | |
" }", | |
" }", | |
"}"), | |
@@ -1067,6 +1125,10 @@ | |
// Platform `LINUX` also includes FreeBSD. | |
return ifTrue(platform == CppPlatform.LINUX, lines); | |
} | |
+ | |
+ private static String ifSolaris(CppPlatform platform, String... lines) { | |
+ return ifTrue(platform == CppPlatform.SOLARIS, lines); | |
+ } | |
private static String ifMac(CppPlatform platform, String... lines) { | |
return ifTrue(platform == CppPlatform.MAC, lines); | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java | |
--- bazel-orig/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java 2018-04-01 14:52:36.283294269 +0000 | |
+++ bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java 2018-04-10 15:22:57.980534738 +0000 | |
@@ -397,9 +397,18 @@ | |
toolchain = removeLegacyCompileFlagsFeatureFromToolchain(toolchain); | |
} | |
+ CppPlatform cppPlatform; | |
+ if (toolchain.getTargetLibc().equals("macosx")) { | |
+ cppPlatform = CppPlatform.MAC; | |
+ } else if (toolchain.getTargetLibc().equals("solaris")) { | |
+ cppPlatform = CppPlatform.SOLARIS; | |
+ } else { | |
+ cppPlatform = CppPlatform.LINUX; | |
+ } | |
+ | |
TextFormat.merge( | |
CppActionConfigs.getCppActionConfigs( | |
- toolchain.getTargetLibc().equals("macosx") ? CppPlatform.MAC : CppPlatform.LINUX, | |
+ cppPlatform, | |
featureNames, | |
gccToolPath, | |
linkerToolPath, | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/java/com/google/devtools/build/lib/util/OS.java bazel/src/main/java/com/google/devtools/build/lib/util/OS.java | |
--- bazel-orig/src/main/java/com/google/devtools/build/lib/util/OS.java 2018-04-01 14:52:36.327916523 +0000 | |
+++ bazel/src/main/java/com/google/devtools/build/lib/util/OS.java 2018-04-01 14:53:02.530468640 +0000 | |
@@ -21,11 +21,12 @@ | |
public enum OS { | |
DARWIN("osx", "Mac OS X"), | |
FREEBSD("freebsd", "FreeBSD"), | |
+ SOLARIS("solaris","SunOS"), | |
LINUX("linux", "Linux"), | |
WINDOWS("windows", "Windows"), | |
UNKNOWN("unknown", ""); | |
- private static final EnumSet<OS> POSIX_COMPATIBLE = EnumSet.of(DARWIN, FREEBSD, LINUX); | |
+ private static final EnumSet<OS> POSIX_COMPATIBLE = EnumSet.of(DARWIN, FREEBSD, SOLARIS, LINUX); | |
private final String canonicalName; | |
private final String detectionName; | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/java/com/google/devtools/build/lib/vfs/LocalPath.java bazel/src/main/java/com/google/devtools/build/lib/vfs/LocalPath.java | |
--- bazel-orig/src/main/java/com/google/devtools/build/lib/vfs/LocalPath.java 2018-04-01 14:52:36.363892385 +0000 | |
+++ bazel/src/main/java/com/google/devtools/build/lib/vfs/LocalPath.java 2018-04-01 14:53:02.531108306 +0000 | |
@@ -667,6 +667,7 @@ | |
switch (OS.getCurrent()) { | |
case LINUX: | |
case FREEBSD: | |
+ case SOLARIS: | |
case UNKNOWN: | |
return new UnixOsPathPolicy(); | |
case DARWIN: | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/native/BUILD bazel/src/main/native/BUILD | |
--- bazel-orig/src/main/native/BUILD 2018-04-01 14:52:36.377005168 +0000 | |
+++ bazel/src/main/native/BUILD 2018-04-05 13:21:59.249328191 +0000 | |
@@ -4,6 +4,7 @@ | |
"//src/conditions:darwin": ["//tools/jdk:jni_md_header-darwin"], | |
"//src/conditions:darwin_x86_64": ["//tools/jdk:jni_md_header-darwin"], | |
"//src/conditions:freebsd": ["//tools/jdk:jni_md_header-freebsd"], | |
+ "//src/conditions:solaris": ["//tools/jdk:jni_md_header-solaris"], | |
"//src/conditions:windows": ["//tools/jdk:jni_md_header-windows"], | |
"//conditions:default": ["//tools/jdk:jni_md_header-linux"], | |
}), | |
@@ -32,6 +33,7 @@ | |
"fsevents.cc", | |
], | |
"//src/conditions:freebsd": ["unix_jni_freebsd.cc"], | |
+ "//src/conditions:solaris": ["unix_jni_solaris.cc"], | |
"//conditions:default": ["unix_jni_linux.cc"], | |
}), | |
) | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/native/unix_jni.cc bazel/src/main/native/unix_jni.cc | |
--- bazel-orig/src/main/native/unix_jni.cc 2018-04-01 14:52:36.377326959 +0000 | |
+++ bazel/src/main/native/unix_jni.cc 2018-04-06 14:12:56.121231749 +0000 | |
@@ -642,6 +642,7 @@ | |
static char GetDirentType(struct dirent *entry, | |
int dirfd, | |
bool follow_symlinks) { | |
+ #ifdef _DIRENT_HAVE_D_TYPE | |
switch (entry->d_type) { | |
case DT_REG: | |
return 'f'; | |
@@ -653,16 +654,19 @@ | |
} | |
FALLTHROUGH_INTENDED; | |
case DT_UNKNOWN: | |
+ #endif | |
portable_stat_struct statbuf; | |
if (portable_fstatat(dirfd, entry->d_name, &statbuf, 0) == 0) { | |
if (S_ISREG(statbuf.st_mode)) return 'f'; | |
if (S_ISDIR(statbuf.st_mode)) return 'd'; | |
} | |
+ #ifdef _DIRENT_HAVE_D_TYPE | |
// stat failed or returned something weird; fall through | |
FALLTHROUGH_INTENDED; | |
default: | |
return '?'; | |
} | |
+ #endif | |
} | |
/* | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/native/unix_jni.h bazel/src/main/native/unix_jni.h | |
--- bazel-orig/src/main/native/unix_jni.h 2018-04-01 14:52:36.377391561 +0000 | |
+++ bazel/src/main/native/unix_jni.h 2018-04-07 17:52:30.610016712 +0000 | |
@@ -31,7 +31,7 @@ | |
} \ | |
} while (0) | |
-#if defined(__APPLE__) || defined(__FreeBSD__) | |
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) | |
// stat64 is deprecated on OS X/BSD. | |
typedef struct stat portable_stat_struct; | |
#define portable_stat ::stat | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/native/unix_jni_solaris.cc bazel/src/main/native/unix_jni_solaris.cc | |
--- bazel-orig/src/main/native/unix_jni_solaris.cc 1970-01-01 00:00:00.000000000 +0000 | |
+++ bazel/src/main/native/unix_jni_solaris.cc 2018-04-07 15:32:12.747213012 +0000 | |
@@ -0,0 +1,88 @@ | |
+// Copyright 2015 The Bazel Authors. All rights reserved. | |
+// | |
+// Licensed under the Apache License, Version 2.0 (the "License"); | |
+// you may not use this file except in compliance with the License. | |
+// You may obtain a copy of the License at | |
+// | |
+// http://www.apache.org/licenses/LICENSE-2.0 | |
+// | |
+// Unless required by applicable law or agreed to in writing, software | |
+// distributed under the License is distributed on an "AS IS" BASIS, | |
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+// See the License for the specific language governing permissions and | |
+// limitations under the License. | |
+ | |
+#include "src/main/native/unix_jni.h" | |
+ | |
+#include <assert.h> | |
+#include <errno.h> | |
+#include <fcntl.h> | |
+#include <stdlib.h> | |
+#include <string.h> | |
+#include <sys/param.h> | |
+#include <sys/stat.h> | |
+#include <sys/unistd.h> | |
+#include <sys/types.h> | |
+ | |
+#include <string> | |
+ | |
+using std::string; | |
+ | |
+// See unix_jni.h. | |
+string ErrorMessage(int error_number) { | |
+ char buf[1024] = ""; | |
+ if (strerror_r(error_number, buf, sizeof buf) < 0) { | |
+ snprintf(buf, sizeof buf, "strerror_r(%d): errno %d", error_number, errno); | |
+ } | |
+ | |
+ return string(buf); | |
+} | |
+ | |
+int portable_fstatat(int dirfd, char *name, portable_stat_struct *statbuf, | |
+ int flags) { | |
+ return fstatat(dirfd, name, statbuf, flags); | |
+} | |
+ | |
+int StatSeconds(const portable_stat_struct &statbuf, StatTimes t) { | |
+ switch (t) { | |
+ case STAT_ATIME: | |
+ return statbuf.st_atime; | |
+ case STAT_CTIME: | |
+ return statbuf.st_ctime; | |
+ case STAT_MTIME: | |
+ return statbuf.st_mtime; | |
+ default: | |
+ CHECK(false); | |
+ } | |
+} | |
+ | |
+int StatNanoSeconds(const portable_stat_struct &statbuf, StatTimes t) { | |
+ // TODO: Implement nano second based timers on Solaris. | |
+ switch (t) { | |
+ case STAT_ATIME: | |
+ return statbuf.st_atim.tv_nsec; | |
+ case STAT_CTIME: | |
+ return statbuf.st_ctim.tv_nsec; | |
+ case STAT_MTIME: | |
+ return statbuf.st_mtim.tv_nsec; | |
+ default: | |
+ CHECK(false); | |
+ } | |
+} | |
+ | |
+ssize_t portable_getxattr(const char *path, const char *name, void *value, | |
+ size_t size) { | |
+ errno = ENOSYS; | |
+ return -1; | |
+} | |
+ | |
+ssize_t portable_lgetxattr(const char *path, const char *name, void *value, | |
+ size_t size) { | |
+ errno = ENOSYS; | |
+ return -1; | |
+} | |
+ | |
+int portable_sysctlbyname(const char *name_chars, long *mibp, size_t *sizep) { | |
+ errno = ENOSYS; | |
+ return -1; | |
+} | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/tools/BUILD bazel/src/main/tools/BUILD | |
--- bazel-orig/src/main/tools/BUILD 2018-04-01 14:52:36.379860913 +0000 | |
+++ bazel/src/main/tools/BUILD 2018-04-07 15:43:08.346415213 +0000 | |
@@ -53,6 +53,7 @@ | |
"//src/conditions:darwin": ["dummy-sandbox.c"], | |
"//src/conditions:darwin_x86_64": ["dummy-sandbox.c"], | |
"//src/conditions:freebsd": ["dummy-sandbox.c"], | |
+ "//src/conditions:solaris": ["dummy-sandbox.c"], | |
"//src/conditions:windows": ["dummy-sandbox.c"], | |
"//conditions:default": [ | |
"linux-sandbox.cc", | |
@@ -68,6 +69,7 @@ | |
"//src/conditions:darwin": [], | |
"//src/conditions:darwin_x86_64": [], | |
"//src/conditions:freebsd": [], | |
+ "//src/conditions:solaris": [], | |
"//src/conditions:windows": [], | |
"//conditions:default": [ | |
":logging", | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/tools/build-runfiles.cc bazel/src/main/tools/build-runfiles.cc | |
--- bazel-orig/src/main/tools/build-runfiles.cc 2018-04-01 14:52:36.380005896 +0000 | |
+++ bazel/src/main/tools/build-runfiles.cc 2018-04-06 09:01:50.284393631 +0000 | |
@@ -246,7 +246,7 @@ | |
std::string entry_path = prefix + entry->d_name; | |
FileInfo actual_info; | |
- actual_info.type = DentryToFileType(entry_path, entry->d_type); | |
+ actual_info.type = DentryToFileType(entry_path, entry); | |
if (actual_info.type == FILE_TYPE_SYMLINK) { | |
ReadLinkOrDie(entry_path, &actual_info.symlink_target); | |
@@ -310,9 +310,20 @@ | |
} | |
} | |
- FileType DentryToFileType(const std::string &path, char d_type) { | |
- if (d_type == DT_UNKNOWN) { | |
- struct stat st; | |
+ FileType DentryToFileType(const std::string &path, struct dirent *ent) { | |
+ #ifdef _DIRENT_HAVE_D_TYPE | |
+ if (ent->d_type != DT_UNKNOWN) { | |
+ if (ent->d_type == DT_DIR) { | |
+ return FILE_TYPE_DIRECTORY; | |
+ } else if (ent->d_type == DT_LNK) { | |
+ return FILE_TYPE_SYMLINK; | |
+ } else { | |
+ return FILE_TYPE_REGULAR; | |
+ } | |
+ } else | |
+ #endif | |
+ { | |
+ struct stat st; | |
LStatOrDie(path, &st); | |
if (S_ISDIR(st.st_mode)) { | |
return FILE_TYPE_DIRECTORY; | |
@@ -321,12 +332,6 @@ | |
} else { | |
return FILE_TYPE_REGULAR; | |
} | |
- } else if (d_type == DT_DIR) { | |
- return FILE_TYPE_DIRECTORY; | |
- } else if (d_type == DT_LNK) { | |
- return FILE_TYPE_SYMLINK; | |
- } else { | |
- return FILE_TYPE_REGULAR; | |
} | |
} | |
@@ -386,7 +391,7 @@ | |
while ((entry = readdir(dh)) != nullptr) { | |
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) continue; | |
const std::string entry_path = path + '/' + entry->d_name; | |
- FileType entry_file_type = DentryToFileType(entry_path, entry->d_type); | |
+ FileType entry_file_type = DentryToFileType(entry_path, entry); | |
DelTree(entry_path, entry_file_type); | |
errno = 0; | |
} | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/main/tools/jdk.BUILD bazel/src/main/tools/jdk.BUILD | |
--- bazel-orig/src/main/tools/jdk.BUILD 2018-04-01 14:52:36.380117028 +0000 | |
+++ bazel/src/main/tools/jdk.BUILD 2018-04-01 14:53:02.531508432 +0000 | |
@@ -21,6 +21,11 @@ | |
) | |
filegroup( | |
+ name = "jni_md_header-solaris", | |
+ srcs = ["include/solaris/jni_md.h"], | |
+) | |
+ | |
+filegroup( | |
name = "jni_md_header-windows", | |
srcs = ["include/win32/jni_md.h"], | |
) | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/test/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationTest.java bazel/src/test/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationTest.java | |
--- bazel-orig/src/test/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationTest.java 2018-04-01 14:52:36.413935890 +0000 | |
+++ bazel/src/test/java/com/google/devtools/build/lib/bazel/rules/BazelConfigurationTest.java 2018-04-01 16:18:12.083503455 +0000 | |
@@ -38,6 +38,8 @@ | |
.isEqualTo(PathFragment.create("/bin/bash")); | |
assertThat(new BazelConfiguration(OS.FREEBSD, o).getShellExecutable()) | |
.isEqualTo(PathFragment.create("/usr/local/bin/bash")); | |
+ assertThat(new BazelConfiguration(OS.SOLARIS, o).getShellExecutable()) | |
+ .isEqualTo(PathFragment.create("/usr/bin/bash")); | |
assertThat(new BazelConfiguration(OS.WINDOWS, o).getShellExecutable()) | |
.isEqualTo(PathFragment.create("c:/tools/msys64/usr/bin/bash.exe")); | |
} | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/tools/singlejar/diag.h bazel/src/tools/singlejar/diag.h | |
--- bazel-orig/src/tools/singlejar/diag.h 2018-04-01 14:52:36.533587187 +0000 | |
+++ bazel/src/tools/singlejar/diag.h 2018-04-06 08:29:19.142846564 +0000 | |
@@ -19,7 +19,7 @@ | |
* Various useful diagnostics functions from Linux err.h file, wrapped | |
* for portability. | |
*/ | |
-#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) | |
+#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__sun) | |
#include <err.h> | |
#define diag_err(...) err(__VA_ARGS__) | |
#define diag_errx(...) errx(__VA_ARGS__) | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/tools/singlejar/mapped_file.h bazel/src/tools/singlejar/mapped_file.h | |
--- bazel-orig/src/tools/singlejar/mapped_file.h 2018-04-01 14:52:36.534209029 +0000 | |
+++ bazel/src/tools/singlejar/mapped_file.h 2018-04-06 08:47:39.237631273 +0000 | |
@@ -35,8 +35,8 @@ | |
* | |
* The implementation is 64-bit Linux or OSX specific. | |
*/ | |
-#if !((defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)) && \ | |
- __SIZEOF_POINTER__ == 8) | |
+#if !((defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ | |
+ defined(__sun)) && __SIZEOF_POINTER__ == 8) | |
#error This code for 64 bit Unix. | |
#endif | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/src/tools/singlejar/zip_headers.h bazel/src/tools/singlejar/zip_headers.h | |
--- bazel-orig/src/tools/singlejar/zip_headers.h 2018-04-01 14:52:36.535412972 +0000 | |
+++ bazel/src/tools/singlejar/zip_headers.h 2018-04-06 08:36:37.161731896 +0000 | |
@@ -25,7 +25,7 @@ | |
#include <cinttypes> | |
-#if defined(__linux__) | |
+#if defined(__linux__) || defined(__sun) | |
#include <endian.h> | |
#elif defined(__FreeBSD__) | |
#include <sys/endian.h> | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/third_party/BUILD bazel/third_party/BUILD | |
--- bazel-orig/third_party/BUILD 2018-04-01 14:52:36.555267787 +0000 | |
+++ bazel/third_party/BUILD 2018-04-01 14:53:02.532119695 +0000 | |
@@ -662,6 +662,11 @@ | |
) | |
config_setting( | |
+ name = "solaris", | |
+ values = {"host_cpu": "solaris"}, | |
+) | |
+ | |
+config_setting( | |
name = "s390x", | |
values = {"host_cpu": "s390x"}, | |
) | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/third_party/grpc/BUILD bazel/third_party/grpc/BUILD | |
--- bazel-orig/third_party/grpc/BUILD 2018-04-01 14:52:36.732829841 +0000 | |
+++ bazel/third_party/grpc/BUILD 2018-04-09 12:22:56.449801085 +0000 | |
@@ -435,6 +435,15 @@ | |
"-std=gnu99", | |
"-Wimplicit-function-declaration", | |
], | |
+ "//src/conditions:solaris": [ | |
+ # Needed for 'msg_control' in 'msghdr'. | |
+ "-D_XOPEN_SOURCE=600", | |
+ # Needed for 'IPV6_V6ONLY' in 'in.h'. | |
+ "-D__EXTENSIONS__", | |
+ # Must be c99 otherwise 'feature_tests.h' will complain. | |
+ "-std=c99", | |
+ "-Wimplicit-function-declaration", | |
+ ], | |
":windows": ["/we4013"], | |
}), | |
includes = [ | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/third_party/grpc/include/grpc/impl/codegen/port_platform.h bazel/third_party/grpc/include/grpc/impl/codegen/port_platform.h | |
--- bazel-orig/third_party/grpc/include/grpc/impl/codegen/port_platform.h 2018-04-01 14:52:36.741437006 +0000 | |
+++ bazel/third_party/grpc/include/grpc/impl/codegen/port_platform.h 2018-04-16 12:26:42.102079236 +0000 | |
@@ -249,6 +249,38 @@ | |
#else /* _LP64 */ | |
#define GPR_ARCH_32 1 | |
#endif /* _LP64 */ | |
+#elif defined(__sun) | |
+#define GPR_PLATFORM_STRING "solaris" | |
+#ifndef _BSD_SOURCE | |
+#define _BSD_SOURCE | |
+#endif | |
+#define GPR_SOLARIS 1 | |
+#define GPR_CPU_POSIX 1 | |
+#define GPR_GCC_ATOMIC 1 | |
+#define GPR_GCC_TLS 1 | |
+#define GPR_POSIX_LOG 1 | |
+#define GPR_POSIX_ENV 1 | |
+#define GPR_POSIX_TMPFILE 1 | |
+#define GPR_POSIX_STRING 1 | |
+#define GPR_POSIX_SUBPROCESS 1 | |
+#define GPR_POSIX_SYNC 1 | |
+#define GPR_POSIX_TIME 1 | |
+#define GPR_GETPID_IN_UNISTD_H 1 | |
+#define GPR_SUPPORT_CHANNELS_FROM_FD 1 | |
+#define GPR_HAVE_ARPA_NAMESER 1 | |
+#define GPR_HAVE_IFADDRS 1 | |
+#define GPR_HAVE_IPV6_RECVPKTINFO 1 | |
+#define GPR_HAVE_UNIX_SOCKET 1 | |
+#define GPR_POSIX_FORK 1 | |
+#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 | |
+#define GPR_POSIX_SOCKET 1 | |
+#define GPR_POSIX_SOCKETADDR 1 | |
+#define GPR_POSIX_SOCKETUTILS 1 | |
+#define GPR_POSIX_WAKEUP_FD 1 | |
+#define GPR_TIMER_USE_GENERIC 1 | |
+// Event ports are not implemented so this is our best option. | |
+#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 | |
+#define GPR_ARCH_64 1 | |
#elif defined(__FreeBSD__) | |
#define GPR_PLATFORM_STRING "freebsd" | |
#ifndef _BSD_SOURCE | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/cpp/BUILD bazel/tools/cpp/BUILD | |
--- bazel-orig/tools/cpp/BUILD 2018-04-01 14:52:36.549549685 +0000 | |
+++ bazel/tools/cpp/BUILD 2018-04-15 19:49:53.323417694 +0000 | |
@@ -40,6 +40,7 @@ | |
"armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a", | |
"darwin|compiler": ":cc-compiler-darwin", | |
"freebsd|compiler": ":cc-compiler-freebsd", | |
+ "solaris|compiler": ":cc-compiler-solaris", | |
"local|compiler": ":cc-compiler-local", | |
"x64_windows|compiler": ":cc-compiler-x64_windows", | |
"x64_windows_msvc|compiler": ":cc-compiler-x64_windows_msvc", | |
@@ -123,6 +124,20 @@ | |
all_files = ":empty", | |
compiler_files = ":empty", | |
cpu = "local", | |
+ dwp_files = ":empty", | |
+ dynamic_runtime_libs = [":empty"], | |
+ linker_files = ":empty", | |
+ objcopy_files = ":empty", | |
+ static_runtime_libs = [":empty"], | |
+ strip_files = ":empty", | |
+ supports_param_files = 0, | |
+) | |
+ | |
+cc_toolchain( | |
+ name = "cc-compiler-solaris", | |
+ all_files = ":empty", | |
+ compiler_files = ":empty", | |
+ cpu = "local", | |
dwp_files = ":empty", | |
dynamic_runtime_libs = [":empty"], | |
linker_files = ":empty", | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/cpp/BUILD.static bazel/tools/cpp/BUILD.static | |
--- bazel-orig/tools/cpp/BUILD.static 2018-04-01 14:52:36.549606668 +0000 | |
+++ bazel/tools/cpp/BUILD.static 2018-04-16 09:00:33.368157291 +0000 | |
@@ -19,6 +19,7 @@ | |
toolchains = { | |
"armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a", | |
"freebsd|compiler": ":cc-compiler-freebsd", | |
+ "solaris|compiler": ":cc-compiler-solaris", | |
"x64_windows|msvc-cl": ":cc-compiler-x64_windows", | |
"x64_windows|msys-gcc": ":cc-compiler-x64_windows_msys", | |
"x64_windows|mingw-gcc": ":cc-compiler-x64_windows_mingw", | |
@@ -45,6 +46,20 @@ | |
all_files = ":empty", | |
compiler_files = ":empty", | |
cpu = "local", | |
+ dwp_files = ":empty", | |
+ dynamic_runtime_libs = [":empty"], | |
+ linker_files = ":empty", | |
+ objcopy_files = ":empty", | |
+ static_runtime_libs = [":empty"], | |
+ strip_files = ":empty", | |
+ supports_param_files = 0, | |
+) | |
+ | |
+cc_toolchain( | |
+ name = "cc-compiler-solaris", | |
+ all_files = ":empty", | |
+ compiler_files = ":empty", | |
+ cpu = "local", | |
dwp_files = ":empty", | |
dynamic_runtime_libs = [":empty"], | |
linker_files = ":empty", | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/cpp/CROSSTOOL bazel/tools/cpp/CROSSTOOL | |
--- bazel-orig/tools/cpp/CROSSTOOL 2018-04-01 14:52:36.549774320 +0000 | |
+++ bazel/tools/cpp/CROSSTOOL 2018-04-16 11:13:25.255861297 +0000 | |
@@ -19,6 +19,10 @@ | |
toolchain_identifier: "local_freebsd" | |
} | |
default_toolchain { | |
+ cpu: "solaris" | |
+ toolchain_identifier: "local_solaris" | |
+} | |
+default_toolchain { | |
cpu: "armeabi-v7a" | |
toolchain_identifier: "stub_armeabi-v7a" | |
} | |
@@ -420,6 +424,186 @@ | |
} | |
toolchain { | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ builtin_sysroot: "" | |
+ compiler: "compiler" | |
+ host_system_name: "local" | |
+ needsPic: true | |
+ supports_gold_linker: false | |
+ supports_incremental_linker: false | |
+ supports_fission: false | |
+ supports_interface_shared_objects: false | |
+ supports_normalizing_ar: false | |
+ supports_start_end_lib: false | |
+ target_libc: "solaris" | |
+ target_cpu: "solaris" | |
+ target_system_name: "local" | |
+ toolchain_identifier: "local_solaris" | |
+ | |
+ tool_path { name: "ar" path: "/usr/bin/ar" } | |
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" } | |
+ tool_path { name: "cpp" path: "/opt/local/gcc7/bin/cpp" } | |
+ tool_path { name: "dwp" path: "/usr/bin/dwp" } | |
+ tool_path { name: "gcc" path: "/opt/local/gcc7/bin/gcc" } | |
+ cxx_flag: "-std=c++11" | |
+ linker_flag: "-lstdc++" | |
+ #linker_flag: "-B/usr/bin/" | |
+ | |
+ # TODO: These are actually just required by depdencies (sub project) like protobuf (js_embed). | |
+ # Shouldn't be in the normal tool chain. | |
+ linker_flag: "-lxnet" | |
+ linker_flag: "-lsocket" | |
+ linker_flag: "-lnsl" | |
+ | |
+ # Make the Solaris linker more talkative about what it's doing. | |
+ linker_flag: "-Wl,-z,verbose" | |
+ # Make the Solaris linker behave more strictly. | |
+ linker_flag: "-Wl,-z,text" | |
+ # Make the Solaris linker rescan the archive files that are provided to the link-edit. | |
+ linker_flag: "-Wl,-z,rescan" | |
+ | |
+ # TODO: Can we do without a 'linker_flag'? Only defaults are in it. However | |
+ # last time I removed it we ran in to (what should be unrelated) build errors. | |
+ linker_flag: "-Wl,-z,defs" | |
+ | |
+ # TODO(bazel-team): In theory, the path here ought to exactly match the path | |
+ # used by gcc. That works because bazel currently doesn't track files at | |
+ # absolute locations and has no remote execution, yet. However, this will need | |
+ # to be fixed, maybe with auto-detection? | |
+ # | |
+ # Paths obtained with '/opt/local/gcc7/bin/g++ -E -x c++ - -v < /dev/null'. | |
+ cxx_builtin_include_directory: "/opt/local/gcc7/include/c++" | |
+ cxx_builtin_include_directory: "/opt/local/gcc7/include/c++/x86_64-sun-solaris2.11" | |
+ cxx_builtin_include_directory: "/opt/local/gcc7/include/c++/backward" | |
+ cxx_builtin_include_directory: "/opt/local/gcc7/lib/gcc/x86_64-sun-solaris2.11/7.2.0/include" | |
+ cxx_builtin_include_directory: "/opt/local/include" | |
+ cxx_builtin_include_directory: "/opt/local/gcc7/include" | |
+ cxx_builtin_include_directory: "/opt/local/gcc7/lib/gcc/x86_64-sun-solaris2.11/7.2.0/include-fixed" | |
+ cxx_builtin_include_directory: "/usr/include" | |
+ | |
+ tool_path { name: "gcov" path: "/opt/local/gcc7/bin/gcov" } | |
+ | |
+ # C(++) compiles invoke the compiler (as that is the one knowing where | |
+ # to find libraries), but we provide LD so other rules can invoke the linker. | |
+ tool_path { name: "ld" path: "/usr/bin/ld" } | |
+ | |
+ tool_path { name: "nm" path: "/opt/local/bin/nm" } | |
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" } | |
+ objcopy_embed_flag: "-I" | |
+ objcopy_embed_flag: "binary" | |
+ tool_path { name: "objdump" path: "/usr/bin/objdump" } | |
+ tool_path { name: "strip" path: "/usr/bin/strip" } | |
+ | |
+ # Anticipated future default. | |
+ unfiltered_cxx_flag: "-no-canonical-prefixes" | |
+ unfiltered_cxx_flag: "-fno-canonical-system-headers" | |
+ | |
+ # Make C++ compilation deterministic. Use linkstamping instead of these | |
+ # compiler symbols. | |
+ unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" | |
+ unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" | |
+ unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" | |
+ unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" | |
+ | |
+ # Security hardening on by default. | |
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. | |
+ # We need to undef it before redefining it as some distributions now have | |
+ # it enabled by default. | |
+ compiler_flag: "-U_FORTIFY_SOURCE" | |
+ compiler_flag: "-D_FORTIFY_SOURCE=1" | |
+ # TODO: Does the Solaris linker support this? | |
+ #compiler_flag: "-fstack-protector" | |
+ | |
+ # Uncomment to make GCC more talkative about what it's doing. | |
+ #compiler_flag: "-v" | |
+ | |
+ # Enable coloring even if there's no attached terminal. Bazel removes the | |
+ # escape sequences if --nocolor is specified. This isn't supported by gcc | |
+ # on Ubuntu 14.04. | |
+ # compiler_flag: "-fcolor-diagnostics" | |
+ | |
+ # All warnings are enabled. Maybe enable -Werror as well? | |
+ compiler_flag: "-Wall" | |
+ # Enable a few more warnings that aren't part of -Wall. | |
+ compiler_flag: "-Wunused-but-set-parameter" | |
+ # But disable some that are problematic. | |
+ compiler_flag: "-Wno-free-nonheap-object" # has false positives | |
+ | |
+ # Keep stack frames for debugging, even in opt mode. | |
+ compiler_flag: "-fno-omit-frame-pointer" | |
+ | |
+ compilation_mode_flags { | |
+ mode: DBG | |
+ # Enable debug symbols. | |
+ compiler_flag: "-g" | |
+ } | |
+ compilation_mode_flags { | |
+ mode: OPT | |
+ | |
+ # No debug symbols. | |
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or | |
+ # even generally? However, that can't happen here, as it requires special | |
+ # handling in Bazel. | |
+ compiler_flag: "-g0" | |
+ | |
+ # Conservative choice for -O | |
+ # -O3 can increase binary size and even slow down the resulting binaries. | |
+ # Profile first and / or use FDO if you need better performance than this. | |
+ compiler_flag: "-O2" | |
+ | |
+ # Disable assertions | |
+ compiler_flag: "-DNDEBUG" | |
+ | |
+ # Removal of unused code and data at link time (can this increase binary size in some cases?). | |
+ compiler_flag: "-ffunction-sections" | |
+ compiler_flag: "-fdata-sections" | |
+ } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+ | |
+ # Needed in order to get 'ar' correctly invoked. | |
+ feature { | |
+ name: 'archiver_flags' | |
+ enabled: true | |
+ | |
+ flag_set { | |
+ action: 'c++-link-static-library' | |
+ action: 'c++-link-alwayslink-static-library' | |
+ action: 'c++-link-pic-static-library' | |
+ action: 'c++-link-alwayslink-pic-static-library' | |
+ | |
+ flag_group { | |
+ expand_if_all_available: 'output_execpath' | |
+ flag: '-rcs' | |
+ flag: '%{output_execpath}' | |
+ } | |
+ | |
+ flag_group { | |
+ flag_group { | |
+ expand_if_all_available: "libraries_to_link" | |
+ iterate_over: "libraries_to_link" | |
+ flag_group { | |
+ expand_if_equal { | |
+ variable: "libraries_to_link.type" | |
+ value: "object_file" | |
+ } | |
+ flag: "%{libraries_to_link.name}" | |
+ } | |
+ flag_group { | |
+ expand_if_equal { | |
+ variable: "libraries_to_link.type" | |
+ value: "object_file_group" | |
+ } | |
+ iterate_over: "libraries_to_link.object_files" | |
+ flag: "%{libraries_to_link.object_files}" | |
+ } | |
+ } | |
+ } | |
+ } | |
+ } | |
+} | |
+ | |
+toolchain { | |
abi_version: "local" | |
abi_libc_version: "local" | |
builtin_sysroot: "" | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/cpp/CROSSTOOL.orig bazel/tools/cpp/CROSSTOOL.orig | |
--- bazel-orig/tools/cpp/CROSSTOOL.orig 1970-01-01 00:00:00.000000000 +0000 | |
+++ bazel/tools/cpp/CROSSTOOL.orig 2018-04-08 08:55:32.691548535 +0000 | |
@@ -0,0 +1,935 @@ | |
+major_version: "local" | |
+minor_version: "" | |
+default_target_cpu: "same_as_host" | |
+ | |
+default_toolchain { | |
+ cpu: "k8" | |
+ toolchain_identifier: "local_linux" | |
+} | |
+default_toolchain { | |
+ cpu: "piii" | |
+ toolchain_identifier: "local_linux" | |
+} | |
+default_toolchain { | |
+ cpu: "darwin" | |
+ toolchain_identifier: "local_darwin" | |
+} | |
+default_toolchain { | |
+ cpu: "freebsd" | |
+ toolchain_identifier: "local_freebsd" | |
+} | |
+default_toolchain { | |
+ cpu: "armeabi-v7a" | |
+ toolchain_identifier: "stub_armeabi-v7a" | |
+} | |
+default_toolchain { | |
+ cpu: "arm" | |
+ toolchain_identifier: "local_linux" | |
+} | |
+default_toolchain { | |
+ cpu: "x64_windows" | |
+ toolchain_identifier: "local_windows_msys64" | |
+} | |
+default_toolchain { | |
+ cpu: "x64_windows_msvc" | |
+ toolchain_identifier: "vc_14_0_x64" | |
+} | |
+default_toolchain { | |
+ cpu: "s390x" | |
+ toolchain_identifier: "local_linux" | |
+} | |
+ | |
+default_toolchain { | |
+ cpu: "ppc" | |
+ toolchain_identifier: "local_linux" | |
+} | |
+ | |
+default_toolchain { | |
+ cpu: "ppc64" | |
+ toolchain_identifier: "local_linux" | |
+} | |
+ | |
+default_toolchain { | |
+ cpu: "ios_x86_64" | |
+ toolchain_identifier: "ios_x86_64" | |
+} | |
+ | |
+toolchain { | |
+ abi_version: "armeabi-v7a" | |
+ abi_libc_version: "armeabi-v7a" | |
+ builtin_sysroot: "" | |
+ compiler: "compiler" | |
+ host_system_name: "armeabi-v7a" | |
+ needsPic: true | |
+ supports_gold_linker: false | |
+ supports_incremental_linker: false | |
+ supports_fission: false | |
+ supports_interface_shared_objects: false | |
+ supports_normalizing_ar: false | |
+ supports_start_end_lib: false | |
+ target_libc: "armeabi-v7a" | |
+ target_cpu: "armeabi-v7a" | |
+ target_system_name: "armeabi-v7a" | |
+ toolchain_identifier: "stub_armeabi-v7a" | |
+ | |
+ tool_path { name: "ar" path: "/bin/false" } | |
+ tool_path { name: "compat-ld" path: "/bin/false" } | |
+ tool_path { name: "cpp" path: "/bin/false" } | |
+ tool_path { name: "dwp" path: "/bin/false" } | |
+ tool_path { name: "gcc" path: "/bin/false" } | |
+ tool_path { name: "gcov" path: "/bin/false" } | |
+ tool_path { name: "ld" path: "/bin/false" } | |
+ | |
+ tool_path { name: "nm" path: "/bin/false" } | |
+ tool_path { name: "objcopy" path: "/bin/false" } | |
+ tool_path { name: "objdump" path: "/bin/false" } | |
+ tool_path { name: "strip" path: "/bin/false" } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
+ | |
+toolchain { | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ builtin_sysroot: "" | |
+ compiler: "compiler" | |
+ host_system_name: "local" | |
+ needsPic: true | |
+ supports_gold_linker: false | |
+ supports_incremental_linker: false | |
+ supports_fission: false | |
+ supports_interface_shared_objects: false | |
+ supports_normalizing_ar: false | |
+ supports_start_end_lib: false | |
+ target_libc: "local" | |
+ target_cpu: "local" | |
+ target_system_name: "local" | |
+ toolchain_identifier: "local_linux" | |
+ | |
+ tool_path { name: "ar" path: "/usr/bin/ar" } | |
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" } | |
+ tool_path { name: "cpp" path: "/usr/bin/cpp" } | |
+ tool_path { name: "dwp" path: "/usr/bin/dwp" } | |
+ tool_path { name: "gcc" path: "/usr/bin/gcc" } | |
+ cxx_flag: "-std=c++0x" | |
+ linker_flag: "-lstdc++" | |
+ linker_flag: "-B/usr/bin/" | |
+ | |
+ # TODO(bazel-team): In theory, the path here ought to exactly match the path | |
+ # used by gcc. That works because bazel currently doesn't track files at | |
+ # absolute locations and has no remote execution, yet. However, this will need | |
+ # to be fixed, maybe with auto-detection? | |
+ cxx_builtin_include_directory: "/usr/lib/gcc/" | |
+ cxx_builtin_include_directory: "/usr/local/include" | |
+ cxx_builtin_include_directory: "/usr/include" | |
+ tool_path { name: "gcov" path: "/usr/bin/gcov" } | |
+ | |
+ # C(++) compiles invoke the compiler (as that is the one knowing where | |
+ # to find libraries), but we provide LD so other rules can invoke the linker. | |
+ tool_path { name: "ld" path: "/usr/bin/ld" } | |
+ | |
+ tool_path { name: "nm" path: "/usr/bin/nm" } | |
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" } | |
+ objcopy_embed_flag: "-I" | |
+ objcopy_embed_flag: "binary" | |
+ tool_path { name: "objdump" path: "/usr/bin/objdump" } | |
+ tool_path { name: "strip" path: "/usr/bin/strip" } | |
+ | |
+ # Anticipated future default. | |
+ unfiltered_cxx_flag: "-no-canonical-prefixes" | |
+ unfiltered_cxx_flag: "-fno-canonical-system-headers" | |
+ | |
+ # Make C++ compilation deterministic. Use linkstamping instead of these | |
+ # compiler symbols. | |
+ unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" | |
+ unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" | |
+ unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" | |
+ unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" | |
+ | |
+ # Security hardening on by default. | |
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. | |
+ # We need to undef it before redefining it as some distributions now have | |
+ # it enabled by default. | |
+ compiler_flag: "-U_FORTIFY_SOURCE" | |
+ compiler_flag: "-D_FORTIFY_SOURCE=1" | |
+ compiler_flag: "-fstack-protector" | |
+ linker_flag: "-Wl,-z,relro,-z,now" | |
+ | |
+ # Enable coloring even if there's no attached terminal. Bazel removes the | |
+ # escape sequences if --nocolor is specified. This isn't supported by gcc | |
+ # on Ubuntu 14.04. | |
+ # compiler_flag: "-fcolor-diagnostics" | |
+ | |
+ # All warnings are enabled. Maybe enable -Werror as well? | |
+ compiler_flag: "-Wall" | |
+ # Enable a few more warnings that aren't part of -Wall. | |
+ compiler_flag: "-Wunused-but-set-parameter" | |
+ # But disable some that are problematic. | |
+ compiler_flag: "-Wno-free-nonheap-object" # has false positives | |
+ | |
+ # Keep stack frames for debugging, even in opt mode. | |
+ compiler_flag: "-fno-omit-frame-pointer" | |
+ | |
+ # Anticipated future default. | |
+ linker_flag: "-no-canonical-prefixes" | |
+ # Have gcc return the exit code from ld. | |
+ linker_flag: "-pass-exit-codes" | |
+ # Gold linker only? Can we enable this by default? | |
+ # linker_flag: "-Wl,--warn-execstack" | |
+ # linker_flag: "-Wl,--detect-odr-violations" | |
+ | |
+ compilation_mode_flags { | |
+ mode: DBG | |
+ # Enable debug symbols. | |
+ compiler_flag: "-g" | |
+ } | |
+ compilation_mode_flags { | |
+ mode: OPT | |
+ | |
+ # No debug symbols. | |
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or | |
+ # even generally? However, that can't happen here, as it requires special | |
+ # handling in Bazel. | |
+ compiler_flag: "-g0" | |
+ | |
+ # Conservative choice for -O | |
+ # -O3 can increase binary size and even slow down the resulting binaries. | |
+ # Profile first and / or use FDO if you need better performance than this. | |
+ compiler_flag: "-O2" | |
+ | |
+ # Disable assertions | |
+ compiler_flag: "-DNDEBUG" | |
+ | |
+ # Removal of unused code and data at link time (can this increase binary size in some cases?). | |
+ compiler_flag: "-ffunction-sections" | |
+ compiler_flag: "-fdata-sections" | |
+ linker_flag: "-Wl,--gc-sections" | |
+ } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
+ | |
+toolchain { | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ builtin_sysroot: "" | |
+ compiler: "compiler" | |
+ host_system_name: "local" | |
+ needsPic: true | |
+ target_libc: "macosx" | |
+ target_cpu: "darwin" | |
+ target_system_name: "local" | |
+ toolchain_identifier: "local_darwin" | |
+ | |
+ tool_path { name: "ar" path: "/usr/bin/libtool" } | |
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" } | |
+ tool_path { name: "cpp" path: "/usr/bin/cpp" } | |
+ tool_path { name: "dwp" path: "/usr/bin/dwp" } | |
+ tool_path { name: "gcc" path: "osx_cc_wrapper.sh" } | |
+ cxx_flag: "-std=c++0x" | |
+ linker_flag: "-lstdc++" | |
+ linker_flag: "-undefined" | |
+ linker_flag: "dynamic_lookup" | |
+ linker_flag: "-headerpad_max_install_names" | |
+ # TODO(ulfjack): This is wrong on so many levels. Figure out a way to auto-detect the proper | |
+ # setting from the local compiler, and also how to make incremental builds correct. | |
+ cxx_builtin_include_directory: "/" | |
+ tool_path { name: "gcov" path: "/usr/bin/gcov" } | |
+ tool_path { name: "ld" path: "/usr/bin/ld" } | |
+ tool_path { name: "nm" path: "/usr/bin/nm" } | |
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" } | |
+ objcopy_embed_flag: "-I" | |
+ objcopy_embed_flag: "binary" | |
+ tool_path { name: "objdump" path: "/usr/bin/objdump" } | |
+ tool_path { name: "strip" path: "/usr/bin/strip" } | |
+ | |
+ # Anticipated future default. | |
+ unfiltered_cxx_flag: "-no-canonical-prefixes" | |
+ | |
+ # Make C++ compilation deterministic. Use linkstamping instead of these | |
+ # compiler symbols. | |
+ unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" | |
+ unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" | |
+ unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" | |
+ unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" | |
+ | |
+ # Security hardening on by default. | |
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. | |
+ compiler_flag: "-D_FORTIFY_SOURCE=1" | |
+ compiler_flag: "-fstack-protector" | |
+ | |
+ # Enable coloring even if there's no attached terminal. Bazel removes the | |
+ # escape sequences if --nocolor is specified. | |
+ compiler_flag: "-fcolor-diagnostics" | |
+ | |
+ # All warnings are enabled. Maybe enable -Werror as well? | |
+ compiler_flag: "-Wall" | |
+ # Enable a few more warnings that aren't part of -Wall. | |
+ compiler_flag: "-Wthread-safety" | |
+ compiler_flag: "-Wself-assign" | |
+ | |
+ # Keep stack frames for debugging, even in opt mode. | |
+ compiler_flag: "-fno-omit-frame-pointer" | |
+ | |
+ # Anticipated future default. | |
+ linker_flag: "-no-canonical-prefixes" | |
+ | |
+ compilation_mode_flags { | |
+ mode: DBG | |
+ # Enable debug symbols. | |
+ compiler_flag: "-g" | |
+ } | |
+ compilation_mode_flags { | |
+ mode: OPT | |
+ # No debug symbols. | |
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or even generally? | |
+ # However, that can't happen here, as it requires special handling in Bazel. | |
+ compiler_flag: "-g0" | |
+ | |
+ # Conservative choice for -O | |
+ # -O3 can increase binary size and even slow down the resulting binaries. | |
+ # Profile first and / or use FDO if you need better performance than this. | |
+ compiler_flag: "-O2" | |
+ | |
+ # Disable assertions | |
+ compiler_flag: "-DNDEBUG" | |
+ | |
+ # Removal of unused code and data at link time (can this increase binary size in some cases?). | |
+ compiler_flag: "-ffunction-sections" | |
+ compiler_flag: "-fdata-sections" | |
+ } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
+ | |
+toolchain { | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ builtin_sysroot: "" | |
+ compiler: "compiler" | |
+ host_system_name: "local" | |
+ needsPic: true | |
+ supports_gold_linker: false | |
+ supports_incremental_linker: false | |
+ supports_fission: false | |
+ supports_interface_shared_objects: false | |
+ supports_normalizing_ar: false | |
+ supports_start_end_lib: false | |
+ target_libc: "local" | |
+ target_cpu: "freebsd" | |
+ target_system_name: "local" | |
+ toolchain_identifier: "local_freebsd" | |
+ | |
+ tool_path { name: "ar" path: "/usr/bin/ar" } | |
+ tool_path { name: "compat-ld" path: "/usr/bin/ld" } | |
+ tool_path { name: "cpp" path: "/usr/bin/cpp" } | |
+ tool_path { name: "dwp" path: "/usr/bin/dwp" } | |
+ tool_path { name: "gcc" path: "/usr/bin/clang" } | |
+ cxx_flag: "-std=c++0x" | |
+ linker_flag: "-lstdc++" | |
+ linker_flag: "-B/usr/bin/" | |
+ | |
+ # TODO(bazel-team): In theory, the path here ought to exactly match the path | |
+ # used by gcc. That works because bazel currently doesn't track files at | |
+ # absolute locations and has no remote execution, yet. However, this will need | |
+ # to be fixed, maybe with auto-detection? | |
+ cxx_builtin_include_directory: "/usr/lib/clang" | |
+ cxx_builtin_include_directory: "/usr/local/include" | |
+ cxx_builtin_include_directory: "/usr/include" | |
+ tool_path { name: "gcov" path: "/usr/bin/gcov" } | |
+ | |
+ # C(++) compiles invoke the compiler (as that is the one knowing where | |
+ # to find libraries), but we provide LD so other rules can invoke the linker. | |
+ tool_path { name: "ld" path: "/usr/bin/ld" } | |
+ | |
+ tool_path { name: "nm" path: "/usr/bin/nm" } | |
+ tool_path { name: "objcopy" path: "/usr/bin/objcopy" } | |
+ objcopy_embed_flag: "-I" | |
+ objcopy_embed_flag: "binary" | |
+ tool_path { name: "objdump" path: "/usr/bin/objdump" } | |
+ tool_path { name: "strip" path: "/usr/bin/strip" } | |
+ | |
+ # Anticipated future default. | |
+ unfiltered_cxx_flag: "-no-canonical-prefixes" | |
+ | |
+ # Make C++ compilation deterministic. Use linkstamping instead of these | |
+ # compiler symbols. | |
+ unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" | |
+ unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" | |
+ unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" | |
+ unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" | |
+ | |
+ # Security hardening on by default. | |
+ # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. | |
+ # We need to undef it before redefining it as some distributions now have | |
+ # it enabled by default. | |
+ compiler_flag: "-U_FORTIFY_SOURCE" | |
+ compiler_flag: "-D_FORTIFY_SOURCE=1" | |
+ compiler_flag: "-fstack-protector" | |
+ linker_flag: "-Wl,-z,relro,-z,now" | |
+ | |
+ # Enable coloring even if there's no attached terminal. Bazel removes the | |
+ # escape sequences if --nocolor is specified. This isn't supported by gcc | |
+ # on Ubuntu 14.04. | |
+ # compiler_flag: "-fcolor-diagnostics" | |
+ | |
+ # All warnings are enabled. Maybe enable -Werror as well? | |
+ compiler_flag: "-Wall" | |
+ # Enable a few more warnings that aren't part of -Wall. | |
+ #compiler_flag: "-Wunused-but-set-parameter" | |
+ # But disable some that are problematic. | |
+ #compiler_flag: "-Wno-free-nonheap-object" # has false positives | |
+ | |
+ # Keep stack frames for debugging, even in opt mode. | |
+ compiler_flag: "-fno-omit-frame-pointer" | |
+ | |
+ # Anticipated future default. | |
+ linker_flag: "-no-canonical-prefixes" | |
+ # Have gcc return the exit code from ld. | |
+ #linker_flag: "-pass-exit-codes" | |
+ # Stamp the binary with a unique identifier. | |
+ # Gold linker only? Can we enable this by default? | |
+ # linker_flag: "-Wl,--warn-execstack" | |
+ # linker_flag: "-Wl,--detect-odr-violations" | |
+ | |
+ compilation_mode_flags { | |
+ mode: DBG | |
+ # Enable debug symbols. | |
+ compiler_flag: "-g" | |
+ } | |
+ compilation_mode_flags { | |
+ mode: OPT | |
+ | |
+ # No debug symbols. | |
+ # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or | |
+ # even generally? However, that can't happen here, as it requires special | |
+ # handling in Bazel. | |
+ compiler_flag: "-g0" | |
+ | |
+ # Conservative choice for -O | |
+ # -O3 can increase binary size and even slow down the resulting binaries. | |
+ # Profile first and / or use FDO if you need better performance than this. | |
+ compiler_flag: "-O2" | |
+ | |
+ # Disable assertions | |
+ compiler_flag: "-DNDEBUG" | |
+ | |
+ # Removal of unused code and data at link time (can this increase binary size in some cases?). | |
+ compiler_flag: "-ffunction-sections" | |
+ compiler_flag: "-fdata-sections" | |
+ linker_flag: "-Wl,--gc-sections" | |
+ } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
+ | |
+toolchain { | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ builtin_sysroot: "" | |
+ compiler: "windows_mingw" | |
+ host_system_name: "local" | |
+ needsPic: false | |
+ target_libc: "local" | |
+ target_cpu: "x64_windows" | |
+ target_system_name: "local" | |
+ toolchain_identifier: "local_windows_mingw" | |
+ | |
+ tool_path { name: "ar" path: "C:/mingw/bin/ar" } | |
+ tool_path { name: "compat-ld" path: "C:/mingw/bin/ld" } | |
+ tool_path { name: "cpp" path: "C:/mingw/bin/cpp" } | |
+ tool_path { name: "dwp" path: "C:/mingw/bin/dwp" } | |
+ tool_path { name: "gcc" path: "C:/mingw/bin/gcc" } | |
+ cxx_flag: "-std=c++0x" | |
+ # TODO(bazel-team): In theory, the path here ought to exactly match the path | |
+ # used by gcc. That works because bazel currently doesn't track files at | |
+ # absolute locations and has no remote execution, yet. However, this will need | |
+ # to be fixed, maybe with auto-detection? | |
+ cxx_builtin_include_directory: "C:/mingw/include" | |
+ cxx_builtin_include_directory: "C:/mingw/lib/gcc" | |
+ tool_path { name: "gcov" path: "C:/mingw/bin/gcov" } | |
+ tool_path { name: "ld" path: "C:/mingw/bin/ld" } | |
+ tool_path { name: "nm" path: "C:/mingw/bin/nm" } | |
+ tool_path { name: "objcopy" path: "C:/mingw/bin/objcopy" } | |
+ objcopy_embed_flag: "-I" | |
+ objcopy_embed_flag: "binary" | |
+ tool_path { name: "objdump" path: "C:/mingw/bin/objdump" } | |
+ tool_path { name: "strip" path: "C:/mingw/bin/strip" } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
+ | |
+toolchain { | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ builtin_sysroot: "" | |
+ compiler: "windows_msys64_mingw64" | |
+ host_system_name: "local" | |
+ needsPic: false | |
+ target_libc: "local" | |
+ target_cpu: "x64_windows" | |
+ target_system_name: "local" | |
+ toolchain_identifier: "local_windows_msys64_mingw64" | |
+ | |
+ tool_path { name: "ar" path: "C:/tools/msys64/mingw64/bin/ar" } | |
+ tool_path { name: "compat-ld" path: "C:/tools/msys64/mingw64/bin/ld" } | |
+ tool_path { name: "cpp" path: "C:/tools/msys64/mingw64/bin/cpp" } | |
+ tool_path { name: "dwp" path: "C:/tools/msys64/mingw64/bin/dwp" } | |
+ tool_path { name: "gcc" path: "C:/tools/msys64/mingw64/bin/gcc" } | |
+ cxx_flag: "-std=c++0x" | |
+ # TODO(bazel-team): In theory, the path here ought to exactly match the path | |
+ # used by gcc. That works because bazel currently doesn't track files at | |
+ # absolute locations and has no remote execution, yet. However, this will need | |
+ # to be fixed, maybe with auto-detection? | |
+ cxx_builtin_include_directory: "C:/tools/msys64/mingw64/x86_64-w64-mingw32/include" | |
+ tool_path { name: "gcov" path: "C:/tools/msys64/mingw64/bin/gcov" } | |
+ tool_path { name: "ld" path: "C:/tools/msys64/mingw64/bin/ld" } | |
+ tool_path { name: "nm" path: "C:/tools/msys64/mingw64/bin/nm" } | |
+ tool_path { name: "objcopy" path: "C:/tools/msys64/mingw64/bin/objcopy" } | |
+ objcopy_embed_flag: "-I" | |
+ objcopy_embed_flag: "binary" | |
+ tool_path { name: "objdump" path: "C:/tools/msys64/mingw64/bin/objdump" } | |
+ tool_path { name: "strip" path: "C:/tools/msys64/mingw64/bin/strip" } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
+ | |
+toolchain { | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ builtin_sysroot: "" | |
+ compiler: "windows_clang" | |
+ host_system_name: "local" | |
+ needsPic: false | |
+ target_libc: "local" | |
+ target_cpu: "x64_windows" | |
+ target_system_name: "local" | |
+ toolchain_identifier: "local_windows_clang" | |
+ | |
+ tool_path { name: "ar" path: "C:/mingw/bin/ar" } | |
+ tool_path { name: "compat-ld" path: "C:/Program Files (x86)/LLVM/bin/ld" } | |
+ tool_path { name: "cpp" path: "C:/Program Files (x86)/LLVM/bin/cpp" } | |
+ tool_path { name: "dwp" path: "C:/Program Files (x86)/LLVM/bin/dwp" } | |
+ tool_path { name: "gcc" path: "C:/Program Files (x86)/LLVM/bin/clang" } | |
+ cxx_flag: "-std=c++0x" | |
+ # TODO(bazel-team): In theory, the path here ought to exactly match the path | |
+ # used by gcc. That works because bazel currently doesn't track files at | |
+ # absolute locations and has no remote execution, yet. However, this will need | |
+ # to be fixed, maybe with auto-detection? | |
+ cxx_builtin_include_directory: "/usr/lib/gcc/" | |
+ cxx_builtin_include_directory: "/usr/local/include" | |
+ cxx_builtin_include_directory: "/usr/include" | |
+ tool_path { name: "gcov" path: "C:/Program Files (x86)/LLVM/bin/gcov" } | |
+ tool_path { name: "ld" path: "C:/Program Files (x86)/LLVM/bin/ld" } | |
+ tool_path { name: "nm" path: "C:/Program Files (x86)/LLVM/bin/nm" } | |
+ tool_path { name: "objcopy" path: "C:/Program Files (x86)/LLVM/bin/objcopy" } | |
+ objcopy_embed_flag: "-I" | |
+ objcopy_embed_flag: "binary" | |
+ tool_path { name: "objdump" path: "C:/Program Files (x86)/LLVM/bin/objdump" } | |
+ tool_path { name: "strip" path: "C:/Program Files (x86)/LLVM/bin/strip" } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
+ | |
+toolchain { | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ builtin_sysroot: "" | |
+ compiler: "windows_msys64" | |
+ host_system_name: "local" | |
+ needsPic: false | |
+ target_libc: "local" | |
+ target_cpu: "x64_windows" | |
+ target_system_name: "local" | |
+ toolchain_identifier: "local_windows_msys64" | |
+ | |
+ tool_path { name: "ar" path: "C:/tools/msys64/usr/bin/ar" } | |
+ tool_path { name: "compat-ld" path: "C:/tools/msys64/usr/bin/ld" } | |
+ tool_path { name: "cpp" path: "C:/tools/msys64/usr/bin/cpp" } | |
+ tool_path { name: "dwp" path: "C:/tools/msys64/usr/bin/dwp" } | |
+ # Use gcc instead of g++ so that C will compile correctly. | |
+ tool_path { name: "gcc" path: "C:/tools/msys64/usr/bin/gcc" } | |
+ cxx_flag: "-std=gnu++0x" | |
+ linker_flag: "-lstdc++" | |
+ # TODO(bazel-team): In theory, the path here ought to exactly match the path | |
+ # used by gcc. That works because bazel currently doesn't track files at | |
+ # absolute locations and has no remote execution, yet. However, this will need | |
+ # to be fixed, maybe with auto-detection? | |
+ cxx_builtin_include_directory: "C:/tools/msys64/" | |
+ cxx_builtin_include_directory: "/usr/" | |
+ tool_path { name: "gcov" path: "C:/tools/msys64/usr/bin/gcov" } | |
+ tool_path { name: "ld" path: "C:/tools/msys64/usr/bin/ld" } | |
+ tool_path { name: "nm" path: "C:/tools/msys64/usr/bin/nm" } | |
+ tool_path { name: "objcopy" path: "C:/tools/msys64/usr/bin/objcopy" } | |
+ objcopy_embed_flag: "-I" | |
+ objcopy_embed_flag: "binary" | |
+ tool_path { name: "objdump" path: "C:/tools/msys64/usr/bin/objdump" } | |
+ tool_path { name: "strip" path: "C:/tools/msys64/usr/bin/strip" } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
+ | |
+toolchain { | |
+ toolchain_identifier: "vc_14_0_x64" | |
+ host_system_name: "local" | |
+ target_system_name: "local" | |
+ | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ target_cpu: "x64_windows_msvc" | |
+ compiler: "cl" | |
+ target_libc: "msvcrt140" | |
+ default_python_version: "python2.7" | |
+ cxx_builtin_include_directory: "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/INCLUDE" | |
+ cxx_builtin_include_directory: "C:/Program Files (x86)/Windows Kits/10/include/" | |
+ cxx_builtin_include_directory: "C:/Program Files (x86)/Windows Kits/8.1/include/" | |
+ cxx_builtin_include_directory: "C:/Program Files (x86)/GnuWin32/include/" | |
+ cxx_builtin_include_directory: "C:/python_27_amd64/files/include" | |
+ tool_path { | |
+ name: "ar" | |
+ path: "wrapper/bin/msvc_link.bat" | |
+ } | |
+ tool_path { | |
+ name: "cpp" | |
+ path: "wrapper/bin/msvc_cl.bat" | |
+ } | |
+ tool_path { | |
+ name: "gcc" | |
+ path: "wrapper/bin/msvc_cl.bat" | |
+ } | |
+ tool_path { | |
+ name: "gcov" | |
+ path: "wrapper/bin/msvc_nop.bat" | |
+ } | |
+ tool_path { | |
+ name: "ld" | |
+ path: "wrapper/bin/msvc_link.bat" | |
+ } | |
+ tool_path { | |
+ name: "nm" | |
+ path: "wrapper/bin/msvc_nop.bat" | |
+ } | |
+ tool_path { | |
+ name: "objcopy" | |
+ path: "wrapper/bin/msvc_nop.bat" | |
+ } | |
+ tool_path { | |
+ name: "objdump" | |
+ path: "wrapper/bin/msvc_nop.bat" | |
+ } | |
+ tool_path { | |
+ name: "strip" | |
+ path: "wrapper/bin/msvc_nop.bat" | |
+ } | |
+ supports_gold_linker: false | |
+ supports_start_end_lib: false | |
+ supports_interface_shared_objects: false | |
+ supports_incremental_linker: false | |
+ supports_normalizing_ar: true | |
+ needsPic: false | |
+ | |
+ compiler_flag: "-m64" | |
+ compiler_flag: "/D__inline__=__inline" | |
+ # TODO(pcloudy): Review those flags below, they should be defined by cl.exe | |
+ compiler_flag: "/DCOMPILER_MSVC" | |
+ | |
+ # Don't pollute with GDI macros in windows.h. | |
+ compiler_flag: "/DNOGDI" | |
+ # Don't define min/max macros in windows.h. | |
+ compiler_flag: "/DNOMINMAX" | |
+ compiler_flag: "/DPRAGMA_SUPPORTED" | |
+ # Platform defines. | |
+ compiler_flag: "/D_WIN32_WINNT=0x0600" | |
+ # Turn off warning messages. | |
+ compiler_flag: "/D_CRT_SECURE_NO_DEPRECATE" | |
+ compiler_flag: "/D_CRT_SECURE_NO_WARNINGS" | |
+ compiler_flag: "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS" | |
+ # Use math constants (M_PI, etc.) from the math library | |
+ compiler_flag: "/D_USE_MATH_DEFINES" | |
+ | |
+ # Useful options to have on for compilation. | |
+ # Suppress startup banner. | |
+ compiler_flag: "/nologo" | |
+ # Increase the capacity of object files to 2^32 sections. | |
+ compiler_flag: "/bigobj" | |
+ # Allocate 500MB for precomputed headers. | |
+ compiler_flag: "/Zm500" | |
+ # Use unsigned char by default. | |
+ compiler_flag: "/J" | |
+ # Use function level linking. | |
+ compiler_flag: "/Gy" | |
+ # Use string pooling. | |
+ compiler_flag: "/GF" | |
+ # Warning level 3 (could possibly go to 4 in the future). | |
+ compiler_flag: "/W3" | |
+ # Catch both asynchronous (structured) and synchronous (C++) exceptions. | |
+ compiler_flag: "/EHsc" | |
+ | |
+ # Globally disabled warnings. | |
+ # Don't warn about elements of array being be default initialized. | |
+ compiler_flag: "/wd4351" | |
+ # Don't warn about no matching delete found. | |
+ compiler_flag: "/wd4291" | |
+ # Don't warn about diamond inheritance patterns. | |
+ compiler_flag: "/wd4250" | |
+ # Don't warn about insecure functions (e.g. non _s functions). | |
+ compiler_flag: "/wd4996" | |
+ | |
+ linker_flag: "-m64" | |
+ # Stop passing -frandom-seed option | |
+ feature { | |
+ name: 'random_seed' | |
+ } | |
+ | |
+ # This feature is just for enabling flag_set in action_config for -c and -o options during the transitional period | |
+ feature { | |
+ name: 'compile_action_flags_in_flag_set' | |
+ } | |
+ | |
+ action_config { | |
+ config_name: 'c-compile' | |
+ action_name: 'c-compile' | |
+ tool { | |
+ tool_path: 'wrapper/bin/msvc_cl.bat' | |
+ } | |
+ flag_set { | |
+ flag_group { | |
+ flag: '/c' | |
+ flag: '%{source_file}' | |
+ } | |
+ } | |
+ flag_set { | |
+ expand_if_all_available: 'output_object_file' | |
+ flag_group { | |
+ flag: '/Fo%{output_object_file}' | |
+ } | |
+ } | |
+ flag_set { | |
+ expand_if_all_available: 'output_assembly_file' | |
+ flag_group { | |
+ flag: '/Fa%{output_assembly_file}' | |
+ } | |
+ } | |
+ flag_set { | |
+ expand_if_all_available: 'output_preprocess_file' | |
+ flag_group { | |
+ flag: '/P' | |
+ flag: '/Fi%{output_preprocess_file}' | |
+ } | |
+ } | |
+ implies: 'legacy_compile_flags' | |
+ implies: 'user_compile_flags' | |
+ implies: 'sysroot' | |
+ implies: 'unfiltered_compile_flags' | |
+ } | |
+ | |
+ action_config { | |
+ config_name: 'c++-compile' | |
+ action_name: 'c++-compile' | |
+ tool { | |
+ tool_path: 'wrapper/bin/msvc_cl.bat' | |
+ } | |
+ flag_set { | |
+ flag_group { | |
+ flag: '/c' | |
+ flag: '%{source_file}' | |
+ } | |
+ } | |
+ flag_set { | |
+ expand_if_all_available: 'output_object_file' | |
+ flag_group { | |
+ flag: '/Fo%{output_object_file}' | |
+ } | |
+ } | |
+ flag_set { | |
+ expand_if_all_available: 'output_assembly_file' | |
+ flag_group { | |
+ flag: '/Fa%{output_assembly_file}' | |
+ } | |
+ } | |
+ flag_set { | |
+ expand_if_all_available: 'output_preprocess_file' | |
+ flag_group { | |
+ flag: '/P' | |
+ flag: '/Fi%{output_preprocess_file}' | |
+ } | |
+ } | |
+ implies: 'legacy_compile_flags' | |
+ implies: 'user_compile_flags' | |
+ implies: 'sysroot' | |
+ implies: 'unfiltered_compile_flags' | |
+ } | |
+ | |
+ # TODO(b/65151735): Remove legacy_compile_flags feature when legacy fields are | |
+ # not used in this crosstool | |
+ feature { | |
+ name: 'legacy_compile_flags' | |
+ flag_set { | |
+ expand_if_all_available: 'legacy_compile_flags' | |
+ action: 'assemble' | |
+ action: 'preprocess-assemble' | |
+ action: 'c-compile' | |
+ action: 'c++-compile' | |
+ action: 'c++-header-parsing' | |
+ action: 'c++-header-preprocessing' | |
+ action: 'c++-module-compile' | |
+ action: 'c++-module-codegen' | |
+ flag_group { | |
+ iterate_over: 'legacy_compile_flags' | |
+ flag: '%{legacy_compile_flags}' | |
+ } | |
+ } | |
+ } | |
+ | |
+ feature { | |
+ name: 'include_paths' | |
+ flag_set { | |
+ action: 'preprocess-assemble' | |
+ action: 'c-compile' | |
+ action: 'c++-compile' | |
+ action: 'c++-header-parsing' | |
+ action: 'c++-header-preprocessing' | |
+ action: 'c++-module-compile' | |
+ flag_group { | |
+ iterate_over: 'quote_include_paths' | |
+ flag: '/I%{quote_include_paths}' | |
+ } | |
+ flag_group { | |
+ iterate_over: 'include_paths' | |
+ flag: '/I%{include_paths}' | |
+ } | |
+ flag_group { | |
+ iterate_over: 'system_include_paths' | |
+ flag: '/I%{system_include_paths}' | |
+ } | |
+ } | |
+ } | |
+ | |
+ feature { | |
+ name: 'dependency_file' | |
+ flag_set { | |
+ action: 'assemble' | |
+ action: 'preprocess-assemble' | |
+ action: 'c-compile' | |
+ action: 'c++-compile' | |
+ action: 'c++-module-compile' | |
+ action: 'c++-header-preprocessing' | |
+ action: 'c++-header-parsing' | |
+ expand_if_all_available: 'dependency_file' | |
+ flag_group { | |
+ flag: '/DEPENDENCY_FILE' | |
+ flag: '%{dependency_file}' | |
+ } | |
+ } | |
+ } | |
+ | |
+ feature { | |
+ name: 'user_compile_flags' | |
+ flag_set { | |
+ expand_if_all_available: 'user_compile_flags' | |
+ action: 'assemble' | |
+ action: 'preprocess-assemble' | |
+ action: 'c-compile' | |
+ action: 'c++-compile' | |
+ action: 'c++-header-parsing' | |
+ action: 'c++-header-preprocessing' | |
+ action: 'c++-module-compile' | |
+ action: 'c++-module-codegen' | |
+ flag_group { | |
+ iterate_over: 'user_compile_flags' | |
+ flag: '%{user_compile_flags}' | |
+ } | |
+ } | |
+ } | |
+ | |
+ feature { | |
+ name: 'sysroot' | |
+ flag_set { | |
+ expand_if_all_available: 'sysroot' | |
+ action: 'assemble' | |
+ action: 'preprocess-assemble' | |
+ action: 'c-compile' | |
+ action: 'c++-compile' | |
+ action: 'c++-header-parsing' | |
+ action: 'c++-header-preprocessing' | |
+ action: 'c++-module-compile' | |
+ action: 'c++-module-codegen' | |
+ action: 'c++-link-executable' | |
+ action: 'c++-link-dynamic-library' | |
+ flag_group { | |
+ iterate_over: 'sysroot' | |
+ flag: '--sysroot=%{sysroot}' | |
+ } | |
+ } | |
+ } | |
+ | |
+ feature { | |
+ name: 'unfiltered_compile_flags' | |
+ flag_set { | |
+ expand_if_all_available: 'unfiltered_compile_flags' | |
+ action: 'assemble' | |
+ action: 'preprocess-assemble' | |
+ action: 'c-compile' | |
+ action: 'c++-compile' | |
+ action: 'c++-header-parsing' | |
+ action: 'c++-header-preprocessing' | |
+ action: 'c++-module-compile' | |
+ action: 'c++-module-codegen' | |
+ flag_group { | |
+ iterate_over: 'unfiltered_compile_flags' | |
+ flag: '%{unfiltered_compile_flags}' | |
+ } | |
+ } | |
+ } | |
+ | |
+ compilation_mode_flags { | |
+ mode: DBG | |
+ compiler_flag: "/DDEBUG=1" | |
+ # This will signal the wrapper that we are doing a debug build, which sets | |
+ # some internal state of the toolchain wrapper. It is intentionally a "-" | |
+ # flag to make this very obvious. | |
+ compiler_flag: "-g" | |
+ compiler_flag: "/Od" | |
+ compiler_flag: "-Xcompilation-mode=dbg" | |
+ } | |
+ | |
+ compilation_mode_flags { | |
+ mode: FASTBUILD | |
+ compiler_flag: "/DNDEBUG" | |
+ compiler_flag: "/Od" | |
+ compiler_flag: "-Xcompilation-mode=fastbuild" | |
+ } | |
+ | |
+ compilation_mode_flags { | |
+ mode: OPT | |
+ compiler_flag: "/DNDEBUG" | |
+ compiler_flag: "/O2" | |
+ compiler_flag: "-Xcompilation-mode=opt" | |
+ } | |
+} | |
+ | |
+# Stub crosstool to allow construction of apple crosstool configuration in a | |
+# static configuration set. | |
+# TODO(b/33804121): Remove this once dynamic configurations are in place. | |
+toolchain { | |
+ toolchain_identifier: "ios_x86_64" | |
+ host_system_name: "x86_64-apple-macosx" | |
+ target_system_name: "x86_64-apple-ios" | |
+ target_cpu: "ios_x86_64" | |
+ target_libc: "ios" | |
+ compiler: "compiler" | |
+ abi_version: "local" | |
+ abi_libc_version: "local" | |
+ supports_gold_linker: false | |
+ supports_incremental_linker: false | |
+ supports_fission: false | |
+ supports_interface_shared_objects: false | |
+ supports_normalizing_ar: false | |
+ supports_start_end_lib: false | |
+ | |
+ tool_path { name: "ar" path: "/bin/false" } | |
+ tool_path { name: "compat-ld" path: "/bin/false" } | |
+ tool_path { name: "cpp" path: "/bin/false" } | |
+ tool_path { name: "dwp" path: "/bin/false" } | |
+ tool_path { name: "gcc" path: "/bin/false" } | |
+ tool_path { name: "gcov" path: "/bin/false" } | |
+ tool_path { name: "ld" path: "/bin/false" } | |
+ | |
+ tool_path { name: "nm" path: "/bin/false" } | |
+ tool_path { name: "objcopy" path: "/bin/false" } | |
+ tool_path { name: "objdump" path: "/bin/false" } | |
+ tool_path { name: "strip" path: "/bin/false" } | |
+ linking_mode_flags { mode: DYNAMIC } | |
+} | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/cpp/cc_configure.bzl bazel/tools/cpp/cc_configure.bzl | |
--- bazel-orig/tools/cpp/cc_configure.bzl 2018-04-01 14:52:36.550063824 +0000 | |
+++ bazel/tools/cpp/cc_configure.bzl 2018-04-10 09:07:17.133149069 +0000 | |
@@ -24,7 +24,7 @@ | |
Label("@bazel_tools//tools/cpp:dummy_toolchain.bzl"), "dummy_toolchain.bzl") | |
env = repository_ctx.os.environ | |
cpu_value = get_cpu_value(repository_ctx) | |
- if cpu_value == "freebsd": | |
+ if (cpu_value == "freebsd" or cpu_value == "solaris"): | |
# This is defaulting to the static crosstool, we should eventually | |
# autoconfigure this platform too. Theorically, FreeBSD should be | |
# straightforward to add but we cannot run it in a docker container so | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/cpp/lib_cc_configure.bzl bazel/tools/cpp/lib_cc_configure.bzl | |
--- bazel-orig/tools/cpp/lib_cc_configure.bzl 2018-04-01 14:52:36.550230850 +0000 | |
+++ bazel/tools/cpp/lib_cc_configure.bzl 2018-04-07 15:57:33.858542175 +0000 | |
@@ -97,6 +97,8 @@ | |
return "darwin" | |
if os_name.find("freebsd") != -1: | |
return "freebsd" | |
+ if os_name.find("sunos") != -1: | |
+ return "solaris" | |
if os_name.find("windows") != -1: | |
return "x64_windows" | |
# Use uname to figure out whether we are on x86_32 or x86_64 | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/cpp/solaris_cc_configure.bzl bazel/tools/cpp/solaris_cc_configure.bzl | |
--- bazel-orig/tools/cpp/solaris_cc_configure.bzl 1970-01-01 00:00:00.000000000 +0000 | |
+++ bazel/tools/cpp/solaris_cc_configure.bzl 2018-04-10 08:56:48.749937615 +0000 | |
@@ -0,0 +1,32 @@ | |
+# pylint: disable=g-bad-file-header | |
+# Copyright 2016 The Bazel Authors. All rights reserved. | |
+# | |
+# Licensed under the Apache License, Version 2.0 (the "License"); | |
+# you may not use this file except in compliance with the License. | |
+# You may obtain a copy of the License at | |
+# | |
+# http://www.apache.org/licenses/LICENSE-2.0 | |
+# | |
+# Unless required by applicable law or agreed to in writing, software | |
+# distributed under the License is distributed on an "AS IS" BASIS, | |
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+# See the License for the specific language governing permissions and | |
+# limitations under the License. | |
+"""Configuring the C++ toolchain on Solaris.""" | |
+ | |
+load( | |
+ "@bazel_tools//tools/cpp:lib_cc_configure.bzl", | |
+ "escape_string", | |
+) | |
+ | |
+load( | |
+ "@bazel_tools//tools/cpp:unix_cc_configure.bzl", | |
+ "get_escaped_cxx_inc_directories", | |
+ "tpl", | |
+ "get_env", | |
+ "find_cc", | |
+ "configure_unix_toolchain" | |
+) | |
+ | |
+def configure_osx_toolchain(repository_ctx, overriden_tools): | |
+ """Configure C++ toolchain on Solaris.""" | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/jdk/BUILD bazel/tools/jdk/BUILD | |
--- bazel-orig/tools/jdk/BUILD 2018-04-01 14:52:36.548335741 +0000 | |
+++ bazel/tools/jdk/BUILD 2018-04-01 14:53:02.534423986 +0000 | |
@@ -77,6 +77,11 @@ | |
) | |
alias( | |
+ name = "jni_md_header-solaris", | |
+ actual = "@local_jdk//:jni_md_header-solaris", | |
+) | |
+ | |
+alias( | |
name = "java", | |
actual = "@local_jdk//:java", | |
) | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/platforms/BUILD bazel/tools/platforms/BUILD | |
--- bazel-orig/tools/platforms/BUILD 2018-04-01 14:52:36.549193491 +0000 | |
+++ bazel/tools/platforms/BUILD 2018-04-01 14:53:02.534848733 +0000 | |
@@ -56,6 +56,11 @@ | |
) | |
constraint_value( | |
+ name = "solaris", | |
+ constraint_setting = ":os", | |
+) | |
+ | |
+constraint_value( | |
name = "linux", | |
constraint_setting = ":os", | |
) | |
@@ -83,6 +88,7 @@ | |
os_constraints = [ | |
":osx", | |
":freebsd", | |
+ ":solaris", | |
":linux", | |
":windows", | |
], | |
@@ -100,6 +106,7 @@ | |
os_constraints = [ | |
":osx", | |
":freebsd", | |
+ ":solaris", | |
":linux", | |
":windows", | |
], | |
diff -Nuar '--exclude=bazel-*' '--exclude=output' bazel-orig/tools/platforms/platforms.BUILD bazel/tools/platforms/platforms.BUILD | |
--- bazel-orig/tools/platforms/platforms.BUILD 2018-04-01 14:52:36.549245186 +0000 | |
+++ bazel/tools/platforms/platforms.BUILD 2018-04-01 14:53:02.535174740 +0000 | |
@@ -46,6 +46,11 @@ | |
) | |
constraint_value( | |
+ name = "solaris", | |
+ constraint_setting = ":os", | |
+) | |
+ | |
+constraint_value( | |
name = "linux", | |
constraint_setting = ":os", | |
) | |
@@ -73,6 +78,7 @@ | |
os_constraints = [ | |
":osx", | |
":freebsd", | |
+ ":solaris", | |
":linux", | |
":windows", | |
], | |
@@ -90,6 +96,7 @@ | |
os_constraints = [ | |
":osx", | |
":freebsd", | |
+ ":solaris", | |
":linux", | |
":windows", | |
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment