1(define-module (nmeum packages misc)
2 #:use-module (srfi srfi-26)
3 #:use-module (guix)
4 #:use-module (guix git-download)
5 #:use-module (guix build-system gnu)
6 #:use-module (guix build-system meson)
7 #:use-module ((guix licenses) #:prefix license:)
8 #:use-module (gnu packages acl)
9 #:use-module (gnu packages autotools)
10 #:use-module (gnu packages base)
11 #:use-module (gnu packages bison)
12 #:use-module (gnu packages compression)
13 #:use-module (gnu packages flex)
14 #:use-module (gnu packages libedit)
15 #:use-module (gnu packages ncurses)
16 #:use-module (gnu packages perl)
17 #:use-module (gnu packages pkg-config)
18 #:use-module (gnu packages shells)
19 #:use-module (gnu packages tls))
20
21(define-public mandoc-zstd
22 (package
23 (name "mandoc-zstd")
24 (version "1.14.6")
25 (source (origin
26 (method url-fetch)
27 (uri (string-append "https://mandoc.bsd.lv/snapshots/mandoc-"
28 version ".tar.gz"))
29 (patches (map (lambda (patch)
30 (search-path (map (cut string-append <>
31 "/nmeum/packages/patches")
32 %load-path) patch))
33 '("mandoc-support-zstd-compression.patch")))
34 (sha256
35 (base32
36 "174x2x9ws47b14lm339j6rzm7mxy1j3qhh484khscw0yy1qdbw4b"))))
37 (build-system gnu-build-system)
38 (arguments
39 `(#:test-target "regress"
40 #:make-flags
41 (list "VPATH=./zstd-src/zlibWrapper"
42 (string-join
43 (list "CFLAGS=-DZWRAP_USE_ZSTD=1"
44 (string-append "-I./zstd-src/zlibWrapper"))
45 " "))
46 #:phases ,#~(modify-phases %standard-phases
47 (add-after 'unpack 'unpack-zstd
48 (lambda _
49 (mkdir "zstd-src")
50 (invoke "tar" "--strip-components=1" "-C" "zstd-src"
51 "-xf" #$(package-source zstd))))
52 (add-before 'configure 'set-prefix
53 (lambda* (#:key outputs #:allow-other-keys)
54 (substitute* "configure"
55 (("^CC=.*")
56 (string-append "CC=" #$(cc-for-target) "\n"))
57 (("^DEFCFLAGS=\\\\\"")
58 "DEFCFLAGS=\"-O2 ")
59 (("^UTF8_LOCALE=.*") ;used for tests
60 "UTF8_LOCALE=en_US.UTF-8\n")
61 (("^MANPATH_(BASE|DEFAULT)=.*" _ which)
62 (string-append "MANPATH_" which "="
63 "/run/current-system/profile/share/man\n"))
64 (("^PREFIX=.*")
65 (string-append "PREFIX=" (assoc-ref outputs "out")
66 "\n"))))))))
67 (native-inputs (list (libc-utf8-locales-for-target) perl)) ;used to run tests
68 (inputs (list zlib (list zstd "lib")))
69 (native-search-paths
70 (list (search-path-specification
71 (variable "MANPATH")
72 (files '("share/man")))))
73 (synopsis "Tools for BSD mdoc and man pages")
74 (description
75 "mandoc is a suite of tools compiling mdoc, the roff macro language of
76choice for BSD manual pages, and man, the predominant historical language for
77UNIX manuals. It is small and quite fast. The main component of the toolset
78is the @command{mandoc} utility program, based on the libmandoc validating
79compiler, to format output for UTF-8 and ASCII UNIX terminals, HTML 5,
80PostScript, and PDF. Additional tools include the @command{man} viewer, and
81@command{apropos} and @command{whatis}.")
82 (home-page "https://mandoc.bsd.lv/")
83 (license license:isc)))
84
85(define-public libxo
86 (package
87 (name "libxo")
88 (version "1.7.5")
89 (source
90 (origin
91 (method git-fetch)
92 (uri (git-reference
93 (url "https://github.com/Juniper/libxo")
94 (commit version)))
95 (file-name (git-file-name name version))
96 (sha256
97 (base32 "115jv067msym0lsxkiz95ddvspd6smvww37248xkqyin0rxb2m0j"))))
98 (build-system gnu-build-system)
99 (native-inputs (list autoconf automake libtool))
100 (home-page "http://juniper.github.io/libxo/libxo-manual.html")
101 (synopsis "Library for Generating Text, XML, JSON, and HTML Output")
102 (description
103 "This library allows an application to generate text, XML,
104JSON, and HTML output using a common set of function calls. The application
105decides at run time which output style should be produced. The application
106calls a function @code{xo_emit} to product output that is described in a format
107string. A \"field descriptor\" tells libxo what the field is and what it means.")
108 (license license:bsd-2)))
109
110(define-public chimera-utils
111 (package
112 (name "chimerautils")
113 (version "14.2.0")
114 (source
115 (origin
116 (method git-fetch)
117 (uri (git-reference
118 (url "https://github.com/chimera-linux/chimerautils")
119 (commit (string-append "v" version))))
120 (file-name (git-file-name name version))
121 (patches (map (lambda (patch)
122 (search-path (map (cut string-append <>
123 "/nmeum/packages/patches")
124 %load-path) patch))
125 '("chimerautils-find-getopt-fix.patch")))
126 (sha256
127 (base32 "1z23ii57r9li4ffk9fg8q5k6n74rkzvmj2v5bcwb7dgkjanmhrn5"))))
128 (build-system meson-build-system)
129 (arguments
130 (list
131 #:tests? #f))
132 (inputs (list (list zstd "lib")
133 zlib
134 ncurses
135 acl
136 libedit
137 libxo
138 openssl))
139 (native-inputs (list flex bison pkg-config))
140 (home-page "https://github.com/chimera-linux/chimerautils")
141 (synopsis "The FreeBSD-based core Linux userland from Chimera Linux")
142 (description
143 "This is a port of the FreeBSD userland for Linux provided by
144the Chimera Linux distribution. Essentially, it is a collection of UNIX tools
145such as @command{grep}, @command{cp}, @command{vi}, etc. and can be used as an
146alternative to the corresponding implementations from the GNU project.")
147 (license license:bsd-2)))
148
149;; TODO: Use package-with-extra-patches somehow, however, we need to change
150;; the package name somehow as loksh would otherwise be ambiguous and not
151;; sure how do that on a package returned by package-with-extra-patches.
152(define-public loksh-bracketed
153 (package
154 (inherit loksh)
155 (name "loksh-bracketed")
156 (source
157 (origin
158 (inherit (package-source loksh))
159 (patches (map (lambda (patch)
160 (search-path (map (cut string-append <>
161 "/nmeum/packages/patches")
162 %load-path) patch))
163 '("loksh-bracketed-paste-mode.patch")))))))