Bazel: move man page generation to nginx-pkgoss's BUILD file.

Change-Id: I14a4bb9db25c47ec6b0df17fee2035c9a2506e54
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Reviewed-on: https://nginx-review.googlesource.com/2581
Reviewed-by: Gurgen Hrachyan <gugo@google.com>
diff --git a/BUILD b/BUILD
index 80e6c2d..0f05f9b 100644
--- a/BUILD
+++ b/BUILD
@@ -77,6 +77,13 @@
     ],
 )
 
+filegroup(
+    name = "man_sources",
+    srcs = [
+        "docs/man/nginx.8",
+    ],
+)
+
 genrule(
     name = "configure",
     srcs = [
@@ -158,21 +165,6 @@
     ],
 )
 
-genrule(
-    name = "nginx_8",
-    srcs = [
-        "docs/man/nginx.8",
-    ],
-    outs = [
-        "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'" +
-          " < $(<) > $(@)",
-)
-
 cc_library(
     name = "core",
     srcs = [
diff --git a/build.bzl b/build.bzl
index bb52974..ad949e4 100644
--- a/build.bzl
+++ b/build.bzl
@@ -449,6 +449,21 @@
 )
 
 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",
@@ -474,15 +489,6 @@
 )
 
 pkg_tar(
-    name = "debian_usr_share_man_man8",
-    files = [
-        "{nginx}:nginx.8",
-    ],
-    mode = "0644",
-    package_dir = "/usr/share/man/man8",
-)
-
-pkg_tar(
     name = "debian_usr_share_nginx_html",
     files = [
         "{nginx}:html_files",
@@ -511,6 +517,7 @@
         "etc/logrotate.d/nginx",
         "etc/nginx/conf.d/default.conf",
         "etc/nginx/nginx.conf",
+        "usr/share/man/man8/nginx.8",
     ],
     mode = "0644",
     modes = {
@@ -522,7 +529,6 @@
     ],
     deps = [
         ":debian_etc_nginx",
-        ":debian_usr_share_man_man8",
         ":debian_usr_share_nginx_html",
         ":debian_var",
     ],