blob: 1e2b440fb0e901a97de859ab28361c9b676a5fe7 [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
Andrew Geissler82c905d2020-04-13 13:39:40 -050063
64 if [ ! -z "${tz}" -a ! -e "$D${datadir}/zoneinfo/${tz}" ] ; then
Brad Bishop19323692019-04-05 15:28:33 -040065 echo "You have an invalid TIMEZONE setting in ${src}"
66 echo "Your ${etc_lt} has been reset to Universal; enjoy!"
67 tz="Universal"
68 echo "Updating ${etc_lt} with $D${datadir}/zoneinfo/${tz}"
69 if [ -L ${etc_lt} ] ; then
70 rm -f "${etc_lt}"
71 fi
72 ln -s "${datadir}/zoneinfo/${tz}" "${etc_lt}"
73 fi
74}
75
76# Packages primarily organized by directory with a major city
77# in most time zones in the base package
78
79TZ_PACKAGES = " \
80 tzdata-core tzdata-misc tzdata-posix tzdata-right tzdata-africa \
81 tzdata-americas tzdata-antarctica tzdata-arctic tzdata-asia \
82 tzdata-atlantic tzdata-australia tzdata-europe tzdata-pacific"
83PACKAGES = "${TZ_PACKAGES} ${PN}"
84
85FILES_tzdata-africa += "${datadir}/zoneinfo/Africa/*"
86RPROVIDES_tzdata-africa = "tzdata-africa"
87
88FILES_tzdata-americas += "${datadir}/zoneinfo/America/* \
89 ${datadir}/zoneinfo/US/* \
90 ${datadir}/zoneinfo/Brazil/* \
91 ${datadir}/zoneinfo/Canada/* \
92 ${datadir}/zoneinfo/Mexico/* \
93 ${datadir}/zoneinfo/Chile/*"
94RPROVIDES_tzdata-americas = "tzdata-americas"
95
96FILES_tzdata-antarctica += "${datadir}/zoneinfo/Antarctica/*"
97RPROVIDES_tzdata-antarctica = "tzdata-antarctica"
98
99FILES_tzdata-arctic += "${datadir}/zoneinfo/Arctic/*"
100RPROVIDES_tzdata-arctic = "tzdata-arctic"
101
102FILES_tzdata-asia += "${datadir}/zoneinfo/Asia/* \
103 ${datadir}/zoneinfo/Indian/* \
104 ${datadir}/zoneinfo/Mideast/*"
105RPROVIDES_tzdata-asia = "tzdata-asia"
106
107FILES_tzdata-atlantic += "${datadir}/zoneinfo/Atlantic/*"
108RPROVIDES_tzdata-atlantic = "tzdata-atlantic"
109
110FILES_tzdata-australia += "${datadir}/zoneinfo/Australia/*"
111RPROVIDES_tzdata-australia = "tzdata-australia"
112
113FILES_tzdata-europe += "${datadir}/zoneinfo/Europe/*"
114RPROVIDES_tzdata-europe = "tzdata-europe"
115
116FILES_tzdata-pacific += "${datadir}/zoneinfo/Pacific/*"
117RPROVIDES_tzdata-pacific = "tzdata-pacific"
118
119FILES_tzdata-posix += "${datadir}/zoneinfo/posix/*"
120RPROVIDES_tzdata-posix = "tzdata-posix"
121
122FILES_tzdata-right += "${datadir}/zoneinfo/right/*"
123RPROVIDES_tzdata-right = "tzdata-right"
124
125FILES_tzdata-misc += "${datadir}/zoneinfo/Cuba \
126 ${datadir}/zoneinfo/Egypt \
127 ${datadir}/zoneinfo/Eire \
128 ${datadir}/zoneinfo/Factory \
129 ${datadir}/zoneinfo/GB-Eire \
130 ${datadir}/zoneinfo/Hongkong \
131 ${datadir}/zoneinfo/Iceland \
132 ${datadir}/zoneinfo/Iran \
133 ${datadir}/zoneinfo/Israel \
134 ${datadir}/zoneinfo/Jamaica \
135 ${datadir}/zoneinfo/Japan \
136 ${datadir}/zoneinfo/Kwajalein \
137 ${datadir}/zoneinfo/Libya \
138 ${datadir}/zoneinfo/Navajo \
139 ${datadir}/zoneinfo/Poland \
140 ${datadir}/zoneinfo/Portugal \
141 ${datadir}/zoneinfo/Singapore \
142 ${datadir}/zoneinfo/Turkey"
143RPROVIDES_tzdata-misc = "tzdata-misc"
144
145FILES_tzdata-core += " \
Brad Bishopa34c0302019-09-23 22:34:48 -0400146 ${sysconfdir}/localtime \
147 ${sysconfdir}/timezone \
Brad Bishop19323692019-04-05 15:28:33 -0400148 ${datadir}/zoneinfo/Pacific/Honolulu \
149 ${datadir}/zoneinfo/America/Anchorage \
150 ${datadir}/zoneinfo/America/Los_Angeles \
151 ${datadir}/zoneinfo/America/Denver \
152 ${datadir}/zoneinfo/America/Chicago \
153 ${datadir}/zoneinfo/America/New_York \
154 ${datadir}/zoneinfo/America/Caracas \
155 ${datadir}/zoneinfo/America/Sao_Paulo \
156 ${datadir}/zoneinfo/Europe/London \
157 ${datadir}/zoneinfo/Europe/Paris \
158 ${datadir}/zoneinfo/Africa/Cairo \
159 ${datadir}/zoneinfo/Europe/Moscow \
160 ${datadir}/zoneinfo/Asia/Dubai \
161 ${datadir}/zoneinfo/Asia/Karachi \
162 ${datadir}/zoneinfo/Asia/Dhaka \
163 ${datadir}/zoneinfo/Asia/Bangkok \
164 ${datadir}/zoneinfo/Asia/Hong_Kong \
165 ${datadir}/zoneinfo/Asia/Tokyo \
166 ${datadir}/zoneinfo/Australia/Darwin \
167 ${datadir}/zoneinfo/Australia/Adelaide \
168 ${datadir}/zoneinfo/Australia/Brisbane \
169 ${datadir}/zoneinfo/Australia/Sydney \
170 ${datadir}/zoneinfo/Pacific/Noumea \
171 ${datadir}/zoneinfo/CET \
172 ${datadir}/zoneinfo/CST6CDT \
173 ${datadir}/zoneinfo/EET \
174 ${datadir}/zoneinfo/EST \
175 ${datadir}/zoneinfo/EST5EDT \
176 ${datadir}/zoneinfo/GB \
177 ${datadir}/zoneinfo/GMT \
178 ${datadir}/zoneinfo/GMT+0 \
179 ${datadir}/zoneinfo/GMT-0 \
180 ${datadir}/zoneinfo/GMT0 \
181 ${datadir}/zoneinfo/Greenwich \
182 ${datadir}/zoneinfo/HST \
183 ${datadir}/zoneinfo/MET \
184 ${datadir}/zoneinfo/MST \
185 ${datadir}/zoneinfo/MST7MDT \
186 ${datadir}/zoneinfo/NZ \
187 ${datadir}/zoneinfo/NZ-CHAT \
188 ${datadir}/zoneinfo/PRC \
189 ${datadir}/zoneinfo/PST8PDT \
190 ${datadir}/zoneinfo/ROC \
191 ${datadir}/zoneinfo/ROK \
192 ${datadir}/zoneinfo/UCT \
193 ${datadir}/zoneinfo/UTC \
194 ${datadir}/zoneinfo/Universal \
195 ${datadir}/zoneinfo/W-SU \
196 ${datadir}/zoneinfo/WET \
197 ${datadir}/zoneinfo/Zulu \
198 ${datadir}/zoneinfo/zone.tab \
199 ${datadir}/zoneinfo/zone1970.tab \
200 ${datadir}/zoneinfo/iso3166.tab \
201 ${datadir}/zoneinfo/Etc/*"
202
Brad Bishopa34c0302019-09-23 22:34:48 -0400203CONFFILES_tzdata-core = "${sysconfdir}/localtime ${sysconfdir}/timezone"
Brad Bishop19323692019-04-05 15:28:33 -0400204
205ALLOW_EMPTY_${PN} = "1"
206RDEPENDS_${PN} = "${TZ_PACKAGES}"