svn commit: r319192 - in stable/11: . gnu/usr.bin lib share/mk tools/build/mk tools/build/options usr.bin usr.sbin usr.sbin/tzsetup

Ngie Cooper ngie at FreeBSD.org
Tue May 30 07:28:29 UTC 2017


Author: ngie
Date: Tue May 30 07:28:27 2017
New Revision: 319192
URL: https://svnweb.freebsd.org/changeset/base/319192

Log:
  MFC r306375,r307802:
  
  r306375 (by emaste):
  
  Add a WITHOUT_DIALOG src.conf(5) knob
  
  It also turns off dependencies (bsdinstall, bsdconfig, dpv, tzsetup).
  
  r307802 (by bapt):
  
  Fix build of tzsetup when WITHOUT_DIALOG is set
  
  Hide dialog specific code behind HAVE_DIALOG. It allows to build a stripped
  down version (missing the dialog UI) but perfectly function tzsetup when
  world is built WITHOUT_DIALOG
  
  Reorganise a bit the code to limit the number of blocks under HAVE_DIALOG

Added:
  stable/11/tools/build/options/WITHOUT_DIALOG
     - copied unchanged from r306375, head/tools/build/options/WITHOUT_DIALOG
Modified:
  stable/11/Makefile.inc1
  stable/11/gnu/usr.bin/Makefile
  stable/11/lib/Makefile
  stable/11/share/mk/src.opts.mk
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
  stable/11/usr.bin/Makefile
  stable/11/usr.sbin/Makefile
  stable/11/usr.sbin/tzsetup/Makefile
  stable/11/usr.sbin/tzsetup/tzsetup.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/Makefile.inc1
==============================================================================
--- stable/11/Makefile.inc1	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/Makefile.inc1	Tue May 30 07:28:27 2017	(r319192)
@@ -2049,8 +2049,7 @@ _prebuild_libs=	${_kerberos5_lib_libasn1} \
 		${_cddl_lib_libctf} \
 		lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
 		${_secure_lib_libcrypto} ${_lib_libldns} \
-		${_secure_lib_libssh} ${_secure_lib_libssl} \
-		gnu/lib/libdialog
+		${_secure_lib_libssh} ${_secure_lib_libssl}
 
 .if ${MK_GNUCXX} != "no"
 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
@@ -2058,6 +2057,11 @@ gnu/lib/libstdc++__L: lib/msun__L
 gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
 .endif
 
+.if ${MK_DIALOG} != "no"
+_prebuild_libs+= gnu/lib/libdialog
+gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
+.endif
+
 .if ${MK_LIBCPLUSPLUS} != "no"
 _prebuild_libs+= lib/libc++
 .endif
@@ -2203,8 +2207,6 @@ lib/libproc__L: lib/libcxxrt__L
 lib/libproc__L: gnu/lib/libsupc++__L
 .endif
 .endif
-
-gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
 
 .for _lib in ${_prereq_libs}
 ${_lib}__PL: .PHONY .MAKE

Modified: stable/11/gnu/usr.bin/Makefile
==============================================================================
--- stable/11/gnu/usr.bin/Makefile	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/gnu/usr.bin/Makefile	Tue May 30 07:28:27 2017	(r319192)
@@ -4,7 +4,6 @@
 
 SUBDIR= ${_binutils} \
 	${_cc} \
-	dialog \
 	diff \
 	diff3 \
 	${_dtc} \
@@ -48,6 +47,8 @@ _gdb=		gdb
 .if ${MK_GCC} != "no"
 _cc=		cc
 .endif
+
+SUBDIR.${MK_DIALOG}+=	dialog
 
 SUBDIR_PARALLEL=
 

Modified: stable/11/lib/Makefile
==============================================================================
--- stable/11/lib/Makefile	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/lib/Makefile	Tue May 30 07:28:27 2017	(r319192)
@@ -46,7 +46,6 @@ SUBDIR=	${SUBDIR_BOOTSTRAP} \
 	libdevdctl \
 	libdevinfo \
 	libdevstat \
-	libdpv \
 	libdwarf \
 	libedit \
 	${_libefivar} \
@@ -192,6 +191,8 @@ _cuse=		libcuse
 _libelftc=	libelftc
 _libpe=		libpe
 .endif
+
+SUBDIR.${MK_DIALOG}+=	libdpv
 
 .if ${MK_FILE} != "no"
 _libmagic=	libmagic

Modified: stable/11/share/mk/src.opts.mk
==============================================================================
--- stable/11/share/mk/src.opts.mk	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/share/mk/src.opts.mk	Tue May 30 07:28:27 2017	(r319192)
@@ -76,6 +76,7 @@ __DEFAULT_YES_OPTIONS = \
     CTM \
     CUSE \
     CXX \
+    DIALOG \
     DICT \
     DMAGENT \
     DYNAMICROOT \
@@ -330,6 +331,10 @@ MK_KERBEROS:=	no
 MK_CLANG:=	no
 MK_GROFF:=	no
 MK_GNUCXX:=	no
+.endif
+
+.if ${MK_DIALOG} == "no"
+MK_BSDINSTALL:=	no
 .endif
 
 .if ${MK_MAIL} == "no"

Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc	Tue May 30 07:28:27 2017	(r319192)
@@ -1581,6 +1581,25 @@ OLD_FILES+=usr/bin/g++
 OLD_FILES+=usr/libexec/cc1plus
 .endif
 
+.if ${MK_DIALOG} == no
+OLD_FILES+=usr/bin/dialog
+OLD_FILES+=usr/bin/dpv
+OLD_FILES+=usr/lib/libdialog.a
+OLD_FILES+=usr/lib/libdialog.so
+OLD_FILES+=usr/lib/libdialog.so.8
+OLD_FILES+=usr/lib/libdialog_p.a
+OLD_FILES+=usr/lib/libdpv.a
+OLD_FILES+=usr/lib/libdpv.so
+OLD_FILES+=usr/lib/libdpv.so.1
+OLD_FILES+=usr/lib/libdpv_p.a
+OLD_FILES+=usr/sbin/bsdconfig
+OLD_FILES+=usr/share/man/man1/dialog.1.gz
+OLD_FILES+=usr/share/man/man1/dpv.1.gz
+OLD_FILES+=usr/share/man/man3/dialog.3.gz
+OLD_FILES+=usr/share/man/man3/dpv.3.gz
+OLD_FILES+=usr/share/man/man8/bsdconfig.8.gz
+.endif
+
 .if ${MK_FMTREE} == no
 OLD_FILES+=usr/sbin/fmtree
 OLD_FILES+=usr/share/man/man8/fmtree.8.gz

Copied: stable/11/tools/build/options/WITHOUT_DIALOG (from r306375, head/tools/build/options/WITHOUT_DIALOG)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/11/tools/build/options/WITHOUT_DIALOG	Tue May 30 07:28:27 2017	(r319192, copy of r306375, head/tools/build/options/WITHOUT_DIALOG)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to not build dialog(1), dialog(1,3), and dpv(1,3).

Modified: stable/11/usr.bin/Makefile
==============================================================================
--- stable/11/usr.bin/Makefile	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/usr.bin/Makefile	Tue May 30 07:28:27 2017	(r319192)
@@ -36,7 +36,6 @@ SUBDIR=	alias \
 	ctlstat \
 	cut \
 	dirname \
-	dpv \
 	du \
 	elf2aout \
 	elfdump \
@@ -201,6 +200,7 @@ SUBDIR.${MK_BLUETOOTH}+=	bluetooth
 SUBDIR.${MK_BSD_CPIO}+=	cpio
 SUBDIR.${MK_CALENDAR}+=	calendar
 SUBDIR.${MK_CLANG}+=	clang
+SUBDIR.${MK_DIALOG}+=	dpv
 SUBDIR.${MK_EE}+=	ee
 SUBDIR.${MK_FILE}+=	file
 SUBDIR.${MK_FINGER}+=	finger

Modified: stable/11/usr.sbin/Makefile
==============================================================================
--- stable/11/usr.sbin/Makefile	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/usr.sbin/Makefile	Tue May 30 07:28:27 2017	(r319192)
@@ -6,7 +6,6 @@
 SUBDIR=	adduser \
 	arp \
 	binmiscctl \
-	bsdconfig \
 	camdd \
 	cdcontrol \
 	chkgrp \
@@ -123,6 +122,7 @@ SUBDIR.${MK_BOOTPARAMD}+=	bootparamd
 SUBDIR.${MK_BSDINSTALL}+=	bsdinstall
 SUBDIR.${MK_BSNMP}+=	bsnmpd
 SUBDIR.${MK_CTM}+=	ctm
+SUBDIR.${MK_DIALOG}+=	bsdconfig
 SUBDIR.${MK_EFI}+=	efivar efidp
 SUBDIR.${MK_FLOPPY}+=	fdcontrol
 SUBDIR.${MK_FLOPPY}+=	fdformat

Modified: stable/11/usr.sbin/tzsetup/Makefile
==============================================================================
--- stable/11/usr.sbin/tzsetup/Makefile	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/usr.sbin/tzsetup/Makefile	Tue May 30 07:28:27 2017	(r319192)
@@ -1,12 +1,16 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 PROG=	tzsetup
 MAN=	tzsetup.8
 
-CFLAGS+= -I${.CURDIR}/../../contrib/dialog -I.
+CFLAGS+= -I.
 
+.if ${MK_DIALOG} != no
 WARNS?=	3
-
+CFLAGS+=	-I${.CURDIR}/../../contrib/dialog -DHAVE_DIALOG
 LIBADD=	dialog ncursesw
+.endif
 
 .include <bsd.prog.mk>

Modified: stable/11/usr.sbin/tzsetup/tzsetup.c
==============================================================================
--- stable/11/usr.sbin/tzsetup/tzsetup.c	Tue May 30 05:15:09 2017	(r319191)
+++ stable/11/usr.sbin/tzsetup/tzsetup.c	Tue May 30 07:28:27 2017	(r319192)
@@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/stat.h>
 #include <sys/sysctl.h>
 
+#ifdef HAVE_DIALOG
 #include <dialog.h>
+#endif
 
 #define	_PATH_ZONETAB		"/usr/share/zoneinfo/zone.tab"
 #define	_PATH_ISO3166		"/usr/share/misc/iso3166"
@@ -72,6 +74,19 @@ __FBSDID("$FreeBSD$");
 #define DITEM_LEAVE_MENU        (1 << 16)
 #define DITEM_RECREATE          (1 << 18)
 
+static char	path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN],
+		path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN],
+		path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN];
+
+static int reallydoit = 1;
+static int reinstall = 0;
+static char *chrootenv = NULL;
+
+static void	usage(void);
+static int	install_zoneinfo(const char *zoneinfo);
+static int	install_zoneinfo_file(const char *zoneinfo_file);
+
+#ifdef HAVE_DIALOG
 /* for use in describing more exotic behaviors */
 typedef struct dialogMenuItem {
 	char *prompt;
@@ -187,20 +202,10 @@ again:
 	return result;
 }
 
-static char	path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN],
-		path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN],
-		path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN];
-
-static int reallydoit = 1;
-static int reinstall = 0;
 static int usedialog = 1;
-static char *chrootenv = NULL;
 
-static void	usage(void);
 static int	confirm_zone(const char *filename);
 static int	continent_country_menu(dialogMenuItem *);
-static int	install_zoneinfo(const char *zoneinfo);
-static int	install_zoneinfo_file(const char *zoneinfo_file);
 static int	set_zone_multi(dialogMenuItem *);
 static int	set_zone_whole_country(dialogMenuItem *);
 static int	set_zone_menu(dialogMenuItem *);
@@ -644,6 +649,53 @@ set_zone_utc(void)
 }
 
 static int
+confirm_zone(const char *filename)
+{
+	char		title[64], prompt[64];
+	time_t		t = time(0);
+	struct tm	*tm;
+	int		rv;
+
+	setenv("TZ", filename == NULL ? "" : filename, 1);
+	tzset();
+	tm = localtime(&t);
+
+	snprintf(title, sizeof(title), "Confirmation");
+	snprintf(prompt, sizeof(prompt),
+	    "Does the abbreviation `%s' look reasonable?", tm->tm_zone);
+	rv = !dialog_yesno(title, prompt, 5, 72);
+	return (rv);
+}
+
+static int
+set_zone_multi(dialogMenuItem *dmi)
+{
+	struct zone	*zp = dmi->data;
+	int		rv;
+
+	if (!confirm_zone(zp->filename))
+		return (DITEM_FAILURE | DITEM_RECREATE);
+
+	rv = install_zoneinfo(zp->filename);
+	return (rv);
+}
+
+static int
+set_zone_whole_country(dialogMenuItem *dmi)
+{
+	struct country	*cp = dmi->data;
+	int		rv;
+
+	if (!confirm_zone(cp->filename))
+		return (DITEM_FAILURE | DITEM_RECREATE);
+
+	rv = install_zoneinfo(cp->filename);
+	return (rv);
+}
+
+#endif
+
+static int
 install_zoneinfo_file(const char *zoneinfo_file)
 {
 	char		buf[1024];
@@ -672,9 +724,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 		snprintf(prompt, sizeof(prompt),
 		    "Creating symbolic link %s to %s",
 		    path_localtime, zoneinfo_file);
+#ifdef HAVE_DIALOG
 	if (usedialog)
 		dialog_msgbox(title, prompt, 8, 72, 1);
 	else
+#endif
 		fprintf(stderr, "%s\n", prompt);
 #endif
 
@@ -685,9 +739,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				snprintf(prompt, sizeof(prompt),
 				     "Could not delete %s: %s", path_localtime,
 				     strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog)
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 
 				return (DITEM_FAILURE | DITEM_RECREATE);
@@ -697,9 +753,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				snprintf(prompt, sizeof(prompt),
 				     "Could not delete %s: %s", path_db,
 				     strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog)
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 
 				return (DITEM_FAILURE | DITEM_RECREATE);
@@ -708,9 +766,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 			snprintf(title, sizeof(title), "Done");
 			snprintf(prompt, sizeof(prompt),
 			    "Removed %s", path_localtime);
+#ifdef HAVE_DIALOG
 			if (usedialog)
 				dialog_msgbox(title, prompt, 8, 72, 1);
 			else
+#endif
 				fprintf(stderr, "%s\n", prompt);
 #endif
 			return (DITEM_LEAVE_MENU);
@@ -723,9 +783,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				snprintf(prompt, sizeof(prompt),
 				    "Could not open %s: %s", zoneinfo_file,
 				    strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog)
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 				return (DITEM_FAILURE | DITEM_RECREATE);
 			}
@@ -734,10 +796,12 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				snprintf(prompt, sizeof(prompt),
 				    "Could not unlink %s: %s",
 				    path_localtime, strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog) {
 					snprintf(title, sizeof(title), "Error");
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				} else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 				return (DITEM_FAILURE | DITEM_RECREATE);
 			}
@@ -749,9 +813,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				snprintf(prompt, sizeof(prompt),
 				    "Could not open %s: %s",
 				    path_localtime, strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog)
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 				return (DITEM_FAILURE | DITEM_RECREATE);
 			}
@@ -765,9 +831,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				snprintf(prompt, sizeof(prompt),
 				    "Error copying %s to %s %s", zoneinfo_file,
 				    path_localtime, strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog)
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 				/* Better to leave none than a corrupt one. */
 				unlink(path_localtime);
@@ -781,9 +849,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				snprintf(prompt, sizeof(prompt),
 				    "Cannot access %s: %s", zoneinfo_file,
 				    strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog)
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 				return (DITEM_FAILURE | DITEM_RECREATE);
 			}
@@ -791,10 +861,12 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				snprintf(prompt, sizeof(prompt),
 				    "Could not unlink %s: %s",
 				    path_localtime, strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog) {
 					snprintf(title, sizeof(title), "Error");
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				} else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 				return (DITEM_FAILURE | DITEM_RECREATE);
 			}
@@ -804,9 +876,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 				    "Cannot create symbolic link %s to %s: %s",
 				    path_localtime, zoneinfo_file,
 				    strerror(errno));
+#ifdef HAVE_DIALOG
 				if (usedialog)
 					dialog_msgbox(title, prompt, 8, 72, 1);
 				else
+#endif
 					fprintf(stderr, "%s\n", prompt);
 				return (DITEM_FAILURE | DITEM_RECREATE);
 			}
@@ -822,9 +896,11 @@ install_zoneinfo_file(const char *zoneinfo_file)
 			snprintf(prompt, sizeof(prompt),
 			    "Created symbolic link from %s to %s",
 			    zoneinfo_file, path_localtime);
+#ifdef HAVE_DIALOG
 		if (usedialog)
 			dialog_msgbox(title, prompt, 8, 72, 1);
 		else
+#endif
 			fprintf(stderr, "%s\n", prompt);
 #endif
 	} /* reallydoit */
@@ -855,51 +931,6 @@ install_zoneinfo(const char *zoneinfo)
 	return (rv);
 }
 
-static int
-confirm_zone(const char *filename)
-{
-	char		title[64], prompt[64];
-	time_t		t = time(0);
-	struct tm	*tm;
-	int		rv;
-
-	setenv("TZ", filename == NULL ? "" : filename, 1);
-	tzset();
-	tm = localtime(&t);
-
-	snprintf(title, sizeof(title), "Confirmation");
-	snprintf(prompt, sizeof(prompt),
-	    "Does the abbreviation `%s' look reasonable?", tm->tm_zone);
-	rv = !dialog_yesno(title, prompt, 5, 72);
-	return (rv);
-}
-
-static int
-set_zone_multi(dialogMenuItem *dmi)
-{
-	struct zone	*zp = dmi->data;
-	int		rv;
-
-	if (!confirm_zone(zp->filename))
-		return (DITEM_FAILURE | DITEM_RECREATE);
-
-	rv = install_zoneinfo(zp->filename);
-	return (rv);
-}
-
-static int
-set_zone_whole_country(dialogMenuItem *dmi)
-{
-	struct country	*cp = dmi->data;
-	int		rv;
-
-	if (!confirm_zone(cp->filename))
-		return (DITEM_FAILURE | DITEM_RECREATE);
-
-	rv = install_zoneinfo(cp->filename);
-	return (rv);
-}
-
 static void
 usage(void)
 {
@@ -912,8 +943,11 @@ usage(void)
 int
 main(int argc, char **argv)
 {
+#ifdef HAVE_DIALOG
 	char		title[64], prompt[128];
-	int		c, fd, rv, skiputc;
+	int		fd;
+#endif
+	int		c, rv, skiputc;
 	char		vm_guest[16] = "";
 	size_t		len = sizeof(vm_guest);
 
@@ -934,7 +968,9 @@ main(int argc, char **argv)
 			break;
 		case 'r':
 			reinstall = 1;
+#ifdef HAVE_DIALOG
 			usedialog = 0;
+#endif
 			break;
 		case 's':
 			skiputc = 1;
@@ -998,12 +1034,15 @@ main(int argc, char **argv)
 		struct stat sb;
 
 		if (stat(argv[optind], &sb) != 0) {
+#ifdef HAVE_DIALOG
 			usedialog = 0;
+#endif
 			rv = install_zoneinfo(argv[optind]);
 			exit(rv & ~DITEM_LEAVE_MENU);
 		}
 		/* FALLTHROUGH */
 	}
+#ifdef HAVE_DIALOG
 
 	read_iso3166_table();
 	read_zones();
@@ -1064,5 +1103,8 @@ main(int argc, char **argv)
 
 	dlg_clear();
 	end_dialog();
+#else
+	usage();
+#endif
 	return (0);
 }


More information about the svn-src-all mailing list