aboutsummaryrefslogtreecommitdiffstats
path: root/misc/zoneinfo/Makefile
blob: 15ea4a5efd6e1426fac853687bfda87218f0bb23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Created by: Edwin Groothuis <edwin@mavetju.org>
# $FreeBSD$

PORTNAME=   zoneinfo
DISTVERSION=    2014e
CATEGORIES= misc
MASTER_SITES=   ftp://ftp.iana.org/tz/releases/ \
        ftp://munnari.oz.au/pub/
DISTNAME=   tzdata${DISTVERSION}

MAINTAINER= edwin@mavetju.org
COMMENT=    Updated timezone definitions

WRKSRC=     ${WRKDIR}
PREFIX=     /usr

TZFILES=    africa antarctica asia australasia etcetera europe \
        factory northamerica southamerica systemv
POSIXRULES= America/New_York

# Prevent packages if on the FreeBSD building cluster. This because
# it overwrites system files and directories.
.if defined(PACKAGE_BUILDING)
NO_PACKAGE= Overwrites files in the base system
.endif

# Make sure it breaks when the distfile isn't there anymore.
.if !defined(PACKAGE_BUILDING)
MASTER_SITES+=  http://people.freebsd.org/~edwin/
.endif

.include <bsd.port.pre.mk>

# The following country codes can be missing from /usr/share/misc/iso3166 and
# shouldn't appear in the zoneinfo file.
MISSING=    ax bl bq cw gg im je me mf rs ss sx

.ifndef NOMISSING
.for M in ${MISSING}
HAS_${M:tu}!=   ${GREP} -c ^${M:tu} /usr/share/misc/iso3166 || ${TRUE}
.if ${HAS_${M:tu}} == "0"
EXTRA_PATCHES+= ${FILESDIR}/patchremove-${M}
.endif
.endfor
.endif

do-build:
    umask 022; \
    cd ${WRKSRC}; \
    zic -d ${WRKSRC}/zoneinfo -p ${POSIXRULES} -m ${NOBINMODE} \
        ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}

do-install:
    ${MKDIR} ${STAGEDIR}${PREFIX}/share/zoneinfo
    ${CP} -R -p ${WRKSRC}/zoneinfo/ ${STAGEDIR}${PREFIX}/share/zoneinfo
    ${INSTALL_DATA} ${WRKSRC}/zone.tab ${STAGEDIR}${PREFIX}/share/zoneinfo

post-install:
    @if [ -f /var/db/zoneinfo -a -O /var/db/zoneinfo -a \
         -G /var/db/zoneinfo -a \
         -f /usr/share/zoneinfo/$$(cat /var/db/zoneinfo) ]; then \
        tzsetup -r; \
        echo "/etc/localtime is updated."; \
    else \
        ${CAT} ${PKGMESSAGE}; \
    fi

test-patches:
.for M in ${MISSING}
    make clean
    NOMISSING=1 EXTRA_PATCHES=${FILESDIR}/patchremove-${M} make patch
.endfor

.include <bsd.port.post.mk>