mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
92bd70fb85
This patch updates files coming from tzcode to the versions in tzcode 2017b. A couple of changes to other glibc code are needed. time/tzset.c was using the SECSPERDAY macro from tzfile.h, which no longer defines that macro, so a local definition is added to tzset.c. Because timezone/private.h now defines the _ macro whenever HAVE_GETTEXT is true, even if it was previously defined, it is also necessary to avoid a conflict with the definition in include/libintl.h. Defining _ISOMAC is the obvious way to avoid such internal definitions being visible, together with defining TZ_DOMAIN so that zic and zdump continue to get the messages from the libc domain as desired. However, zic and zdump rely on PKGVERSION and REPORT_BUGS_TO from config.h, which is not included by default with _ISOMAC, so -include config.h needs adding to the options for these programs as well. Together those changes allow unmodified tzcode 2017b sources to work in glibc. Tested for x86_64. * timezone/private.h: Update from tzcode 2017b. * timezone/tzfile.h: Likewise. * timezone/tzselect.ksh: Likewise. * timezone/zdump.c: Likewise. * timezone/zic.c: Likewise. * timezone/Makefile (tz-cflags): Add -D_ISOMAC -DTZ_DOMAIN='"libc"' -include $(common-objpfx)config.h. * time/tzset.c (SECSPERDAY): New macro.
133 lines
4.4 KiB
Makefile
133 lines
4.4 KiB
Makefile
# Copyright (C) 1998-2017 Free Software Foundation, Inc.
|
|
# This file is part of the GNU C Library.
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
# License as published by the Free Software Foundation; either
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
# The GNU C Library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Lesser General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with the GNU C Library; if not, see
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
# Makefile for timezone information
|
|
#
|
|
subdir := timezone
|
|
|
|
include ../Makeconfig
|
|
|
|
others := zdump zic
|
|
tests := test-tz tst-timezone tst-tzset
|
|
|
|
generated-dirs += testdata
|
|
|
|
generated += tzselect
|
|
|
|
testdata = $(objpfx)testdata
|
|
|
|
ifeq ($(enable-timezone-tools),yes)
|
|
install-sbin := zic zdump
|
|
install-bin-script = tzselect
|
|
endif
|
|
|
|
ifeq ($(run-built-tests),yes)
|
|
# List zones generated by separate commands running zic on the host.
|
|
# Each such zic run counts as a separate test.
|
|
test-zones := America/New_York Etc/UTC UTC Europe/Berlin \
|
|
Australia/Melbourne America/Sao_Paulo Asia/Tokyo \
|
|
$(posixrules-file)
|
|
tests-special += $(addprefix $(testdata)/, $(test-zones))
|
|
endif
|
|
|
|
include ../Rules
|
|
|
|
|
|
$(objpfx)zic.o $(objpfx)zdump.o: $(objpfx)version.h
|
|
|
|
$(objpfx)version.h: $(common-objpfx)config.make
|
|
echo 'static char const TZVERSION[]="$(version)";' \
|
|
> $@.new
|
|
mv -f $@.new $@
|
|
|
|
tz-cflags = -DTZDIR='"$(zonedir)"' \
|
|
-DTZDEFAULT='"$(localtime-file)"' \
|
|
-DTZDEFRULES='"$(posixrules-file)"' \
|
|
-DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone \
|
|
-DHAVE_GETTEXT -DUSE_LTZ=0 -D_ISOMAC -DTZ_DOMAIN='"libc"' \
|
|
-include $(common-objpfx)config.h -Wno-maybe-uninitialized
|
|
|
|
# The -Wno-unused-variable flag is used to prevent GCC 6
|
|
# from warning about time_t_min and time_t_max which are
|
|
# defined in private.h but not used.
|
|
CFLAGS-zdump.c = $(tz-cflags)
|
|
CFLAGS-zic.c = $(tz-cflags) -Wno-unused-variable
|
|
|
|
# We have to make sure the data for testing the tz functions is available.
|
|
# Don't add leapseconds here since test-tz made checks that work only without
|
|
# leapseconds.
|
|
define build-testdata
|
|
$(built-program-cmd) -d $(testdata) -y ./yearistype $<; \
|
|
$(evaluate-test)
|
|
endef
|
|
|
|
$(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
|
|
$(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
|
|
Europe/Berlin Universal \
|
|
Australia/Melbourne \
|
|
America/New_York \
|
|
America/Sao_Paulo Asia/Tokyo \
|
|
Europe/London)
|
|
$(objpfx)tst-tzset.out: $(addprefix $(testdata)/XT, 1 2 3 4)
|
|
|
|
test-tz-ENV = TZDIR=$(testdata)
|
|
tst-timezone-ENV = TZDIR=$(testdata)
|
|
tst-tzset-ENV = TZDIR=$(testdata)
|
|
|
|
# Note this must come second in the deps list for $(built-program-cmd) to work.
|
|
zic-deps = $(objpfx)zic $(leapseconds) yearistype
|
|
|
|
$(testdata)/America/New_York: northamerica $(zic-deps)
|
|
$(build-testdata)
|
|
$(testdata)/$(posixrules-file): $(testdata)/America/New_York
|
|
$(make-link); $(evaluate-test)
|
|
$(testdata)/Etc/UTC: etcetera $(zic-deps)
|
|
$(build-testdata)
|
|
# Use a pattern rule to indicate the command produces both targets at once.
|
|
# Two separate targets built separately can collide if in parallel.
|
|
%/UTC %/Universal: simplebackw $(zic-deps) %/Etc/UTC
|
|
$(build-testdata)
|
|
{ test -r $(@D)/Universal.test-result \
|
|
&& cp $(@D)/Universal.test-result $(@D)/UTC.test-result \
|
|
&& sed -i 's/Universal/UTC/' $(@D)/UTC.test-result ; exit 0; }
|
|
{ test -r $(@D)/UTC.test-result \
|
|
&& cp $(@D)/UTC.test-result $(@D)/Universal.test-result \
|
|
&& sed -i 's/UTC/Universal/' $(@D)/Universal.test-result ; exit 0; }
|
|
$(testdata)/%/Berlin $(testdata)/%/London: europe $(zic-deps)
|
|
$(build-testdata)
|
|
$(testdata)/Australia/Melbourne: australasia $(zic-deps)
|
|
$(build-testdata)
|
|
$(testdata)/America/Sao_Paulo: southamerica $(zic-deps)
|
|
$(build-testdata)
|
|
$(testdata)/Asia/Tokyo: asia $(zic-deps)
|
|
$(build-testdata)
|
|
|
|
$(testdata)/XT%: testdata/XT%
|
|
$(make-target-directory)
|
|
cp $< $@
|
|
|
|
$(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
|
|
sed -e 's|/bin/bash|$(BASH)|' \
|
|
-e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
|
|
-e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
|
|
-e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
|
|
-e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
|
|
< $< > $@.new
|
|
chmod 555 $@.new
|
|
mv -f $@.new $@
|