blob: 82fe369baa948672f9de8e5f252badae62189776 [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
40
41 # Install default timezone
42 if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
43 install -d ${D}${sysconfdir}
44 if [ "${INSTALL_TIMEZONE_FILE}" = "1" ]; then
45 echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
46 fi
47 ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
48 else
49 bberror "DEFAULT_TIMEZONE is set to an invalid value."
50 exit 1
51 fi
52
53 chown -R root:root ${D}
54}
55
56pkg_postinst_${PN} () {
57 etc_lt="$D${sysconfdir}/localtime"
58 src="$D${sysconfdir}/timezone"
59
60 if [ -e ${src} ] ; then
61 tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
62 fi
63
64 if [ -z "${tz}" ] ; then
65 exit 0
66 fi
67
68 if [ ! -e "$D${datadir}/zoneinfo/${tz}" ] ; then
69 echo "You have an invalid TIMEZONE setting in ${src}"
70 echo "Your ${etc_lt} has been reset to Universal; enjoy!"
71 tz="Universal"
72 echo "Updating ${etc_lt} with $D${datadir}/zoneinfo/${tz}"
73 if [ -L ${etc_lt} ] ; then
74 rm -f "${etc_lt}"
75 fi
76 ln -s "${datadir}/zoneinfo/${tz}" "${etc_lt}"
77 fi
78}
79
80# Packages primarily organized by directory with a major city
81# in most time zones in the base package
82
83TZ_PACKAGES = " \
84 tzdata-core tzdata-misc tzdata-posix tzdata-right tzdata-africa \
85 tzdata-americas tzdata-antarctica tzdata-arctic tzdata-asia \
86 tzdata-atlantic tzdata-australia tzdata-europe tzdata-pacific"
87PACKAGES = "${TZ_PACKAGES} ${PN}"
88
89FILES_tzdata-africa += "${datadir}/zoneinfo/Africa/*"
90RPROVIDES_tzdata-africa = "tzdata-africa"
91
92FILES_tzdata-americas += "${datadir}/zoneinfo/America/* \
93 ${datadir}/zoneinfo/US/* \
94 ${datadir}/zoneinfo/Brazil/* \
95 ${datadir}/zoneinfo/Canada/* \
96 ${datadir}/zoneinfo/Mexico/* \
97 ${datadir}/zoneinfo/Chile/*"
98RPROVIDES_tzdata-americas = "tzdata-americas"
99
100FILES_tzdata-antarctica += "${datadir}/zoneinfo/Antarctica/*"
101RPROVIDES_tzdata-antarctica = "tzdata-antarctica"
102
103FILES_tzdata-arctic += "${datadir}/zoneinfo/Arctic/*"
104RPROVIDES_tzdata-arctic = "tzdata-arctic"
105
106FILES_tzdata-asia += "${datadir}/zoneinfo/Asia/* \
107 ${datadir}/zoneinfo/Indian/* \
108 ${datadir}/zoneinfo/Mideast/*"
109RPROVIDES_tzdata-asia = "tzdata-asia"
110
111FILES_tzdata-atlantic += "${datadir}/zoneinfo/Atlantic/*"
112RPROVIDES_tzdata-atlantic = "tzdata-atlantic"
113
114FILES_tzdata-australia += "${datadir}/zoneinfo/Australia/*"
115RPROVIDES_tzdata-australia = "tzdata-australia"
116
117FILES_tzdata-europe += "${datadir}/zoneinfo/Europe/*"
118RPROVIDES_tzdata-europe = "tzdata-europe"
119
120FILES_tzdata-pacific += "${datadir}/zoneinfo/Pacific/*"
121RPROVIDES_tzdata-pacific = "tzdata-pacific"
122
123FILES_tzdata-posix += "${datadir}/zoneinfo/posix/*"
124RPROVIDES_tzdata-posix = "tzdata-posix"
125
126FILES_tzdata-right += "${datadir}/zoneinfo/right/*"
127RPROVIDES_tzdata-right = "tzdata-right"
128
129FILES_tzdata-misc += "${datadir}/zoneinfo/Cuba \
130 ${datadir}/zoneinfo/Egypt \
131 ${datadir}/zoneinfo/Eire \
132 ${datadir}/zoneinfo/Factory \
133 ${datadir}/zoneinfo/GB-Eire \
134 ${datadir}/zoneinfo/Hongkong \
135 ${datadir}/zoneinfo/Iceland \
136 ${datadir}/zoneinfo/Iran \
137 ${datadir}/zoneinfo/Israel \
138 ${datadir}/zoneinfo/Jamaica \
139 ${datadir}/zoneinfo/Japan \
140 ${datadir}/zoneinfo/Kwajalein \
141 ${datadir}/zoneinfo/Libya \
142 ${datadir}/zoneinfo/Navajo \
143 ${datadir}/zoneinfo/Poland \
144 ${datadir}/zoneinfo/Portugal \
145 ${datadir}/zoneinfo/Singapore \
146 ${datadir}/zoneinfo/Turkey"
147RPROVIDES_tzdata-misc = "tzdata-misc"
148
149FILES_tzdata-core += " \
150 ${datadir}/zoneinfo/Pacific/Honolulu \
151 ${datadir}/zoneinfo/America/Anchorage \
152 ${datadir}/zoneinfo/America/Los_Angeles \
153 ${datadir}/zoneinfo/America/Denver \
154 ${datadir}/zoneinfo/America/Chicago \
155 ${datadir}/zoneinfo/America/New_York \
156 ${datadir}/zoneinfo/America/Caracas \
157 ${datadir}/zoneinfo/America/Sao_Paulo \
158 ${datadir}/zoneinfo/Europe/London \
159 ${datadir}/zoneinfo/Europe/Paris \
160 ${datadir}/zoneinfo/Africa/Cairo \
161 ${datadir}/zoneinfo/Europe/Moscow \
162 ${datadir}/zoneinfo/Asia/Dubai \
163 ${datadir}/zoneinfo/Asia/Karachi \
164 ${datadir}/zoneinfo/Asia/Dhaka \
165 ${datadir}/zoneinfo/Asia/Bangkok \
166 ${datadir}/zoneinfo/Asia/Hong_Kong \
167 ${datadir}/zoneinfo/Asia/Tokyo \
168 ${datadir}/zoneinfo/Australia/Darwin \
169 ${datadir}/zoneinfo/Australia/Adelaide \
170 ${datadir}/zoneinfo/Australia/Brisbane \
171 ${datadir}/zoneinfo/Australia/Sydney \
172 ${datadir}/zoneinfo/Pacific/Noumea \
173 ${datadir}/zoneinfo/CET \
174 ${datadir}/zoneinfo/CST6CDT \
175 ${datadir}/zoneinfo/EET \
176 ${datadir}/zoneinfo/EST \
177 ${datadir}/zoneinfo/EST5EDT \
178 ${datadir}/zoneinfo/GB \
179 ${datadir}/zoneinfo/GMT \
180 ${datadir}/zoneinfo/GMT+0 \
181 ${datadir}/zoneinfo/GMT-0 \
182 ${datadir}/zoneinfo/GMT0 \
183 ${datadir}/zoneinfo/Greenwich \
184 ${datadir}/zoneinfo/HST \
185 ${datadir}/zoneinfo/MET \
186 ${datadir}/zoneinfo/MST \
187 ${datadir}/zoneinfo/MST7MDT \
188 ${datadir}/zoneinfo/NZ \
189 ${datadir}/zoneinfo/NZ-CHAT \
190 ${datadir}/zoneinfo/PRC \
191 ${datadir}/zoneinfo/PST8PDT \
192 ${datadir}/zoneinfo/ROC \
193 ${datadir}/zoneinfo/ROK \
194 ${datadir}/zoneinfo/UCT \
195 ${datadir}/zoneinfo/UTC \
196 ${datadir}/zoneinfo/Universal \
197 ${datadir}/zoneinfo/W-SU \
198 ${datadir}/zoneinfo/WET \
199 ${datadir}/zoneinfo/Zulu \
200 ${datadir}/zoneinfo/zone.tab \
201 ${datadir}/zoneinfo/zone1970.tab \
202 ${datadir}/zoneinfo/iso3166.tab \
203 ${datadir}/zoneinfo/Etc/*"
204
205CONFFILES_tzdata-core += "${@ "${sysconfdir}/timezone" if bb.utils.to_boolean(d.getVar('INSTALL_TIMEZONE_FILE')) else "" }"
206CONFFILES_tzdata-core += "${sysconfdir}/localtime"
207
208ALLOW_EMPTY_${PN} = "1"
209RDEPENDS_${PN} = "${TZ_PACKAGES}"