Skip to contentSkip to conversation

secilc: Fix documentation build for OS X systems

PATCH Applied Yuli Khodorkovskiy 2 participants 2 messages Feb 24, 2018 – Feb 26, 2018 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 secilc: Fix documentation build for OS X systems

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.

---
 secilc/docs/Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
secilc/docs/Makefile +8 -2
index c0fa6b7f..6b07ce7f 100644
@@ -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
Signature · 1 line
2.14.3
#1 lore raw
Quoted 7 lines · Yuli Khodorkovskiy

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.

Thanks, applied.

Quoted 37 lines
---
 secilc/docs/Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
secilc/docs/Makefile +8 -2
index c0fa6b7f..6b07ce7f 100644
@@ -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