Skip to content

Commit 9f6b237

Browse files
committed
[check] make scripts detect presence of GNU sed and use it (to make it work on macOS) + update readme for macOS
1 parent 3dc04f5 commit 9f6b237

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

README.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,26 @@ Get involved:
1313
- `How to tell if an issue is editorial <https://github.com/cplusplus/draft/wiki/How-to-tell-if-an-issue-is-editorial>`_
1414
- `How to submit a new issue/defect report <https://isocpp.org/std/submit-issue>`_ for non-editorial issues
1515

16-
More information about the C++ standard can be found at `isocpp.org <http://isocpp.org/std>`_.
16+
More information about the C++ standard can be found at `isocpp.org <https://isocpp.org/std>`_.
1717

18-
---------------------------
19-
Getting Started on Mac OS X
20-
---------------------------
18+
------------------------
19+
Getting Started on macOS
20+
------------------------
2121

22-
Install the `MacTeX distribution <http://tug.org/mactex/>`_.
22+
Install the `MacTeX distribution <https://tug.org/mactex/>`_.
2323

24-
If you are on a slow network, you'll want to get the `BasicTeX package <http://tug.org/mactex/morepackages.html>`_ instead,
24+
If you are on a slow network, you'll want to get the `BasicTeX package <https://tug.org/mactex/morepackages.html>`_ instead,
2525
then run the following command to install the other packages that the draft requires::
2626

2727
sudo tlmgr install latexmk isodate substr relsize ulem fixme rsfs extract layouts enumitem l3packages l3kernel imakeidx splitindex xstring
2828

29+
Using homebrew on macOS
30+
=======================
31+
32+
Instead of downloading packages from internet, you can use `HomeBrew package manager <https://brew.sh>` to install all is needed to build the draft and run checks on it:
33+
34+
brew install mactex gnu-sed
35+
2936
---------------------------------------
3037
Getting Started on Debian-based Systems
3138
---------------------------------------

tools/check-output.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ function fail() {
1111
! sed 's/^\(.\+\.tex\):/file=\1::/;s/^/::error /' | grep .
1212
}
1313

14+
# If we detect GNU sed (on macOS installed with brew) then we will use it.
15+
# Otherwise the script can fail on macOS which ships with BSD sed.
16+
if command -v gsed >/dev/null 2>&1; then
17+
GSED=$(exec command -v gsed)
18+
sed() {
19+
${GSED} "$@"
20+
}
21+
fi
1422

1523
# Discover "Overfull \[hv]box" and "Reference ... undefined" messages from LaTeX.
1624
sed -n '/\.tex/{s/^.*\/\([-a-z0-9]\+\.tex\).*$/\1/;h};

tools/check-source.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ function fail() {
2121
grep .
2222
}
2323

24+
# If we detect GNU sed (on macOS installed with brew) then we will use it.
25+
# Otherwise the script can fail on macOS which ships with BSD sed.
26+
if command -v gsed >/dev/null 2>&1; then
27+
GSED=$(exec command -v gsed)
28+
sed() {
29+
${GSED} "$@"
30+
}
31+
fi
2432

2533
# We require GNU tools.
2634
sed --version | grep -Fqe "GNU sed" || { echo "sed is not GNU sed"; exit 1; }

0 commit comments

Comments
 (0)