From 6ca08153fb987d49c535120a7b451e1935d6627e 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 | 28 ++++++++ gnu/packages/text-editors.scm | 78 +++++++++++++++++++++- 3 files changed, 106 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 59fc1a82c..e22c8e471 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -643,6 +643,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/khmer-use-libraries.patch \ %D%/packages/patches/kmod-module-directory.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..943647d0c --- /dev/null +++ b/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch @@ -0,0 +1,28 @@ +Kakoune uses gzip to compress its manpages, but this saves the original time +stamp into the file. If we add --no-name to the uses of gzip then we get a +reproducible build. + +--- a/src/Makefile ++++ b/src/Makefile +@@ -71,19 +71,19 @@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF $(addprefix ., $(<:.cc=$(suffix).d)) -c -o $@ $< + + # Generate the man page + ../doc/kak.1.gz: ../doc/kak.1.txt + a2x --no-xmllint -f manpage $< +- gzip -f $(basename $<) ++ gzip -f --no-name $(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 + 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) ++ gzip -f --no-name $(@:.gz=.1) + mv -f $(@:.gz=.1.gz) $@ + + check: test + test: diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm index 4e2324dbe..110234a49 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 "125c8b7e80995732e0d8c87b82040025748f1b4f") + (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 + "19qs99l8r9p1vi5pxxx9an22fvi7xx40qw3jh2cnh2mbacawvdyb")) + (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