git: 394cf6719a3c - main - tzcode: Move configuration into separate header.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Jan 2023 10:40:53 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=394cf6719a3c665eabe24d96669409e0c5a78076
commit 394cf6719a3c665eabe24d96669409e0c5a78076
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-01-11 09:20:46 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-01-11 10:39:12 +0000
tzcode: Move configuration into separate header.
MFC after: 1 week
Sponsored by: Klara, Inc.
---
contrib/tzcode/private.h | 19 -------------------
contrib/tzcode/tzconfig.h | 19 +++++++++++++++++++
lib/libc/gen/Makefile.inc | 2 ++
lib/libc/stdtime/Makefile.inc | 17 ++++++++++-------
usr.sbin/zdump/Makefile | 3 +--
usr.sbin/zic/Makefile | 3 +--
6 files changed, 33 insertions(+), 30 deletions(-)
diff --git a/contrib/tzcode/private.h b/contrib/tzcode/private.h
index 0bb70056a9d7..35d2444d4ec1 100644
--- a/contrib/tzcode/private.h
+++ b/contrib/tzcode/private.h
@@ -7,21 +7,8 @@
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
-**
-** $FreeBSD$
*/
-/* Stuff moved from Makefile.inc to reduce clutter */
-#ifndef TM_GMTOFF
-#define TM_GMTOFF tm_gmtoff
-#define TM_ZONE tm_zone
-#define PCTS 1
-#define HAVE_LONG_DOUBLE 1
-#define HAVE_UNISTD_H 1
-#define LOCALE_HOME _PATH_LOCALE
-#define TZDIR "/usr/share/zoneinfo"
-#endif /* ndef TM_GMTOFF */
-
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
@@ -524,12 +511,6 @@ typedef unsigned long uintmax_t;
# define restrict /* empty */
#endif
-#if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
-# define ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define ATTRIBUTE_PURE /* empty */
-#endif
-
/*
** Workarounds for compilers/systems.
*/
diff --git a/contrib/tzcode/tzconfig.h b/contrib/tzcode/tzconfig.h
new file mode 100644
index 000000000000..730043b36526
--- /dev/null
+++ b/contrib/tzcode/tzconfig.h
@@ -0,0 +1,19 @@
+#ifndef TZCONFIG_H_INCLUDED
+#define TZCONFIG_H_INCLUDED
+
+#define TM_GMTOFF tm_gmtoff
+#define TM_ZONE tm_zone
+
+#define HAVE_GETTEXT false
+#define HAVE_SYS_STAT_H true
+#define HAVE_UNISTD_H true
+#define HAVE_STDINT_H true
+
+#define PCTS 1
+#define NETBSD_INSPIRED 0
+#define STD_INSPIRED 1
+#define HAVE_TZNAME 2
+#define USG_COMPAT 0
+#define ALTZONE 0
+
+#endif /* !TZCONFIG_H_INCLUDED */
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 45977b6b9005..f222565fd0bc 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -176,6 +176,8 @@ SRCS+= __getosreldate.c \
CFLAGS.arc4random.c= -I${SRCTOP}/sys -I${SRCTOP}/sys/crypto/chacha20
+CFLAGS.sysconf.c= -I${SRCTOP}/contrib/tzcode
+
CFLAGS.dlfcn.c= ${RTLD_HDRS}
CFLAGS.tls.c= ${RTLD_HDRS}
diff --git a/lib/libc/stdtime/Makefile.inc b/lib/libc/stdtime/Makefile.inc
index a7ef64650ba1..a55cbbb17e24 100644
--- a/lib/libc/stdtime/Makefile.inc
+++ b/lib/libc/stdtime/Makefile.inc
@@ -3,17 +3,20 @@
.PATH: ${LIBC_SRCTOP}/stdtime ${SRCTOP}/contrib/tzcode
-SRCS+= asctime.c difftime.c localtime.c strftime.c strptime.c timelocal.c \
- time32.c
+TZCODE_SRCS= asctime.c difftime.c localtime.c
+STDTIME_SRCS= strftime.c strptime.c timelocal.c
+SRCS+= ${TZCODE_SRCS} ${STDTIME_SRCS} time32.c
-SYM_MAPS+= ${LIBC_SRCTOP}/stdtime/Symbol.map
+SYM_MAPS+= ${LIBC_SRCTOP}/stdtime/Symbol.map
-CFLAGS+= -I${SRCTOP}/contrib/tzcode -I${LIBC_SRCTOP}/stdtime
+.for src in ${TZCODE_SRCS} ${STDTIME_SRCS}
+CFLAGS.${src}+= -I${SRCTOP}/contrib/tzcode -include tzconfig.h
+.endfor
+.for src in ${STDTIME_SRCS}
+CFLAGS.${src}+= -I${LIBC_SRCTOP}/stdtime
+.endfor
-CFLAGS.localtime.c= -fwrapv
CFLAGS.localtime.c+= -DALL_STATE -DTHREAD_SAFE
-CFLAGS.localtime.c+= -DHAVE_TZNAME=2 -DUSG_COMPAT=0 -DALTZONE=0
-CFLAGS.localtime.c+= -DNETBSD_INSPIRED=0 -DSTD_INSPIRED=1
.if ${MK_DETECT_TZ_CHANGES} != "no"
CFLAGS.localtime.c+= -DDETECT_TZ_CHANGES
.endif
diff --git a/usr.sbin/zdump/Makefile b/usr.sbin/zdump/Makefile
index 43e4edaae2b6..cbf7c5c566c8 100644
--- a/usr.sbin/zdump/Makefile
+++ b/usr.sbin/zdump/Makefile
@@ -6,7 +6,6 @@ PROG= zdump
MAN= zdump.8
SRCS= zdump.c
-CFLAGS+= -DNETBSD_INSPIRED=0 -DSTD_INSPIRED=1
-CFLAGS+= -I${SRCTOP}/contrib/tzcode
+CFLAGS+= -I${SRCTOP}/contrib/tzcode -include tzconfig.h
.include <bsd.prog.mk>
diff --git a/usr.sbin/zic/Makefile b/usr.sbin/zic/Makefile
index a3eb6f7dadba..88d3f12c3016 100644
--- a/usr.sbin/zic/Makefile
+++ b/usr.sbin/zic/Makefile
@@ -6,7 +6,6 @@ PROG= zic
MAN= zic.8
SRCS= zic.c
-CFLAGS+= -DNETBSD_INSPIRED=0 -DSTD_INSPIRED=1
-CFLAGS+= -I${SRCTOP}/contrib/tzcode
+CFLAGS+= -I${SRCTOP}/contrib/tzcode -include tzconfig.h
.include <bsd.prog.mk>