kumquat-buildroot/package/tz/tz.mk
Scott Fan e6884604ea package/tz: fix incorrect timezone setting for uclibc
According to the doc file from <uclibc-src>/docs/
Glibc_vs_uClibc_Differences.txt, the uclibc library read the
TZ environment variable, or the /etc/TZ file; the /etc/TZ file
should be a single line, ending with a newline, containing the
TZ setting.  For example: echo CST6CDT > /etc/TZ

Whereas the tzdump cmd would output two lines like this:
  # Asia/Shanghai
  CST-8

This make the uclibc could not read the correct TZ setting, therefore
e.g. the 'busybox date' cmd always show the UTC timezone.

This fix remove the redundant first line from the tzdump output.

Signed-off-by: Scott Fan <fancp2007@gmail.com>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-08-06 09:12:18 +02:00

41 lines
1.5 KiB
Makefile

################################################################################
#
# tz
#
################################################################################
TZ_SOURCE =
TZ_DEPENDENCIES = host-tzdata host-tzdump
TZ_LICENSE = Public domain
TZ_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME))
define TZ_BUILD_CMDS
(cd $(HOST_DIR)/usr/share/zoneinfo/posix/; \
for i in $$(find . -type f); do \
mkdir -p $(@D)/output/$$(dirname $$i); \
$(TZDUMP) -p . -q $${i#./} | sed '1d' > $(@D)/output/$$i; \
done \
)
endef
define TZ_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0644 $(HOST_DIR)/usr/share/zoneinfo/zone.tab \
$(TARGET_DIR)/usr/share/zoneinfo/zone.tab
$(INSTALL) -D -m 0644 $(HOST_DIR)/usr/share/zoneinfo/iso3166.tab \
$(TARGET_DIR)/usr/share/zoneinfo/iso3166.tab
mkdir -p $(TARGET_DIR)/usr/share/zoneinfo/uclibc
cp -a $(@D)/output/* $(TARGET_DIR)/usr/share/zoneinfo/uclibc
if [ -n "$(TZ_LOCALTIME)" ]; then \
if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZDATA_LOCALTIME) ]; then \
printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \
"$(TZDATA_LOCALTIME)"; \
exit 1; \
fi; \
cd $(TARGET_DIR)/etc; \
ln -sf ../usr/share/zoneinfo/uclibc/$(TZDATA_LOCALTIME) TZ; \
fi
endef
$(eval $(generic-package))