summaryrefslogtreecommitdiff
path: root/repo/tzdata
diff options
context:
space:
mode:
Diffstat (limited to 'repo/tzdata')
-rw-r--r--repo/tzdata/0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch27
-rw-r--r--repo/tzdata/0002-fix-implicit-declaration-warnings-by-including-strin.patch28
-rw-r--r--repo/tzdata/tzdata.xibuild56
3 files changed, 111 insertions, 0 deletions
diff --git a/repo/tzdata/0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch b/repo/tzdata/0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch
new file mode 100644
index 0000000..c4ae70b
--- /dev/null
+++ b/repo/tzdata/0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch
@@ -0,0 +1,27 @@
+From e6765bd363d2dd1dcaeeae5117cc25aae53fb944 Mon Sep 17 00:00:00 2001
+From: William Pitcock <nenolod@dereferenced.org>
+Date: Thu, 28 Apr 2011 02:56:42 -0500
+Subject: [PATCH 1/2] posixtz: ensure the file offset we pass to lseek is off_t
+
+on 32-bit systems, sizeof(off_t) is 4, on 64-bit sizeof(off_t) is 8
+causing a word masking issue.
+---
+ posixtz.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/posixtz.c b/posixtz.c
+index cddcb3e..972ca31 100644
+--- a/posixtz-0.5/posixtz.c
++++ b/posixtz-0.5/posixtz.c
+@@ -36,7 +36,7 @@ char *posix_tz(const char *filename)
+ if (r != TZ_BUFLEN
+ || strncmp(buf, "TZif", 4) != 0
+ || (unsigned char)buf[4] < 2
+- || lseek(fd, -TZ_BUFLEN, SEEK_END) < 0
++ || lseek(fd, (off_t) -TZ_BUFLEN, SEEK_END) < 0
+ )
+ goto ERROR;
+
+--
+2.16.2
+
diff --git a/repo/tzdata/0002-fix-implicit-declaration-warnings-by-including-strin.patch b/repo/tzdata/0002-fix-implicit-declaration-warnings-by-including-strin.patch
new file mode 100644
index 0000000..6f61b25
--- /dev/null
+++ b/repo/tzdata/0002-fix-implicit-declaration-warnings-by-including-strin.patch
@@ -0,0 +1,28 @@
+From 89d4aece7ba679703060393ac95086fd514c7fc7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Tue, 27 Mar 2018 19:09:44 +0200
+Subject: [PATCH 2/2] fix implicit declaration warnings by including string.h
+ and unistd.h
+
+string.h is needed for strncmp(3) and unistd.h is needed for read(3),
+close(3) and lseek(3).
+---
+ posixtz.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/posixtz.c b/posixtz.c
+index 972ca31..4a36e10 100644
+--- a/posixtz-0.5/posixtz.c
++++ b/posixtz-0.5/posixtz.c
+@@ -14,6 +14,8 @@
+ #include <fcntl.h>
+ #include <limits.h>
+ #include <stdio.h>
++#include <string.h>
++#include <unistd.h>
+
+ #include "posixtz.h"
+
+--
+2.16.2
+
diff --git a/repo/tzdata/tzdata.xibuild b/repo/tzdata/tzdata.xibuild
new file mode 100644
index 0000000..0813733
--- /dev/null
+++ b/repo/tzdata/tzdata.xibuild
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+NAME="tzdata"
+DESC="Timezone data"
+
+MAKEDEPS="cmake "
+DEPS="musl "
+
+PKG_VER=2022a
+SOURCE="https://www.iana.org/time-zones/repository/releases/tzdata$PKG_VER.tar.gz"
+tzcodever=2022a
+ptzver=0.5
+
+ADDITIONAL="
+https://www.iana.org/time-zones/repository/releases/tzcode$tzcodever.tar.gz
+https://dev.alpinelinux.org/archive/posixtz/posixtz-$ptzver.tar.xz
+0002-fix-implicit-declaration-warnings-by-including-strin.patch 0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch
+"
+
+timezones="africa antarctica asia australasia europe northamerica \
+ southamerica etcetera backward factory"
+
+prepare () {
+ tar xf tzcode$tzcodever.tar.gz
+ tar xf posixtz-$ptzver.tar.xz
+ apply_patches
+}
+
+
+build() {
+ make cc="${CC:-gcc}" CFLAGS="$CFLAGS -DHAVE_STDINT_H=1"
+ TZDIR="/usr/share/zoneinfo"
+
+ cd posixtz-$ptzver
+ make posixtz
+ cd ..
+}
+
+package () {
+ ./zic -b fat -y ./yearistype -d "$PKG_DEST"/usr/share/zoneinfo $timezones
+ ./zic -b fat -y ./yearistype -d "$PKG_DEST"/usr/share/zoneinfo/right -L leapseconds $timezones
+
+ ./zic -b fat -y ./yearistype -d "$PKG_DEST"/usr/share/zoneinfo -p America/New_York
+ install -m444 -t "$PKG_DEST"/usr/share/zoneinfo iso3166.tab zone1970.tab zone.tab
+
+ mkdir -p "$PKG_DEST"/usr/sbin
+ install -m755 zic zdump "$PKG_DEST"/usr/sbin
+
+ mkdir -p "$PKG_DEST"/usr/share/man/man8
+ install -m644 zic.8 zdump.8 "$PKG_DEST"/usr/share/man/man8
+
+ rm -f "$PKG_DEST"/usr/share/zoneinfo/localtime
+ install -Dm755 posixtz-$ptzver/posixtz \
+ "$PKG_DEST"/usr/bin/posixtz
+
+}