diff options
Diffstat (limited to 'science/libtensorflow1/files')
-rw-r--r-- | science/libtensorflow1/files/extra-patch-third_party_repo.bzl | 25 | ||||
-rw-r--r-- | science/libtensorflow1/files/patch-.bazelrc | 52 | ||||
-rw-r--r-- | science/libtensorflow1/files/patch-configure.py | 11 |
3 files changed, 88 insertions, 0 deletions
diff --git a/science/libtensorflow1/files/extra-patch-third_party_repo.bzl b/science/libtensorflow1/files/extra-patch-third_party_repo.bzl new file mode 100644 index 000000000000..eaab437bdc72 --- /dev/null +++ b/science/libtensorflow1/files/extra-patch-third_party_repo.bzl @@ -0,0 +1,25 @@ +--- third_party/repo.bzl.orig ++++ third_party/repo.bzl +@@ -62,13 +62,15 @@ def _repos_are_siblings(): + return Label("@foo//bar").workspace_root.startswith("../") + + # Apply a patch_file to the repository root directory +-# Runs 'git apply' on Unix, 'patch -p1' on Windows. ++# Runs 'patch -p1' + def _apply_patch(ctx, patch_file): +- if _is_windows(ctx): +- patch_command = ["patch", "-p1", "-d", ctx.path("."), "-i", ctx.path(patch_file)] +- else: +- patch_command = ["git", "apply", "-v", ctx.path(patch_file)] +- cmd = _wrap_bash_cmd(ctx, patch_command) ++ # Don't check patch on Windows, because patch is only available under bash. ++ if not _is_windows(ctx) and not ctx.which("patch"): ++ fail("patch command is not found, please install it") ++ cmd = _wrap_bash_cmd( ++ ctx, ++ ["patch", "-p1", "-d", ctx.path("."), "-i", ctx.path(patch_file)], ++ ) + _execute_and_check_ret_code(ctx, cmd) + + def _apply_delete(ctx, paths): + diff --git a/science/libtensorflow1/files/patch-.bazelrc b/science/libtensorflow1/files/patch-.bazelrc new file mode 100644 index 000000000000..451c94c30fa0 --- /dev/null +++ b/science/libtensorflow1/files/patch-.bazelrc @@ -0,0 +1,52 @@ +--- .bazelrc.orig 2021-01-04 20:18:42 UTC ++++ .bazelrc +@@ -195,7 +195,7 @@ build:c++17 --cxxopt=-stdlib=libc++ + build:c++1z --config=c++17 + + # Default paths for TF_SYSTEM_LIBS +-build --define=PREFIX=/usr ++build --define=PREFIX=/usr/local + build --define=LIBDIR=$(PREFIX)/lib + build --define=INCLUDEDIR=$(PREFIX)/include + +@@ -208,6 +208,9 @@ build:short_logs --output_filter=DONT_MATCH_ANYTHING + # Instruction set optimizations + # TODO(gunan): Create a feature in toolchains for avx/avx2 to + # avoid having to define linux/win separately. ++build:avx_freebsd --copt=-mavx ++build:avx2_freebsd --copt=-mavx2 ++build:native_arch_freebsd --copt=-march=native + build:avx_linux --copt=-mavx + build:avx2_linux --copt=-mavx2 + build:native_arch_linux --copt=-march=native +@@ -295,6 +298,20 @@ build:rbe_linux_py3 --repo_env=PYTHON_BIN_PATH="/usr/b + build:rbe_linux_py3 --python_path="/usr/bin/python3" + build:rbe_linux_py3 --repo_env=TF_PYTHON_CONFIG_REPO="@org_tensorflow//third_party/toolchains/preconfig/ubuntu16.04/py3" + ++build:rbe_cpu_freebsd --config=rbe_cpu_linux ++build:rbe_freebsd_cuda_nvcc --config=rbe_linux_cuda_nvcc ++common:rbe_gpu_freebsd --config=rbe_gpu_linux ++ ++build:rbe_freebsd_py2 --config=rbe_linux ++build:rbe_freebsd_py2 --repo_env=PYTHON_BIN_PATH="%%LOCALBASE%%/bin/python2" ++build:rbe_freebsd_py2 --python_path="%%LOCALBASE%%/bin/python2" ++build:rbe_freebsd_py2 --repo_env=TF_PYTHON_CONFIG_REPO="@org_tensorflow//third_party/toolchains/preconfig/ubuntu16.04/py" ++ ++build:rbe_freebsd_py3 --config=rbe_linux ++build:rbe_freebsd_py3 --repo_env=PYTHON_BIN_PATH="%%PYTHON_CMD%%" ++build:rbe_freebsd_py3 --python_path="%%PYTHON_CMD%%" ++build:rbe_freebsd_py3 --repo_env=TF_PYTHON_CONFIG_REPO="@org_tensorflow//third_party/toolchains/preconfig/ubuntu16.04/py3" ++ + build:rbe_win --config=rbe + build:rbe_win --crosstool_top="@org_tensorflow//third_party/toolchains/preconfig/win_1803/bazel_026:toolchain" + build:rbe_win --extra_execution_platforms="@org_tensorflow//third_party/toolchains/preconfig/win_1803:rbe_windows_1803" +@@ -334,6 +351,9 @@ common:tensorflow_testing_rbe_linux --remote_instance_ + build:tensorflow_testing_rbe_linux --config=tensorflow_testing_rbe + build:tensorflow_testing_rbe_linux --config=rbe + build:tensorflow_testing_rbe_linux --config=rbe_linux ++ ++common:tensorflow_testing_rbe_freebsd --config=tensorflow_testing_rbe_linux ++build:tensorflow_testing_rbe_freebsd --config=tensorflow_testing_rbe_linux + + common:tensorflow_testing_rbe_win --remote_instance_name=projects/tensorflow-testing/instances/windows + build:tensorflow_testing_rbe_win --config=tensorflow_testing_rbe diff --git a/science/libtensorflow1/files/patch-configure.py b/science/libtensorflow1/files/patch-configure.py new file mode 100644 index 000000000000..26abc48aad9d --- /dev/null +++ b/science/libtensorflow1/files/patch-configure.py @@ -0,0 +1,11 @@ +--- configure.py.orig 2021-01-04 20:18:42 UTC ++++ configure.py +@@ -475,7 +475,7 @@ def check_bazel_version(min_version, max_version): + print('Cannot find bazel. Please install bazel.') + sys.exit(0) + curr_version = run_shell( +- ['bazel', '--batch', '--bazelrc=/dev/null', 'version']) ++ ['bazel', '--batch', '--output_user_root=/tmp/.bazel', '--bazelrc=/dev/null', 'version']) + + for line in curr_version.split('\n'): + if 'Build label: ' in line: |