From a15396f186d5a88f7fbe1af21add9bbd40ddc59b Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Fri, 30 Dec 2016 02:15:59 +1100 Subject: [PATCH] gnu: Add kakoune * gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch: New file. * gnu/local.mk (dist_patch_DATA): Register patch. * gnu/packages/text-editors.scm (kakoune): New variable. --- gnu/local.mk | 1 + .../kakoune-leave-manpages-uncompressed.patch | 69 +++++++++++++++++++ gnu/packages/text-editors.scm | 78 +++++++++++++++++++++- 3 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch diff --git a/gnu/local.mk b/gnu/local.mk index 2da8b82db..ce7a905d2 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -645,6 +645,7 @@ dist_patch_DATA = \ %D%/packages/patches/isl-0.11.1-aarch64-support.patch \ %D%/packages/patches/jbig2dec-ignore-testtest.patch \ %D%/packages/patches/jq-CVE-2015-8863.patch \ + %D%/packages/patches/kakoune-leave-manpages-uncompressed.patch \ %D%/packages/patches/kdbusaddons-kinit-file-name.patch \ %D%/packages/patches/khal-disable-failing-tests.patch \ %D%/packages/patches/khmer-use-libraries.patch \ diff --git a/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch b/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch new file mode 100644 index 000000000..eb1acb34d --- /dev/null +++ b/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch @@ -0,0 +1,69 @@ +Kakoune compresses its manpages, which makes the build non-reproducible (as it +leaves timestamps in files). If we don't do that here, and instead do it in +the guix phases `compress-manpages` then the build is reproducible. + +--- a/src/Makefile ++++ b/src/Makefile +@@ -22,7 +22,7 @@ + objects := $(addprefix ., $(sources:.cc=$(suffix).o)) + deps := $(addprefix ., $(sources:.cc=$(suffix).d)) + docs := $(wildcard ../doc/manpages/*.asciidoc) +-mandocs := $(docs:.asciidoc=.gz) ++mandocs := $(docs:.asciidoc=.1) + + PREFIX ?= /usr/local + DESTDIR ?= # root dir +@@ -76,19 +76,17 @@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF $(addprefix ., $(<:.cc=$(suffix).d)) -c -o $@ $< + + # Generate the man page +-../doc/kak.1.gz: ../doc/kak.1.txt ++../doc/kak.1: ../doc/kak.1.txt + a2x --no-xmllint -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 +-../doc/manpages/%.gz: ../doc/manpages/%.asciidoc ++# we generate the pages and patch them ++../doc/manpages/%.1: ../doc/manpages/%.asciidoc + a2x --no-xmllint -f manpage $< + sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$(basename $(notdir $<))\"," \ +- -e "/^\.SH \"NAME\"/{N;d;}" $(@:.gz=.1) +- gzip -f $(@:.gz=.1) +- mv -f $(@:.gz=.1.gz) $@ ++ -e "/^\.SH \"NAME\"/{N;d;}" $@ ++ + + check: test + test: +@@ -97,7 +95,7 @@ + TAGS: tags + tags: + ctags -R +-man: ../doc/kak.1.gz ++man: ../doc/kak.1 + doc: $(mandocs) + + clean: +@@ -124,8 +122,8 @@ + [ -e $(sharedir)/autoload ] || ln -s rc $(sharedir)/autoload + install -m 0644 ../colors/* $(sharedir)/colors + install -m 0644 ../README.asciidoc $(docdir) +- install -m 0644 ../doc/manpages/*.gz $(docdir)/manpages +- install -m 0644 ../doc/kak.1.gz $(mandir) ++ install -m 0644 ../doc/manpages/*.1 $(docdir)/manpages ++ install -m 0644 ../doc/kak.1 $(mandir) + + install-strip: install + strip -s $(bindir)/kak +@@ -134,7 +132,7 @@ + rm -rf $(bindir)/kak \ + $(sharedir) \ + $(docdir) \ +- $(mandir)/kak.1.gz ++ $(mandir)/kak.1 + + .PHONY: check TAGS clean distclean installdirs install install-strip uninstall + .PHONY: tags test man doc diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm index 4e2324dbe..8b7e95975 100644 --- a/gnu/packages/text-editors.scm +++ b/gnu/packages/text-editors.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 José Miguel Sánchez García +;;; Copyright © 2016 Carlo Zancanaro ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,13 +20,20 @@ (define-module (gnu packages text-editors) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) #:use-module (gnu packages lua) #:use-module (gnu packages ncurses) - #:use-module (gnu packages terminals)) + #:use-module (gnu packages terminals) + #:use-module (gnu packages gcc) + #:use-module (gnu packages bash) + #:use-module (gnu packages documentation) + #:use-module (gnu packages boost) + #:use-module (gnu packages ruby) + #:use-module (gnu packages xml)) (define-public vis (package @@ -75,3 +83,71 @@ based command language.") (license (list license:isc ; Main distribution. license:public-domain ; map.[ch] license:expat)))) ; lexers and libutf.[ch] + +(define-public kakoune + (let ((commit "c61aae0722058ad404ec1c117a277bef437e006e") + (revision "1")) + (package + (name "kakoune") + (version (string-append "0.0.0-" revision "." (string-take commit 7))) + (source + (origin + (file-name (string-append "kakoune-" version "-checkout")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/mawww/kakoune.git") + (commit commit))) + (sha256 + (base32 + "03jvlmna291609hydrpmpcl0a2qdcnghwpsgn3arvglq050l5w12")) + (patches + (search-patches + "kakoune-leave-manpages-uncompressed.patch")))) + (build-system gnu-build-system) + (arguments + `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) + ;; Boost is compiled with the older ABI, so we can't use + ;; the new ABI if we want to link againt it. + "CPPFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0") + + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'patch-bash-path + (lambda* (#:key inputs #:allow-other-keys) + ;; kakoune uses confstr with _CS_PATH to find out where to find + ;; a posix shell, but this doesn't work in the build + ;; environment. This substitution just replaces that result + ;; with the path the bash (which is run as sh). + (substitute* "src/shell_manager.cc" + (("if \\(m_shell.empty\\(\\)\\)" line) + (string-append "m_shell = \"" (assoc-ref %build-inputs "bash") + "/bin/sh\";\n " line))) + #t)) + ;; kakoune requires us to be in the src/ directory to build + (add-before 'build 'chdir + (lambda* (#:key outputs #:allow-other-keys) + (chdir "src") + #t)) + (add-before 'check 'fix-test-permissions + (lambda* _ + ;; Out git downloader doesn't give us write permissions, but + ;; without them the tests fail. + (zero? (system* "chmod" "-R" "u+w" "../test"))))))) + (native-inputs `(("gcc" ,gcc-5) + ("libxslt" ,libxslt) + ("asciidoc" ,asciidoc) + ("ruby" ,ruby))) + (inputs `(("gcc:lib" ,gcc-5 "lib") + ("bash" ,bash) + ("ncurses" ,ncurses) + ("boost" ,boost))) + (synopsis "Vim-inspired code editor") + (description + "Kakoune is a code editor heavily inspired by Vim, as such most of its +commands are similar to Vi's ones, and it shares Vi's \"keystrokes as a text +editing language\" model. Kakoune has a strong focus on interactivity, most +commands provide immediate and incremental results, while still being +competitive (as in keystroke count) with Vim.") + (home-page "http://kakoune.org/") + (license license:unlicense)))) -- 2.11.0