Add two makefiles to manage compiling packages with NetBSD libc.
* minix.libc.mk contains the proper CFLAGS/LDFLAGS
* pkgsrchooks.mk contains the logic for setting the flags.
* update bmake
Several pkg-config files were added to help pkgsrc learn about
the c, minlib, and compat_minix libraries.
# force the dynamic linker to initialize libc first
SHLIB_SHFLAGS+= -Wl,-z,initfirst
+.include <bsd.own.mk>
+SUBDIR+= pkgconfig
+.include <bsd.subdir.mk>
+
--- /dev/null
+NOOBJ= # defined
+
+.include <bsd.own.mk>
+
+FILES=libc.pc
+FILESDIR=/usr/netbsd/lib
+FILESMODE=444
+
+.include <bsd.prog.mk>
--- /dev/null
+Name: c
+Description: NetBSD C Library
+Version: 1.0
+Libs: -nostdlib /usr/netbsd/lib/crt1.o /usr/netbsd/lib/crti.o /usr/netbsd/lib/crtn.o -L/usr/netbsd/lib -lc -L/usr/pkg/lib -lgcc -L/usr/netbsd/lib -lminlib -lcompat_minix
+Cflags: -nostdinc -D__NBSD_LIBC -isystem /usr/netbsd/include
.include "include/Makefile.inc"
+.include <bsd.own.mk>
+SUBDIR+= pkgconfig
+.include <bsd.subdir.mk>
+
.include <bsd.lib.mk>
--- /dev/null
+NOOBJ= # defined
+
+.include <bsd.own.mk>
+
+FILES=compat_minix.pc
+FILESDIR=/usr/netbsd/lib
+FILESMODE=444
+
+.include <bsd.prog.mk>
--- /dev/null
+Name: compat_minix
+Description: Minix Compatibility Library
+Version: 1.0
+Libs: -L/usr/netbsd/lib -lcompat_minix
+Cflags: -I/usr/netbsd/include
.include "${MACHINE}/Makefile.inc"
+.include <bsd.own.mk>
+SUBDIR+= pkgconfig
+.include <bsd.subdir.mk>
+
.include <bsd.lib.mk>
--- /dev/null
+NOOBJ= # defined
+
+.include <bsd.own.mk>
+
+FILES=minlib.pc
+FILESDIR=/usr/netbsd/lib
+FILESMODE=444
+
+.include <bsd.prog.mk>
--- /dev/null
+Name: minlib
+Description: Minix Compatibility Library
+Version: 1.0
+Libs: -L/usr/netbsd/lib -lminlib
+Cflags: -I/usr/netbsd/include
+
.if ${MKSHARE} != "no"
FILES= bsd.ack.mk bsd.dep.mk bsd.files.mk \
bsd.gcc.mk bsd.inc.mk \
- bsd.init.mk bsd.kinc.mk bsd.klinks.mk \
- bsd.lib.mk bsd.links.mk bsd.man.mk bsd.obj.mk bsd.own.mk \
+ bsd.init.mk bsd.kinc.mk bsd.klinks.mk bsd.lib.mk \
+ bsd.links.mk bsd.man.mk bsd.obj.mk bsd.own.mk \
bsd.prog.mk bsd.subdir.mk bsd.sys.mk bsd.gcov.mk \
- sys.mk
+ minix.libc.mk pkgsrchooks.mk sys.mk
# MINIX-specific files
FILES+= minix.bootprog.mk
--- /dev/null
+# NetBSD libc flags go here
+NETBSD_LIBC_CPPFLAGS=-nostdinc -D__NBSD_LIBC -isystem /usr/netbsd/include
+NETBSD_LIBC_LDFLAGS=-nostdlib /usr/netbsd/lib/crt1.o /usr/netbsd/lib/crti.o /usr/netbsd/lib/crtn.o -L/usr/netbsd/lib -lc -L/usr/pkg/lib -lgcc -L/usr/netbsd/lib -lminlib -lcompat_minix
+
+# Minix libc flags go here
+MINIX_LIBC_CPPFLAGS=
+MINIX_LIBC_LDFLAGS=
--- /dev/null
+#
+
+.if !defined(_MINIX_PKGSRC_HOOKS_)
+_MINIX_PKGSRC_HOOKS_=1
+
+# Get PKGS_REQUIRING_MINIX_LIBC
+.include "/usr/pkgsrc/minix/pkgs_requiring_minix_libc.mk"
+
+# Get MINIX_LIBC_* and NETBSD_LIBC_*
+.include "/usr/share/mk/minix.libc.mk"
+
+# Build everything not in PKGS_REQUIRING_MINIX_LIBC with NetBSD libc
+PKG_REQUIRES_MINIX_LIBC=no
+
+# Search PKGS_REQUIRING_MINIX_LIBC to see if it needs Minix libc
+.for PKG_REQUIRING_MINIX_LIBC in ${PKGS_REQUIRING_MINIX_LIBC}
+.if "${PKG_REQUIRING_MINIX_LIBC}" == "${CATEGORIES}/${PKGBASE}"
+PKG_REQUIRES_MINIX_LIBC=yes
+.endif
+.endfor
+
+# Set the proper compilation flags
+.if ${PKG_REQUIRES_MINIX_LIBC} == yes
+CPPFLAGS+= ${MINIX_LIBC_CPPFLAGS}
+LDFLAGS+= ${MINIX_LIBC_LDFLAGS}
+.else
+SED=/bin/sed
+.include "/usr/pkgsrc/mk/nbsd_libc.buildlink3.mk"
+PREFER_NATIVE+=minlib
+PREFER_NATIVE+=compat_minix
+PREFER_NATIVE+=nbsd_libc
+CPPFLAGS+= ${NETBSD_LIBC_CPPFLAGS}
+LDFLAGS+= ${NETBSD_LIBC_LDFLAGS}
+.endif
+
+.endif # !defined(_MINIX_PKGSRC_HOOKS_)
PREINSTALLED_PACKAGES="
pkgin-0.4.1
pkg_install-20101212
- bmake-20100808
+ bmake-20110606
binutils-2.17nb3
clang-2.9nb2
compiler-rt-r123836nb3