| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 |
|
| 32 | (define-module (gnu packages gettext)
|
| 33 | #:use-module ((guix licenses) #:select (gpl2+ gpl3+ bsd-3))
|
| 34 | #:use-module (gnu packages)
|
| 35 | #:use-module (guix packages)
|
| 36 | #:use-module (guix gexp)
|
| 37 | #:use-module (guix git-download)
|
| 38 | #:use-module (guix download)
|
| 39 | #:use-module (guix build-system gnu)
|
| 40 | #:use-module (guix build-system perl)
|
| 41 | #:use-module (guix build-system pyproject)
|
| 42 | #:use-module (gnu packages bash)
|
| 43 | #:use-module (gnu packages check)
|
| 44 | #:use-module (gnu packages docbook)
|
| 45 | #:use-module (gnu packages emacs)
|
| 46 | #:use-module (gnu packages libunistring)
|
| 47 | #:use-module (gnu packages ncurses)
|
| 48 | #:use-module (gnu packages perl)
|
| 49 | #:use-module (gnu packages perl-check)
|
| 50 | #:use-module (gnu packages tex)
|
| 51 | #:use-module (gnu packages xml)
|
| 52 | #:use-module (gnu packages python-build)
|
| 53 | #:use-module (gnu packages python-xyz)
|
| 54 | #:use-module (gnu packages sphinx)
|
| 55 | #:use-module (guix utils))
|
| 56 |
|
| 57 | (define-public gettext-minimal
|
| 58 | (package
|
| 59 | (name "gettext-minimal")
|
| 60 | (version "0.23.1")
|
| 61 | (source (origin
|
| 62 | (method url-fetch)
|
| 63 | (uri (string-append "mirror://gnu/gettext/gettext-"
|
| 64 | version ".tar.gz"))
|
| 65 | (sha256
|
| 66 | (base32
|
| 67 | "0j8fijicvg8jkrisgsqbpnbmfb2mz3gx2p6pcwip82731yb7i9aj"))))
|
| 68 | (build-system gnu-build-system)
|
| 69 | (outputs '("out"
|
| 70 | "doc")) |
| 71 | (inputs
|
| 72 | (list libunistring
|
| 73 | libxml2
|
| 74 | |
| 75 | |
| 76 | |
| 77 | ncurses))
|
| 78 | (arguments
|
| 79 | (list #:configure-flags #~'("--with-included-libunistring=no"
|
| 80 | "--with-included-libxml=no")
|
| 81 | #:phases
|
| 82 | #~(modify-phases %standard-phases
|
| 83 | (add-before 'patch-source-shebangs 'patch-fixed-paths
|
| 84 | (lambda _
|
| 85 | (substitute* '("gettext-tools/config.h.in"
|
| 86 | "gettext-tools/gnulib-tests/init.sh"
|
| 87 | "gettext-tools/tests/init.sh"
|
| 88 | "gettext-tools/system-tests/run-test")
|
| 89 | (("/bin/sh") "sh"))
|
| 90 | (substitute* '("gettext-tools/src/project-id"
|
| 91 | "gettext-tools/projects/KDE/trigger"
|
| 92 | "gettext-tools/projects/GNOME/trigger")
|
| 93 | (("/bin/pwd") "pwd"))))
|
| 94 | (add-before 'check 'patch-tests
|
| 95 | (lambda* (#:key inputs #:allow-other-keys)
|
| 96 | |
| 97 | (substitute* "gettext-tools/gnulib-tests/test-execute.sh"
|
| 98 | (("^#!.*" all)
|
| 99 | (string-append all "exit 77;\n")))
|
| 100 | (let* ((bash (which "sh")))
|
| 101 | |
| 102 | |
| 103 | |
| 104 | (with-fluids ((%default-port-encoding #f))
|
| 105 | (substitute*
|
| 106 | (find-files "gettext-tools/tests"
|
| 107 | "^(lang-sh|msg(exec|filter)-[0-9])")
|
| 108 | (("#![[:blank:]]/bin/sh")
|
| 109 | (format #f "#!~a" bash)))
|
| 110 |
|
| 111 | (substitute* (cons "gettext-tools/src/msginit.c"
|
| 112 | (find-files "gettext-tools/gnulib-tests"
|
| 113 | "posix_spawn"))
|
| 114 | (("/bin/sh")
|
| 115 | bash))
|
| 116 |
|
| 117 | (substitute* "gettext-tools/src/project-id"
|
| 118 | (("/bin/pwd")
|
| 119 | "pwd"))
|
| 120 |
|
| 121 | #$@(if (target-hurd?)
|
| 122 | #~((substitute*
|
| 123 | "gettext-tools/gnulib-tests/Makefile.in"
|
| 124 | |
| 125 | ((" test-tls\\$\\(EXEEXT\\) ") " ")))
|
| 126 | '())))))
|
| 127 | #$@(if (%current-target-system)
|
| 128 | #~((add-after 'install 'patch-cross-shebangs
|
| 129 | (lambda _
|
| 130 | (let ((path (list (string-append #$bash-minimal "/bin"))))
|
| 131 | (define (patch-cross-shebang file)
|
| 132 | (patch-shebang file path))
|
| 133 | (with-directory-excursion
|
| 134 | (string-append #$output "/bin")
|
| 135 | (for-each
|
| 136 | patch-cross-shebang
|
| 137 | '("autopoint" "gettext.sh" "gettextize")))))))
|
| 138 | '()))
|
| 139 |
|
| 140 | |
| 141 | #:make-flags #~'("VERBOSE=yes")))
|
| 142 | (home-page "https://www.gnu.org/software/gettext/")
|
| 143 | (synopsis
|
| 144 | "Tools and documentation for translation (used to build other packages)")
|
| 145 | (description
|
| 146 | "GNU Gettext is a package providing a framework for translating the
|
| 147 | textual output of programs into multiple languages. It provides translators
|
| 148 | with the means to create message catalogs, and a runtime library to load
|
| 149 | translated messages from the catalogs. Nearly all GNU packages use Gettext.")
|
| 150 | (properties `((upstream-name . "gettext")
|
| 151 | (cpe-name . "gettext")))
|
| 152 | (license gpl3+))) |
| 153 |
|
| 154 | (define-public gettext-minimal-0.21
|
| 155 | (package/inherit gettext-minimal
|
| 156 | (version "0.21")
|
| 157 | (source (origin
|
| 158 | (method url-fetch)
|
| 159 | (uri (string-append "mirror://gnu/gettext/gettext-"
|
| 160 | version ".tar.gz"))
|
| 161 | (sha256
|
| 162 | (base32
|
| 163 | "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7"))
|
| 164 | (patches (search-patches "gettext-libunicode-update.patch"))))
|
| 165 | (arguments
|
| 166 | (substitute-keyword-arguments arguments
|
| 167 | ((#:phases phases)
|
| 168 | #~(modify-phases #$phases
|
| 169 | (add-after 'unpack 'touch-test
|
| 170 | (lambda _
|
| 171 | (with-output-to-file "gettext-tools/gnulib-tests/test-execute.sh"
|
| 172 | (lambda _ (display "")))))
|
| 173 | (add-before 'check 'patch-test
|
| 174 | (lambda _
|
| 175 | |
| 176 | (substitute* "gettext-tools/tests/xgettext-javascript-6"
|
| 177 | (("^#!.*" all) (string-append all "exit 77;\n")))))))))))
|
| 178 |
|
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | (define-public gnu-gettext
|
| 187 | (package/inherit gettext-minimal
|
| 188 | (name "gettext")
|
| 189 | (arguments
|
| 190 | (substitute-keyword-arguments arguments
|
| 191 | ((#:phases phases)
|
| 192 | #~(modify-phases #$phases
|
| 193 | (add-after 'install 'add-emacs-autoloads
|
| 194 | (lambda* (#:key outputs #:allow-other-keys)
|
| 195 | |
| 196 | (with-directory-excursion
|
| 197 | (string-append (assoc-ref outputs "out")
|
| 198 | "/share/emacs/site-lisp")
|
| 199 | (symlink "start-po.el" "gettext-autoloads.el"))))))))
|
| 200 | (native-inputs (list emacs-minimal)) |
| 201 | (synopsis "Tools and documentation for translation")))
|
| 202 |
|
| 203 | (define-public libtextstyle
|
| 204 | (package
|
| 205 | (name "libtextstyle")
|
| 206 | (version "0.21")
|
| 207 | (source (origin
|
| 208 | (inherit (package-source gnu-gettext))
|
| 209 | (uri (string-append "mirror://gnu/gettext/gettext-"
|
| 210 | version ".tar.gz"))
|
| 211 | (sha256
|
| 212 | (base32
|
| 213 | "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7"))))
|
| 214 | (build-system gnu-build-system)
|
| 215 | (arguments
|
| 216 | '(#:configure-flags '("--disable-static")
|
| 217 | #:phases (modify-phases %standard-phases
|
| 218 | (add-after 'unpack 'chdir
|
| 219 | (lambda _
|
| 220 | (chdir "libtextstyle")
|
| 221 | #t)))))
|
| 222 | |
| 223 | |
| 224 | |
| 225 | (home-page "https://www.gnu.org/software/gettext/")
|
| 226 | (synopsis "Text styling library")
|
| 227 | (description
|
| 228 | "GNU libtextstyle is a C library that provides an easy way to add styling
|
| 229 | to programs that produce output to a console or terminal emulator window. It
|
| 230 | allows applications to emit text annotated with styling information, such as
|
| 231 | color, font attributes (weight, posture), or underlining.")
|
| 232 | (license gpl3+)))
|
| 233 |
|
| 234 | (define-public mdpo
|
| 235 | (package
|
| 236 | (name "mdpo")
|
| 237 | (version "2.1.4")
|
| 238 | (source
|
| 239 | (origin
|
| 240 | (method git-fetch)
|
| 241 | (uri (git-reference
|
| 242 | (url "https://github.com/mondeja/mdpo")
|
| 243 | (commit (string-append "v" version))))
|
| 244 | (file-name (git-file-name name version))
|
| 245 | (sha256
|
| 246 | (base32 "02i17xly3yvfk6lpjl6sc15xzq9s3zc814siag1winyqckzl74gj"))))
|
| 247 | (build-system pyproject-build-system)
|
| 248 | (arguments
|
| 249 | (list
|
| 250 | #:test-flags
|
| 251 | #~(list
|
| 252 | |
| 253 | "--ignore=tests/test_unit/test_md2po2md/test_md2po2md_cli.py"
|
| 254 | "--ignore=tests/test_unit/test_text.py"
|
| 255 | "--ignore=tests/test_unit/test_command.py"
|
| 256 | "--ignore=tests/test_unit/test_md2po/test_location.py"
|
| 257 | "-k" "not test_mark_not_found_as_obsolete")
|
| 258 | #:phases
|
| 259 | #~(modify-phases %standard-phases
|
| 260 | (add-after 'unpack 'relax-requirements
|
| 261 | (lambda _
|
| 262 | (substitute* "pyproject.toml"
|
| 263 | ((".*contextlib-chdir.*") ""))))))) |
| 264 | (native-inputs
|
| 265 | (list python-hatchling
|
| 266 | python-pytest
|
| 267 | python-setuptools))
|
| 268 | (propagated-inputs
|
| 269 | (list python-importlib-metadata-argparse-version
|
| 270 | python-md-ulb-pwrap
|
| 271 | python-polib
|
| 272 | python-pymd4c))
|
| 273 | (home-page "https://github.com/mondeja/mdpo")
|
| 274 | (synopsis "Markdown file translation utilities using pofiles")
|
| 275 | (description
|
| 276 | "The mdpo utility creates pofiles, the format stabilished by GNU Gettext,
|
| 277 | from Markdown files.")
|
| 278 | (license bsd-3)))
|
| 279 |
|
| 280 | (define-public po4a
|
| 281 | (package
|
| 282 | (name "po4a")
|
| 283 | (version "0.74")
|
| 284 | (source (origin
|
| 285 | (method url-fetch)
|
| 286 | (uri (string-append "https://github.com/mquinson/po4a"
|
| 287 | "/releases/download/v"
|
| 288 | version "/po4a-" version ".tar.gz"))
|
| 289 | (sha256
|
| 290 | (base32
|
| 291 | "1hp7iy1rl8ci7rirh7r6d3jb0i16jm4vy3mgqd4bsyx35czk5z15"))))
|
| 292 | (build-system perl-build-system)
|
| 293 | (arguments
|
| 294 | (list
|
| 295 | #:phases
|
| 296 | #~(modify-phases %standard-phases
|
| 297 | (add-after 'install 'wrap-programs
|
| 298 | (lambda _
|
| 299 | |
| 300 | |
| 301 | (for-each
|
| 302 | (lambda (file)
|
| 303 | (wrap-program file
|
| 304 | (list "PERL5LIB" 'suffix
|
| 305 | (list (string-append #$output "/lib/perl5/site_perl")
|
| 306 | (getenv "PERL5LIB")))))
|
| 307 | (find-files (string-append #$output "/bin/") "\\.*$"))))
|
| 308 | #$@(if (system-hurd?)
|
| 309 | #~((add-after 'unpack 'skip-tests/hurd
|
| 310 | (lambda _
|
| 311 | (delete-file "t/cfg-multi.t")
|
| 312 | (delete-file "t/cfg-single.t")
|
| 313 | (delete-file "t/cfg-split.t"))))
|
| 314 | #~()))))
|
| 315 | (native-inputs
|
| 316 | (list gettext-minimal
|
| 317 | perl-module-build
|
| 318 | docbook-xsl
|
| 319 | libxslt
|
| 320 | libxml2 |
| 321 | |
| 322 | docbook-sgml-4.1
|
| 323 | docbook-xml-4.5
|
| 324 | perl-test-pod
|
| 325 | (texlive-local-tree)))
|
| 326 | (inputs
|
| 327 | (list bash-minimal
|
| 328 | opensp
|
| 329 | perl-gettext
|
| 330 | perl-pod-parser
|
| 331 | perl-pod-simple
|
| 332 | perl-sgmls
|
| 333 | perl-syntax-keyword-try
|
| 334 | perl-xs-parse-keyword
|
| 335 | perl-term-readkey
|
| 336 | perl-text-wrapi18n
|
| 337 | perl-unicode-linebreak
|
| 338 | perl-yaml-tiny))
|
| 339 | (home-page "https://po4a.org/")
|
| 340 | (synopsis "Scripts to ease maintenance of translations")
|
| 341 | (description
|
| 342 | "The po4a (PO for anything) project goal is to ease translations (and
|
| 343 | more interestingly, the maintenance of translations) using gettext tools on
|
| 344 | areas where they were not expected like documentation.")
|
| 345 | (license gpl2+)))
|
| 346 |
|
| 347 | (define-public po4a-minimal
|
| 348 | (package/inherit po4a
|
| 349 | (native-inputs
|
| 350 | |
| 351 | |
| 352 | (modify-inputs native-inputs
|
| 353 | (delete "docbook-xml" "perl-test-pod" "texlive-local-tree")))
|
| 354 | (arguments
|
| 355 | (substitute-keyword-arguments arguments
|
| 356 | ((#:tests? _ #t) #f)))
|
| 357 | (properties '((hidden? . #t)))))
|