diff options
author | Bart vdr. Meulen <bartvdrmeulen@gmail.com> | 2010-05-07 23:34:53 +0200 |
---|---|---|
committer | Remy Bohmer <linux@bohmer.net> | 2010-06-02 21:09:29 +0200 |
commit | af3c619059b204e20fd51634b2bbd8089c745451 (patch) | |
tree | 108790a6e4534819b730248776ecdcd6c48de813 | |
parent | 5a6af26a95988d2a9b69e639b35519c3df40f4b9 (diff) | |
download | ptxdist-af3c619059b204e20fd51634b2bbd8089c745451.tar.gz ptxdist-af3c619059b204e20fd51634b2bbd8089c745451.tar.xz |
[timezone] add new packet
Add an alternative source for the timezone info. This option can be used when
using toolchains in which the timezone info is incorrect/does not work or is
not available at all
The option build's the timezone database from the tzdata source files on the
host and installs the selected zoneinfos to the target.
Signed-off-by: Bart vdr. Meulen <bartvdrmeulen@gmail.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>
-rw-r--r-- | rules/host-tz-database.in | 4 | ||||
-rw-r--r-- | rules/host-tz-database.make | 100 | ||||
-rw-r--r-- | rules/pre/Rules.make | 4 | ||||
-rw-r--r-- | rules/timezone.in | 15 | ||||
-rw-r--r-- | rules/timezone.make | 10 | ||||
-rwxr-xr-x | scripts/make_zoneinfo.sh | 15 |
6 files changed, 136 insertions, 12 deletions
diff --git a/rules/host-tz-database.in b/rules/host-tz-database.in new file mode 100644 index 000000000..c1e02522d --- /dev/null +++ b/rules/host-tz-database.in @@ -0,0 +1,4 @@ +## SECTION=hosttools_noprompt + +config HOST_TZDATABASE + tristate diff --git a/rules/host-tz-database.make b/rules/host-tz-database.make new file mode 100644 index 000000000..dc12fe6a2 --- /dev/null +++ b/rules/host-tz-database.make @@ -0,0 +1,100 @@ +# -*-makefile-*- +# +# Copyright (C) 2010 by Bart vdr. Meulen <bartvdrmeulen@gmail.com> +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +HOST_PACKAGES-$(PTXCONF_HOST_TZDATABASE) += host-tz-database + +# +# Paths and names +# +TZCODE_VERSION := 2010f +TZCODE := tzcode$(TZCODE_VERSION) +TZCODE_SUFFIX := tar.gz +TZCODE_URL := \ +ftp://elsie.nci.nih.gov/pub/$(TZCODE).$(TZCODE_SUFFIX) \ +ftp://munnari.oz.au/pub/oldtz/$(TZCODE).$(TZCODE_SUFFIX) +TZCODE_SOURCE := $(SRCDIR)/$(TZCODE).$(TZCODE_SUFFIX) + +TZDATA_VERSION := 2010h +TZDATA := tzdata$(TZDATA_VERSION) +TZDATA_SUFFIX := tar.gz +TZDATA_URL := \ +ftp://elsie.nci.nih.gov/pub/$(TZDATA).$(TZDATA_SUFFIX) \ +ftp://munnari.oz.au/pub/oldtz/$(TZDATA).$(TZDATA_SUFFIX) +TZDATA_SOURCE := $(SRCDIR)/$(TZDATA).$(TZDATA_SUFFIX) + + +HOST_TZDATABASE := tz-database +HOST_TZDATABASE_DIR := $(HOST_BUILDDIR)/$(HOST_TZDATABASE) + +# ---------------------------------------------------------------------------- +# Get +# ---------------------------------------------------------------------------- +$(TZCODE_SOURCE): + @$(call get, TZCODE) + +$(TZDATA_SOURCE): + @$(call get, TZDATA) + +$(STATEDIR)/host-tz-database.get: $(TZCODE_SOURCE) $(TZDATA_SOURCE) + @$(call targetinfo) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Extract +# ---------------------------------------------------------------------------- + +$(STATEDIR)/host-tz-database.extract: + @$(call targetinfo) + @$(call clean, $(HOST_TZDATABASE_DIR)) + @$(call extract, TZCODE, $(HOST_TZDATABASE_DIR)) + @$(call extract, TZDATA, $(HOST_TZDATABASE_DIR)) + @$(call touch) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +HOST_TZDATABASE_PATH := PATH=$(HOST_PATH) +HOST_TZDATABASE_ENV := $(HOST_ENV) + +$(STATEDIR)/host-tz-database.prepare: + @$(call targetinfo, $@) + @$(call touch, $@) + +# ---------------------------------------------------------------------------- +# Compile +# ---------------------------------------------------------------------------- + +$(STATEDIR)/host-tz-database.compile: + @$(call targetinfo) + cd $(HOST_TZDATABASE_DIR) && $(HOST_TZDATABASE_PATH) \ + $(MAKE) posix_only TZDIR=$(PTXDIST_SYSROOT_HOST)/usr/share/zoneinfo + @$(call touch) + +# ---------------------------------------------------------------------------- +# Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/host-tz-database.install: + $(call targetinfo) + $(call touch) + +# ---------------------------------------------------------------------------- +# Clean +# ---------------------------------------------------------------------------- + +#$(STATEDIR)/host-tz-database.clean: +# @$(call targetinfo) +# @$(call clean_pkg, HOST_TZDATABASE) + +# vim: syntax=make diff --git a/rules/pre/Rules.make b/rules/pre/Rules.make index 8ffc6fd86..1fd370731 100644 --- a/rules/pre/Rules.make +++ b/rules/pre/Rules.make @@ -386,10 +386,12 @@ add_locale = \ add_zoneinfo = \ ZONEINFO_NAME=$(strip $(1)); \ PREF=$(strip $(2)); \ + SYSROOT=$(strip $(3)); \ ${CROSS_ENV_CC} $(CROSS_ENV_STRIP) \ $(SCRIPTSDIR)/make_zoneinfo.sh \ -n $$ZONEINFO_NAME \ - -p $$PREF + -p $$PREF \ + -s $$SYSROOT # # extract diff --git a/rules/timezone.in b/rules/timezone.in index 9d277897f..96c328d41 100644 --- a/rules/timezone.in +++ b/rules/timezone.in @@ -1,13 +1,13 @@ ## SECTION=core -comment "Time zone support doesn't work with OSELAS.Toolchain-1.1.0" -comment "and prio versions, hence marked as broken for now" +# comment "Time zone support doesn't work with OSELAS.Toolchain-1.1.0" +# comment "and prio versions, hence marked as broken for now" menuconfig TIMEZONE tristate prompt "Timezone Files " depends on GLIBC - depends on BROKEN + select HOST_TZDATABASE if TIMEZONE_LOCAL_DATABASE help installs timezone files @@ -23,6 +23,15 @@ config GLIBC_LOCALTIME_LINK Where should /etc/localtime point to. (e.g. /usr/share/zoneinfo/Europe/Berlin) +config TIMEZONE_LOCAL_DATABASE + bool + prompt "Use local build timezone database" + depends on TIMEZONE + default y + help + Don't use the timezone info provided by the toolchain + but a locally build from source + config TIMEZONE_AFRICA bool prompt "Africa" diff --git a/rules/timezone.make b/rules/timezone.make index f9c5f2e4f..1ec1ffee3 100644 --- a/rules/timezone.make +++ b/rules/timezone.make @@ -137,9 +137,15 @@ $(STATEDIR)/timezone.targetinstall: @$(call install_fixup, timezone,DEPENDS,) @$(call install_fixup, timezone,DESCRIPTION,missing) +ifdef PTXCONF_TIMEZONE_LOCAL_DATABASE @for target in $(TIMEZONE-y); do \ - $(call add_zoneinfo, $$target, $(TIMEZONE_DIR)); \ + $(call add_zoneinfo, $$target, $(TIMEZONE_DIR), $(PTXDIST_SYSROOT_HOST)/usr); \ done +else + @for target in $(TIMEZONE-y); do \ + $(call add_zoneinfo, $$target, $(TIMEZONE_DIR), ""); \ + done +endif @$(call install_copy, timezone, 0, 0, 0755, /usr/share/zoneinfo) @for d in `find ${TIMEZONE_DIR}/zoneinfo/ -type d | awk -v FS="zoneinfo/" '{print $$2}'`; do \ @@ -151,7 +157,7 @@ $(STATEDIR)/timezone.targetinstall: done ifdef PTXCONF_GLIBC_LOCALTIME_LINK - @$(call install_link, timezone, $(PTXCONF_GLIBC_LOCALTIME_LINK), /etc/localtime) + @$(call install_link, timezone, ..$(PTXCONF_GLIBC_LOCALTIME_LINK), /etc/localtime) endif @$(call install_finish, timezone) diff --git a/scripts/make_zoneinfo.sh b/scripts/make_zoneinfo.sh index ad3367584..c583aab40 100755 --- a/scripts/make_zoneinfo.sh +++ b/scripts/make_zoneinfo.sh @@ -21,24 +21,27 @@ usage() { } add_zoneinfo() { - local PREF ZONEINFO_NAME - while getopts "n:p:" opt; do + local PREF ZONEINFO_NAME SYSROOT_USR + while getopts "n:p:s:" opt; do case "${opt}" in n) - ZONEINFO_NAME="${OPTARG}" + ZONEINFO_NAME="${OPTARG}" ;; p) PREF="${OPTARG}" ;; + s) + SYSROOT_USR="${OPTARG}" + ;; *) usage ;; esac done - SYSROOT_USR=`ptxd_get_sysroot_usr` - [ ! -d ${SYSROOT_USR} ] && { echo "Toolchain sysroot dir not found"; exit 1; } - [ ! -d ${SYSROOT_USR}/share/zoneinfo ] && { echo "Zoneinfo dir not found"; exit 1; } + [ -z ${SYSROOT_USR} ] && SYSROOT_USR=`ptxd_get_sysroot_usr` + [ ! -d ${SYSROOT_USR} ] && { echo "Toolchain sysroot dir (${SYSROOT_USR}) not found"; exit 1; } + [ ! -d ${SYSROOT_USR}/share/zoneinfo ] && { echo "Zoneinfo dir (${SYSROOT_USR}) not found"; exit 1; } if [ ! -d ${PREF}/zoneinfo ]; then mkdir -p ${PREF}/zoneinfo |