Bazel: reorganize workspace.
Change-Id: I2c9971768ce5401aa5975d41f350c07cc227c80d
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Reviewed-on: https://nginx-review.googlesource.com/c/nginx/+/3863
Reviewed-by: Patryk Lesiewicz <patryk@google.com>
diff --git a/BUILD b/BUILD
index 4a7f831..1a4abe2 100644
--- a/BUILD
+++ b/BUILD
@@ -22,9 +22,9 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
+load("@nginx//bazel:nginx.bzl", "nginx_copts")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar")
-load(":build.bzl", "nginx_copts")
licenses(["notice"]) # BSD license
@@ -371,9 +371,9 @@
],
}),
deps = [
- "//external:boringssl_crypto",
- "//external:boringssl_ssl",
- "//external:pcre",
+ "@boringssl//:crypto",
+ "@boringssl//:ssl",
+ "@pcre",
],
)
@@ -444,7 +444,7 @@
],
deps = [
":core",
- "//external:zlib",
+ "@zlib",
],
)
@@ -655,7 +655,7 @@
deps = [
":core",
":http",
- "//external:zlib",
+ "@zlib",
],
)
@@ -671,7 +671,7 @@
deps = [
":core",
":http",
- "//external:zlib",
+ "@zlib",
],
)
@@ -1200,7 +1200,7 @@
],
deps = [
":core",
- "//external:zlib",
+ "@zlib",
],
)
@@ -1469,9 +1469,9 @@
srcs = [
":LICENSE",
"@boringssl//:LICENSE",
- "@nginx_pcre//:LICENCE",
- "@nginx_zlib//:README",
"@org_brotli//:LICENSE",
+ "@pcre//:LICENCE",
+ "@zlib//:README",
],
outs = [
"usr/share/doc/nginx-google/copyright",
@@ -1485,9 +1485,9 @@
"echo \"\n\nBrotli license:\n===============\n\" >> $(@);" +
"cat $(location @org_brotli//:LICENSE) >> $(@);" +
"echo \"\n\nPCRE license:\n=============\n\" >> $(@);" +
- "cat $(location @nginx_pcre//:LICENCE) >> $(@);" +
+ "cat $(location @pcre//:LICENCE) >> $(@);" +
"echo \"\n\nzlib license:\n=============\n\" >> $(@);" +
- "cat $(location @nginx_zlib//:README) | grep -A99 Copyright >> $(@)",
+ "cat $(location @zlib//:README) | grep -A99 Copyright >> $(@)",
)
pkg_tar(
diff --git a/WORKSPACE b/WORKSPACE
index be0f060..645d13f 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -24,26 +24,10 @@
workspace(name = "nginx")
-# @rules_pkg
+load("//bazel:repositories.bzl", "nginx_repositories")
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+nginx_repositories()
-http_archive(
- name = "rules_pkg",
- sha256 = "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d",
- url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
-)
+load("//bazel:dependencies.bzl", "nginx_dependencies")
-load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
-
-rules_pkg_dependencies()
-
-# @nginx
-
-load(":build.bzl", "nginx_repositories")
-
-nginx_repositories(
- bind = True,
- nginx = "@//",
- ngx_brotli = True,
-)
+nginx_dependencies()
diff --git a/bazel/BUILD b/bazel/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bazel/BUILD
diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl
new file mode 100644
index 0000000..c67b13f
--- /dev/null
+++ b/bazel/dependencies.bzl
@@ -0,0 +1,28 @@
+# Copyright (C) 2015-2021 Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
+
+def nginx_dependencies():
+ rules_pkg_dependencies()
diff --git a/bazel/external/BUILD b/bazel/external/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bazel/external/BUILD
diff --git a/bazel/external/nginx_pkgoss.BUILD b/bazel/external/nginx_pkgoss.BUILD
new file mode 100755
index 0000000..16be0e4
--- /dev/null
+++ b/bazel/external/nginx_pkgoss.BUILD
@@ -0,0 +1,269 @@
+# Copyright (C) 2015-2021 Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+
+licenses(["notice"])
+
+genrule(
+ name = "debian_nginx_preinst",
+ srcs = [
+ "debian/nginx.preinst",
+ ],
+ outs = [
+ "nginx.preinst",
+ ],
+ cmd = "sed -e 's|#DEBHELPER#||g'" +
+ " < $(<) > $(@)",
+)
+
+filegroup(
+ name = "debian_preinst",
+ srcs = [
+ "nginx.preinst",
+ ],
+ visibility = [
+ "//visibility:public",
+ ],
+)
+
+genrule(
+ name = "debian_nginx_postinst",
+ srcs = [
+ "debian/nginx.postinst",
+ ],
+ outs = [
+ "nginx.postinst",
+ ],
+ cmd = "sed -e 's|#DEBHELPER#|" +
+ "if [ -x \"/etc/init.d/nginx\" ]; then\\n" +
+ "\\tupdate-rc.d nginx defaults >/dev/null \\|\\| exit $$?\\n" +
+ "fi\\n" +
+ "|g'" +
+ " < $(<) > $(@)",
+)
+
+filegroup(
+ name = "debian_postinst",
+ srcs = [
+ "nginx.postinst",
+ ],
+ visibility = [
+ "//visibility:public",
+ ],
+)
+
+genrule(
+ name = "debian_nginx_prerm",
+ srcs = [
+ "debian/nginx.prerm",
+ ],
+ outs = [
+ "nginx.prerm",
+ ],
+ cmd = "sed -e 's|#DEBHELPER#||g'" +
+ " < $(<) > $(@)",
+)
+
+filegroup(
+ name = "debian_prerm",
+ srcs = [
+ "nginx.prerm",
+ ],
+ visibility = [
+ "//visibility:public",
+ ],
+)
+
+genrule(
+ name = "debian_nginx_postrm",
+ srcs = [
+ "debian/nginx.postrm",
+ ],
+ outs = [
+ "nginx.postrm",
+ ],
+ cmd = "sed -e 's|#DEBHELPER#|" +
+ "if [ \"$$1\" = \"purge\" ] ; then\\n" +
+ "\\tupdate-rc.d nginx remove >/dev/null\\n" +
+ "fi\\n" +
+ "\\n" +
+ "if [ -d /run/systemd/system ] ; then\\n" +
+ "\\tsystemctl --system daemon-reload >/dev/null \\|\\| true\\n" +
+ "fi\\n" +
+ "|g'" +
+ " < $(<) > $(@)",
+)
+
+filegroup(
+ name = "debian_postrm",
+ srcs = [
+ "nginx.postrm",
+ ],
+ visibility = [
+ "//visibility:public",
+ ],
+)
+
+genrule(
+ name = "debian_etc_default_nginx",
+ srcs = [
+ "debian/nginx.default",
+ ],
+ outs = [
+ "etc/default/nginx",
+ ],
+ cmd = "cp -p $(<) $(@)",
+)
+
+genrule(
+ name = "debian_etc_init_d_nginx",
+ srcs = [
+ "debian/nginx.init.in",
+ ],
+ outs = [
+ "etc/init.d/nginx",
+ ],
+ cmd = "sed -e 's|%%PROVIDES%%|nginx|g'" +
+ " -e 's|%%DEFAULTSTART%%|2 3 4 5|g'" +
+ " -e 's|%%DEFAULTSTOP%%|0 1 6|g'" +
+ " < $(<) > $(@)",
+)
+
+genrule(
+ name = "debian_etc_logrotate_d_nginx",
+ srcs = [
+ "debian/nginx.logrotate",
+ ],
+ outs = [
+ "etc/logrotate.d/nginx",
+ ],
+ cmd = "cp -p $(<) $(@)",
+)
+
+genrule(
+ name = "debian_etc_nginx_conf_d_default_conf",
+ srcs = [
+ "debian/nginx.vh.default.conf",
+ ],
+ outs = [
+ "etc/nginx/conf.d/default.conf",
+ ],
+ cmd = "cp -p $(<) $(@)",
+)
+
+genrule(
+ name = "debian_etc_nginx_nginx_conf",
+ srcs = [
+ "debian/nginx.conf",
+ ],
+ outs = [
+ "etc/nginx/nginx.conf",
+ ],
+ cmd = "cp -p $(<) $(@)",
+)
+
+genrule(
+ name = "debian_usr_share_man_man8_nginx_8",
+ srcs = [
+ "@nginx//:docs/man/nginx.8",
+ ],
+ outs = [
+ "usr/share/man/man8/nginx.8",
+ ],
+ cmd = "sed -e 's|%%PREFIX%%|/etc/nginx|g'" +
+ " -e 's|%%CONF_PATH%%|/etc/nginx/nginx.conf|g'" +
+ " -e 's|%%ERROR_LOG_PATH%%|/var/log/nginx/error.log|g'" +
+ " -e 's|%%PID_PATH%%|/var/run/nginx.pid|g'" +
+ " < $(<) > $(@)",
+)
+
+genrule(
+ name = "debian_var_cache_nginx",
+ outs = [
+ "var/cache/nginx/.empty",
+ ],
+ cmd = "touch $(@)",
+)
+
+genrule(
+ name = "debian_var_log_nginx",
+ outs = [
+ "var/log/nginx/.empty",
+ ],
+ cmd = "touch $(@)",
+)
+
+pkg_tar(
+ name = "debian_etc_nginx",
+ srcs = [
+ "@nginx//:config_includes",
+ ],
+ mode = "0644",
+ package_dir = "/etc/nginx",
+)
+
+pkg_tar(
+ name = "debian_usr_share_nginx_html",
+ srcs = [
+ "@nginx//:html_files",
+ ],
+ mode = "0644",
+ package_dir = "/usr/share/nginx/html",
+)
+
+pkg_tar(
+ name = "debian_var",
+ srcs = [
+ "var/cache/nginx/.empty",
+ "var/log/nginx/.empty",
+ ],
+ mode = "0644",
+ strip_prefix = ".",
+)
+
+pkg_tar(
+ name = "debian_overlay",
+ srcs = [
+ "etc/default/nginx",
+ "etc/init.d/nginx",
+ "etc/logrotate.d/nginx",
+ "etc/nginx/conf.d/default.conf",
+ "etc/nginx/nginx.conf",
+ "usr/share/man/man8/nginx.8",
+ ],
+ mode = "0644",
+ modes = {
+ "etc/init.d/nginx": "0755",
+ },
+ strip_prefix = ".",
+ visibility = [
+ "//visibility:public",
+ ],
+ deps = [
+ ":debian_etc_nginx",
+ ":debian_usr_share_nginx_html",
+ ":debian_var",
+ ],
+)
diff --git a/bazel/external/ngx_brotli.BUILD b/bazel/external/ngx_brotli.BUILD
new file mode 100755
index 0000000..ee6a4ac
--- /dev/null
+++ b/bazel/external/ngx_brotli.BUILD
@@ -0,0 +1,80 @@
+# Copyright (C) 2015-2021 Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load("@nginx//bazel:nginx.bzl", "nginx_copts")
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+
+licenses(["notice"]) # BSD license
+
+exports_files(["LICENSE"])
+
+cc_library(
+ name = "http_brotli_filter",
+ srcs = [
+ "src/ngx_http_brotli_filter_module.c",
+ ],
+ copts = nginx_copts,
+ defines = [
+ "NGX_HTTP_BROTLI_FILTER",
+ ],
+ visibility = [
+ "//visibility:public",
+ ],
+ deps = [
+ "@nginx//:core",
+ "@nginx//:http",
+ "@org_brotli//:brotlienc",
+ ],
+)
+
+cc_library(
+ name = "http_brotli_static",
+ srcs = [
+ "src/ngx_http_brotli_static_module.c",
+ ],
+ copts = nginx_copts,
+ defines = [
+ "NGX_HTTP_BROTLI_STATIC",
+ ],
+ visibility = [
+ "//visibility:public",
+ ],
+ deps = [
+ "@nginx//:core",
+ "@nginx//:http",
+ ],
+)
+
+cc_binary(
+ name = "nginx",
+ srcs = [
+ "@nginx//:modules",
+ ],
+ copts = nginx_copts,
+ deps = [
+ ":http_brotli_filter",
+ ":http_brotli_static",
+ "@nginx//:core",
+ ],
+)
diff --git a/bazel/external/pcre.BUILD b/bazel/external/pcre.BUILD
new file mode 100755
index 0000000..041cd5c
--- /dev/null
+++ b/bazel/external/pcre.BUILD
@@ -0,0 +1,131 @@
+# Copyright (C) 2015-2021 Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+licenses(["notice"])
+
+exports_files(["LICENCE"])
+
+genrule(
+ name = "config_h",
+ srcs = [
+ "config.h.generic",
+ ],
+ outs = [
+ "config.h",
+ ],
+ cmd = "cp -p $(<) $(@)",
+)
+
+genrule(
+ name = "pcre_h",
+ srcs = [
+ "pcre.h.generic",
+ ],
+ outs = [
+ "pcre.h",
+ ],
+ cmd = "cp -p $(<) $(@)",
+)
+
+genrule(
+ name = "pcre_chartables_c",
+ srcs = [
+ "pcre_chartables.c.dist",
+ ],
+ outs = [
+ "pcre_chartables.c",
+ ],
+ cmd = "cp -p $(<) $(@)",
+)
+
+cc_library(
+ name = "sljit",
+ srcs = [
+ "sljit/sljitConfig.h",
+ "sljit/sljitConfigInternal.h",
+ "sljit/sljitLir.h",
+ ],
+ hdrs = [
+ "sljit/sljitExecAllocator.c",
+ "sljit/sljitLir.c",
+ "sljit/sljitNativeX86_64.c",
+ "sljit/sljitNativeX86_common.c",
+ "sljit/sljitUtils.c",
+ ],
+)
+
+cc_library(
+ name = "pcre",
+ srcs = [
+ "config.h",
+ "pcre_byte_order.c",
+ "pcre_chartables.c",
+ "pcre_compile.c",
+ "pcre_config.c",
+ "pcre_dfa_exec.c",
+ "pcre_exec.c",
+ "pcre_fullinfo.c",
+ "pcre_get.c",
+ "pcre_globals.c",
+ "pcre_internal.h",
+ "pcre_jit_compile.c",
+ "pcre_maketables.c",
+ "pcre_newline.c",
+ "pcre_ord2utf8.c",
+ "pcre_refcount.c",
+ "pcre_study.c",
+ "pcre_tables.c",
+ "pcre_ucd.c",
+ "pcre_valid_utf8.c",
+ "pcre_version.c",
+ "pcre_xclass.c",
+ "ucp.h",
+ ],
+ hdrs = [
+ "pcre.h",
+ ],
+ copts = [
+ "-DHAVE_CONFIG_H",
+ "-DHAVE_MEMMOVE",
+ "-DHAVE_STDINT_H",
+ "-DNO_RECURSE",
+ "-DSUPPORT_JIT",
+ "-DSUPPORT_PCRE8",
+ "-DSUPPORT_UCP",
+ "-DSUPPORT_UTF",
+ "-Wno-maybe-uninitialized",
+ "-Wno-unknown-warning-option",
+ ],
+ includes = [
+ ".",
+ ],
+ visibility = [
+ "//visibility:public",
+ ],
+ deps = [
+ ":sljit",
+ ],
+)
diff --git a/bazel/external/zlib.BUILD b/bazel/external/zlib.BUILD
new file mode 100755
index 0000000..0c108e0
--- /dev/null
+++ b/bazel/external/zlib.BUILD
@@ -0,0 +1,62 @@
+# Copyright (C) 2015-2021 Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+licenses(["notice"])
+
+exports_files(["README"])
+
+cc_library(
+ name = "zlib",
+ srcs = [
+ "adler32.c",
+ "crc32.c",
+ "crc32.h",
+ "deflate.c",
+ "deflate.h",
+ "infback.c",
+ "inffast.c",
+ "inffast.h",
+ "inffixed.h",
+ "inflate.c",
+ "inflate.h",
+ "inftrees.c",
+ "inftrees.h",
+ "trees.c",
+ "trees.h",
+ "zconf.h",
+ "zutil.c",
+ "zutil.h",
+ ],
+ hdrs = [
+ "zlib.h",
+ ],
+ defines = [
+ "Z_SOLO",
+ ],
+ visibility = [
+ "//visibility:public",
+ ],
+)
diff --git a/bazel/nginx.bzl b/bazel/nginx.bzl
new file mode 100644
index 0000000..3105f77
--- /dev/null
+++ b/bazel/nginx.bzl
@@ -0,0 +1,47 @@
+# Copyright (C) 2015-2021 Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+_common_copts = [
+ "-fno-common",
+ "-fvisibility=hidden",
+ "-Wall",
+ "-Werror",
+ "-Wextra",
+ "-Wformat=2",
+ "-Wlong-long",
+ "-Wpointer-arith",
+ "-Wshadow",
+ "-Wno-deprecated-declarations",
+ "-Wno-unused-parameter",
+]
+
+nginx_copts = _common_copts + [
+ "-Wmissing-prototypes",
+ "-Wold-style-definition",
+ "-Wstrict-prototypes",
+]
+
+nginx_cxxopts = _common_copts + [
+ "-Wmissing-declarations",
+]
diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl
new file mode 100644
index 0000000..24b0f0d
--- /dev/null
+++ b/bazel/repositories.bzl
@@ -0,0 +1,88 @@
+# Copyright (C) 2015-2021 Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+load(
+ "@bazel_tools//tools/build_defs/repo:git.bzl",
+ "git_repository",
+ "new_git_repository",
+)
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+def nginx_repositories():
+ # packaging
+ new_git_repository(
+ name = "nginx_pkgoss",
+ build_file = "@nginx//bazel/external:nginx_pkgoss.BUILD",
+ commit = "319a336633b034c798b26e23a15fda1b54545fc9", # nginx-1.19.9
+ remote = "https://nginx.googlesource.com/nginx-pkgoss",
+ shallow_since = "1617121567 +0300",
+ )
+
+ http_archive(
+ name = "rules_pkg",
+ sha256 = "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d",
+ url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz",
+ )
+
+ # BoringSSL
+ git_repository(
+ name = "boringssl",
+ commit = "55b3946d1d961e76ec0a21b37c20457efd273af6", # 2021-03-02
+ remote = "https://boringssl.googlesource.com/boringssl",
+ shallow_since = "1614643264 +0000",
+ )
+
+ # PCRE
+ http_archive(
+ name = "pcre",
+ build_file = "@nginx//bazel/external:pcre.BUILD",
+ sha256 = "aecafd4af3bd0f3935721af77b889d9024b2e01d96b58471bd91a3063fb47728",
+ strip_prefix = "pcre-8.44",
+ url = "https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz",
+ )
+
+ # zlib
+ http_archive(
+ name = "zlib",
+ build_file = "@nginx//bazel/external:zlib.BUILD",
+ sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
+ strip_prefix = "zlib-1.2.11",
+ url = "https://zlib.net/zlib-1.2.11.tar.gz",
+ )
+
+ # ngx_brotli + dependencies
+ new_git_repository(
+ name = "ngx_brotli",
+ build_file = "@nginx//bazel/external:ngx_brotli.BUILD",
+ commit = "5ead1ada782b18c7b38a3c2798a40a334801c7b6", # 2016-12-05
+ remote = "https://nginx.googlesource.com/ngx_brotli",
+ shallow_since = "1480976257 +0000",
+ )
+
+ git_repository(
+ name = "org_brotli",
+ commit = "222564a95d9ab58865a096b8d9f7324ea5f2e03e", # 2016-12-02
+ remote = "https://github.com/google/brotli.git",
+ shallow_since = "1480681940 +0100",
+ )
diff --git a/build.bzl b/build.bzl
deleted file mode 100644
index 1131579..0000000
--- a/build.bzl
+++ /dev/null
@@ -1,708 +0,0 @@
-# Copyright (C) 2015-2021 Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-load(
- "@bazel_tools//tools/build_defs/repo:git.bzl",
- "git_repository",
- "new_git_repository",
-)
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-_common_copts = [
- "-fno-common",
- "-fvisibility=hidden",
- "-Wall",
- "-Werror",
- "-Wextra",
- "-Wformat=2",
- "-Wlong-long",
- "-Wpointer-arith",
- "-Wshadow",
- "-Wno-deprecated-declarations",
- "-Wno-unused-parameter",
-]
-
-nginx_copts = _common_copts + [
- "-Wmissing-prototypes",
- "-Wold-style-definition",
- "-Wstrict-prototypes",
-]
-
-nginx_cxxopts = _common_copts + [
- "-Wmissing-declarations",
-]
-
-_NGX_BROTLI_BUILD_FILE = """
-# Copyright (C) 2015-2021 Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-licenses(["notice"]) # BSD license
-
-exports_files(["LICENSE"])
-
-load("{nginx}:build.bzl", "nginx_copts")
-
-cc_library(
- name = "http_brotli_filter",
- srcs = [
- "src/ngx_http_brotli_filter_module.c",
- ],
- copts = nginx_copts,
- defines = [
- "NGX_HTTP_BROTLI_FILTER",
- ],
- visibility = [
- "//visibility:public",
- ],
- deps = [
- "//external:brotli_enc",
- "{nginx}:core",
- "{nginx}:http",
- ],
-)
-
-cc_library(
- name = "http_brotli_static",
- srcs = [
- "src/ngx_http_brotli_static_module.c",
- ],
- copts = nginx_copts,
- defines = [
- "NGX_HTTP_BROTLI_STATIC",
- ],
- visibility = [
- "//visibility:public",
- ],
- deps = [
- "{nginx}:core",
- "{nginx}:http",
- ],
-)
-
-cc_binary(
- name = "nginx",
- srcs = [
- "{nginx}:modules",
- ],
- copts = nginx_copts,
- deps = [
- ":http_brotli_filter",
- ":http_brotli_static",
- "{nginx}:core",
- ],
-)
-"""
-
-_PCRE_BUILD_FILE = """
-# Copyright (C) 2015-2021 Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-licenses(["notice"])
-
-exports_files(["LICENCE"])
-
-genrule(
- name = "config_h",
- srcs = [
- "config.h.generic",
- ],
- outs = [
- "config.h",
- ],
- cmd = "cp -p $(<) $(@)",
-)
-
-genrule(
- name = "pcre_h",
- srcs = [
- "pcre.h.generic",
- ],
- outs = [
- "pcre.h",
- ],
- cmd = "cp -p $(<) $(@)",
-)
-
-genrule(
- name = "pcre_chartables_c",
- srcs = [
- "pcre_chartables.c.dist",
- ],
- outs = [
- "pcre_chartables.c",
- ],
- cmd = "cp -p $(<) $(@)",
-)
-
-cc_library(
- name = "sljit",
- srcs = [
- "sljit/sljitConfig.h",
- "sljit/sljitConfigInternal.h",
- "sljit/sljitLir.h",
- ],
- hdrs = [
- "sljit/sljitExecAllocator.c",
- "sljit/sljitLir.c",
- "sljit/sljitNativeX86_64.c",
- "sljit/sljitNativeX86_common.c",
- "sljit/sljitUtils.c",
- ],
-)
-
-cc_library(
- name = "pcre",
- srcs = [
- "config.h",
- "pcre_byte_order.c",
- "pcre_chartables.c",
- "pcre_compile.c",
- "pcre_config.c",
- "pcre_dfa_exec.c",
- "pcre_exec.c",
- "pcre_fullinfo.c",
- "pcre_get.c",
- "pcre_globals.c",
- "pcre_internal.h",
- "pcre_jit_compile.c",
- "pcre_maketables.c",
- "pcre_newline.c",
- "pcre_ord2utf8.c",
- "pcre_refcount.c",
- "pcre_study.c",
- "pcre_tables.c",
- "pcre_ucd.c",
- "pcre_valid_utf8.c",
- "pcre_version.c",
- "pcre_xclass.c",
- "ucp.h",
- ],
- hdrs = [
- "pcre.h",
- ],
- copts = [
- "-DHAVE_CONFIG_H",
- "-DHAVE_MEMMOVE",
- "-DHAVE_STDINT_H",
- "-DNO_RECURSE",
- "-DSUPPORT_JIT",
- "-DSUPPORT_PCRE8",
- "-DSUPPORT_UCP",
- "-DSUPPORT_UTF",
- "-Wno-maybe-uninitialized",
- "-Wno-unknown-warning-option",
- ],
- includes = [
- ".",
- ],
- visibility = [
- "//visibility:public",
- ],
- deps = [
- ":sljit",
- ],
-)
-"""
-
-_PKGOSS_BUILD_FILE = """
-# Copyright (C) 2015-2021 Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-licenses(["notice"])
-
-exports_files(["README"])
-
-load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
-
-genrule(
- name = "debian_nginx_preinst",
- srcs = [
- "debian/nginx.preinst",
- ],
- outs = [
- "nginx.preinst",
- ],
- cmd = "sed -e 's|#DEBHELPER#||g'" +
- " < $(<) > $(@)",
-)
-
-filegroup(
- name = "debian_preinst",
- srcs = [
- "nginx.preinst",
- ],
- visibility = [
- "//visibility:public",
- ],
-)
-
-genrule(
- name = "debian_nginx_postinst",
- srcs = [
- "debian/nginx.postinst",
- ],
- outs = [
- "nginx.postinst",
- ],
- cmd = "sed -e 's|#DEBHELPER#|" +
- "if [ -x \\"/etc/init.d/nginx\\" ]; then\\\\n" +
- "\\\\tupdate-rc.d nginx defaults >/dev/null \\\\|\\\\| exit $$?\\\\n" +
- "fi\\\\n" +
- "|g'" +
- " < $(<) > $(@)",
-)
-
-filegroup(
- name = "debian_postinst",
- srcs = [
- "nginx.postinst",
- ],
- visibility = [
- "//visibility:public",
- ],
-)
-
-genrule(
- name = "debian_nginx_prerm",
- srcs = [
- "debian/nginx.prerm",
- ],
- outs = [
- "nginx.prerm",
- ],
- cmd = "sed -e 's|#DEBHELPER#||g'" +
- " < $(<) > $(@)",
-)
-
-filegroup(
- name = "debian_prerm",
- srcs = [
- "nginx.prerm",
- ],
- visibility = [
- "//visibility:public",
- ],
-)
-
-genrule(
- name = "debian_nginx_postrm",
- srcs = [
- "debian/nginx.postrm",
- ],
- outs = [
- "nginx.postrm",
- ],
- cmd = "sed -e 's|#DEBHELPER#|" +
- "if [ \\"$$1\\" = \\"purge\\" ] ; then\\\\n" +
- "\\\\tupdate-rc.d nginx remove >/dev/null\\\\n" +
- "fi\\\\n" +
- "\\\\n" +
- "if [ -d /run/systemd/system ] ; then\\\\n" +
- "\\\\tsystemctl --system daemon-reload >/dev/null \\\\|\\\\| true\\\\n" +
- "fi\\\\n" +
- "|g'" +
- " < $(<) > $(@)",
-)
-
-filegroup(
- name = "debian_postrm",
- srcs = [
- "nginx.postrm",
- ],
- visibility = [
- "//visibility:public",
- ],
-)
-
-genrule(
- name = "debian_etc_default_nginx",
- srcs = [
- "debian/nginx.default",
- ],
- outs = [
- "etc/default/nginx",
- ],
- cmd = "cp -p $(<) $(@)",
-)
-
-genrule(
- name = "debian_etc_init_d_nginx",
- srcs = [
- "debian/nginx.init.in",
- ],
- outs = [
- "etc/init.d/nginx",
- ],
- cmd = "sed -e 's|%%PROVIDES%%|nginx|g'" +
- " -e 's|%%DEFAULTSTART%%|2 3 4 5|g'" +
- " -e 's|%%DEFAULTSTOP%%|0 1 6|g'" +
- " < $(<) > $(@)",
-)
-
-genrule(
- name = "debian_etc_logrotate_d_nginx",
- srcs = [
- "debian/nginx.logrotate",
- ],
- outs = [
- "etc/logrotate.d/nginx",
- ],
- cmd = "cp -p $(<) $(@)",
-)
-
-genrule(
- name = "debian_etc_nginx_conf_d_default_conf",
- srcs = [
- "debian/nginx.vh.default.conf",
- ],
- outs = [
- "etc/nginx/conf.d/default.conf",
- ],
- cmd = "cp -p $(<) $(@)",
-)
-
-genrule(
- name = "debian_etc_nginx_nginx_conf",
- srcs = [
- "debian/nginx.conf",
- ],
- outs = [
- "etc/nginx/nginx.conf",
- ],
- cmd = "cp -p $(<) $(@)",
-)
-
-genrule(
- name = "debian_usr_share_man_man8_nginx_8",
- srcs = [
- "{nginx}:docs/man/nginx.8",
- ],
- outs = [
- "usr/share/man/man8/nginx.8",
- ],
- cmd = "sed -e 's|%%PREFIX%%|/etc/nginx|g'" +
- " -e 's|%%CONF_PATH%%|/etc/nginx/nginx.conf|g'" +
- " -e 's|%%ERROR_LOG_PATH%%|/var/log/nginx/error.log|g'" +
- " -e 's|%%PID_PATH%%|/var/run/nginx.pid|g'" +
- " < $(<) > $(@)",
-)
-
-genrule(
- name = "debian_var_cache_nginx",
- outs = [
- "var/cache/nginx/.empty",
- ],
- cmd = "touch $(@)",
-)
-
-genrule(
- name = "debian_var_log_nginx",
- outs = [
- "var/log/nginx/.empty",
- ],
- cmd = "touch $(@)",
-)
-
-pkg_tar(
- name = "debian_etc_nginx",
- srcs = [
- "{nginx}:config_includes",
- ],
- mode = "0644",
- package_dir = "/etc/nginx",
-)
-
-pkg_tar(
- name = "debian_usr_share_nginx_html",
- srcs = [
- "{nginx}:html_files",
- ],
- mode = "0644",
- package_dir = "/usr/share/nginx/html",
-)
-
-pkg_tar(
- name = "debian_var",
- srcs = [
- "var/cache/nginx/.empty",
- "var/log/nginx/.empty",
- ],
- mode = "0644",
- strip_prefix = ".",
-)
-"""
-
-_PKGOSS_BUILD_FILE_TAIL = """
-pkg_tar(
- name = "debian_overlay",
- srcs = [
- "etc/default/nginx",
- "etc/init.d/nginx",
- "etc/logrotate.d/nginx",
- "etc/nginx/conf.d/default.conf",
- "etc/nginx/nginx.conf",
- "usr/share/man/man8/nginx.8",
- ],
- mode = "0644",
- modes = {
- "etc/init.d/nginx": "0755",
- },
- strip_prefix = ".",
- visibility = [
- "//visibility:public",
- ],
- deps = [
- ":debian_etc_nginx",
- ":debian_usr_share_nginx_html",
- ":debian_var",
- ],
-)
-"""
-
-_ZLIB_BUILD_FILE = """
-# Copyright (C) 2015-2021 Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-licenses(["notice"])
-
-exports_files(["README"])
-
-cc_library(
- name = "zlib",
- srcs = [
- "adler32.c",
- "crc32.c",
- "crc32.h",
- "deflate.c",
- "deflate.h",
- "infback.c",
- "inffast.c",
- "inffast.h",
- "inffixed.h",
- "inflate.c",
- "inflate.h",
- "inftrees.c",
- "inftrees.h",
- "trees.c",
- "trees.h",
- "zconf.h",
- "zutil.c",
- "zutil.h",
- ],
- hdrs = [
- "zlib.h",
- ],
- defines = [
- "Z_SOLO",
- ],
- visibility = [
- "//visibility:public",
- ],
-)
-"""
-
-def nginx_repositories_boringssl(bind):
- git_repository(
- name = "boringssl",
- commit = "55b3946d1d961e76ec0a21b37c20457efd273af6", # 2021-03-02
- remote = "https://boringssl.googlesource.com/boringssl",
- shallow_since = "1614643264 +0000",
- )
-
- if bind:
- native.bind(
- name = "boringssl_crypto",
- actual = "@boringssl//:crypto",
- )
-
- native.bind(
- name = "boringssl_ssl",
- actual = "@boringssl//:ssl",
- )
-
-def nginx_repositories_brotli(bind):
- git_repository(
- name = "org_brotli",
- commit = "222564a95d9ab58865a096b8d9f7324ea5f2e03e", # 2016-12-02
- remote = "https://github.com/google/brotli.git",
- shallow_since = "1480681940 +0100",
- )
-
- if bind:
- native.bind(
- name = "brotli_enc",
- actual = "@org_brotli//:brotlienc",
- )
-
- native.bind(
- name = "brotli_dec",
- actual = "@org_brotli//:brotlidec",
- )
-
-def nginx_repositories_ngx_brotli(nginx):
- new_git_repository(
- name = "ngx_brotli",
- build_file_content = _NGX_BROTLI_BUILD_FILE.format(nginx = nginx),
- commit = "5ead1ada782b18c7b38a3c2798a40a334801c7b6", # 2016-12-05
- remote = "https://nginx.googlesource.com/ngx_brotli",
- shallow_since = "1480976257 +0000",
- )
-
-def nginx_repositories_pcre(bind):
- http_archive(
- name = "nginx_pcre",
- build_file_content = _PCRE_BUILD_FILE,
- sha256 = "aecafd4af3bd0f3935721af77b889d9024b2e01d96b58471bd91a3063fb47728",
- strip_prefix = "pcre-8.44",
- url = "https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz",
- )
-
- if bind:
- native.bind(
- name = "pcre",
- actual = "@nginx_pcre//:pcre",
- )
-
-def nginx_repositories_pkgoss(nginx):
- new_git_repository(
- name = "nginx_pkgoss",
- build_file_content = _PKGOSS_BUILD_FILE.format(nginx = nginx) +
- _PKGOSS_BUILD_FILE_TAIL,
- commit = "319a336633b034c798b26e23a15fda1b54545fc9", # nginx-1.19.9
- remote = "https://nginx.googlesource.com/nginx-pkgoss",
- shallow_since = "1617121567 +0300",
- )
-
-def nginx_repositories_zlib(bind):
- http_archive(
- name = "nginx_zlib",
- build_file_content = _ZLIB_BUILD_FILE,
- sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
- strip_prefix = "zlib-1.2.11",
- url = "https://zlib.net/zlib-1.2.11.tar.gz",
- )
-
- if bind:
- native.bind(
- name = "zlib",
- actual = "@nginx_zlib//:zlib",
- )
-
-def nginx_repositories(bind = False, nginx = "@nginx//", ngx_brotli = False):
- # core dependencies
- nginx_repositories_boringssl(bind)
- nginx_repositories_pcre(bind)
- nginx_repositories_zlib(bind)
-
- # packaging
- nginx_repositories_pkgoss(nginx)
-
- # ngx_brotli + dependencies
- if ngx_brotli:
- nginx_repositories_ngx_brotli(nginx)
- nginx_repositories_brotli(bind)
diff --git a/src/ngx_modules.c b/src/ngx_modules.c
index 2f1a4db..1fb3f35 100644
--- a/src/ngx_modules.c
+++ b/src/ngx_modules.c
@@ -1183,21 +1183,21 @@
#endif
#if (NGX_SSL)
- ngx_write_stderr(" --with-openssl=//external:boringssl");
+ ngx_write_stderr(" --with-openssl=@boringssl");
#endif
#if (NGX_PCRE)
- ngx_write_stderr(" --with-pcre=//external:pcre");
+ ngx_write_stderr(" --with-pcre=@pcre");
ngx_write_stderr(" --with-pcre-jit");
#endif
#if (NGX_ZLIB)
- ngx_write_stderr(" --with-zlib=//external:zlib");
+ ngx_write_stderr(" --with-zlib=@zlib");
#endif
#if (NGX_HTTP_BROTLI_FILTER)
- ngx_write_stderr(" --add-module=//ngx_brotli:http_brotli_filter");
+ ngx_write_stderr(" --add-module=@ngx_brotli//:http_brotli_filter");
#endif
#if (NGX_HTTP_BROTLI_STATIC)
- ngx_write_stderr(" --add-module=//ngx_brotli:http_brotli_static");
+ ngx_write_stderr(" --add-module=@ngx_brotli//:http_brotli_static");
#endif
ngx_write_stderr(NGX_LINEFEED);