From 69bf8e4f71a428acac73c75b17930bf12557a3c1 Mon Sep 17 00:00:00 2001 From: Thomas Cort Date: Mon, 27 Jun 2011 03:16:29 +0000 Subject: [PATCH] add pkgsrc hooks for building pkgs w/nbsd_libc 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. --- lib/nbsd_libc/Makefile | 4 +++ lib/nbsd_libc/pkgconfig/Makefile | 9 +++++ lib/nbsd_libc/pkgconfig/libc.pc | 5 +++ lib/nbsd_libcompat_minix/Makefile | 4 +++ lib/nbsd_libcompat_minix/pkgconfig/Makefile | 9 +++++ .../pkgconfig/compat_minix.pc | 5 +++ lib/nbsd_libminlib/Makefile | 4 +++ lib/nbsd_libminlib/pkgconfig/Makefile | 9 +++++ lib/nbsd_libminlib/pkgconfig/minlib.pc | 6 ++++ share/mk/Makefile | 6 ++-- share/mk/minix.libc.mk | 7 ++++ share/mk/pkgsrchooks.mk | 36 +++++++++++++++++++ tools/release.sh | 2 +- 13 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 lib/nbsd_libc/pkgconfig/Makefile create mode 100644 lib/nbsd_libc/pkgconfig/libc.pc create mode 100644 lib/nbsd_libcompat_minix/pkgconfig/Makefile create mode 100644 lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc create mode 100644 lib/nbsd_libminlib/pkgconfig/Makefile create mode 100644 lib/nbsd_libminlib/pkgconfig/minlib.pc create mode 100644 share/mk/minix.libc.mk create mode 100644 share/mk/pkgsrchooks.mk diff --git a/lib/nbsd_libc/Makefile b/lib/nbsd_libc/Makefile index f0f530d45..4b124caf8 100644 --- a/lib/nbsd_libc/Makefile +++ b/lib/nbsd_libc/Makefile @@ -172,3 +172,7 @@ CSHLIBFLAGS+= -D_I18N_DYNAMIC # force the dynamic linker to initialize libc first SHLIB_SHFLAGS+= -Wl,-z,initfirst +.include +SUBDIR+= pkgconfig +.include + diff --git a/lib/nbsd_libc/pkgconfig/Makefile b/lib/nbsd_libc/pkgconfig/Makefile new file mode 100644 index 000000000..4c2c4c916 --- /dev/null +++ b/lib/nbsd_libc/pkgconfig/Makefile @@ -0,0 +1,9 @@ +NOOBJ= # defined + +.include + +FILES=libc.pc +FILESDIR=/usr/netbsd/lib +FILESMODE=444 + +.include diff --git a/lib/nbsd_libc/pkgconfig/libc.pc b/lib/nbsd_libc/pkgconfig/libc.pc new file mode 100644 index 000000000..828a9df8c --- /dev/null +++ b/lib/nbsd_libc/pkgconfig/libc.pc @@ -0,0 +1,5 @@ +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 diff --git a/lib/nbsd_libcompat_minix/Makefile b/lib/nbsd_libcompat_minix/Makefile index 21ec36866..710ede979 100644 --- a/lib/nbsd_libcompat_minix/Makefile +++ b/lib/nbsd_libcompat_minix/Makefile @@ -44,4 +44,8 @@ SRCS+= cuserid.c .include "include/Makefile.inc" +.include +SUBDIR+= pkgconfig +.include + .include diff --git a/lib/nbsd_libcompat_minix/pkgconfig/Makefile b/lib/nbsd_libcompat_minix/pkgconfig/Makefile new file mode 100644 index 000000000..73a654d12 --- /dev/null +++ b/lib/nbsd_libcompat_minix/pkgconfig/Makefile @@ -0,0 +1,9 @@ +NOOBJ= # defined + +.include + +FILES=compat_minix.pc +FILESDIR=/usr/netbsd/lib +FILESMODE=444 + +.include diff --git a/lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc b/lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc new file mode 100644 index 000000000..f763fd81e --- /dev/null +++ b/lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc @@ -0,0 +1,5 @@ +Name: compat_minix +Description: Minix Compatibility Library +Version: 1.0 +Libs: -L/usr/netbsd/lib -lcompat_minix +Cflags: -I/usr/netbsd/include diff --git a/lib/nbsd_libminlib/Makefile b/lib/nbsd_libminlib/Makefile index e049137d2..76062b65e 100644 --- a/lib/nbsd_libminlib/Makefile +++ b/lib/nbsd_libminlib/Makefile @@ -35,4 +35,8 @@ INCS+= tools.h .include "${MACHINE}/Makefile.inc" +.include +SUBDIR+= pkgconfig +.include + .include diff --git a/lib/nbsd_libminlib/pkgconfig/Makefile b/lib/nbsd_libminlib/pkgconfig/Makefile new file mode 100644 index 000000000..b70ad99ab --- /dev/null +++ b/lib/nbsd_libminlib/pkgconfig/Makefile @@ -0,0 +1,9 @@ +NOOBJ= # defined + +.include + +FILES=minlib.pc +FILESDIR=/usr/netbsd/lib +FILESMODE=444 + +.include diff --git a/lib/nbsd_libminlib/pkgconfig/minlib.pc b/lib/nbsd_libminlib/pkgconfig/minlib.pc new file mode 100644 index 000000000..9fb06b6ea --- /dev/null +++ b/lib/nbsd_libminlib/pkgconfig/minlib.pc @@ -0,0 +1,6 @@ +Name: minlib +Description: Minix Compatibility Library +Version: 1.0 +Libs: -L/usr/netbsd/lib -lminlib +Cflags: -I/usr/netbsd/include + diff --git a/share/mk/Makefile b/share/mk/Makefile index 740bc5ba0..4eff2fc36 100644 --- a/share/mk/Makefile +++ b/share/mk/Makefile @@ -5,10 +5,10 @@ NOOBJ= # defined .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 diff --git a/share/mk/minix.libc.mk b/share/mk/minix.libc.mk new file mode 100644 index 000000000..8d1864c19 --- /dev/null +++ b/share/mk/minix.libc.mk @@ -0,0 +1,7 @@ +# 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= diff --git a/share/mk/pkgsrchooks.mk b/share/mk/pkgsrchooks.mk new file mode 100644 index 000000000..8e61f9fee --- /dev/null +++ b/share/mk/pkgsrchooks.mk @@ -0,0 +1,36 @@ +# + +.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_) diff --git a/tools/release.sh b/tools/release.sh index 361ea3979..cba55f2dd 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -30,7 +30,7 @@ PACKAGEURL=ftp://ftp.minix3.org/pub/minix/packages/$version_pretty/`uname -m`/Al PREINSTALLED_PACKAGES=" pkgin-0.4.1 pkg_install-20101212 - bmake-20100808 + bmake-20110606 binutils-2.17nb3 clang-2.9nb2 compiler-rt-r123836nb3 -- 2.44.0