* [PATCH] secilc: Fix documentation build for OS X systems
@ 2018-02-24 4:57 Yuli Khodorkovskiy
2018-02-26 14:56 ` Stephen Smalley
0 siblings, 1 reply; 2+ messages in thread
From: Yuli Khodorkovskiy @ 2018-02-24 4:57 UTC (permalink / raw)
To: selinux
Since Darwin systems do not have GNU sed installed, the Darwin sed is
missing the "regexp-extended" flag needed to modify the secilc markdown
files before processing with pandoc.
A quick fix for Mac users is to `brew install gnu-sed` and to use gsed.
Signed-off-by: Yuli Khodorkovskiy <ykhodo@gmail.com>
---
secilc/docs/Makefile | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/secilc/docs/Makefile b/secilc/docs/Makefile
index c0fa6b7f..6b07ce7f 100644
--- a/secilc/docs/Makefile
+++ b/secilc/docs/Makefile
@@ -31,6 +31,12 @@ PANDOC_FILE_LIST = $(addprefix $(TMPDIR)/,$(FILE_LIST))
PDF_OUT=CIL_Reference_Guide.pdf
HTML_OUT=CIL_Reference_Guide.html
PANDOC = pandoc
+SED ?= sed
+
+OS := $(shell uname)
+ifeq ($(OS), Darwin)
+ SED := gsed
+endif
all: html pdf
@@ -40,12 +46,12 @@ $(TMPDIR):
$(TMPDIR)/%.md: %.md | $(TMPDIR)
cp -f $< $(TMPDIR)/
@# Substitute markdown links for conversion into PDF links
- sed -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
+ $(SED) -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
$(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
cp -f $< $@
@# add a title for the TOC to policy.cil. This is needed to play nicely with the PDF conversion.
- sed -i '1i Example Policy\n=========\n```' $@
+ $(SED) -i '1i Example Policy\n=========\n```' $@
echo '```' >> $@
html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] secilc: Fix documentation build for OS X systems
2018-02-24 4:57 [PATCH] secilc: Fix documentation build for OS X systems Yuli Khodorkovskiy
@ 2018-02-26 14:56 ` Stephen Smalley
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2018-02-26 14:56 UTC (permalink / raw)
To: Yuli Khodorkovskiy, selinux
On 02/23/2018 11:57 PM, Yuli Khodorkovskiy wrote:
> Since Darwin systems do not have GNU sed installed, the Darwin sed is
> missing the "regexp-extended" flag needed to modify the secilc markdown
> files before processing with pandoc.
>
> A quick fix for Mac users is to `brew install gnu-sed` and to use gsed.
>
> Signed-off-by: Yuli Khodorkovskiy <ykhodo@gmail.com>
Thanks, applied.
> ---
> secilc/docs/Makefile | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/secilc/docs/Makefile b/secilc/docs/Makefile
> index c0fa6b7f..6b07ce7f 100644
> --- a/secilc/docs/Makefile
> +++ b/secilc/docs/Makefile
> @@ -31,6 +31,12 @@ PANDOC_FILE_LIST = $(addprefix $(TMPDIR)/,$(FILE_LIST))
> PDF_OUT=CIL_Reference_Guide.pdf
> HTML_OUT=CIL_Reference_Guide.html
> PANDOC = pandoc
> +SED ?= sed
> +
> +OS := $(shell uname)
> +ifeq ($(OS), Darwin)
> + SED := gsed
> +endif
>
> all: html pdf
>
> @@ -40,12 +46,12 @@ $(TMPDIR):
> $(TMPDIR)/%.md: %.md | $(TMPDIR)
> cp -f $< $(TMPDIR)/
> @# Substitute markdown links for conversion into PDF links
> - sed -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
> + $(SED) -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
>
> $(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
> cp -f $< $@
> @# add a title for the TOC to policy.cil. This is needed to play nicely with the PDF conversion.
> - sed -i '1i Example Policy\n=========\n```' $@
> + $(SED) -i '1i Example Policy\n=========\n```' $@
> echo '```' >> $@
>
> html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-26 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-24 4:57 [PATCH] secilc: Fix documentation build for OS X systems Yuli Khodorkovskiy
2018-02-26 14:56 ` Stephen Smalley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.