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