From 8223a81f41280f6fe2bd61946dbfd8533aceb3c1 Mon Sep 17 00:00:00 2001
From: Philipp Stephani
Date: Wed, 22 Jan 2025 20:30:36 +0100
Subject: [PATCH 1/2] Run Makeinfo through sh_binary wrapper script.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On all systems including Windows with MSYS2, makeinfo is an interpreted script.
Trying to run it directly won’t work on Windows, so we need to go through some
shell that interprets shebang lines.
---
docs/BUILD | 12 +++++++++---
docs/makeinfo.sh | 17 +++++++++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
create mode 100755 docs/makeinfo.sh
diff --git a/docs/BUILD b/docs/BUILD
index ea0dcace..1502da91 100644
--- a/docs/BUILD
+++ b/docs/BUILD
@@ -15,6 +15,7 @@
load("@pip//:requirements.bzl", "requirement")
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
load("@rules_python//python:py_binary.bzl", "py_binary")
+load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("//elisp:defs.bzl", "elisp_binary", "elisp_manual")
load("//private:defs.bzl", "PACKAGE_FEATURES", "merged_manual")
@@ -32,13 +33,18 @@ elisp_manual(
out = "manual.texi",
)
-# This rule assumes that Texinfo is installed locally.
genrule(
name = "info",
srcs = ["manual.texi"],
outs = ["rules_elisp.info"],
- cmd = "$(execpath @local_texinfo//:makeinfo) --no-split --output=$@ -- $<",
- tools = ["@local_texinfo//:makeinfo"],
+ cmd = "$(execpath :makeinfo) --no-split --output=$@ -- $<",
+ tools = [":makeinfo"],
+)
+
+# This rule assumes that Texinfo is installed locally.
+sh_binary(
+ name = "makeinfo",
+ srcs = ["makeinfo.sh"],
)
DOCS = [
diff --git a/docs/makeinfo.sh b/docs/makeinfo.sh
new file mode 100755
index 00000000..f709b016
--- /dev/null
+++ b/docs/makeinfo.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Copyright 2025 Philipp Stephani
+#
+# 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.
+
+makeinfo "$@"
From 5594e758ffae6dc6db0b3d0792f31972d6a01cc3 Mon Sep 17 00:00:00 2001
From: Philipp Stephani
Date: Wed, 22 Jan 2025 20:10:23 +0100
Subject: [PATCH 2/2] Use run_binary instead of genrule
---
docs/BUILD | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/docs/BUILD b/docs/BUILD
index 1502da91..ae36bb3a 100644
--- a/docs/BUILD
+++ b/docs/BUILD
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+load("@bazel_skylib//rules:run_binary.bzl", "run_binary")
load("@pip//:requirements.bzl", "requirement")
load("@protobuf//bazel:py_proto_library.bzl", "py_proto_library")
load("@rules_python//python:py_binary.bzl", "py_binary")
@@ -33,12 +34,17 @@ elisp_manual(
out = "manual.texi",
)
-genrule(
+run_binary(
name = "info",
srcs = ["manual.texi"],
outs = ["rules_elisp.info"],
- cmd = "$(execpath :makeinfo) --no-split --output=$@ -- $<",
- tools = [":makeinfo"],
+ args = [
+ "--no-split",
+ "--output=$(execpath rules_elisp.info)",
+ "--",
+ "$(execpath manual.texi)",
+ ],
+ tool = ":makeinfo",
)
# This rule assumes that Texinfo is installed locally.