blob: 6aac516f694b147622b059430dd1c113664e14d8 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001require timezone.inc
2
3DEPENDS = "tzcode-native"
4
5inherit allarch
6
7RCONFLICTS_${PN} = "timezones timezone-africa timezone-america timezone-antarctica \
8 timezone-arctic timezone-asia timezone-atlantic \
9 timezone-australia timezone-europe timezone-indian \
10 timezone-iso3166.tab timezone-pacific timezone-zone.tab"
11
12S = "${WORKDIR}"
13
14DEFAULT_TIMEZONE ?= "Universal"
15INSTALL_TIMEZONE_FILE ?= "1"
16
17TZONES= "africa antarctica asia australasia europe northamerica southamerica \
18 factory etcetera backward systemv \
19 "
20# pacificnew
21
22do_compile () {
23 for zone in ${TZONES}; do \
24 ${STAGING_BINDIR_NATIVE}/zic -d ${WORKDIR}${datadir}/zoneinfo -L /dev/null \
25 -y ${S}/yearistype.sh ${S}/${zone} ; \
26 ${STAGING_BINDIR_NATIVE}/zic -d ${WORKDIR}${datadir}/zoneinfo/posix -L /dev/null \
27 -y ${S}/yearistype.sh ${S}/${zone} ; \
28 ${STAGING_BINDIR_NATIVE}/zic -d ${WORKDIR}${datadir}/zoneinfo/right -L ${S}/leapseconds \
29 -y ${S}/yearistype.sh ${S}/${zone} ; \
30 done
31}
32
33do_install () {
34 install -d ${D}/$exec_prefix ${D}${datadir}/zoneinfo
35 cp -pPR ${S}/$exec_prefix ${D}/
36 # libc is removing zoneinfo files from package
37 cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
38 cp -pP "${S}/zone1970.tab" ${D}${datadir}/zoneinfo
39 cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
Andrew Geisslerc9f78652020-09-18 14:11:35 -050040 cp -pP "${S}/leapseconds" ${D}${datadir}/zoneinfo
41 cp -pP "${S}/leap-seconds.list" ${D}${datadir}/zoneinfo
Brad Bishop19323692019-04-05 15:28:33 -040042
43 # Install default timezone
44 if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
45 install -d ${D}${sysconfdir}
46 if [ "${INSTALL_TIMEZONE_FILE}" = "1" ]; then
47 echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
48 fi
49 ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
50 else
51 bberror "DEFAULT_TIMEZONE is set to an invalid value."
52 exit 1
53 fi
54
55 chown -R root:root ${D}
56}
57
58pkg_postinst_${PN} () {
59 etc_lt="$D${sysconfdir}/localtime"
60 src="$D${sysconfdir}/timezone"
61
62 if [ -e ${src} ] ; then
63 tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
64 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -050065
66 if [ ! -z "${tz}" -a ! -e "$D${datadir}/zoneinfo/${tz}" ] ; then
Brad Bishop19323692019-04-05 15:28:33 -040067 echo "You have an invalid TIMEZONE setting in ${src}"
68 echo "Your ${etc_lt} has been reset to Universal; enjoy!"
69 tz="Universal"
70 echo "Updating ${etc_lt} with $D${datadir}/zoneinfo/${tz}"
71 if [ -L ${etc_lt} ] ; then
72 rm -f "${etc_lt}"
73 fi
74 ln -s "${datadir}/zoneinfo/${tz}" "${etc_lt}"
75 fi
76}
77
78# Packages primarily organized by directory with a major city
79# in most time zones in the base package
80
81TZ_PACKAGES = " \
82 tzdata-core tzdata-misc tzdata-posix tzdata-right tzdata-africa \
83 tzdata-americas tzdata-antarctica tzdata-arctic tzdata-asia \
84 tzdata-atlantic tzdata-australia tzdata-europe tzdata-pacific"
85PACKAGES = "${TZ_PACKAGES} ${PN}"
86
87FILES_tzdata-africa += "${datadir}/zoneinfo/Africa/*"
88RPROVIDES_tzdata-africa = "tzdata-africa"
89
90FILES_tzdata-americas += "${datadir}/zoneinfo/America/* \
91 ${datadir}/zoneinfo/US/* \
92 ${datadir}/zoneinfo/Brazil/* \
93 ${datadir}/zoneinfo/Canada/* \
94 ${datadir}/zoneinfo/Mexico/* \
95 ${datadir}/zoneinfo/Chile/*"
96RPROVIDES_tzdata-americas = "tzdata-americas"
97
98FILES_tzdata-antarctica += "${datadir}/zoneinfo/Antarctica/*"
99RPROVIDES_tzdata-antarctica = "tzdata-antarctica"
100
101FILES_tzdata-arctic += "${datadir}/zoneinfo/Arctic/*"
102RPROVIDES_tzdata-arctic = "tzdata-arctic"
103
104FILES_tzdata-asia += "${datadir}/zoneinfo/Asia/* \
105 ${datadir}/zoneinfo/Indian/* \
106 ${datadir}/zoneinfo/Mideast/*"
107RPROVIDES_tzdata-asia = "tzdata-asia"
108
109FILES_tzdata-atlantic += "${datadir}/zoneinfo/Atlantic/*"
110RPROVIDES_tzdata-atlantic = "tzdata-atlantic"
111
112FILES_tzdata-australia += "${datadir}/zoneinfo/Australia/*"
113RPROVIDES_tzdata-australia = "tzdata-australia"
114
115FILES_tzdata-europe += "${datadir}/zoneinfo/Europe/*"
116RPROVIDES_tzdata-europe = "tzdata-europe"
117
118FILES_tzdata-pacific += "${datadir}/zoneinfo/Pacific/*"
119RPROVIDES_tzdata-pacific = "tzdata-pacific"
120
121FILES_tzdata-posix += "${datadir}/zoneinfo/posix/*"
122RPROVIDES_tzdata-posix = "tzdata-posix"
123
124FILES_tzdata-right += "${datadir}/zoneinfo/right/*"
125RPROVIDES_tzdata-right = "tzdata-right"
126
127FILES_tzdata-misc += "${datadir}/zoneinfo/Cuba \
128 ${datadir}/zoneinfo/Egypt \
129 ${datadir}/zoneinfo/Eire \
130 ${datadir}/zoneinfo/Factory \
131 ${datadir}/zoneinfo/GB-Eire \
132 ${datadir}/zoneinfo/Hongkong \
133 ${datadir}/zoneinfo/Iceland \
134 ${datadir}/zoneinfo/Iran \
135 ${datadir}/zoneinfo/Israel \
136 ${datadir}/zoneinfo/Jamaica \
137 ${datadir}/zoneinfo/Japan \
138 ${datadir}/zoneinfo/Kwajalein \
139 ${datadir}/zoneinfo/Libya \
140 ${datadir}/zoneinfo/Navajo \
141 ${datadir}/zoneinfo/Poland \
142 ${datadir}/zoneinfo/Portugal \
143 ${datadir}/zoneinfo/Singapore \
144 ${datadir}/zoneinfo/Turkey"
145RPROVIDES_tzdata-misc = "tzdata-misc"
146
147FILES_tzdata-core += " \
Brad Bishopa34c0302019-09-23 22:34:48 -0400148 ${sysconfdir}/localtime \
149 ${sysconfdir}/timezone \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500150 ${datadir}/zoneinfo/leapseconds \
151 ${datadir}/zoneinfo/leap-seconds.list \
Brad Bishop19323692019-04-05 15:28:33 -0400152 ${datadir}/zoneinfo/Pacific/Honolulu \
153 ${datadir}/zoneinfo/America/Anchorage \
154 ${datadir}/zoneinfo/America/Los_Angeles \
155 ${datadir}/zoneinfo/America/Denver \
156 ${datadir}/zoneinfo/America/Chicago \
157 ${datadir}/zoneinfo/America/New_York \
158 ${datadir}/zoneinfo/America/Caracas \
159 ${datadir}/zoneinfo/America/Sao_Paulo \
160 ${datadir}/zoneinfo/Europe/London \
161 ${datadir}/zoneinfo/Europe/Paris \
162 ${datadir}/zoneinfo/Africa/Cairo \
163 ${datadir}/zoneinfo/Europe/Moscow \
164 ${datadir}/zoneinfo/Asia/Dubai \
165 ${datadir}/zoneinfo/Asia/Karachi \
166 ${datadir}/zoneinfo/Asia/Dhaka \
167 ${datadir}/zoneinfo/Asia/Bangkok \
168 ${datadir}/zoneinfo/Asia/Hong_Kong \
169 ${datadir}/zoneinfo/Asia/Tokyo \
170 ${datadir}/zoneinfo/Australia/Darwin \
171 ${datadir}/zoneinfo/Australia/Adelaide \
172 ${datadir}/zoneinfo/Australia/Brisbane \
173 ${datadir}/zoneinfo/Australia/Sydney \
174 ${datadir}/zoneinfo/Pacific/Noumea \
175 ${datadir}/zoneinfo/CET \
176 ${datadir}/zoneinfo/CST6CDT \
177 ${datadir}/zoneinfo/EET \
178 ${datadir}/zoneinfo/EST \
179 ${datadir}/zoneinfo/EST5EDT \
180 ${datadir}/zoneinfo/GB \
181 ${datadir}/zoneinfo/GMT \
182 ${datadir}/zoneinfo/GMT+0 \
183 ${datadir}/zoneinfo/GMT-0 \
184 ${datadir}/zoneinfo/GMT0 \
185 ${datadir}/zoneinfo/Greenwich \
186 ${datadir}/zoneinfo/HST \
187 ${datadir}/zoneinfo/MET \
188 ${datadir}/zoneinfo/MST \
189 ${datadir}/zoneinfo/MST7MDT \
190 ${datadir}/zoneinfo/NZ \
191 ${datadir}/zoneinfo/NZ-CHAT \
192 ${datadir}/zoneinfo/PRC \
193 ${datadir}/zoneinfo/PST8PDT \
194 ${datadir}/zoneinfo/ROC \
195 ${datadir}/zoneinfo/ROK \
196 ${datadir}/zoneinfo/UCT \
197 ${datadir}/zoneinfo/UTC \
198 ${datadir}/zoneinfo/Universal \
199 ${datadir}/zoneinfo/W-SU \
200 ${datadir}/zoneinfo/WET \
201 ${datadir}/zoneinfo/Zulu \
202 ${datadir}/zoneinfo/zone.tab \
203 ${datadir}/zoneinfo/zone1970.tab \
204 ${datadir}/zoneinfo/iso3166.tab \
205 ${datadir}/zoneinfo/Etc/*"
206
Brad Bishopa34c0302019-09-23 22:34:48 -0400207CONFFILES_tzdata-core = "${sysconfdir}/localtime ${sysconfdir}/timezone"
Brad Bishop19323692019-04-05 15:28:33 -0400208
209ALLOW_EMPTY_${PN} = "1"
210RDEPENDS_${PN} = "${TZ_PACKAGES}"