Module Name:    src
Committed By:   thorpej
Date:           Wed May  8 02:25:50 UTC 2019

Modified Files:
        src/common/lib/libprop: prop_bool.c prop_data.c prop_number.c
            prop_object_impl.h prop_stack.c prop_string.c
        src/tools/compat: Makefile
        src/tools/libprop: Makefile
Added Files:
        src/tools/compat/sys: rbtree.h

Log Message:
Fix building libprop as a host tool library on platforms that don't have
the Matt Thomas rbtree:

- Include rb.c in libnbcompat, and provide a nbcompat sys/rbtree.h
  header.
- Make sure libprop's source file include prop_object_impl.h before
  anything else, and pull in nbtool_config.h from there.

Tested by simulating such a host system by renaming the host's
<sys/rbtree.h> out of the way (which reproduced the build failure)
and verifying that the host-tool installboot contained the rb_*
functions in its own .text segment.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/common/lib/libprop/prop_bool.c
cvs rdiff -u -r1.14 -r1.15 src/common/lib/libprop/prop_data.c
cvs rdiff -u -r1.30 -r1.31 src/common/lib/libprop/prop_number.c
cvs rdiff -u -r1.32 -r1.33 src/common/lib/libprop/prop_object_impl.h
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libprop/prop_stack.c
cvs rdiff -u -r1.12 -r1.13 src/common/lib/libprop/prop_string.c
cvs rdiff -u -r1.86 -r1.87 src/tools/compat/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/compat/sys/rbtree.h
cvs rdiff -u -r1.1 -r1.2 src/tools/libprop/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libprop/prop_bool.c
diff -u src/common/lib/libprop/prop_bool.c:1.17 src/common/lib/libprop/prop_bool.c:1.18
--- src/common/lib/libprop/prop_bool.c:1.17	Sat Jan  3 18:31:33 2009
+++ src/common/lib/libprop/prop_bool.c	Wed May  8 02:25:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_bool.c,v 1.17 2009/01/03 18:31:33 pooka Exp $	*/
+/*	$NetBSD: prop_bool.c,v 1.18 2019/05/08 02:25:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,8 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <prop/prop_bool.h>
 #include "prop_object_impl.h"
+#include <prop/prop_bool.h>
 
 struct _prop_bool {
 	struct _prop_object	pb_obj;

Index: src/common/lib/libprop/prop_data.c
diff -u src/common/lib/libprop/prop_data.c:1.14 src/common/lib/libprop/prop_data.c:1.15
--- src/common/lib/libprop/prop_data.c:1.14	Sun Jan 25 06:59:35 2009
+++ src/common/lib/libprop/prop_data.c	Wed May  8 02:25:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_data.c,v 1.14 2009/01/25 06:59:35 cyber Exp $	*/
+/*	$NetBSD: prop_data.c,v 1.15 2019/05/08 02:25:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,8 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <prop/prop_data.h>
 #include "prop_object_impl.h"
+#include <prop/prop_data.h>
 
 #if defined(_KERNEL)
 #include <sys/systm.h>

Index: src/common/lib/libprop/prop_number.c
diff -u src/common/lib/libprop/prop_number.c:1.30 src/common/lib/libprop/prop_number.c:1.31
--- src/common/lib/libprop/prop_number.c:1.30	Tue Jun 28 06:47:35 2016
+++ src/common/lib/libprop/prop_number.c	Wed May  8 02:25:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_number.c,v 1.30 2016/06/28 06:47:35 pgoyette Exp $	*/
+/*	$NetBSD: prop_number.c,v 1.31 2019/05/08 02:25:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,9 +29,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <sys/rbtree.h>
-#include <prop/prop_number.h>
 #include "prop_object_impl.h"
+#include <prop/prop_number.h>
+#include <sys/rbtree.h>
 
 #if defined(_KERNEL)
 #include <sys/systm.h>

Index: src/common/lib/libprop/prop_object_impl.h
diff -u src/common/lib/libprop/prop_object_impl.h:1.32 src/common/lib/libprop/prop_object_impl.h:1.33
--- src/common/lib/libprop/prop_object_impl.h:1.32	Mon May 11 16:50:35 2015
+++ src/common/lib/libprop/prop_object_impl.h	Wed May  8 02:25:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_object_impl.h,v 1.32 2015/05/11 16:50:35 christos Exp $	*/
+/*	$NetBSD: prop_object_impl.h,v 1.33 2019/05/08 02:25:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -32,6 +32,10 @@
 #ifndef _PROPLIB_PROP_OBJECT_IMPL_H_
 #define	_PROPLIB_PROP_OBJECT_IMPL_H_
 
+#if defined(HAVE_NBTOOL_CONFIG_H)
+#include "nbtool_config.h"
+#endif
+
 #if defined(_KERNEL) || defined(_STANDALONE)
 #include <lib/libkern/libkern.h>
 #else

Index: src/common/lib/libprop/prop_stack.c
diff -u src/common/lib/libprop/prop_stack.c:1.2 src/common/lib/libprop/prop_stack.c:1.3
--- src/common/lib/libprop/prop_stack.c:1.2	Thu Aug 30 12:23:54 2007
+++ src/common/lib/libprop/prop_stack.c	Wed May  8 02:25:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: prop_stack.c,v 1.2 2007/08/30 12:23:54 joerg Exp $ */
+/* $NetBSD: prop_stack.c,v 1.3 2019/05/08 02:25:50 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <jo...@netbsd.org>.
@@ -29,8 +29,8 @@
  * SUCH DAMAGE.
  */
 
-#include "prop_stack.h"
 #include "prop_object_impl.h"
+#include "prop_stack.h"
 
 void
 _prop_stack_init(prop_stack_t stack)

Index: src/common/lib/libprop/prop_string.c
diff -u src/common/lib/libprop/prop_string.c:1.12 src/common/lib/libprop/prop_string.c:1.13
--- src/common/lib/libprop/prop_string.c:1.12	Wed Mar 26 18:12:46 2014
+++ src/common/lib/libprop/prop_string.c	Wed May  8 02:25:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_string.c,v 1.12 2014/03/26 18:12:46 christos Exp $	*/
+/*	$NetBSD: prop_string.c,v 1.13 2019/05/08 02:25:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,8 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <prop/prop_string.h>
 #include "prop_object_impl.h"
+#include <prop/prop_string.h>
 
 struct _prop_string {
 	struct _prop_object	ps_obj;

Index: src/tools/compat/Makefile
diff -u src/tools/compat/Makefile:1.86 src/tools/compat/Makefile:1.87
--- src/tools/compat/Makefile:1.86	Thu Aug 30 12:05:34 2018
+++ src/tools/compat/Makefile	Wed May  8 02:25:50 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.86 2018/08/30 12:05:34 christos Exp $
+#	$NetBSD: Makefile,v 1.87 2019/05/08 02:25:50 thorpej Exp $
 
 HOSTLIB=	nbcompat
 
@@ -13,7 +13,7 @@ SRCS=		atoll.c basename.c cdbr.c cdbw.c 
 		mi_vector_hash.c mkdtemp.c \
 		mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
 		pw_scan.c \
-		raise_default_signal.c reallocarr.c rmd160.c rmd160hl.c \
+		raise_default_signal.c rb.c reallocarr.c rmd160.c rmd160hl.c \
 		regcomp.c regerror.c regexec.c regfree.c \
 		setenv.c setgroupent.c \
 		setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
@@ -54,6 +54,7 @@ CPPFLAGS+=	-I. -I./include -I${.CURDIR} 
 		${.CURDIR}/../../lib/libc/string \
 		${.CURDIR}/../../lib/libutil \
 		${.CURDIR}/../../common/lib/libc/cdb \
+		${.CURDIR}/../../common/lib/libc/gen \
 		${.CURDIR}/../../common/lib/libc/string \
 		${.CURDIR}/../../common/lib/libc/hash/rmd160 \
 		${.CURDIR}/../../common/lib/libc/hash/sha1 \

Index: src/tools/libprop/Makefile
diff -u src/tools/libprop/Makefile:1.1 src/tools/libprop/Makefile:1.2
--- src/tools/libprop/Makefile:1.1	Tue May  7 04:29:45 2019
+++ src/tools/libprop/Makefile	Wed May  8 02:25:50 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2019/05/07 04:29:45 thorpej Exp $
+#	$NetBSD: Makefile,v 1.2 2019/05/08 02:25:50 thorpej Exp $
 
 HOSTLIB=	prop
 
@@ -10,6 +10,7 @@ LIBPROP_INC=	${.CURDIR}/../../common/inc
 .include "${LIBPROP_DIR}/Makefile.inc"
 
 CPPFLAGS+=	-I${.CURDIR}/../compat -I${LIBPROP_INC}
+CPPFLAGS+=	-I${TOOLDIR}/include/compat
 CPPFLAGS+=	-I${TOOLDIR}/include/nbinclude
 
 .PATH:		${LIBPROP_DIR}

Added files:

Index: src/tools/compat/sys/rbtree.h
diff -u /dev/null src/tools/compat/sys/rbtree.h:1.1
--- /dev/null	Wed May  8 02:25:50 2019
+++ src/tools/compat/sys/rbtree.h	Wed May  8 02:25:50 2019
@@ -0,0 +1,4 @@
+/*	$NetBSD: rbtree.h,v 1.1 2019/05/08 02:25:50 thorpej Exp $	*/
+
+/* We unconditionally use the NetBSD rbtree(3) in libnbcompat. */
+#include "../../../sys/sys/rbtree.h"

Reply via email to