fix(tzdata): prepend to ZONE_SOURCES instead of substituting in place

This commit is contained in:
Evangelos Paterakis 2022-12-21 16:30:37 +02:00
parent 44073f6d16
commit a979bd9214
No known key found for this signature in database
GPG key ID: FE5185F095BFC8C9
2 changed files with 19 additions and 4 deletions

View file

@ -4,6 +4,7 @@
, fetchurl
, fetchpatch
, lib
, substituteAll
# Dependencies
, boehmgc
, coreutils
@ -100,7 +101,12 @@ let
inherit sha256;
};
patches = [ ]
patches = [
(substituteAll {
src = ./tzdata.patch;
inherit tzdata;
})
]
++ lib.optionals (lib.versionOlder version "1.2.0") [
# add support for DWARF5 debuginfo, fixes builds on recent compilers
# the PR is 8 commits from 2019, so just fetch the whole thing
@ -124,9 +130,6 @@ let
substituteInPlace Makefile \
--replace 'docs: ## Generate standard library documentation' 'docs: crystal ## Generate standard library documentation'
substituteInPlace src/crystal/system/unix/time.cr \
--replace /usr/share/zoneinfo ${tzdata}/share/zoneinfo
mkdir -p $TMP/crystal
substituteInPlace spec/std/file_spec.cr \

View file

@ -0,0 +1,12 @@
diff --git a/src/crystal/system/unix/time.cr b/src/crystal/system/unix/time.cr
index 333b66075..1c29a0e55 100644
--- a/src/crystal/system/unix/time.cr
+++ b/src/crystal/system/unix/time.cr
@@ -43,6 +43,7 @@ module Crystal::System::Time
# Many systems use /usr/share/zoneinfo, Solaris 2 has
# /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ.
ZONE_SOURCES = {
+ "@tzdata@/share/zoneinfo/",
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",