From 16a793a252e51530bca1b15ee3a0b470929816b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hana=20Dusi=CC=81kova=CC=81?= Date: Fri, 2 Jan 2026 17:45:08 +0100 Subject: [PATCH] [check] make scripts detect presence of GNU sed and use it (to make it work on macOS) + update readme for macOS --- README.rst | 19 +++++++++++++------ tools/check-output.sh | 8 ++++++++ tools/check-source.sh | 8 ++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index c737a81a71..b89ce85a4b 100644 --- a/README.rst +++ b/README.rst @@ -13,19 +13,26 @@ Get involved: - `How to tell if an issue is editorial `_ - `How to submit a new issue/defect report `_ for non-editorial issues -More information about the C++ standard can be found at `isocpp.org `_. +More information about the C++ standard can be found at `isocpp.org `_. ---------------------------- -Getting Started on Mac OS X ---------------------------- +------------------------ +Getting Started on macOS +------------------------ -Install the `MacTeX distribution `_. +Install the `MacTeX distribution `_. -If you are on a slow network, you'll want to get the `BasicTeX package `_ instead, +If you are on a slow network, you'll want to get the `BasicTeX package `_ instead, then run the following command to install the other packages that the draft requires:: sudo tlmgr install latexmk isodate substr relsize ulem fixme rsfs extract layouts enumitem l3packages l3kernel imakeidx splitindex xstring +Using homebrew on macOS +======================= + +Instead of downloading packages from the internet, you can use the `HomeBrew package manager ` to install all that is needed to build the draft and run checks on it: + + brew install mactex gnu-sed + --------------------------------------- Getting Started on Debian-based Systems --------------------------------------- diff --git a/tools/check-output.sh b/tools/check-output.sh index a28d236e0c..290312f9c4 100755 --- a/tools/check-output.sh +++ b/tools/check-output.sh @@ -11,6 +11,14 @@ function fail() { ! sed 's/^\(.\+\.tex\):/file=\1::/;s/^/::error /' | grep . } +# If we detect GNU sed (on macOS installed with brew) then we will use it. +# Otherwise the script can fail on macOS which ships with BSD sed. +if command -v gsed >/dev/null 2>&1; then + GSED=$(command -v gsed) + sed() { + ${GSED} "$@" + } +fi # Discover "Overfull \[hv]box" and "Reference ... undefined" messages from LaTeX. sed -n '/\.tex/{s/^.*\/\([-a-z0-9]\+\.tex\).*$/\1/;h}; diff --git a/tools/check-source.sh b/tools/check-source.sh index ffd7c94d47..900bf33295 100755 --- a/tools/check-source.sh +++ b/tools/check-source.sh @@ -21,6 +21,14 @@ function fail() { grep . } +# If we detect GNU sed (on macOS installed with brew) then we will use it. +# Otherwise the script can fail on macOS which ships with BSD sed. +if command -v gsed >/dev/null 2>&1; then + GSED=$(command -v gsed) + sed() { + ${GSED} "$@" + } +fi # We require GNU tools. sed --version | grep -Fqe "GNU sed" || { echo "sed is not GNU sed"; exit 1; }