Re: HEADS UP: dynamic root support now in the tree

From: David O'Brien <obrien_at_FreeBSD.org>
Date: Sun, 17 Aug 2003 18:48:23 -0700
On Sun, Aug 17, 2003 at 01:54:38AM -0700, Gordon Tetlow wrote:
> I just got through with my commit spree to enable users to build /bin
> and /sbin dynamically linked. To do this required a fair amount of
> tweaking and moving around libraries and such dangerous equipment as

I think this is a more correct way to change the install locations of the
/ needed libs.  Your current way makes the real location a "2nd class
citizen" vs. /usr/lib for any needed compatibility links.

I'd like to commit this:

Index: lib/libalias/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libalias/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- lib/libalias/Makefile	17 Aug 2003 08:28:43 -0000	1.21
+++ lib/libalias/Makefile	18 Aug 2003 01:42:15 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/lib/libalias/Makefile,v 1.21 2003/08/17 08:28:43 gordon Exp $
 
 LIB=	alias
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SHLIB_MAJOR=	4
 MAN=	libalias.3
 SRCS=	alias.c alias_cuseeme.c alias_db.c alias_ftp.c alias_irc.c \
Index: lib/libatm/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libatm/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- lib/libatm/Makefile	17 Aug 2003 08:28:43 -0000	1.8
+++ lib/libatm/Makefile	18 Aug 2003 01:42:11 -0000
_at__at_ -28,7 +28,7 _at__at_
 #
 
 LIB=	atm
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SRCS=	atm_addr.c cache_key.c ioctl_subr.c ip_addr.c ip_checksum.c timer.c
 INCS=	libatm.h
 
Index: lib/libc/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libc/Makefile,v
retrieving revision 1.42
diff -u -r1.42 Makefile
--- lib/libc/Makefile	17 Aug 2003 08:28:44 -0000	1.42
+++ lib/libc/Makefile	18 Aug 2003 01:42:08 -0000
_at__at_ -10,7 +10,7 _at__at_
 # system call stubs.
 LIB=c
 SHLIB_MAJOR= 5
-SHLIBDIR?=/lib
+LIBDIR?= /lib
 CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include
 CFLAGS+=-I${.CURDIR}/${MACHINE_ARCH}
 CLEANFILES+=tags
Index: lib/libcam/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libcam/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- lib/libcam/Makefile	17 Aug 2003 08:28:44 -0000	1.11
+++ lib/libcam/Makefile	18 Aug 2003 01:42:21 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/lib/libcam/Makefile,v 1.11 2003/08/17 08:28:44 gordon Exp $
 
 LIB=		cam
-SHLIBDIR?=	/lib
+LIBDIR?=	/lib
 SRCS=		camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c
 INCS=		camlib.h
 
Index: lib/libcrypt/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libcrypt/Makefile,v
retrieving revision 1.33
diff -u -r1.33 Makefile
--- lib/libcrypt/Makefile	17 Aug 2003 08:28:44 -0000	1.33
+++ lib/libcrypt/Makefile	18 Aug 2003 01:42:23 -0000
_at__at_ -4,7 +4,7 _at__at_
 
 SHLIB_MAJOR=	2
 LIB=		crypt
-SHLIBDIR?=	/lib
+LIBDIR?=	/lib
 
 .PATH:		${.CURDIR}/../libmd
 SRCS=		crypt.c misc.c \
Index: lib/libdevstat/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libdevstat/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- lib/libdevstat/Makefile	17 Aug 2003 08:28:44 -0000	1.12
+++ lib/libdevstat/Makefile	18 Aug 2003 01:42:28 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/lib/libdevstat/Makefile,v 1.12 2003/08/17 08:28:44 gordon Exp $
 
 LIB=	devstat
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 # Bump DEVSTAT_USER_API_VER in devstat.h every time this is incremented.
 SHLIB_MAJOR= 4
 SRCS=	devstat.c
Index: lib/libedit/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libedit/Makefile,v
retrieving revision 1.27
diff -u -r1.27 Makefile
--- lib/libedit/Makefile	17 Aug 2003 08:28:44 -0000	1.27
+++ lib/libedit/Makefile	18 Aug 2003 01:42:37 -0000
_at__at_ -4,7 +4,7 _at__at_
 
 LIB=	edit
 SHLIB_MAJOR=	4
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 
 OSRCS=	chared.c common.c el.c emacs.c fcns.c help.c hist.c key.c map.c \
 	parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c
Index: lib/libexpat/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libexpat/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- lib/libexpat/Makefile	17 Aug 2003 08:28:44 -0000	1.4
+++ lib/libexpat/Makefile	18 Aug 2003 01:42:43 -0000
_at__at_ -3,7 +3,7 _at__at_
 EXPAT=		${.CURDIR}/../../contrib/expat
 
 LIB=		bsdxml
-SHLIBDIR?=	/lib
+LIBDIR?=	/lib
 SHLIB_MAJOR=	1
 SRCS=		xmlparse.c xmlrole.c xmltok.c
 INCS=		bsdxml.h
Index: lib/libgeom/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libgeom/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- lib/libgeom/Makefile	17 Aug 2003 08:28:44 -0000	1.8
+++ lib/libgeom/Makefile	18 Aug 2003 01:42:48 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/lib/libgeom/Makefile,v 1.8 2003/08/17 08:28:44 gordon Exp $
 
 LIB=	geom
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SRCS+=	geom_getxml.c
 SRCS+=	geom_stats.c
 SRCS+=	geom_xml2tree.c
Index: lib/libipsec/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libipsec/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- lib/libipsec/Makefile	17 Aug 2003 08:28:44 -0000	1.13
+++ lib/libipsec/Makefile	18 Aug 2003 01:42:51 -0000
_at__at_ -27,7 +27,7 _at__at_
 # $FreeBSD: src/lib/libipsec/Makefile,v 1.13 2003/08/17 08:28:44 gordon Exp $
 
 LIB=	ipsec
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SHLIB_MAJOR= 1
 CFLAGS+=-I. -I${.CURDIR}
 CFLAGS+=-DIPSEC_DEBUG -DIPSEC
Index: lib/libipx/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libipx/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- lib/libipx/Makefile	17 Aug 2003 08:28:45 -0000	1.6
+++ lib/libipx/Makefile	18 Aug 2003 01:42:55 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/lib/libipx/Makefile,v 1.6 2003/08/17 08:28:45 gordon Exp $
 
 LIB=	ipx
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SRCS=	ipx_addr.c ipx_ntoa.c
 MAN=	ipx.3
 MLINKS+=ipx.3 ipx_addr.3 ipx.3 ipx_ntoa.3
Index: lib/libkvm/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libkvm/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- lib/libkvm/Makefile	17 Aug 2003 08:28:45 -0000	1.13
+++ lib/libkvm/Makefile	18 Aug 2003 01:42:59 -0000
_at__at_ -2,7 +2,7 _at__at_
 # $FreeBSD: src/lib/libkvm/Makefile,v 1.13 2003/08/17 08:28:45 gordon Exp $
 
 LIB=	kvm
-SHLIBDIR?=/lib
+LIBDIR?= /lib
 CFLAGS+=-DLIBC_SCCS -I${.CURDIR}
 SRCS=	kvm.c kvm_${MACHINE_ARCH}.c kvm_file.c kvm_getloadavg.c \
 	kvm_getswapinfo.c kvm_proc.c
Index: lib/libmd/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libmd/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- lib/libmd/Makefile	17 Aug 2003 08:28:45 -0000	1.39
+++ lib/libmd/Makefile	18 Aug 2003 01:43:03 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/lib/libmd/Makefile,v 1.39 2003/08/17 08:28:45 gordon Exp $
 
 LIB=	md
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SRCS=	md2c.c md4c.c md5c.c md2hl.c md4hl.c md5hl.c \
 	rmd160c.c rmd160hl.c \
 	sha0c.c sha0hl.c sha1c.c sha1hl.c
Index: lib/libncurses/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libncurses/Makefile,v
retrieving revision 1.71
diff -u -r1.71 Makefile
--- lib/libncurses/Makefile	17 Aug 2003 08:28:45 -0000	1.71
+++ lib/libncurses/Makefile	18 Aug 2003 01:43:07 -0000
_at__at_ -3,7 +3,7 _at__at_
 NCURSES=${.CURDIR}/../../contrib/ncurses
 
 LIB=	ncurses
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SHLIB_MAJOR=5
 
 # Should be elsewhere
Index: lib/libsbuf/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libsbuf/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- lib/libsbuf/Makefile	17 Aug 2003 08:28:45 -0000	1.4
+++ lib/libsbuf/Makefile	18 Aug 2003 01:43:10 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/lib/libsbuf/Makefile,v 1.4 2003/08/17 08:28:45 gordon Exp $
 
 LIB=	sbuf
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SRCS=	subr_sbuf.c 
 WARNS?= 2
 
Index: lib/libufs/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libufs/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- lib/libufs/Makefile	17 Aug 2003 08:28:45 -0000	1.9
+++ lib/libufs/Makefile	18 Aug 2003 01:43:29 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/lib/libufs/Makefile,v 1.9 2003/08/17 08:28:45 gordon Exp $
 
 LIB=	ufs
-SHLIBDIR?=	/lib
+LIBDIR?= /lib
 SRCS=	block.c cgroup.c inode.c sblock.c type.c
 INCS=	libufs.h
 MAN=	bread.3 cgread.3 libufs.3 sbread.3 ufs_disk_close.3
Index: lib/libutil/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libutil/Makefile,v
retrieving revision 1.50
diff -u -r1.50 Makefile
--- lib/libutil/Makefile	17 Aug 2003 08:28:45 -0000	1.50
+++ lib/libutil/Makefile	18 Aug 2003 01:43:33 -0000
_at__at_ -3,7 +3,7 _at__at_
 
 LIB=	util
 SHLIB_MAJOR= 3
-SHLIBDIR?=/lib
+LIBDIR?= /lib
 CFLAGS+=-Wall -DLIBC_SCCS -I${.CURDIR} -I${.CURDIR}/../libc/gen/
 CFLAGS+=-DINET6
 SRCS=	_secure_path.c auth.c fparseln.c login.c login_auth.c \
Index: lib/libz/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libz/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- lib/libz/Makefile	17 Aug 2003 08:28:45 -0000	1.15
+++ lib/libz/Makefile	18 Aug 2003 01:43:35 -0000
_at__at_ -5,7 +5,7 _at__at_
 MAINTAINER=peter_at_FreeBSD.org
 
 LIB=		z
-SHLIBDIR?=	/lib
+LIBDIR?=	/lib
 MAN=		zlib.3
 
 #CFLAGS+=	-DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
Index: lib/msun/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/msun/Makefile,v
retrieving revision 1.35
diff -u -r1.35 Makefile
--- lib/msun/Makefile	17 Aug 2003 08:28:46 -0000	1.35
+++ lib/msun/Makefile	18 Aug 2003 01:43:40 -0000
_at__at_ -55,6 +55,7 _at__at_
 	    e_remainder.S e_scalb.S e_sqrt.S s_atan.S s_ceil.S s_copysign.S \
 	    s_cos.S s_finite.S s_floor.S s_ilogb.S s_logb.S \
 	    s_rint.S s_scalbn.S s_significand.S s_sin.S s_tan.S
+#CSTD?=	c99
 # Broken:
 # ARCH_SRCS+=	s_log1p.S
 .endif
_at__at_ -66,7 +67,7 _at__at_
 CFLAGS+= -D_IEEE_LIBM
 
 LIB=	m
-SHLIBDIR?= /lib
+LIBDIR?= /lib
 COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \
 	e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \
 	e_atan2.c e_atan2f.c e_atanh.c e_atanhf.c e_cosh.c e_coshf.c e_exp.c \
Index: libexec/ftpd/ftpd.c
===================================================================
RCS file: /home/ncvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.145
diff -u -r1.145 ftpd.c
--- libexec/ftpd/ftpd.c	9 Jul 2003 12:46:24 -0000	1.145
+++ libexec/ftpd/ftpd.c	11 Jul 2003 17:16:44 -0000
_at__at_ -183,8 +183,10 _at__at_
 pam_handle_t *pamh = NULL;
 #endif
 
+#ifndef NO_OPIE
 static struct opie opiedata;
 static char opieprompt[OPIE_CHALLENGE_MAX+1];
+#endif
 static int pwok;
 
 char	*pid_file = NULL;
_at__at_ -1059,13 +1061,16 _at__at_
 #ifdef USE_PAM
 	/* XXX Kluge! The conversation mechanism needs to be fixed. */
 #endif
+#ifndef NO_OPIE
 	if (opiechallenge(&opiedata, name, opieprompt) == 0) {
 		pwok = (pw != NULL) &&
 		       opieaccessfile(remotehost) &&
 		       opiealways(pw->pw_dir);
 		reply(331, "Response to %s %s for %s.",
 		      opieprompt, pwok ? "requested" : "required", name);
-	} else {
+	} else
+#endif
+	{
 		pwok = 1;
 		reply(331, "Password required for %s.", name);
 	}
_at__at_ -1380,9 +1385,12 _at__at_
 			goto skip;
 		}
 #endif
+#ifndef NO_OPIE
 		if (opieverify(&opiedata, passwd) == 0)
 			xpasswd = pw->pw_passwd;
-		else if (pwok) {
+		else 
+#endif
+		if (pwok) {
 			xpasswd = crypt(passwd, pw->pw_passwd);
 			if (passwd[0] == '\0' && pw->pw_passwd[0] != '\0')
 				xpasswd = ":";
Index: libexec/rexecd/rexecd.c
===================================================================
RCS file: /home/ncvs/src/libexec/rexecd/rexecd.c,v
retrieving revision 1.30
diff -u -r1.30 rexecd.c
--- libexec/rexecd/rexecd.c	3 May 2002 13:12:06 -0000	1.30
+++ libexec/rexecd/rexecd.c	24 Feb 2003 05:33:34 -0000
_at__at_ -63,6 +63,7 _at__at_
 #include <syslog.h>
 #include <unistd.h>
 
+#ifndef NO_PAM
 #include <security/pam_appl.h>
 #include <security/openpam.h>
 
_at__at_ -74,6 +75,7 _at__at_
 static int pam_flags = PAM_SILENT|PAM_DISALLOW_NULL_AUTHTOK;
 static int pam_err;
 #define pam_ok(err) ((pam_err = (err)) == PAM_SUCCESS)
+#endif
 
 char	**environ;
 char	remote[MAXHOSTNAMELEN];
_at__at_ -183,12 +185,16 _at__at_
 	getstr(cmdbuf, sizeof(cmdbuf), "command");
 	(void) alarm(0);
 
-	if ((pwd = getpwnam(user))  == NULL || (pwd->pw_uid = 0 && no_uid_0) ||
+	if ((pwd = getpwnam(user))  == NULL || (pwd->pw_uid = 0 && no_uid_0)
+#ifndef NO_PAM
+	    ||
 	    !pam_ok(pam_start("rexecd", user, &pamc, &pamh)) ||
 	    !pam_ok(pam_set_item(pamh, PAM_RHOST, remote)) ||
 	    !pam_ok(pam_set_item(pamh, PAM_AUTHTOK, pass)) ||
 	    !pam_ok(pam_authenticate(pamh, pam_flags)) ||
-	    !pam_ok(pam_acct_mgmt(pamh, pam_flags))) {
+	    !pam_ok(pam_acct_mgmt(pamh, pam_flags))
+#endif
+	    ) {
 		syslog(LOG_ERR, "%s LOGIN REFUSED from %s", user, remote);
 		error("Login incorrect.\n");
 		exit(1);
_at__at_ -207,7 +213,9 _at__at_
 		}
 		if (pid) {
 			/* parent */
+#ifndef NO_PAM
 			(void) pam_end(pamh, pam_err);
+#endif
 			(void) close(STDIN_FILENO);
 			(void) close(STDOUT_FILENO);
 			(void) close(STDERR_FILENO);
_at__at_ -262,6 +270,7 _at__at_
 		syslog(LOG_ERR, "setlogin() failed: %m");
 	(void) setgid((gid_t)pwd->pw_gid);
 	initgroups(pwd->pw_name, pwd->pw_gid);
+#ifndef NO_PAM
 	if (!pam_ok(pam_setcred(pamh, PAM_ESTABLISH_CRED)))
 		syslog(LOG_ERR, "pam_setcred() failed: %s",
 		    pam_strerror(pamh, pam_err));
_at__at_ -271,6 +280,7 _at__at_
 	(void) pam_setenv(pamh, "PATH", _PATH_DEFPATH, 1);
 	environ = pam_getenvlist(pamh);
 	(void) pam_end(pamh, pam_err);
+#endif
 	(void) setuid((uid_t)pwd->pw_uid);
 	cp = strrchr(pwd->pw_shell, '/');
 	if (cp)
Index: secure/lib/libcrypto/Makefile
===================================================================
RCS file: /home/ncvs/src/secure/lib/libcrypto/Makefile,v
retrieving revision 1.65
diff -u -r1.65 Makefile
--- secure/lib/libcrypto/Makefile	17 Aug 2003 08:28:46 -0000	1.65
+++ secure/lib/libcrypto/Makefile	18 Aug 2003 01:44:26 -0000
_at__at_ -1,7 +1,7 _at__at_
 # $FreeBSD: src/secure/lib/libcrypto/Makefile,v 1.65 2003/08/17 08:28:46 gordon Exp $
 
 LIB=		crypto
-SHLIBDIR?=	/lib
+LIBDIR?=	/lib
 SHLIB_MAJOR=	3
 
 NOLINT=		true
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.lib.mk,v
retrieving revision 1.149
diff -u -r1.149 bsd.lib.mk
--- share/mk/bsd.lib.mk	17 Aug 2003 07:42:50 -0000	1.149
+++ share/mk/bsd.lib.mk	18 Aug 2003 01:41:20 -0000
_at__at_ -206,12 +206,7 _at__at_
 	    ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
 	    ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
 .if defined(SHLIB_LINK)
-.if (${LIBDIR} == ${SHLIBDIR})
-	ln -fs ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
-.else
-	ln -fs ${LIBDIR:C|/[^/]+|/..|g:S|^/||}${SHLIBDIR}/${SHLIB_NAME} \
-	    ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
-.endif
+	ln -fs ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIB_LINK}
 .endif
 .endif
 .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
Received on Sun Aug 17 2003 - 16:48:27 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:19 UTC