* [PATCH] gnu: Add kakoune
@ 2016-12-30 3:43 Carlo Zancanaro
2016-12-30 4:44 ` Carlo Zancanaro
0 siblings, 1 reply; 14+ messages in thread
From: Carlo Zancanaro @ 2016-12-30 3:43 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 9436 bytes --]
* gnu/packages/patches/kakoune-fix-bash-path.patch: New file.
* gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch:
* New file. gnu/local.mk (dist_patch_DATA): Register patches.
* gnu/packages/text-editors.scm (kakoune): New variable. ---
gnu/local.mk | 2 +
gnu/packages/patches/kakoune-fix-bash-path.patch | 34
++++++++++ .../kakoune-leave-manpages-uncompressed.patch |
65 +++++++++++++++++++ gnu/packages/text-editors.scm
| 73 +++++++++++++++++++++- 4 files changed, 173 insertions(+), 1
deletion(-) create mode 100644
gnu/packages/patches/kakoune-fix-bash-path.patch create mode
100644
gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch
diff --git a/gnu/local.mk b/gnu/local.mk index
106adb235..5517be2de 100644 --- a/gnu/local.mk +++ b/gnu/local.mk
@@ -640,6 +640,8 @@ 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-fix-bash-path.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-fix-bash-path.patch
b/gnu/packages/patches/kakoune-fix-bash-path.patch new file mode
100644 index 000000000..35b076d57 --- /dev/null +++
b/gnu/packages/patches/kakoune-fix-bash-path.patch @@ -0,0 +1,34
@@ +--- a/src/shell_manager.cc ++++ b/src/shell_manager.cc +@@
-22,30 +22,7 @@ + + ShellManager::ShellManager() + { +- // Get
a guaranteed to be POSIX shell binary +- { +- auto size
= confstr(_CS_PATH, 0, 0); +- String path;
path.resize(size-1, 0); +- confstr(_CS_PATH, path.data(),
size); +- for (auto dir : StringView{path} |
split<StringView>(':')) +- { +- String candidate
= format("{}/sh", dir); +- struct stat st; +-
if (stat(candidate.c_str(), &st)) +- continue; +-
+- bool executable = (st.st_mode & S_IXUSR) +-
| (st.st_mode & S_IXGRP) +- |
(st.st_mode & S_IXOTH); +- if (S_ISREG(st.st_mode) and
executable) +- { +- m_shell =
std::move(candidate); +- break; +- } +-
} +- if (m_shell.empty()) +- throw
runtime_error{format("unable to find a posix shell in {}", path)};
+- } ++ m_shell = "__BASH_PATH__/bin/sh"; + + // Add
Kakoune binary location to the path to guarantee that %sh{ ... } +
// have access to the kak command regardless of if the user
installed it 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..f7118c309 --- /dev/null +++
b/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch
@@ -0,0 +1,65 @@ +--- 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..c3981948e 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
<jmi2k@openmailbox.org>
+;;; Copyright © 2016 Carlo Zancanaro <carlo@zancanaro.id.au>
;;; ;;; 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,66 @@ 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
"4f986776423f5cd5fd80a16735f873ae23c10da2")) + (package +
(name "kakoune") + (version (string-append "0.0.1-"
(string-take commit 7))) + (source + (origin +
(file-name (string-append "kakoune-" version)) + (method
git-fetch) + (uri (git-reference + (url
"https://github.com/mawww/kakoune.git") + (commit
commit))) + (sha256 + (base32 +
"1nwkz18f73xcygayj42ijd70afzvwpasnqj84x4pdxgf4s349ipy")) +
(patches + (search-patches +
"kakoune-fix-bash-path.patch" +
"kakoune-leave-manpages-uncompressed.patch")))) +
(build-system gnu-build-system) + (arguments +
`(#:phases + (modify-phases %standard-phases +
(add-before 'configure 'patch-bash-path + (lambda*
(#:key inputs #:allow-other-keys) + (substitute*
"src/shell_manager.cc" + (("__BASH_PATH__") +
(assoc-ref inputs "bash"))))) + ;; Kakoune doesn't have
a configure script, but it still + ;; requires us to do
some setup/configuration. + (replace 'configure +
(lambda* (#:key outputs #:allow-other-keys) + ;;
Make has to be run in the src/ directory, so let's +
;; move there now. + (chdir "src") +
;; Boost is compiled with the older ABI, so we can't use +
;; the new ABI if we want to link againt it. +
(setenv "CPPFLAGS" "-D_GLIBCXX_USE_CXX11_ABI=0") +
(setenv "PREFIX" (assoc-ref outputs "out")))) +
(add-before 'check 'fix-test-permissions + (lambda* _
+ ;; The tests fail if they can't write over files
in the + ;; test directory, so make sure we can
write everywhere + ;; we might possibly need to. +
(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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2016-12-30 3:43 [PATCH] gnu: Add kakoune Carlo Zancanaro
@ 2016-12-30 4:44 ` Carlo Zancanaro
2016-12-30 19:25 ` Leo Famulari
0 siblings, 1 reply; 14+ messages in thread
From: Carlo Zancanaro @ 2016-12-30 4:44 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1.1: Type: text/plain, Size: 81 bytes --]
It turns out emacs decided to destroy my whitespace!
I'll attach it this time.
[-- Attachment #1.2: 0001-gnu-Add-kakoune.patch --]
[-- Type: text/x-patch, Size: 9858 bytes --]
From 57b2f9e6af20606e302fc4040515d7a92bde73fc Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
Date: Fri, 30 Dec 2016 02:15:59 +1100
Subject: [PATCH] gnu: Add kakoune
To: guix-devel@gnu.org
* gnu/packages/patches/kakoune-fix-bash-path.patch: New file.
* gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patches.
* gnu/packages/text-editors.scm (kakoune): New variable.
---
gnu/local.mk | 2 +
gnu/packages/patches/kakoune-fix-bash-path.patch | 34 ++++++++++
.../kakoune-leave-manpages-uncompressed.patch | 65 +++++++++++++++++++
gnu/packages/text-editors.scm | 73 +++++++++++++++++++++-
4 files changed, 173 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/kakoune-fix-bash-path.patch
create mode 100644 gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 106adb235..5517be2de 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -640,6 +640,8 @@ 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-fix-bash-path.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-fix-bash-path.patch b/gnu/packages/patches/kakoune-fix-bash-path.patch
new file mode 100644
index 000000000..35b076d57
--- /dev/null
+++ b/gnu/packages/patches/kakoune-fix-bash-path.patch
@@ -0,0 +1,34 @@
+--- a/src/shell_manager.cc
++++ b/src/shell_manager.cc
+@@ -22,30 +22,7 @@
+
+ ShellManager::ShellManager()
+ {
+- // Get a guaranteed to be POSIX shell binary
+- {
+- auto size = confstr(_CS_PATH, 0, 0);
+- String path; path.resize(size-1, 0);
+- confstr(_CS_PATH, path.data(), size);
+- for (auto dir : StringView{path} | split<StringView>(':'))
+- {
+- String candidate = format("{}/sh", dir);
+- struct stat st;
+- if (stat(candidate.c_str(), &st))
+- continue;
+-
+- bool executable = (st.st_mode & S_IXUSR)
+- | (st.st_mode & S_IXGRP)
+- | (st.st_mode & S_IXOTH);
+- if (S_ISREG(st.st_mode) and executable)
+- {
+- m_shell = std::move(candidate);
+- break;
+- }
+- }
+- if (m_shell.empty())
+- throw runtime_error{format("unable to find a posix shell in {}", path)};
+- }
++ m_shell = "__BASH_PATH__/bin/sh";
+
+ // Add Kakoune binary location to the path to guarantee that %sh{ ... }
+ // have access to the kak command regardless of if the user installed it
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..f7118c309
--- /dev/null
+++ b/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch
@@ -0,0 +1,65 @@
+--- 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..c3981948e 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 <jmi2k@openmailbox.org>
+;;; Copyright © 2016 Carlo Zancanaro <carlo@zancanaro.id.au>
;;;
;;; 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,66 @@ 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 "4f986776423f5cd5fd80a16735f873ae23c10da2"))
+ (package
+ (name "kakoune")
+ (version (string-append "0.0.1-" (string-take commit 7)))
+ (source
+ (origin
+ (file-name (string-append "kakoune-" version))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/mawww/kakoune.git")
+ (commit commit)))
+ (sha256
+ (base32
+ "1nwkz18f73xcygayj42ijd70afzvwpasnqj84x4pdxgf4s349ipy"))
+ (patches
+ (search-patches
+ "kakoune-fix-bash-path.patch"
+ "kakoune-leave-manpages-uncompressed.patch"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'patch-bash-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "src/shell_manager.cc"
+ (("__BASH_PATH__")
+ (assoc-ref inputs "bash")))))
+ ;; Kakoune doesn't have a configure script, but it still
+ ;; requires us to do some setup/configuration.
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;; Make has to be run in the src/ directory, so let's
+ ;; move there now.
+ (chdir "src")
+ ;; Boost is compiled with the older ABI, so we can't use
+ ;; the new ABI if we want to link againt it.
+ (setenv "CPPFLAGS" "-D_GLIBCXX_USE_CXX11_ABI=0")
+ (setenv "PREFIX" (assoc-ref outputs "out"))))
+ (add-before 'check 'fix-test-permissions
+ (lambda* _
+ ;; The tests fail if they can't write over files in the
+ ;; test directory, so make sure we can write everywhere
+ ;; we might possibly need to.
+ (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
[-- Attachment #1.3: Type: text/plain, Size: 50 bytes --]
On Fri, Dec 30 2016, Carlo Zancanaro wrote
> ...
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2016-12-30 4:44 ` Carlo Zancanaro
@ 2016-12-30 19:25 ` Leo Famulari
2016-12-30 23:19 ` Carlo Zancanaro
0 siblings, 1 reply; 14+ messages in thread
From: Leo Famulari @ 2016-12-30 19:25 UTC (permalink / raw)
To: Carlo Zancanaro; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 3764 bytes --]
On Fri, Dec 30, 2016 at 03:44:13PM +1100, Carlo Zancanaro wrote:
> From 57b2f9e6af20606e302fc4040515d7a92bde73fc Mon Sep 17 00:00:00 2001
> From: Carlo Zancanaro <carlo@zancanaro.id.au>
> Date: Fri, 30 Dec 2016 02:15:59 +1100
> Subject: [PATCH] gnu: Add kakoune
> To: guix-devel@gnu.org
>
> * gnu/packages/patches/kakoune-fix-bash-path.patch: New file.
> * gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register patches.
> * gnu/packages/text-editors.scm (kakoune): New variable.
Thank you!
> diff --git a/gnu/packages/patches/kakoune-fix-bash-path.patch b/gnu/packages/patches/kakoune-fix-bash-path.patch
> diff --git a/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch b/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch
Patches require some commentary explaining what problem they are solving
and, if the approach they take is unclear, how they do it. If they are
copied from somewhere else, they need attribution.
In this case, we need to explain why upstream's approach of finding a
POSIX shell doesn't work.
> diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm
> +(define-public kakoune
> + (let ((commit "4f986776423f5cd5fd80a16735f873ae23c10da2"))
Can you say why you chose this commit? Is it simply the most recent
commit when you made the package?
> + (package
> + (name "kakoune")
> + (version (string-append "0.0.1-" (string-take commit 7)))
Please add a revision counter, as described in the manual, section 7.6.3
Version Numbers. The resulting version will look like this:
> + (version (string-append "0.0.0-" revision "." (string-take commit 7)))
> + (file-name (string-append "kakoune-" version))
Please append '-checkout' to the end of the file-name.
> + (add-before 'configure 'patch-bash-path
> + (lambda* (#:key inputs #:allow-other-keys)
> + (substitute* "src/shell_manager.cc"
> + (("__BASH_PATH__")
> + (assoc-ref inputs "bash")))))
I wonder if we can do this change all in the same place. It's sort of
complicated to use a patch and a substitution.
Also, using a patch to get half-way there will cause the source code
given by `guix build --source` to be unbuildable, right? So, I think we
should find another way to fix whatever is wrong with the shell-finding
logic. Perhaps it will require cooperation with the upstream
maintainers, I don't know.
> + ;; Kakoune doesn't have a configure script, but it still
> + ;; requires us to do some setup/configuration.
> + (replace 'configure
> + (lambda* (#:key outputs #:allow-other-keys)
> + ;; Make has to be run in the src/ directory, so let's
> + ;; move there now.
> + (chdir "src")
> + ;; Boost is compiled with the older ABI, so we can't use
> + ;; the new ABI if we want to link againt it.
> + (setenv "CPPFLAGS" "-D_GLIBCXX_USE_CXX11_ABI=0")
> + (setenv "PREFIX" (assoc-ref outputs "out"))))
I think that CPPFLAGS and PREFIX should be set in #:make-flags. This
phase would then be renamed to 'chdir' and we'd delete the 'configure'
phase.
> + (add-before 'check 'fix-test-permissions
> + (lambda* _
> + ;; The tests fail if they can't write over files in the
> + ;; test directory, so make sure we can write everywhere
> + ;; we might possibly need to.
> + (system* "chmod" "-R" "u+w" "../test"))))))
This seems like a bug. Can you report it upstream?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2016-12-30 19:25 ` Leo Famulari
@ 2016-12-30 23:19 ` Carlo Zancanaro
2017-01-10 22:26 ` Leo Famulari
0 siblings, 1 reply; 14+ messages in thread
From: Carlo Zancanaro @ 2016-12-30 23:19 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 2658 bytes --]
On Fri, Dec 30 2016, Leo Famulari wrote
>> diff --git a/gnu/packages/patches/kakoune-fix-bash-path.patch b/gnu/packages/patches/kakoune-fix-bash-path.patch
>> diff --git a/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch b/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch
>
> Patches require some commentary explaining what problem they are solving
> and, if the approach they take is unclear, how they do it. If they are
> copied from somewhere else, they need attribution.
>
> In this case, we need to explain why upstream's approach of finding a
> POSIX shell doesn't work.
Perhaps you can give me a hint on this. I've patched it myself because
the original code uses confstr with _CS_PATH, but within the build
environment (and presumably outside of it, too) it gives back
"/bin:/usr/bin". Within the build environment this is invalid (as
neither directory exists), so the tests all fail. There is a bug[1]
about this already, but it was closed without fixing the issue (due to
some complexity/ambiguity in doing so, and no immediate need to fix it).
I can try to come up with a better way to patch this, but I don't know
if I should actually use the PATH environment variable. The patch that
changed this code to use _CS_PATH instead of PATH was made fifteen days
ago and was apparently to "use a POSIX guaranteed way of getting the
shell path"[2].
I could package the commit from just before the patch instead (which
would make this problem go away for now), or we can try to come up with
a real solution to the problem.
[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23112.
[2]: https://github.com/mawww/kakoune/commit/9a879262a272bd4c6458fcfa07a9289ee41d7220
>> + (add-before 'configure 'patch-bash-path
>> + (lambda* (#:key inputs #:allow-other-keys)
>> + (substitute* "src/shell_manager.cc"
>> + (("__BASH_PATH__")
>> + (assoc-ref inputs "bash")))))
>
> I wonder if we can do this change all in the same place. It's sort of
> complicated to use a patch and a substitution.
>
> Also, using a patch to get half-way there will cause the source code
> given by `guix build --source` to be unbuildable, right? So, I think we
> should find another way to fix whatever is wrong with the shell-finding
> logic. Perhaps it will require cooperation with the upstream
> maintainers, I don't know.
I hadn't thought about the effect this would have on `guix build
--source`. That's a fairly big problem.
Everything else that I haven't responded to is fine. I'll fix them up
and send a new patch once I have some direction on the _CS_PATH issue.
Carlo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2016-12-30 23:19 ` Carlo Zancanaro
@ 2017-01-10 22:26 ` Leo Famulari
2017-01-21 1:49 ` Carlo Zancanaro
0 siblings, 1 reply; 14+ messages in thread
From: Leo Famulari @ 2017-01-10 22:26 UTC (permalink / raw)
To: Carlo Zancanaro; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]
On Sat, Dec 31, 2016 at 10:19:53AM +1100, Carlo Zancanaro wrote:
> On Fri, Dec 30 2016, Leo Famulari wrote
> >> diff --git a/gnu/packages/patches/kakoune-fix-bash-path.patch b/gnu/packages/patches/kakoune-fix-bash-path.patch
> >> diff --git a/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch b/gnu/packages/patches/kakoune-leave-manpages-uncompressed.patch
> > In this case, we need to explain why upstream's approach of finding a
> > POSIX shell doesn't work.
>
> Perhaps you can give me a hint on this. I've patched it myself because
> the original code uses confstr with _CS_PATH, but within the build
> environment (and presumably outside of it, too) it gives back
> "/bin:/usr/bin". Within the build environment this is invalid (as
> neither directory exists), so the tests all fail. There is a bug[1]
> about this already, but it was closed without fixing the issue (due to
> some complexity/ambiguity in doing so, and no immediate need to fix it).
How about this?
(add-before 'configure 'patch-bash-path
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "src/shell_manager.cc"
(("if \\(m_shell.empty\\(\\)\\)" line)
(string-append "m_shell = \"" (assoc-ref %build-inputs "bash")
"/bin/sh\";\n " line)))
#t))
It's crude but it seems to work (the tests pass) and it avoids this
issue:
> > Also, using a patch to get half-way there will cause the source code
> > given by `guix build --source` to be unbuildable, right? So, I think we
> > should find another way to fix whatever is wrong with the shell-finding
> > logic. Perhaps it will require cooperation with the upstream
> > maintainers, I don't know.
>
> I hadn't thought about the effect this would have on `guix build
> --source`. That's a fairly big problem.
Sorry for the slooooow response!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2017-01-10 22:26 ` Leo Famulari
@ 2017-01-21 1:49 ` Carlo Zancanaro
2017-01-26 10:20 ` Ludovic Courtès
0 siblings, 1 reply; 14+ messages in thread
From: Carlo Zancanaro @ 2017-01-21 1:49 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
[-- Attachment #1.1: Type: text/plain, Size: 138 bytes --]
Let's give this another try, then. I think I've taken into account all
your feedback, and I've updated to a more recent kakoune commit.
[-- Attachment #1.2: 0001-gnu-Add-kakoune.patch --]
[-- Type: text/x-patch, Size: 8627 bytes --]
From a15396f186d5a88f7fbe1af21add9bbd40ddc59b Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
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 <jmi2k@openmailbox.org>
+;;; Copyright © 2016 Carlo Zancanaro <carlo@zancanaro.id.au>
;;;
;;; 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2017-01-21 1:49 ` Carlo Zancanaro
@ 2017-01-26 10:20 ` Ludovic Courtès
2017-01-26 12:26 ` Carlo Zancanaro
0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2017-01-26 10:20 UTC (permalink / raw)
To: Carlo Zancanaro; +Cc: guix-devel
Hello,
Sorry for the delay.
Carlo Zancanaro <carlo@zancanaro.id.au> skribis:
> From a15396f186d5a88f7fbe1af21add9bbd40ddc59b Mon Sep 17 00:00:00 2001
> From: Carlo Zancanaro <carlo@zancanaro.id.au>
> 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.
[...]
> +++ 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 $<)
It’s simpler to add --no-name (which suppresses timestamps and file
names from the gzip output) to all the gzip invocation in this Makefile.
Could you do that?
In ‘core-updates’ I’d like to add a phase that clears timestamps and
file names from all gzip headers so we don’t have to bother.
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2017-01-26 10:20 ` Ludovic Courtès
@ 2017-01-26 12:26 ` Carlo Zancanaro
2017-01-26 20:19 ` Marius Bakke
0 siblings, 1 reply; 14+ messages in thread
From: Carlo Zancanaro @ 2017-01-26 12:26 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1.1: Type: text/plain, Size: 371 bytes --]
On Thu, Jan 26 2017, Ludovic Courtès wrote
> It’s simpler to add --no-name (which suppresses timestamps and file
> names from the gzip output) to all the gzip invocation in this Makefile.
>
> Could you do that?
Done! Patch attached. I've also updated it to the most recent commit
again. I figure it's worth committing it as up-to-date as possible.
Carlo
[-- Attachment #1.2: 0001-gnu-Add-kakoune.patch --]
[-- Type: text/x-patch, Size: 7329 bytes --]
From 6ca08153fb987d49c535120a7b451e1935d6627e Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
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 <jmi2k@openmailbox.org>
+;;; Copyright © 2016 Carlo Zancanaro <carlo@zancanaro.id.au>
;;;
;;; 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2017-01-26 12:26 ` Carlo Zancanaro
@ 2017-01-26 20:19 ` Marius Bakke
2017-01-26 21:43 ` Carlo Zancanaro
0 siblings, 1 reply; 14+ messages in thread
From: Marius Bakke @ 2017-01-26 20:19 UTC (permalink / raw)
To: Carlo Zancanaro, Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 625 bytes --]
Carlo Zancanaro <carlo@zancanaro.id.au> writes:
> On Thu, Jan 26 2017, Ludovic Courtès wrote
>> It’s simpler to add --no-name (which suppresses timestamps and file
>> names from the gzip output) to all the gzip invocation in this Makefile.
>>
>> Could you do that?
>
> Done! Patch attached. I've also updated it to the most recent commit
> again. I figure it's worth committing it as up-to-date as possible.
Hi Carlo,
I replaced the patch file with a substitution phase instead and
committed. Also removed the explicit bash input with (which "sh").
Pushed as 5613ea79fccc5a5befafea313cb81010c5f5a8dd!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2017-01-26 20:19 ` Marius Bakke
@ 2017-01-26 21:43 ` Carlo Zancanaro
2017-01-26 22:09 ` Marius Bakke
0 siblings, 1 reply; 14+ messages in thread
From: Carlo Zancanaro @ 2017-01-26 21:43 UTC (permalink / raw)
To: Marius Bakke; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 465 bytes --]
On Thu, Jan 26 2017, Marius Bakke wrote
> I replaced the patch file with a substitution phase instead ... .
Is this the preferred way to patch reproducibility issues? I don't
really have a sense of it, but the other packages I have seen have used
either a patch or a snippet to make a build reproducible.
I don't really have a sense of when I should use a patch, a snippet, or
a phase. Can you give me a sense of when I should prefer one over the
others?
Carlo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2017-01-26 21:43 ` Carlo Zancanaro
@ 2017-01-26 22:09 ` Marius Bakke
2017-01-26 23:57 ` Carlo Zancanaro
0 siblings, 1 reply; 14+ messages in thread
From: Marius Bakke @ 2017-01-26 22:09 UTC (permalink / raw)
To: Carlo Zancanaro; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]
Carlo Zancanaro <carlo@zancanaro.id.au> writes:
> On Thu, Jan 26 2017, Marius Bakke wrote
>> I replaced the patch file with a substitution phase instead ... .
>
> Is this the preferred way to patch reproducibility issues? I don't
> really have a sense of it, but the other packages I have seen have used
> either a patch or a snippet to make a build reproducible.
>
> I don't really have a sense of when I should use a patch, a snippet, or
> a phase. Can you give me a sense of when I should prefer one over the
> others?
When it is a simple s/gzip -f/gzip -f --foo/, I prefer a substitution
over a patch since it's easier to maintain/less chance of conflicts. On
the other hand, they might silently become ineffective. So perhaps a
patch is better.
Now, whether this substitution should be run as a source 'snippet' is a
different question. The package is reproducible for `guix challenge`,
but not for the user verifying this manually with `guix build -S`.
I think that is a bug, and the substitution should run as a snippet
instead. They are for critical bug fixes, e.g. security, reproducibility
or freedom problems. Anything else should go in a phase, AFAIK.
Would you like to fix it? Good catch, sorry for making the mistake on
your behalf!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2017-01-26 22:09 ` Marius Bakke
@ 2017-01-26 23:57 ` Carlo Zancanaro
2017-01-27 0:47 ` Marius Bakke
0 siblings, 1 reply; 14+ messages in thread
From: Carlo Zancanaro @ 2017-01-26 23:57 UTC (permalink / raw)
To: Marius Bakke; +Cc: guix-devel
[-- Attachment #1.1: Type: text/plain, Size: 512 bytes --]
On Thu, Jan 26 2017, Marius Bakke wrote
> Would you like to fix it? Good catch, sorry for making the mistake on
> your behalf!
No worries!
I've attached a patch to move it to a snippet. I wasn't sure how to word
the commit message (this is the first time I've updated a package), so I
hope it's okay. If not, feel free to change it.
Thanks for the comments regarding patches/snippets/phases. I think I'll
just need to hang around a bit longer and see how things are done to get
a feel for it myself.
Carlo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-kakoune-Move-substitution-phase-to-snippet.patch --]
[-- Type: text/x-patch, Size: 1912 bytes --]
From b66c5ce74f15994f7976d405171771c185a646ff Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
Date: Fri, 27 Jan 2017 10:48:12 +1100
Subject: [PATCH] gnu: kakoune: Move substitution phase to snippet.
* gnu/packages/text-editors.scm (kakoune): Move substitution phase to snippet.
---
gnu/packages/text-editors.scm | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm
index cb4855860..465c088a8 100644
--- a/gnu/packages/text-editors.scm
+++ b/gnu/packages/text-editors.scm
@@ -98,7 +98,13 @@ based command language.")
(commit commit)))
(sha256
(base32
- "19qs99l8r9p1vi5pxxx9an22fvi7xx40qw3jh2cnh2mbacawvdyb"))))
+ "19qs99l8r9p1vi5pxxx9an22fvi7xx40qw3jh2cnh2mbacawvdyb"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; Kakoune uses 'gzip' to compress its manpages. Make sure
+ ;; timestamps are not preserved for reproducibility.
+ '(substitute* "src/Makefile"
+ (("gzip -f") "gzip -f --no-name")))))
(build-system gnu-build-system)
(arguments
`(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
@@ -117,10 +123,6 @@ based command language.")
(("if \\(m_shell.empty\\(\\)\\)" line)
(string-append "m_shell = \"" (which "sh")
"\";\n " line)))
- ;; Kakoune uses 'gzip' to compress its manpages. Make sure
- ;; timestamps are not preserved for reproducibility.
- (substitute* "src/Makefile"
- (("gzip -f") "gzip -f --no-name"))
#t))
(delete 'configure)
;; kakoune requires us to be in the src/ directory to build
--
2.11.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] gnu: Add kakoune
2017-01-26 23:57 ` Carlo Zancanaro
@ 2017-01-27 0:47 ` Marius Bakke
2017-01-27 23:00 ` gzip embedded timestamps Ludovic Courtès
0 siblings, 1 reply; 14+ messages in thread
From: Marius Bakke @ 2017-01-27 0:47 UTC (permalink / raw)
To: Carlo Zancanaro; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 839 bytes --]
Carlo Zancanaro <carlo@zancanaro.id.au> writes:
> On Thu, Jan 26 2017, Marius Bakke wrote
>> Would you like to fix it? Good catch, sorry for making the mistake on
>> your behalf!
>
> No worries!
>
> I've attached a patch to move it to a snippet. I wasn't sure how to word
> the commit message (this is the first time I've updated a package), so I
> hope it's okay. If not, feel free to change it.
Thank you! I tweaked it to match the convention of mentioning which
fields changed.
> Thanks for the comments regarding patches/snippets/phases. I think I'll
> just need to hang around a bit longer and see how things are done to get
> a feel for it myself.
To clarify, snippets and patches change the source presented to the
user with `guix build -S`. Substitutions that works around build or
paradigm problems are better fit in a phase.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* gzip embedded timestamps
2017-01-27 0:47 ` Marius Bakke
@ 2017-01-27 23:00 ` Ludovic Courtès
0 siblings, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2017-01-27 23:00 UTC (permalink / raw)
To: Marius Bakke; +Cc: guix-devel, Carlo Zancanaro
Hi!
BTW, yesterday I added a ‘remove-gzip-timestamps’ phase in
‘core-updates’ so we don’t have to bother at all in the future:
http://git.savannah.gnu.org/cgit/guix.git/commit/?h=core-updates&id=1d636d63193b66f67fbd0f10315cd61818f132c1
http://git.savannah.gnu.org/cgit/guix.git/commit/?h=core-updates&id=95e7be97282f136190d7007f34d355a9691a16fa
Ludo’.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2017-01-27 23:00 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-30 3:43 [PATCH] gnu: Add kakoune Carlo Zancanaro
2016-12-30 4:44 ` Carlo Zancanaro
2016-12-30 19:25 ` Leo Famulari
2016-12-30 23:19 ` Carlo Zancanaro
2017-01-10 22:26 ` Leo Famulari
2017-01-21 1:49 ` Carlo Zancanaro
2017-01-26 10:20 ` Ludovic Courtès
2017-01-26 12:26 ` Carlo Zancanaro
2017-01-26 20:19 ` Marius Bakke
2017-01-26 21:43 ` Carlo Zancanaro
2017-01-26 22:09 ` Marius Bakke
2017-01-26 23:57 ` Carlo Zancanaro
2017-01-27 0:47 ` Marius Bakke
2017-01-27 23:00 ` gzip embedded timestamps Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).