summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-freebsd/freebsd-lib/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-freebsd/freebsd-lib/files')
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch49
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch98
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch16
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libusb.patch19
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch16
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch20
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch11
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch15
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch28
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch21
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch12
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch19
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch10
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch12
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch215
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch21
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch11
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch122
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch17
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch51
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch16
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch30
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch26
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch68
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/libmap.conf8
-rw-r--r--sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in11
-rw-r--r--sys-freebsd/freebsd-lib/files/libusb.pc.in11
32 files changed, 1018 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch
new file mode 100644
index 000000000000..42b64b572322
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch
@@ -0,0 +1,49 @@
+diff --git a/lib/atf/Makefile.inc b/lib/atf/Makefile.inc
+index 937187a..d5277f3 100644
+--- a/lib/atf/Makefile.inc
++++ b/lib/atf/Makefile.inc
+@@ -49,6 +49,24 @@ CFLAGS+= -DATF_PKGDATADIR='"${SHAREDIR}/atf"'
+ CFLAGS+= -DATF_SHELL='"/bin/sh"'
+ CFLAGS+= -DATF_WORKDIR='"/tmp"'
+
++CXXFLAGS+= -DHAVE_CONFIG_H
++CXXFLAGS+= -DATF_ARCH='"${MACHINE}"'
++CXXFLAGS+= -DATF_BUILD_CC='"${CC}"'
++CXXFLAGS+= -DATF_BUILD_CXXFLAGS='"${_CXXFLAGS}"'
++CXXFLAGS+= -DATF_BUILD_CPP='"${CPP}"'
++CXXFLAGS+= -DATF_BUILD_CPPFLAGS='"${_CPPFLAGS}"'
++CXXFLAGS+= -DATF_BUILD_CXX='"${CXX}"'
++CXXFLAGS+= -DATF_BUILD_CXXFLAGS='"${_CXXFLAGS}"'
++CXXFLAGS+= -DATF_CONFDIR='"${CONFDIR}/atf"'
++CXXFLAGS+= -DATF_INCLUDEDIR='"${INCLUDEDIR}"'
++CXXFLAGS+= -DATF_LIBDIR='"${LIBDIR}"'
++CXXFLAGS+= -DATF_LIBEXECDIR='"${LIBEXECDIR}"'
++CXXFLAGS+= -DATF_MACHINE='"${MACHINE_ARCH}"'
++CXXFLAGS+= -DATF_M4='"/usr/bin/m4"'
++CXXFLAGS+= -DATF_PKGDATADIR='"${SHAREDIR}/atf"'
++CXXFLAGS+= -DATF_SHELL='"/bin/sh"'
++CXXFLAGS+= -DATF_WORKDIR='"/tmp"'
++
+ WARNS?= 3
+
+ # vim: syntax=make
+diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile
+index 37d6073..90a2687 100644
+--- a/lib/atf/libatf-c++/Makefile
++++ b/lib/atf/libatf-c++/Makefile
+@@ -40,11 +40,11 @@ LDFLAGS+= -L${.OBJDIR}/../libatf-c
+ .PATH: ${ATF}/atf-c++
+ .PATH: ${ATF}/atf-c++/detail
+
+-CFLAGS+= -I${ATF}
+-CFLAGS+= -I${.CURDIR}/../libatf-c
+-CFLAGS+= -I.
++CXXFLAGS+= -I${ATF}
++CXXFLAGS+= -I${.CURDIR}/../libatf-c
++CXXFLAGS+= -I.
+
+-CFLAGS+= -DHAVE_CONFIG_H
++CXXFLAGS+= -DHAVE_CONFIG_H
+
+ SRCS= application.cpp \
+ build.cpp \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch
new file mode 100644
index 000000000000..6ef3f07de0fd
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch
@@ -0,0 +1,98 @@
+diff --git a/lib/libcam/Makefile b/lib/libcam/Makefile
+index 9a21dde..0815f0a 100644
+--- a/lib/libcam/Makefile
++++ b/lib/libcam/Makefile
+@@ -8,6 +8,7 @@ INCS= camlib.h
+
+ DPADD= ${LIBSBUF}
+ LDADD= -lsbuf
++LDFLAGS+= -L${.OBJDIR}/../libsbuf
+
+ MAN= cam.3 cam_cdbparse.3
+
+diff --git a/lib/libdwarf/Makefile b/lib/libdwarf/Makefile
+index dbd7895..607b1f6 100644
+--- a/lib/libdwarf/Makefile
++++ b/lib/libdwarf/Makefile
+@@ -21,6 +21,7 @@ SRCS= \
+ INCS= dwarf.h libdwarf.h
+
+ CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR}/../libelf
+
+ SHLIB_MAJOR= 3
+
+diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
+index 4449c06..f024cf0 100644
+--- a/lib/libproc/Makefile
++++ b/lib/libproc/Makefile
+@@ -14,6 +14,7 @@ SRCS= proc_bkpt.c \
+ INCS= libproc.h
+
+ CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR}/../libelf
+
+ .if ${MK_LIBCPLUSPLUS} != "no"
+ LDADD+= -lcxxrt
+@@ -27,4 +28,7 @@ SHLIB_MAJOR= 2
+
+ WITHOUT_MAN=
+
++LDADD+= -lelf
++LDFLAGS+= -L${.OBJDIR}/../libelf
++
+ .include <bsd.lib.mk>
+diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile
+index af5a775..c01aa05 100644
+--- a/lib/libprocstat/Makefile
++++ b/lib/libprocstat/Makefile
+@@ -16,6 +16,8 @@ VERSION_DEF= ${.CURDIR}/Versions.def
+ SYMBOL_MAPS= ${.CURDIR}/Symbol.map
+
+ INCS= libprocstat.h
++CFLAGS+= -I${.CURDIR}/../libelf
++LDFLAGS+= -L${.OBJDIR}/../libelf
+ CFLAGS+= -I. -I${.CURDIR} -D_KVM_VNODE
+ SHLIB_MAJOR= 1
+
+diff --git a/lib/librtld_db/Makefile b/lib/librtld_db/Makefile
+index 2815a07..e992662 100644
+--- a/lib/librtld_db/Makefile
++++ b/lib/librtld_db/Makefile
+@@ -10,5 +10,8 @@ SRCS= rtld_db.c
+ INCS= rtld_db.h
+
+ CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR}/../libelf
++LDADD+= -lutil -lproc
++LDFLAGS+= -L${.OBJDIR}/../libutil -L${.OBJDIR}/../libproc
+
+ .include <bsd.lib.mk>
+diff --git a/lib/libtelnet/Makefile b/lib/libtelnet/Makefile
+index 1cf52a0..3d25fae 100644
+--- a/lib/libtelnet/Makefile
++++ b/lib/libtelnet/Makefile
+@@ -13,6 +13,8 @@ INTERNALLIB=
+ SRCS= genget.c getent.c misc.c
+ CFLAGS+= -I${TELNETDIR}
+
++CFLAGS+= -I${.CURDIR}/../libmp
++
+ WARNS?= 2
+
+ .if !defined(RELEASE_CRUNCH)
+diff --git a/lib/libexecinfo/Makefile b/lib/libexecinfo/Makefile
+index 30a1dfb..9f8a99c 100644
+--- a/lib/libexecinfo/Makefile
++++ b/lib/libexecinfo/Makefile
+@@ -10,8 +10,10 @@ SHLIB_MAJOR= 1
+ INCS= execinfo.h
+ SRCS= backtrace.c symtab.c unwind.c
+
++CFLAGS+= -I${.CURDIR}/../libelf
+ DPADD= ${LIBELF}
+ LDADD= -lelf
++LDFLAGS+= -L${.OBJDIR}/../libelf
+
+ MAN= backtrace.3
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch
new file mode 100644
index 000000000000..55987aa44fa1
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch
@@ -0,0 +1,16 @@
+diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
+index f9e01ab..15b27d8 100644
+--- a/lib/libproc/Makefile
++++ b/lib/libproc/Makefile
+@@ -15,7 +15,10 @@ INCS= libproc.h
+
+ CFLAGS+= -I${.CURDIR}
+
+-.if ${MK_LIBCPLUSPLUS} != "no"
++.if ${CXX:T:M*-stdlib=libc++*}
++LDADD+= -lcxxrt
++DPADD+= ${LIBCXXRT}
++.elif ${CXXFLAGS:T:M*-stdlib=libc++*}
+ LDADD+= -lcxxrt
+ DPADD+= ${LIBCXXRT}
+ .else
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libusb.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libusb.patch
new file mode 100644
index 000000000000..296825259f08
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libusb.patch
@@ -0,0 +1,19 @@
+diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile
+index 21016a9..26010e8 100644
+--- a/lib/libusb/Makefile
++++ b/lib/libusb/Makefile
+@@ -40,11 +40,11 @@ CFLAGS+= -DCOMPAT_32BIT
+
+ beforeinstall:
+ ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+- ${.CURDIR}/libusb-0.1.pc ${DESTDIR}${LIBDATADIR}/pkgconfig
++ ${.CURDIR}/libusb-0.1.pc ${DESTDIR}${LIBDIR}/pkgconfig
+ ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+- ${.CURDIR}/libusb-1.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig
++ ${.CURDIR}/libusb-1.0.pc ${DESTDIR}${LIBDIR}/pkgconfig
+ ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+- ${.CURDIR}/libusb-2.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig
++ ${.CURDIR}/libusb-2.0.pc ${DESTDIR}${LIBDIR}/pkgconfig
+
+ #
+ # Cross platform support
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch
new file mode 100644
index 000000000000..00de8a6debb8
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch
@@ -0,0 +1,13 @@
+Index: fbsd-6/lib/libipsec/policy_token.l
+===================================================================
+--- fbsd-6.orig/lib/libipsec/policy_token.l
++++ fbsd-6/lib/libipsec/policy_token.l
+@@ -138,8 +138,6 @@ void
+ __policy__strbuffer__init__(msg)
+ char *msg;
+ {
+- if (yy_current_buffer)
+- yy_delete_buffer(yy_current_buffer);
+ strbuffer = (YY_BUFFER_STATE)yy_scan_string(msg);
+ yy_switch_to_buffer(strbuffer);
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch
new file mode 100644
index 000000000000..a3e7d5e1b63c
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch
@@ -0,0 +1,16 @@
+This patch is needed to avoid inclusion of GCC's float.h that defines
+LDBL_MANT_DIG at 53 (while the source file checks for 113 or 64.
+
+Index: freebsd-6.0_beta4/lib/msun/src/s_fmal.c
+===================================================================
+--- freebsd-6.0_beta4.orig/lib/msun/src/s_fmal.c
++++ freebsd-6.0_beta4/lib/msun/src/s_fmal.c
+@@ -28,7 +28,7 @@
+ __FBSDID("$FreeBSD: src/lib/msun/src/s_fmal.c,v 1.2 2005/03/18 02:27:59 das Exp $");
+
+ #include <fenv.h>
+-#include <float.h>
++#include <machine/float.h>
+ #include <math.h>
+
+ /*
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch
new file mode 100644
index 000000000000..2f6de4652822
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch
@@ -0,0 +1,13 @@
+Index: freebsd-6.0_beta4/lib/libpmc/Makefile
+===================================================================
+--- freebsd-6.0_beta4.orig/lib/libpmc/Makefile
++++ freebsd-6.0_beta4/lib/libpmc/Makefile
+@@ -9,6 +9,8 @@ WARNS?= 6
+
+ MAN= pmc.3 pmclog.3
+
++CFLAGS+= -I${.CURDIR}
++
+ MLINKS+= \
+ pmc.3 pmc_allocate.3 \
+ pmc.3 pmc_attach.3 \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch
new file mode 100644
index 000000000000..075f2780e693
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch
@@ -0,0 +1,20 @@
+--- lib/csu/amd64/Makefile.orig 2006-07-04 07:49:58 -0300
++++ lib/csu/amd64/Makefile 2006-07-04 07:50:15 -0300
+@@ -16,6 +16,7 @@
+ ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
+
+ realinstall:
++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
+ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${OBJS} ${DESTDIR}${LIBDIR}
+
+--- lib/csu/sparc64/Makefile.orig 2006-10-06 15:13:55 +0100
++++ lib/csu/sparc64/Makefile 2006-10-06 15:15:06 +0100
+@@ -15,6 +15,7 @@
+ ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC}
+
+ realinstall:
++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
+ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${OBJS} ${DESTDIR}${LIBDIR}
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch
new file mode 100644
index 000000000000..a9b8435eff66
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch
@@ -0,0 +1,11 @@
+--- lib/libsdp/Makefile 2007-06-15 12:04:37 +0200
++++ lib.sdp/libsdp/Makefile 2007-06-15 12:26:14 +0200
+@@ -5,7 +5,7 @@
+ MAN= sdp.3
+
+ WARNS?= 2
+-CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libbluetooth
+
+ SHLIB_MAJOR= 2
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch
new file mode 100644
index 000000000000..8de5df2d16a6
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch
@@ -0,0 +1,15 @@
+Fixes a compile error if XOPEN_SOURCE 600 is defined.
+
+See: http://www.mailinglistarchive.com/freebsd-current@freebsd.org/msg15011.html
+
+--- sys/sys/types.h.orig
++++ sys/sys/types.h
+@@ -46,7 +46,7 @@
+
+ #include <sys/_pthreadtypes.h>
+
+-#if __BSD_VISIBLE
++#ifndef _POSIX_SOURCE
+ typedef unsigned char u_char;
+ typedef unsigned short u_short;
+ typedef unsigned int u_int;
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch
new file mode 100644
index 000000000000..2ddb9eadb909
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch
@@ -0,0 +1,28 @@
+diff -Nur work.orig/include/rpcsvc/nis.x work/include/rpcsvc/nis.x
+--- work.orig/include/rpcsvc/nis.x 2009-10-25 10:10:29.000000000 +0900
++++ work/include/rpcsvc/nis.x 2011-04-13 21:25:13.000000000 +0900
+@@ -399,10 +399,7 @@
+ %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
+ %#define WORLD_DEFAULT (NIS_READ_ACC)
+ %#define GROUP_DEFAULT (NIS_READ_ACC << 8)
+-%#define OWNER_DEFAULT ((NIS_READ_ACC +\
+- NIS_MODIFY_ACC +\
+- NIS_CREATE_ACC +\
+- NIS_DESTROY_ACC) << 16)
++%#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16)
+ %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
+ %
+ %/* Result manipulation defines ... */
+@@ -431,10 +428,8 @@
+ % * these definitions they take an nis_object *, and an int and return
+ % * a u_char * for Value, and an int for length.
+ % */
+-%#define ENTRY_VAL(obj, col) \
+- (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
+-%#define ENTRY_LEN(obj, col) \
+- (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
++%#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
++%#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
+ %
+ %#ifdef __cplusplus
+ %}
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch
new file mode 100644
index 000000000000..a9fd18998287
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch
@@ -0,0 +1,21 @@
+log2 and log2f are required by C99 and are not implemented.
+Workaround the deficiency.
+
+--- lib/msun/src/math.h.old 2010-03-14 17:02:25.000000000 +0100
++++ lib/msun/src/math.h 2010-03-14 17:07:03.000000000 +0100
+@@ -203,6 +203,7 @@
+ double frexp(double, int *); /* fundamentally !__pure2 */
+ double ldexp(double, int);
+ double log(double);
++#define log2(x) log(x)/log(2.0)
+ double log10(double);
+ double modf(double, double *); /* fundamentally !__pure2 */
+
+@@ -319,6 +320,7 @@
+ float log10f(float);
+ float log1pf(float);
+ float logf(float);
++#define log2f(x) logf(x)/logf(2.0)
+ float modff(float, float *); /* fundamentally !__pure2 */
+
+ float powf(float, float);
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch
new file mode 100644
index 000000000000..a7de06fadf56
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch
@@ -0,0 +1,12 @@
+Without this linking fails during a stage3 build.
+
+--- lib/librpcsec_gss/Makefile.orig
++++ lib/librpcsec_gss/Makefile
+@@ -8,6 +8,7 @@
+
+ DPADD+= ${LIBGSSAPI}
+ LDADD+= -lgssapi
++LDFLAGS+= -L${.OBJDIR}/../libgssapi
+
+ VERSION_DEF= ${.CURDIR}/../libc/Versions.def
+ SYMBOL_MAPS= ${.CURDIR}/Symbol.map
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch
new file mode 100644
index 000000000000..c8be7f48472e
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch
@@ -0,0 +1,19 @@
+--- lib/libproc/Makefile.old 2011-07-06 00:58:04.000000000 +0000
++++ lib/libproc/Makefile 2011-07-06 00:58:58.000000000 +0000
+@@ -18,5 +18,6 @@
+ WARNS?= 6
+
+ WITHOUT_MAN= yes
++LDADD=-lelf
+
+ .include <bsd.lib.mk>
+--- lib/librtld_db/Makefile.old 2011-07-06 00:58:12.000000000 +0000
++++ lib/librtld_db/Makefile 2011-07-06 00:59:27.000000000 +0000
+@@ -10,5 +10,7 @@
+ INCS= rtld_db.h
+
+ CFLAGS+= -I${.CURDIR}
++LDADD=-lutil -lproc
++LDFLAGS+=-L${.CURDIR}/../libutil -L${.CURDIR}/../libproc
+
+ .include <bsd.lib.mk>
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch
new file mode 100644
index 000000000000..556ade50b033
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch
@@ -0,0 +1,10 @@
+--- include/unistd.h 2010/12/20 20:39:49 216602
++++ include/unistd.h 2010/12/20 21:12:18 216603
+@@ -529,6 +529,7 @@
+ #define _MKTEMP_DECLARED
+ #endif
+ int nfssvc(int, void *);
++int nlm_syscall(int, int, int, char **);
+ int profil(char *, size_t, vm_offset_t, int);
+ int rcmd(char **, int, const char *, const char *, const char *, int *);
+ int rcmd_af(char **, int, const char *,
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch
new file mode 100644
index 000000000000..cf1172ab6335
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch
@@ -0,0 +1,12 @@
+diff -Nur lib.orig/libsdp/Makefile lib/libsdp/Makefile
+--- lib.orig/libsdp/Makefile 2012-12-25 20:28:50.000000000 +0900
++++ lib/libsdp/Makefile 2012-12-25 20:31:19.000000000 +0900
+@@ -5,7 +5,7 @@
+ MAN= sdp.3
+
+ WARNS?= 2
+-CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libbluetooth
+
+ SHLIB_MAJOR= 4
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch
new file mode 100644
index 000000000000..ad9b9608f42c
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch
@@ -0,0 +1,215 @@
+Index: lib/libc/gen/glob.c
+===================================================================
+--- lib/libc/gen/glob.c (revision 246357)
++++ lib/libc/gen/glob.c (working copy)
+@@ -94,6 +94,25 @@ __FBSDID("$FreeBSD$");
+
+ #include "collate.h"
+
++/*
++ * glob(3) expansion limits. Stop the expansion if any of these limits
++ * is reached. This caps the runtime in the face of DoS attacks. See
++ * also CVE-2010-2632
++ */
++#define GLOB_LIMIT_BRACE 128 /* number of brace calls */
++#define GLOB_LIMIT_PATH 65536 /* number of path elements */
++#define GLOB_LIMIT_READDIR 16384 /* number of readdirs */
++#define GLOB_LIMIT_STAT 1024 /* number of stat system calls */
++#define GLOB_LIMIT_STRING ARG_MAX /* maximum total size for paths */
++
++struct glob_limit {
++ size_t l_brace_cnt;
++ size_t l_path_lim;
++ size_t l_readdir_cnt;
++ size_t l_stat_cnt;
++ size_t l_string_cnt;
++};
++
+ #define DOLLAR '$'
+ #define DOT '.'
+ #define EOS '\0'
+@@ -153,15 +172,18 @@ static const Char *g_strchr(const Char *, wchar_t)
+ static Char *g_strcat(Char *, const Char *);
+ #endif
+ static int g_stat(Char *, struct stat *, glob_t *);
+-static int glob0(const Char *, glob_t *, size_t *);
+-static int glob1(Char *, glob_t *, size_t *);
+-static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
+-static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
+-static int globextend(const Char *, glob_t *, size_t *);
+-static const Char *
++static int glob0(const Char *, glob_t *, struct glob_limit *);
++static int glob1(Char *, glob_t *, struct glob_limit *);
++static int glob2(Char *, Char *, Char *, Char *, glob_t *,
++ struct glob_limit *);
++static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *,
++ struct glob_limit *);
++static int globextend(const Char *, glob_t *, struct glob_limit *);
++static const Char *
+ globtilde(const Char *, Char *, size_t, glob_t *);
+-static int globexp1(const Char *, glob_t *, size_t *);
+-static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
++static int globexp1(const Char *, glob_t *, struct glob_limit *);
++static int globexp2(const Char *, const Char *, glob_t *, int *,
++ struct glob_limit *);
+ static int match(Char *, Char *, Char *);
+ #ifdef DEBUG
+ static void qprintf(const char *, Char *);
+@@ -171,8 +193,8 @@ int
+ glob(const char * __restrict pattern, int flags,
+ int (*errfunc)(const char *, int), glob_t * __restrict pglob)
+ {
++ struct glob_limit limit = { 0, 0, 0, 0, 0 };
+ const char *patnext;
+- size_t limit;
+ Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot;
+ mbstate_t mbs;
+ wchar_t wc;
+@@ -186,11 +208,10 @@ glob(const char * __restrict pattern, int flags,
+ pglob->gl_offs = 0;
+ }
+ if (flags & GLOB_LIMIT) {
+- limit = pglob->gl_matchc;
+- if (limit == 0)
+- limit = ARG_MAX;
+- } else
+- limit = 0;
++ limit.l_path_lim = pglob->gl_matchc;
++ if (limit.l_path_lim == 0)
++ limit.l_path_lim = GLOB_LIMIT_PATH;
++ }
+ pglob->gl_flags = flags & ~GLOB_MAGCHAR;
+ pglob->gl_errfunc = errfunc;
+ pglob->gl_matchc = 0;
+@@ -243,11 +264,17 @@ glob(const char * __restrict pattern, int flags,
+ * characters
+ */
+ static int
+-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
++globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
+ {
+ const Char* ptr = pattern;
+ int rv;
+
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) {
++ errno = 0;
++ return (GLOB_NOSPACE);
++ }
++
+ /* Protect a single {}, for find(1), like csh */
+ if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
+ return glob0(pattern, pglob, limit);
+@@ -266,7 +293,8 @@ static int
+ * If it fails then it tries to glob the rest of the pattern and returns.
+ */
+ static int
+-globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit)
++globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
++ struct glob_limit *limit)
+ {
+ int i;
+ Char *lm, *ls;
+@@ -436,7 +464,7 @@ globtilde(const Char *pattern, Char *patbuf, size_
+ * if things went well, nonzero if errors occurred.
+ */
+ static int
+-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
++glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
+ {
+ const Char *qpatnext;
+ int err;
+@@ -529,7 +557,7 @@ compare(const void *p, const void *q)
+ }
+
+ static int
+-glob1(Char *pattern, glob_t *pglob, size_t *limit)
++glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit)
+ {
+ Char pathbuf[MAXPATHLEN];
+
+@@ -547,7 +575,7 @@ static int
+ */
+ static int
+ glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
+- glob_t *pglob, size_t *limit)
++ glob_t *pglob, struct glob_limit *limit)
+ {
+ struct stat sb;
+ Char *p, *q;
+@@ -563,6 +591,15 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_
+ if (g_lstat(pathbuf, &sb, pglob))
+ return(0);
+
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) {
++ errno = 0;
++ if (pathend + 1 > pathend_last)
++ return (GLOB_ABORTED);
++ *pathend++ = SEP;
++ *pathend = EOS;
++ return (GLOB_NOSPACE);
++ }
+ if (((pglob->gl_flags & GLOB_MARK) &&
+ pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
+ || (S_ISLNK(sb.st_mode) &&
+@@ -606,7 +643,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_
+ static int
+ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
+ Char *pattern, Char *restpattern,
+- glob_t *pglob, size_t *limit)
++ glob_t *pglob, struct glob_limit *limit)
+ {
+ struct dirent *dp;
+ DIR *dirp;
+@@ -652,6 +689,19 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_
+ size_t clen;
+ mbstate_t mbs;
+
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) {
++ errno = 0;
++ if (pathend + 1 > pathend_last)
++ err = GLOB_ABORTED;
++ else {
++ *pathend++ = SEP;
++ *pathend = EOS;
++ err = GLOB_NOSPACE;
++ }
++ break;
++ }
++
+ /* Initial DOT must be matched literally. */
+ if (dp->d_name[0] == DOT && *pattern != DOT)
+ continue;
+@@ -702,14 +752,15 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_
+ * gl_pathv points to (gl_offs + gl_pathc + 1) items.
+ */
+ static int
+-globextend(const Char *path, glob_t *pglob, size_t *limit)
++globextend(const Char *path, glob_t *pglob, struct glob_limit *limit)
+ {
+ char **pathv;
+ size_t i, newsize, len;
+ char *copy;
+ const Char *p;
+
+- if (*limit && pglob->gl_pathc > *limit) {
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ pglob->gl_matchc > limit->l_path_lim) {
+ errno = 0;
+ return (GLOB_NOSPACE);
+ }
+@@ -737,6 +788,12 @@ static int
+ for (p = path; *p++;)
+ continue;
+ len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */
++ limit->l_string_cnt += len;
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ limit->l_string_cnt >= GLOB_LIMIT_STRING) {
++ errno = 0;
++ return (GLOB_NOSPACE);
++ }
+ if ((copy = malloc(len)) != NULL) {
+ if (g_Ctoc(path, copy, len)) {
+ free(copy);
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch
new file mode 100644
index 000000000000..f8e470736c64
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch
@@ -0,0 +1,21 @@
+diff -uNr lib.ol/libproc/Makefile lib/libproc/Makefile
+--- lib.ol/libproc/Makefile 2011-11-02 14:02:17.000000000 +0000
++++ lib/libproc/Makefile 2011-11-02 14:03:09.000000000 +0000
+@@ -16,5 +16,6 @@
+ SHLIB_MAJOR= 2
+
+ WITHOUT_MAN=
++LDADD+=-lelf
+
+ .include <bsd.lib.mk>
+diff -uNr lib.ol/librtld_db/Makefile lib/librtld_db/Makefile
+--- lib.ol/librtld_db/Makefile 2011-11-02 14:02:13.000000000 +0000
++++ lib/librtld_db/Makefile 2011-11-02 14:04:00.000000000 +0000
+@@ -10,5 +10,7 @@
+ INCS= rtld_db.h
+
+ CFLAGS+= -I${.CURDIR}
++LDADD+=-lutil -lproc
++LDFLAGS+=-L${.OBJDIR}/../libutil -L${.OBJDIR}/../libproc
+
+ .include <bsd.lib.mk>
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch
new file mode 100644
index 000000000000..c1c2a0e04560
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch
@@ -0,0 +1,11 @@
+diff -Nur lib.orig/libncp/Makefile lib/libncp/Makefile
+--- lib.orig/libncp/Makefile 2012-12-25 20:35:16.000000000 +0900
++++ lib/libncp/Makefile 2012-12-25 20:36:23.000000000 +0900
+@@ -6,6 +6,7 @@
+
+ DPADD= ${LIBIPX}
+ LDADD= -lipx
++LDFLAGS+=-L${.OBJDIR}/../libipx
+
+ SRCS= ncpl_subr.c ncpl_bind.c ncpl_queue.c ncpl_file.c ncpl_misc.c \
+ ncpl_net.c ncpl_rcfile.c ncpl_conn.c ncpl_nls.c ncpl_msg.c \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch
new file mode 100644
index 000000000000..bf77a0a5219f
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch
@@ -0,0 +1,122 @@
+Fixes warnings like:
+/var/tmp/portage/sys-freebsd/freebsd-lib-9.0-r2/work/lib/libopie/../../contrib/opie/libopie/randomchallenge.c:43:5:
+warning: incompatible implicit declaration of built-in function ‘strcpy’
+
+diff -uNr contrib.old/opie/libopie/accessfile.c contrib/opie/libopie/accessfile.c
+--- contrib.old/opie/libopie/accessfile.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/accessfile.c 2012-05-25 09:12:34.000000000 -0400
+@@ -46,6 +46,7 @@
+ #ifdef DEBUG
+ #include <syslog.h>
+ #endif /* DEBUG */
++#include <ctype.h>
+
+ #include "opie.h"
+
+diff -uNr contrib.old/opie/libopie/generator.c contrib/opie/libopie/generator.c
+--- contrib.old/opie/libopie/generator.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/generator.c 2012-05-25 08:58:10.000000000 -0400
+@@ -50,6 +50,7 @@
+ #include <syslog.h>
+ #endif /* DEBUG */
+ #include "opie.h"
++#include <stdio.h>
+
+ static char *algids[] = { NULL, NULL, NULL, "sha1", "md4", "md5" };
+
+diff -uNr contrib.old/opie/libopie/lookup.c contrib/opie/libopie/lookup.c
+--- contrib.old/opie/libopie/lookup.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/lookup.c 2012-05-25 09:15:08.000000000 -0400
+@@ -14,6 +14,7 @@
+ #include "opie_cfg.h"
+ #include <stdio.h>
+ #include "opie.h"
++#include <string.h>
+
+ int opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal)
+ {
+diff -uNr contrib.old/opie/libopie/newseed.c contrib/opie/libopie/newseed.c
+--- contrib.old/opie/libopie/newseed.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/newseed.c 2012-05-25 09:14:37.000000000 -0400
+@@ -36,6 +36,9 @@
+ #include <syslog.h>
+ #endif /* DEBUG */
+ #include "opie.h"
++#include <stdio.h>
++#include <stdlib.h>
++#include <time.h>
+
+ int opienewseed FUNCTION((seed), char *seed)
+ {
+diff -uNr contrib.old/opie/libopie/parsechallenge.c contrib/opie/libopie/parsechallenge.c
+--- contrib.old/opie/libopie/parsechallenge.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/parsechallenge.c 2012-05-25 09:15:54.000000000 -0400
+@@ -20,6 +20,8 @@
+ #include <string.h>
+ #endif /* HAVE_STRING_H */
+ #include "opie.h"
++#include <stdlib.h>
++#include <ctype.h>
+
+ struct algorithm {
+ char *name;
+diff -uNr contrib.old/opie/libopie/passwd.c contrib/opie/libopie/passwd.c
+--- contrib.old/opie/libopie/passwd.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/passwd.c 2012-05-25 09:13:45.000000000 -0400
+@@ -22,6 +22,7 @@
+
+ #include "opie_cfg.h"
+ #include "opie.h"
++#include <string.h>
+
+ int opiepasswd FUNCTION((old, flags, principal, n, seed, ks), struct opie *old AND int flags AND char *principal AND int n AND char *seed AND char *ks)
+ {
+diff -uNr contrib.old/opie/libopie/randomchallenge.c contrib/opie/libopie/randomchallenge.c
+--- contrib.old/opie/libopie/randomchallenge.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/randomchallenge.c 2012-05-25 09:00:27.000000000 -0400
+@@ -28,6 +28,9 @@
+
+ #include "opie_cfg.h"
+ #include "opie.h"
++#include <stdio.h>
++#include <string.h>
++#include <stdlib.h>
+
+ static char *algids[] = { 0, 0, 0, "sha1", "md4", "md5" };
+
+diff -uNr contrib.old/opie/libopie/verify.c contrib/opie/libopie/verify.c
+--- contrib.old/opie/libopie/verify.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/verify.c 2012-05-25 09:12:09.000000000 -0400
+@@ -25,6 +25,7 @@
+ #include <string.h>
+ #endif /* HAVE_STRING_H */
+ #include "opie.h"
++#include <ctype.h>
+
+ #define RESPONSE_STANDARD 0
+ #define RESPONSE_WORD 1
+diff -uNr contrib.old/opie/libopie/version.c contrib/opie/libopie/version.c
+--- contrib.old/opie/libopie/version.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/version.c 2012-05-25 09:13:15.000000000 -0400
+@@ -19,6 +19,8 @@
+ */
+ #include "opie_cfg.h"
+ #include "opie.h"
++#include <stdio.h>
++#include <stdlib.h>
+
+ VOIDRET opieversion FUNCTION_NOARGS
+ {
+diff -uNr contrib.old/opie/opie.h contrib/opie/opie.h
+--- contrib.old/opie/opie.h 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/opie.h 2012-05-25 09:21:28.000000000 -0400
+@@ -158,6 +158,9 @@
+ int __opiereadrec __P((struct opie *));
+ int __opiewriterec __P((struct opie *));
+ int __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));
++VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND VOIDPTR in AND struct opie_otpkey *out AND int n);
++int opieinsecure FUNCTION_NOARGS;
++int opienewseed FUNCTION((seed), char *seed);
+ __END_DECLS
+
+ #define opiestrncpy(dst, src, n) \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch
new file mode 100644
index 000000000000..fdb7e16f6e08
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch
@@ -0,0 +1,17 @@
+Fix "no .eh_frame_hdr table will be created" error.
+
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47829
+http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4a0e0cd7377c45dc21d5c71bcab931b5e5727e74
+
+diff -Nur lib.orig/csu/i386-elf/Makefile lib/csu/i386-elf/Makefile
+--- lib.orig/csu/i386-elf/Makefile 2013-03-06 01:07:57.000000000 +0900
++++ lib/csu/i386-elf/Makefile 2013-03-06 01:10:09.000000000 +0900
+@@ -10,6 +10,8 @@
+ FILESDIR= ${LIBDIR}
+ CFLAGS+= -I${.CURDIR}/../common \
+ -I${.CURDIR}/../../libc/include
++CFLAGS+= -fno-omit-frame-pointer
++CFLAGS+= -fno-asynchronous-unwind-tables
+ CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
+ CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch
new file mode 100644
index 000000000000..97ac14160b87
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch
@@ -0,0 +1,51 @@
+Backport aligned_alloc for C++11 support.
+
+http://lists.freebsd.org/pipermail/svn-src-stable-9/2012-November/003313.html
+
+diff -uNr lib.old/libc/stdlib/Symbol.map lib/libc/stdlib/Symbol.map
+--- lib.old/libc/stdlib/Symbol.map 2013-05-24 17:03:55.000000000 -0400
++++ lib/libc/stdlib/Symbol.map 2013-05-24 17:06:03.000000000 -0400
+@@ -97,6 +97,7 @@
+ atoi_l;
+ atol_l;
+ atoll_l;
++ aligned_alloc;
+ at_quick_exit;
+ quick_exit;
+ strtod_l;
+diff -uNr lib.old/libc/stdlib/malloc.c lib/libc/stdlib/malloc.c
+--- lib.old/libc/stdlib/malloc.c 2013-05-24 17:03:55.000000000 -0400
++++ lib/libc/stdlib/malloc.c 2013-05-24 17:05:40.000000000 -0400
+@@ -6046,6 +6046,21 @@
+ }
+
+ void *
++aligned_alloc(size_t alignment, size_t size)
++{
++ void *memptr;
++ int ret;
++
++ ret = posix_memalign(&memptr, alignment, size);
++ if (ret != 0) {
++ errno = ret;
++ return (NULL);
++ }
++ return (memptr);
++}
++
++
++void *
+ calloc(size_t num, size_t size)
+ {
+ void *ret;
+diff -uNr includeold/stdlib.h include/stdlib.h
+--- includeold/stdlib.h 2013-05-24 17:03:46.000000000 -0400
++++ include/stdlib.h 2013-05-24 17:04:46.000000000 -0400
+@@ -155,6 +155,7 @@
+ * If we're in a mode greater than C99, expose C1x functions.
+ */
+ #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
++void * aligned_alloc(size_t, size_t);
+ _Noreturn void
+ quick_exit(int);
+ int at_quick_exit(void (*)(void));
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch
new file mode 100644
index 000000000000..62357e0830db
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch
@@ -0,0 +1,16 @@
+--- include/Makefile.orig 2013-06-16 10:47:52.000000000 +0200
++++ include/Makefile 2013-06-16 10:47:37.000000000 +0200
+@@ -6,11 +6,11 @@
+ .include <bsd.own.mk>
+
+ CLEANFILES= osreldate.h version vers.c
++SUBDIR= arpa protocols rpcsvc rpc xlocale
+-SUBDIR= arpa gssapi protocols rpcsvc rpc xlocale
+ INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
+ db.h \
+ dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
++ fts.h ftw.h getopt.h glob.h grp.h \
+- fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
+ ieeefp.h ifaddrs.h \
+ inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
+ locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch
new file mode 100644
index 000000000000..00b39f750ec1
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch
@@ -0,0 +1,30 @@
+Please do not disable this patch.
+All commands will be non-executable.
+Abort trap: 6 (core dumped) is displayed...
+
+Details see Gentoo Bug #511698.
+https://bugs.gentoo.org/show_bug.cgi?id=511698
+
+diff --git a/lib/libc/Makefile b/lib/libc/Makefile
+index 1cc23b7..7dd458e 100644
+--- a/lib/libc/Makefile
++++ b/lib/libc/Makefile
+@@ -149,6 +149,6 @@ CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
+ # in the future to circumvent this.
+ SSP_CFLAGS:= ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/}
+ # Disable stack protection for SSP symbols.
+-SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
++SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/:C/^$/-fno-stack-protector/}
+ # Generate stack unwinding tables for cancellation points
+ CANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//}
+diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc
+index f92d87d..7a3a2f3 100644
+--- a/lib/csu/Makefile.inc
++++ b/lib/csu/Makefile.inc
+@@ -1,5 +1,5 @@
+ # $FreeBSD: release/9.1.0/lib/csu/Makefile.inc 204757 2010-03-05 13:29:05Z uqs $
+
+-SSP_CFLAGS=
++SSP_CFLAGS= -fno-stack-protector
+
+ .include "../Makefile.inc"
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch
new file mode 100644
index 000000000000..ec90defc03a0
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch
@@ -0,0 +1,13 @@
+diff -u lib/libgeom/Makefile lib.xml/libgeom/Makefile
+--- lib/libgeom/Makefile 2004-03-07 16:07:57 +0000
++++ lib.xml/libgeom/Makefile 2005-05-06 10:38:41 +0000
+@@ -8,7 +8,8 @@
+ SRCS+= geom_ctl.c
+ INCS= libgeom.h
+
+-CFLAGS += -I${.CURDIR}
++CFLAGS += -I${.CURDIR} -I${.CURDIR}/../libexpat
++LDFLAGS += -L${.CURDIR}/../libexpat
+
+ WARNS?= 3
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch
new file mode 100644
index 000000000000..1b4e79129bfc
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch
@@ -0,0 +1,26 @@
+diff -ur lib/libgeom.old/Makefile lib/libgeom/Makefile
+--- lib/libgeom.old/Makefile 2011-07-10 14:23:51.000000000 +0000
++++ lib/libgeom/Makefile 2011-07-10 15:12:39.000000000 +0000
+@@ -13,8 +13,8 @@
+
+ WARNS?= 3
+
+-DPADD= ${LIBBSDXML} ${LIBSBUF}
+-LDADD= -lbsdxml -lsbuf
++DPADD= ${LIBSBUF}
++LDADD= -lexpat -lsbuf
+
+ MAN= libgeom.3
+
+diff -ur lib/libgeom.old/geom_xml2tree.c lib/libgeom/geom_xml2tree.c
+--- lib/libgeom.old/geom_xml2tree.c 2010-12-21 17:09:25.000000000 +0000
++++ lib/libgeom/geom_xml2tree.c 2011-07-10 15:12:52.000000000 +0000
+@@ -43,7 +43,7 @@
+ #include <sys/sbuf.h>
+ #include <sys/sysctl.h>
+ #include <err.h>
+-#include <bsdxml.h>
++#include <expat.h>
+ #include <libgeom.h>
+
+ struct mystate {
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch
new file mode 100644
index 000000000000..c2cf1421ea9e
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch
@@ -0,0 +1,13 @@
+Fix headers dependencies so that they can be included alone.
+
+--- include/ifaddrs.h.old 2009-05-15 13:50:10 +0000
++++ include/ifaddrs.h 2009-05-15 13:50:23 +0000
+@@ -28,6 +28,8 @@
+ #ifndef _IFADDRS_H_
+ #define _IFADDRS_H_
+
++#include <sys/types.h>
++
+ struct ifaddrs {
+ struct ifaddrs *ifa_next;
+ char *ifa_name;
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch
new file mode 100644
index 000000000000..c9288a45c61f
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch
@@ -0,0 +1,68 @@
+--- lib/msun/i387/fenv.c.orig 2007-01-05 04:15:26 -0300
++++ lib/msun/i387/fenv.c 2008-06-14 00:49:30 -0300
+@@ -152,7 +152,8 @@
+ int
+ feupdateenv(const fenv_t *envp)
+ {
+- int mxcsr, status;
++ int mxcsr;
++ short status;
+
+ __fnstsw(&status);
+ if (__HAS_SSE())
+--- lib/msun/i387/fenv.h.orig 2007-01-06 18:46:23 -0300
++++ lib/msun/i387/fenv.h 2008-06-14 01:06:40 -0300
+@@ -134,7 +134,8 @@
+ static __inline int
+ fegetexceptflag(fexcept_t *__flagp, int __excepts)
+ {
+- int __mxcsr, __status;
++ int __mxcsr;
++ short __status;
+
+ __fnstsw(&__status);
+ if (__HAS_SSE())
+@@ -151,7 +152,8 @@
+ static __inline int
+ fetestexcept(int __excepts)
+ {
+- int __mxcsr, __status;
++ int __mxcsr;
++ short __status;
+
+ __fnstsw(&__status);
+ if (__HAS_SSE())
+--- lib/msun/amd64/fenv.c.orig 2007-01-05 04:15:26 -0300
++++ lib/msun/amd64/fenv.c 2008-06-14 01:02:41 -0300
+@@ -101,7 +101,8 @@
+ int
+ feupdateenv(const fenv_t *envp)
+ {
+- int mxcsr, status;
++ int mxcsr;
++ short status;
+
+ __fnstsw(&status);
+ __stmxcsr(&mxcsr);
+--- lib/msun/amd64/fenv.h.orig 2007-01-06 18:46:23 -0300
++++ lib/msun/amd64/fenv.h 2008-06-14 01:08:23 -0300
+@@ -110,7 +110,8 @@
+ static __inline int
+ fegetexceptflag(fexcept_t *__flagp, int __excepts)
+ {
+- int __mxcsr, __status;
++ int __mxcsr;
++ short __status;
+
+ __stmxcsr(&__mxcsr);
+ __fnstsw(&__status);
+@@ -124,7 +125,8 @@
+ static __inline int
+ fetestexcept(int __excepts)
+ {
+- int __mxcsr, __status;
++ int __mxcsr;
++ short __status;
+
+ __stmxcsr(&__mxcsr);
+ __fnstsw(&__status);
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch b/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch
new file mode 100644
index 000000000000..751a77c843bb
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch
@@ -0,0 +1,13 @@
+u_int is defined in sys/types.h
+makes header usable alone.
+
+--- sys/sys/sysctl.h.old 2012-05-25 11:08:53.000000000 -0400
++++ sys/sys/sysctl.h 2012-05-25 11:09:16.000000000 -0400
+@@ -788,6 +788,7 @@
+ struct sysctl_req *);
+ #else /* !_KERNEL */
+ #include <sys/cdefs.h>
++#include <sys/types.h> /* for u_int */
+
+ __BEGIN_DECLS
+ int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
diff --git a/sys-freebsd/freebsd-lib/files/libmap.conf b/sys-freebsd/freebsd-lib/files/libmap.conf
new file mode 100644
index 000000000000..7a879f973788
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/libmap.conf
@@ -0,0 +1,8 @@
+# /etc/libmap.conf
+
+# Ensure that libthr does all threading
+libpthread.so.2 libthr.so.2
+libpthread.so libthr.so
+libc_r.so.6 libthr.so.2
+libc_r.so libthr.so
+
diff --git a/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in b/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in
new file mode 100644
index 000000000000..058ecb4384a3
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libusb
+Description: USB access library (FreeBSD version)
+Version: 1.0.1
+Libs: -L${libdir} -lusb
+Cflags: -I${includedir}
+
diff --git a/sys-freebsd/freebsd-lib/files/libusb.pc.in b/sys-freebsd/freebsd-lib/files/libusb.pc.in
new file mode 100644
index 000000000000..f63c6e399816
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/libusb.pc.in
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libusb
+Description: USB access library (FreeBSD version)
+Version: 0.1.12
+Libs: -L${libdir} -lusb
+Cflags: -I${includedir}
+