This commit is contained in:
Ali 2020-10-21 02:42:47 +04:00
parent 0d76b4b84c
commit 4412b0c29b
10 changed files with 19 additions and 67 deletions

View File

@ -57,6 +57,8 @@ endif
BAZEL_COMMON_FLAGS=\ BAZEL_COMMON_FLAGS=\
--announce_rc \ --announce_rc \
--features=swift.use_global_module_cache \ --features=swift.use_global_module_cache \
--features=swift.split_derived_files_generation \
--features=swift.skip_function_bodies_for_derived_files
BAZEL_DEBUG_FLAGS=\ BAZEL_DEBUG_FLAGS=\
--features=swift.enable_batch_mode \ --features=swift.enable_batch_mode \

View File

@ -1,4 +1,4 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
http_archive( http_archive(
name = "com_google_protobuf", name = "com_google_protobuf",
@ -50,3 +50,9 @@ apple_support_dependencies()
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace() bazel_skylib_workspace()
http_file(
name = "cmake_tar_gz",
urls = ["https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4-Darwin-x86_64.tar.gz"],
sha256 = "9d27049660474cf134ab46fa0e0db771b263313fcb8ba82ee8b2d1a1a62f8f20",
)

@ -1 +1 @@
Subproject commit b8755bd2884d6bf651827c30e00bd0ea318e41a2 Subproject commit 2583fa0bfd6909e7936da5b30e3547ba13e198dc

@ -1 +1 @@
Subproject commit d6f9a87d70781e92b95b9344c7d21d921ccc3ae2 Subproject commit f3434dcd7e1dd033231143078b8540ae1b754286

@ -1 +1 @@
Subproject commit 44e8c29afe3baa7f5fc434f4a7e83f7ac786644e Subproject commit dcc52352949d5ccf184f5d202aa5084957b0e103

View File

@ -1,21 +0,0 @@
genrule(
name = "cmake",
srcs = [
"cmake-3.16.0.tar.gz",
],
bash =
"""
core_count="`sysctl -n hw.logicalcpu`"
mkdir -p "$OUT"
tar -xzf "$SRCDIR/cmake-3.16.0.tar.gz" --directory "$OUT"
pushd "$OUT/cmake-3.16.0"
./bootstrap --parallel=$core_count -- -DCMAKE_BUILD_TYPE:STRING=Release
make -j $core_count
popd
""",
out = "cmake",
visibility = [
"PUBLIC",
]
)

View File

@ -1,32 +0,0 @@
genrule(
name = "cmake",
srcs = [
"cmake-3.16.0.tar.gz",
],
cmd_bash =
"""
BUILD_DIR="$(RULEDIR)/build"
rm -rf "$$BUILD_DIR"
mkdir -p "$$BUILD_DIR"
tar -xzf "$(location cmake-3.16.0.tar.gz)" --directory "$$BUILD_DIR"
pushd "$$BUILD_DIR/cmake-3.16.0"
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
core_count="`sysctl -n hw.logicalcpu`"
./bootstrap --parallel=$$core_count -- -DCMAKE_BUILD_TYPE:STRING=Release
make -j $$core_count
popd
tar -cf "$(location cmake.tar)" -C "$$BUILD_DIR/cmake-3.16.0" .
""",
outs = [
"cmake.tar",
],
visibility = [
"//visibility:public",
]
)

Binary file not shown.

View File

@ -22,6 +22,7 @@ genrule(
srcs = [ srcs = [
"build-mozjpeg-bazel.sh", "build-mozjpeg-bazel.sh",
":mozjpeg_sources", ":mozjpeg_sources",
"@cmake_tar_gz//file",
], ],
cmd_bash = cmd_bash =
""" """
@ -44,7 +45,7 @@ genrule(
CMAKE_DIR="$$(pwd)/$$BUILD_DIR/cmake" CMAKE_DIR="$$(pwd)/$$BUILD_DIR/cmake"
rm -rf "$$CMAKE_DIR" rm -rf "$$CMAKE_DIR"
mkdir -p "$$CMAKE_DIR" mkdir -p "$$CMAKE_DIR"
tar -xf "$(location //third-party/cmake:cmake.tar)" -C "$$CMAKE_DIR" tar -xzf "$(location @cmake_tar_gz//file)" -C "$$CMAKE_DIR"
cp $(location :build-mozjpeg-bazel.sh) "$$BUILD_DIR/" cp $(location :build-mozjpeg-bazel.sh) "$$BUILD_DIR/"
@ -54,7 +55,7 @@ genrule(
mkdir -p "$$BUILD_DIR/Public/mozjpeg" mkdir -p "$$BUILD_DIR/Public/mozjpeg"
PATH="$$PATH:$$CMAKE_DIR/bin" sh $$BUILD_DIR/build-mozjpeg-bazel.sh $$BUILD_ARCH "$$BUILD_DIR/mozjpeg" "$$BUILD_DIR" PATH="$$PATH:$$CMAKE_DIR/cmake-3.18.4-Darwin-x86_64/CMake.app/Contents/bin" sh $$BUILD_DIR/build-mozjpeg-bazel.sh $$BUILD_ARCH "$$BUILD_DIR/mozjpeg" "$$BUILD_DIR"
""" + """ +
"\n".join([ "\n".join([
"cp -f \"$$BUILD_DIR/mozjpeg/{}\" \"$(location Public/mozjpeg/{})\"".format(header, header) for header in headers "cp -f \"$$BUILD_DIR/mozjpeg/{}\" \"$(location Public/mozjpeg/{})\"".format(header, header) for header in headers
@ -67,9 +68,6 @@ genrule(
outs = ["Public/mozjpeg/" + x for x in headers] + outs = ["Public/mozjpeg/" + x for x in headers] +
["Public/mozjpeg/jconfig.h"] + ["Public/mozjpeg/jconfig.h"] +
["Public/mozjpeg/lib/lib{}.a".format(x) for x in libs], ["Public/mozjpeg/lib/lib{}.a".format(x) for x in libs],
tools = [
"//third-party/cmake:cmake.tar",
],
visibility = [ visibility = [
"//visibility:public", "//visibility:public",
] ]

View File

@ -1,8 +1,10 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
genrule( genrule(
name = "yasm", name = "yasm",
srcs = [ srcs = [
"yasm-1.3.0.tar.gz", "yasm-1.3.0.tar.gz",
"@cmake_tar_gz//file",
], ],
cmd_bash = cmd_bash =
""" """
@ -15,21 +17,18 @@ set -x
CMAKE_DIR="$$(pwd)/$$BUILD_DIR/cmake" CMAKE_DIR="$$(pwd)/$$BUILD_DIR/cmake"
rm -rf "$$CMAKE_DIR" rm -rf "$$CMAKE_DIR"
mkdir -p "$$CMAKE_DIR" mkdir -p "$$CMAKE_DIR"
tar -xf "$(location //third-party/cmake:cmake.tar)" -C "$$CMAKE_DIR" tar -xf "$(location @cmake_tar_gz//file)" -C "$$CMAKE_DIR"
tar -xzf "$(location yasm-1.3.0.tar.gz)" --directory "$$BUILD_DIR" tar -xzf "$(location yasm-1.3.0.tar.gz)" --directory "$$BUILD_DIR"
pushd "$$BUILD_DIR/yasm-1.3.0" pushd "$$BUILD_DIR/yasm-1.3.0"
mkdir build mkdir build
cd build cd build
PATH="$$PATH:$$CMAKE_DIR/bin" cmake .. -DYASM_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF PATH="$$PATH:$$CMAKE_DIR/cmake-3.18.4-Darwin-x86_64/CMake.app/Contents/bin" cmake .. -DYASM_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
make -j $$core_count make -j $$core_count
popd popd
tar -cf "$(location yasm.tar)" -C "$$BUILD_DIR/yasm-1.3.0/build" . tar -cf "$(location yasm.tar)" -C "$$BUILD_DIR/yasm-1.3.0/build" .
""", """,
tools = [
"//third-party/cmake:cmake.tar",
],
outs = [ outs = [
"yasm.tar", "yasm.tar",
], ],