Subject: [bug#31484] [PATCH] gnu: icu4c: Patch zoneinfo directory.

From: Christopher Baines <[email-masked]>
Date: Thu, 17 May 2018 13:58:34 +0100

Replace the hardcoded /usr/share/zoneinfo file with a reference to the tzdata
package.

* gnu/packages/icu4c.scm (icu4c)[inputs]: Add tzdata.
[arguments]: Add a patch-zoneinfo-directory phase.
---
 gnu/packages/icu4c.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/icu4c.scm b/gnu/packages/icu4c.scm
index 57e8fffb3..d34b61745 100644
--- a/gnu/packages/icu4c.scm
+++ b/gnu/packages/icu4c.scm
@@ -22,6 +22,7 @@
 
 (define-module (gnu packages icu4c)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages perl)
   #:use-module (guix licenses)
   #:use-module (guix packages)
@@ -45,7 +46,8 @@
              (base32 "065l3n0q9wqaw8dz20x82srshhm6i987fr9ync5xf9mr6n7ylwzh"))))
    (build-system gnu-build-system)
    (inputs
-    `(("perl" ,perl)))
+    `(("perl" ,perl)
+      ("tzdata" ,tzdata)))
    (arguments
     `(#:configure-flags
       '("--enable-rpath"
@@ -58,7 +60,13 @@
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'chdir-to-source
-          (lambda _ (chdir "source") #t)))))
+          (lambda _ (chdir "source") #t))
+        (add-after 'chdir-to-source 'patch-zoneinfo-directory
+          (lambda* (#:key inputs #:allow-other-keys)
+            (substitute* "common/putil.cpp"
+              (("\\/usr\\/share\\/zoneinfo")
+               (string-append (assoc-ref inputs "tzdata")
+                              "/share/zoneinfo"))))))))
    (synopsis "International Components for Unicode")
    (description
     "ICU is a set of C/C++ and Java libraries providing Unicode and
-- 
2.16.3