diff mbox

[2/2] package/tzdata: new package

Message ID 1357304770-23310-1-git-send-email-rbraun@sceen.net
State Changes Requested
Headers show

Commit Message

Richard Braun Jan. 4, 2013, 1:06 p.m. UTC
This is the time zone database, used by glibc for translations between
UTC and local time.

Signed-off-by: Richard Braun <rbraun@sceen.net>
---
 package/Config.in        |    1 +
 package/tzdata/Config.in |   24 ++++++++++++++++++++++++
 package/tzdata/tzdata.mk |   44 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 0 deletions(-)
 create mode 100644 package/tzdata/Config.in
 create mode 100644 package/tzdata/tzdata.mk

Comments

Thomas Petazzoni Jan. 4, 2013, 1:41 p.m. UTC | #1
Dear Richard Braun,

On Fri,  4 Jan 2013 14:06:10 +0100, Richard Braun wrote:

> +		for zone in $(TZDATA_ZONELIST); do \
> +			$(TZDATA_ZIC) -d _output -y yearistype.sh $$zone; \
> +			$(TZDATA_ZIC) -d _output/posix -y yearistype.sh $$zone; \

I am wondering why we are generating the time zone data twice here with
the same argument? I know POSIX says that time zone data shouldn't take
leap seconds into account, so I understand the difference between
_output/posix and _output/right, but not between _output and
_output/posix.

Thomas
Richard Braun Jan. 4, 2013, 1:45 p.m. UTC | #2
On Fri, Jan 04, 2013 at 02:41:19PM +0100, Thomas Petazzoni wrote:
> I am wondering why we are generating the time zone data twice here with
> the same argument? I know POSIX says that time zone data shouldn't take
> leap seconds into account, so I understand the difference between
> _output/posix and _output/right, but not between _output and
> _output/posix.

The posix version is the default one.
Thomas Petazzoni Jan. 4, 2013, 1:48 p.m. UTC | #3
Dear Richard Braun,

On Fri, 4 Jan 2013 14:45:20 +0100, Richard Braun wrote:
> On Fri, Jan 04, 2013 at 02:41:19PM +0100, Thomas Petazzoni wrote:
> > I am wondering why we are generating the time zone data twice here with
> > the same argument? I know POSIX says that time zone data shouldn't take
> > leap seconds into account, so I understand the difference between
> > _output/posix and _output/right, but not between _output and
> > _output/posix.
> 
> The posix version is the default one.

Yes, but then why isn't _output/posix a symlink to _output/ ?

Thomas
Richard Braun Jan. 4, 2013, 1:57 p.m. UTC | #4
On Fri, Jan 04, 2013 at 02:48:57PM +0100, Thomas Petazzoni wrote:
> > The posix version is the default one.
> 
> Yes, but then why isn't _output/posix a symlink to _output/ ?

I expected this to be the real question :). A symlink allowing recursive
traversal seems like an easy way to get in trouble.
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 2cbadf4..99bb724 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -540,6 +540,7 @@  source "package/protobuf/Config.in"
 source "package/schifra/Config.in"
 source "package/startup-notification/Config.in"
 source "package/liblog4c-localtime/Config.in"
+source "package/tzdata/Config.in"
 endmenu
 
 menu "Text and terminal handling"
diff --git a/package/tzdata/Config.in b/package/tzdata/Config.in
new file mode 100644
index 0000000..d219ae2
--- /dev/null
+++ b/package/tzdata/Config.in
@@ -0,0 +1,24 @@ 
+config BR2_PACKAGE_TZDATA
+	bool "tzdata"
+	help
+	  Time zone database
+
+	  http://www.iana.org/time-zones/repository/tz-link.html
+
+	  Note that this package is most useful for glibc-based systems, as
+	  uClibc doesn't support the format. Despite this, the time zone
+	  database can also be built on uClibc-based systems in case an
+	  application has specific support for it.
+
+config BR2_PACKAGE_TZDATA_ZONELIST
+	string "Time zone list"
+	depends on BR2_PACKAGE_TZDATA
+	default "default"
+	help
+	  Space-separated list of time zones to compile.
+
+	  The value "default" includes all commonly used time zones. Note
+	  that this set consumes around 5.5M.
+
+	  The full list is the list of files in the time zone database source,
+	  not including the build and .tab files.
diff --git a/package/tzdata/tzdata.mk b/package/tzdata/tzdata.mk
new file mode 100644
index 0000000..5bcee85
--- /dev/null
+++ b/package/tzdata/tzdata.mk
@@ -0,0 +1,44 @@ 
+#############################################################
+#
+# tzdata
+#
+#############################################################
+
+TZDATA_VERSION = 2012j
+TZDATA_SOURCE = tzdata$(TZDATA_VERSION).tar.gz
+TZDATA_SITE = http://www.iana.org/time-zones/repository/releases
+TZDATA_DEPENDENCIES = host-zic
+TZDATA_LICENSE = Public domain
+
+TZDATA_ZIC = $(HOST_DIR)/usr/sbin/zic
+TZDATA_DEFAULT_ZONELIST = africa antarctica asia australasia backward etcetera \
+			europe factory northamerica pacificnew southamerica
+
+ifeq ($(call qstrip,$(BR2_PACKAGE_TZDATA_ZONELIST)),default)
+TZDATA_ZONELIST = $(TZDATA_DEFAULT_ZONELIST)
+else
+TZDATA_ZONELIST = $(call qstrip,$(BR2_PACKAGE_TZDATA_ZONELIST))
+endif
+
+# Don't strip any path components during extraction.
+define TZDATA_EXTRACT_CMDS
+	gzip -d -c $(DL_DIR)/$(TZDATA_SOURCE) \
+		| $(TAR) --strip-components=0 -C $(@D) -xf -
+endef
+
+define TZDATA_BUILD_CMDS
+	(cd $(@D); \
+		for zone in $(TZDATA_ZONELIST); do \
+			$(TZDATA_ZIC) -d _output -y yearistype.sh $$zone; \
+			$(TZDATA_ZIC) -d _output/posix -y yearistype.sh $$zone; \
+			$(TZDATA_ZIC) -d _output/right -L leapseconds -y yearistype.sh $$zone; \
+		done; \
+	)
+endef
+
+define TZDATA_INSTALL_TARGET_CMDS
+	mkdir -p $(TARGET_DIR)/usr/share/zoneinfo
+	cp -a $(@D)/_output/* $(TARGET_DIR)/usr/share/zoneinfo
+endef
+
+$(eval $(generic-package))