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