1require timezone.inc 2 3DEPENDS = "tzcode-native" 4 5inherit allarch 6 7DEFAULT_TIMEZONE ?= "Universal" 8INSTALL_TIMEZONE_FILE ?= "1" 9 10TZONES = " \ 11 africa antarctica asia australasia europe northamerica southamerica \ 12 factory etcetera backward \ 13" 14 15# "slim" is the default since 2020b 16# "fat" is needed by e.g. MariaDB's mysql_tzinfo_to_sql 17ZIC_FMT ?= "slim" 18 19do_configure[cleandirs] = "${B}" 20B = "${WORKDIR}/build" 21 22do_compile() { 23 for zone in ${TZONES}; do 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} 27 done 28} 29 30do_install() { 31 install -d ${D}${datadir}/zoneinfo 32 cp -pPR ${B}/zoneinfo/* ${D}${datadir}/zoneinfo 33 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 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" -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!" 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 are primarily organized by directory with a major city in most time 77# zones in the base package 78TZ_PACKAGES = " \ 79 tzdata-core tzdata-misc tzdata-posix tzdata-right tzdata-africa \ 80 tzdata-americas tzdata-antarctica tzdata-arctic tzdata-asia \ 81 tzdata-atlantic tzdata-australia tzdata-europe tzdata-pacific \ 82" 83PACKAGES = "${TZ_PACKAGES} ${PN}" 84 85FILES:tzdata-africa += "${datadir}/zoneinfo/Africa" 86 87FILES: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" 95 96FILES:tzdata-antarctica += "${datadir}/zoneinfo/Antarctica" 97 98FILES:tzdata-arctic += "${datadir}/zoneinfo/Arctic" 99 100FILES:tzdata-asia += " \ 101 ${datadir}/zoneinfo/Asia \ 102 ${datadir}/zoneinfo/Indian \ 103 ${datadir}/zoneinfo/Mideast \ 104" 105 106FILES:tzdata-atlantic += "${datadir}/zoneinfo/Atlantic" 107 108FILES:tzdata-australia += "${datadir}/zoneinfo/Australia" 109 110FILES:tzdata-europe += "${datadir}/zoneinfo/Europe" 111 112FILES:tzdata-pacific += "${datadir}/zoneinfo/Pacific" 113 114FILES:tzdata-posix += "${datadir}/zoneinfo/posix" 115 116FILES:tzdata-right += "${datadir}/zoneinfo/right" 117 118FILES: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" 138 139FILES:tzdata-core += " \ 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" 199 200CONFFILES:tzdata-core = "${sysconfdir}/localtime ${sysconfdir}/timezone" 201 202ALLOW_EMPTY:${PN} = "1" 203 204RDEPENDS:${PN} = "${TZ_PACKAGES}" 205