unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#39913] [PATCH] gnu: Add bidiv.
@ 2020-03-04 19:41 Efraim Flashner
       [not found] ` <handler.39913.B.158335097723832.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Efraim Flashner @ 2020-03-04 19:41 UTC (permalink / raw)
  To: 39913; +Cc: Efraim Flashner

* gnu/packages/fribidi.scm (bidiv): New variable.
* gnu/packages/patches/bidiv-update-fribidi.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/fribidi.scm                      | 54 ++++++++++++++++++-
 .../patches/bidiv-update-fribidi.patch        | 50 +++++++++++++++++
 3 files changed, 104 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/bidiv-update-fribidi.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index cbb7d2b2f0..d5e5ac1e12 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -758,6 +758,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/beignet-correct-file-names.patch		\
   %D%/packages/patches/benchmark-unbundle-googletest.patch	\
   %D%/packages/patches/biber-fix-encoding-write.patch		\
+  %D%/packages/patches/bidiv-update-fribidi.patch		\
   %D%/packages/patches/binutils-boot-2.20.1a.patch		\
   %D%/packages/patches/binutils-loongson-workaround.patch	\
   %D%/packages/patches/blender-2.79-newer-ffmpeg.patch		\
diff --git a/gnu/packages/fribidi.scm b/gnu/packages/fribidi.scm
index 61aa6fd726..345529b73a 100644
--- a/gnu/packages/fribidi.scm
+++ b/gnu/packages/fribidi.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Marek Benc <merkur32@gmail.com>
-;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -54,3 +54,55 @@ or right-to-left ordering as necessary.")
     (source
       (origin (inherit (package-source fribidi))
               (patches (search-patches "fribidi-CVE-2019-18397.patch"))))))
+
+(define-public bidiv
+  (package
+    (name "bidiv")
+    (version "1.5")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "mirror://debian/pool/main/b/bidiv/bidiv_"
+                            version ".orig.tar.gz"))
+        (sha256
+         (base32
+          "05p5m2ihxbmc1qsgs8rjlww08fy9859fhl7xf196p8g5qygqd7cv"))
+        (patches (search-patches "bidiv-update-fribidi.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure) ; no configure
+         (add-after 'unpack 'misc-fixes
+           (lambda _
+             (substitute* "bidiv.c"
+               (("FriBidiCharType") "FriBidiParType")
+               (("&c") "(char *)&c"))
+             #t))
+         ;; We don't want to use the handwritten makefile
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((fribidi (assoc-ref inputs "fribidi")))
+               (invoke "gcc" "-o" "bidiv" "bidiv.c"
+                       ;; pkg-config --cflags fribidi
+                       (string-append "-I" fribidi "/include/fribidi")
+                       ;; pkg-config --libs fribidi
+                       (string-append "-L" fribidi "/lib") "-lfribidi"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (man (string-append out "/share/man/man1")))
+               (install-file "bidiv" bin)
+               (install-file "bidiv.1" man))
+             #t)))
+       #:tests? #f)) ; no tests
+    (inputs
+     `(("fribidi" ,fribidi)))
+    (home-page "https://tracker.debian.org/pkg/bidiv")
+    (synopsis "BiDi viewer - command-line tool displaying logical Hebrew/Arabic")
+    (description "bidiv is a simple utility for converting logical-Hebrew input
+to visual-Hebrew output.  This is useful for reading Hebrew mail messages,
+viewing Hebrew texts, etc.  It was written for Hebrew but Arabic (or other BiDi
+languages) should work equally well.")
+    (license gpl2+)))
diff --git a/gnu/packages/patches/bidiv-update-fribidi.patch b/gnu/packages/patches/bidiv-update-fribidi.patch
new file mode 100644
index 0000000000..d000cfeda4
--- /dev/null
+++ b/gnu/packages/patches/bidiv-update-fribidi.patch
@@ -0,0 +1,50 @@
+https://sources.debian.org/data/main/b/bidiv/1.5-6/debian/patches/fribidi_019
+
+Description: Fix building with fribidi 1.9
+Author: أحمد المحمودي <aelmahmoudy@users.sourceforge.net>
+Bug-Debian: http://bugs.debian.org/568130
+
+--- a/bidiv.c
++++ b/bidiv.c
+@@ -141,8 +141,9 @@ bidiv(FILE *fp)
+ 				*/
+ 				if(c1<0x80||c1>0xbf){
+ 					ungetc(c1, fp);
+-					unicode_in[len]=
+-						fribidi_iso8859_8_to_unicode_c(c);
++					fribidi_charset_to_unicode(
++						FRIBIDI_CHAR_SET_ISO8859_8,
++						&c, 1, &unicode_in[len]);
+ 				} else
+ 				unicode_in[len]=((c & 037) << 6) + (c1 & 077);
+ 				newline=0;
+@@ -153,8 +154,9 @@ bidiv(FILE *fp)
+ 				   In the future we will have a language
+ 				   option, which will control this (as well
+ 				   as the output encoding). */
+-				unicode_in[len]=
+-					fribidi_iso8859_8_to_unicode_c(c);
++				fribidi_charset_to_unicode(
++					FRIBIDI_CHAR_SET_ISO8859_8,
++					&c, 1, &unicode_in[len]);
+ #else
+ 				in[len]=c;
+ #endif
+@@ -206,11 +208,11 @@ bidiv(FILE *fp)
+ 			rtl_line=0;
+ 
+ 		if(out_utf8)
+-			fribidi_unicode_to_utf8(unicode_out, len,
+-					     out);
++			fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8,
++					unicode_out, len, out);
+ 		else
+-			fribidi_unicode_to_iso8859_8(unicode_out, len,
+-						     out);
++			fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_ISO8859_8,
++				unicode_out, len, out);
+ 		/* if rtl_line (i.e., base_dir is RL), and we didn't fill the
+ 		   entire width, we need to pad with spaces. Maybe in the
+ 		   future this should be an option.
+--
+
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#39913: Acknowledgement ([PATCH] gnu: Add bidiv.)
       [not found] ` <handler.39913.B.158335097723832.ack@debbugs.gnu.org>
@ 2020-03-15  6:51   ` Efraim Flashner
  0 siblings, 0 replies; 2+ messages in thread
From: Efraim Flashner @ 2020-03-15  6:51 UTC (permalink / raw)
  To: 39913-done

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

Patch pushed.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-15  6:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-04 19:41 [bug#39913] [PATCH] gnu: Add bidiv Efraim Flashner
     [not found] ` <handler.39913.B.158335097723832.ack@debbugs.gnu.org>
2020-03-15  6:51   ` bug#39913: Acknowledgement ([PATCH] gnu: Add bidiv.) Efraim Flashner

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).