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.
This commit is contained in:
Thomas Cort 2011-06-27 03:16:29 +00:00 committed by Ben Gras
parent ec84a2cfa5
commit 69bf8e4f71
13 changed files with 102 additions and 4 deletions

View file

@ -172,3 +172,7 @@ CSHLIBFLAGS+= -D_I18N_DYNAMIC
# force the dynamic linker to initialize libc first # force the dynamic linker to initialize libc first
SHLIB_SHFLAGS+= -Wl,-z,initfirst SHLIB_SHFLAGS+= -Wl,-z,initfirst
.include <bsd.own.mk>
SUBDIR+= pkgconfig
.include <bsd.subdir.mk>

View file

@ -0,0 +1,9 @@
NOOBJ= # defined
.include <bsd.own.mk>
FILES=libc.pc
FILESDIR=/usr/netbsd/lib
FILESMODE=444
.include <bsd.prog.mk>

View file

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

View file

@ -44,4 +44,8 @@ SRCS+= cuserid.c
.include "include/Makefile.inc" .include "include/Makefile.inc"
.include <bsd.own.mk>
SUBDIR+= pkgconfig
.include <bsd.subdir.mk>
.include <bsd.lib.mk> .include <bsd.lib.mk>

View file

@ -0,0 +1,9 @@
NOOBJ= # defined
.include <bsd.own.mk>
FILES=compat_minix.pc
FILESDIR=/usr/netbsd/lib
FILESMODE=444
.include <bsd.prog.mk>

View file

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

View file

@ -35,4 +35,8 @@ INCS+= tools.h
.include "${MACHINE}/Makefile.inc" .include "${MACHINE}/Makefile.inc"
.include <bsd.own.mk>
SUBDIR+= pkgconfig
.include <bsd.subdir.mk>
.include <bsd.lib.mk> .include <bsd.lib.mk>

View file

@ -0,0 +1,9 @@
NOOBJ= # defined
.include <bsd.own.mk>
FILES=minlib.pc
FILESDIR=/usr/netbsd/lib
FILESMODE=444
.include <bsd.prog.mk>

View file

@ -0,0 +1,6 @@
Name: minlib
Description: Minix Compatibility Library
Version: 1.0
Libs: -L/usr/netbsd/lib -lminlib
Cflags: -I/usr/netbsd/include

View file

@ -5,10 +5,10 @@ NOOBJ= # defined
.if ${MKSHARE} != "no" .if ${MKSHARE} != "no"
FILES= bsd.ack.mk bsd.dep.mk bsd.files.mk \ FILES= bsd.ack.mk bsd.dep.mk bsd.files.mk \
bsd.gcc.mk bsd.inc.mk \ bsd.gcc.mk bsd.inc.mk \
bsd.init.mk bsd.kinc.mk bsd.klinks.mk \ bsd.init.mk bsd.kinc.mk bsd.klinks.mk bsd.lib.mk \
bsd.lib.mk bsd.links.mk bsd.man.mk bsd.obj.mk bsd.own.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 \ bsd.prog.mk bsd.subdir.mk bsd.sys.mk bsd.gcov.mk \
sys.mk minix.libc.mk pkgsrchooks.mk sys.mk
# MINIX-specific files # MINIX-specific files
FILES+= minix.bootprog.mk FILES+= minix.bootprog.mk

7
share/mk/minix.libc.mk Normal file
View file

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

36
share/mk/pkgsrchooks.mk Normal file
View file

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

View file

@ -30,7 +30,7 @@ PACKAGEURL=ftp://ftp.minix3.org/pub/minix/packages/$version_pretty/`uname -m`/Al
PREINSTALLED_PACKAGES=" PREINSTALLED_PACKAGES="
pkgin-0.4.1 pkgin-0.4.1
pkg_install-20101212 pkg_install-20101212
bmake-20100808 bmake-20110606
binutils-2.17nb3 binutils-2.17nb3
clang-2.9nb2 clang-2.9nb2
compiler-rt-r123836nb3 compiler-rt-r123836nb3