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.
This commit is contained in:
thorpej 2019-05-08 02:25:50 +00:00
parent 4ca6b93188
commit 8319f966d5
9 changed files with 25 additions and 15 deletions

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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 <joerg@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)

View File

@ -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;

View File

@ -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 dirname.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} -I${.CURDIR}/sys \
${.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 \

View File

@ -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"

View File

@ -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/include
.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}