From 9d6d2b767f08feabaa8cec2c928a6cf6ede21af8 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Thu, 4 Feb 2016 11:53:41 +0200 Subject: [PATCH 1/5] Properly install the man page when using a custom prefix --- src/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 0239b23f..900dfb36 100644 --- a/src/Makefile +++ b/src/Makefile @@ -38,7 +38,7 @@ NCURSESW_INCLUDE ?= /usr/include/ncursesw bindir := $(DESTDIR)$(PREFIX)/bin sharedir := $(DESTDIR)$(PREFIX)/share/kak docdir := $(DESTDIR)$(PREFIX)/share/doc/kak -mandir := $(DESTDIR)$(PREFIX)/man/man1 +mandir := $(DESTDIR)$(PREFIX)/share/man/man1 os := $(shell uname) @@ -112,6 +112,7 @@ install: kak man doc mkdir -p $(sharedir)/colors install -m 0644 ../colors/* $(sharedir)/colors mkdir -p $(docdir)/manpages + mkdir -p $(mandir) install -m 0644 ../README.asciidoc $(docdir) install -m 0644 ../doc/manpages/*.gz $(docdir)/manpages install -m 0644 ../doc/kakoune.1.gz $(mandir) From eb62327a4c52a1c1d000d8a87ed1eb0cf5fd0d18 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Thu, 4 Feb 2016 12:58:59 +0200 Subject: [PATCH 2/5] Rename the man page to `kak` --- doc/{kakoune.1.txt => kak.1.txt} | 0 src/Makefile | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename doc/{kakoune.1.txt => kak.1.txt} (100%) diff --git a/doc/kakoune.1.txt b/doc/kak.1.txt similarity index 100% rename from doc/kakoune.1.txt rename to doc/kak.1.txt diff --git a/src/Makefile b/src/Makefile index 900dfb36..9c23d322 100644 --- a/src/Makefile +++ b/src/Makefile @@ -83,7 +83,7 @@ test: tags: ctags -R -man: ../doc/kakoune.1.gz +man: ../doc/kak.1.gz doc: $(addsuffix .1,$(addprefix ../doc/manpages/,$(docs))) @for f in $^; do \ pagename="$${f##*/}"; pagename="$${pagename%.*}"; \ @@ -115,6 +115,6 @@ install: kak man doc mkdir -p $(mandir) install -m 0644 ../README.asciidoc $(docdir) install -m 0644 ../doc/manpages/*.gz $(docdir)/manpages - install -m 0644 ../doc/kakoune.1.gz $(mandir) + install -m 0644 ../doc/kak.1.gz $(mandir) .PHONY: tags install From 4280831e7abc03b770183b007144913464de827b Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Thu, 4 Feb 2016 14:54:53 +0200 Subject: [PATCH 3/5] Prevent `a2x` from changing the generated man page name to 'kakoune' --- doc/kak.1.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/kak.1.txt b/doc/kak.1.txt index 86f64a0b..e4d56918 100644 --- a/doc/kak.1.txt +++ b/doc/kak.1.txt @@ -1,9 +1,9 @@ -kakoune(1) -========== +kak(1) +====== NAME ---- -kakoune - a vim inspired, selection oriented code editor +kak - a vim inspired, selection oriented code editor SYNOPSIS -------- From 8d0988d5411c14584d3c8a1638ebaa8426e54507 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Thu, 4 Feb 2016 15:10:04 +0200 Subject: [PATCH 4/5] Prevent unconditional generation of the man pages, fix the executable name for `a2x` on Mac OS X --- src/Makefile | 54 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/Makefile b/src/Makefile index 9c23d322..c689d683 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,15 +20,16 @@ endif sources := $(wildcard *.cc) objects := $(addprefix ., $(sources:.cc=$(suffix).o)) deps := $(addprefix ., $(sources:.cc=$(suffix).d)) -docs := commands \ - execeval \ - expansions \ - faces \ - highlighters \ - hooks \ - options \ - registers \ - shortcuts \ +docs := ../doc/manpages/commands \ + ../doc/manpages/execeval \ + ../doc/manpages/expansions \ + ../doc/manpages/faces \ + ../doc/manpages/highlighters \ + ../doc/manpages/hooks \ + ../doc/manpages/options \ + ../doc/manpages/registers \ + ../doc/manpages/shortcuts +mandocs := $(addsuffix .gz,$(docs)) PREFIX ?= /usr/local DESTDIR ?= # root dir @@ -44,6 +45,7 @@ os := $(shell uname) ifeq ($(os),Darwin) LIBS += -lncurses -lboost_regex-mt + A2X ?= a2x.py else ifeq ($(os),FreeBSD) LIBS += -ltinfow -lncursesw -lboost_regex CPPFLAGS += -I/usr/local/include @@ -62,6 +64,10 @@ else LDFLAGS += -rdynamic endif +# The `a2x` tool is used as-is (`a2x.py`) in some distributions, or as a symlink in others (`a2x` → `a2x.py`) +# Picking the right name is done in the system detection switch above +A2X ?= a2x + CXXFLAGS += -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare kak : $(objects) @@ -72,26 +78,30 @@ kak : $(objects) .%$(suffix).o: %.cc $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF $(addprefix ., $(<:.cc=$(suffix).d)) -c -o $@ $< -%.1: % - a2x -f manpage $< -%.1.gz: %.1.txt - a2x -f manpage $< +# Generate the man page +../doc/kak.1.gz: ../doc/kak.1.txt + $(A2X) -f manpage $< gzip -f $(basename $<) +# Generate the editor's documentation pages +# Since `a2x` won't generate man pages if some sections are missing (which we don't need), +# we generate the pages, patch them and then compress them +$(mandocs): $(docs) + @for f in $^; do \ + pagename="$${f##*/}"; pagename="$${pagename%.*}"; \ + $(A2X) -f manpage "$$f"; \ + sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$${pagename^^}\"," \ + -e "/^\.SH \"NAME\"/,+1d" "$${f}.1"; \ + gzip -f "$${f}.1"; \ + mv "$${f}.1.gz" "$${f/.1/}.gz"; \ + done + test: cd ../test && ./run tags: ctags -R - man: ../doc/kak.1.gz -doc: $(addsuffix .1,$(addprefix ../doc/manpages/,$(docs))) - @for f in $^; do \ - pagename="$${f##*/}"; pagename="$${pagename%.*}"; \ - sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$${pagename^^}\"," \ - -e "/^\.SH \"NAME\"/,+1d" $$f; \ - gzip -f "$$f"; \ - mv "$${f}.gz" "$${f/.1/}.gz"; \ - done +doc: $(mandocs) clean: rm -f .*.o .*.d kak tags From 3a8b856a9ebf5da7e90d859eff0f0d54483cb941 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Thu, 4 Feb 2016 16:46:23 +0200 Subject: [PATCH 5/5] Document the `asciidoc` dependency --- README.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/README.asciidoc b/README.asciidoc index be9c2615..48f88cae 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -102,6 +102,7 @@ Kakoune dependencies are: * A C++11 compliant compiler (GCC >= 4.8 or clang >= 3.4) * boost (>= 1.50) * ncurses with wide-characters support (>= 5.3, generally referred to as libncursesw) + * asciidoc (for the `a2k` tool), to generate man pages To build, just type *make* in the src directory