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