The TZData package contains code and data that represent the history of local time for many representative locations around the globe."
Create the PKGBUILD for the TZ Data package with the following commands:
mkdir /sources/tzdata
cd /sources/tzdata
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="tzdata"
_ver="2025a"
pkgver=${_ver/[a-z]/.${_ver//[0-9.]/}}
pkgrel="1"
pkgdesc="The Time Zone Database (often called tz or zoneinfo) contains code and data that represent the history of local time for many representative locations around the globe."
arch=('x86'
'x86_64')
url="http://www.iana.org/time-zones/"
license=('PD')
groups=('core')
options=('!debug'
'!emptydirs'
'!strip')
depends=('bash'
'glibc')
makedepends=('binutils'
'coreutils'
'gcc'
'gzip'
'make'
'sed'
'tar')
source=('https://www.iana.org/time-zones/repository/releases/tzdata2025a.tar.gz'
'https://www.iana.org/time-zones/repository/releases/tzcode2025a.tar.gz')
md5sums=('404229390c06b7440f5e48d12c1a3251'
'c690058bd8c597041241e9edc870e127')
_timezones=('africa' 'antarctica' 'asia' 'australasia' 'europe' 'northamerica' 'southamerica' 'etcetera' 'backward' 'factory')
build() {
make LFLAGS="${LDFLAGS} ${LTOFLAGS}" CC="gcc -std=c99"
}
package() {
cd "${srcdir}"
# install tzcode stuff
make DESTDIR="${pkgdir}" install
# install tzdata stuff
./zic -b fat -d "${pkgdir}"/usr/share/zoneinfo ${_timezones[@]}
./zic -b fat -d "${pkgdir}"/usr/share/zoneinfo/posix ${_timezones[@]}
./zic -b fat -d "${pkgdir}"/usr/share/zoneinfo/right -L leapseconds ${_timezones[@]}
# This creates the posixrules file.
# We use New York because POSIX requires the daylight savings time rules
# to be in accordance with US rules.
./zic -b fat -d "${pkgdir}"/usr/share/zoneinfo -p America/New_York
install -m644 -t "${pkgdir}"/usr/share/zoneinfo \
iso3166.tab leap-seconds.list \
zone1970.tab zone.tab SECURITY
# zone.tab is depricated and will go soon
# cleanup
rm "${pkgdir}/etc/localtime"
}
REALEOF
The meaning of the zic commands:
zic -L /dev/null
...
This creates posix time zones without any leap seconds. It is
conventional to put these in both zoneinfo and zoneinfo/posix. It is necessary to put the
POSIX time zones in zoneinfo,
otherwise various test-suites will report errors. On an
embedded system, where space is tight and you do not intend
to ever update the time zones, you could save 1.9 MB by not
using the posix directory, but
some applications or test-suites might produce some failures.
zic -L
leapseconds ...
This creates right time zones, including leap seconds. On an
embedded system, where space is tight and you do not intend
to ever update the time zones, or care about the correct
time, you could save 1.9MB by omitting the right directory.
zic ... -p
...
This creates the posixrules
file. We use New York because POSIX requires the daylight
savings time rules to be in accordance with US rules.
Prepare the build directory for the pacman user and build the package:
chown -R root:pacman . chmod 2775 . chmod 664 PKGBUILD su pacman -c 'makepkg -L --nodeps'
Add the newly created package to the central package repository:
_ver=2025a
pkgver=${_ver/[a-z]/.${_ver//[0-9.]/}}
cp tzdata-${pkgver}-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/tzdata-${pkgver}-1-$(uname -m).pkg.tar.xz
Update the local cache and install the tzdata package:
pacman -Syu pacman -S tzdata --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean up the build directory:
mkdir /srv/pacman/source/LFS/tzdata cp PKGBUILD /srv/pacman/source/LFS/tzdata cd /sources rm -rf tzdata