public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Yuta SATOH" <nigoro.gentoo@0x100.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-bsd:master commit in: sys-freebsd/freebsd-share/files/, sys-freebsd/freebsd-mk-defs/files/, ...
Date: Fri, 27 Jul 2012 11:55:31 +0000 (UTC)	[thread overview]
Message-ID: <1343388540.fdd6722a67e75f8e755d4885e16d38e45cef28d9.yuta_satoh@gentoo> (raw)

commit:     fdd6722a67e75f8e755d4885e16d38e45cef28d9
Author:     Yuta SATOH <nigoro <AT> gentoo <DOT> gr <DOT> jp>
AuthorDate: Fri Jul 27 11:29:00 2012 +0000
Commit:     Yuta SATOH <nigoro.gentoo <AT> 0x100 <DOT> com>
CommitDate: Fri Jul 27 11:29:00 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=commit;h=fdd6722a

sys-freebsd/*/files -- synced to latest portage tree

---
 .../boot0/files/boot0-8.2-zfsboot-makefile.patch   |   13 +
 .../files/freebsd-cddl-8.2-libpaths.patch          |   22 ++
 .../files/freebsd-cddl-9.0-bsdxml.patch            |   28 ++
 .../files/freebsd-cddl-9.0-libpaths.patch          |  167 ++++++++++
 .../files/freebsd-cddl-9.0-underlink.patch         |   22 ++
 sys-freebsd/freebsd-cddl/files/zfs.initd           |   24 ++
 sys-freebsd/freebsd-cddl/files/zvol.initd          |   10 +-
 .../files/{zvol.initd => zvol.initd-9.0}           |   12 +-
 .../freebsd-lib/files/freebsd-lib-8.0-gcc45.patch  |   28 ++
 .../files/freebsd-lib-8.2-liblink.patch            |   19 ++
 .../files/freebsd-lib-8.2-nlm_syscall.patch        |   10 +
 .../files/freebsd-lib-9.0-liblink.patch            |   21 ++
 .../files/freebsd-lib-9.0-opieincludes.patch       |  122 ++++++++
 .../files/freebsd-lib-9.0-trylock-adaptive.patch   |   14 +
 .../files/freebsd-lib-bsdxml2expat.patch           |   26 ++
 .../files/freebsd-sources-9.0-sysctluint.patch     |   13 +
 .../files/freebsd-libexec-8.2-rtld.patch           |   40 +++
 .../files/freebsd-mk-defs-9.0-gentoo.patch         |  326 ++++++++++++++++++++
 .../files/freebsd-mk-defs-9.0-gnu.patch            |   79 +++++
 .../files/freebsd-pam-modules-9.0-gentoo.patch     |   22 ++
 .../freebsd-pf/files/freebsd-pf-9.0-bpf.patch      |   10 +
 .../freebsd-pf/files/freebsd-pf-9.0-getline.patch  |   38 +++
 .../freebsd-pf/files/freebsd-pf-9.0-libevent.patch |   15 +
 .../files/freebsd-pf-9.0-pcap_pollution.patch      |   17 +
 .../freebsd-pf/files/freebsd-pf-9.0-pflogd.patch   |   13 +
 .../files/freebsd-rescue-8.2-libzcleverlink.patch  |   20 ++
 .../files/freebsd-sbin-bsdxml2expat.patch          |   13 +
 .../files/freebsd-sbin-bsdxml2expat.patch          |   13 +
 .../files/freebsd-share-9.0-gentoowaydir.patch     |   16 +
 .../files/freebsd-sources-8.2-unix2.patch          |   55 ++++
 .../freebsd-sources-9.0-disable-optimization.patch |   32 ++
 ...freebsd-sources-9.0-disable-optimizations.patch |   30 ++
 .../files/freebsd-sources-9.0-gentoo.patch         |   33 ++
 .../files/freebsd-sources-9.0-ipv6refcount.patch   |  128 ++++++++
 .../files/freebsd-sources-9.0-sysctluint.patch     |   13 +
 .../files/freebsd-sources-cve-2012-0217.patch      |   26 ++
 .../files/freebsd-ubin-8.2-compress.patch          |   55 ++++
 .../files/freebsd-ubin-9.0-fixmakefiles.patch      |   11 +
 .../files/freebsd-usbin-8.2-newsyslog.patch        |   10 +
 .../files/freebsd-usbin-9.0-libarchive.patch       |   12 +
 .../files/freebsd-usbin-9.0-newsyslog.patch        |   12 +
 sys-freebsd/freebsd-usbin/files/mountd.patch       |   15 +
 sys-freebsd/freebsd-usbin/files/nfs.initd          |    6 +-
 43 files changed, 1600 insertions(+), 11 deletions(-)

diff --git a/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch b/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch
new file mode 100644
index 0000000..a3a33d5
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch
@@ -0,0 +1,13 @@
+diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
+index bb16ea3..7dedb49 100644
+--- a/sys/boot/i386/zfsboot/Makefile
++++ b/sys/boot/i386/zfsboot/Makefile
+@@ -83,6 +83,8 @@ zfsboot.bin: zfsboot.out
+ zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o
+ 	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
+ 
++drv.o: drv.c xreadorg.h
++
+ zfsboot.o: zfsboot.s
+ 
+ SRCS=	zfsboot.c xreadorg.h

diff --git a/sys-freebsd/freebsd-cddl/files/freebsd-cddl-8.2-libpaths.patch b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-8.2-libpaths.patch
new file mode 100644
index 0000000..a0e5677
--- /dev/null
+++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-8.2-libpaths.patch
@@ -0,0 +1,22 @@
+--- cddl/usr.sbin/dtrace/Makefile.old	2011-07-06 00:09:01.000000000 +0000
++++ cddl/usr.sbin/dtrace/Makefile	2011-07-06 00:09:48.000000000 +0000
+@@ -24,6 +24,8 @@
+ #CFLAGS+=	-DNEED_ERRLOC
+ #YFLAGS+=	-d
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libdtrace -L${.CURDIR}/../../lib/libctf
++
+ DPADD=		${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
+ 		${LIBCTF} ${LIBELF} ${LIBZ} ${LIBUTIL} ${LIBRTLD_DB}
+ LDADD=		-lpthread -ldtrace -ly -lfl -lproc -lctf -lelf -lz -lutil \
+--- cddl/usr.sbin/lockstat/Makefile.old	2011-07-06 00:10:33.000000000 +0000
++++ cddl/usr.sbin/lockstat/Makefile	2011-07-06 00:10:57.000000000 +0000
+@@ -23,6 +23,8 @@
+ 
+ CFLAGS+=	-DNEED_ERRLOC -g
+ 
++LDFLAGS+=-L${.CURDIR}/../../lib/libdtrace -L${.CURDIR}/../../lib/libctf
++
+ #YFLAGS+=	-d
+ 
+ DPADD=		${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \

diff --git a/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-bsdxml.patch b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-bsdxml.patch
new file mode 100644
index 0000000..b3d95bb
--- /dev/null
+++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-bsdxml.patch
@@ -0,0 +1,28 @@
+diff -ur cddl.old/sbin/zfs/Makefile cddl/sbin/zfs/Makefile
+--- cddl.old/sbin/zfs/Makefile	2011-11-04 10:01:46.000000000 +0000
++++ cddl/sbin/zfs/Makefile	2011-11-04 10:07:15.000000000 +0000
+@@ -21,8 +21,8 @@
+ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
+ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
+ 
+-DPADD=	${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
++DPADD=	${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
+ 	${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
+-LDADD=	-lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
++LDADD=	-lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
+ 
+ .include <bsd.prog.mk>
+diff -ur cddl.old/sbin/zpool/Makefile cddl/sbin/zpool/Makefile
+--- cddl.old/sbin/zpool/Makefile	2011-11-04 10:01:46.000000000 +0000
++++ cddl/sbin/zpool/Makefile	2011-11-04 10:06:38.000000000 +0000
+@@ -26,8 +26,8 @@
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
+ 
+-DPADD=	${LIBAVL} ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
++DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
+ 	${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
+-LDADD=	-lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
++LDADD=	-lavl -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
+ 
+ .include <bsd.prog.mk>

diff --git a/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-libpaths.patch b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-libpaths.patch
new file mode 100644
index 0000000..c81a2c3
--- /dev/null
+++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-libpaths.patch
@@ -0,0 +1,167 @@
+diff -upNr a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile
+--- a/cddl/lib/libzfs/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/lib/libzfs/Makefile	2012-03-30 19:04:39.904906253 +0000
+@@ -54,4 +54,8 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/cont
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
++
+ .include <bsd.lib.mk>
+diff -upNr a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile
+--- a/cddl/lib/libzpool/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/lib/libzpool/Makefile	2012-03-30 19:04:55.839233753 +0000
+@@ -56,6 +56,10 @@ CFLAGS+=	-I${.CURDIR}/../../../lib/libpt
+ CFLAGS+=	-I${.CURDIR}/../../../lib/libpthread/sys
+ CFLAGS+=	-I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
++
+ DPADD=		${LIBMD} ${LIBPTHREAD} ${LIBZ}
+ LDADD=		-lmd -lpthread -lz -lumem -lnvpair -lavl
+ 
+diff -upNr a/cddl/sbin/zfs/Makefile b/cddl/sbin/zfs/Makefile
+--- a/cddl/sbin/zfs/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/sbin/zfs/Makefile	2012-03-30 19:05:11.094859502 +0000
+@@ -21,6 +21,11 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
+ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
+ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
++
+ DPADD=	${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
+ 	${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
+ LDADD=	-lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
+diff -upNr a/cddl/sbin/zpool/Makefile b/cddl/sbin/zpool/Makefile
+--- a/cddl/sbin/zpool/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/sbin/zpool/Makefile	2012-03-30 19:05:24.830721002 +0000
+@@ -26,6 +26,12 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
++
+ DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
+ 	${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
+ LDADD=	-lavl -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
+diff -upNr a/cddl/usr.bin/ctfconvert/Makefile b/cddl/usr.bin/ctfconvert/Makefile
+--- a/cddl/usr.bin/ctfconvert/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/usr.bin/ctfconvert/Makefile	2012-03-30 19:05:49.454897012 +0000
+@@ -36,6 +36,8 @@ CFLAGS+=	-I${.CURDIR}/../../../sys/cddl/
+ 		-I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
+ 		-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
+ 
++LDFLAGS+=	-L${.CURDIR}/../../lib/libctf
++
+ DPADD=		${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
+ LDADD=		-lctf -ldwarf -lelf -lz -lpthread
+ 
+diff -upNr a/cddl/usr.bin/ctfmerge/Makefile b/cddl/usr.bin/ctfmerge/Makefile
+--- a/cddl/usr.bin/ctfmerge/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/usr.bin/ctfmerge/Makefile	2012-03-30 19:06:08.084858412 +0000
+@@ -33,6 +33,8 @@ CFLAGS+=	-I${.CURDIR}/../../../sys/cddl/
+ 		-I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
+ 		-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
+ 
++LDFLAGS+=	-L${.CURDIR}/../../lib/libctf
++
+ DPADD=		${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
+ LDADD=		-lctf -ldwarf -lelf -lz -lpthread
+ 
+diff -upNr a/cddl/usr.bin/zinject/Makefile b/cddl/usr.bin/zinject/Makefile
+--- a/cddl/usr.bin/zinject/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/usr.bin/zinject/Makefile	2012-03-30 19:06:25.084865592 +0000
+@@ -19,6 +19,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
+ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
+ CFLAGS+= -I${.CURDIR}/../../lib/libumem
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
++
+ DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
+ 	${LIBZFS} ${LIBZPOOL}
+ LDADD=	-lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
+diff -upNr a/cddl/usr.bin/zstreamdump/Makefile b/cddl/usr.bin/zstreamdump/Makefile
+--- a/cddl/usr.bin/zstreamdump/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/usr.bin/zstreamdump/Makefile	2012-03-30 19:06:44.544860132 +0000
+@@ -18,6 +18,11 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
+ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
+ CFLAGS+= -I${.CURDIR}/../../lib/libumem
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
++
+ DPADD=	${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
+ 	${LIBPTHREAD} ${LIBZ} ${LIBAVL}
+ LDADD=	-lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
+diff -upNr a/cddl/usr.bin/ztest/Makefile b/cddl/usr.bin/ztest/Makefile
+--- a/cddl/usr.bin/ztest/Makefile	2012-03-30 18:58:53.174771000 +0000
++++ b/cddl/usr.bin/ztest/Makefile	2012-03-30 19:06:58.344895642 +0000
+@@ -17,6 +17,11 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
+ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
+ CFLAGS+= -I${.CURDIR}/../../lib/libumem
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
++
+ DPADD=	${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
+ 	${LIBPTHREAD} ${LIBZ} ${LIBAVL}
+ LDADD=	-lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
+diff -upNr a/cddl/usr.sbin/zdb/Makefile b/cddl/usr.sbin/zdb/Makefile
+--- a/cddl/usr.sbin/zdb/Makefile	2012-03-30 18:58:53.164736000 +0000
++++ b/cddl/usr.sbin/zdb/Makefile	2012-03-30 19:07:17.454861002 +0000
+@@ -23,6 +23,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
+ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
+ CFLAGS+= -I${.CURDIR}/../../lib/libumem
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
++
+ DPADD=	${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
+ 	${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL}
+ LDADD=	-lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
+--- a/cddl/usr.sbin/dtrace/Makefile.old	2011-07-06 00:09:01.000000000 +0000
++++ b/cddl/usr.sbin/dtrace/Makefile	2011-07-06 00:09:48.000000000 +0000
+@@ -24,6 +24,8 @@
+ #CFLAGS+=	-DNEED_ERRLOC
+ #YFLAGS+=	-d
+ 
++LDFLAGS+= -L${.CURDIR}/../../lib/libdtrace -L${.CURDIR}/../../lib/libctf
++
+ DPADD=		${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
+ 		${LIBCTF} ${LIBELF} ${LIBZ} ${LIBUTIL} ${LIBRTLD_DB}
+ LDADD=		-lpthread -ldtrace -ly -lfl -lproc -lctf -lelf -lz -lutil \
+--- a/cddl/usr.sbin/lockstat/Makefile.old	2011-07-06 00:10:33.000000000 +0000
++++ b/cddl/usr.sbin/lockstat/Makefile	2011-07-06 00:10:57.000000000 +0000
+@@ -23,6 +23,8 @@
+ 
+ CFLAGS+=	-DNEED_ERRLOC -g
+ 
++LDFLAGS+=-L${.CURDIR}/../../lib/libdtrace -L${.CURDIR}/../../lib/libctf
++
+ #YFLAGS+=	-d
+ 
+ DPADD=		${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \

diff --git a/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-underlink.patch b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-underlink.patch
new file mode 100644
index 0000000..ff87d2c
--- /dev/null
+++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-underlink.patch
@@ -0,0 +1,22 @@
+--- cddl/lib/libzfs/Makefile.old	2011-11-04 10:27:30.000000000 +0000
++++ cddl/lib/libzfs/Makefile	2011-11-04 10:28:59.000000000 +0000
+@@ -7,7 +7,7 @@
+ 
+ LIB=	zfs
+ DPADD=	${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL}
+-LDADD=	-lmd -lpthread -lumem -lutil
++LDADD=	-lmd -lpthread -lumem -lutil -luutil -lnvpair -lm -lgeom
+ 
+ SRCS=	deviceid.c \
+ 	fsshare.c \
+--- cddl/lib/libzpool/Makefile.old	2011-11-04 18:22:28.000000000 +0000
++++ cddl/lib/libzpool/Makefile	2011-11-04 18:24:01.000000000 +0000
+@@ -57,7 +57,7 @@
+ CFLAGS+=	-I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
+ 
+ DPADD=		${LIBMD} ${LIBPTHREAD} ${LIBZ}
+-LDADD=		-lmd -lpthread -lz
++LDADD=		-lmd -lpthread -lz -lumem -lnvpair -lavl
+ 
+ # atomic.S doesn't like profiling.
+ NO_PROFILE=

diff --git a/sys-freebsd/freebsd-cddl/files/zfs.initd b/sys-freebsd/freebsd-cddl/files/zfs.initd
new file mode 100644
index 0000000..a2b0f97
--- /dev/null
+++ b/sys-freebsd/freebsd-cddl/files/zfs.initd
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/files/zfs.initd,v 1.1 2012/05/27 06:23:07 naota Exp $
+
+depend() {
+	need hostid
+	before fsck
+}
+
+start() {
+	einfo "Starting zfs ..."
+	zfs mount -a
+	zfs share -a
+	if [ ! -r /etc/zfs/exports ]; then
+		touch /etc/zfs/exports
+	fi
+}
+
+stop() {
+	einfo "Stopping zfs ..."
+	zfs unshare -a
+	zfs unmount -a
+}

diff --git a/sys-freebsd/freebsd-cddl/files/zvol.initd b/sys-freebsd/freebsd-cddl/files/zvol.initd
index 4546935..738ec23 100755
--- a/sys-freebsd/freebsd-cddl/files/zvol.initd
+++ b/sys-freebsd/freebsd-cddl/files/zvol.initd
@@ -1,7 +1,7 @@
 #!/sbin/runscript
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/files/zvol.initd,v 1.1 2010/04/04 21:04:19 the_paya Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/files/zvol.initd,v 1.2 2011/07/06 05:51:32 aballier Exp $
 
 depend() {
 	need hostid
@@ -12,7 +12,7 @@ start() {
 	einfo "Starting zfs volumes..."
 	zfs volinit
 	eend $?
-	 Enable swap on ZVOLs that have org.freebsd:swap=on.
+	# Enable swap on ZVOLs that have org.freebsd:swap=on.
 	zfs list -H -o org.freebsd:swap,name -t volume | \
 	while read state name; do
 		case "${state}" in
@@ -41,3 +41,7 @@ stop() {
 	zfs volfini
 	eend $?
 }
+
+restart() {
+	:
+}

diff --git a/sys-freebsd/freebsd-cddl/files/zvol.initd b/sys-freebsd/freebsd-cddl/files/zvol.initd-9.0
similarity index 81%
copy from sys-freebsd/freebsd-cddl/files/zvol.initd
copy to sys-freebsd/freebsd-cddl/files/zvol.initd-9.0
index 4546935..5086680 100755
--- a/sys-freebsd/freebsd-cddl/files/zvol.initd
+++ b/sys-freebsd/freebsd-cddl/files/zvol.initd-9.0
@@ -1,7 +1,7 @@
 #!/sbin/runscript
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/files/zvol.initd,v 1.1 2010/04/04 21:04:19 the_paya Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-cddl/files/zvol.initd-9.0,v 1.1 2012/05/12 07:57:13 naota Exp $
 
 depend() {
 	need hostid
@@ -10,9 +10,8 @@ depend() {
 
 start() {
 	einfo "Starting zfs volumes..."
-	zfs volinit
 	eend $?
-	 Enable swap on ZVOLs that have org.freebsd:swap=on.
+	# Enable swap on ZVOLs that have org.freebsd:swap=on.
 	zfs list -H -o org.freebsd:swap,name -t volume | \
 	while read state name; do
 		case "${state}" in
@@ -38,6 +37,9 @@ stop() {
 		esac
 	done
 	einfo "Stopping zfs volumes..."
-	zfs volfini
 	eend $?
 }
+
+restart() {
+	:
+}

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 0000000..2ddb9ea
--- /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.2-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch
new file mode 100644
index 0000000..c8be7f4
--- /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 0000000..556ade5
--- /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-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch
new file mode 100644
index 0000000..5d7526f
--- /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${.CURDIR}/../libutil -L${.CURDIR}/../libproc
+ 
+ .include <bsd.lib.mk>

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 0000000..bf77a0a
--- /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.0-trylock-adaptive.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-trylock-adaptive.patch
new file mode 100644
index 0000000..e72b171
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-trylock-adaptive.patch
@@ -0,0 +1,14 @@
+http://www.freebsd.org/cgi/query-pr.cgi?pr=168317
+
+Index: lib/libthr/thread/thr_mutex.c
+===================================================================
+--- lib/libthr/thread/thr_mutex.c	(revision 235924)
++++ lib/libthr/thread/thr_mutex.c	(working copy)
+@@ -538,6 +538,7 @@
+ 	switch (PMUTEX_TYPE(m->m_flags)) {
+ 	case PTHREAD_MUTEX_ERRORCHECK:
+ 	case PTHREAD_MUTEX_NORMAL:
++	case PTHREAD_MUTEX_ADAPTIVE_NP:
+ 		ret = EBUSY; 
+ 		break;
+ 

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 0000000..1b4e791
--- /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-sources-9.0-sysctluint.patch b/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch
new file mode 100644
index 0000000..751a77c
--- /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-libexec/files/freebsd-libexec-8.2-rtld.patch b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch
new file mode 100644
index 0000000..c60b2fe
--- /dev/null
+++ b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch
@@ -0,0 +1,40 @@
+--- head/libexec/rtld-elf/rtld.c	2011/09/15 11:50:09	225582
++++ head/libexec/rtld-elf/rtld.c	2011/10/08 12:39:47	226155
+@@ -495,8 +495,12 @@
+        exit (0);
+     }
+ 
+-    /* setup TLS for main thread */
+-    dbg("initializing initial thread local storage");
++    /*
++     * Processing tls relocations requires having the tls offsets
++     * initialized.  Prepare offsets before starting initial
++     * relocation processing.
++     */
++    dbg("initializing initial thread local storage offsets");
+     STAILQ_FOREACH(entry, &list_main, link) {
+ 	/*
+ 	 * Allocate all the initial objects out of the static TLS
+@@ -504,7 +508,6 @@
+ 	 */
+ 	allocate_tls_offset(entry->obj);
+     }
+-    allocate_initial_tls(obj_list);
+ 
+     if (relocate_objects(obj_main,
+       ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1)
+@@ -519,6 +522,14 @@
+        exit (0);
+     }
+ 
++    /*
++     * Setup TLS for main thread.  This must be done after the
++     * relocations are processed, since tls initialization section
++     * might be the subject for relocations.
++     */
++    dbg("initializing initial thread local storage");
++    allocate_initial_tls(obj_list);
++
+     dbg("initializing key program variables");
+     set_program_var("__progname", argv[0] != NULL ? basename(argv[0]) : "");
+     set_program_var("environ", env);

diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.0-gentoo.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.0-gentoo.patch
new file mode 100644
index 0000000..f5e6568
--- /dev/null
+++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.0-gentoo.patch
@@ -0,0 +1,326 @@
+diff -ur share/mk.old/bsd.doc.mk share/mk/bsd.doc.mk
+--- share/mk.old/bsd.doc.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.doc.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -135,10 +135,12 @@
+ realinstall:
+ .for _dev in ${PRINTERDEVICE:Mhtml}
+ 	cd ${SRCDIR}; \
++	    ${INSTALL} -d ${DESTDIR}${BINDIR}/${VOLUME}; \
+ 	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ 	    ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
+ .endfor
+ .for _dev in ${PRINTERDEVICE:Nhtml}
++	${INSTALL} -d ${DESTDIR}${BINDIR}/${VOLUME}; \
+ 	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ 	    ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}
+ .endfor
+diff -ur share/mk.old/bsd.files.mk share/mk/bsd.files.mk
+--- share/mk.old/bsd.files.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.files.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -39,6 +39,7 @@
+ .endif
+ installfiles: _${group}INS_${file:T}
+ _${group}INS_${file:T}: ${file}
++	${INSTALL} -d ${DESTDIR}${${group}DIR_${.ALLSRC:T}}
+ 	${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
+ 	    -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
+ 	    ${.ALLSRC} \
+@@ -51,10 +52,12 @@
+ installfiles: _${group}INS
+ _${group}INS: ${_${group}FILES}
+ .if defined(${group}NAME)
++	${INSTALL} -d ${DESTDIR}${${group}DIR}/${${group}NAME}
+ 	${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
+ 	    -m ${${group}MODE} ${.ALLSRC} \
+ 	    ${DESTDIR}${${group}DIR}/${${group}NAME}
+ .else
++	${INSTALL} -d ${DESTDIR}${${group}DIR}
+ 	${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
+ 	    -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}
+ .endif
+diff -ur share/mk.old/bsd.incs.mk share/mk/bsd.incs.mk
+--- share/mk.old/bsd.incs.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.incs.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -41,7 +41,10 @@
+ .endif
+ installincludes: _${group}INS_${header:T}
+ _${group}INS_${header:T}: ${header}
++	${INSTALL} -d -o ${${group}OWN_${.ALLSRC:T}} \
++		 -g ${${group}GRP_${.ALLSRC:T}} \
++		 ${DESTDIR}${${group}DIR_${.ALLSRC:T}}
+	${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
+ 	    -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
+ 	    ${.ALLSRC} \
+ 	    ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
+@@ -53,10 +56,14 @@
+ installincludes: _${group}INS
+ _${group}INS: ${_${group}INCS}
+ .if defined(${group}NAME)
++	${INSTALL} -d -o ${${group}OWN} -g ${${group}GRP} \
++		${DESTDIR}${${group}DIR}
+	${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
+ 	    ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
+ .else
++	${INSTALL} -d -o ${${group}OWN} -g ${${group}GRP} \
++		${DESTDIR}${${group}DIR}
+	${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
+ 	    ${.ALLSRC} ${DESTDIR}${${group}DIR}
+ .endif
+ .endif
+diff -ur share/mk.old/bsd.info.mk share/mk/bsd.info.mk
+--- share/mk.old/bsd.info.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.info.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -83,6 +83,7 @@
+ TEX?=		tex
+ DVIPS?=		dvips
+ DVIPS2ASCII?=	dvips2ascii
++INSTALL?=	install
+ 
+ .SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
+ 
+@@ -144,15 +145,17 @@
+ INSTALLINFODIRS+= ${x:S/$/-install/}
+ ${x:S/$/-install/}:
+ .if !empty(.MAKEFLAGS:M-j)
++	${INSTALL} -d ${DESTDIR}${INFODIR}
+ 	lockf -k ${DESTDIR}${INFODIR}/${INFODIRFILE} \
+ 	${INSTALLINFO} ${INSTALLINFOFLAGS} \
+-	    --defsection=${INFOSECTION} \
+-	    --defentry=${INFOENTRY_${x}} \
++	    --section=${INFOSECTION} \
++	    --entry=${INFOENTRY_${x}} \
+ 	    ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
+ .else
++	${INSTALL} -d ${DESTDIR}${INFODIR}
+ 	${INSTALLINFO} ${INSTALLINFOFLAGS} \
+-	    --defsection=${INFOSECTION} \
+-	    --defentry=${INFOENTRY_${x}} \
++	    --section=${INFOSECTION} \
++	    --entry=${INFOENTRY_${x}} \
+ 	    ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
+ .endif
+ .endfor
+diff -ur share/mk.old/bsd.lib.mk share/mk/bsd.lib.mk
+--- share/mk.old/bsd.lib.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.lib.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -46,10 +46,6 @@
+ .endif
+ .endif
+ 
+-.if !defined(DEBUG_FLAGS)
+-STRIP?=	-s
+-.endif
+-
+ .include <bsd.libnames.mk>
+ 
+ # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
+@@ -270,14 +266,17 @@
+ .ORDER: beforeinstall _libinstall
+ _libinstall:
+ .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
++	${INSTALL} -d ${DESTDIR}${LIBDIR}
+ 	${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ 	    ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
+ .endif
+ .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
++	${INSTALL} -d ${DESTDIR}${LIBDIR}
+ 	${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ 	    ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
+ .endif
+ .if defined(SHLIB_NAME)
++	${INSTALL} -d ${DESTDIR}${SHLIBDIR}
+ 	${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ 	    ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
+ 	    ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
+@@ -295,10 +294,12 @@
+ .endif
+ .endif
+ .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
++	${INSTALL} -d ${DESTDIR}${LIBDIR}
+ 	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ 	    ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
+ .endif
+ .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB)
++	${INSTALL} -d ${DESTDIR}${LINTLIBDIR}
+ 	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ 	    ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
+ .endif
+diff -ur share/mk.old/bsd.libnames.mk share/mk/bsd.libnames.mk
+--- share/mk.old/bsd.libnames.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.libnames.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -46,7 +46,7 @@
+ LIBEDIT?=	${DESTDIR}${LIBDIR}/libedit.a
+ LIBELF?=	${DESTDIR}${LIBDIR}/libelf.a
+ LIBFETCH?=	${DESTDIR}${LIBDIR}/libfetch.a
+-LIBFL?=		"don't use LIBFL, use LIBL"
++LIBFL?=		${DESTDIR}${LIBDIR}/libfl.a
+ LIBFORM?=	${DESTDIR}${LIBDIR}/libform.a
+ LIBFTPIO?=	${DESTDIR}${LIBDIR}/libftpio.a
+ LIBG2C?=	${DESTDIR}${LIBDIR}/libg2c.a
+@@ -77,7 +77,7 @@
+ LIBKICONV?=	${DESTDIR}${LIBDIR}/libkiconv.a
+ LIBKRB5?=	${DESTDIR}${LIBDIR}/libkrb5.a
+ LIBKVM?=	${DESTDIR}${LIBDIR}/libkvm.a
+-LIBL?=		${DESTDIR}${LIBDIR}/libl.a
++LIBL?=		${DESTDIR}${LIBDIR}/libfl.a
+ LIBLN?=		"don't use LIBLN, use LIBL"
+ .if ${MK_BIND} != "no"
+ LIBLWRES?=	${DESTDIR}${LIBDIR}/liblwres.a
+diff -ur share/mk.old/bsd.links.mk share/mk/bsd.links.mk
+--- share/mk.old/bsd.links.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.links.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -15,6 +15,8 @@
+ 		t=${DESTDIR}$$1; \
+ 		shift; \
+ 		${ECHO} $$t -\> $$l; \
++		d=`dirname $$t`; \
++		test -d $$d || mkdir $$d; \
+ 		ln -f $$l $$t; \
+ 	done; true
+ .endif
+@@ -26,6 +28,8 @@
+ 		t=${DESTDIR}$$1; \
+ 		shift; \
+ 		${ECHO} $$t -\> $$l; \
++		d=`dirname $$t`; \
++		test -d $$d || mkdir $$d; \
+ 		ln -fs $$l $$t; \
+ 	done; true
+ .endif
+diff -ur share/mk.old/bsd.man.mk share/mk/bsd.man.mk
+--- share/mk.old/bsd.man.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.man.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -165,9 +165,11 @@
+ .if defined(NO_MANCOMPRESS)
+ .if defined(MANFILTER)
+ .for __page in ${MAN}
++	${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}/${page}
+ 	${MINSTALL} ${__page:T:S/$/${FILTEXTENSION}/g} \
+ 		${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}/${__page}
+ .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
++	${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page}
+ 	${MINSTALL} ${__page:T:S/$/${CATEXT}${FILTEXTENSION}/g} \
+ 		${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page}
+ .endif
+@@ -181,11 +183,14 @@
+ 		esac; \
+ 		page=$$1; shift; sect=$$1; shift; \
+ 		d=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}; \
++		${ECHO} ${INSTALL} -d $${d}; \
++		${INSTALL} -d $${d}; \
+ 		${ECHO} ${MINSTALL} $${page} $${d}; \
+ 		${MINSTALL} $${page} $${d}; \
+ 	done
+ .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
+ .for __page in ${MAN}
++	${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page:T}
+ 	${MINSTALL} ${__page:T:S/$/${CATEXT}/} \
+ 		${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T}
+ .endfor
+@@ -193,9 +198,11 @@
+ .endif
+ .else
+ .for __page in ${MAN}
++	${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}
+ 	${MINSTALL} ${__page:T:S/$/${MCOMPRESS_EXT}/g} \
+ 		${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}
+ .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
++	${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page:T:S/$/${MCOMPRESS_EXT}
+ 	${MINSTALL} ${__page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} \
+ 		${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T:S/$/${MCOMPRESS_EXT}/}
+ .endif
+diff -ur share/mk.old/bsd.nls.mk share/mk/bsd.nls.mk
+--- share/mk.old/bsd.nls.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.nls.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -62,7 +62,8 @@
+ # installation rules
+ #
+ .for file in ${NLS}
+-NLSNAME_${file:T}= ${file:T:R}/${NLSNAME}.cat
++NLSDIR_${file:T}= ${SHAREDIR}/nls/${file:T:R}/
++NLSNAME_${file:T}= ${NLSNAME}.cat
+ .if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R})
+ NLSLINKS+=	${file:R}
+ .endif
+diff -ur share/mk.old/bsd.own.mk share/mk/bsd.own.mk
+--- share/mk.old/bsd.own.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.own.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -182,9 +182,6 @@
+ INCLUDEDIR?=	/usr/include
+ 
+ # Common variables
+-.if !defined(DEBUG_FLAGS)
+-STRIP?=		-s
+-.endif
+ 
+ COMPRESS_CMD?=	gzip -cn
+ COMPRESS_EXT?=	.gz
+diff -ur share/mk.old/bsd.prog.mk share/mk/bsd.prog.mk
+--- share/mk.old/bsd.prog.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.prog.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -33,10 +33,6 @@
+ CFLAGS+=${CRUNCH_CFLAGS}
+ .endif
+ 
+-.if !defined(DEBUG_FLAGS)
+-STRIP?=	-s
+-.endif
+-
+ .if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
+ LDFLAGS+= -static
+ .endif
+@@ -155,6 +151,7 @@
+ .ORDER: beforeinstall _proginstall
+ _proginstall:
+ .if defined(PROG)
++	${INSTALL} -d ${DESTDIR}${BINDIR}
+ .if defined(PROGNAME)
+ 	${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ 	    ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
+@@ -186,6 +183,7 @@
+ SCRIPTSMODE_${script:T}?=	${SCRIPTSMODE}
+ _scriptsinstall: _SCRIPTSINS_${script:T}
+ _SCRIPTSINS_${script:T}: ${script}
++	${INSTALL} -d ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}
+ 	${INSTALL} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
+ 	    -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
+ 	    ${.ALLSRC} \
+diff -ur share/mk.old/bsd.sys.mk share/mk/bsd.sys.mk
+--- share/mk.old/bsd.sys.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/bsd.sys.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -28,9 +28,6 @@
+ . if defined(WARNS)
+ .  if ${WARNS} >= 1
+ CWARNFLAGS	+=	-Wsystem-headers
+-.   if !defined(NO_WERROR)
+-CWARNFLAGS	+=	-Werror
+-.   endif
+ .  endif
+ .  if ${WARNS} >= 2
+ CWARNFLAGS	+=	-Wall -Wno-format-y2k
+@@ -66,9 +63,6 @@
+ .  if ${WFORMAT} > 0
+ #CWARNFLAGS	+=	-Wformat-nonliteral -Wformat-security -Wno-format-extra-args
+ CWARNFLAGS	+=	-Wformat=2 -Wno-format-extra-args
+-.   if !defined(NO_WERROR)
+-CWARNFLAGS	+=	-Werror
+-.   endif
+ .  endif
+ . endif
+ . if defined(NO_WFORMAT)
+diff -ur share/mk.old/sys.mk share/mk/sys.mk
+--- share/mk.old/sys.mk	2011-10-18 14:42:26.000000000 +0000
++++ share/mk/sys.mk	2011-11-06 15:45:08.000000000 +0000
+@@ -349,12 +349,6 @@
+ 		(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
+ 		${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
+ 
+-# FreeBSD build pollution.  Hide it in the non-POSIX part of the ifdef.
+-__MAKE_CONF?=/etc/make.conf
+-.if exists(${__MAKE_CONF})
+-.include "${__MAKE_CONF}"
+-.endif
+-
+ .if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL)
+ SHELL=	${__MAKE_SHELL}
+ .SHELL: path=${__MAKE_SHELL}

diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.0-gnu.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.0-gnu.patch
new file mode 100644
index 0000000..bd7d7e6
--- /dev/null
+++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.0-gnu.patch
@@ -0,0 +1,79 @@
+Index: work/share/mk/bsd.lib.mk
+===================================================================
+--- work.orig/share/mk/bsd.lib.mk
++++ work/share/mk/bsd.lib.mk
+@@ -146,11 +146,7 @@ _LIBS=		lib${LIB}.a
+ lib${LIB}.a: ${OBJS} ${STATICOBJS}
+ 	@${ECHO} building static ${LIB} library
+ 	@rm -f ${.TARGET}
+-.if !defined(NM)
+-	@${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
+-.else
+-	@${AR} cq ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
+-.endif
++	@${AR} cq ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD}
+ 	${RANLIB} ${.TARGET}
+ .endif
+ 
+@@ -163,11 +159,7 @@ POBJS+=		${OBJS:.o=.po} ${STATICOBJS:.o=
+ lib${LIB}_p.a: ${POBJS}
+ 	@${ECHO} building profiled ${LIB} library
+ 	@rm -f ${.TARGET}
+-.if !defined(NM)
+-	@${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD}
+-.else
+-	@${AR} cq ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
+-.endif
++	@${AR} cq ${.TARGET} ${POBJS} ${ARADD}
+ 	${RANLIB} ${.TARGET}
+ .endif
+ 
+@@ -189,15 +181,9 @@ ${SHLIB_NAME}: ${SOBJS}
+ .if defined(SHLIB_LINK)
+ 	@ln -fs ${.TARGET} ${SHLIB_LINK}
+ .endif
+-.if !defined(NM)
+ 	@${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \
+ 	    -o ${.TARGET} -Wl,-soname,${SONAME} \
+-	    `lorder ${SOBJS} | tsort -q` ${LDADD}
+-.else
+-	@${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \
+-	    -o ${.TARGET} -Wl,-soname,${SONAME} \
+-	    `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
+-.endif
++	    `echo ${SOBJS} | xargs -n 1 echo | sort -u` ${LDADD}
+ 	@[ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || \
+ 		(${ECHO} ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} && \
+ 		${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS})
+@@ -245,13 +231,6 @@ _EXTRADEPEND:
+ 
+ .if !target(install)
+ 
+-.if defined(PRECIOUSLIB)
+-.if !defined(NO_FSCHG)
+-SHLINSTALLFLAGS+= -fschg
+-.endif
+-SHLINSTALLFLAGS+= -S
+-.endif
+-
+ _INSTALLFLAGS:=	${INSTALLFLAGS}
+ .for ie in ${INSTALLFLAGS_EDIT}
+ _INSTALLFLAGS:=	${_INSTALLFLAGS${ie}}
+Index: work/share/mk/bsd.prog.mk
+===================================================================
+--- work.orig/share/mk/bsd.prog.mk
++++ work/share/mk/bsd.prog.mk
+@@ -134,13 +134,6 @@ _EXTRADEPEND:
+ 
+ .if !target(install)
+ 
+-.if defined(PRECIOUSPROG)
+-.if !defined(NO_FSCHG)
+-INSTALLFLAGS+= -fschg
+-.endif
+-INSTALLFLAGS+= -S
+-.endif
+-
+ _INSTALLFLAGS:=	${INSTALLFLAGS}
+ .for ie in ${INSTALLFLAGS_EDIT}
+ _INSTALLFLAGS:=	${_INSTALLFLAGS${ie}}

diff --git a/sys-freebsd/freebsd-pam-modules/files/freebsd-pam-modules-9.0-gentoo.patch b/sys-freebsd/freebsd-pam-modules/files/freebsd-pam-modules-9.0-gentoo.patch
new file mode 100644
index 0000000..aa08d40
--- /dev/null
+++ b/sys-freebsd/freebsd-pam-modules/files/freebsd-pam-modules-9.0-gentoo.patch
@@ -0,0 +1,22 @@
+--- lib/libpam/modules/Makefile.inc.old	2011-11-02 20:46:56.000000000 +0000
++++ lib/libpam/modules/Makefile.inc	2011-11-02 20:47:16.000000000 +0000
+@@ -5,18 +5,10 @@
+ NO_INSTALLLIB=
+ NO_PROFILE=
+ 
+-CFLAGS+= -I${PAMDIR}/include -I${.CURDIR}/../../libpam
++CFLAGS+= -I${.CURDIR}/../../libpam
+ 
+-# This is nasty.
+-# For the static case, libpam.a depends on the modules.
+-# For the dynamic case, the modules depend on libpam.so.N
+-.if defined(_NO_LIBPAM_SO_YET)
+-NO_PIC=
+-.else
+ SHLIB_NAME?=	${LIB}.so.${SHLIB_MAJOR}
+-DPADD+=		${LIBPAM}
+ LDADD+=		-lpam
+-.endif
+ 
+ .c.o:
+ 	${CC} ${CFLAGS} -DOPENPAM_STATIC_MODULES -c ${.IMPSRC}

diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-bpf.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-bpf.patch
new file mode 100644
index 0000000..fb3c701
--- /dev/null
+++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-bpf.patch
@@ -0,0 +1,10 @@
+--- contrib/pf/pflogd/pflogd.c.old	2011-11-02 21:12:57.000000000 +0000
++++ contrib/pf/pflogd/pflogd.c	2011-11-02 21:13:11.000000000 +0000
+@@ -39,6 +39,7 @@
+ #include <sys/stat.h>
+ #include <sys/socket.h>
+ #include <net/if.h>
++#include <net/bpf.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>

diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-getline.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-getline.patch
new file mode 100644
index 0000000..6679d32
--- /dev/null
+++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-getline.patch
@@ -0,0 +1,38 @@
+--- contrib/pf/ftp-proxy/ftp-proxy.c.old	2011-11-02 21:18:19.000000000 +0000
++++ contrib/pf/ftp-proxy/ftp-proxy.c	2011-11-02 21:18:36.000000000 +0000
+@@ -103,7 +103,7 @@
+ int	drop_privs(void);
+ void	end_session(struct session *);
+ void	exit_daemon(void);
+-int	getline(char *, size_t *);
++int	ftpgetline(char *, size_t *);
+ void	handle_connection(const int, short, void *);
+ void	handle_signal(int, short, void *);
+ struct session * init_session(void);
+@@ -249,7 +249,7 @@
+ 		    buf_avail);
+ 		s->cbuf_valid += clientread;
+ 
+-		while ((n = getline(s->cbuf, &s->cbuf_valid)) > 0) {
++		while ((n = ftpgetline(s->cbuf, &s->cbuf_valid)) > 0) {
+ 			logmsg(LOG_DEBUG, "#%d client: %s", s->id, linebuf);
+ 			if (!client_parse(s)) {
+ 				end_session(s);
+@@ -343,7 +343,7 @@
+ }
+ 
+ int
+-getline(char *buf, size_t *valid)
++ftpgetline(char *buf, size_t *valid)
+ {
+ 	size_t i;
+ 
+@@ -1087,7 +1087,7 @@
+ 		    buf_avail);
+ 		s->sbuf_valid += srvread;
+ 
+-		while ((n = getline(s->sbuf, &s->sbuf_valid)) > 0) {
++		while ((n = ftpgetline(s->sbuf, &s->sbuf_valid)) > 0) {
+ 			logmsg(LOG_DEBUG, "#%d server: %s", s->id, linebuf);
+ 			if (!server_parse(s)) {
+ 				end_session(s);

diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-libevent.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-libevent.patch
new file mode 100644
index 0000000..e488423
--- /dev/null
+++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-libevent.patch
@@ -0,0 +1,15 @@
+--- usr.sbin/ftp-proxy/ftp-proxy/Makefile.old	2011-11-02 20:57:03.000000000 +0000
++++ usr.sbin/ftp-proxy/ftp-proxy/Makefile	2011-11-02 20:57:21.000000000 +0000
+@@ -7,11 +7,9 @@
+ 
+ SRCS=	ftp-proxy.c filter.c
+ 
+-CFLAGS+= -I${.CURDIR}/../../../contrib/pf/libevent
+ CFLAGS+= -I${.CURDIR}/../../../sys/contrib/pf
+ 
+-LDADD+= ${LIBEVENT}
+-DPADD+= ${LIBEVENT}
++LDADD+= -levent
+ 
+ WARNS?=	3
+ 

diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-pcap_pollution.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-pcap_pollution.patch
new file mode 100644
index 0000000..184ab6f
--- /dev/null
+++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-pcap_pollution.patch
@@ -0,0 +1,17 @@
+--- contrib/pf/pflogd/privsep.c.old	2011-11-02 21:04:01.000000000 +0000
++++ contrib/pf/pflogd/privsep.c	2011-11-02 21:04:27.000000000 +0000
+@@ -32,11 +32,13 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <limits.h>
++#include <stdio.h>
++#define HAVE_SNPRINTF
++#define HAVE_STRLCPY
+ #include <pcap.h>
+ #include <pcap-int.h>
+ #include <pwd.h>
+ #include <signal.h>
+-#include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <syslog.h>

diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-pflogd.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-pflogd.patch
new file mode 100644
index 0000000..d5a65ea
--- /dev/null
+++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-pflogd.patch
@@ -0,0 +1,13 @@
+--- sbin/pflogd/Makefile.old	2011-11-02 21:08:46.000000000 +0000
++++ sbin/pflogd/Makefile	2011-11-02 21:08:53.000000000 +0000
+@@ -6,10 +6,7 @@
+ SRCS= 	pflogd.c pidfile.c privsep.c privsep_fdpass.c
+ MAN=	pflogd.8
+ 
+-CFLAGS+=-include ${.CURDIR}/../../lib/libpcap/config.h
+-
+ LDADD=	-lpcap
+-DPADD=	${LIBPCAP} ${LIBUTIL}
+ 
+ WARNS?=	2
+ 

diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-rescue-8.2-libzcleverlink.patch b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-8.2-libzcleverlink.patch
new file mode 100644
index 0000000..3d44457
--- /dev/null
+++ b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-8.2-libzcleverlink.patch
@@ -0,0 +1,20 @@
+--- rescue/rescue/Makefile.old	2011-07-06 01:35:13.000000000 +0000
++++ rescue/rescue/Makefile	2011-07-06 01:35:54.000000000 +0000
+@@ -143,7 +143,7 @@
+ .if ${MK_ZFS} != "no"
+ CRUNCH_LIBS+= -lzfs -lnvpair -luutil -lavl
+ .endif
+-CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs -lz
++CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs
+ 
+ .if ${MACHINE_ARCH} == "i386"
+ CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
+@@ -234,7 +234,7 @@
+ CRUNCH_PROGS_usr.sbin+= chown
+ CRUNCH_ALIAS_chown= chgrp
+ ##################################################################
+-CRUNCH_LIBS+= -lm
++CRUNCH_LIBS+= -lz -lm
+ 
+ ##################################################################
+ #  The following is pretty nearly a generic crunchgen-handling makefile

diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-sbin-bsdxml2expat.patch b/sys-freebsd/freebsd-rescue/files/freebsd-sbin-bsdxml2expat.patch
new file mode 100644
index 0000000..bdda99b
--- /dev/null
+++ b/sys-freebsd/freebsd-rescue/files/freebsd-sbin-bsdxml2expat.patch
@@ -0,0 +1,13 @@
+diff -uNr sbin/ifconfig.old/regdomain.c sbin/ifconfig/regdomain.c
+--- sbin/ifconfig.old/regdomain.c	2010-12-21 17:09:25.000000000 +0000
++++ sbin/ifconfig/regdomain.c	2011-07-10 15:56:27.000000000 +0000
+@@ -39,7 +39,7 @@
+ #include <err.h>
+ #include <unistd.h>
+ 
+-#include <bsdxml.h>
++#include <expat.h>
+ 
+ #include "regdomain.h"
+ 
+Los ficheros binarios sbin/ifconfig.old/regdomain.o y sbin/ifconfig/regdomain.o son distintos

diff --git a/sys-freebsd/freebsd-sbin/files/freebsd-sbin-bsdxml2expat.patch b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-bsdxml2expat.patch
new file mode 100644
index 0000000..bdda99b
--- /dev/null
+++ b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-bsdxml2expat.patch
@@ -0,0 +1,13 @@
+diff -uNr sbin/ifconfig.old/regdomain.c sbin/ifconfig/regdomain.c
+--- sbin/ifconfig.old/regdomain.c	2010-12-21 17:09:25.000000000 +0000
++++ sbin/ifconfig/regdomain.c	2011-07-10 15:56:27.000000000 +0000
+@@ -39,7 +39,7 @@
+ #include <err.h>
+ #include <unistd.h>
+ 
+-#include <bsdxml.h>
++#include <expat.h>
+ 
+ #include "regdomain.h"
+ 
+Los ficheros binarios sbin/ifconfig.old/regdomain.o y sbin/ifconfig/regdomain.o son distintos

diff --git a/sys-freebsd/freebsd-share/files/freebsd-share-9.0-gentoowaydir.patch b/sys-freebsd/freebsd-share/files/freebsd-share-9.0-gentoowaydir.patch
new file mode 100644
index 0000000..f299051
--- /dev/null
+++ b/sys-freebsd/freebsd-share/files/freebsd-share-9.0-gentoowaydir.patch
@@ -0,0 +1,16 @@
+diff -Nur etc.orig/mtree/BSD.usr.dist etc/mtree/BSD.usr.dist
+--- etc.orig/mtree/BSD.usr.dist	2012-01-03 12:26:10.000000000 +0900
++++ etc/mtree/BSD.usr.dist	2012-01-27 21:50:47.941466067 +0900
+@@ -25,12 +25,6 @@
+ 	i18n
+ 	..
+     ..
+-    lib32
+-	dtrace
+-	..
+-	i18n
+-	..
+-    ..
+     libdata
+         gcc
+         ..

diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-8.2-unix2.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-8.2-unix2.patch
new file mode 100644
index 0000000..50dacd0
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-8.2-unix2.patch
@@ -0,0 +1,55 @@
+Index: sys/kern/uipc_usrreq.c
+===================================================================
+--- sys/kern/uipc_usrreq.c	(revision 225745)
++++ sys/kern/uipc_usrreq.c	(working copy)
+@@ -462,6 +462,8 @@
+ 	unp = sotounpcb(so);
+ 	KASSERT(unp != NULL, ("uipc_bind: unp == NULL"));
+ 
++	if (soun->sun_len > sizeof(struct sockaddr_un))
++		return (EINVAL);
+ 	namelen = soun->sun_len - offsetof(struct sockaddr_un, sun_path);
+ 	if (namelen <= 0)
+ 		return (EINVAL);
+@@ -1252,6 +1254,8 @@
+ 	unp = sotounpcb(so);
+ 	KASSERT(unp != NULL, ("unp_connect: unp == NULL"));
+ 
++	if (nam->sa_len > sizeof(struct sockaddr_un))
++		return (EINVAL);
+ 	len = nam->sa_len - offsetof(struct sockaddr_un, sun_path);
+ 	if (len <= 0)
+ 		return (EINVAL);
+Index: sys/compat/linux/linux_socket.c
+===================================================================
+--- sys/compat/linux/linux_socket.c	(revision 225919)
++++ sys/compat/linux/linux_socket.c	(working copy)
+@@ -104,6 +104,7 @@
+ 	int oldv6size;
+ 	struct sockaddr_in6 *sin6;
+ #endif
++	int namelen;
+ 
+ 	if (*osalen < 2 || *osalen > UCHAR_MAX || !osa)
+ 		return (EINVAL);
+@@ -166,6 +167,20 @@
+ 		}
+ 	}
+ 
++	if ((bdom == AF_LOCAL) && (*osalen > sizeof(struct sockaddr_un))) {
++		for (namelen = 0;
++		    namelen < *osalen - offsetof(struct sockaddr_un, sun_path);
++		    namelen++)
++			if (!((struct sockaddr_un *)kosa)->sun_path[namelen])
++				break;
++		if (namelen + offsetof(struct sockaddr_un, sun_path) >
++		    sizeof(struct sockaddr_un)) {
++			error = EINVAL;
++			goto out;
++		}
++		alloclen = sizeof(struct sockaddr_un);
++	}
++
+ 	sa = (struct sockaddr *) kosa;
+ 	sa->sa_family = bdom;
+ 	sa->sa_len = alloclen;

diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-disable-optimization.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-disable-optimization.patch
new file mode 100644
index 0000000..4824ff6
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-disable-optimization.patch
@@ -0,0 +1,32 @@
+Taken from debian GNU/kFreeBSD.
+
+Regretably, with GCC 4.4 or later this is the only flag combination
+I could find that doesn't cause kernel panics CPU triple-faults or
+other kind of severe breakage. This is Gentoo Bug #410945.
+
+Clang can use -O2, so we do not force -O1 on it
+
+--- a/sys/conf/kern.pre.mk
++++ b/sys/conf/kern.pre.mk
+@@ -41,6 +41,9 @@
+ .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
+ COPTFLAGS+= -fno-strict-aliasing
+ .endif
++.if ${CC:T:Mclang} != "clang" && !empty(COPTFLAGS:M-O[23s])
++COPTFLAGS+= -O1
++.endif
+ .if !defined(NO_CPU_COPTFLAGS)
+ COPTFLAGS+= ${_CPUCFLAGS}
+ .endif
+--- a/sys/conf/kmod.mk
++++ b/sys/conf/kmod.mk
+@@ -91,6 +91,9 @@
+ .if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
+ CFLAGS+=	-fno-strict-aliasing
+ .endif
++.if ${CC:T:Mclang} != "clang" && !empty(CFLAGS:M-O[23s])
++CFLAGS+=	-O1
++.endif
+ WERROR?=	-Werror
+ CFLAGS+=	${WERROR}
+ CFLAGS+=	-D_KERNEL

diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-disable-optimizations.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-disable-optimizations.patch
new file mode 100644
index 0000000..6160a7b
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-disable-optimizations.patch
@@ -0,0 +1,30 @@
+Taken from debian GNU/kFreeBSD.
+
+Regretably, with GCC 4.4 or later this is the only flag combination
+I could find that doesn't cause kernel panics CPU triple-faults or
+other kind of severe breakage.
+
+--- a/sys/conf/kern.pre.mk
++++ b/sys/conf/kern.pre.mk
+@@ -41,6 +41,9 @@
+ .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
+ COPTFLAGS+= -fno-strict-aliasing
+ .endif
++.if !empty(COPTFLAGS:M-O[23s])
++COPTFLAGS+= -O1
++.endif
+ .if !defined(NO_CPU_COPTFLAGS)
+ COPTFLAGS+= ${_CPUCFLAGS}
+ .endif
+--- a/sys/conf/kmod.mk
++++ b/sys/conf/kmod.mk
+@@ -91,6 +91,9 @@
+ .if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
+ CFLAGS+=	-fno-strict-aliasing
+ .endif
++.if !empty(CFLAGS:M-O[23s])
++CFLAGS+=	-O1
++.endif
+ WERROR?=	-Werror
+ CFLAGS+=	${WERROR}
+ CFLAGS+=	-D_KERNEL

diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-gentoo.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-gentoo.patch
new file mode 100644
index 0000000..840af81
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-gentoo.patch
@@ -0,0 +1,33 @@
+diff -uNr sys.old/conf/kern.mk sys/conf/kern.mk
+--- sys.old/conf/kern.mk	2011-11-02 13:02:13.000000000 +0000
++++ sys/conf/kern.mk	2011-11-02 13:05:53.000000000 +0000
+@@ -5,7 +5,7 @@
+ #
+ CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
+ 		-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
+-		-Wundef -Wno-pointer-sign -fformat-extensions \
++		-Wundef -Wno-pointer-sign \
+ 		-Wmissing-include-dirs -fdiagnostics-show-option
+ #
+ # The following flags are next up for working on:
+@@ -32,7 +32,7 @@
+ #
+ .if ${MACHINE_CPUARCH} == "i386"
+ .if ${CC:T:Mclang} != "clang"
+-CFLAGS+=	-mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse
++CFLAGS+=	-mpreferred-stack-boundary=2 -mno-sse
+ .else
+ CFLAGS+=	-mno-aes -mno-avx
+ .endif
+diff -uNr sys.old/dev/aic7xxx/aicasm/Makefile sys/dev/aic7xxx/aicasm/Makefile
+--- sys.old/dev/aic7xxx/aicasm/Makefile	2011-11-02 13:02:11.000000000 +0000
++++ sys/dev/aic7xxx/aicasm/Makefile	2011-11-02 13:06:24.000000000 +0000
+@@ -14,7 +14,7 @@
+ SRCS=	${GENHDRS} ${CSRCS} ${YSRCS} ${LSRCS}
+ CLEANFILES+= ${GENHDRS} ${YSRCS:R:C/(.*)/\1.output/g}
+ DPADD=	${LIBL}
+-LDADD=	-ll
++LDADD=	-lfl
+ WARNS?=	5
+ 
+ # Correct path for kernel builds

diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-ipv6refcount.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-ipv6refcount.patch
new file mode 100644
index 0000000..f0984f6
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-ipv6refcount.patch
@@ -0,0 +1,128 @@
+Index: sys/netinet6/in6.c
+===================================================================
+--- sys/netinet6/in6.c.orig
++++ sys/netinet6/in6.c
+@@ -1369,6 +1369,8 @@ in6_purgeaddr(struct ifaddr *ifa)
+ 	}
+ 
+ cleanup:
++	if (ifa0 != NULL)
++		ifa_free(ifa0);
+ 
+ 	plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */
+ 	if ((ia->ia_flags & IFA_ROUTE) && plen == 128) {
+@@ -1393,8 +1395,6 @@ cleanup:
+ 			return;
+ 		ia->ia_flags &= ~IFA_ROUTE;
+ 	}
+-	if (ifa0 != NULL)
+-		ifa_free(ifa0);
+ 
+ 	in6_unlink_ifa(ia, ifp);
+ }
+@@ -1667,14 +1667,19 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, c
+ 			hostid = IFA_IN6(ifa);
+ 
+ 			/* prefixlen must be <= 64. */
+-			if (64 < iflr->prefixlen)
++			if (64 < iflr->prefixlen) {
++				if (ifa != NULL)
++					ifa_free(ifa);
+ 				return EINVAL;
++			}
+ 			prefixlen = iflr->prefixlen;
+ 
+ 			/* hostid part must be zero. */
+ 			sin6 = (struct sockaddr_in6 *)&iflr->addr;
+ 			if (sin6->sin6_addr.s6_addr32[2] != 0 ||
+ 			    sin6->sin6_addr.s6_addr32[3] != 0) {
++				if (ifa != NULL)
++					ifa_free(ifa);
+ 				return EINVAL;
+ 			}
+ 		} else
+@@ -2265,14 +2265,20 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr
+ 		IN6_IFADDR_RUNLOCK();
+ 		return (struct in6_ifaddr *)ifa;
+ 	}
+-	IN6_IFADDR_RUNLOCK();
+ 
+ 	/* use the last-resort values, that are, deprecated addresses */
+-	if (dep[0])
++	if (dep[0]) {
++		ifa_ref((struct ifaddr *)dep[0]);
++		IN6_IFADDR_RUNLOCK();
+ 		return dep[0];
+-	if (dep[1])
++	}
++	if (dep[1]) {
++		ifa_ref((struct ifaddr *)dep[1]);
++		IN6_IFADDR_RUNLOCK();
+ 		return dep[1];
++	}
+ 
++	IN6_IFADDR_RUNLOCK();
+ 	return NULL;
+ }
+ 
+Index: sys/netinet6/ip6_input.c
+===================================================================
+--- sys/netinet6/ip6_input.c.orig
++++ sys/netinet6/ip6_input.c
+@@ -879,19 +879,23 @@ passin:
+ 	 * as our interface address (e.g. multicast addresses, addresses
+ 	 * within FAITH prefixes and such).
+ 	 */
+-	if (deliverifp && !ip6_getdstifaddr(m)) {
++	if (deliverifp) {
+ 		struct in6_ifaddr *ia6;
+ 
+-		ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst);
+-		if (ia6) {
+-			if (!ip6_setdstifaddr(m, ia6)) {
+-				/*
+-				 * XXX maybe we should drop the packet here,
+-				 * as we could not provide enough information
+-				 * to the upper layers.
+-				 */
++ 		if ((ia6 = ip6_getdstifaddr(m)) != NULL) {
++			ifa_free(&ia6->ia_ifa);
++		} else {
++			ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst);
++			if (ia6) {
++				if (!ip6_setdstifaddr(m, ia6)) {
++					/*
++					 * XXX maybe we should drop the packet here,
++					 * as we could not provide enough information
++					 * to the upper layers.
++					 */
++				}
++				ifa_free(&ia6->ia_ifa);
+ 			}
+-			ifa_free(&ia6->ia_ifa);
+ 		}
+ 	}
+ 
+Index: sys/netinet/tcp_input.c
+===================================================================
+--- sys/netinet/tcp_input.c.orig
++++ sys/netinet/tcp_input.c
+@@ -512,6 +512,8 @@ tcp6_input(struct mbuf **mp, int *offp, int proto)
+ 			    (caddr_t)&ip6->ip6_dst - (caddr_t)ip6);
+ 		return IPPROTO_DONE;
+ 	}
++	if (ia6)
++		ifa_free(&ia6->ia_ifa);
+ 
+ 	tcp_input(m, *offp);
+ 	return IPPROTO_DONE;
+@@ -1240,7 +1242,8 @@ relocked:
+ 				rstreason = BANDLIM_RST_OPENPORT;
+ 				goto dropwithreset;
+ 			}
+-			ifa_free(&ia6->ia_ifa);
++			if (ia6)
++				ifa_free(&ia6->ia_ifa);
+ 		}
+ #endif /* INET6 */
+ 		/*

diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-sysctluint.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-sysctluint.patch
new file mode 100644
index 0000000..751a77c
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/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-sources/files/freebsd-sources-cve-2012-0217.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-cve-2012-0217.patch
new file mode 100644
index 0000000..0bf1b61
--- /dev/null
+++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-cve-2012-0217.patch
@@ -0,0 +1,26 @@
+Index: sys/amd64/amd64/trap.c
+===================================================================
+--- sys/amd64/amd64/trap.c.orig
++++ sys/amd64/amd64/trap.c	(working copy)
+@@ -972,4 +972,21 @@
+ 	     syscallname(td->td_proc, sa.code)));
+ 
+ 	syscallret(td, error, &sa);
++
++	/*
++	 * If the user-supplied value of %rip is not a canonical
++	 * address, then some CPUs will trigger a ring 0 #GP during
++	 * the sysret instruction.  However, the fault handler would
++	 * execute with the user's %gs and %rsp in ring 0 which would
++	 * not be safe.  Instead, preemptively kill the thread with a
++	 * SIGBUS.
++	 */
++	if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) {
++		ksiginfo_init_trap(&ksi);
++		ksi.ksi_signo = SIGBUS;
++		ksi.ksi_code = BUS_OBJERR;
++		ksi.ksi_trapno = T_PROTFLT;
++		ksi.ksi_addr = (void *)td->td_frame->tf_rip;
++		trapsignal(td, &ksi);
++	}
+ }

diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.2-compress.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.2-compress.patch
new file mode 100644
index 0000000..5bd1d55
--- /dev/null
+++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.2-compress.patch
@@ -0,0 +1,55 @@
+Index: usr.bin/compress/zopen.c
+===================================================================
+--- usr.bin/compress/zopen.c	(revision 225020)
++++ usr.bin/compress/zopen.c	(working copy)
+@@ -486,7 +486,7 @@ zread(void *cookie, char *rbp, int num)
+ 	block_compress = maxbits & BLOCK_MASK;
+ 	maxbits &= BIT_MASK;
+ 	maxmaxcode = 1L << maxbits;
+-	if (maxbits > BITS) {
++	if (maxbits > BITS || maxbits < 12) {
+ 		errno = EFTYPE;
+ 		return (-1);
+ 	}
+@@ -513,17 +513,28 @@ zread(void *cookie, char *rbp, int num)
+ 			for (code = 255; code >= 0; code--)
+ 				tab_prefixof(code) = 0;
+ 			clear_flg = 1;
+-			free_ent = FIRST - 1;
+-			if ((code = getcode(zs)) == -1)	/* O, untimely death! */
+-				break;
++			free_ent = FIRST;
++			oldcode = -1;
++			continue;
+ 		}
+ 		incode = code;
+ 
+-		/* Special case for KwKwK string. */
++		/* Special case for kWkWk string. */
+ 		if (code >= free_ent) {
++			if (code > free_ent || oldcode == -1) {
++				/* Bad stream. */
++				errno = EINVAL;
++				return (-1);
++			}
+ 			*stackp++ = finchar;
+ 			code = oldcode;
+ 		}
++		/*
++		 * The above condition ensures that code < free_ent.
++		 * The construction of tab_prefixof in turn guarantees that
++		 * each iteration decreases code and therefore stack usage is
++		 * bound by 1 << BITS - 256.
++		 */
+ 
+ 		/* Generate output characters in reverse order. */
+ 		while (code >= 256) {
+@@ -540,7 +551,7 @@ middle:		do {
+ 		} while (stackp > de_stack);
+ 
+ 		/* Generate the new entry. */
+-		if ((code = free_ent) < maxmaxcode) {
++		if ((code = free_ent) < maxmaxcode && oldcode != -1) {
+ 			tab_prefixof(code) = (u_short) oldcode;
+ 			tab_suffixof(code) = finchar;
+ 			free_ent = code + 1;

diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.0-fixmakefiles.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.0-fixmakefiles.patch
new file mode 100644
index 0000000..d34eb9e
--- /dev/null
+++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.0-fixmakefiles.patch
@@ -0,0 +1,11 @@
+diff -uNr usr.bin.old/calendar/Makefile usr.bin/calendar/Makefile
+--- usr.bin.old/calendar/Makefile	2011-11-02 18:22:09.000000000 +0000
++++ usr.bin/calendar/Makefile	2011-11-02 18:22:48.000000000 +0000
+@@ -15,6 +15,7 @@
+ WARNS?=		7
+ 
+ beforeinstall:
++	${INSTALL} -d ${DESTDIR}${SHAREDIR}/calendar
+ 	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
+ 	    ${.CURDIR}/calendars/calendar.* ${DESTDIR}${SHAREDIR}/calendar
+ .for lang in ${INTER}

diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-8.2-newsyslog.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-8.2-newsyslog.patch
new file mode 100644
index 0000000..a098391
--- /dev/null
+++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-8.2-newsyslog.patch
@@ -0,0 +1,10 @@
+--- usr.sbin/newsyslog/pathnames.h.orig	2001-07-30 18:17:17.000000000 +0300
++++ usr.sbin/newsyslog/pathnames.h	2009-09-11 08:32:57.508226240 +0300
+@@ -24,5 +24,5 @@
+ 
+ #define _PATH_CONF	"/etc/newsyslog.conf"
+ #define _PATH_SYSLOGPID	_PATH_VARRUN "syslog.pid"
+-#define _PATH_BZIP2	"/usr/bin/bzip2"
+-#define _PATH_GZIP	"/usr/bin/gzip"
++#define _PATH_BZIP2	"/bin/bzip2"
++#define _PATH_GZIP	"/bin/gzip"

diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.0-libarchive.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.0-libarchive.patch
new file mode 100644
index 0000000..bfe4794
--- /dev/null
+++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.0-libarchive.patch
@@ -0,0 +1,12 @@
+--- usr.sbin/bsdinstall/distextract/distextract.c.old	2011-11-02 20:28:08.000000000 +0000
++++ usr.sbin/bsdinstall/distextract/distextract.c	2011-11-02 20:28:57.000000000 +0000
+@@ -32,6 +32,9 @@
+ #include <limits.h>
+ #include <archive.h>
+ #include <dialog.h>
++#ifndef archive_read_free
++#define archive_read_free(x) archive_read_finish(x)
++#endif
+ 
+ static int extract_files(int nfiles, const char **files);
+ 

diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.0-newsyslog.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.0-newsyslog.patch
new file mode 100644
index 0000000..1d83865
--- /dev/null
+++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.0-newsyslog.patch
@@ -0,0 +1,12 @@
+diff -uNr usr.sbin/newsyslog.old/pathnames.h usr.sbin/newsyslog/pathnames.h
+--- usr.sbin/newsyslog.old/pathnames.h	2011-11-02 20:12:37.000000000 +0000
++++ usr.sbin/newsyslog/pathnames.h	2011-11-02 20:12:50.000000000 +0000
+@@ -24,6 +24,6 @@
+ 
+ #define	_PATH_CONF	"/etc/newsyslog.conf"
+ #define	_PATH_SYSLOGPID	_PATH_VARRUN "syslog.pid"
+-#define	_PATH_BZIP2	"/usr/bin/bzip2"
+-#define	_PATH_GZIP	"/usr/bin/gzip"
++#define	_PATH_BZIP2	"/bin/bzip2"
++#define	_PATH_GZIP	"/bin/gzip"
+ #define	_PATH_XZ	"/usr/bin/xz"

diff --git a/sys-freebsd/freebsd-usbin/files/mountd.patch b/sys-freebsd/freebsd-usbin/files/mountd.patch
new file mode 100644
index 0000000..3cb9f03
--- /dev/null
+++ b/sys-freebsd/freebsd-usbin/files/mountd.patch
@@ -0,0 +1,15 @@
+http://security.freebsd.org/advisories/FreeBSD-SA-11:01.mountd.asc
+
+Index: usr.sbin/mountd/mountd.c
+===================================================================
+--- usr.sbin/mountd/mountd.c	20 Dec 2010 09:28:28 -0000	1.107
++++ usr.sbin/mountd/mountd.c	1 Mar 2011 11:47:16 -0000	1.108
+@@ -2875,7 +2875,7 @@ makemask(struct sockaddr_storage *ssp, i
+ 
+ 	for (i = 0; i < len; i++) {
+ 		bits = (bitlen > CHAR_BIT) ? CHAR_BIT : bitlen;
+-		*p++ = (1 << bits) - 1;
++		*p++ = (u_char)~0 << (CHAR_BIT - bits);
+ 		bitlen -= bits;
+ 	}
+ 	return 0;

diff --git a/sys-freebsd/freebsd-usbin/files/nfs.initd b/sys-freebsd/freebsd-usbin/files/nfs.initd
index 640095f..e25ddea 100755
--- a/sys-freebsd/freebsd-usbin/files/nfs.initd
+++ b/sys-freebsd/freebsd-usbin/files/nfs.initd
@@ -1,5 +1,5 @@
 #!/sbin/runscript
-# Copyright 1999-2008 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 #---------------------------------------------------------------------------
@@ -35,12 +35,12 @@ start() {
 
 stop() {
 	ebegin "Stopping NFS mountd"
-	start-stop-daemon --stop --quiet --oknodo --exec $mountd \
+	start-stop-daemon --stop --quiet --exec $mountd \
 		--pidfile /var/run/mountd.pid
 	eend $? "Error stopping NFS mountd"
 
 	ebegin "Stopping NFS daemon"
-	start-stop-daemon --stop --quiet --oknodo \
+	start-stop-daemon --stop --signal USR1 --quiet \
 		--name nfsd --user root
 	eend $? "Error stopping NFS daemon"
 }


             reply	other threads:[~2012-07-27 11:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27 11:55 Yuta SATOH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-12-31  9:51 [gentoo-commits] proj/gentoo-bsd:master commit in: sys-freebsd/freebsd-share/files/, sys-freebsd/freebsd-mk-defs/files/, Yuta SATOH
2012-12-31  9:51 Yuta SATOH
2013-08-04 12:36 Yuta SATOH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343388540.fdd6722a67e75f8e755d4885e16d38e45cef28d9.yuta_satoh@gentoo \
    --to=nigoro.gentoo@0x100.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox