Gentoo Archives: gentoo-commits

From: Yuta SATOH <nigoro@×××××××××.jp>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoo-bsd:master commit in: sys-freebsd/freebsd-usbin/, sys-freebsd/freebsd-mk-defs/files/, ...
Date: Wed, 28 Sep 2016 12:25:07
Message-Id: 1475063841.7808fa178a26089ff2fc0c338a3e1835b290ffea.yuta_satoh@gentoo
1 commit: 7808fa178a26089ff2fc0c338a3e1835b290ffea
2 Author: Yuta SATOH <nigoro.dev <AT> gmail <DOT> com>
3 AuthorDate: Wed Sep 28 11:57:21 2016 +0000
4 Commit: Yuta SATOH <nigoro <AT> gentoo <DOT> gr <DOT> jp>
5 CommitDate: Wed Sep 28 11:57:21 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/gentoo-bsd.git/commit/?id=7808fa17
7
8 sys-freebsd: import 10.3 from latest tree
9
10 sys-freebsd/boot0/boot0-11.0.ebuild | 83 +++
11 .../files/boot0-10.1-drop-unsupport-cflags.patch | 26 +
12 sys-freebsd/boot0/files/boot0-10.1-gcc46.patch | 67 +++
13 sys-freebsd/boot0/files/boot0-10.3-clang.patch | 30 +
14 .../files/boot0-10.3-drop-unsupport-cflags.patch | 28 +
15 .../boot0/files/boot0-10.3-uefi-support.patch | 33 ++
16 .../boot0/files/boot0-8.2-zfsboot-makefile.patch | 13 +
17 sys-freebsd/boot0/files/boot0-9.2-gcc46.patch | 66 +++
18 .../boot0/files/boot0-add-nossp-cflags.patch | 11 +
19 sys-freebsd/boot0/metadata.xml | 12 +
20 sys-freebsd/freebsd-bin/freebsd-bin-11.0.ebuild | 42 ++
21 sys-freebsd/freebsd-bin/metadata.xml | 8 +
22 .../files/freebsd-cddl-10.2-libpaths.patch | 220 +++++++
23 .../files/freebsd-cddl-10.3-underlink.patch | 12 +
24 .../files/freebsd-cddl-8.0-libpaths.patch | 114 ++++
25 .../files/freebsd-cddl-8.2-libpaths.patch | 22 +
26 .../files/freebsd-cddl-9.0-bsdxml.patch | 28 +
27 .../files/freebsd-cddl-9.0-libpaths.patch | 167 ++++++
28 .../files/freebsd-cddl-9.0-underlink.patch | 22 +
29 .../files/freebsd-cddl-9.2-libpaths.patch | 220 +++++++
30 sys-freebsd/freebsd-cddl/files/zfs.initd | 24 +
31 sys-freebsd/freebsd-cddl/files/zvol.initd | 47 ++
32 sys-freebsd/freebsd-cddl/files/zvol.initd-9.0 | 45 ++
33 sys-freebsd/freebsd-cddl/freebsd-cddl-11.0.ebuild | 75 +++
34 sys-freebsd/freebsd-cddl/metadata.xml | 8 +
35 .../files/freebsd-lib-10.0-atfcxx.patch | 49 ++
36 .../files/freebsd-lib-10.0-liblink.patch | 98 ++++
37 .../files/freebsd-lib-10.0-libproc-libcxx.patch | 16 +
38 .../files/freebsd-lib-10.0-libusb.patch | 19 +
39 .../files/freebsd-lib-10.2-bsdxml2expat.patch | 39 ++
40 .../files/freebsd-lib-10.2-liblink.patch | 26 +
41 .../files/freebsd-lib-10.3-libusb.patch | 13 +
42 .../files/freebsd-lib-6.0-flex-2.5.31.patch | 13 +
43 .../files/freebsd-lib-6.0-gccfloat.patch | 16 +
44 .../freebsd-lib/files/freebsd-lib-6.0-pmc.patch | 13 +
45 .../freebsd-lib/files/freebsd-lib-6.1-csu.patch | 20 +
46 .../files/freebsd-lib-6.2-bluetooth.patch | 11 +
47 .../files/freebsd-lib-7.1-types.h-fix.patch | 15 +
48 .../freebsd-lib/files/freebsd-lib-8.0-gcc45.patch | 28 +
49 .../freebsd-lib/files/freebsd-lib-8.0-log2.patch | 21 +
50 .../files/freebsd-lib-8.0-rpcsec_gss.patch | 12 +
51 .../files/freebsd-lib-8.2-liblink.patch | 19 +
52 .../files/freebsd-lib-8.2-nlm_syscall.patch | 10 +
53 .../files/freebsd-lib-9.0-bluetooth.patch | 12 +
54 .../files/freebsd-lib-9.0-cve-2010-2632.patch | 215 +++++++
55 .../files/freebsd-lib-9.0-liblink.patch | 21 +
56 .../files/freebsd-lib-9.0-netware.patch | 11 +
57 .../files/freebsd-lib-9.0-opieincludes.patch | 122 ++++
58 .../files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch | 17 +
59 .../files/freebsd-lib-9.1-aligned_alloc.patch | 51 ++
60 .../files/freebsd-lib-9.1-rmgssapi.patch | 16 +
61 .../files/freebsd-lib-add-nossp-cflags.patch | 30 +
62 .../freebsd-lib/files/freebsd-lib-bsdxml.patch | 13 +
63 .../files/freebsd-lib-bsdxml2expat.patch | 26 +
64 .../freebsd-lib/files/freebsd-lib-includes.patch | 13 +
65 .../freebsd-lib/files/freebsd-lib-new_as.patch | 68 +++
66 .../files/freebsd-sources-9.0-sysctluint.patch | 13 +
67 sys-freebsd/freebsd-lib/files/libmap.conf | 8 +
68 sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in | 11 +
69 sys-freebsd/freebsd-lib/files/libusb.pc.in | 11 +
70 sys-freebsd/freebsd-lib/freebsd-lib-11.0.ebuild | 647 +++++++++++++++++++++
71 sys-freebsd/freebsd-lib/metadata.xml | 16 +
72 sys-freebsd/freebsd-libexec/files/bootpd.confd | 7 +
73 sys-freebsd/freebsd-libexec/files/bootpd.initd | 27 +
74 .../files/freebsd-libexec-10.2-atf-check.patch | 28 +
75 .../files/freebsd-libexec-7.2-pic.patch | 13 +
76 .../files/freebsd-libexec-8.2-rtld.patch | 40 ++
77 .../files/freebsd-libexec-9.2-no_ld32.patch | 15 +
78 sys-freebsd/freebsd-libexec/files/ftpd.pamd | 8 +
79 sys-freebsd/freebsd-libexec/files/rquotad.xinetd | 11 +
80 sys-freebsd/freebsd-libexec/files/rstatd.xinetd | 11 +
81 sys-freebsd/freebsd-libexec/files/rusersd.xinetd | 11 +
82 sys-freebsd/freebsd-libexec/files/sprayd.xinetd | 11 +
83 sys-freebsd/freebsd-libexec/files/walld.xinetd | 11 +
84 .../freebsd-libexec/freebsd-libexec-11.0.ebuild | 112 ++++
85 sys-freebsd/freebsd-libexec/metadata.xml | 8 +
86 .../files/freebsd-mk-defs-10.2-gnu.patch | 63 ++
87 .../files/freebsd-mk-defs-10.3-gentoo.patch | 337 +++++++++++
88 .../files/freebsd-mk-defs-8.0-gentoo.patch | 332 +++++++++++
89 .../files/freebsd-mk-defs-8.0-gnu.patch | 121 ++++
90 .../files/freebsd-mk-defs-9.1-gentoo.patch | 326 +++++++++++
91 .../files/freebsd-mk-defs-9.1-gnu.patch | 77 +++
92 .../files/freebsd-mk-defs-add-nossp-cflags.patch | 28 +
93 .../freebsd-mk-defs/freebsd-mk-defs-11.0.ebuild | 42 ++
94 sys-freebsd/freebsd-mk-defs/metadata.xml | 8 +
95 sys-freebsd/freebsd-pam-modules/files/README.pamd | 63 ++
96 .../files/freebsd-pam-modules-6.0-gentoo.patch | 24 +
97 .../files/freebsd-pam-modules-9.0-gentoo.patch | 22 +
98 .../freebsd-pam-modules-11.0.ebuild | 48 ++
99 sys-freebsd/freebsd-pam-modules/metadata.xml | 8 +
100 .../files/freebsd-pf-10.0-libevent.patch | 16 +
101 .../freebsd-pf/files/freebsd-pf-10.0-pflogd.patch | 15 +
102 .../freebsd-pf/files/freebsd-pf-7.0-libevent.patch | 12 +
103 .../files/freebsd-pf-7.0-pcap_pollution.patch | 18 +
104 .../freebsd-pf/files/freebsd-pf-9.0-bpf.patch | 10 +
105 .../freebsd-pf/files/freebsd-pf-9.0-getline.patch | 38 ++
106 .../freebsd-pf/files/freebsd-pf-9.0-libevent.patch | 15 +
107 .../files/freebsd-pf-9.0-pcap_pollution.patch | 17 +
108 .../freebsd-pf/files/freebsd-pf-9.0-pflogd.patch | 13 +
109 sys-freebsd/freebsd-pf/files/pf.confd | 9 +
110 sys-freebsd/freebsd-pf/files/pf.initd | 50 ++
111 sys-freebsd/freebsd-pf/freebsd-pf-11.0.ebuild | 73 +++
112 sys-freebsd/freebsd-pf/metadata.xml | 8 +
113 .../files/freebsd-rescue-10.0-zlib.patch | 22 +
114 .../files/freebsd-rescue-7.1-zlib.patch | 21 +
115 ...sd-rescue-8.0-pkgconfig_static_libarchive.patch | 11 +
116 .../files/freebsd-rescue-8.2-libzcleverlink.patch | 20 +
117 .../files/freebsd-rescue-9.1-bsdtar.patch | 12 +
118 .../files/freebsd-rescue-9.1-libcleverlink.patch | 21 +
119 .../files/freebsd-sbin-bsdxml2expat.patch | 13 +
120 .../files/freebsd-ubin-10.2-bsdxml.patch | 13 +
121 .../freebsd-rescue/freebsd-rescue-11.0.ebuild | 82 +++
122 sys-freebsd/freebsd-rescue/metadata.xml | 12 +
123 sys-freebsd/freebsd-sbin/files/adjkerntz-crontab | 4 +
124 sys-freebsd/freebsd-sbin/files/devd.conf | 153 +++++
125 sys-freebsd/freebsd-sbin/files/devd.initd | 47 ++
126 sys-freebsd/freebsd-sbin/files/devd_queue | 50 ++
127 .../files/freebsd-sbin-10.0-zlib.patch | 22 +
128 .../files/freebsd-sbin-6.1-pr102701.patch | 17 +
129 .../files/freebsd-sbin-6.2-ldconfig.patch | 13 +
130 .../freebsd-sbin/files/freebsd-sbin-7.1-zlib.patch | 21 +
131 .../files/freebsd-sbin-bsdxml2expat.patch | 13 +
132 .../freebsd-sbin/files/freebsd-sbin-setXid.patch | 20 +
133 sys-freebsd/freebsd-sbin/files/idmapd.initd | 20 +
134 sys-freebsd/freebsd-sbin/files/ipfw.confd | 10 +
135 sys-freebsd/freebsd-sbin/files/ipfw.initd | 110 ++++
136 sys-freebsd/freebsd-sbin/files/sysctl.initd | 28 +
137 sys-freebsd/freebsd-sbin/freebsd-sbin-11.0.ebuild | 101 ++++
138 sys-freebsd/freebsd-sbin/metadata.xml | 20 +
139 .../files/freebsd-share-10.0-gentoo-eapi3.patch | 17 +
140 .../files/freebsd-share-10.2-gnu-miscfiles.patch | 30 +
141 .../files/freebsd-share-10.3-gentoo-skel.patch | 20 +
142 .../files/freebsd-share-5.3-doc-locations.patch | 20 +
143 .../files/freebsd-share-5.4-gentoo-skel.patch | 20 +
144 .../files/freebsd-share-8.0-gnu-miscfiles.patch | 26 +
145 .../files/freebsd-share-9.2-gnu-miscfiles.patch | 28 +
146 .../freebsd-share/freebsd-share-11.0.ebuild | 113 ++++
147 sys-freebsd/freebsd-share/metadata.xml | 12 +
148 sys-freebsd/freebsd-sources/files/config-GENTOO | 4 +
149 .../files/freebsd-sources-10.0-gentoo.patch | 22 +
150 .../files/freebsd-sources-10.1-gcc48.patch | 18 +
151 .../files/freebsd-sources-6.0-flex-2.5.31.patch | 22 +
152 .../files/freebsd-sources-6.1-ntfs.patch | 32 +
153 .../freebsd-sources-7.0-tmpfs_whiteout_stub.patch | 44 ++
154 .../files/freebsd-sources-7.1-binutils_link.patch | 37 ++
155 .../files/freebsd-sources-7.1-includes.patch | 13 +
156 .../files/freebsd-sources-7.1-types.h-fix.patch | 15 +
157 .../files/freebsd-sources-7.2-debug-O2.patch | 27 +
158 .../files/freebsd-sources-8.0-gentoo.patch | 33 ++
159 .../freebsd-sources-8.0-subnet-route-pr40133.patch | 21 +
160 .../files/freebsd-sources-8.2-unix2.patch | 55 ++
161 .../freebsd-sources-9.0-disable-optimization.patch | 32 +
162 .../files/freebsd-sources-9.0-ipv6refcount.patch | 128 ++++
163 .../files/freebsd-sources-9.0-sysctluint.patch | 13 +
164 .../files/freebsd-sources-9.1-ciss.patch | 65 +++
165 .../files/freebsd-sources-9.1-cve-2013-3077.patch | 26 +
166 .../files/freebsd-sources-9.1-cve-2013-3266.patch | 13 +
167 .../files/freebsd-sources-9.1-cve-2013-5209.patch | 19 +
168 .../files/freebsd-sources-9.1-cve-2013-5691.patch | 89 +++
169 .../files/freebsd-sources-9.1-cve-2013-5710.patch | 28 +
170 .../files/freebsd-sources-9.1-cve-2014-1453.patch | 70 +++
171 .../files/freebsd-sources-9.1-exec.patch | 66 +++
172 .../files/freebsd-sources-9.1-gentoo.patch | 21 +
173 .../files/freebsd-sources-9.1-ktrace.patch | 12 +
174 .../files/freebsd-sources-9.1-mmap-2014.patch | 20 +
175 .../files/freebsd-sources-9.1-mmap.patch | 20 +
176 .../files/freebsd-sources-9.1-nfsserver.patch | 16 +
177 .../files/freebsd-sources-9.1-random.patch | 27 +
178 .../files/freebsd-sources-9.1-tcp.patch | 32 +
179 .../files/freebsd-sources-9.2-gentoo-gcc.patch | 13 +
180 .../files/freebsd-sources-cve-2012-0217.patch | 26 +
181 .../files/freebsd-ubin-10.3-bmake-workaround.patch | 13 +
182 .../freebsd-sources/freebsd-sources-11.0.ebuild | 174 ++++++
183 sys-freebsd/freebsd-sources/metadata.xml | 13 +
184 .../freebsd-ubin/files/freebsd-ubin-10.0-atf.patch | 15 +
185 .../files/freebsd-ubin-10.0-dtc-gcc46.patch | 25 +
186 .../files/freebsd-ubin-10.0-kdump-ioctl.patch | 26 +
187 .../files/freebsd-ubin-10.0-mandoc.patch | 13 +
188 .../files/freebsd-ubin-10.1-kdump-workaround.patch | 13 +
189 .../files/freebsd-ubin-10.2-bsdxml.patch | 13 +
190 .../files/freebsd-ubin-10.2-talk-workaround.patch | 12 +
191 .../files/freebsd-ubin-10.3-bmake-workaround.patch | 13 +
192 .../files/freebsd-ubin-6.0-bsdcmp.patch | 13 +
193 .../files/freebsd-ubin-6.0-fixmakefiles.patch | 35 ++
194 .../files/freebsd-ubin-6.0-kdump-ioctl.patch | 28 +
195 .../files/freebsd-ubin-8.0-bsdar.patch | 21 +
196 .../files/freebsd-ubin-8.0-xinstall.patch | 26 +
197 .../files/freebsd-ubin-8.2-compress.patch | 55 ++
198 .../files/freebsd-ubin-9.0-fixmakefiles.patch | 11 +
199 .../files/freebsd-ubin-9.1-ar-libarchive3.patch | 19 +
200 .../files/freebsd-ubin-9.1-bsdar.patch | 25 +
201 .../freebsd-ubin/files/freebsd-ubin-9.1-grep.patch | 17 +
202 .../files/freebsd-ubin-9.1-kdump-ioctl.patch | 24 +
203 .../files/freebsd-ubin-9.1-minigzip.patch | 10 +
204 .../files/freebsd-ubin-lint-stdarg.patch | 24 +
205 .../freebsd-ubin/files/freebsd-ubin-setXid.patch | 129 ++++
206 .../freebsd-ubin/files/locate-updatedb-cron | 6 +
207 sys-freebsd/freebsd-ubin/files/login.1.pamd | 4 +
208 sys-freebsd/freebsd-ubin/files/login.pamd | 20 +
209 sys-freebsd/freebsd-ubin/files/passwd.1.pamd | 9 +
210 sys-freebsd/freebsd-ubin/files/passwd.pamd | 11 +
211 sys-freebsd/freebsd-ubin/files/su.1.pamd | 17 +
212 sys-freebsd/freebsd-ubin/files/su.pamd | 17 +
213 sys-freebsd/freebsd-ubin/freebsd-ubin-11.0.ebuild | 210 +++++++
214 sys-freebsd/freebsd-ubin/metadata.xml | 24 +
215 .../files/freebsd-usbin-10.0-bsdxml2expat.patch | 24 +
216 .../files/freebsd-usbin-10.3-bsdxml2expat.patch | 13 +
217 .../files/freebsd-usbin-7.0-nowrap.patch | 45 ++
218 .../files/freebsd-usbin-8.2-newsyslog.patch | 10 +
219 .../files/freebsd-usbin-9.0-libarchive.patch | 12 +
220 .../files/freebsd-usbin-9.0-newsyslog.patch | 12 +
221 .../files/freebsd-usbin-9.1-bsdxml2expat.patch | 12 +
222 .../files/freebsd-usbin-9.1-kldxref.patch | 30 +
223 .../files/freebsd-usbin-adduser.patch | 20 +
224 sys-freebsd/freebsd-usbin/files/iscsid.initd | 20 +
225 sys-freebsd/freebsd-usbin/files/mountd.patch | 15 +
226 sys-freebsd/freebsd-usbin/files/moused.confd | 20 +
227 sys-freebsd/freebsd-usbin/files/moused.initd | 66 +++
228 sys-freebsd/freebsd-usbin/files/nfs.confd | 10 +
229 sys-freebsd/freebsd-usbin/files/nfs.initd | 54 ++
230 sys-freebsd/freebsd-usbin/files/nfsmount.initd | 63 ++
231 sys-freebsd/freebsd-usbin/files/nfsuserd.confd | 5 +
232 sys-freebsd/freebsd-usbin/files/nfsuserd.initd | 20 +
233 sys-freebsd/freebsd-usbin/files/powerd.confd | 14 +
234 sys-freebsd/freebsd-usbin/files/powerd.initd | 27 +
235 sys-freebsd/freebsd-usbin/files/pw.conf | 5 +
236 sys-freebsd/freebsd-usbin/files/rarpd.confd | 7 +
237 sys-freebsd/freebsd-usbin/files/rarpd.initd | 35 ++
238 sys-freebsd/freebsd-usbin/files/rpc.lockd.initd | 20 +
239 sys-freebsd/freebsd-usbin/files/rpc.statd.initd | 20 +
240 sys-freebsd/freebsd-usbin/files/rpcbind.initd | 30 +
241 sys-freebsd/freebsd-usbin/files/syscons.confd | 14 +
242 sys-freebsd/freebsd-usbin/files/syscons.initd | 78 +++
243 sys-freebsd/freebsd-usbin/files/syslogd.initd | 25 +
244 .../freebsd-usbin/freebsd-usbin-11.0.ebuild | 187 ++++++
245 sys-freebsd/freebsd-usbin/metadata.xml | 19 +
246 236 files changed, 9546 insertions(+)
247
248 diff --git a/sys-freebsd/boot0/boot0-11.0.ebuild b/sys-freebsd/boot0/boot0-11.0.ebuild
249 new file mode 100644
250 index 0000000..49521d0
251 --- /dev/null
252 +++ b/sys-freebsd/boot0/boot0-11.0.ebuild
253 @@ -0,0 +1,83 @@
254 +# Copyright 1999-2016 Gentoo Foundation
255 +# Distributed under the terms of the GNU General Public License v2
256 +# $Id$
257 +
258 +EAPI=5
259 +
260 +inherit bsdmk freebsd flag-o-matic toolchain-funcs
261 +
262 +DESCRIPTION="FreeBSD's bootloader"
263 +SLOT="0"
264 +
265 +IUSE="bzip2 ieee1394 tftp zfs"
266 +
267 +if [[ ${PV} != *9999* ]]; then
268 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
269 +fi
270 +
271 +EXTRACTONLY="
272 + sys/
273 + lib/
274 + contrib/bzip2/
275 +"
276 +
277 +RDEPEND=""
278 +DEPEND="=sys-freebsd/freebsd-mk-defs-${RV}*
279 + =sys-freebsd/freebsd-lib-${RV}*"
280 +
281 +S="${WORKDIR}/sys/boot"
282 +
283 +PATCHES=( "${FILESDIR}/${PN}-10.1-gcc46.patch"
284 + "${FILESDIR}/${PN}-10.3-clang.patch"
285 + "${FILESDIR}/${PN}-10.3-drop-unsupport-cflags.patch"
286 + "${FILESDIR}/${PN}-10.3-uefi-support.patch"
287 + "${FILESDIR}/${PN}-add-nossp-cflags.patch" )
288 +
289 +boot0_use_enable() {
290 + use ${1} && mymakeopts="${mymakeopts} LOADER_${2}_SUPPORT=\"yes\""
291 + use ${1} || mymakeopts="${mymakeopts} WITHOUT_${2}= "
292 +}
293 +
294 +pkg_setup() {
295 + boot0_use_enable ieee1394 FIREWIRE
296 + boot0_use_enable zfs ZFS
297 + boot0_use_enable tftp TFTP
298 + boot0_use_enable bzip2 BZIP2
299 +}
300 +
301 +src_prepare() {
302 + sed -e '/-mno-align-long-strings/d' \
303 + -i "${S}"/i386/boot2/Makefile \
304 + -i "${S}"/i386/gptboot/Makefile \
305 + -i "${S}"/i386/gptzfsboot/Makefile \
306 + -i "${S}"/i386/zfsboot/Makefile || die
307 +
308 + export MAKEOBJDIRPREFIX="${WORKDIR}/build"
309 +}
310 +
311 +src_compile() {
312 + strip-flags
313 + append-flags "-fno-strict-aliasing"
314 +
315 + cd "${WORKDIR}/lib/libstand" || die
316 + freebsd_src_compile
317 +
318 + CFLAGS="${CFLAGS} -I${WORKDIR}/lib/libstand"
319 + LDFLAGS="${LDFLAGS} -L${WORKDIR}/lib/libstand"
320 + export LIBSTAND="${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libstand/libstand.a"
321 +
322 + cd "${S}" || die
323 + NOFLAGSTRIP="yes" freebsd_src_compile
324 +}
325 +
326 +src_install() {
327 + dodir /boot/defaults
328 + mkinstall FILESDIR=/boot || die "mkinstall failed"
329 +
330 + cd "${WORKDIR}/sys/$(tc-arch-kernel)/conf" || die
331 + insinto /boot
332 + newins GENERIC.hints device.hints
333 +
334 + echo 'CONFIG_PROTECT="/boot/device.hints"' > "${T}"/50boot0
335 + doenvd "${T}"/50boot0
336 +}
337
338 diff --git a/sys-freebsd/boot0/files/boot0-10.1-drop-unsupport-cflags.patch b/sys-freebsd/boot0/files/boot0-10.1-drop-unsupport-cflags.patch
339 new file mode 100644
340 index 0000000..4ab415b
341 --- /dev/null
342 +++ b/sys-freebsd/boot0/files/boot0-10.1-drop-unsupport-cflags.patch
343 @@ -0,0 +1,26 @@
344 +diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile
345 +index 76ed0ca..2d1d39d 100644
346 +--- a/sys/boot/efi/libefi/Makefile
347 ++++ b/sys/boot/efi/libefi/Makefile
348 +@@ -17,7 +17,4 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
349 + CFLAGS+= -I${.CURDIR}/../../common
350 +
351 +
352 +-# Suppress warning from clang for FreeBSD %b and %D formats
353 +-CFLAGS+= -fformat-extensions
354 +-
355 + .include <bsd.lib.mk>
356 +diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile
357 +index d714c74..a5cfa3c 100644
358 +--- a/sys/boot/i386/libi386/Makefile
359 ++++ b/sys/boot/i386/libi386/Makefile
360 +@@ -52,9 +52,6 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../common \
361 + # the location of libstand
362 + CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
363 +
364 +-# Suppress warning from clang for FreeBSD %b and %D formats
365 +-CFLAGS+= -fformat-extensions
366 +-
367 + .if ${MACHINE_CPUARCH} == "amd64"
368 + CLEANFILES+= machine
369 + machine:
370
371 diff --git a/sys-freebsd/boot0/files/boot0-10.1-gcc46.patch b/sys-freebsd/boot0/files/boot0-10.1-gcc46.patch
372 new file mode 100644
373 index 0000000..9b31e7c
374 --- /dev/null
375 +++ b/sys-freebsd/boot0/files/boot0-10.1-gcc46.patch
376 @@ -0,0 +1,67 @@
377 +diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc
378 +index 472b275..0c9409d 100644
379 +--- a/sys/boot/i386/Makefile.inc
380 ++++ b/sys/boot/i386/Makefile.inc
381 +@@ -13,8 +13,6 @@ LDFLAGS+= -nostdlib
382 + .if ${MACHINE_CPUARCH} == "amd64"
383 + CFLAGS+= -m32
384 + ACFLAGS+= -m32
385 +-# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
386 +-LD_FLAGS+= -m elf_i386_fbsd
387 + AFLAGS+= --32
388 + .endif
389 +
390 +diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
391 +index 428950e..6a15450 100644
392 +--- a/sys/boot/i386/boot2/Makefile
393 ++++ b/sys/boot/i386/boot2/Makefile
394 +@@ -113,3 +113,10 @@ machine:
395 + # XXX: clang integrated-as doesn't grok .codeNN directives yet
396 + CFLAGS.boot1.S= ${CLANG_NO_IAS}
397 + CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
398 ++
399 ++# gcc 4.6 or later version, -fno-asynchronous-unwind-tables is required to build.
400 ++CFLAGS+= -fno-asynchronous-unwind-tables
401 ++
402 ++.if ${MACHINE_CPUARCH} == "amd64"
403 ++LD_FLAGS+= -m elf_i386_fbsd
404 ++.endif
405 +diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
406 +index a90e712..d60ae00 100644
407 +--- a/sys/boot/i386/gptboot/Makefile
408 ++++ b/sys/boot/i386/gptboot/Makefile
409 +@@ -81,3 +81,8 @@ machine:
410 + # XXX: clang integrated-as doesn't grok .codeNN directives yet
411 + CFLAGS.gptldr.S= ${CLANG_NO_IAS}
412 + CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
413 ++
414 ++.if ${MACHINE_CPUARCH} == "amd64"
415 ++LD_FLAGS+= -m elf_i386_fbsd
416 ++.endif
417 ++
418 +diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile
419 +index 5eb2383..c10a917 100644
420 +--- a/sys/boot/i386/gptzfsboot/Makefile
421 ++++ b/sys/boot/i386/gptzfsboot/Makefile
422 +@@ -78,3 +78,8 @@ machine:
423 + # XXX: clang integrated-as doesn't grok .codeNN directives yet
424 + CFLAGS.gptldr.S= ${CLANG_NO_IAS}
425 + CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
426 ++
427 ++.if ${MACHINE_CPUARCH} == "amd64"
428 ++LD_FLAGS+= -m elf_i386_fbsd
429 ++.endif
430 ++
431 +diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
432 +index 149f43a..be1e46a 100644
433 +--- a/sys/boot/i386/zfsboot/Makefile
434 ++++ b/sys/boot/i386/zfsboot/Makefile
435 +@@ -91,3 +91,8 @@ machine:
436 + # XXX: clang integrated-as doesn't grok .codeNN directives yet
437 + CFLAGS.zfsldr.S= ${CLANG_NO_IAS}
438 + CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
439 ++
440 ++.if ${MACHINE_CPUARCH} == "amd64"
441 ++LD_FLAGS+= -m elf_i386_fbsd
442 ++.endif
443 ++
444
445 diff --git a/sys-freebsd/boot0/files/boot0-10.3-clang.patch b/sys-freebsd/boot0/files/boot0-10.3-clang.patch
446 new file mode 100644
447 index 0000000..4245e21
448 --- /dev/null
449 +++ b/sys-freebsd/boot0/files/boot0-10.3-clang.patch
450 @@ -0,0 +1,30 @@
451 +Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=542676
452 +
453 +https://svnweb.freebsd.org/base/head/sys/boot/i386/boot2/Makefile?r1=272249&r2=276479
454 +
455 +diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
456 +index 8a6e771..c030853 100644
457 +--- a/sys/boot/i386/boot2/Makefile
458 ++++ b/sys/boot/i386/boot2/Makefile
459 +@@ -22,8 +22,7 @@ BOOT2_UFS?= UFS1_AND_UFS2
460 + #BOOT2_UFS?= UFS2_ONLY
461 + #BOOT2_UFS?= UFS1_ONLY
462 +
463 +-CFLAGS= -Os \
464 +- -fomit-frame-pointer \
465 ++CFLAGS= -fomit-frame-pointer \
466 + -mrtd \
467 + -mregparm=3 \
468 + -DUSE_XREAD \
469 +@@ -40,7 +39,10 @@ CFLAGS= -Os \
470 + -Winline \
471 + ${CLANG_OPT_SMALL}
472 +
473 +-CFLAGS.gcc+= -fno-guess-branch-probability \
474 ++CFLAGS.clang+= -Oz
475 ++
476 ++CFLAGS.gcc+= -Os \
477 ++ -fno-guess-branch-probability \
478 + -fno-unit-at-a-time \
479 + --param max-inline-insns-single=100
480 + .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
481
482 diff --git a/sys-freebsd/boot0/files/boot0-10.3-drop-unsupport-cflags.patch b/sys-freebsd/boot0/files/boot0-10.3-drop-unsupport-cflags.patch
483 new file mode 100644
484 index 0000000..af1d351
485 --- /dev/null
486 +++ b/sys-freebsd/boot0/files/boot0-10.3-drop-unsupport-cflags.patch
487 @@ -0,0 +1,28 @@
488 +diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile
489 +index fc66e01..470453d 100644
490 +--- a/sys/boot/efi/libefi/Makefile
491 ++++ b/sys/boot/efi/libefi/Makefile
492 +@@ -17,9 +17,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
493 + # Pick up the bootstrap header for some interface items
494 + CFLAGS+= -I${.CURDIR}/../../common
495 +
496 +-
497 +-# Suppress warning from clang for FreeBSD %b and %D formats
498 +-CFLAGS+= -fformat-extensions
499 + CFLAGS+= -DTERM_EMU
500 +
501 + .include <bsd.lib.mk>
502 +diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile
503 +index 24cc4c1..e5d2bae 100644
504 +--- a/sys/boot/i386/libi386/Makefile
505 ++++ b/sys/boot/i386/libi386/Makefile
506 +@@ -55,9 +55,6 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../common \
507 + # the location of libstand
508 + CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
509 +
510 +-# Suppress warning from clang for FreeBSD %b and %D formats
511 +-CFLAGS+= -fformat-extensions
512 +-
513 + .if ${MACHINE_CPUARCH} == "amd64"
514 + CLEANFILES+= machine
515 + machine:
516
517 diff --git a/sys-freebsd/boot0/files/boot0-10.3-uefi-support.patch b/sys-freebsd/boot0/files/boot0-10.3-uefi-support.patch
518 new file mode 100644
519 index 0000000..fdafe74
520 --- /dev/null
521 +++ b/sys-freebsd/boot0/files/boot0-10.3-uefi-support.patch
522 @@ -0,0 +1,33 @@
523 +diff --git a/efi/Makefile b/efi/Makefile
524 +index 30024e3..a33efb2 100644
525 +--- a/efi/Makefile
526 ++++ b/efi/Makefile
527 +@@ -2,15 +2,10 @@
528 +
529 + .include <bsd.own.mk>
530 +
531 +-# In-tree GCC does not support __attribute__((ms_abi)).
532 +-.if ${COMPILER_TYPE} != "gcc"
533 +-
534 + .if ${MACHINE_CPUARCH} == "amd64"
535 + SUBDIR+= libefi loader boot1
536 + .endif
537 +
538 +-.endif # ${COMPILER_TYPE} != "gcc"
539 +-
540 + .if ${MACHINE_CPUARCH} == "ia64"
541 + SUBDIR+= libefi
542 + .endif
543 +diff --git a/efi/boot1/Makefile b/efi/boot1/Makefile
544 +index 4ffdfda..8ec0e00 100644
545 +--- a/efi/boot1/Makefile
546 ++++ b/efi/boot1/Makefile
547 +@@ -64,7 +64,7 @@ LDFLAGS+= -Wl,-znocombreloc
548 + # Add libstand for required string and memory functions for all platforms.
549 + #
550 + DPADD+= ${LIBSTAND}
551 +-LDADD+= -lstand
552 ++LDADD+= ${LIBSTAND}
553 +
554 + DPADD+= ${LDSCRIPT}
555 +
556
557 diff --git a/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch b/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch
558 new file mode 100644
559 index 0000000..a3a33d5
560 --- /dev/null
561 +++ b/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch
562 @@ -0,0 +1,13 @@
563 +diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
564 +index bb16ea3..7dedb49 100644
565 +--- a/sys/boot/i386/zfsboot/Makefile
566 ++++ b/sys/boot/i386/zfsboot/Makefile
567 +@@ -83,6 +83,8 @@ zfsboot.bin: zfsboot.out
568 + zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o
569 + ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
570 +
571 ++drv.o: drv.c xreadorg.h
572 ++
573 + zfsboot.o: zfsboot.s
574 +
575 + SRCS= zfsboot.c xreadorg.h
576
577 diff --git a/sys-freebsd/boot0/files/boot0-9.2-gcc46.patch b/sys-freebsd/boot0/files/boot0-9.2-gcc46.patch
578 new file mode 100644
579 index 0000000..ffd9f43
580 --- /dev/null
581 +++ b/sys-freebsd/boot0/files/boot0-9.2-gcc46.patch
582 @@ -0,0 +1,66 @@
583 +diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc
584 +index f5faec7..a9cf593 100644
585 +--- a/sys/boot/i386/Makefile.inc
586 ++++ b/sys/boot/i386/Makefile.inc
587 +@@ -12,7 +12,6 @@ LDFLAGS+= -nostdlib
588 + .if ${MACHINE_CPUARCH} == "amd64"
589 + CFLAGS+= -m32
590 + ACFLAGS+= -m32
591 +-LDFLAGS+= -m elf_i386_fbsd
592 + AFLAGS+= --32
593 + .endif
594 +
595 +diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
596 +index 65815a5..61840dd 100644
597 +--- a/sys/boot/i386/boot2/Makefile
598 ++++ b/sys/boot/i386/boot2/Makefile
599 +@@ -109,3 +109,10 @@ machine:
600 + # XXX: clang integrated-as doesn't grok .codeNN directives yet
601 + CFLAGS.boot1.S= ${CLANG_NO_IAS}
602 + CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
603 ++
604 ++# gcc 4.6 or later version, -fno-asynchronous-unwind-tables is required to build.
605 ++CFLAGS+= -fno-asynchronous-unwind-tables
606 ++
607 ++.if ${MACHINE_CPUARCH} == "amd64"
608 ++LDFLAGS+= -m elf_i386_fbsd
609 ++.endif
610 +diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
611 +index e1a640a..29886cc 100644
612 +--- a/sys/boot/i386/gptboot/Makefile
613 ++++ b/sys/boot/i386/gptboot/Makefile
614 +@@ -78,3 +78,8 @@ machine:
615 + # XXX: clang integrated-as doesn't grok .codeNN directives yet
616 + CFLAGS.gptldr.S= ${CLANG_NO_IAS}
617 + CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
618 ++
619 ++.if ${MACHINE_CPUARCH} == "amd64"
620 ++LDFLAGS+= -m elf_i386_fbsd
621 ++.endif
622 ++
623 +diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile
624 +index a2b8fcc..107f531 100644
625 +--- a/sys/boot/i386/gptzfsboot/Makefile
626 ++++ b/sys/boot/i386/gptzfsboot/Makefile
627 +@@ -76,3 +76,8 @@ machine:
628 + # XXX: clang integrated-as doesn't grok .codeNN directives yet
629 + CFLAGS.gptldr.S= ${CLANG_NO_IAS}
630 + CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
631 ++
632 ++.if ${MACHINE_CPUARCH} == "amd64"
633 ++LDFLAGS+= -m elf_i386_fbsd
634 ++.endif
635 ++
636 +diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
637 +index b2db778..252dc62 100644
638 +--- a/sys/boot/i386/zfsboot/Makefile
639 ++++ b/sys/boot/i386/zfsboot/Makefile
640 +@@ -89,3 +89,8 @@ machine:
641 + # XXX: clang integrated-as doesn't grok .codeNN directives yet
642 + CFLAGS.zfsldr.S= ${CLANG_NO_IAS}
643 + CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
644 ++
645 ++.if ${MACHINE_CPUARCH} == "amd64"
646 ++LDFLAGS+= -m elf_i386_fbsd
647 ++.endif
648 ++
649
650 diff --git a/sys-freebsd/boot0/files/boot0-add-nossp-cflags.patch b/sys-freebsd/boot0/files/boot0-add-nossp-cflags.patch
651 new file mode 100644
652 index 0000000..abc6a57
653 --- /dev/null
654 +++ b/sys-freebsd/boot0/files/boot0-add-nossp-cflags.patch
655 @@ -0,0 +1,11 @@
656 +https://bugs.gentoo.org/show_bug.cgi?id=511698
657 +
658 +diff --git a/sys/boot/Makefile.inc b/sys/boot/Makefile.inc
659 +index e0039b9..533dea0 100644
660 +--- a/sys/boot/Makefile.inc
661 ++++ b/sys/boot/Makefile.inc
662 +@@ -1,3 +1,3 @@
663 + # $FreeBSD: release/10.0.0/sys/boot/Makefile.inc 188895 2009-02-21 15:04:31Z ru $
664 +
665 +-SSP_CFLAGS=
666 ++SSP_CFLAGS= -fno-stack-protector
667
668 diff --git a/sys-freebsd/boot0/metadata.xml b/sys-freebsd/boot0/metadata.xml
669 new file mode 100644
670 index 0000000..d9f0c83
671 --- /dev/null
672 +++ b/sys-freebsd/boot0/metadata.xml
673 @@ -0,0 +1,12 @@
674 +<?xml version="1.0" encoding="UTF-8"?>
675 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
676 +<pkgmetadata>
677 +<maintainer type="project">
678 + <email>bsd@g.o</email>
679 + <name>BSD Project</name>
680 + </maintainer>
681 + <use>
682 + <flag name="tftp">Enable PXE/TFTP boot support.</flag>
683 + <flag name="zfs">Enable booting on ZFS filesystems.</flag>
684 + </use>
685 +</pkgmetadata>
686
687 diff --git a/sys-freebsd/freebsd-bin/freebsd-bin-11.0.ebuild b/sys-freebsd/freebsd-bin/freebsd-bin-11.0.ebuild
688 new file mode 100644
689 index 0000000..d4bf7e3
690 --- /dev/null
691 +++ b/sys-freebsd/freebsd-bin/freebsd-bin-11.0.ebuild
692 @@ -0,0 +1,42 @@
693 +# Copyright 1999-2016 Gentoo Foundation
694 +# Distributed under the terms of the GNU General Public License v2
695 +# $Id$
696 +
697 +EAPI=5
698 +
699 +inherit bsdmk freebsd
700 +
701 +DESCRIPTION="FreeBSD /bin tools"
702 +SLOT="0"
703 +
704 +IUSE=""
705 +
706 +if [[ ${PV} != *9999* ]]; then
707 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
708 +fi
709 +
710 +EXTRACTONLY="
711 + bin/
712 + usr.bin/
713 + sbin/
714 + lib/
715 +"
716 +
717 +RDEPEND="=sys-freebsd/freebsd-lib-${RV}*
718 + >=dev-libs/libedit-20120311.3.0-r1
719 + sys-libs/ncurses:0=
720 + sys-apps/ed
721 + !app-misc/realpath
722 + !<sys-freebsd/freebsd-ubin-8"
723 +DEPEND="${RDEPEND}
724 + =sys-freebsd/freebsd-mk-defs-${RV}*
725 + >=sys-devel/flex-2.5.31-r2"
726 +
727 +S=${WORKDIR}/bin
728 +
729 +# csh and tcsh are provided by tcsh package, rmail is sendmail stuff.
730 +REMOVE_SUBDIRS="csh rmail ed freebsd-version"
731 +
732 +pkg_setup() {
733 + mymakeopts="${mymakeopts} WITHOUT_TCSH= WITHOUT_SENDMAIL= WITHOUT_RCMDS= "
734 +}
735
736 diff --git a/sys-freebsd/freebsd-bin/metadata.xml b/sys-freebsd/freebsd-bin/metadata.xml
737 new file mode 100644
738 index 0000000..a00f3ae
739 --- /dev/null
740 +++ b/sys-freebsd/freebsd-bin/metadata.xml
741 @@ -0,0 +1,8 @@
742 +<?xml version="1.0" encoding="UTF-8"?>
743 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
744 +<pkgmetadata>
745 +<maintainer type="project">
746 + <email>bsd@g.o</email>
747 + <name>BSD Project</name>
748 +</maintainer>
749 +</pkgmetadata>
750
751 diff --git a/sys-freebsd/freebsd-cddl/files/freebsd-cddl-10.2-libpaths.patch b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-10.2-libpaths.patch
752 new file mode 100644
753 index 0000000..9af7cfb
754 --- /dev/null
755 +++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-10.2-libpaths.patch
756 @@ -0,0 +1,220 @@
757 +diff --git a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile
758 +index d8bcccb..2cebbcb 100644
759 +--- a/cddl/lib/libzfs/Makefile
760 ++++ b/cddl/lib/libzfs/Makefile
761 +@@ -59,6 +59,11 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
762 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
763 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
764 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
765 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
766 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
767 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
768 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
769 ++
770 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
771 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
772 +
773 +diff --git a/cddl/lib/libzfs_core/Makefile b/cddl/lib/libzfs_core/Makefile
774 +index 262d3e9..9643210 100644
775 +--- a/cddl/lib/libzfs_core/Makefile
776 ++++ b/cddl/lib/libzfs_core/Makefile
777 +@@ -34,4 +34,6 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
778 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
779 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
780 +
781 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
782 ++
783 + .include <bsd.lib.mk>
784 +diff --git a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile
785 +index 83cefca..55c56d5 100644
786 +--- a/cddl/lib/libzpool/Makefile
787 ++++ b/cddl/lib/libzpool/Makefile
788 +@@ -56,6 +56,10 @@ CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/thread
789 + CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/sys
790 + CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
791 +
792 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
793 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
794 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
795 ++
796 + DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBZ} ${LIBNVPAIR} \
797 + ${LIBAVL} ${LIBUMEM}
798 + LDADD= -lmd -lpthread -lz -lnvpair -lavl -lumem
799 +diff --git a/cddl/sbin/zfs/Makefile b/cddl/sbin/zfs/Makefile
800 +index 1f909aa..2590302 100644
801 +--- a/cddl/sbin/zfs/Makefile
802 ++++ b/cddl/sbin/zfs/Makefile
803 +@@ -22,6 +22,12 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
804 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
805 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
806 +
807 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
808 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
809 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
810 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
811 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
812 ++
813 + DPADD= ${LIBGEOM} ${LIBJAIL} ${LIBNVPAIR} ${LIBUMEM} \
814 + ${LIBUTIL} ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS}
815 + LDADD= -lgeom -ljail -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
816 +diff --git a/cddl/sbin/zpool/Makefile b/cddl/sbin/zpool/Makefile
817 +index 4b5b898..f89d010 100644
818 +--- a/cddl/sbin/zpool/Makefile
819 ++++ b/cddl/sbin/zpool/Makefile
820 +@@ -27,6 +27,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
821 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
822 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
823 +
824 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
825 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
826 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
827 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
828 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
829 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
830 ++
831 + DPADD= ${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \
832 + ${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS}
833 + LDADD= -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
834 +diff --git a/cddl/usr.bin/ctfconvert/Makefile b/cddl/usr.bin/ctfconvert/Makefile
835 +index 6cb9529..e76fbc4 100644
836 +--- a/cddl/usr.bin/ctfconvert/Makefile
837 ++++ b/cddl/usr.bin/ctfconvert/Makefile
838 +@@ -36,6 +36,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
839 + -I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
840 + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common
841 +
842 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
843 ++
844 + DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
845 + LDADD= -lctf -ldwarf -lelf -lz -lpthread
846 +
847 +diff --git a/cddl/usr.bin/ctfmerge/Makefile b/cddl/usr.bin/ctfmerge/Makefile
848 +index 673c7e3..5fff940 100644
849 +--- a/cddl/usr.bin/ctfmerge/Makefile
850 ++++ b/cddl/usr.bin/ctfmerge/Makefile
851 +@@ -33,6 +33,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
852 + -I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
853 + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common
854 +
855 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
856 ++
857 + DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
858 + LDADD= -lctf -ldwarf -lelf -lz -lpthread
859 +
860 +diff --git a/cddl/usr.bin/zinject/Makefile b/cddl/usr.bin/zinject/Makefile
861 +index b6605cb..7028630 100644
862 +--- a/cddl/usr.bin/zinject/Makefile
863 ++++ b/cddl/usr.bin/zinject/Makefile
864 +@@ -21,6 +21,14 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs/
865 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
866 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
867 +
868 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
869 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
870 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
871 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
872 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
873 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
874 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
875 ++
876 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
877 + ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
878 + LDADD= -lgeom -lm -lnvpair -lumem -luutil -lzfs_core -lzfs -lzpool
879 +diff --git a/cddl/usr.bin/zstreamdump/Makefile b/cddl/usr.bin/zstreamdump/Makefile
880 +index 888b9af..523ba44 100644
881 +--- a/cddl/usr.bin/zstreamdump/Makefile
882 ++++ b/cddl/usr.bin/zstreamdump/Makefile
883 +@@ -18,6 +18,11 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
884 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
885 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
886 +
887 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
888 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
889 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
890 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
891 ++
892 + DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
893 + ${LIBPTHREAD} ${LIBZ} ${LIBAVL}
894 + LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
895 +diff --git a/cddl/usr.bin/ztest/Makefile b/cddl/usr.bin/ztest/Makefile
896 +index f6f7e03..6fed691 100644
897 +--- a/cddl/usr.bin/ztest/Makefile
898 ++++ b/cddl/usr.bin/ztest/Makefile
899 +@@ -18,6 +18,14 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
900 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
901 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
902 +
903 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
904 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
905 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
906 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
907 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
908 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
909 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
910 ++
911 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
912 + ${LIBPTHREAD} ${LIBAVL} ${LIBZFS_CORE} ${LIBZFS} ${LIBUUTIL}
913 + LDADD= -lgeom -lm -lnvpair -lumem -lzpool -lpthread -lavl -lzfs_core -lzfs \
914 +diff --git a/cddl/usr.sbin/dtrace/Makefile b/cddl/usr.sbin/dtrace/Makefile
915 +index fb5729f..ea9a752 100644
916 +--- a/cddl/usr.sbin/dtrace/Makefile
917 ++++ b/cddl/usr.sbin/dtrace/Makefile
918 +@@ -25,4 +25,7 @@ DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBFL} ${LIBPROC} \
919 + LDADD= -lpthread -ldtrace -ly -lfl -lproc -lctf -lelf -lz -lutil \
920 + -lrtld_db
921 +
922 ++LDFLAGS+= -L${.CURDIR}/../../lib/libdtrace
923 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
924 ++
925 + .include <bsd.prog.mk>
926 +diff --git a/cddl/usr.sbin/lockstat/Makefile b/cddl/usr.sbin/lockstat/Makefile
927 +index ccd8189..827a197 100644
928 +--- a/cddl/usr.sbin/lockstat/Makefile
929 ++++ b/cddl/usr.sbin/lockstat/Makefile
930 +@@ -20,6 +20,9 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
931 +
932 + CFLAGS+= -DNEED_ERRLOC -g
933 +
934 ++LDFLAGS+= -L${.CURDIR}/../../lib/libdtrace
935 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
936 ++
937 + #YFLAGS+= -d
938 +
939 + DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBFL} ${LIBPROC} \
940 +diff --git a/cddl/usr.sbin/zdb/Makefile b/cddl/usr.sbin/zdb/Makefile
941 +index c2a6b1d..f411fc0 100644
942 +--- a/cddl/usr.sbin/zdb/Makefile
943 ++++ b/cddl/usr.sbin/zdb/Makefile
944 +@@ -24,6 +24,14 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
945 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
946 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
947 +
948 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
949 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
950 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
951 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
952 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
953 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
954 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
955 ++
956 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
957 + ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
958 + LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs_core -lzfs -lzpool
959 +diff --git a/cddl/usr.sbin/zhack/Makefile b/cddl/usr.sbin/zhack/Makefile
960 +index 1957aad..9a5570a 100644
961 +--- a/cddl/usr.sbin/zhack/Makefile
962 ++++ b/cddl/usr.sbin/zhack/Makefile
963 +@@ -23,6 +23,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
964 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
965 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
966 +
967 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
968 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
969 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
970 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
971 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
972 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
973 ++
974 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
975 + ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
976 + LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs_core -lzfs -lzpool
977
978 diff --git a/sys-freebsd/freebsd-cddl/files/freebsd-cddl-10.3-underlink.patch b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-10.3-underlink.patch
979 new file mode 100644
980 index 0000000..c8ce8e1
981 --- /dev/null
982 +++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-10.3-underlink.patch
983 @@ -0,0 +1,12 @@
984 +diff --git a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile
985 +index 2a66337..04988d7 100644
986 +--- a/cddl/lib/libzfs/Makefile
987 ++++ b/cddl/lib/libzfs/Makefile
988 +@@ -12,6 +12,7 @@ DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} ${LIBNVPAIR} \
989 +
990 + LDADD= -lmd -lpthread -lumem -lutil -luutil -lm -lnvpair -lavl \
991 + -lbsdxml -lgeom -lnvpair -lz -lzfs_core
992 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
993 +
994 + SRCS= deviceid.c \
995 + fsshare.c \
996
997 diff --git a/sys-freebsd/freebsd-cddl/files/freebsd-cddl-8.0-libpaths.patch b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-8.0-libpaths.patch
998 new file mode 100644
999 index 0000000..ad5c83e
1000 --- /dev/null
1001 +++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-8.0-libpaths.patch
1002 @@ -0,0 +1,114 @@
1003 +diff -ru cddl.orig/lib/libctf/Makefile cddl/lib/libctf/Makefile
1004 +--- cddl.orig/lib/libctf/Makefile 2009-01-24 03:36:33 -0200
1005 ++++ cddl/lib/libctf/Makefile 2009-01-24 03:55:10 -0200
1006 +@@ -4,6 +4,7 @@
1007 +
1008 + LIB= ctf
1009 + SHLIB_MAJOR= 2
1010 ++LDADD+=-lz
1011 +
1012 + SRCS= ctf_create.c \
1013 + ctf_decl.c \
1014 +diff -ru cddl.orig/lib/libdtrace/Makefile cddl/lib/libdtrace/Makefile
1015 +--- cddl.orig/lib/libdtrace/Makefile 2009-01-24 00:18:47 -0200
1016 ++++ cddl/lib/libdtrace/Makefile 2009-01-24 03:31:06 -0200
1017 +@@ -74,7 +74,7 @@
1018 + .endif
1019 +
1020 + LFLAGS+=-l
1021 +-
1022 ++LDADD+=-lz -lproc
1023 + YFLAGS+=-d
1024 +
1025 + CLEANFILES= dt_errtags.c dt_names.c
1026 +diff -ru cddl.orig/lib/libzfs/Makefile cddl/lib/libzfs/Makefile
1027 +--- cddl.orig/lib/libzfs/Makefile 2008-06-22 10:26:18 -0300
1028 ++++ cddl/lib/libzfs/Makefile 2008-06-22 10:26:26 -0300
1029 +@@ -7,7 +7,8 @@
1030 +
1031 + LIB= zfs
1032 + DPADD= ${LIBUTIL}
1033 +-LDADD= -lutil
1034 ++LDADD= -lutil -lgeom -lm -luutil -lumem
1035 ++LDFLAGS+= -L${.CURDIR}/../libuutil -L${.CURDIR}/../libumem
1036 +
1037 + SRCS= deviceid.c \
1038 + mnttab.c \
1039 +diff -ru cddl.orig/lib/libzpool/Makefile cddl/lib/libzpool/Makefile
1040 +--- cddl.orig/lib/libzpool/Makefile 2008-06-22 10:35:15 -0300
1041 ++++ cddl/lib/libzpool/Makefile 2008-06-22 10:37:06 -0300
1042 +@@ -42,7 +42,8 @@
1043 + CFLAGS+= -I${.CURDIR}/../../../contrib/opensolaris/lib/libnvpair
1044 +
1045 + DPADD= ${LIBPTHREAD} ${LIBZ}
1046 +-LDADD= -lpthread -lz
1047 ++LDADD= -lpthread -lz -lavl -lumem
1048 ++LDFLAGS+= -L${.CURDIR}/../libavl -L${.CURDIR}/../libumem
1049 +
1050 + # atomic.S doesn't like profiling.
1051 + NO_PROFILE=
1052 +diff -ru cddl.orig/sbin/zfs/Makefile cddl/sbin/zfs/Makefile
1053 +--- cddl.orig/sbin/zfs/Makefile 2008-06-22 10:02:30 -0300
1054 ++++ cddl/sbin/zfs/Makefile 2008-06-22 10:14:23 -0300
1055 +@@ -23,5 +23,7 @@
1056 + ${LIBM} ${LIBNVPAIR} ${LIBUUTIL} ${LIBUTIL}
1057 + LDADD= -lzfs -lgeom -lbsdxml -lsbuf \
1058 + -lm -lnvpair -luutil -lutil
1059 ++LDFLAGS+=-L${.CURDIR}/../../lib/libzfs -L${.CURDIR}/../../lib/libnvpair \
1060 ++ -L${.CURDIR}/../../lib/libuutil -L/lib -L/usr/lib
1061 +
1062 + .include <bsd.prog.mk>
1063 +diff -ru cddl.orig/sbin/zpool/Makefile cddl/sbin/zpool/Makefile
1064 +--- cddl.orig/sbin/zpool/Makefile 2008-06-22 10:02:30 -0300
1065 ++++ cddl/sbin/zpool/Makefile 2008-06-22 10:14:47 -0300
1066 +@@ -23,5 +23,7 @@
1067 + ${LIBM} ${LIBNVPAIR} ${LIBUUTIL} ${LIBUTIL}
1068 + LDADD= -lavl -lzfs -lgeom -lbsdxml -lsbuf \
1069 + -lm -lnvpair -luutil -lutil
1070 ++LDFLAGS+=-L${.CURDIR}/../../lib/libzfs -L${.CURDIR}/../../lib/libavl -L/lib -L/usr/lib \
1071 ++ -L${.CURDIR}/../../lib/libnvpair -L${.CURDIR}/../../lib/libuutil
1072 +
1073 + .include <bsd.prog.mk>
1074 +diff -ru cddl.orig/usr.bin/ztest/Makefile cddl/usr.bin/ztest/Makefile
1075 +--- cddl.orig/usr.bin/ztest/Makefile 2008-06-22 10:02:30 -0300
1076 ++++ cddl/usr.bin/ztest/Makefile 2008-06-22 10:12:40 -0300
1077 +@@ -18,5 +18,7 @@
1078 + DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
1079 + ${LIBPTHREAD} ${LIBZ} ${LIBAVL}
1080 + LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
1081 ++LDFLAGS+=-L${.CURDIR}/../../lib/libnvpair -L${.CURDIR}/../../lib/libumem \
1082 ++ -L${.CURDIR}/../../lib/libzpool -L${.CURDIR}/../../lib/libavl -L/lib -L/usr/lib
1083 +
1084 + .include <bsd.prog.mk>
1085 +diff -ru cddl.orig/usr.bin/Makefile.inc cddl/usr.bin/Makefile.inc
1086 +--- cddl.orig/usr.bin/Makefile.inc 2009-01-10 07:21:10 +0000
1087 ++++ cddl/usr.bin/Makefile.inc 2009-01-10 07:18:55 +0000
1088 +@@ -1,5 +1,6 @@
1089 + # $FreeBSD: src/cddl/usr.bin/Makefile.inc,v 1.1.6.1 2008/11/25 02:59:29 kensmith Exp $
1090 +
1091 + BINDIR?= /usr/bin
1092 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
1093 +
1094 + .include "../Makefile.inc"
1095 +--- cddl.orig/usr.sbin/zdb/Makefile 2010-03-11 13:19:48 +0100
1096 ++++ cddl/usr.sbin/zdb/Makefile 2010-03-11 13:20:08 +0100
1097 +@@ -22,6 +22,8 @@
1098 + DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
1099 + ${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL}
1100 + LDADD= -lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
1101 ++LDFLAGS+=-L${.CURDIR}/../../lib/libnvpair -L${.CURDIR}/../../lib/libumem \
1102 ++ -L${.CURDIR}/../../lib/libzpool -L${.CURDIR}/../../lib/libavl -L${.CURDIR}/../../lib/libuutil -L${.CURDIR}/../../lib/libzfs
1103 +
1104 + CSTD= c99
1105 +
1106 +--- cddl.orig/usr.bin/zinject/Makefile 2010-03-11 13:30:32 +0100
1107 ++++ cddl/usr.bin/zinject/Makefile 2010-03-11 13:33:27 +0100
1108 +@@ -21,5 +21,8 @@
1109 + DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
1110 + ${LIBZFS} ${LIBZPOOL} ${LIBUUTIL}
1111 + LDADD= -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
1112 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl -L${.CURDIR}/../../lib/libnvpair \
1113 ++ -L${.CURDIR}/../../lib/libumem -L${.CURDIR}/../../lib/libuutil \
1114 ++ -L${.CURDIR}/../../lib/libzfs -L${.CURDIR}/../../lib/libzpool
1115 +
1116 + .include <bsd.prog.mk>
1117
1118 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
1119 new file mode 100644
1120 index 0000000..a0e5677
1121 --- /dev/null
1122 +++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-8.2-libpaths.patch
1123 @@ -0,0 +1,22 @@
1124 +--- cddl/usr.sbin/dtrace/Makefile.old 2011-07-06 00:09:01.000000000 +0000
1125 ++++ cddl/usr.sbin/dtrace/Makefile 2011-07-06 00:09:48.000000000 +0000
1126 +@@ -24,6 +24,8 @@
1127 + #CFLAGS+= -DNEED_ERRLOC
1128 + #YFLAGS+= -d
1129 +
1130 ++LDFLAGS+= -L${.CURDIR}/../../lib/libdtrace -L${.CURDIR}/../../lib/libctf
1131 ++
1132 + DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
1133 + ${LIBCTF} ${LIBELF} ${LIBZ} ${LIBUTIL} ${LIBRTLD_DB}
1134 + LDADD= -lpthread -ldtrace -ly -lfl -lproc -lctf -lelf -lz -lutil \
1135 +--- cddl/usr.sbin/lockstat/Makefile.old 2011-07-06 00:10:33.000000000 +0000
1136 ++++ cddl/usr.sbin/lockstat/Makefile 2011-07-06 00:10:57.000000000 +0000
1137 +@@ -23,6 +23,8 @@
1138 +
1139 + CFLAGS+= -DNEED_ERRLOC -g
1140 +
1141 ++LDFLAGS+=-L${.CURDIR}/../../lib/libdtrace -L${.CURDIR}/../../lib/libctf
1142 ++
1143 + #YFLAGS+= -d
1144 +
1145 + DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
1146
1147 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
1148 new file mode 100644
1149 index 0000000..b3d95bb
1150 --- /dev/null
1151 +++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-bsdxml.patch
1152 @@ -0,0 +1,28 @@
1153 +diff -ur cddl.old/sbin/zfs/Makefile cddl/sbin/zfs/Makefile
1154 +--- cddl.old/sbin/zfs/Makefile 2011-11-04 10:01:46.000000000 +0000
1155 ++++ cddl/sbin/zfs/Makefile 2011-11-04 10:07:15.000000000 +0000
1156 +@@ -21,8 +21,8 @@
1157 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
1158 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
1159 +
1160 +-DPADD= ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
1161 ++DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
1162 + ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
1163 +-LDADD= -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
1164 ++LDADD= -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
1165 +
1166 + .include <bsd.prog.mk>
1167 +diff -ur cddl.old/sbin/zpool/Makefile cddl/sbin/zpool/Makefile
1168 +--- cddl.old/sbin/zpool/Makefile 2011-11-04 10:01:46.000000000 +0000
1169 ++++ cddl/sbin/zpool/Makefile 2011-11-04 10:06:38.000000000 +0000
1170 +@@ -26,8 +26,8 @@
1171 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
1172 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
1173 +
1174 +-DPADD= ${LIBAVL} ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
1175 ++DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
1176 + ${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
1177 +-LDADD= -lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
1178 ++LDADD= -lavl -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
1179 +
1180 + .include <bsd.prog.mk>
1181
1182 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
1183 new file mode 100644
1184 index 0000000..c81a2c3
1185 --- /dev/null
1186 +++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-libpaths.patch
1187 @@ -0,0 +1,167 @@
1188 +diff -upNr a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile
1189 +--- a/cddl/lib/libzfs/Makefile 2012-03-30 18:58:53.174771000 +0000
1190 ++++ b/cddl/lib/libzfs/Makefile 2012-03-30 19:04:39.904906253 +0000
1191 +@@ -54,4 +54,8 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/cont
1192 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
1193 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
1194 +
1195 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1196 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1197 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1198 ++
1199 + .include <bsd.lib.mk>
1200 +diff -upNr a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile
1201 +--- a/cddl/lib/libzpool/Makefile 2012-03-30 18:58:53.174771000 +0000
1202 ++++ b/cddl/lib/libzpool/Makefile 2012-03-30 19:04:55.839233753 +0000
1203 +@@ -56,6 +56,10 @@ CFLAGS+= -I${.CURDIR}/../../../lib/libpt
1204 + CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/sys
1205 + CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
1206 +
1207 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1208 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1209 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1210 ++
1211 + DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBZ}
1212 + LDADD= -lmd -lpthread -lz -lumem -lnvpair -lavl
1213 +
1214 +diff -upNr a/cddl/sbin/zfs/Makefile b/cddl/sbin/zfs/Makefile
1215 +--- a/cddl/sbin/zfs/Makefile 2012-03-30 18:58:53.174771000 +0000
1216 ++++ b/cddl/sbin/zfs/Makefile 2012-03-30 19:05:11.094859502 +0000
1217 +@@ -21,6 +21,11 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
1218 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
1219 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
1220 +
1221 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1222 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1223 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1224 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1225 ++
1226 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
1227 + ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
1228 + LDADD= -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
1229 +diff -upNr a/cddl/sbin/zpool/Makefile b/cddl/sbin/zpool/Makefile
1230 +--- a/cddl/sbin/zpool/Makefile 2012-03-30 18:58:53.174771000 +0000
1231 ++++ b/cddl/sbin/zpool/Makefile 2012-03-30 19:05:24.830721002 +0000
1232 +@@ -26,6 +26,12 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
1233 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
1234 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
1235 +
1236 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1237 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1238 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1239 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1240 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1241 ++
1242 + DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
1243 + ${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
1244 + LDADD= -lavl -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
1245 +diff -upNr a/cddl/usr.bin/ctfconvert/Makefile b/cddl/usr.bin/ctfconvert/Makefile
1246 +--- a/cddl/usr.bin/ctfconvert/Makefile 2012-03-30 18:58:53.174771000 +0000
1247 ++++ b/cddl/usr.bin/ctfconvert/Makefile 2012-03-30 19:05:49.454897012 +0000
1248 +@@ -36,6 +36,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
1249 + -I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
1250 + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common
1251 +
1252 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
1253 ++
1254 + DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
1255 + LDADD= -lctf -ldwarf -lelf -lz -lpthread
1256 +
1257 +diff -upNr a/cddl/usr.bin/ctfmerge/Makefile b/cddl/usr.bin/ctfmerge/Makefile
1258 +--- a/cddl/usr.bin/ctfmerge/Makefile 2012-03-30 18:58:53.174771000 +0000
1259 ++++ b/cddl/usr.bin/ctfmerge/Makefile 2012-03-30 19:06:08.084858412 +0000
1260 +@@ -33,6 +33,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
1261 + -I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
1262 + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common
1263 +
1264 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
1265 ++
1266 + DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
1267 + LDADD= -lctf -ldwarf -lelf -lz -lpthread
1268 +
1269 +diff -upNr a/cddl/usr.bin/zinject/Makefile b/cddl/usr.bin/zinject/Makefile
1270 +--- a/cddl/usr.bin/zinject/Makefile 2012-03-30 18:58:53.174771000 +0000
1271 ++++ b/cddl/usr.bin/zinject/Makefile 2012-03-30 19:06:25.084865592 +0000
1272 +@@ -19,6 +19,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
1273 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
1274 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1275 +
1276 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1277 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1278 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1279 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1280 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1281 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1282 ++
1283 + DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
1284 + ${LIBZFS} ${LIBZPOOL}
1285 + LDADD= -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
1286 +diff -upNr a/cddl/usr.bin/zstreamdump/Makefile b/cddl/usr.bin/zstreamdump/Makefile
1287 +--- a/cddl/usr.bin/zstreamdump/Makefile 2012-03-30 18:58:53.174771000 +0000
1288 ++++ b/cddl/usr.bin/zstreamdump/Makefile 2012-03-30 19:06:44.544860132 +0000
1289 +@@ -18,6 +18,11 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
1290 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
1291 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1292 +
1293 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1294 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1295 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1296 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1297 ++
1298 + DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
1299 + ${LIBPTHREAD} ${LIBZ} ${LIBAVL}
1300 + LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
1301 +diff -upNr a/cddl/usr.bin/ztest/Makefile b/cddl/usr.bin/ztest/Makefile
1302 +--- a/cddl/usr.bin/ztest/Makefile 2012-03-30 18:58:53.174771000 +0000
1303 ++++ b/cddl/usr.bin/ztest/Makefile 2012-03-30 19:06:58.344895642 +0000
1304 +@@ -17,6 +17,11 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
1305 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
1306 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1307 +
1308 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1309 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1310 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1311 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1312 ++
1313 + DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
1314 + ${LIBPTHREAD} ${LIBZ} ${LIBAVL}
1315 + LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
1316 +diff -upNr a/cddl/usr.sbin/zdb/Makefile b/cddl/usr.sbin/zdb/Makefile
1317 +--- a/cddl/usr.sbin/zdb/Makefile 2012-03-30 18:58:53.164736000 +0000
1318 ++++ b/cddl/usr.sbin/zdb/Makefile 2012-03-30 19:07:17.454861002 +0000
1319 +@@ -23,6 +23,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/
1320 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
1321 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1322 +
1323 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1324 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1325 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1326 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1327 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1328 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1329 ++
1330 + DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
1331 + ${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL}
1332 + LDADD= -lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
1333 +--- a/cddl/usr.sbin/dtrace/Makefile.old 2011-07-06 00:09:01.000000000 +0000
1334 ++++ b/cddl/usr.sbin/dtrace/Makefile 2011-07-06 00:09:48.000000000 +0000
1335 +@@ -24,6 +24,8 @@
1336 + #CFLAGS+= -DNEED_ERRLOC
1337 + #YFLAGS+= -d
1338 +
1339 ++LDFLAGS+= -L${.CURDIR}/../../lib/libdtrace -L${.CURDIR}/../../lib/libctf
1340 ++
1341 + DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
1342 + ${LIBCTF} ${LIBELF} ${LIBZ} ${LIBUTIL} ${LIBRTLD_DB}
1343 + LDADD= -lpthread -ldtrace -ly -lfl -lproc -lctf -lelf -lz -lutil \
1344 +--- a/cddl/usr.sbin/lockstat/Makefile.old 2011-07-06 00:10:33.000000000 +0000
1345 ++++ b/cddl/usr.sbin/lockstat/Makefile 2011-07-06 00:10:57.000000000 +0000
1346 +@@ -23,6 +23,8 @@
1347 +
1348 + CFLAGS+= -DNEED_ERRLOC -g
1349 +
1350 ++LDFLAGS+=-L${.CURDIR}/../../lib/libdtrace -L${.CURDIR}/../../lib/libctf
1351 ++
1352 + #YFLAGS+= -d
1353 +
1354 + DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
1355
1356 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
1357 new file mode 100644
1358 index 0000000..ff87d2c
1359 --- /dev/null
1360 +++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.0-underlink.patch
1361 @@ -0,0 +1,22 @@
1362 +--- cddl/lib/libzfs/Makefile.old 2011-11-04 10:27:30.000000000 +0000
1363 ++++ cddl/lib/libzfs/Makefile 2011-11-04 10:28:59.000000000 +0000
1364 +@@ -7,7 +7,7 @@
1365 +
1366 + LIB= zfs
1367 + DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL}
1368 +-LDADD= -lmd -lpthread -lumem -lutil
1369 ++LDADD= -lmd -lpthread -lumem -lutil -luutil -lnvpair -lm -lgeom
1370 +
1371 + SRCS= deviceid.c \
1372 + fsshare.c \
1373 +--- cddl/lib/libzpool/Makefile.old 2011-11-04 18:22:28.000000000 +0000
1374 ++++ cddl/lib/libzpool/Makefile 2011-11-04 18:24:01.000000000 +0000
1375 +@@ -57,7 +57,7 @@
1376 + CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
1377 +
1378 + DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBZ}
1379 +-LDADD= -lmd -lpthread -lz
1380 ++LDADD= -lmd -lpthread -lz -lumem -lnvpair -lavl
1381 +
1382 + # atomic.S doesn't like profiling.
1383 + NO_PROFILE=
1384
1385 diff --git a/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.2-libpaths.patch b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.2-libpaths.patch
1386 new file mode 100644
1387 index 0000000..36eb570
1388 --- /dev/null
1389 +++ b/sys-freebsd/freebsd-cddl/files/freebsd-cddl-9.2-libpaths.patch
1390 @@ -0,0 +1,220 @@
1391 +diff --git a/lib/libzfs/Makefile b/lib/libzfs/Makefile
1392 +index 5b6b47d..c8549b4 100644
1393 +--- a/lib/libzfs/Makefile
1394 ++++ b/lib/libzfs/Makefile
1395 +@@ -55,6 +55,11 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
1396 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
1397 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libnvpair
1398 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
1399 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1400 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1401 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1402 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
1403 ++
1404 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
1405 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
1406 +
1407 +diff --git a/lib/libzfs_core/Makefile b/lib/libzfs_core/Makefile
1408 +index a470fbc..ae8c649 100644
1409 +--- a/lib/libzfs_core/Makefile
1410 ++++ b/lib/libzfs_core/Makefile
1411 +@@ -34,4 +34,6 @@ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libuutil/common
1412 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs_core/common
1413 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
1414 +
1415 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1416 ++
1417 + .include <bsd.lib.mk>
1418 +diff --git a/lib/libzpool/Makefile b/lib/libzpool/Makefile
1419 +index 417c1cc..838cdb5 100644
1420 +--- a/lib/libzpool/Makefile
1421 ++++ b/lib/libzpool/Makefile
1422 +@@ -56,6 +56,10 @@ CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/thread
1423 + CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/sys
1424 + CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include
1425 +
1426 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1427 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1428 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1429 ++
1430 + DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBZ}
1431 + LDADD= -lmd -lpthread -lz
1432 +
1433 +diff --git a/sbin/zfs/Makefile b/sbin/zfs/Makefile
1434 +index a49d278..b22442e 100644
1435 +--- a/sbin/zfs/Makefile
1436 ++++ b/sbin/zfs/Makefile
1437 +@@ -22,6 +22,12 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
1438 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
1439 + CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
1440 +
1441 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1442 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1443 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1444 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1445 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
1446 ++
1447 + DPADD= ${LIBGEOM} ${LIBJAIL} ${LIBNVPAIR} ${LIBUMEM} \
1448 + ${LIBUTIL} ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS}
1449 + LDADD= -lgeom -ljail -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
1450 +diff --git a/sbin/zpool/Makefile b/sbin/zpool/Makefile
1451 +index 1884d24..5f06d5f 100644
1452 +--- a/sbin/zpool/Makefile
1453 ++++ b/sbin/zpool/Makefile
1454 +@@ -26,6 +26,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
1455 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
1456 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
1457 +
1458 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1459 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1460 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1461 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1462 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1463 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
1464 ++
1465 + DPADD= ${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \
1466 + ${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS}
1467 + LDADD= -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs_core -lzfs
1468 +diff --git a/usr.bin/ctfconvert/Makefile b/usr.bin/ctfconvert/Makefile
1469 +index 7e4a05a..72327ad 100644
1470 +--- a/usr.bin/ctfconvert/Makefile
1471 ++++ b/usr.bin/ctfconvert/Makefile
1472 +@@ -36,6 +36,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
1473 + -I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
1474 + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common
1475 +
1476 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
1477 ++
1478 + DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
1479 + LDADD= -lctf -ldwarf -lelf -lz -lpthread
1480 +
1481 +diff --git a/usr.bin/ctfmerge/Makefile b/usr.bin/ctfmerge/Makefile
1482 +index ba4840e..845d28c 100644
1483 +--- a/usr.bin/ctfmerge/Makefile
1484 ++++ b/usr.bin/ctfmerge/Makefile
1485 +@@ -33,6 +33,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
1486 + -I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
1487 + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common
1488 +
1489 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
1490 ++
1491 + DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
1492 + LDADD= -lctf -ldwarf -lelf -lz -lpthread
1493 +
1494 +diff --git a/usr.bin/zinject/Makefile b/usr.bin/zinject/Makefile
1495 +index 8c5c141..3db2b29 100644
1496 +--- a/usr.bin/zinject/Makefile
1497 ++++ b/usr.bin/zinject/Makefile
1498 +@@ -19,6 +19,14 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
1499 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
1500 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1501 +
1502 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1503 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1504 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1505 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1506 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1507 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1508 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
1509 ++
1510 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
1511 + ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
1512 + LDADD= -lgeom -lm -lnvpair -lumem -luutil -lzfs_core -lzfs -lzpool
1513 +diff --git a/usr.bin/zstreamdump/Makefile b/usr.bin/zstreamdump/Makefile
1514 +index 304ff7c..5f0b00e 100644
1515 +--- a/usr.bin/zstreamdump/Makefile
1516 ++++ b/usr.bin/zstreamdump/Makefile
1517 +@@ -18,6 +18,11 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
1518 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
1519 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1520 +
1521 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1522 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1523 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1524 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1525 ++
1526 + DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
1527 + ${LIBPTHREAD} ${LIBZ} ${LIBAVL}
1528 + LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
1529 +diff --git a/usr.bin/ztest/Makefile b/usr.bin/ztest/Makefile
1530 +index 965300e..ad40a92 100644
1531 +--- a/usr.bin/ztest/Makefile
1532 ++++ b/usr.bin/ztest/Makefile
1533 +@@ -18,6 +18,14 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
1534 + CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
1535 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1536 +
1537 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1538 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1539 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1540 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1541 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1542 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1543 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
1544 ++
1545 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
1546 + ${LIBPTHREAD} ${LIBAVL} ${LIBZFS_CORE} ${LIBZFS} ${LIBUUTIL}
1547 + LDADD= -lgeom -lm -lnvpair -lumem -lzpool -lpthread -lavl -lzfs_core -lzfs \
1548 +diff --git a/usr.sbin/dtrace/Makefile b/usr.sbin/dtrace/Makefile
1549 +index 3930f01..4bdbd1a 100644
1550 +--- a/usr.sbin/dtrace/Makefile
1551 ++++ b/usr.sbin/dtrace/Makefile
1552 +@@ -25,4 +25,7 @@ DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} \
1553 + LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz -lutil \
1554 + -lrtld_db
1555 +
1556 ++LDFLAGS+= -L${.CURDIR}/../../lib/libdtrace
1557 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
1558 ++
1559 + .include <bsd.prog.mk>
1560 +diff --git a/usr.sbin/lockstat/Makefile b/usr.sbin/lockstat/Makefile
1561 +index 70515ef..d65e4c3 100644
1562 +--- a/usr.sbin/lockstat/Makefile
1563 ++++ b/usr.sbin/lockstat/Makefile
1564 +@@ -20,6 +20,9 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
1565 +
1566 + CFLAGS+= -DNEED_ERRLOC -g
1567 +
1568 ++LDFLAGS+= -L${.CURDIR}/../../lib/libdtrace
1569 ++LDFLAGS+= -L${.CURDIR}/../../lib/libctf
1570 ++
1571 + #YFLAGS+= -d
1572 +
1573 + DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBFL} ${LIBPROC} \
1574 +diff --git a/usr.sbin/zdb/Makefile b/usr.sbin/zdb/Makefile
1575 +index 8068385..337e324 100644
1576 +--- a/usr.sbin/zdb/Makefile
1577 ++++ b/usr.sbin/zdb/Makefile
1578 +@@ -23,6 +23,14 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
1579 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
1580 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1581 +
1582 ++LDFLAGS+= -L${.CURDIR}/../../lib/libavl
1583 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1584 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1585 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1586 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1587 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1588 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
1589 ++
1590 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
1591 + ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
1592 + LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs_core -lzfs -lzpool
1593 +diff --git a/usr.sbin/zhack/Makefile b/usr.sbin/zhack/Makefile
1594 +index f09d2d8..fc3d7a4 100644
1595 +--- a/usr.sbin/zhack/Makefile
1596 ++++ b/usr.sbin/zhack/Makefile
1597 +@@ -22,6 +22,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
1598 + CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
1599 + CFLAGS+= -I${.CURDIR}/../../lib/libumem
1600 +
1601 ++LDFLAGS+= -L${.CURDIR}/../../lib/libnvpair
1602 ++LDFLAGS+= -L${.CURDIR}/../../lib/libumem
1603 ++LDFLAGS+= -L${.CURDIR}/../../lib/libuutil
1604 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs
1605 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzpool
1606 ++LDFLAGS+= -L${.CURDIR}/../../lib/libzfs_core
1607 ++
1608 + DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
1609 + ${LIBUUTIL} ${LIBZFS_CORE} ${LIBZFS} ${LIBZPOOL}
1610 + LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs_core -lzfs -lzpool
1611
1612 diff --git a/sys-freebsd/freebsd-cddl/files/zfs.initd b/sys-freebsd/freebsd-cddl/files/zfs.initd
1613 new file mode 100644
1614 index 0000000..7daf445
1615 --- /dev/null
1616 +++ b/sys-freebsd/freebsd-cddl/files/zfs.initd
1617 @@ -0,0 +1,24 @@
1618 +#!/sbin/openrc-run
1619 +# Copyright 1999-2012 Gentoo Foundation
1620 +# Distributed under the terms of the GNU General Public License v2
1621 +# $Id$
1622 +
1623 +depend() {
1624 + need hostid
1625 + before fsck
1626 +}
1627 +
1628 +start() {
1629 + einfo "Starting zfs ..."
1630 + zfs mount -a
1631 + zfs share -a
1632 + if [ ! -r /etc/zfs/exports ]; then
1633 + touch /etc/zfs/exports
1634 + fi
1635 +}
1636 +
1637 +stop() {
1638 + einfo "Stopping zfs ..."
1639 + zfs unshare -a
1640 + zfs unmount -a
1641 +}
1642
1643 diff --git a/sys-freebsd/freebsd-cddl/files/zvol.initd b/sys-freebsd/freebsd-cddl/files/zvol.initd
1644 new file mode 100644
1645 index 0000000..0f9fcb9
1646 --- /dev/null
1647 +++ b/sys-freebsd/freebsd-cddl/files/zvol.initd
1648 @@ -0,0 +1,47 @@
1649 +#!/sbin/openrc-run
1650 +# Copyright 1999-2011 Gentoo Foundation
1651 +# Distributed under the terms of the GNU General Public License v2
1652 +# $Id$
1653 +
1654 +depend() {
1655 + need hostid
1656 + before fsck
1657 +}
1658 +
1659 +start() {
1660 + einfo "Starting zfs volumes..."
1661 + zfs volinit
1662 + eend $?
1663 + # Enable swap on ZVOLs that have org.freebsd:swap=on.
1664 + zfs list -H -o org.freebsd:swap,name -t volume | \
1665 + while read state name; do
1666 + case "${state}" in
1667 + [oO][nN])
1668 + einfo "Enabling swap on zvol ${name}"
1669 + swapon /dev/zvol/${name}
1670 + eend $?
1671 + ;;
1672 + esac
1673 + done
1674 +}
1675 +
1676 +stop() {
1677 + # Disable what we had enabled before.
1678 + zfs list -H -o org.freebsd:swap,name -t volume | \
1679 + while read state name; do
1680 + case "${state}" in
1681 + [oO][nN])
1682 + einfo "Disabling swap on zvol ${name}"
1683 + swapoff /dev/zvol/${name}
1684 + eend $?
1685 + ;;
1686 + esac
1687 + done
1688 + einfo "Stopping zfs volumes..."
1689 + zfs volfini
1690 + eend $?
1691 +}
1692 +
1693 +restart() {
1694 + :
1695 +}
1696
1697 diff --git a/sys-freebsd/freebsd-cddl/files/zvol.initd-9.0 b/sys-freebsd/freebsd-cddl/files/zvol.initd-9.0
1698 new file mode 100644
1699 index 0000000..bfba28f
1700 --- /dev/null
1701 +++ b/sys-freebsd/freebsd-cddl/files/zvol.initd-9.0
1702 @@ -0,0 +1,45 @@
1703 +#!/sbin/openrc-run
1704 +# Copyright 1999-2012 Gentoo Foundation
1705 +# Distributed under the terms of the GNU General Public License v2
1706 +# $Id$
1707 +
1708 +depend() {
1709 + need hostid
1710 + before fsck
1711 +}
1712 +
1713 +start() {
1714 + einfo "Starting zfs volumes..."
1715 + eend $?
1716 + # Enable swap on ZVOLs that have org.freebsd:swap=on.
1717 + zfs list -H -o org.freebsd:swap,name -t volume | \
1718 + while read state name; do
1719 + case "${state}" in
1720 + [oO][nN])
1721 + einfo "Enabling swap on zvol ${name}"
1722 + swapon /dev/zvol/${name}
1723 + eend $?
1724 + ;;
1725 + esac
1726 + done
1727 +}
1728 +
1729 +stop() {
1730 + # Disable what we had enabled before.
1731 + zfs list -H -o org.freebsd:swap,name -t volume | \
1732 + while read state name; do
1733 + case "${state}" in
1734 + [oO][nN])
1735 + einfo "Disabling swap on zvol ${name}"
1736 + swapoff /dev/zvol/${name}
1737 + eend $?
1738 + ;;
1739 + esac
1740 + done
1741 + einfo "Stopping zfs volumes..."
1742 + eend $?
1743 +}
1744 +
1745 +restart() {
1746 + :
1747 +}
1748
1749 diff --git a/sys-freebsd/freebsd-cddl/freebsd-cddl-11.0.ebuild b/sys-freebsd/freebsd-cddl/freebsd-cddl-11.0.ebuild
1750 new file mode 100644
1751 index 0000000..afc5c8d
1752 --- /dev/null
1753 +++ b/sys-freebsd/freebsd-cddl/freebsd-cddl-11.0.ebuild
1754 @@ -0,0 +1,75 @@
1755 +# Copyright 1999-2016 Gentoo Foundation
1756 +# Distributed under the terms of the GNU General Public License v2
1757 +# $Id$
1758 +
1759 +EAPI=5
1760 +
1761 +inherit bsdmk freebsd toolchain-funcs multilib
1762 +
1763 +DESCRIPTION="FreeBSD CDDL (opensolaris/zfs) extra software"
1764 +SLOT="0"
1765 +
1766 +IUSE="build"
1767 +LICENSE="CDDL GPL-2"
1768 +
1769 +if [[ ${PV} != *9999* ]]; then
1770 + KEYWORDS="~amd64-fbsd ~x86-fbsd"
1771 +fi
1772 +
1773 +# sys is required.
1774 +EXTRACTONLY="
1775 + cddl/
1776 + contrib/
1777 + usr.bin/
1778 + lib/
1779 + sbin/
1780 + sys/
1781 +"
1782 +
1783 +RDEPEND="=sys-freebsd/freebsd-lib-${RV}*
1784 + =sys-freebsd/freebsd-libexec-${RV}*
1785 + build? ( sys-apps/baselayout )"
1786 +
1787 +DEPEND="${RDEPEND}
1788 + =sys-freebsd/freebsd-mk-defs-${RV}*
1789 + !build? ( =sys-freebsd/freebsd-sources-${RV}* )"
1790 +
1791 +S="${WORKDIR}/cddl"
1792 +
1793 +PATCHES=(
1794 + "${FILESDIR}/${PN}-10.2-libpaths.patch"
1795 + "${FILESDIR}/${PN}-10.3-underlink.patch"
1796 + )
1797 +
1798 +pkg_setup() {
1799 + # Add the required source files.
1800 + use build && EXTRACTONLY+="include/ "
1801 +}
1802 +
1803 +src_prepare() {
1804 + if [[ ! -e "${WORKDIR}/include" ]]; then
1805 + # Link in include headers.
1806 + ln -s "/usr/include" "${WORKDIR}/include" || die "Symlinking /usr/include.."
1807 + fi
1808 +}
1809 +
1810 +src_compile() {
1811 + # Disable parallel make.
1812 + freebsd_src_compile -j1
1813 +}
1814 +
1815 +src_install() {
1816 + # Install libraries proper place
1817 + local mylibdir=$(get_libdir)
1818 + mkinstall SHLIBDIR="/usr/${mylibdir}" LIBDIR="/usr/${mylibdir}" || die
1819 +
1820 + gen_usr_ldscript -a avl nvpair umem uutil zfs zpool zfs_core
1821 +
1822 + # Install zfs volinit script.
1823 + newinitd "${FILESDIR}"/zvol.initd-9.0 zvol
1824 +
1825 + # Install zfs script
1826 + newinitd "${FILESDIR}"/zfs.initd zfs
1827 +
1828 + keepdir /etc/zfs
1829 +}
1830
1831 diff --git a/sys-freebsd/freebsd-cddl/metadata.xml b/sys-freebsd/freebsd-cddl/metadata.xml
1832 new file mode 100644
1833 index 0000000..a00f3ae
1834 --- /dev/null
1835 +++ b/sys-freebsd/freebsd-cddl/metadata.xml
1836 @@ -0,0 +1,8 @@
1837 +<?xml version="1.0" encoding="UTF-8"?>
1838 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
1839 +<pkgmetadata>
1840 +<maintainer type="project">
1841 + <email>bsd@g.o</email>
1842 + <name>BSD Project</name>
1843 +</maintainer>
1844 +</pkgmetadata>
1845
1846 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
1847 new file mode 100644
1848 index 0000000..42b64b5
1849 --- /dev/null
1850 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch
1851 @@ -0,0 +1,49 @@
1852 +diff --git a/lib/atf/Makefile.inc b/lib/atf/Makefile.inc
1853 +index 937187a..d5277f3 100644
1854 +--- a/lib/atf/Makefile.inc
1855 ++++ b/lib/atf/Makefile.inc
1856 +@@ -49,6 +49,24 @@ CFLAGS+= -DATF_PKGDATADIR='"${SHAREDIR}/atf"'
1857 + CFLAGS+= -DATF_SHELL='"/bin/sh"'
1858 + CFLAGS+= -DATF_WORKDIR='"/tmp"'
1859 +
1860 ++CXXFLAGS+= -DHAVE_CONFIG_H
1861 ++CXXFLAGS+= -DATF_ARCH='"${MACHINE}"'
1862 ++CXXFLAGS+= -DATF_BUILD_CC='"${CC}"'
1863 ++CXXFLAGS+= -DATF_BUILD_CXXFLAGS='"${_CXXFLAGS}"'
1864 ++CXXFLAGS+= -DATF_BUILD_CPP='"${CPP}"'
1865 ++CXXFLAGS+= -DATF_BUILD_CPPFLAGS='"${_CPPFLAGS}"'
1866 ++CXXFLAGS+= -DATF_BUILD_CXX='"${CXX}"'
1867 ++CXXFLAGS+= -DATF_BUILD_CXXFLAGS='"${_CXXFLAGS}"'
1868 ++CXXFLAGS+= -DATF_CONFDIR='"${CONFDIR}/atf"'
1869 ++CXXFLAGS+= -DATF_INCLUDEDIR='"${INCLUDEDIR}"'
1870 ++CXXFLAGS+= -DATF_LIBDIR='"${LIBDIR}"'
1871 ++CXXFLAGS+= -DATF_LIBEXECDIR='"${LIBEXECDIR}"'
1872 ++CXXFLAGS+= -DATF_MACHINE='"${MACHINE_ARCH}"'
1873 ++CXXFLAGS+= -DATF_M4='"/usr/bin/m4"'
1874 ++CXXFLAGS+= -DATF_PKGDATADIR='"${SHAREDIR}/atf"'
1875 ++CXXFLAGS+= -DATF_SHELL='"/bin/sh"'
1876 ++CXXFLAGS+= -DATF_WORKDIR='"/tmp"'
1877 ++
1878 + WARNS?= 3
1879 +
1880 + # vim: syntax=make
1881 +diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile
1882 +index 37d6073..90a2687 100644
1883 +--- a/lib/atf/libatf-c++/Makefile
1884 ++++ b/lib/atf/libatf-c++/Makefile
1885 +@@ -40,11 +40,11 @@ LDFLAGS+= -L${.OBJDIR}/../libatf-c
1886 + .PATH: ${ATF}/atf-c++
1887 + .PATH: ${ATF}/atf-c++/detail
1888 +
1889 +-CFLAGS+= -I${ATF}
1890 +-CFLAGS+= -I${.CURDIR}/../libatf-c
1891 +-CFLAGS+= -I.
1892 ++CXXFLAGS+= -I${ATF}
1893 ++CXXFLAGS+= -I${.CURDIR}/../libatf-c
1894 ++CXXFLAGS+= -I.
1895 +
1896 +-CFLAGS+= -DHAVE_CONFIG_H
1897 ++CXXFLAGS+= -DHAVE_CONFIG_H
1898 +
1899 + SRCS= application.cpp \
1900 + build.cpp \
1901
1902 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
1903 new file mode 100644
1904 index 0000000..6ef3f07
1905 --- /dev/null
1906 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch
1907 @@ -0,0 +1,98 @@
1908 +diff --git a/lib/libcam/Makefile b/lib/libcam/Makefile
1909 +index 9a21dde..0815f0a 100644
1910 +--- a/lib/libcam/Makefile
1911 ++++ b/lib/libcam/Makefile
1912 +@@ -8,6 +8,7 @@ INCS= camlib.h
1913 +
1914 + DPADD= ${LIBSBUF}
1915 + LDADD= -lsbuf
1916 ++LDFLAGS+= -L${.OBJDIR}/../libsbuf
1917 +
1918 + MAN= cam.3 cam_cdbparse.3
1919 +
1920 +diff --git a/lib/libdwarf/Makefile b/lib/libdwarf/Makefile
1921 +index dbd7895..607b1f6 100644
1922 +--- a/lib/libdwarf/Makefile
1923 ++++ b/lib/libdwarf/Makefile
1924 +@@ -21,6 +21,7 @@ SRCS= \
1925 + INCS= dwarf.h libdwarf.h
1926 +
1927 + CFLAGS+= -I${.CURDIR}
1928 ++CFLAGS+= -I${.CURDIR}/../libelf
1929 +
1930 + SHLIB_MAJOR= 3
1931 +
1932 +diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
1933 +index 4449c06..f024cf0 100644
1934 +--- a/lib/libproc/Makefile
1935 ++++ b/lib/libproc/Makefile
1936 +@@ -14,6 +14,7 @@ SRCS= proc_bkpt.c \
1937 + INCS= libproc.h
1938 +
1939 + CFLAGS+= -I${.CURDIR}
1940 ++CFLAGS+= -I${.CURDIR}/../libelf
1941 +
1942 + .if ${MK_LIBCPLUSPLUS} != "no"
1943 + LDADD+= -lcxxrt
1944 +@@ -27,4 +28,7 @@ SHLIB_MAJOR= 2
1945 +
1946 + WITHOUT_MAN=
1947 +
1948 ++LDADD+= -lelf
1949 ++LDFLAGS+= -L${.OBJDIR}/../libelf
1950 ++
1951 + .include <bsd.lib.mk>
1952 +diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile
1953 +index af5a775..c01aa05 100644
1954 +--- a/lib/libprocstat/Makefile
1955 ++++ b/lib/libprocstat/Makefile
1956 +@@ -16,6 +16,8 @@ VERSION_DEF= ${.CURDIR}/Versions.def
1957 + SYMBOL_MAPS= ${.CURDIR}/Symbol.map
1958 +
1959 + INCS= libprocstat.h
1960 ++CFLAGS+= -I${.CURDIR}/../libelf
1961 ++LDFLAGS+= -L${.OBJDIR}/../libelf
1962 + CFLAGS+= -I. -I${.CURDIR} -D_KVM_VNODE
1963 + SHLIB_MAJOR= 1
1964 +
1965 +diff --git a/lib/librtld_db/Makefile b/lib/librtld_db/Makefile
1966 +index 2815a07..e992662 100644
1967 +--- a/lib/librtld_db/Makefile
1968 ++++ b/lib/librtld_db/Makefile
1969 +@@ -10,5 +10,8 @@ SRCS= rtld_db.c
1970 + INCS= rtld_db.h
1971 +
1972 + CFLAGS+= -I${.CURDIR}
1973 ++CFLAGS+= -I${.CURDIR}/../libelf
1974 ++LDADD+= -lutil -lproc
1975 ++LDFLAGS+= -L${.OBJDIR}/../libutil -L${.OBJDIR}/../libproc
1976 +
1977 + .include <bsd.lib.mk>
1978 +diff --git a/lib/libtelnet/Makefile b/lib/libtelnet/Makefile
1979 +index 1cf52a0..3d25fae 100644
1980 +--- a/lib/libtelnet/Makefile
1981 ++++ b/lib/libtelnet/Makefile
1982 +@@ -13,6 +13,8 @@ INTERNALLIB=
1983 + SRCS= genget.c getent.c misc.c
1984 + CFLAGS+= -I${TELNETDIR}
1985 +
1986 ++CFLAGS+= -I${.CURDIR}/../libmp
1987 ++
1988 + WARNS?= 2
1989 +
1990 + .if !defined(RELEASE_CRUNCH)
1991 +diff --git a/lib/libexecinfo/Makefile b/lib/libexecinfo/Makefile
1992 +index 30a1dfb..9f8a99c 100644
1993 +--- a/lib/libexecinfo/Makefile
1994 ++++ b/lib/libexecinfo/Makefile
1995 +@@ -10,8 +10,10 @@ SHLIB_MAJOR= 1
1996 + INCS= execinfo.h
1997 + SRCS= backtrace.c symtab.c unwind.c
1998 +
1999 ++CFLAGS+= -I${.CURDIR}/../libelf
2000 + DPADD= ${LIBELF}
2001 + LDADD= -lelf
2002 ++LDFLAGS+= -L${.OBJDIR}/../libelf
2003 +
2004 + MAN= backtrace.3
2005 +
2006
2007 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
2008 new file mode 100644
2009 index 0000000..55987aa
2010 --- /dev/null
2011 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch
2012 @@ -0,0 +1,16 @@
2013 +diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
2014 +index f9e01ab..15b27d8 100644
2015 +--- a/lib/libproc/Makefile
2016 ++++ b/lib/libproc/Makefile
2017 +@@ -15,7 +15,10 @@ INCS= libproc.h
2018 +
2019 + CFLAGS+= -I${.CURDIR}
2020 +
2021 +-.if ${MK_LIBCPLUSPLUS} != "no"
2022 ++.if ${CXX:T:M*-stdlib=libc++*}
2023 ++LDADD+= -lcxxrt
2024 ++DPADD+= ${LIBCXXRT}
2025 ++.elif ${CXXFLAGS:T:M*-stdlib=libc++*}
2026 + LDADD+= -lcxxrt
2027 + DPADD+= ${LIBCXXRT}
2028 + .else
2029
2030 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
2031 new file mode 100644
2032 index 0000000..2968252
2033 --- /dev/null
2034 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libusb.patch
2035 @@ -0,0 +1,19 @@
2036 +diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile
2037 +index 21016a9..26010e8 100644
2038 +--- a/lib/libusb/Makefile
2039 ++++ b/lib/libusb/Makefile
2040 +@@ -40,11 +40,11 @@ CFLAGS+= -DCOMPAT_32BIT
2041 +
2042 + beforeinstall:
2043 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
2044 +- ${.CURDIR}/libusb-0.1.pc ${DESTDIR}${LIBDATADIR}/pkgconfig
2045 ++ ${.CURDIR}/libusb-0.1.pc ${DESTDIR}${LIBDIR}/pkgconfig
2046 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
2047 +- ${.CURDIR}/libusb-1.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig
2048 ++ ${.CURDIR}/libusb-1.0.pc ${DESTDIR}${LIBDIR}/pkgconfig
2049 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
2050 +- ${.CURDIR}/libusb-2.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig
2051 ++ ${.CURDIR}/libusb-2.0.pc ${DESTDIR}${LIBDIR}/pkgconfig
2052 +
2053 + #
2054 + # Cross platform support
2055
2056 diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-bsdxml2expat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-bsdxml2expat.patch
2057 new file mode 100644
2058 index 0000000..303f422
2059 --- /dev/null
2060 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-bsdxml2expat.patch
2061 @@ -0,0 +1,39 @@
2062 +diff --git a/lib/libgeom/Makefile b/lib/libgeom/Makefile
2063 +index bbfb57b..a7c17e3 100644
2064 +--- a/lib/libgeom/Makefile
2065 ++++ b/lib/libgeom/Makefile
2066 +@@ -13,7 +13,7 @@ CFLAGS += -I${.CURDIR}
2067 +
2068 + WARNS?= 3
2069 +
2070 +-DPADD= ${LIBBSDXML} ${LIBSBUF}
2071 ++DPADD= ${LIBSBUF}
2072 + LDADD= -lbsdxml -lsbuf
2073 +
2074 + MAN= libgeom.3
2075 +diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c
2076 +index 9dedb8e..d96420c 100644
2077 +--- a/lib/libgeom/geom_xml2tree.c
2078 ++++ b/lib/libgeom/geom_xml2tree.c
2079 +@@ -43,7 +43,7 @@
2080 + #include <sys/sbuf.h>
2081 + #include <sys/sysctl.h>
2082 + #include <err.h>
2083 +-#include <bsdxml.h>
2084 ++#include <expat.h>
2085 + #include <libgeom.h>
2086 +
2087 + struct mystate {
2088 +diff --git a/lib/libmt/mtlib.c b/lib/libmt/mtlib.c
2089 +index d1fc0b1..89ac55e 100644
2090 +--- a/lib/libmt/mtlib.c
2091 ++++ b/lib/libmt/mtlib.c
2092 +@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD: stable/10/lib/libmt/mtlib.c 280438 2015-03-24 14:36:10Z ken
2093 + #include <unistd.h>
2094 + #include <stdint.h>
2095 + #include <errno.h>
2096 +-#include <bsdxml.h>
2097 ++#include <expat.h>
2098 + #include <mtlib.h>
2099 +
2100 + /*
2101
2102 diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-liblink.patch
2103 new file mode 100644
2104 index 0000000..b08d95f
2105 --- /dev/null
2106 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-liblink.patch
2107 @@ -0,0 +1,26 @@
2108 +diff --git a/lib/libmt/Makefile b/lib/libmt/Makefile
2109 +index cb1da71..43de5a5 100644
2110 +--- a/lib/libmt/Makefile
2111 ++++ b/lib/libmt/Makefile
2112 +@@ -5,6 +5,7 @@ SHLIBDIR?= /lib
2113 + SRCS= mtlib.c
2114 + INCS= mtlib.h
2115 +
2116 ++CFLAGS+= -I${.CURDIR}
2117 + DPADD= ${LIBSBUF}
2118 + LDADD= -lsbuf
2119 +
2120 +diff --git a/lib/libdpv/Makefile b/lib/libdpv/Makefile
2121 +index e9384b7..085ef62 100644
2122 +--- a/lib/libdpv/Makefile
2123 ++++ b/lib/libdpv/Makefile
2124 +@@ -11,7 +11,8 @@ LDADD= -ldialog -lfigpar -lncursesw -lutil
2125 +
2126 + SRCS= dialog_util.c dialogrc.c dprompt.c dpv.c status.c util.c
2127 +
2128 +-CFLAGS+= -I${.CURDIR}
2129 ++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libfigpar
2130 ++LDFLAGS+= -L${.OBJDIR}/../libfigpar
2131 +
2132 + WARNS?= 6
2133 +
2134
2135 diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.3-libusb.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.3-libusb.patch
2136 new file mode 100644
2137 index 0000000..813a42b
2138 --- /dev/null
2139 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.3-libusb.patch
2140 @@ -0,0 +1,13 @@
2141 +diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile
2142 +index 88ec3fe..076b8d4 100644
2143 +--- a/lib/libusb/Makefile
2144 ++++ b/lib/libusb/Makefile
2145 +@@ -38,7 +38,7 @@ SRCS+= libusb10_io.c
2146 + CFLAGS+= -DCOMPAT_32BIT
2147 + .else
2148 + FILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc
2149 +-FILESDIR= ${LIBDATADIR}/pkgconfig
2150 ++FILESDIR= ${LIBDIR}/pkgconfig
2151 + .endif
2152 +
2153 + #
2154
2155 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
2156 new file mode 100644
2157 index 0000000..00de8a6
2158 --- /dev/null
2159 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch
2160 @@ -0,0 +1,13 @@
2161 +Index: fbsd-6/lib/libipsec/policy_token.l
2162 +===================================================================
2163 +--- fbsd-6.orig/lib/libipsec/policy_token.l
2164 ++++ fbsd-6/lib/libipsec/policy_token.l
2165 +@@ -138,8 +138,6 @@ void
2166 + __policy__strbuffer__init__(msg)
2167 + char *msg;
2168 + {
2169 +- if (yy_current_buffer)
2170 +- yy_delete_buffer(yy_current_buffer);
2171 + strbuffer = (YY_BUFFER_STATE)yy_scan_string(msg);
2172 + yy_switch_to_buffer(strbuffer);
2173 +
2174
2175 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
2176 new file mode 100644
2177 index 0000000..a3e7d5e
2178 --- /dev/null
2179 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch
2180 @@ -0,0 +1,16 @@
2181 +This patch is needed to avoid inclusion of GCC's float.h that defines
2182 +LDBL_MANT_DIG at 53 (while the source file checks for 113 or 64.
2183 +
2184 +Index: freebsd-6.0_beta4/lib/msun/src/s_fmal.c
2185 +===================================================================
2186 +--- freebsd-6.0_beta4.orig/lib/msun/src/s_fmal.c
2187 ++++ freebsd-6.0_beta4/lib/msun/src/s_fmal.c
2188 +@@ -28,7 +28,7 @@
2189 + __FBSDID("$FreeBSD: src/lib/msun/src/s_fmal.c,v 1.2 2005/03/18 02:27:59 das Exp $");
2190 +
2191 + #include <fenv.h>
2192 +-#include <float.h>
2193 ++#include <machine/float.h>
2194 + #include <math.h>
2195 +
2196 + /*
2197
2198 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
2199 new file mode 100644
2200 index 0000000..2f6de46
2201 --- /dev/null
2202 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch
2203 @@ -0,0 +1,13 @@
2204 +Index: freebsd-6.0_beta4/lib/libpmc/Makefile
2205 +===================================================================
2206 +--- freebsd-6.0_beta4.orig/lib/libpmc/Makefile
2207 ++++ freebsd-6.0_beta4/lib/libpmc/Makefile
2208 +@@ -9,6 +9,8 @@ WARNS?= 6
2209 +
2210 + MAN= pmc.3 pmclog.3
2211 +
2212 ++CFLAGS+= -I${.CURDIR}
2213 ++
2214 + MLINKS+= \
2215 + pmc.3 pmc_allocate.3 \
2216 + pmc.3 pmc_attach.3 \
2217
2218 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
2219 new file mode 100644
2220 index 0000000..075f278
2221 --- /dev/null
2222 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch
2223 @@ -0,0 +1,20 @@
2224 +--- lib/csu/amd64/Makefile.orig 2006-07-04 07:49:58 -0300
2225 ++++ lib/csu/amd64/Makefile 2006-07-04 07:50:15 -0300
2226 +@@ -16,6 +16,7 @@
2227 + ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
2228 +
2229 + realinstall:
2230 ++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
2231 + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
2232 + ${OBJS} ${DESTDIR}${LIBDIR}
2233 +
2234 +--- lib/csu/sparc64/Makefile.orig 2006-10-06 15:13:55 +0100
2235 ++++ lib/csu/sparc64/Makefile 2006-10-06 15:15:06 +0100
2236 +@@ -15,6 +15,7 @@
2237 + ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC}
2238 +
2239 + realinstall:
2240 ++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
2241 + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
2242 + ${OBJS} ${DESTDIR}${LIBDIR}
2243 +
2244
2245 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
2246 new file mode 100644
2247 index 0000000..a9b8435
2248 --- /dev/null
2249 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch
2250 @@ -0,0 +1,11 @@
2251 +--- lib/libsdp/Makefile 2007-06-15 12:04:37 +0200
2252 ++++ lib.sdp/libsdp/Makefile 2007-06-15 12:26:14 +0200
2253 +@@ -5,7 +5,7 @@
2254 + MAN= sdp.3
2255 +
2256 + WARNS?= 2
2257 +-CFLAGS+= -I${.CURDIR}
2258 ++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libbluetooth
2259 +
2260 + SHLIB_MAJOR= 2
2261 +
2262
2263 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
2264 new file mode 100644
2265 index 0000000..8de5df2
2266 --- /dev/null
2267 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch
2268 @@ -0,0 +1,15 @@
2269 +Fixes a compile error if XOPEN_SOURCE 600 is defined.
2270 +
2271 +See: http://www.mailinglistarchive.com/freebsd-current@×××××××.org/msg15011.html
2272 +
2273 +--- sys/sys/types.h.orig
2274 ++++ sys/sys/types.h
2275 +@@ -46,7 +46,7 @@
2276 +
2277 + #include <sys/_pthreadtypes.h>
2278 +
2279 +-#if __BSD_VISIBLE
2280 ++#ifndef _POSIX_SOURCE
2281 + typedef unsigned char u_char;
2282 + typedef unsigned short u_short;
2283 + typedef unsigned int u_int;
2284
2285 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
2286 new file mode 100644
2287 index 0000000..2ddb9ea
2288 --- /dev/null
2289 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch
2290 @@ -0,0 +1,28 @@
2291 +diff -Nur work.orig/include/rpcsvc/nis.x work/include/rpcsvc/nis.x
2292 +--- work.orig/include/rpcsvc/nis.x 2009-10-25 10:10:29.000000000 +0900
2293 ++++ work/include/rpcsvc/nis.x 2011-04-13 21:25:13.000000000 +0900
2294 +@@ -399,10 +399,7 @@
2295 + %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
2296 + %#define WORLD_DEFAULT (NIS_READ_ACC)
2297 + %#define GROUP_DEFAULT (NIS_READ_ACC << 8)
2298 +-%#define OWNER_DEFAULT ((NIS_READ_ACC +\
2299 +- NIS_MODIFY_ACC +\
2300 +- NIS_CREATE_ACC +\
2301 +- NIS_DESTROY_ACC) << 16)
2302 ++%#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16)
2303 + %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
2304 + %
2305 + %/* Result manipulation defines ... */
2306 +@@ -431,10 +428,8 @@
2307 + % * these definitions they take an nis_object *, and an int and return
2308 + % * a u_char * for Value, and an int for length.
2309 + % */
2310 +-%#define ENTRY_VAL(obj, col) \
2311 +- (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
2312 +-%#define ENTRY_LEN(obj, col) \
2313 +- (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
2314 ++%#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
2315 ++%#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
2316 + %
2317 + %#ifdef __cplusplus
2318 + %}
2319
2320 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
2321 new file mode 100644
2322 index 0000000..a9fd189
2323 --- /dev/null
2324 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch
2325 @@ -0,0 +1,21 @@
2326 +log2 and log2f are required by C99 and are not implemented.
2327 +Workaround the deficiency.
2328 +
2329 +--- lib/msun/src/math.h.old 2010-03-14 17:02:25.000000000 +0100
2330 ++++ lib/msun/src/math.h 2010-03-14 17:07:03.000000000 +0100
2331 +@@ -203,6 +203,7 @@
2332 + double frexp(double, int *); /* fundamentally !__pure2 */
2333 + double ldexp(double, int);
2334 + double log(double);
2335 ++#define log2(x) log(x)/log(2.0)
2336 + double log10(double);
2337 + double modf(double, double *); /* fundamentally !__pure2 */
2338 +
2339 +@@ -319,6 +320,7 @@
2340 + float log10f(float);
2341 + float log1pf(float);
2342 + float logf(float);
2343 ++#define log2f(x) logf(x)/logf(2.0)
2344 + float modff(float, float *); /* fundamentally !__pure2 */
2345 +
2346 + float powf(float, float);
2347
2348 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
2349 new file mode 100644
2350 index 0000000..a7de06f
2351 --- /dev/null
2352 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch
2353 @@ -0,0 +1,12 @@
2354 +Without this linking fails during a stage3 build.
2355 +
2356 +--- lib/librpcsec_gss/Makefile.orig
2357 ++++ lib/librpcsec_gss/Makefile
2358 +@@ -8,6 +8,7 @@
2359 +
2360 + DPADD+= ${LIBGSSAPI}
2361 + LDADD+= -lgssapi
2362 ++LDFLAGS+= -L${.OBJDIR}/../libgssapi
2363 +
2364 + VERSION_DEF= ${.CURDIR}/../libc/Versions.def
2365 + SYMBOL_MAPS= ${.CURDIR}/Symbol.map
2366
2367 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
2368 new file mode 100644
2369 index 0000000..c8be7f4
2370 --- /dev/null
2371 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch
2372 @@ -0,0 +1,19 @@
2373 +--- lib/libproc/Makefile.old 2011-07-06 00:58:04.000000000 +0000
2374 ++++ lib/libproc/Makefile 2011-07-06 00:58:58.000000000 +0000
2375 +@@ -18,5 +18,6 @@
2376 + WARNS?= 6
2377 +
2378 + WITHOUT_MAN= yes
2379 ++LDADD=-lelf
2380 +
2381 + .include <bsd.lib.mk>
2382 +--- lib/librtld_db/Makefile.old 2011-07-06 00:58:12.000000000 +0000
2383 ++++ lib/librtld_db/Makefile 2011-07-06 00:59:27.000000000 +0000
2384 +@@ -10,5 +10,7 @@
2385 + INCS= rtld_db.h
2386 +
2387 + CFLAGS+= -I${.CURDIR}
2388 ++LDADD=-lutil -lproc
2389 ++LDFLAGS+=-L${.CURDIR}/../libutil -L${.CURDIR}/../libproc
2390 +
2391 + .include <bsd.lib.mk>
2392
2393 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
2394 new file mode 100644
2395 index 0000000..556ade5
2396 --- /dev/null
2397 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch
2398 @@ -0,0 +1,10 @@
2399 +--- include/unistd.h 2010/12/20 20:39:49 216602
2400 ++++ include/unistd.h 2010/12/20 21:12:18 216603
2401 +@@ -529,6 +529,7 @@
2402 + #define _MKTEMP_DECLARED
2403 + #endif
2404 + int nfssvc(int, void *);
2405 ++int nlm_syscall(int, int, int, char **);
2406 + int profil(char *, size_t, vm_offset_t, int);
2407 + int rcmd(char **, int, const char *, const char *, const char *, int *);
2408 + int rcmd_af(char **, int, const char *,
2409
2410 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
2411 new file mode 100644
2412 index 0000000..cf1172a
2413 --- /dev/null
2414 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch
2415 @@ -0,0 +1,12 @@
2416 +diff -Nur lib.orig/libsdp/Makefile lib/libsdp/Makefile
2417 +--- lib.orig/libsdp/Makefile 2012-12-25 20:28:50.000000000 +0900
2418 ++++ lib/libsdp/Makefile 2012-12-25 20:31:19.000000000 +0900
2419 +@@ -5,7 +5,7 @@
2420 + MAN= sdp.3
2421 +
2422 + WARNS?= 2
2423 +-CFLAGS+= -I${.CURDIR}
2424 ++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libbluetooth
2425 +
2426 + SHLIB_MAJOR= 4
2427 +
2428
2429 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
2430 new file mode 100644
2431 index 0000000..ad9b960
2432 --- /dev/null
2433 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch
2434 @@ -0,0 +1,215 @@
2435 +Index: lib/libc/gen/glob.c
2436 +===================================================================
2437 +--- lib/libc/gen/glob.c (revision 246357)
2438 ++++ lib/libc/gen/glob.c (working copy)
2439 +@@ -94,6 +94,25 @@ __FBSDID("$FreeBSD$");
2440 +
2441 + #include "collate.h"
2442 +
2443 ++/*
2444 ++ * glob(3) expansion limits. Stop the expansion if any of these limits
2445 ++ * is reached. This caps the runtime in the face of DoS attacks. See
2446 ++ * also CVE-2010-2632
2447 ++ */
2448 ++#define GLOB_LIMIT_BRACE 128 /* number of brace calls */
2449 ++#define GLOB_LIMIT_PATH 65536 /* number of path elements */
2450 ++#define GLOB_LIMIT_READDIR 16384 /* number of readdirs */
2451 ++#define GLOB_LIMIT_STAT 1024 /* number of stat system calls */
2452 ++#define GLOB_LIMIT_STRING ARG_MAX /* maximum total size for paths */
2453 ++
2454 ++struct glob_limit {
2455 ++ size_t l_brace_cnt;
2456 ++ size_t l_path_lim;
2457 ++ size_t l_readdir_cnt;
2458 ++ size_t l_stat_cnt;
2459 ++ size_t l_string_cnt;
2460 ++};
2461 ++
2462 + #define DOLLAR '$'
2463 + #define DOT '.'
2464 + #define EOS '\0'
2465 +@@ -153,15 +172,18 @@ static const Char *g_strchr(const Char *, wchar_t)
2466 + static Char *g_strcat(Char *, const Char *);
2467 + #endif
2468 + static int g_stat(Char *, struct stat *, glob_t *);
2469 +-static int glob0(const Char *, glob_t *, size_t *);
2470 +-static int glob1(Char *, glob_t *, size_t *);
2471 +-static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
2472 +-static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
2473 +-static int globextend(const Char *, glob_t *, size_t *);
2474 +-static const Char *
2475 ++static int glob0(const Char *, glob_t *, struct glob_limit *);
2476 ++static int glob1(Char *, glob_t *, struct glob_limit *);
2477 ++static int glob2(Char *, Char *, Char *, Char *, glob_t *,
2478 ++ struct glob_limit *);
2479 ++static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *,
2480 ++ struct glob_limit *);
2481 ++static int globextend(const Char *, glob_t *, struct glob_limit *);
2482 ++static const Char *
2483 + globtilde(const Char *, Char *, size_t, glob_t *);
2484 +-static int globexp1(const Char *, glob_t *, size_t *);
2485 +-static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
2486 ++static int globexp1(const Char *, glob_t *, struct glob_limit *);
2487 ++static int globexp2(const Char *, const Char *, glob_t *, int *,
2488 ++ struct glob_limit *);
2489 + static int match(Char *, Char *, Char *);
2490 + #ifdef DEBUG
2491 + static void qprintf(const char *, Char *);
2492 +@@ -171,8 +193,8 @@ int
2493 + glob(const char * __restrict pattern, int flags,
2494 + int (*errfunc)(const char *, int), glob_t * __restrict pglob)
2495 + {
2496 ++ struct glob_limit limit = { 0, 0, 0, 0, 0 };
2497 + const char *patnext;
2498 +- size_t limit;
2499 + Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot;
2500 + mbstate_t mbs;
2501 + wchar_t wc;
2502 +@@ -186,11 +208,10 @@ glob(const char * __restrict pattern, int flags,
2503 + pglob->gl_offs = 0;
2504 + }
2505 + if (flags & GLOB_LIMIT) {
2506 +- limit = pglob->gl_matchc;
2507 +- if (limit == 0)
2508 +- limit = ARG_MAX;
2509 +- } else
2510 +- limit = 0;
2511 ++ limit.l_path_lim = pglob->gl_matchc;
2512 ++ if (limit.l_path_lim == 0)
2513 ++ limit.l_path_lim = GLOB_LIMIT_PATH;
2514 ++ }
2515 + pglob->gl_flags = flags & ~GLOB_MAGCHAR;
2516 + pglob->gl_errfunc = errfunc;
2517 + pglob->gl_matchc = 0;
2518 +@@ -243,11 +264,17 @@ glob(const char * __restrict pattern, int flags,
2519 + * characters
2520 + */
2521 + static int
2522 +-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
2523 ++globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
2524 + {
2525 + const Char* ptr = pattern;
2526 + int rv;
2527 +
2528 ++ if ((pglob->gl_flags & GLOB_LIMIT) &&
2529 ++ limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) {
2530 ++ errno = 0;
2531 ++ return (GLOB_NOSPACE);
2532 ++ }
2533 ++
2534 + /* Protect a single {}, for find(1), like csh */
2535 + if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
2536 + return glob0(pattern, pglob, limit);
2537 +@@ -266,7 +293,8 @@ static int
2538 + * If it fails then it tries to glob the rest of the pattern and returns.
2539 + */
2540 + static int
2541 +-globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit)
2542 ++globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
2543 ++ struct glob_limit *limit)
2544 + {
2545 + int i;
2546 + Char *lm, *ls;
2547 +@@ -436,7 +464,7 @@ globtilde(const Char *pattern, Char *patbuf, size_
2548 + * if things went well, nonzero if errors occurred.
2549 + */
2550 + static int
2551 +-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
2552 ++glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
2553 + {
2554 + const Char *qpatnext;
2555 + int err;
2556 +@@ -529,7 +557,7 @@ compare(const void *p, const void *q)
2557 + }
2558 +
2559 + static int
2560 +-glob1(Char *pattern, glob_t *pglob, size_t *limit)
2561 ++glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit)
2562 + {
2563 + Char pathbuf[MAXPATHLEN];
2564 +
2565 +@@ -547,7 +575,7 @@ static int
2566 + */
2567 + static int
2568 + glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
2569 +- glob_t *pglob, size_t *limit)
2570 ++ glob_t *pglob, struct glob_limit *limit)
2571 + {
2572 + struct stat sb;
2573 + Char *p, *q;
2574 +@@ -563,6 +591,15 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_
2575 + if (g_lstat(pathbuf, &sb, pglob))
2576 + return(0);
2577 +
2578 ++ if ((pglob->gl_flags & GLOB_LIMIT) &&
2579 ++ limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) {
2580 ++ errno = 0;
2581 ++ if (pathend + 1 > pathend_last)
2582 ++ return (GLOB_ABORTED);
2583 ++ *pathend++ = SEP;
2584 ++ *pathend = EOS;
2585 ++ return (GLOB_NOSPACE);
2586 ++ }
2587 + if (((pglob->gl_flags & GLOB_MARK) &&
2588 + pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
2589 + || (S_ISLNK(sb.st_mode) &&
2590 +@@ -606,7 +643,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_
2591 + static int
2592 + glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
2593 + Char *pattern, Char *restpattern,
2594 +- glob_t *pglob, size_t *limit)
2595 ++ glob_t *pglob, struct glob_limit *limit)
2596 + {
2597 + struct dirent *dp;
2598 + DIR *dirp;
2599 +@@ -652,6 +689,19 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_
2600 + size_t clen;
2601 + mbstate_t mbs;
2602 +
2603 ++ if ((pglob->gl_flags & GLOB_LIMIT) &&
2604 ++ limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) {
2605 ++ errno = 0;
2606 ++ if (pathend + 1 > pathend_last)
2607 ++ err = GLOB_ABORTED;
2608 ++ else {
2609 ++ *pathend++ = SEP;
2610 ++ *pathend = EOS;
2611 ++ err = GLOB_NOSPACE;
2612 ++ }
2613 ++ break;
2614 ++ }
2615 ++
2616 + /* Initial DOT must be matched literally. */
2617 + if (dp->d_name[0] == DOT && *pattern != DOT)
2618 + continue;
2619 +@@ -702,14 +752,15 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_
2620 + * gl_pathv points to (gl_offs + gl_pathc + 1) items.
2621 + */
2622 + static int
2623 +-globextend(const Char *path, glob_t *pglob, size_t *limit)
2624 ++globextend(const Char *path, glob_t *pglob, struct glob_limit *limit)
2625 + {
2626 + char **pathv;
2627 + size_t i, newsize, len;
2628 + char *copy;
2629 + const Char *p;
2630 +
2631 +- if (*limit && pglob->gl_pathc > *limit) {
2632 ++ if ((pglob->gl_flags & GLOB_LIMIT) &&
2633 ++ pglob->gl_matchc > limit->l_path_lim) {
2634 + errno = 0;
2635 + return (GLOB_NOSPACE);
2636 + }
2637 +@@ -737,6 +788,12 @@ static int
2638 + for (p = path; *p++;)
2639 + continue;
2640 + len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */
2641 ++ limit->l_string_cnt += len;
2642 ++ if ((pglob->gl_flags & GLOB_LIMIT) &&
2643 ++ limit->l_string_cnt >= GLOB_LIMIT_STRING) {
2644 ++ errno = 0;
2645 ++ return (GLOB_NOSPACE);
2646 ++ }
2647 + if ((copy = malloc(len)) != NULL) {
2648 + if (g_Ctoc(path, copy, len)) {
2649 + free(copy);
2650
2651 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
2652 new file mode 100644
2653 index 0000000..f8e4707
2654 --- /dev/null
2655 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch
2656 @@ -0,0 +1,21 @@
2657 +diff -uNr lib.ol/libproc/Makefile lib/libproc/Makefile
2658 +--- lib.ol/libproc/Makefile 2011-11-02 14:02:17.000000000 +0000
2659 ++++ lib/libproc/Makefile 2011-11-02 14:03:09.000000000 +0000
2660 +@@ -16,5 +16,6 @@
2661 + SHLIB_MAJOR= 2
2662 +
2663 + WITHOUT_MAN=
2664 ++LDADD+=-lelf
2665 +
2666 + .include <bsd.lib.mk>
2667 +diff -uNr lib.ol/librtld_db/Makefile lib/librtld_db/Makefile
2668 +--- lib.ol/librtld_db/Makefile 2011-11-02 14:02:13.000000000 +0000
2669 ++++ lib/librtld_db/Makefile 2011-11-02 14:04:00.000000000 +0000
2670 +@@ -10,5 +10,7 @@
2671 + INCS= rtld_db.h
2672 +
2673 + CFLAGS+= -I${.CURDIR}
2674 ++LDADD+=-lutil -lproc
2675 ++LDFLAGS+=-L${.OBJDIR}/../libutil -L${.OBJDIR}/../libproc
2676 +
2677 + .include <bsd.lib.mk>
2678
2679 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
2680 new file mode 100644
2681 index 0000000..c1c2a0e
2682 --- /dev/null
2683 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch
2684 @@ -0,0 +1,11 @@
2685 +diff -Nur lib.orig/libncp/Makefile lib/libncp/Makefile
2686 +--- lib.orig/libncp/Makefile 2012-12-25 20:35:16.000000000 +0900
2687 ++++ lib/libncp/Makefile 2012-12-25 20:36:23.000000000 +0900
2688 +@@ -6,6 +6,7 @@
2689 +
2690 + DPADD= ${LIBIPX}
2691 + LDADD= -lipx
2692 ++LDFLAGS+=-L${.OBJDIR}/../libipx
2693 +
2694 + SRCS= ncpl_subr.c ncpl_bind.c ncpl_queue.c ncpl_file.c ncpl_misc.c \
2695 + ncpl_net.c ncpl_rcfile.c ncpl_conn.c ncpl_nls.c ncpl_msg.c \
2696
2697 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
2698 new file mode 100644
2699 index 0000000..bf77a0a
2700 --- /dev/null
2701 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch
2702 @@ -0,0 +1,122 @@
2703 +Fixes warnings like:
2704 +/var/tmp/portage/sys-freebsd/freebsd-lib-9.0-r2/work/lib/libopie/../../contrib/opie/libopie/randomchallenge.c:43:5:
2705 +warning: incompatible implicit declaration of built-in function ‘strcpy’
2706 +
2707 +diff -uNr contrib.old/opie/libopie/accessfile.c contrib/opie/libopie/accessfile.c
2708 +--- contrib.old/opie/libopie/accessfile.c 2012-05-25 08:54:33.000000000 -0400
2709 ++++ contrib/opie/libopie/accessfile.c 2012-05-25 09:12:34.000000000 -0400
2710 +@@ -46,6 +46,7 @@
2711 + #ifdef DEBUG
2712 + #include <syslog.h>
2713 + #endif /* DEBUG */
2714 ++#include <ctype.h>
2715 +
2716 + #include "opie.h"
2717 +
2718 +diff -uNr contrib.old/opie/libopie/generator.c contrib/opie/libopie/generator.c
2719 +--- contrib.old/opie/libopie/generator.c 2012-05-25 08:54:33.000000000 -0400
2720 ++++ contrib/opie/libopie/generator.c 2012-05-25 08:58:10.000000000 -0400
2721 +@@ -50,6 +50,7 @@
2722 + #include <syslog.h>
2723 + #endif /* DEBUG */
2724 + #include "opie.h"
2725 ++#include <stdio.h>
2726 +
2727 + static char *algids[] = { NULL, NULL, NULL, "sha1", "md4", "md5" };
2728 +
2729 +diff -uNr contrib.old/opie/libopie/lookup.c contrib/opie/libopie/lookup.c
2730 +--- contrib.old/opie/libopie/lookup.c 2012-05-25 08:54:33.000000000 -0400
2731 ++++ contrib/opie/libopie/lookup.c 2012-05-25 09:15:08.000000000 -0400
2732 +@@ -14,6 +14,7 @@
2733 + #include "opie_cfg.h"
2734 + #include <stdio.h>
2735 + #include "opie.h"
2736 ++#include <string.h>
2737 +
2738 + int opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal)
2739 + {
2740 +diff -uNr contrib.old/opie/libopie/newseed.c contrib/opie/libopie/newseed.c
2741 +--- contrib.old/opie/libopie/newseed.c 2012-05-25 08:54:33.000000000 -0400
2742 ++++ contrib/opie/libopie/newseed.c 2012-05-25 09:14:37.000000000 -0400
2743 +@@ -36,6 +36,9 @@
2744 + #include <syslog.h>
2745 + #endif /* DEBUG */
2746 + #include "opie.h"
2747 ++#include <stdio.h>
2748 ++#include <stdlib.h>
2749 ++#include <time.h>
2750 +
2751 + int opienewseed FUNCTION((seed), char *seed)
2752 + {
2753 +diff -uNr contrib.old/opie/libopie/parsechallenge.c contrib/opie/libopie/parsechallenge.c
2754 +--- contrib.old/opie/libopie/parsechallenge.c 2012-05-25 08:54:33.000000000 -0400
2755 ++++ contrib/opie/libopie/parsechallenge.c 2012-05-25 09:15:54.000000000 -0400
2756 +@@ -20,6 +20,8 @@
2757 + #include <string.h>
2758 + #endif /* HAVE_STRING_H */
2759 + #include "opie.h"
2760 ++#include <stdlib.h>
2761 ++#include <ctype.h>
2762 +
2763 + struct algorithm {
2764 + char *name;
2765 +diff -uNr contrib.old/opie/libopie/passwd.c contrib/opie/libopie/passwd.c
2766 +--- contrib.old/opie/libopie/passwd.c 2012-05-25 08:54:33.000000000 -0400
2767 ++++ contrib/opie/libopie/passwd.c 2012-05-25 09:13:45.000000000 -0400
2768 +@@ -22,6 +22,7 @@
2769 +
2770 + #include "opie_cfg.h"
2771 + #include "opie.h"
2772 ++#include <string.h>
2773 +
2774 + 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)
2775 + {
2776 +diff -uNr contrib.old/opie/libopie/randomchallenge.c contrib/opie/libopie/randomchallenge.c
2777 +--- contrib.old/opie/libopie/randomchallenge.c 2012-05-25 08:54:33.000000000 -0400
2778 ++++ contrib/opie/libopie/randomchallenge.c 2012-05-25 09:00:27.000000000 -0400
2779 +@@ -28,6 +28,9 @@
2780 +
2781 + #include "opie_cfg.h"
2782 + #include "opie.h"
2783 ++#include <stdio.h>
2784 ++#include <string.h>
2785 ++#include <stdlib.h>
2786 +
2787 + static char *algids[] = { 0, 0, 0, "sha1", "md4", "md5" };
2788 +
2789 +diff -uNr contrib.old/opie/libopie/verify.c contrib/opie/libopie/verify.c
2790 +--- contrib.old/opie/libopie/verify.c 2012-05-25 08:54:33.000000000 -0400
2791 ++++ contrib/opie/libopie/verify.c 2012-05-25 09:12:09.000000000 -0400
2792 +@@ -25,6 +25,7 @@
2793 + #include <string.h>
2794 + #endif /* HAVE_STRING_H */
2795 + #include "opie.h"
2796 ++#include <ctype.h>
2797 +
2798 + #define RESPONSE_STANDARD 0
2799 + #define RESPONSE_WORD 1
2800 +diff -uNr contrib.old/opie/libopie/version.c contrib/opie/libopie/version.c
2801 +--- contrib.old/opie/libopie/version.c 2012-05-25 08:54:33.000000000 -0400
2802 ++++ contrib/opie/libopie/version.c 2012-05-25 09:13:15.000000000 -0400
2803 +@@ -19,6 +19,8 @@
2804 + */
2805 + #include "opie_cfg.h"
2806 + #include "opie.h"
2807 ++#include <stdio.h>
2808 ++#include <stdlib.h>
2809 +
2810 + VOIDRET opieversion FUNCTION_NOARGS
2811 + {
2812 +diff -uNr contrib.old/opie/opie.h contrib/opie/opie.h
2813 +--- contrib.old/opie/opie.h 2012-05-25 08:54:33.000000000 -0400
2814 ++++ contrib/opie/opie.h 2012-05-25 09:21:28.000000000 -0400
2815 +@@ -158,6 +158,9 @@
2816 + int __opiereadrec __P((struct opie *));
2817 + int __opiewriterec __P((struct opie *));
2818 + int __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));
2819 ++VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND VOIDPTR in AND struct opie_otpkey *out AND int n);
2820 ++int opieinsecure FUNCTION_NOARGS;
2821 ++int opienewseed FUNCTION((seed), char *seed);
2822 + __END_DECLS
2823 +
2824 + #define opiestrncpy(dst, src, n) \
2825
2826 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
2827 new file mode 100644
2828 index 0000000..fdb7e16
2829 --- /dev/null
2830 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch
2831 @@ -0,0 +1,17 @@
2832 +Fix "no .eh_frame_hdr table will be created" error.
2833 +
2834 +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47829
2835 +http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4a0e0cd7377c45dc21d5c71bcab931b5e5727e74
2836 +
2837 +diff -Nur lib.orig/csu/i386-elf/Makefile lib/csu/i386-elf/Makefile
2838 +--- lib.orig/csu/i386-elf/Makefile 2013-03-06 01:07:57.000000000 +0900
2839 ++++ lib/csu/i386-elf/Makefile 2013-03-06 01:10:09.000000000 +0900
2840 +@@ -10,6 +10,8 @@
2841 + FILESDIR= ${LIBDIR}
2842 + CFLAGS+= -I${.CURDIR}/../common \
2843 + -I${.CURDIR}/../../libc/include
2844 ++CFLAGS+= -fno-omit-frame-pointer
2845 ++CFLAGS+= -fno-asynchronous-unwind-tables
2846 + CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
2847 + CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s
2848 +
2849
2850 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
2851 new file mode 100644
2852 index 0000000..97ac141
2853 --- /dev/null
2854 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch
2855 @@ -0,0 +1,51 @@
2856 +Backport aligned_alloc for C++11 support.
2857 +
2858 +http://lists.freebsd.org/pipermail/svn-src-stable-9/2012-November/003313.html
2859 +
2860 +diff -uNr lib.old/libc/stdlib/Symbol.map lib/libc/stdlib/Symbol.map
2861 +--- lib.old/libc/stdlib/Symbol.map 2013-05-24 17:03:55.000000000 -0400
2862 ++++ lib/libc/stdlib/Symbol.map 2013-05-24 17:06:03.000000000 -0400
2863 +@@ -97,6 +97,7 @@
2864 + atoi_l;
2865 + atol_l;
2866 + atoll_l;
2867 ++ aligned_alloc;
2868 + at_quick_exit;
2869 + quick_exit;
2870 + strtod_l;
2871 +diff -uNr lib.old/libc/stdlib/malloc.c lib/libc/stdlib/malloc.c
2872 +--- lib.old/libc/stdlib/malloc.c 2013-05-24 17:03:55.000000000 -0400
2873 ++++ lib/libc/stdlib/malloc.c 2013-05-24 17:05:40.000000000 -0400
2874 +@@ -6046,6 +6046,21 @@
2875 + }
2876 +
2877 + void *
2878 ++aligned_alloc(size_t alignment, size_t size)
2879 ++{
2880 ++ void *memptr;
2881 ++ int ret;
2882 ++
2883 ++ ret = posix_memalign(&memptr, alignment, size);
2884 ++ if (ret != 0) {
2885 ++ errno = ret;
2886 ++ return (NULL);
2887 ++ }
2888 ++ return (memptr);
2889 ++}
2890 ++
2891 ++
2892 ++void *
2893 + calloc(size_t num, size_t size)
2894 + {
2895 + void *ret;
2896 +diff -uNr includeold/stdlib.h include/stdlib.h
2897 +--- includeold/stdlib.h 2013-05-24 17:03:46.000000000 -0400
2898 ++++ include/stdlib.h 2013-05-24 17:04:46.000000000 -0400
2899 +@@ -155,6 +155,7 @@
2900 + * If we're in a mode greater than C99, expose C1x functions.
2901 + */
2902 + #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
2903 ++void * aligned_alloc(size_t, size_t);
2904 + _Noreturn void
2905 + quick_exit(int);
2906 + int at_quick_exit(void (*)(void));
2907
2908 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
2909 new file mode 100644
2910 index 0000000..62357e0
2911 --- /dev/null
2912 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch
2913 @@ -0,0 +1,16 @@
2914 +--- include/Makefile.orig 2013-06-16 10:47:52.000000000 +0200
2915 ++++ include/Makefile 2013-06-16 10:47:37.000000000 +0200
2916 +@@ -6,11 +6,11 @@
2917 + .include <bsd.own.mk>
2918 +
2919 + CLEANFILES= osreldate.h version vers.c
2920 ++SUBDIR= arpa protocols rpcsvc rpc xlocale
2921 +-SUBDIR= arpa gssapi protocols rpcsvc rpc xlocale
2922 + INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
2923 + db.h \
2924 + dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
2925 ++ fts.h ftw.h getopt.h glob.h grp.h \
2926 +- fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
2927 + ieeefp.h ifaddrs.h \
2928 + inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
2929 + locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
2930
2931 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
2932 new file mode 100644
2933 index 0000000..00b39f7
2934 --- /dev/null
2935 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch
2936 @@ -0,0 +1,30 @@
2937 +Please do not disable this patch.
2938 +All commands will be non-executable.
2939 +Abort trap: 6 (core dumped) is displayed...
2940 +
2941 +Details see Gentoo Bug #511698.
2942 +https://bugs.gentoo.org/show_bug.cgi?id=511698
2943 +
2944 +diff --git a/lib/libc/Makefile b/lib/libc/Makefile
2945 +index 1cc23b7..7dd458e 100644
2946 +--- a/lib/libc/Makefile
2947 ++++ b/lib/libc/Makefile
2948 +@@ -149,6 +149,6 @@ CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
2949 + # in the future to circumvent this.
2950 + SSP_CFLAGS:= ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/}
2951 + # Disable stack protection for SSP symbols.
2952 +-SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
2953 ++SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/:C/^$/-fno-stack-protector/}
2954 + # Generate stack unwinding tables for cancellation points
2955 + CANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//}
2956 +diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc
2957 +index f92d87d..7a3a2f3 100644
2958 +--- a/lib/csu/Makefile.inc
2959 ++++ b/lib/csu/Makefile.inc
2960 +@@ -1,5 +1,5 @@
2961 + # $FreeBSD: release/9.1.0/lib/csu/Makefile.inc 204757 2010-03-05 13:29:05Z uqs $
2962 +
2963 +-SSP_CFLAGS=
2964 ++SSP_CFLAGS= -fno-stack-protector
2965 +
2966 + .include "../Makefile.inc"
2967
2968 diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch
2969 new file mode 100644
2970 index 0000000..ec90def
2971 --- /dev/null
2972 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch
2973 @@ -0,0 +1,13 @@
2974 +diff -u lib/libgeom/Makefile lib.xml/libgeom/Makefile
2975 +--- lib/libgeom/Makefile 2004-03-07 16:07:57 +0000
2976 ++++ lib.xml/libgeom/Makefile 2005-05-06 10:38:41 +0000
2977 +@@ -8,7 +8,8 @@
2978 + SRCS+= geom_ctl.c
2979 + INCS= libgeom.h
2980 +
2981 +-CFLAGS += -I${.CURDIR}
2982 ++CFLAGS += -I${.CURDIR} -I${.CURDIR}/../libexpat
2983 ++LDFLAGS += -L${.CURDIR}/../libexpat
2984 +
2985 + WARNS?= 3
2986 +
2987
2988 diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch
2989 new file mode 100644
2990 index 0000000..1b4e791
2991 --- /dev/null
2992 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch
2993 @@ -0,0 +1,26 @@
2994 +diff -ur lib/libgeom.old/Makefile lib/libgeom/Makefile
2995 +--- lib/libgeom.old/Makefile 2011-07-10 14:23:51.000000000 +0000
2996 ++++ lib/libgeom/Makefile 2011-07-10 15:12:39.000000000 +0000
2997 +@@ -13,8 +13,8 @@
2998 +
2999 + WARNS?= 3
3000 +
3001 +-DPADD= ${LIBBSDXML} ${LIBSBUF}
3002 +-LDADD= -lbsdxml -lsbuf
3003 ++DPADD= ${LIBSBUF}
3004 ++LDADD= -lexpat -lsbuf
3005 +
3006 + MAN= libgeom.3
3007 +
3008 +diff -ur lib/libgeom.old/geom_xml2tree.c lib/libgeom/geom_xml2tree.c
3009 +--- lib/libgeom.old/geom_xml2tree.c 2010-12-21 17:09:25.000000000 +0000
3010 ++++ lib/libgeom/geom_xml2tree.c 2011-07-10 15:12:52.000000000 +0000
3011 +@@ -43,7 +43,7 @@
3012 + #include <sys/sbuf.h>
3013 + #include <sys/sysctl.h>
3014 + #include <err.h>
3015 +-#include <bsdxml.h>
3016 ++#include <expat.h>
3017 + #include <libgeom.h>
3018 +
3019 + struct mystate {
3020
3021 diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch
3022 new file mode 100644
3023 index 0000000..c2cf142
3024 --- /dev/null
3025 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch
3026 @@ -0,0 +1,13 @@
3027 +Fix headers dependencies so that they can be included alone.
3028 +
3029 +--- include/ifaddrs.h.old 2009-05-15 13:50:10 +0000
3030 ++++ include/ifaddrs.h 2009-05-15 13:50:23 +0000
3031 +@@ -28,6 +28,8 @@
3032 + #ifndef _IFADDRS_H_
3033 + #define _IFADDRS_H_
3034 +
3035 ++#include <sys/types.h>
3036 ++
3037 + struct ifaddrs {
3038 + struct ifaddrs *ifa_next;
3039 + char *ifa_name;
3040
3041 diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch
3042 new file mode 100644
3043 index 0000000..c9288a4
3044 --- /dev/null
3045 +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch
3046 @@ -0,0 +1,68 @@
3047 +--- lib/msun/i387/fenv.c.orig 2007-01-05 04:15:26 -0300
3048 ++++ lib/msun/i387/fenv.c 2008-06-14 00:49:30 -0300
3049 +@@ -152,7 +152,8 @@
3050 + int
3051 + feupdateenv(const fenv_t *envp)
3052 + {
3053 +- int mxcsr, status;
3054 ++ int mxcsr;
3055 ++ short status;
3056 +
3057 + __fnstsw(&status);
3058 + if (__HAS_SSE())
3059 +--- lib/msun/i387/fenv.h.orig 2007-01-06 18:46:23 -0300
3060 ++++ lib/msun/i387/fenv.h 2008-06-14 01:06:40 -0300
3061 +@@ -134,7 +134,8 @@
3062 + static __inline int
3063 + fegetexceptflag(fexcept_t *__flagp, int __excepts)
3064 + {
3065 +- int __mxcsr, __status;
3066 ++ int __mxcsr;
3067 ++ short __status;
3068 +
3069 + __fnstsw(&__status);
3070 + if (__HAS_SSE())
3071 +@@ -151,7 +152,8 @@
3072 + static __inline int
3073 + fetestexcept(int __excepts)
3074 + {
3075 +- int __mxcsr, __status;
3076 ++ int __mxcsr;
3077 ++ short __status;
3078 +
3079 + __fnstsw(&__status);
3080 + if (__HAS_SSE())
3081 +--- lib/msun/amd64/fenv.c.orig 2007-01-05 04:15:26 -0300
3082 ++++ lib/msun/amd64/fenv.c 2008-06-14 01:02:41 -0300
3083 +@@ -101,7 +101,8 @@
3084 + int
3085 + feupdateenv(const fenv_t *envp)
3086 + {
3087 +- int mxcsr, status;
3088 ++ int mxcsr;
3089 ++ short status;
3090 +
3091 + __fnstsw(&status);
3092 + __stmxcsr(&mxcsr);
3093 +--- lib/msun/amd64/fenv.h.orig 2007-01-06 18:46:23 -0300
3094 ++++ lib/msun/amd64/fenv.h 2008-06-14 01:08:23 -0300
3095 +@@ -110,7 +110,8 @@
3096 + static __inline int
3097 + fegetexceptflag(fexcept_t *__flagp, int __excepts)
3098 + {
3099 +- int __mxcsr, __status;
3100 ++ int __mxcsr;
3101 ++ short __status;
3102 +
3103 + __stmxcsr(&__mxcsr);
3104 + __fnstsw(&__status);
3105 +@@ -124,7 +125,8 @@
3106 + static __inline int
3107 + fetestexcept(int __excepts)
3108 + {
3109 +- int __mxcsr, __status;
3110 ++ int __mxcsr;
3111 ++ short __status;
3112 +
3113 + __stmxcsr(&__mxcsr);
3114 + __fnstsw(&__status);
3115
3116 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
3117 new file mode 100644
3118 index 0000000..751a77c
3119 --- /dev/null
3120 +++ b/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch
3121 @@ -0,0 +1,13 @@
3122 +u_int is defined in sys/types.h
3123 +makes header usable alone.
3124 +
3125 +--- sys/sys/sysctl.h.old 2012-05-25 11:08:53.000000000 -0400
3126 ++++ sys/sys/sysctl.h 2012-05-25 11:09:16.000000000 -0400
3127 +@@ -788,6 +788,7 @@
3128 + struct sysctl_req *);
3129 + #else /* !_KERNEL */
3130 + #include <sys/cdefs.h>
3131 ++#include <sys/types.h> /* for u_int */
3132 +
3133 + __BEGIN_DECLS
3134 + int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
3135
3136 diff --git a/sys-freebsd/freebsd-lib/files/libmap.conf b/sys-freebsd/freebsd-lib/files/libmap.conf
3137 new file mode 100644
3138 index 0000000..7a879f9
3139 --- /dev/null
3140 +++ b/sys-freebsd/freebsd-lib/files/libmap.conf
3141 @@ -0,0 +1,8 @@
3142 +# /etc/libmap.conf
3143 +
3144 +# Ensure that libthr does all threading
3145 +libpthread.so.2 libthr.so.2
3146 +libpthread.so libthr.so
3147 +libc_r.so.6 libthr.so.2
3148 +libc_r.so libthr.so
3149 +
3150
3151 diff --git a/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in b/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in
3152 new file mode 100644
3153 index 0000000..058ecb4
3154 --- /dev/null
3155 +++ b/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in
3156 @@ -0,0 +1,11 @@
3157 +prefix=/usr
3158 +exec_prefix=${prefix}
3159 +libdir=@LIBDIR@
3160 +includedir=${prefix}/include
3161 +
3162 +Name: libusb
3163 +Description: USB access library (FreeBSD version)
3164 +Version: 1.0.1
3165 +Libs: -L${libdir} -lusb
3166 +Cflags: -I${includedir}
3167 +
3168
3169 diff --git a/sys-freebsd/freebsd-lib/files/libusb.pc.in b/sys-freebsd/freebsd-lib/files/libusb.pc.in
3170 new file mode 100644
3171 index 0000000..f63c6e3
3172 --- /dev/null
3173 +++ b/sys-freebsd/freebsd-lib/files/libusb.pc.in
3174 @@ -0,0 +1,11 @@
3175 +prefix=/usr
3176 +exec_prefix=${prefix}
3177 +libdir=@LIBDIR@
3178 +includedir=${prefix}/include
3179 +
3180 +Name: libusb
3181 +Description: USB access library (FreeBSD version)
3182 +Version: 0.1.12
3183 +Libs: -L${libdir} -lusb
3184 +Cflags: -I${includedir}
3185 +
3186
3187 diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-11.0.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-11.0.ebuild
3188 new file mode 100644
3189 index 0000000..ed4d9a8
3190 --- /dev/null
3191 +++ b/sys-freebsd/freebsd-lib/freebsd-lib-11.0.ebuild
3192 @@ -0,0 +1,647 @@
3193 +# Copyright 1999-2016 Gentoo Foundation
3194 +# Distributed under the terms of the GNU General Public License v2
3195 +# $Id$
3196 +
3197 +EAPI=5
3198 +
3199 +inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils multibuild multilib-build
3200 +
3201 +DESCRIPTION="FreeBSD's base system libraries"
3202 +SLOT="0"
3203 +LICENSE="BSD zfs? ( CDDL )"
3204 +
3205 +# Security Advisory and Errata patches.
3206 +UPSTREAM_PATCHES=( "EN-16:06/libc.patch" )
3207 +
3208 +# Crypto is needed to have an internal OpenSSL header
3209 +# sys is needed for libalias, probably we can just extract that instead of
3210 +# extracting the whole tarball
3211 +if [[ ${PV} != *9999* ]]; then
3212 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
3213 + SRC_URI="${SRC_URI}
3214 + $(freebsd_upstream_patches)"
3215 +fi
3216 +
3217 +EXTRACTONLY="
3218 + lib/
3219 + contrib/
3220 + crypto/
3221 + libexec/
3222 + etc/
3223 + include/
3224 + usr.sbin/
3225 + gnu/
3226 + secure/
3227 +"
3228 +
3229 +if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then
3230 + RDEPEND="ssl? ( dev-libs/openssl:0= )
3231 + hesiod? ( net-dns/hesiod )
3232 + kerberos? ( app-crypt/heimdal )
3233 + usb? ( !dev-libs/libusb )
3234 + zfs? ( =sys-freebsd/freebsd-cddl-${RV}* )
3235 + >=dev-libs/expat-2.0.1
3236 + >=dev-util/dialog-1.2.20150225
3237 + =sys-freebsd/freebsd-libexec-${RV}*
3238 + !sys-libs/libutempter
3239 + !dev-libs/libelf
3240 + !dev-libs/libexecinfo
3241 + !dev-libs/libiconv
3242 + !sys-freebsd/freebsd-headers"
3243 + DEPEND="${RDEPEND}
3244 + >=sys-devel/flex-2.5.31-r2
3245 + >=sys-freebsd/freebsd-sources-10.3-r5"
3246 + RDEPEND="${RDEPEND}
3247 + =sys-freebsd/freebsd-share-${RV}*
3248 + >=virtual/libiconv-0-r2"
3249 +else
3250 + EXTRACTONLY+="sys/ "
3251 +fi
3252 +
3253 +DEPEND="${DEPEND}
3254 + userland_GNU? ( sys-apps/mtree )
3255 + =sys-freebsd/freebsd-mk-defs-${RV}*"
3256 +
3257 +S="${WORKDIR}/lib"
3258 +
3259 +export CTARGET=${CTARGET:-${CHOST}}
3260 +if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then
3261 + export CTARGET=${CATEGORY/cross-}
3262 +fi
3263 +
3264 +IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware
3265 + build crosscompile_opts_headers-only zfs
3266 + userland_GNU userland_BSD"
3267 +
3268 +QA_DT_NEEDED="lib/libc.so.7 usr/lib32/libc.so.7"
3269 +
3270 +pkg_setup() {
3271 + # Add the required source files.
3272 + use build && EXTRACTONLY+="sys/ "
3273 + use zfs && EXTRACTONLY+="cddl/ "
3274 +
3275 + [ -c /dev/zero ] || \
3276 + die "You forgot to mount /dev; the compiled libc would break."
3277 +
3278 + if ! use ssl && use kerberos; then
3279 + eerror "If you want kerberos support you need to enable ssl support, too."
3280 + fi
3281 +
3282 + use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
3283 + use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= "
3284 + use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= "
3285 + use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= "
3286 + use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= WITHOUT_GSSAPI= "
3287 + use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
3288 + use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
3289 + use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
3290 + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
3291 +
3292 + mymakeopts="${mymakeopts} WITHOUT_SENDMAIL= WITHOUT_CLANG= WITHOUT_LIBCPLUSPLUS= WITHOUT_LDNS= WITHOUT_UNBOUND= "
3293 +
3294 + if [ "${CTARGET}" != "${CHOST}" ]; then
3295 + mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})"
3296 + mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})"
3297 + fi
3298 +}
3299 +
3300 +PATCHES=(
3301 + "${FILESDIR}/${PN}-6.0-pmc.patch"
3302 + "${FILESDIR}/${PN}-6.1-csu.patch"
3303 + "${FILESDIR}/${PN}-10.0-liblink.patch"
3304 + "${FILESDIR}/${PN}-10.2-liblink.patch"
3305 + "${FILESDIR}/${PN}-10.0-atfcxx.patch"
3306 + "${FILESDIR}/${PN}-10.3-libusb.patch"
3307 + "${FILESDIR}/${PN}-10.0-libproc-libcxx.patch"
3308 + "${FILESDIR}/${PN}-10.2-bsdxml2expat.patch"
3309 + "${FILESDIR}/${PN}-9.0-bluetooth.patch"
3310 + "${FILESDIR}/${PN}-9.1-.eh_frame_hdr-fix.patch"
3311 + "${FILESDIR}/${PN}-add-nossp-cflags.patch"
3312 + )
3313 +# Here we disable and remove source which we don't need or want
3314 +# In order:
3315 +# - ncurses stuff
3316 +# - libexpat creates a bsdxml library which is the same as expat
3317 +# - archiving libraries (have their own ebuild)
3318 +# - sendmail libraries (they are installed by sendmail)
3319 +# - SNMP library and dependency (have their own ebuilds)
3320 +# - libstand: static library, 32bits on amd64 used for boot0, we build it from
3321 +# boot0 instead.
3322 +#
3323 +# The rest are libraries we already have somewhere else because
3324 +# they are contribution.
3325 +REMOVE_SUBDIRS="ncurses \
3326 + libexpat \
3327 + libz libbz2 libarchive liblzma \
3328 + libsm libsmdb libsmutil \
3329 + libbegemot libbsnmp \
3330 + libpam libpcap libwrap libmagic \
3331 + libcom_err
3332 + libedit
3333 + libstand
3334 + libgssapi"
3335 +
3336 +# Are we building a cross-compiler?
3337 +is_crosscompile() {
3338 + [ "${CATEGORY#*cross-}" != "${CATEGORY}" ]
3339 +}
3340 +
3341 +src_prepare() {
3342 + # gcc-5.0 or later, Workaround for critical issue. bug 573358.
3343 + use x86-fbsd && [[ "$(gcc-major-version)" -ge 5 ]] && replace-flags -O? -O1
3344 +
3345 + sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc"
3346 +
3347 + # Upstream Display Managers default to using VT7
3348 + # We should make FreeBSD allow this by default
3349 + local x=
3350 + for x in "${WORKDIR}"/etc/etc.*/ttys ; do
3351 + sed -i.bak \
3352 + -e '/ttyv5[[:space:]]/ a\
3353 +# Display Managers default to VT7.\
3354 +# If you use the xdm init script, keep ttyv6 commented out\
3355 +# unless you force a different VT for the DM being used.' \
3356 + -e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \
3357 + || die "Failed to sed ${x}"
3358 + rm "${x}".bak
3359 + done
3360 +
3361 + # This one is here because it also
3362 + # patches "${WORKDIR}/include"
3363 + cd "${WORKDIR}"
3364 + epatch "${FILESDIR}/${PN}-includes.patch"
3365 + epatch "${FILESDIR}/${PN}-8.0-gcc45.patch"
3366 + epatch "${FILESDIR}/${PN}-9.0-opieincludes.patch"
3367 +
3368 + # Don't install the hesiod man page or header
3369 + rm "${WORKDIR}"/include/hesiod.h || die
3370 + sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die
3371 + sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \
3372 + "${WORKDIR}"/lib/libc/net/Makefile.inc || die
3373 +
3374 + # Fix the Makefiles of these few libraries that will overwrite our LDADD.
3375 + cd "${S}"
3376 + for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \
3377 + libsmb libprocstat libulog; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \
3378 + die "Problem fixing \"${dir}/Makefile"
3379 + done
3380 + # Call LD with LDFLAGS, rename them to RAW_LDFLAGS
3381 + sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \
3382 + -i "${S}/csu/i386-elf/Makefile" \
3383 + -i "${S}/csu/ia64/Makefile" || die
3384 +
3385 + if install --version 2> /dev/null | grep -q GNU; then
3386 + sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile"
3387 + fi
3388 +
3389 + # Try to fix sed calls for GNU sed. Do it only with GNU userland and force
3390 + # BSD's sed on BSD.
3391 + cd "${S}"
3392 + if [[ ${CBUILD:-${CHOST}} != *bsd* ]]; then
3393 + find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \;
3394 + sed -i -e 's/-i ""/-i""/' "${S}/csu/Makefile.inc" || die
3395 + fi
3396 +
3397 + if use build; then
3398 + cd "${WORKDIR}"
3399 + # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it
3400 + # shouldn't be a symlink to /usr/src/sys (which should be already patched)
3401 + epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch
3402 + return 0
3403 + fi
3404 +
3405 + if ! is_crosscompile ; then
3406 + if [[ ! -e "${WORKDIR}/sys" ]]; then
3407 + ln -s "${SYSROOT}/usr/src/sys" "${WORKDIR}/sys" || die "Couldn't make sys symlink!"
3408 + fi
3409 + else
3410 + sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \
3411 + "${S}/libc/rpc/Makefile.inc" \
3412 + "${S}/libc/yp/Makefile.inc"
3413 + fi
3414 +}
3415 +
3416 +bootstrap_lib() {
3417 + for i ; do
3418 + cd "${WORKDIR}/${i}" || die "missing ${i}"
3419 + freebsd_src_compile
3420 + append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/${i}"
3421 + done
3422 +}
3423 +
3424 +get_csudir() {
3425 + if [ -d "${WORKDIR}/lib/csu/$1-elf" ]; then
3426 + echo "lib/csu/$1-elf"
3427 + else
3428 + echo "lib/csu/$1"
3429 + fi
3430 +}
3431 +
3432 +bootstrap_csu() {
3433 + local csudir="$(get_csudir $(tc-arch-kernel ${CTARGET}))"
3434 + export RAW_LDFLAGS=$(raw-ldflags)
3435 + bootstrap_lib "${csudir}"
3436 +
3437 + CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
3438 + append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
3439 +
3440 + bootstrap_lib "gnu/lib/csu"
3441 +
3442 + cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
3443 + for i in *.So ; do
3444 + ln -s $i ${i%.So}S.o
3445 + done
3446 + CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
3447 + append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
3448 +}
3449 +
3450 +# Compile libssp_nonshared.a and add it's path to LDFLAGS.
3451 +bootstrap_libssp_nonshared() {
3452 + bootstrap_lib "gnu/lib/libssp/libssp_nonshared"
3453 + export LDADD="-lssp_nonshared"
3454 +}
3455 +
3456 +bootstrap_libgcc() {
3457 + bootstrap_lib "lib/libcompiler_rt"
3458 + cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libcompiler_rt" || die
3459 + ln -s libcompiler_rt.a libgcc.a || die
3460 +
3461 + bootstrap_lib "lib/libc" "gnu/lib/libgcc"
3462 +}
3463 +
3464 +bootstrap_libthr() {
3465 + bootstrap_lib "lib/libthr"
3466 + cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libthr" || die
3467 + ln -s libthr.so libpthread.so
3468 +}
3469 +
3470 +# What to build for a cross-compiler.
3471 +# We also need the csu but this has to be handled separately.
3472 +CROSS_SUBDIRS="lib/libc lib/msun gnu/lib/libssp/libssp_nonshared lib/libthr lib/libutil lib/librt lib/libc_nonshared"
3473 +
3474 +# What to build for non-default ABIs.
3475 +NON_NATIVE_SUBDIRS="${CROSS_SUBDIRS} gnu/lib/csu lib/libcompiler_rt gnu/lib/libgcc lib/libmd lib/libcrypt lib/libsbuf lib/libcam lib/libelf lib/libiconv_modules"
3476 +
3477 +# Subdirs for a native build:
3478 +NATIVE_SUBDIRS="lib gnu/lib/libssp/libssp_nonshared gnu/lib/libregex gnu/lib/csu gnu/lib/libgcc lib/libiconv_modules"
3479 +
3480 +# Is my $ABI native ?
3481 +is_native_abi() {
3482 + is_crosscompile && return 1
3483 + multilib_is_native_abi
3484 +}
3485 +
3486 +# Do we need to bootstrap the csu and libssp_nonshared?
3487 +need_bootstrap() {
3488 + is_crosscompile || use build || { ! is_native_abi && ! has_version '>=sys-freebsd/freebsd-lib-9.1-r8[multilib]' && ! has_version ">=sys-freebsd/freebsd-lib-9.1-r11[${MULTILIB_USEDEP}]" ; } || has_version "<${CATEGORY}/${P}"
3489 +}
3490 +
3491 +# Get the subdirs we are building.
3492 +get_subdirs() {
3493 + local ret=""
3494 + if is_native_abi ; then
3495 + # If we are building for the native ABI, build everything
3496 + ret="${NATIVE_SUBDIRS}"
3497 + elif is_crosscompile ; then
3498 + # With a cross-compiler we only build the very core parts.
3499 + ret="${CROSS_SUBDIRS}"
3500 + if [ "${EBUILD_PHASE}" = "install" ]; then
3501 + # Add the csu dir first when installing. We treat it separately for
3502 + # compiling.
3503 + ret="$(get_csudir $(tc-arch-kernel ${CTARGET})) ${ret}"
3504 + fi
3505 + else
3506 + # For the non-native ABIs we only build the csu parts and very core
3507 + # libraries for now.
3508 + ret="${NON_NATIVE_SUBDIRS} $(get_csudir $(tc-arch-kernel ${CHOST}))"
3509 + fi
3510 + echo "${ret}"
3511 +}
3512 +
3513 +# Bootstrap the core libraries and setup the flags so that the other parts can
3514 +# build against it.
3515 +do_bootstrap() {
3516 + einfo "Bootstrapping on ${CHOST} for ${CTARGET}"
3517 + if ! is_crosscompile ; then
3518 + # Pre-install headers, but not when building a cross-compiler since we
3519 + # assume they have been installed in the previous pass.
3520 + einfo "Pre-installing includes in include_proper_${ABI}"
3521 + mkdir "${WORKDIR}/include_proper_${ABI}" || die
3522 + CTARGET="${CHOST}" install_includes "/include_proper_${ABI}"
3523 + CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
3524 + CXXFLAGS="${CXXFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
3525 + mymakeopts="${mymakeopts} RPCDIR=${WORKDIR}/include_proper_${ABI}/rpcsvc"
3526 + fi
3527 + bootstrap_csu
3528 + bootstrap_libssp_nonshared
3529 + is_crosscompile && bootstrap_lib "lib/libc"
3530 + is_crosscompile || is_native_abi || bootstrap_libgcc
3531 + is_native_abi || bootstrap_libthr
3532 +}
3533 +
3534 +# Compile it. Assume we have the toolchain setup correctly.
3535 +do_compile() {
3536 + # Bootstrap if needed, otherwise assume the system headers are in
3537 + # /usr/include.
3538 + if need_bootstrap ; then
3539 + do_bootstrap
3540 + else
3541 + CFLAGS="${CFLAGS} -isystem /usr/include"
3542 + CXXFLAGS="${CXXFLAGS} -isystem /usr/include"
3543 + fi
3544 +
3545 + export RAW_LDFLAGS=$(raw-ldflags)
3546 +
3547 + # Everything is now setup, build it!
3548 + for i in $(get_subdirs) ; do
3549 + einfo "Building in ${i}... with CC=${CC} and CFLAGS=${CFLAGS}"
3550 + cd "${WORKDIR}/${i}/" || die "missing ${i}."
3551 + freebsd_src_compile || die "make ${i} failed"
3552 + done
3553 +}
3554 +
3555 +src_compile() {
3556 + # Does not work with GNU sed
3557 + # Force BSD's sed on BSD.
3558 + if [[ ${CBUILD:-${CHOST}} == *bsd* ]]; then
3559 + export ESED=/usr/bin/sed
3560 + unalias sed
3561 + fi
3562 +
3563 + use usb && export NON_NATIVE_SUBDIRS="${NON_NATIVE_SUBDIRS} lib/libusb lib/libusbhid"
3564 +
3565 + cd "${WORKDIR}/include"
3566 + $(freebsd_get_bmake) CC="$(tc-getCC)" || die "make include failed"
3567 +
3568 + use crosscompile_opts_headers-only && return 0
3569 +
3570 + # Bug #270098
3571 + append-flags $(test-flags -fno-strict-aliasing)
3572 +
3573 + # Bug #324445
3574 + append-flags $(test-flags -fno-strict-overflow)
3575 +
3576 + # strip flags and do not do it later, we only add safe, and in fact
3577 + # needed flags after all
3578 + strip-flags
3579 + export NOFLAGSTRIP=yes
3580 + if is_crosscompile ; then
3581 + export YACC='yacc -by'
3582 + CHOST=${CTARGET} tc-export CC LD CXX RANLIB
3583 + mymakeopts="${mymakeopts} NLS="
3584 + CFLAGS="${CFLAGS} -isystem /usr/${CTARGET}/usr/include"
3585 + CXXFLAGS="${CXXFLAGS} -isystem /usr/${CTARGET}/usr/include"
3586 + append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc"
3587 + fi
3588 +
3589 + if is_crosscompile ; then
3590 + do_compile
3591 + else
3592 + local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
3593 + multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_compile
3594 + fi
3595 +}
3596 +
3597 +gen_libc_ldscript() {
3598 + # Parameters:
3599 + # $1 = target libdir
3600 + # $2 = source libc dir
3601 + # $3 = source libssp_nonshared dir
3602 +
3603 + # Clear the symlink.
3604 + rm -f "${DESTDIR}/$2/libc.so" || die
3605 +
3606 + # Move the library if needed
3607 + if [ "$1" != "$2" ] ; then
3608 + mv "${DESTDIR}/$2/libc.so.7" "${DESTDIR}/$1/" || die
3609 + fi
3610 +
3611 + # Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking
3612 + # this is done to avoid having to touch gcc spec file as it is currently
3613 + # done on FreeBSD upstream, mostly because their binutils aren't able to
3614 + # cope with linker scripts yet.
3615 + # Taken from toolchain-funcs.eclass:
3616 + local output_format
3617 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
3618 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
3619 +
3620 + # iconv symbol provided by libc_nonshared.a.
3621 + # http://svnweb.freebsd.org/base?view=revision&amp;revision=258283
3622 + cat > "${DESTDIR}/$2/libc.so" <<-END_LDSCRIPT
3623 +/* GNU ld script
3624 + SSP (-fstack-protector) requires __stack_chk_fail_local to be local.
3625 + GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if
3626 + this symbol was provided by a shared libc. So we link in
3627 + libssp_nonshared.a from here.
3628 + */
3629 +${output_format}
3630 +GROUP ( /$1/libc.so.7 /$3/libc_nonshared.a /$3/libssp_nonshared.a )
3631 +END_LDSCRIPT
3632 +}
3633 +
3634 +header_list=""
3635 +
3636 +move_header() {
3637 + local dirname=$(dirname ${1})
3638 + local filename=$(basename ${1})
3639 +
3640 + if [ ! -d "${dirname}/${ABI}" ] ; then
3641 + mkdir "${dirname}/${ABI}" || die
3642 + fi
3643 +
3644 + mv "${1}" "${dirname}/${ABI}/" || die
3645 +
3646 + export header_list="${header_list} ${1}"
3647 +}
3648 +
3649 +make_header_template() {
3650 + cat <<-END_HEADER
3651 +/*
3652 + * Wrapped header for multilib support.
3653 + * See the real headers included below.
3654 + */
3655 +
3656 +#if defined(__x86_64__)
3657 + @ABI_amd64_fbsd@
3658 +#elif defined(__i386__)
3659 + @ABI_x86_fbsd@
3660 +#else
3661 + @ABI_${DEFAULT_ABI}@
3662 +#endif
3663 +END_HEADER
3664 +}
3665 +
3666 +wrap_header() {
3667 + local dirname=$(dirname ${1})
3668 + local filename=$(basename ${1})
3669 +
3670 + if [ -n "${dirname#.}" ] ; then
3671 + dirname="${dirname}/${2}"
3672 + else
3673 + dirname="${2}"
3674 + fi
3675 +
3676 + if [ -f "${dirname}/${filename}" ] ; then
3677 + sed -e "s:@ABI_${2}@:#include <${dirname}/${filename}>:" ${1}
3678 + else
3679 + cat ${1}
3680 + fi
3681 +}
3682 +
3683 +wrap_header_end() {
3684 + sed -e "s:@ABI_.*@:#error \"Sorry, no support for your ABI.\":" ${1}
3685 +}
3686 +
3687 +do_install() {
3688 + if is_crosscompile ; then
3689 + INCLUDEDIR="/usr/${CTARGET}/usr/include"
3690 + else
3691 + INCLUDEDIR="/usr/include"
3692 + fi
3693 +
3694 + dodir ${INCLUDEDIR}
3695 + CTARGET="${CHOST}" \
3696 + install_includes ${INCLUDEDIR}
3697 +
3698 + is_crosscompile && use crosscompile_opts_headers-only && return 0
3699 +
3700 + # Install a libusb.pc for better compat with Linux's libusb
3701 + if use usb ; then
3702 + dodir /usr/$(get_libdir)/pkgconfig
3703 + sed -i.bkp "s:^libdir=.*:libdir=/usr/$(get_libdir):g" "${S}"/libusb/libusb-*.pc
3704 + fi
3705 +
3706 + for i in $(get_subdirs) ; do
3707 + if [[ ${i} != *libiconv_modules* ]] ; then
3708 + einfo "Installing in ${i}..."
3709 + cd "${WORKDIR}/${i}/" || die "missing ${i}."
3710 + freebsd_src_install || die "Install ${i} failed"
3711 + fi
3712 + done
3713 +
3714 + if ! is_crosscompile; then
3715 + local mymakeopts_save="${mymakeopts}"
3716 + mymakeopts="${mymakeopts} SHLIBDIR=/usr/$(get_libdir)/i18n LIBDIR=/usr/$(get_libdir)/i18n"
3717 +
3718 + einfo "Installing in lib/libiconv_modules..."
3719 + cd "${WORKDIR}/lib/libiconv_modules/" || die "missing libiconv_modules."
3720 + freebsd_src_install || die "Install lib/libiconv_modules failed"
3721 +
3722 + mymakeopts="${mymakeopts_save}"
3723 + fi
3724 +
3725 + if ! is_crosscompile ; then
3726 + if ! multilib_is_native_abi ; then
3727 + DESTDIR="${D}" gen_libc_ldscript "usr/$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
3728 + else
3729 + dodir "$(get_libdir)"
3730 + DESTDIR="${D}" gen_libc_ldscript "$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
3731 + fi
3732 + else
3733 + CHOST=${CTARGET} DESTDIR="${D}/usr/${CTARGET}/" gen_libc_ldscript "usr/lib" "usr/lib" "usr/lib"
3734 + # We're done for the cross libc here.
3735 + return 0
3736 + fi
3737 +
3738 + # Generate ldscripts for core libraries that will go in /
3739 + multilib_is_native_abi && \
3740 + gen_usr_ldscript -a alias cam geom ipsec jail kiconv \
3741 + kvm m md procstat sbuf thr ufs util elf
3742 +
3743 + if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]] ; then
3744 + cd "${D}/usr/include"
3745 + for i in machine/*.h fenv.h ; do
3746 + move_header ${i}
3747 + done
3748 + if multilib_is_native_abi ; then
3749 + # Supposedly the last one!
3750 + local uniq_headers="$(echo ${header_list} | tr ' ' '\n' | sort | uniq | tr '\n' ' ')"
3751 + for j in ${uniq_headers} ; do
3752 + make_header_template > ${j}
3753 + for i in $(get_all_abis) ; do
3754 + wrap_header ${j} ${i} > ${j}.new
3755 + cp ${j}.new ${j}
3756 + rm -f ${j}.new
3757 + done
3758 + wrap_header_end ${j} > ${j}.new
3759 + cp ${j}.new ${j}
3760 + rm -f ${j}.new
3761 + done
3762 + fi
3763 + fi
3764 +}
3765 +
3766 +src_install() {
3767 + if is_crosscompile ; then
3768 + einfo "Installing for ${CTARGET} in ${CHOST}.."
3769 + # From this point we need to force: get stripped with the correct tools,
3770 + # get tc-arch-kernel to return the right value, etc.
3771 + export CHOST=${CTARGET}
3772 +
3773 + mymakeopts="${mymakeopts} NO_MAN= \
3774 + INCLUDEDIR=/usr/${CTARGET}/usr/include \
3775 + SHLIBDIR=/usr/${CTARGET}/usr/lib \
3776 + LIBDIR=/usr/${CTARGET}/usr/lib"
3777 +
3778 + dosym "usr/include" "/usr/${CTARGET}/sys-include"
3779 + do_install
3780 +
3781 + return 0
3782 + else
3783 + export STRIP_MASK="*/usr/lib*/*crt*.o"
3784 + local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
3785 + multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_install
3786 + fi
3787 +
3788 + cd "${WORKDIR}/etc/"
3789 + insinto /etc
3790 + doins nls.alias mac.conf netconfig
3791 +
3792 + # Install ttys file
3793 + local MACHINE="$(tc-arch-kernel)"
3794 + doins "etc.${MACHINE}"/*
3795 +}
3796 +
3797 +install_includes()
3798 +{
3799 + local INCLUDEDIR="$1"
3800 +
3801 + # The idea is to be called from either install or unpack.
3802 + # During unpack it's required to install them as portage's user.
3803 + if [[ "${EBUILD_PHASE}" == "install" ]]; then
3804 + local DESTDIR="${D}"
3805 + BINOWN="root"
3806 + BINGRP="wheel"
3807 + else
3808 + local DESTDIR="${WORKDIR}"
3809 + [[ -z "${USER}" ]] && USER="portage"
3810 + BINOWN="${USER}"
3811 + [[ -z "${GROUPS}" ]] && GROUPS="portage"
3812 + BINGRP="${GROUPS}"
3813 + fi
3814 +
3815 + # Must exist before we use it.
3816 + [[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes."
3817 + cd "${WORKDIR}/include"
3818 +
3819 + local MACHINE="$(tc-arch-kernel)"
3820 +
3821 + einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
3822 + $(freebsd_get_bmake) installincludes \
3823 + MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
3824 + DESTDIR="${DESTDIR}" \
3825 + INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
3826 + BINGRP="${BINGRP}" \
3827 + WITHOUT_GSSAPI= || die "install_includes() failed"
3828 + einfo "includes installed ok."
3829 + EXTRA_INCLUDES="lib/librtld_db lib/libutil lib/msun gnu/lib/libregex"
3830 + for i in $EXTRA_INCLUDES; do
3831 + einfo "Installing $i includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
3832 + cd "${WORKDIR}/$i" || die
3833 + $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \
3834 + MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
3835 + INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
3836 + BINGRP="${BINGRP}" || die "problem installing $i includes."
3837 + einfo "$i includes installed ok."
3838 + done
3839 +}
3840
3841 diff --git a/sys-freebsd/freebsd-lib/metadata.xml b/sys-freebsd/freebsd-lib/metadata.xml
3842 new file mode 100644
3843 index 0000000..24ca540
3844 --- /dev/null
3845 +++ b/sys-freebsd/freebsd-lib/metadata.xml
3846 @@ -0,0 +1,16 @@
3847 +<?xml version="1.0" encoding="UTF-8"?>
3848 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3849 +<pkgmetadata>
3850 + <maintainer type="project">
3851 + <email>bsd@g.o</email>
3852 + <name>BSD Project</name>
3853 + </maintainer>
3854 + <use>
3855 + <flag name="hesiod">Enable support for net-dns/hesiod</flag>
3856 + <flag name="netware">
3857 + Build libraries and tools to work with NetWare protocols (IPX
3858 + and NCP).
3859 + </flag>
3860 + <flag name="zfs">Enable ZFS support.</flag>
3861 + </use>
3862 +</pkgmetadata>
3863
3864 diff --git a/sys-freebsd/freebsd-libexec/files/bootpd.confd b/sys-freebsd/freebsd-libexec/files/bootpd.confd
3865 new file mode 100644
3866 index 0000000..6d238e4
3867 --- /dev/null
3868 +++ b/sys-freebsd/freebsd-libexec/files/bootpd.confd
3869 @@ -0,0 +1,7 @@
3870 +# Configuration file for /etc/init.d/bootpd
3871 +
3872 +# Name of the configuration file for bootpd
3873 +# bootptab_file="/etc/bootptab"
3874 +
3875 +# Options to pass to bootpd. See bootpd(8).
3876 +# bootpd_opts=""
3877
3878 diff --git a/sys-freebsd/freebsd-libexec/files/bootpd.initd b/sys-freebsd/freebsd-libexec/files/bootpd.initd
3879 new file mode 100644
3880 index 0000000..82288eb
3881 --- /dev/null
3882 +++ b/sys-freebsd/freebsd-libexec/files/bootpd.initd
3883 @@ -0,0 +1,27 @@
3884 +#!/sbin/openrc-run
3885 +# Copyright 2008 Gentoo Foundation
3886 +# Distributed under the terms of the GNU General Public License v2
3887 +
3888 +depend() {
3889 + need net
3890 +}
3891 +
3892 +start() {
3893 + local bootptab=${bootptab_file:-/etc/bootptab}
3894 +
3895 + if ! [ -f "${bootptab}" ]; then
3896 + eerror "Unable to find the bootptab file: ${bootptab}"
3897 + eend 1
3898 + return 1
3899 + fi
3900 +
3901 + ebegin "Starting BOOTP server"
3902 + start-stop-daemon --start --exec /usr/libexec/bootpd -- ${bootpd_opts} ${bootptab}
3903 + eend $?
3904 +}
3905 +
3906 +stop() {
3907 + ebegin "Stopping BOOTP server"
3908 + start-stop-daemon --stop --exec /usr/libexec/bootpd
3909 + eend $?
3910 +}
3911
3912 diff --git a/sys-freebsd/freebsd-libexec/files/freebsd-libexec-10.2-atf-check.patch b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-10.2-atf-check.patch
3913 new file mode 100644
3914 index 0000000..e9c0925
3915 --- /dev/null
3916 +++ b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-10.2-atf-check.patch
3917 @@ -0,0 +1,28 @@
3918 +diff --git a/libexec/atf/Makefile.inc b/libexec/atf/Makefile.inc
3919 +index b50e14e..e59a413 100644
3920 +--- a/libexec/atf/Makefile.inc
3921 ++++ b/libexec/atf/Makefile.inc
3922 +@@ -25,7 +25,7 @@
3923 + #
3924 + # $FreeBSD: stable/10/libexec/atf/Makefile.inc 271298 2014-09-09 04:00:30Z ngie $
3925 +
3926 +-CFLAGS+= -DHAVE_CONFIG_H
3927 ++CXXFLAGS+= -DHAVE_CONFIG_H
3928 +
3929 + WARNS?= 3
3930 +
3931 +diff --git a/libexec/atf/atf-check/Makefile b/libexec/atf/atf-check/Makefile
3932 +index 77c11db..7449ddb 100644
3933 +--- a/libexec/atf/atf-check/Makefile
3934 ++++ b/libexec/atf/atf-check/Makefile
3935 +@@ -34,8 +34,8 @@ PROG_CXX= atf-check
3936 + SRCS= atf-check.cpp
3937 + MAN= atf-check.1
3938 +
3939 +-CFLAGS+= -I${ATF}
3940 +-CFLAGS+= -DATF_SHELL='"/bin/sh"'
3941 ++CXXFLAGS+= -I${ATF}
3942 ++CXXFLAGS+= -DATF_SHELL='"/bin/sh"'
3943 +
3944 + LDFLAGS+= -L${.OBJDIR}/../../../lib/atf/libatf-c++
3945 + LDFLAGS+= -L${.OBJDIR}/../../../lib/atf/libatf-c
3946
3947 diff --git a/sys-freebsd/freebsd-libexec/files/freebsd-libexec-7.2-pic.patch b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-7.2-pic.patch
3948 new file mode 100644
3949 index 0000000..22d5658
3950 --- /dev/null
3951 +++ b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-7.2-pic.patch
3952 @@ -0,0 +1,13 @@
3953 +Fails to build on sparc without using -fPIC
3954 +
3955 +--- libexec/rtld-elf/Makefile.old 2010-01-09 17:17:21 +0100
3956 ++++ libexec/rtld-elf/Makefile 2010-01-09 17:17:33 +0100
3957 +@@ -19,7 +19,7 @@
3958 + MLINKS= rtld.1 ld-elf.so.1.1 \
3959 + rtld.1 ld.so.1
3960 +
3961 +-CFLAGS+= -fpic -DPIC
3962 ++CFLAGS+= -fPIC -DPIC
3963 + LDFLAGS+= -shared -Wl,-Bsymbolic
3964 + DPADD= ${LIBC_PIC}
3965 + LDADD= -lc_pic
3966
3967 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
3968 new file mode 100644
3969 index 0000000..c60b2fe
3970 --- /dev/null
3971 +++ b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch
3972 @@ -0,0 +1,40 @@
3973 +--- head/libexec/rtld-elf/rtld.c 2011/09/15 11:50:09 225582
3974 ++++ head/libexec/rtld-elf/rtld.c 2011/10/08 12:39:47 226155
3975 +@@ -495,8 +495,12 @@
3976 + exit (0);
3977 + }
3978 +
3979 +- /* setup TLS for main thread */
3980 +- dbg("initializing initial thread local storage");
3981 ++ /*
3982 ++ * Processing tls relocations requires having the tls offsets
3983 ++ * initialized. Prepare offsets before starting initial
3984 ++ * relocation processing.
3985 ++ */
3986 ++ dbg("initializing initial thread local storage offsets");
3987 + STAILQ_FOREACH(entry, &list_main, link) {
3988 + /*
3989 + * Allocate all the initial objects out of the static TLS
3990 +@@ -504,7 +508,6 @@
3991 + */
3992 + allocate_tls_offset(entry->obj);
3993 + }
3994 +- allocate_initial_tls(obj_list);
3995 +
3996 + if (relocate_objects(obj_main,
3997 + ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1)
3998 +@@ -519,6 +522,14 @@
3999 + exit (0);
4000 + }
4001 +
4002 ++ /*
4003 ++ * Setup TLS for main thread. This must be done after the
4004 ++ * relocations are processed, since tls initialization section
4005 ++ * might be the subject for relocations.
4006 ++ */
4007 ++ dbg("initializing initial thread local storage");
4008 ++ allocate_initial_tls(obj_list);
4009 ++
4010 + dbg("initializing key program variables");
4011 + set_program_var("__progname", argv[0] != NULL ? basename(argv[0]) : "");
4012 + set_program_var("environ", env);
4013
4014 diff --git a/sys-freebsd/freebsd-libexec/files/freebsd-libexec-9.2-no_ld32.patch b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-9.2-no_ld32.patch
4015 new file mode 100644
4016 index 0000000..d330009
4017 --- /dev/null
4018 +++ b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-9.2-no_ld32.patch
4019 @@ -0,0 +1,15 @@
4020 +Use LD_* variables for 32bits too instead of the FreeBSD invention LD_32_*.
4021 +We use LD_* everywhere on Gentoo and things like libtool wrappers have no clue
4022 +about LD_32_* and thus fail to run from the build directory.
4023 +
4024 +diff -uNr libexec.old/rtld-elf/rtld.h libexec/rtld-elf/rtld.h
4025 +--- libexec.old/rtld-elf/rtld.h 2013-08-24 12:30:26.000000000 -0400
4026 ++++ libexec/rtld-elf/rtld.h 2013-08-26 17:10:19.000000000 -0400
4027 +@@ -47,7 +47,6 @@
4028 + #define _PATH_ELF_HINTS "/var/run/ld-elf32.so.hints"
4029 + /* For running 32 bit binaries */
4030 + #define STANDARD_LIBRARY_PATH "/lib32:/usr/lib32"
4031 +-#define LD_ "LD_32_"
4032 + #endif
4033 +
4034 + #ifndef STANDARD_LIBRARY_PATH
4035
4036 diff --git a/sys-freebsd/freebsd-libexec/files/ftpd.pamd b/sys-freebsd/freebsd-libexec/files/ftpd.pamd
4037 new file mode 100644
4038 index 0000000..8e90823
4039 --- /dev/null
4040 +++ b/sys-freebsd/freebsd-libexec/files/ftpd.pamd
4041 @@ -0,0 +1,8 @@
4042 +# PAM configuration for the "ftpd" service
4043 +#
4044 +
4045 +auth include system-auth
4046 +account include system-auth
4047 +password include system-auth
4048 +session include system-auth
4049 +
4050
4051 diff --git a/sys-freebsd/freebsd-libexec/files/rquotad.xinetd b/sys-freebsd/freebsd-libexec/files/rquotad.xinetd
4052 new file mode 100644
4053 index 0000000..876cd16
4054 --- /dev/null
4055 +++ b/sys-freebsd/freebsd-libexec/files/rquotad.xinetd
4056 @@ -0,0 +1,11 @@
4057 +service rquotad
4058 +{
4059 + type = rpc
4060 + socket_type = dgram
4061 + protocol = udp
4062 + wait = yes
4063 + user = root
4064 + server = /usr/libexec/rpc.rquotad
4065 + rpc_version = 1
4066 + disabled = yes
4067 +}
4068
4069 diff --git a/sys-freebsd/freebsd-libexec/files/rstatd.xinetd b/sys-freebsd/freebsd-libexec/files/rstatd.xinetd
4070 new file mode 100644
4071 index 0000000..ba1b819
4072 --- /dev/null
4073 +++ b/sys-freebsd/freebsd-libexec/files/rstatd.xinetd
4074 @@ -0,0 +1,11 @@
4075 +service rstatd
4076 +{
4077 + type = rpc
4078 + socket_type = dgram
4079 + protocol = udp
4080 + wait = yes
4081 + user = root
4082 + server = /usr/libexec/rpc.rstatd
4083 + rpc_version = 1-3
4084 + disabled = yes
4085 +}
4086
4087 diff --git a/sys-freebsd/freebsd-libexec/files/rusersd.xinetd b/sys-freebsd/freebsd-libexec/files/rusersd.xinetd
4088 new file mode 100644
4089 index 0000000..5cbe091
4090 --- /dev/null
4091 +++ b/sys-freebsd/freebsd-libexec/files/rusersd.xinetd
4092 @@ -0,0 +1,11 @@
4093 +service rusersd
4094 +{
4095 + type = rpc
4096 + socket_type = dgram
4097 + protocol = udp
4098 + wait = yes
4099 + user = root
4100 + server = /usr/libexec/rpc.rusersd
4101 + rpc_version = 1-2
4102 + disabled = yes
4103 +}
4104
4105 diff --git a/sys-freebsd/freebsd-libexec/files/sprayd.xinetd b/sys-freebsd/freebsd-libexec/files/sprayd.xinetd
4106 new file mode 100644
4107 index 0000000..7be5577
4108 --- /dev/null
4109 +++ b/sys-freebsd/freebsd-libexec/files/sprayd.xinetd
4110 @@ -0,0 +1,11 @@
4111 +service sprayd
4112 +{
4113 + type = rpc
4114 + socket_type = dgram
4115 + protocol = udp
4116 + wait = yes
4117 + user = root
4118 + server = /usr/libexec/rpc.sprayd
4119 + rpc_version = 1
4120 + disabled = yes
4121 +}
4122
4123 diff --git a/sys-freebsd/freebsd-libexec/files/walld.xinetd b/sys-freebsd/freebsd-libexec/files/walld.xinetd
4124 new file mode 100644
4125 index 0000000..800b84f
4126 --- /dev/null
4127 +++ b/sys-freebsd/freebsd-libexec/files/walld.xinetd
4128 @@ -0,0 +1,11 @@
4129 +service walld
4130 +{
4131 + type = rpc
4132 + socket_type = dgram
4133 + protocol = udp
4134 + wait = yes
4135 + user = root
4136 + server = /usr/libexec/rpc.rwalld
4137 + rpc_version = 1
4138 + disabled = yes
4139 +}
4140
4141 diff --git a/sys-freebsd/freebsd-libexec/freebsd-libexec-11.0.ebuild b/sys-freebsd/freebsd-libexec/freebsd-libexec-11.0.ebuild
4142 new file mode 100644
4143 index 0000000..26851c8
4144 --- /dev/null
4145 +++ b/sys-freebsd/freebsd-libexec/freebsd-libexec-11.0.ebuild
4146 @@ -0,0 +1,112 @@
4147 +# Copyright 1999-2016 Gentoo Foundation
4148 +# Distributed under the terms of the GNU General Public License v2
4149 +# $Id$
4150 +
4151 +EAPI=5
4152 +
4153 +inherit bsdmk freebsd pam multilib multibuild multilib-build toolchain-funcs
4154 +
4155 +DESCRIPTION="FreeBSD libexec things"
4156 +SLOT="0"
4157 +
4158 +if [[ ${PV} != *9999* ]]; then
4159 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
4160 +fi
4161 +
4162 +EXTRACTONLY="
4163 + libexec/
4164 + usr.bin/
4165 + bin/
4166 + contrib/hyperv/
4167 + lib/
4168 + etc/
4169 + usr.sbin/
4170 +"
4171 +
4172 +RDEPEND="=sys-freebsd/freebsd-lib-${RV}*
4173 + >=sys-freebsd/freebsd-lib-9.1-r11[${MULTILIB_USEDEP}]
4174 + pam? ( virtual/pam )"
4175 +DEPEND="${RDEPEND}
4176 + =sys-freebsd/freebsd-mk-defs-${RV}*
4177 + =sys-freebsd/freebsd-sources-${RV}*"
4178 +RDEPEND="${RDEPEND}
4179 + xinetd? ( sys-apps/xinetd )"
4180 +
4181 +S="${WORKDIR}/libexec"
4182 +
4183 +# Remove sendmail, tcp_wrapper and other useless stuff
4184 +REMOVE_SUBDIRS="smrsh mail.local tcpd telnetd rshd rlogind ftpd"
4185 +
4186 +IUSE="pam ssl kerberos ipv6 nis xinetd"
4187 +
4188 +PATCHES=( "${FILESDIR}/${PN}-9.2-no_ld32.patch"
4189 + "${FILESDIR}/${PN}-10.2-atf-check.patch" )
4190 +
4191 +pkg_setup() {
4192 + use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6= WITHOUT_INET6_SUPPORT= "
4193 + use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= "
4194 + use nis || mymakeopts="${mymakeopts} WITHOUT_NIS= "
4195 + use pam || mymakeopts="${mymakeopts} WITHOUT_PAM_SUPPORT= "
4196 + use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
4197 +
4198 + mymakeopts="${mymakeopts} WITHOUT_SENDMAIL= WITHOUT_PF= WITHOUT_RCMDS= "
4199 +}
4200 +
4201 +src_prepare() {
4202 + # gcc-5.0 or later, Workaround for critical issue. bug 573358.
4203 + [[ "$(gcc-major-version)" -ge 5 ]] && replace-flags -O? -O1
4204 +
4205 + if [[ ! -e "${WORKDIR}/include" ]]; then
4206 + ln -s /usr/include "${WORKDIR}/include" || die "Symlinking /usr/include.."
4207 + fi
4208 + # allow upgrade directly from 9.x to 10.2.
4209 + if has_version "<sys-freebsd/freebsd-lib-${RV}"; then
4210 + # taken from sys/sys/elf_common.h
4211 + echo "#define DF_1_INTERPOSE 0x00000400" >> "${S}"/rtld-elf/rtld.h
4212 + echo "#define STT_GNU_IFUNC 10" >> "${S}"/rtld-elf/rtld.h
4213 + echo "#define R_386_IRELATIVE 42" >> "${S}"/rtld-elf/rtld.h
4214 + echo "#define PT_GNU_RELRO 0x6474e552" >> "${S}"/rtld-elf/rtld.h
4215 + echo "#define DF_1_NODEFLIB 0x00000800" >> "${S}"/rtld-elf/rtld.h
4216 + # taken from sys/sys/fcntl.h
4217 + echo "#define F_DUPFD_CLOEXEC 17" >> "${S}"/rtld-elf/rtld.h
4218 + # taken from sys/sys/cdefs.h
4219 + echo '#define __compiler_membar() __asm __volatile(" " : : : "memory")' >> "${S}"/rtld-elf/rtld.h
4220 + # taken from sys/sys/mman.h
4221 + echo '#define MAP_ALIGNED(n) ((n) << MAP_ALIGNMENT_SHIFT)' >> "${S}"/rtld-elf/rtld.h
4222 + echo '#define MAP_ALIGNMENT_SHIFT 24' >> "${S}"/rtld-elf/rtld.h
4223 + echo '#define MAP_ALIGNMENT_MASK MAP_ALIGNED(0xff)' >> "${S}"/rtld-elf/rtld.h
4224 + echo '#define MAP_ALIGNED_SUPER MAP_ALIGNED(1)' >> "${S}"/rtld-elf/rtld.h
4225 + fi
4226 +}
4227 +
4228 +setup_multilib_vars() {
4229 + if ! multilib_is_native_abi ; then
4230 + cd "${WORKDIR}/libexec/rtld-elf" || die
4231 + export mymakeopts="${mymakeopts} PROG=ld-elf32.so.1"
4232 + else
4233 + cd "${S}" || die
4234 + fi
4235 + "$@"
4236 +}
4237 +
4238 +src_compile() {
4239 + local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
4240 + multibuild_foreach_variant freebsd_multilib_multibuild_wrapper setup_multilib_vars freebsd_src_compile
4241 +}
4242 +
4243 +src_install() {
4244 + local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
4245 + multibuild_foreach_variant freebsd_multilib_multibuild_wrapper setup_multilib_vars freebsd_src_install
4246 +
4247 + insinto /etc
4248 + doins "${WORKDIR}/etc/gettytab"
4249 + newinitd "${FILESDIR}/bootpd.initd" bootpd
4250 + newconfd "${FILESDIR}/bootpd.confd" bootpd
4251 +
4252 + if use xinetd; then
4253 + for rpcd in rstatd rusersd walld rquotad sprayd; do
4254 + insinto /etc/xinetd.d
4255 + newins "${FILESDIR}/${rpcd}.xinetd" ${rpcd}
4256 + done
4257 + fi
4258 +}
4259
4260 diff --git a/sys-freebsd/freebsd-libexec/metadata.xml b/sys-freebsd/freebsd-libexec/metadata.xml
4261 new file mode 100644
4262 index 0000000..a00f3ae
4263 --- /dev/null
4264 +++ b/sys-freebsd/freebsd-libexec/metadata.xml
4265 @@ -0,0 +1,8 @@
4266 +<?xml version="1.0" encoding="UTF-8"?>
4267 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
4268 +<pkgmetadata>
4269 +<maintainer type="project">
4270 + <email>bsd@g.o</email>
4271 + <name>BSD Project</name>
4272 +</maintainer>
4273 +</pkgmetadata>
4274
4275 diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-10.2-gnu.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-10.2-gnu.patch
4276 new file mode 100644
4277 index 0000000..b88fde2
4278 --- /dev/null
4279 +++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-10.2-gnu.patch
4280 @@ -0,0 +1,63 @@
4281 +diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
4282 +index 80549d8..fd2aac5 100644
4283 +--- a/share/mk/bsd.lib.mk
4284 ++++ b/share/mk/bsd.lib.mk
4285 +@@ -173,7 +173,7 @@ _LIBS= lib${LIB}.a
4286 + lib${LIB}.a: ${OBJS} ${STATICOBJS}
4287 + @${ECHO} building static ${LIB} library
4288 + @rm -f ${.TARGET}
4289 +- @${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
4290 ++ @${AR} ${ARFLAGS} ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD}
4291 + ${RANLIB} ${RANLIBFLAGS} ${.TARGET}
4292 + .endif
4293 +
4294 +@@ -186,7 +186,7 @@ POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
4295 + lib${LIB}_p.a: ${POBJS}
4296 + @${ECHO} building profiled ${LIB} library
4297 + @rm -f ${.TARGET}
4298 +- @${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
4299 ++ @${AR} ${ARFLAGS} ${.TARGET} {POBJS} ${ARADD}
4300 + ${RANLIB} ${RANLIBFLAGS} ${.TARGET}
4301 + .endif
4302 +
4303 +@@ -215,7 +215,7 @@ ${SHLIB_NAME_FULL}: ${SOBJS}
4304 + .endif
4305 + ${_LD} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
4306 + -o ${.TARGET} -Wl,-soname,${SONAME} \
4307 +- `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
4308 ++ `echo ${SOBJS} | xargs -n 1 echo | sort -u` ${LDADD}
4309 + .if ${MK_CTF} != "no"
4310 + ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
4311 + .endif
4312 +@@ -273,13 +273,6 @@ _EXTRADEPEND:
4313 +
4314 + .if !target(install)
4315 +
4316 +-.if defined(PRECIOUSLIB)
4317 +-.if !defined(NO_FSCHG)
4318 +-SHLINSTALLFLAGS+= -fschg
4319 +-.endif
4320 +-SHLINSTALLFLAGS+= -S
4321 +-.endif
4322 +-
4323 + _INSTALLFLAGS:= ${INSTALLFLAGS}
4324 + .for ie in ${INSTALLFLAGS_EDIT}
4325 + _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
4326 +diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
4327 +index 19ad99f..46c4b09 100644
4328 +--- a/share/mk/bsd.prog.mk
4329 ++++ b/share/mk/bsd.prog.mk
4330 +@@ -179,13 +179,6 @@ _EXTRADEPEND:
4331 +
4332 + .if !target(install)
4333 +
4334 +-.if defined(PRECIOUSPROG)
4335 +-.if !defined(NO_FSCHG)
4336 +-INSTALLFLAGS+= -fschg
4337 +-.endif
4338 +-INSTALLFLAGS+= -S
4339 +-.endif
4340 +-
4341 + _INSTALLFLAGS:= ${INSTALLFLAGS}
4342 + .for ie in ${INSTALLFLAGS_EDIT}
4343 + _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
4344
4345 diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-10.3-gentoo.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-10.3-gentoo.patch
4346 new file mode 100644
4347 index 0000000..cdc244d
4348 --- /dev/null
4349 +++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-10.3-gentoo.patch
4350 @@ -0,0 +1,337 @@
4351 +diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk
4352 +index a8aa595..476b33b 100644
4353 +--- a/share/mk/bsd.doc.mk
4354 ++++ b/share/mk/bsd.doc.mk
4355 +@@ -135,10 +135,12 @@ CLEANFILES+= ${DOC}.ascii ${DOC}.ascii${DCOMPRESS_EXT} \
4356 + realinstall:
4357 + .if ${PRINTERDEVICE:Mhtml}
4358 + cd ${SRCDIR}; \
4359 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}/${VOLUME}; \
4360 + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
4361 + ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
4362 + .endif
4363 + .for _dev in ${PRINTERDEVICE:Nhtml}
4364 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}/${VOLUME}; \
4365 + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
4366 + ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}
4367 + .endfor
4368 +diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk
4369 +index 183cb1c..5b57594 100644
4370 +--- a/share/mk/bsd.files.mk
4371 ++++ b/share/mk/bsd.files.mk
4372 +@@ -40,6 +40,7 @@ ${group}NAME_${file:T}?= ${file:T}
4373 + .endif
4374 + installfiles-${group}: _${group}INS_${file:T}
4375 + _${group}INS_${file:T}: ${file}
4376 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR_${.ALLSRC:T}}
4377 + ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
4378 + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
4379 + ${.ALLSRC} \
4380 +@@ -52,10 +53,12 @@ _${group}FILES+= ${file}
4381 + installfiles-${group}: _${group}INS
4382 + _${group}INS: ${_${group}FILES}
4383 + .if defined(${group}NAME)
4384 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR}/${${group}NAME}
4385 + ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
4386 + -m ${${group}MODE} ${.ALLSRC} \
4387 + ${DESTDIR}${${group}DIR}/${${group}NAME}
4388 + .else
4389 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR}
4390 + ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
4391 + -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}
4392 + .endif
4393 +diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk
4394 +index b938221..6b98e72 100644
4395 +--- a/share/mk/bsd.incs.mk
4396 ++++ b/share/mk/bsd.incs.mk
4397 +@@ -41,6 +41,9 @@ ${group}NAME_${header:T}?= ${header:T}
4398 + .endif
4399 + installincludes: _${group}INS_${header:T}
4400 + _${group}INS_${header:T}: ${header}
4401 ++ ${INSTALL} -d -o ${${group}OWN_${.ALLSRC:T}} \
4402 ++ -g ${${group}GRP_${.ALLSRC:T}} \
4403 ++ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}
4404 + ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
4405 + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
4406 + ${.ALLSRC} \
4407 +@@ -53,9 +56,13 @@ _${group}INCS+= ${header}
4408 + installincludes: _${group}INS
4409 + _${group}INS: ${_${group}INCS}
4410 + .if defined(${group}NAME)
4411 ++ ${INSTALL} -d -o ${${group}OWN} -g ${${group}GRP} \
4412 ++ ${DESTDIR}${${group}DIR}
4413 + ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
4414 + ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
4415 + .else
4416 ++ ${INSTALL} -d -o ${${group}OWN} -g ${${group}GRP} \
4417 ++ ${DESTDIR}${${group}DIR}
4418 + ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
4419 + ${.ALLSRC} ${DESTDIR}${${group}DIR}
4420 + .endif
4421 +diff --git a/share/mk/bsd.info.mk b/share/mk/bsd.info.mk
4422 +index 6275ce3..8d32289 100644
4423 +--- a/share/mk/bsd.info.mk
4424 ++++ b/share/mk/bsd.info.mk
4425 +@@ -83,6 +83,7 @@ INFO2HTML?= info2html
4426 + TEX?= tex
4427 + DVIPS?= dvips
4428 + DVIPS2ASCII?= dvips2ascii
4429 ++INSTALL?= install
4430 +
4431 + .SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
4432 +
4433 +@@ -144,15 +145,17 @@ ${x:S/$/${ICOMPRESS_EXT}/}: ${x}
4434 + INSTALLINFODIRS+= ${x:S/$/-install/}
4435 + ${x:S/$/-install/}:
4436 + .if !empty(.MAKEFLAGS:M-j)
4437 ++ ${INSTALL} -d ${DESTDIR}${INFODIR}
4438 + lockf -k ${DESTDIR}${INFODIR}/${INFODIRFILE} \
4439 + ${INSTALLINFO} ${INSTALLINFOFLAGS} \
4440 +- --defsection=${INFOSECTION} \
4441 +- --defentry=${INFOENTRY_${x}} \
4442 ++ --section=${INFOSECTION} \
4443 ++ --entry=${INFOENTRY_${x}} \
4444 + ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
4445 + .else
4446 ++ ${INSTALL} -d ${DESTDIR}${INFODIR}
4447 + ${INSTALLINFO} ${INSTALLINFOFLAGS} \
4448 +- --defsection=${INFOSECTION} \
4449 +- --defentry=${INFOENTRY_${x}} \
4450 ++ --section=${INFOSECTION} \
4451 ++ --entry=${INFOENTRY_${x}} \
4452 + ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
4453 + .endif
4454 + .endfor
4455 +diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
4456 +index c753afe..14f74aa 100644
4457 +--- a/share/mk/bsd.lib.mk
4458 ++++ b/share/mk/bsd.lib.mk
4459 +@@ -46,8 +46,6 @@ CFLAGS+= ${DEBUG_FLAGS}
4460 + .if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
4461 + CTFFLAGS+= -g
4462 + .endif
4463 +-.else
4464 +-STRIP?= -s
4465 + .endif
4466 +
4467 + .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
4468 +@@ -296,14 +294,17 @@ realinstall: _libinstall
4469 + .ORDER: beforeinstall _libinstall
4470 + _libinstall:
4471 + .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
4472 ++ ${INSTALL} -d ${DESTDIR}${_LIBDIR}
4473 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4474 + ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${_LIBDIR}
4475 + .endif
4476 + .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
4477 ++ ${INSTALL} -d ${DESTDIR}${_LIBDIR}
4478 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4479 + ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${_LIBDIR}
4480 + .endif
4481 + .if defined(SHLIB_NAME)
4482 ++ ${INSTALL} -d ${DESTDIR}${_SHLIBDIR}
4483 + ${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4484 + ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
4485 + ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}
4486 +@@ -357,10 +358,12 @@ _libinstall:
4487 + .endif # SHLIB_LINK
4488 + .endif # SHIB_NAME
4489 + .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
4490 ++ ${INSTALL} -d ${DESTDIR}${_LIBDIR}
4491 + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4492 + ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}
4493 + .endif
4494 + .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB)
4495 ++ ${INSTALL} -d ${DESTDIR}${LINTLIBDIR}
4496 + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4497 + ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
4498 + .endif
4499 +diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
4500 +index c097c77..c2994d8 100644
4501 +--- a/share/mk/bsd.libnames.mk
4502 ++++ b/share/mk/bsd.libnames.mk
4503 +@@ -51,7 +51,7 @@ LIBELF?= ${DESTDIR}${LIBDIR}/libelf.a
4504 + LIBEXECINFO?= ${DESTDIR}${LIBDIR}/libexecinfo.a
4505 + LIBFETCH?= ${DESTDIR}${LIBDIR}/libfetch.a
4506 + LIBFIGPAR?= ${DESTDIR}${LIBDIR}/libfigpar.a
4507 +-LIBFL?= "don't use LIBFL, use LIBL"
4508 ++LIBFL?= ${DESTDIR}${LIBDIR}/libfl.a
4509 + LIBFORM?= ${DESTDIR}${LIBDIR}/libform.a
4510 + LIBG2C?= ${DESTDIR}${LIBDIR}/libg2c.a
4511 + LIBGCC?= ${DESTDIR}${LIBDIR}/libgcc.a
4512 +@@ -81,7 +81,7 @@ LIBKEYCAP?= ${DESTDIR}${LIBDIR}/libkeycap.a
4513 + LIBKICONV?= ${DESTDIR}${LIBDIR}/libkiconv.a
4514 + LIBKRB5?= ${DESTDIR}${LIBDIR}/libkrb5.a
4515 + LIBKVM?= ${DESTDIR}${LIBDIR}/libkvm.a
4516 +-LIBL?= ${DESTDIR}${LIBDIR}/libl.a
4517 ++LIBL?= ${DESTDIR}${LIBDIR}/libfl.a
4518 + .if ${MK_LDNS} != "no"
4519 + LIBLDNS?= ${DESTDIR}${LIBPRIVATEDIR}/libldns.a
4520 + .endif
4521 +diff --git a/share/mk/bsd.links.mk b/share/mk/bsd.links.mk
4522 +index 574f0f5..b63b117 100644
4523 +--- a/share/mk/bsd.links.mk
4524 ++++ b/share/mk/bsd.links.mk
4525 +@@ -15,6 +15,8 @@ _installlinks:
4526 + t=${DESTDIR}$$1; \
4527 + shift; \
4528 + ${ECHO} $$t -\> $$l; \
4529 ++ d=`dirname $$t`; \
4530 ++ test -d $$d || mkdir $$d; \
4531 + ${INSTALL_LINK} $$l $$t; \
4532 + done; true
4533 + .endif
4534 +@@ -26,6 +28,8 @@ _installlinks:
4535 + t=${DESTDIR}$$1; \
4536 + shift; \
4537 + ${ECHO} $$t -\> $$l; \
4538 ++ d=`dirname $$t`; \
4539 ++ test -d $$d || mkdir $$d; \
4540 + ${INSTALL_SYMLINK} $$l $$t; \
4541 + done; true
4542 + .endif
4543 +diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
4544 +index 0212d3a..6435936 100644
4545 +--- a/share/mk/bsd.man.mk
4546 ++++ b/share/mk/bsd.man.mk
4547 +@@ -165,9 +165,11 @@ _maninstall: ${MAN}
4548 + .if defined(NO_MANCOMPRESS)
4549 + .if defined(MANFILTER)
4550 + .for __page in ${MAN}
4551 ++ ${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}/${page}
4552 + ${MINSTALL} ${__page:T:S/$/${FILTEXTENSION}/g} \
4553 + ${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}/${__page}
4554 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
4555 ++ ${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page}
4556 + ${MINSTALL} ${__page:T:S/$/${CATEXT}${FILTEXTENSION}/g} \
4557 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page}
4558 + .endif
4559 +@@ -181,11 +183,14 @@ _maninstall: ${MAN}
4560 + esac; \
4561 + page=$$1; shift; sect=$$1; shift; \
4562 + d=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}; \
4563 ++ ${ECHO} ${INSTALL} -d $${d}; \
4564 ++ ${INSTALL} -d $${d}; \
4565 + ${ECHO} ${MINSTALL} $${page} $${d}; \
4566 + ${MINSTALL} $${page} $${d}; \
4567 + done
4568 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
4569 + .for __page in ${MAN}
4570 ++ ${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page:T}
4571 + ${MINSTALL} ${__page:T:S/$/${CATEXT}/} \
4572 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T}
4573 + .endfor
4574 +@@ -193,9 +198,11 @@ _maninstall: ${MAN}
4575 + .endif
4576 + .else
4577 + .for __page in ${MAN}
4578 ++ ${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}
4579 + ${MINSTALL} ${__page:T:S/$/${MCOMPRESS_EXT}/g} \
4580 + ${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}
4581 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
4582 ++ ${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page:T:S/$/${MCOMPRESS_EXT}
4583 + ${MINSTALL} ${__page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} \
4584 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T:S/$/${MCOMPRESS_EXT}/}
4585 + .endif
4586 +diff --git a/share/mk/bsd.nls.mk b/share/mk/bsd.nls.mk
4587 +index 28255ea..2bc6546 100644
4588 +--- a/share/mk/bsd.nls.mk
4589 ++++ b/share/mk/bsd.nls.mk
4590 +@@ -62,7 +62,8 @@ NLSDIR?= ${SHAREDIR}/nls
4591 + # installation rules
4592 + #
4593 + .for file in ${NLS}
4594 +-NLSNAME_${file:T}= ${file:T:R}/${NLSNAME}.cat
4595 ++NLSDIR_${file:T}= ${SHAREDIR}/nls/${file:T:R}/
4596 ++NLSNAME_${file:T}= ${NLSNAME}.cat
4597 + .if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R})
4598 + NLSLINKS+= ${file:R}
4599 + .endif
4600 +diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
4601 +index 73de02d..c6c30ca 100644
4602 +--- a/share/mk/bsd.own.mk
4603 ++++ b/share/mk/bsd.own.mk
4604 +@@ -206,9 +206,6 @@ INSTALL_LINK?= ${INSTALL} ${HRDLINK}
4605 + INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK}
4606 +
4607 + # Common variables
4608 +-.if !defined(DEBUG_FLAGS)
4609 +-STRIP?= -s
4610 +-.endif
4611 +
4612 + COMPRESS_CMD?= gzip -cn
4613 + COMPRESS_EXT?= .gz
4614 +diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
4615 +index d6d0fa5..93a9046 100644
4616 +--- a/share/mk/bsd.prog.mk
4617 ++++ b/share/mk/bsd.prog.mk
4618 +@@ -42,10 +42,6 @@ CTFFLAGS+= -g
4619 + .endif
4620 + .endif
4621 +
4622 +-.if !defined(DEBUG_FLAGS)
4623 +-STRIP?= -s
4624 +-.endif
4625 +-
4626 + .if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
4627 + LDFLAGS+= -static
4628 + .endif
4629 +@@ -200,6 +196,7 @@ realinstall: _proginstall
4630 + .ORDER: beforeinstall _proginstall
4631 + _proginstall:
4632 + .if defined(PROG)
4633 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}
4634 + ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
4635 + ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
4636 + .if ${MK_DEBUG_FILES} != "no"
4637 +@@ -233,6 +230,7 @@ SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP}
4638 + SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE}
4639 + _scriptsinstall: _SCRIPTSINS_${script:T}
4640 + _SCRIPTSINS_${script:T}: ${script}
4641 ++ ${INSTALL} -d ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}
4642 + ${INSTALL} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
4643 + -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
4644 + ${.ALLSRC} \
4645 +diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
4646 +index fee6ccc..c2fe39a 100644
4647 +--- a/share/mk/bsd.sys.mk
4648 ++++ b/share/mk/bsd.sys.mk
4649 +@@ -30,10 +30,6 @@ CFLAGS+= -std=${CSTD}
4650 + .if defined(WARNS)
4651 + .if ${WARNS} >= 1
4652 + CWARNFLAGS+= -Wsystem-headers
4653 +-.if !defined(NO_WERROR) && (${COMPILER_TYPE} != "clang" \
4654 +- || !defined(NO_WERROR.clang))
4655 +-CWARNFLAGS+= -Werror
4656 +-.endif # !NO_WERROR && (!CLANG || !NO_WERROR.clang)
4657 + .endif # WARNS >= 1
4658 + .if ${WARNS} >= 2
4659 + CWARNFLAGS+= -Wall -Wno-format-y2k
4660 +@@ -102,10 +98,6 @@ CWARNFLAGS+= -Wformat=2 -Wno-format-extra-args
4661 + CWARNFLAGS+= -Wno-format-nonliteral
4662 + .endif # WARNS <= 3
4663 + .endif # CLANG
4664 +-.if !defined(NO_WERROR) && (${COMPILER_TYPE} != "clang" \
4665 +- || !defined(NO_WERROR.clang))
4666 +-CWARNFLAGS+= -Werror
4667 +-.endif # !NO_WERROR && (!CLANG || !NO_WERROR.clang)
4668 + .endif # WFORMAT > 0
4669 + .endif # WFORMAT
4670 + .if defined(NO_WFORMAT) || (${COMPILER_TYPE} == "clang" && defined(NO_WFORMAT.clang))
4671 +diff --git a/share/mk/sys.mk b/share/mk/sys.mk
4672 +index c270260..68491ce 100644
4673 +--- a/share/mk/sys.mk
4674 ++++ b/share/mk/sys.mk
4675 +@@ -327,12 +327,6 @@ YFLAGS ?= -d
4676 + rm -f ${.PREFIX}.tmp.c
4677 + ${CTFCONVERT_CMD}
4678 +
4679 +-# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef.
4680 +-__MAKE_CONF?=/etc/make.conf
4681 +-.if exists(${__MAKE_CONF})
4682 +-.include "${__MAKE_CONF}"
4683 +-.endif
4684 +-
4685 + .if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL)
4686 + SHELL= ${__MAKE_SHELL}
4687 + .SHELL: path=${__MAKE_SHELL}
4688
4689 diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-8.0-gentoo.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-8.0-gentoo.patch
4690 new file mode 100644
4691 index 0000000..f17f6c4
4692 --- /dev/null
4693 +++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-8.0-gentoo.patch
4694 @@ -0,0 +1,332 @@
4695 +Index: share/mk/bsd.doc.mk
4696 +===================================================================
4697 +--- share/mk/bsd.doc.mk.orig
4698 ++++ share/mk/bsd.doc.mk
4699 +@@ -137,10 +137,12 @@ CLEANFILES+= ${DOC}.ascii ${DOC}.ascii${
4700 + realinstall:
4701 + .for _dev in ${PRINTERDEVICE:Mhtml}
4702 + cd ${SRCDIR}; \
4703 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}/${VOLUME}
4704 + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
4705 + ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
4706 + .endfor
4707 + .for _dev in ${PRINTERDEVICE:Nhtml}
4708 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}/${VOLUME}
4709 + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
4710 + ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}
4711 + .endfor
4712 +Index: share/mk/bsd.files.mk
4713 +===================================================================
4714 +--- share/mk/bsd.files.mk.orig
4715 ++++ share/mk/bsd.files.mk
4716 +@@ -39,6 +39,7 @@ ${group}NAME_${file:T}?= ${file:T}
4717 + .endif
4718 + installfiles: _${group}INS_${file:T}
4719 + _${group}INS_${file:T}: ${file}
4720 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR_${.ALLSRC}}/${${group}NAME_${.ALLSRC:T}:H}
4721 + ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
4722 + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
4723 + ${.ALLSRC} \
4724 +@@ -51,10 +52,12 @@ _${group}FILES+= ${file}
4725 + installfiles: _${group}INS
4726 + _${group}INS: ${_${group}FILES}
4727 + .if defined(${group}NAME)
4728 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR}/${${group}NAME}
4729 + ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
4730 + -m ${${group}MODE} ${.ALLSRC} \
4731 + ${DESTDIR}${${group}DIR}/${${group}NAME}
4732 + .else
4733 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR}
4734 + ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
4735 + -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}
4736 + .endif
4737 +Index: share/mk/bsd.incs.mk
4738 +===================================================================
4739 +--- share/mk/bsd.incs.mk.orig
4740 ++++ share/mk/bsd.incs.mk
4741 +@@ -41,6 +41,10 @@ ${group}NAME_${header:T}?= ${header:T}
4742 + .endif
4743 + installincludes: _${group}INS_${header:T}
4744 + _${group}INS_${header:T}: ${header}
4745 ++
4746 ++ ${INSTALL} -d -o ${${group}OWN_${.ALLSRC:T}} \
4747 ++ -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
4748 ++ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
4749 + ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
4750 + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
4751 + ${.ALLSRC} \
4752 +@@ -53,9 +57,11 @@ _${group}INCS+= ${header}
4753 + installincludes: _${group}INS
4754 + _${group}INS: ${_${group}INCS}
4755 + .if defined(${group}NAME)
4756 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR}
4757 + ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
4758 + ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
4759 + .else
4760 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR}
4761 + ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
4762 + ${.ALLSRC} ${DESTDIR}${${group}DIR}
4763 + .endif
4764 +Index: share/mk/bsd.info.mk
4765 +===================================================================
4766 +--- share/mk/bsd.info.mk.orig
4767 ++++ share/mk/bsd.info.mk
4768 +@@ -83,6 +83,7 @@ INFO2HTML?= info2html
4769 + TEX?= tex
4770 + DVIPS?= dvips
4771 + DVIPS2ASCII?= dvips2ascii
4772 ++INSTALL?= install
4773 +
4774 + .SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
4775 +
4776 +@@ -144,12 +145,14 @@ ${x:S/$/${ICOMPRESS_EXT}/}: ${x}
4777 + INSTALLINFODIRS+= ${x:S/$/-install/}
4778 + ${x:S/$/-install/}:
4779 + .if !empty(.MAKEFLAGS:M-j)
4780 ++ ${INSTALL} -d ${DESTDIR}${INFODIR}/${INFODIRFILE}
4781 + lockf -k ${DESTDIR}${INFODIR}/${INFODIRFILE} \
4782 + ${INSTALLINFO} ${INSTALLINFOFLAGS} \
4783 + --defsection=${INFOSECTION} \
4784 + --defentry=${INFOENTRY_${x}} \
4785 + ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
4786 + .else
4787 ++ ${INSTALL} -d ${DESTDIR}${INFODIR}/${INFODIRFILE}
4788 + ${INSTALLINFO} ${INSTALLINFOFLAGS} \
4789 + --defsection=${INFOSECTION} \
4790 + --defentry=${INFOENTRY_${x}} \
4791 +Index: share/mk/bsd.lib.mk
4792 +===================================================================
4793 +--- share/mk/bsd.lib.mk.orig
4794 ++++ share/mk/bsd.lib.mk
4795 +@@ -41,10 +41,6 @@ CTFFLAGS+= -g
4796 + .endif
4797 + .endif
4798 +
4799 +-.if !defined(DEBUG_FLAGS)
4800 +-STRIP?= -s
4801 +-.endif
4802 +-
4803 + .include <bsd.libnames.mk>
4804 +
4805 + # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
4806 +@@ -276,14 +272,17 @@ realinstall: _libinstall
4807 + .ORDER: beforeinstall _libinstall
4808 + _libinstall:
4809 + .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
4810 ++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
4811 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4812 + ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
4813 + .endif
4814 + .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
4815 ++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
4816 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4817 + ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
4818 + .endif
4819 + .if defined(SHLIB_NAME)
4820 ++ ${INSTALL} -d ${DESTDIR}${SHLIBDIR}
4821 + ${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4822 + ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
4823 + ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
4824 +Index: share/mk/bsd.libnames.mk
4825 +===================================================================
4826 +--- share/mk/bsd.libnames.mk.orig
4827 ++++ share/mk/bsd.libnames.mk
4828 +@@ -46,7 +46,7 @@ LIBDWARF?= ${DESTDIR}${LIBDIR}/libdwarf.
4829 + LIBEDIT?= ${DESTDIR}${LIBDIR}/libedit.a
4830 + LIBELF?= ${DESTDIR}${LIBDIR}/libelf.a
4831 + LIBFETCH?= ${DESTDIR}${LIBDIR}/libfetch.a
4832 +-LIBFL?= "don't use LIBFL, use LIBL"
4833 ++LIBFL?= ${DESTDIR}${LIBDOR}/libfl.a
4834 + LIBFORM?= ${DESTDIR}${LIBDIR}/libform.a
4835 + LIBFTPIO?= ${DESTDIR}${LIBDIR}/libftpio.a
4836 + LIBG2C?= ${DESTDIR}${LIBDIR}/libg2c.a
4837 +@@ -77,7 +77,7 @@ LIBKEYCAP?= ${DESTDIR}${LIBDIR}/libkeyca
4838 + LIBKICONV?= ${DESTDIR}${LIBDIR}/libkiconv.a
4839 + LIBKRB5?= ${DESTDIR}${LIBDIR}/libkrb5.a
4840 + LIBKVM?= ${DESTDIR}${LIBDIR}/libkvm.a
4841 +-LIBL?= ${DESTDIR}${LIBDIR}/libl.a
4842 ++LIBL?= ${DESTDIR}${LIBDOR}/libfl.a
4843 + LIBLN?= "don't use LIBLN, use LIBL"
4844 + .if ${MK_BIND} != "no"
4845 + LIBLWRES?= ${DESTDIR}${LIBDIR}/liblwres.a
4846 +Index: share/mk/bsd.man.mk
4847 +===================================================================
4848 +--- share/mk/bsd.man.mk.orig
4849 ++++ share/mk/bsd.man.mk
4850 +@@ -165,9 +165,11 @@ _maninstall: ${MAN}
4851 + .if defined(NO_MANCOMPRESS)
4852 + .if defined(MANFILTER)
4853 + .for __page in ${MAN}
4854 ++ ${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}/${page}
4855 + ${MINSTALL} ${__page:T:S/$/${FILTEXTENSION}/g} \
4856 + ${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}/${__page}
4857 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
4858 ++ ${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}/${page}
4859 + ${MINSTALL} ${__page:T:S/$/${CATEXT}${FILTEXTENSION}/g} \
4860 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page}
4861 + .endif
4862 +@@ -181,11 +183,14 @@ _maninstall: ${MAN}
4863 + esac; \
4864 + page=$$1; shift; sect=$$1; shift; \
4865 + d=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}; \
4866 ++ ${ECHO} ${INSTALL} -d $${d}; \
4867 ++ ${INSTALL} -d $${d}; \
4868 + ${ECHO} ${MINSTALL} $${page} $${d}; \
4869 + ${MINSTALL} $${page} $${d}; \
4870 + done
4871 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
4872 + .for __page in ${MAN}
4873 ++ ${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page:T}
4874 + ${MINSTALL} ${__page:T:S/$/${CATEXT}/} \
4875 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T}
4876 + .endfor
4877 +@@ -193,9 +198,11 @@ _maninstall: ${MAN}
4878 + .endif
4879 + .else
4880 + .for __page in ${MAN}
4881 ++ ${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}
4882 + ${MINSTALL} ${__page:T:S/$/${MCOMPRESS_EXT}/g} \
4883 + ${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}
4884 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
4885 ++ ${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page:T:S/$/${MCOMPRESS_EXT}/}
4886 + ${MINSTALL} ${__page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} \
4887 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T:S/$/${MCOMPRESS_EXT}/}
4888 + .endif
4889 +Index: share/mk/bsd.prog.mk
4890 +===================================================================
4891 +--- share/mk/bsd.prog.mk.orig
4892 ++++ share/mk/bsd.prog.mk
4893 +@@ -27,10 +27,6 @@ CTFFLAGS+= -g
4894 + CFLAGS+=${CRUNCH_CFLAGS}
4895 + .endif
4896 +
4897 +-.if !defined(DEBUG_FLAGS)
4898 +-STRIP?= -s
4899 +-.endif
4900 +-
4901 + .if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
4902 + LDFLAGS+= -static
4903 + .endif
4904 +@@ -152,9 +148,11 @@ realinstall: _proginstall
4905 + _proginstall:
4906 + .if defined(PROG)
4907 + .if defined(PROGNAME)
4908 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}
4909 + ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
4910 + ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
4911 + .else
4912 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}
4913 + ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
4914 + ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
4915 + .endif
4916 +@@ -182,6 +180,7 @@ SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP}
4917 + SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE}
4918 + _scriptsinstall: _SCRIPTSINS_${script:T}
4919 + _SCRIPTSINS_${script:T}: ${script}
4920 ++ ${INSTALL} -d ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}
4921 + ${INSTALL} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
4922 + -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
4923 + ${.ALLSRC} \
4924 +Index: share/mk/bsd.sys.mk
4925 +===================================================================
4926 +--- share/mk/bsd.sys.mk.orig
4927 ++++ share/mk/bsd.sys.mk
4928 +@@ -28,9 +28,6 @@ CFLAGS += -std=${CSTD}
4929 + . if defined(WARNS)
4930 + . if ${WARNS} >= 1
4931 + CWARNFLAGS += -Wsystem-headers
4932 +-. if !defined(NO_WERROR)
4933 +-CWARNFLAGS += -Werror
4934 +-. endif
4935 + . endif
4936 + . if ${WARNS} >= 2
4937 + CWARNFLAGS += -Wall -Wno-format-y2k
4938 +@@ -64,9 +61,6 @@ WFORMAT = 1
4939 + . if ${WFORMAT} > 0
4940 + #CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
4941 + CWARNFLAGS += -Wformat=2 -Wno-format-extra-args
4942 +-. if !defined(NO_WERROR)
4943 +-CWARNFLAGS += -Werror
4944 +-. endif
4945 + . endif
4946 + . endif
4947 + .endif
4948 +Index: share/mk/bsd.links.mk
4949 +===================================================================
4950 +--- share/mk/bsd.links.mk.orig
4951 ++++ share/mk/bsd.links.mk
4952 +@@ -15,6 +15,8 @@ _installlinks:
4953 + t=${DESTDIR}$$1; \
4954 + shift; \
4955 + ${ECHO} $$t -\> $$l; \
4956 ++ d=`dirname $$t`; \
4957 ++ test -d $$d || mkdir $$d; \
4958 + ln -f $$l $$t; \
4959 + done; true
4960 + .endif
4961 +@@ -26,6 +28,8 @@ _installlinks:
4962 + t=${DESTDIR}$$1; \
4963 + shift; \
4964 + ${ECHO} $$t -\> $$l; \
4965 ++ d=`dirname $$t`; \
4966 ++ test -d $$d || mkdir $$d; \
4967 + ln -fs $$l $$t; \
4968 + done; true
4969 + .endif
4970 +Index: share/mk/bsd.own.mk
4971 +===================================================================
4972 +--- share/mk/bsd.own.mk.orig
4973 ++++ share/mk/bsd.own.mk
4974 +@@ -164,11 +164,6 @@ NLSMODE?= ${NOBINMODE}
4975 +
4976 + INCLUDEDIR?= /usr/include
4977 +
4978 +-# Common variables
4979 +-.if !defined(DEBUG_FLAGS)
4980 +-STRIP?= -s
4981 +-.endif
4982 +-
4983 + COMPRESS_CMD?= gzip -cn
4984 + COMPRESS_EXT?= .gz
4985 +
4986 +Index: share/mk/sys.mk
4987 +===================================================================
4988 +--- share/mk/sys.mk.orig
4989 ++++ share/mk/sys.mk
4990 +@@ -34,11 +34,11 @@ AFLAGS ?=
4991 + CC ?= c89
4992 + CFLAGS ?= -O
4993 + .else
4994 +-CC ?= cc
4995 ++CC ?= gcc
4996 + .if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "mips"
4997 +-CFLAGS ?= -O -pipe
4998 ++CFLAGS ?= -pipe
4999 + .else
5000 +-CFLAGS ?= -O2 -pipe
5001 ++CFLAGS ?= -pipe
5002 + .endif
5003 + .if defined(NO_STRICT_ALIASING)
5004 + CFLAGS += -fno-strict-aliasing
5005 +@@ -64,7 +64,7 @@ CFLAGS += -g
5006 + .endif
5007 + .endif
5008 +
5009 +-CXX ?= c++
5010 ++CXX ?= g++
5011 + CXXFLAGS ?= ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign}
5012 +
5013 + CPP ?= cpp
5014 +@@ -333,12 +333,6 @@ YFLAGS ?= -d
5015 + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
5016 + .endif
5017 +
5018 +-# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef.
5019 +-__MAKE_CONF?=/etc/make.conf
5020 +-.if exists(${__MAKE_CONF})
5021 +-.include "${__MAKE_CONF}"
5022 +-.endif
5023 +-
5024 + .if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL)
5025 + SHELL= ${__MAKE_SHELL}
5026 + .SHELL: path=${__MAKE_SHELL}
5027
5028 diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-8.0-gnu.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-8.0-gnu.patch
5029 new file mode 100644
5030 index 0000000..41c4de4
5031 --- /dev/null
5032 +++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-8.0-gnu.patch
5033 @@ -0,0 +1,121 @@
5034 +Index: mk/bsd.incs.mk
5035 +===================================================================
5036 +--- mk/bsd.incs.mk.orig
5037 ++++ mk/bsd.incs.mk
5038 +@@ -45,7 +45,7 @@ _${group}INS_${header:T}: ${header}
5039 + ${INSTALL} -d -o ${${group}OWN_${.ALLSRC:T}} \
5040 + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
5041 + ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
5042 +- ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
5043 ++ ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
5044 + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
5045 + ${.ALLSRC} \
5046 + ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
5047 +@@ -58,11 +58,11 @@ installincludes: _${group}INS
5048 + _${group}INS: ${_${group}INCS}
5049 + .if defined(${group}NAME)
5050 + ${INSTALL} -d ${DESTDIR}${${group}DIR}
5051 +- ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
5052 ++ ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
5053 + ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
5054 + .else
5055 + ${INSTALL} -d ${DESTDIR}${${group}DIR}
5056 +- ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
5057 ++ ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
5058 + ${.ALLSRC} ${DESTDIR}${${group}DIR}
5059 + .endif
5060 + .endif
5061 +Index: mk/bsd.lib.mk
5062 +===================================================================
5063 +--- mk/bsd.lib.mk.orig
5064 ++++ mk/bsd.lib.mk
5065 +@@ -156,11 +156,7 @@ _LIBS= lib${LIB}.a
5066 + lib${LIB}.a: ${OBJS} ${STATICOBJS}
5067 + @${ECHO} building static ${LIB} library
5068 + @rm -f ${.TARGET}
5069 +-.if !defined(NM)
5070 +- @${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
5071 +-.else
5072 +- @${AR} cq ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
5073 +-.endif
5074 ++ @${AR} cq ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD}
5075 + ${RANLIB} ${.TARGET}
5076 + .endif
5077 +
5078 +@@ -173,11 +169,7 @@ POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=
5079 + lib${LIB}_p.a: ${POBJS}
5080 + @${ECHO} building profiled ${LIB} library
5081 + @rm -f ${.TARGET}
5082 +-.if !defined(NM)
5083 +- @${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD}
5084 +-.else
5085 +- @${AR} cq ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
5086 +-.endif
5087 ++ @${AR} cq ${.TARGET} ${POBJS} ${ARADD}
5088 + ${RANLIB} ${.TARGET}
5089 + .endif
5090 +
5091 +@@ -195,15 +187,9 @@ ${SHLIB_NAME}: ${SOBJS}
5092 + .if defined(SHLIB_LINK)
5093 + @ln -fs ${.TARGET} ${SHLIB_LINK}
5094 + .endif
5095 +-.if !defined(NM)
5096 +- @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \
5097 +- -o ${.TARGET} -Wl,-soname,${SONAME} \
5098 +- `lorder ${SOBJS} | tsort -q` ${LDADD}
5099 +-.else
5100 + @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \
5101 + -o ${.TARGET} -Wl,-soname,${SONAME} \
5102 +- `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
5103 +-.endif
5104 ++ `echo ${SOBJS} | xargs -n 1 echo | sort -u` ${LDADD}
5105 + .if defined(CTFMERGE)
5106 + ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
5107 + .endif
5108 +@@ -251,13 +237,6 @@ _EXTRADEPEND:
5109 +
5110 + .if !target(install)
5111 +
5112 +-.if defined(PRECIOUSLIB)
5113 +-.if !defined(NO_FSCHG)
5114 +-SHLINSTALLFLAGS+= -fschg
5115 +-.endif
5116 +-SHLINSTALLFLAGS+= -S
5117 +-.endif
5118 +-
5119 + _INSTALLFLAGS:= ${INSTALLFLAGS}
5120 + .for ie in ${INSTALLFLAGS_EDIT}
5121 + _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
5122 +@@ -273,12 +252,12 @@ realinstall: _libinstall
5123 + _libinstall:
5124 + .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
5125 + ${INSTALL} -d ${DESTDIR}${LIBDIR}
5126 +- ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5127 ++ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5128 + ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
5129 + .endif
5130 + .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
5131 + ${INSTALL} -d ${DESTDIR}${LIBDIR}
5132 +- ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5133 ++ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5134 + ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
5135 + .endif
5136 + .if defined(SHLIB_NAME)
5137 +Index: mk/bsd.prog.mk
5138 +===================================================================
5139 +--- mk/bsd.prog.mk.orig
5140 ++++ mk/bsd.prog.mk
5141 +@@ -130,13 +130,6 @@ _EXTRADEPEND:
5142 +
5143 + .if !target(install)
5144 +
5145 +-.if defined(PRECIOUSPROG)
5146 +-.if !defined(NO_FSCHG)
5147 +-INSTALLFLAGS+= -fschg
5148 +-.endif
5149 +-INSTALLFLAGS+= -S
5150 +-.endif
5151 +-
5152 + _INSTALLFLAGS:= ${INSTALLFLAGS}
5153 + .for ie in ${INSTALLFLAGS_EDIT}
5154 + _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
5155
5156 diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.1-gentoo.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.1-gentoo.patch
5157 new file mode 100644
5158 index 0000000..598d0b9
5159 --- /dev/null
5160 +++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.1-gentoo.patch
5161 @@ -0,0 +1,326 @@
5162 +diff -Nur share.orig/mk/bsd.doc.mk share/mk/bsd.doc.mk
5163 +--- share.orig/mk/bsd.doc.mk 2012-07-12 13:25:44.000000000 +0900
5164 ++++ share/mk/bsd.doc.mk 2012-07-16 00:01:55.000000000 +0900
5165 +@@ -135,10 +135,12 @@
5166 + realinstall:
5167 + .for _dev in ${PRINTERDEVICE:Mhtml}
5168 + cd ${SRCDIR}; \
5169 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}/${VOLUME}; \
5170 + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
5171 + ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME}
5172 + .endfor
5173 + .for _dev in ${PRINTERDEVICE:Nhtml}
5174 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}/${VOLUME}; \
5175 + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
5176 + ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME}
5177 + .endfor
5178 +diff -Nur share.orig/mk/bsd.files.mk share/mk/bsd.files.mk
5179 +--- share.orig/mk/bsd.files.mk 2012-07-12 13:25:44.000000000 +0900
5180 ++++ share/mk/bsd.files.mk 2012-07-16 00:01:55.000000000 +0900
5181 +@@ -39,6 +39,7 @@
5182 + .endif
5183 + installfiles: _${group}INS_${file:T}
5184 + _${group}INS_${file:T}: ${file}
5185 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR_${.ALLSRC:T}}
5186 + ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
5187 + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
5188 + ${.ALLSRC} \
5189 +@@ -51,10 +52,12 @@
5190 + installfiles: _${group}INS
5191 + _${group}INS: ${_${group}FILES}
5192 + .if defined(${group}NAME)
5193 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR}/${${group}NAME}
5194 + ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
5195 + -m ${${group}MODE} ${.ALLSRC} \
5196 + ${DESTDIR}${${group}DIR}/${${group}NAME}
5197 + .else
5198 ++ ${INSTALL} -d ${DESTDIR}${${group}DIR}
5199 + ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
5200 + -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}
5201 + .endif
5202 +diff -Nur share.orig/mk/bsd.incs.mk share/mk/bsd.incs.mk
5203 +--- share.orig/mk/bsd.incs.mk 2012-07-12 13:25:44.000000000 +0900
5204 ++++ share/mk/bsd.incs.mk 2012-07-16 00:01:55.000000000 +0900
5205 +@@ -41,6 +41,9 @@
5206 + .endif
5207 + installincludes: _${group}INS_${header:T}
5208 + _${group}INS_${header:T}: ${header}
5209 ++ ${INSTALL} -d -o ${${group}OWN_${.ALLSRC:T}} \
5210 ++ -g ${${group}GRP_${.ALLSRC:T}} \
5211 ++ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}
5212 + ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
5213 + -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
5214 + ${.ALLSRC} \
5215 +@@ -53,9 +56,13 @@
5216 + installincludes: _${group}INS
5217 + _${group}INS: ${_${group}INCS}
5218 + .if defined(${group}NAME)
5219 ++ ${INSTALL} -d -o ${${group}OWN} -g ${${group}GRP} \
5220 ++ ${DESTDIR}${${group}DIR}
5221 + ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
5222 + ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
5223 + .else
5224 ++ ${INSTALL} -d -o ${${group}OWN} -g ${${group}GRP} \
5225 ++ ${DESTDIR}${${group}DIR}
5226 + ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
5227 + ${.ALLSRC} ${DESTDIR}${${group}DIR}
5228 + .endif
5229 +diff -Nur share.orig/mk/bsd.info.mk share/mk/bsd.info.mk
5230 +--- share.orig/mk/bsd.info.mk 2012-07-12 13:25:44.000000000 +0900
5231 ++++ share/mk/bsd.info.mk 2012-07-16 00:01:55.000000000 +0900
5232 +@@ -83,6 +83,7 @@
5233 + TEX?= tex
5234 + DVIPS?= dvips
5235 + DVIPS2ASCII?= dvips2ascii
5236 ++INSTALL?= install
5237 +
5238 + .SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
5239 +
5240 +@@ -144,15 +145,17 @@
5241 + INSTALLINFODIRS+= ${x:S/$/-install/}
5242 + ${x:S/$/-install/}:
5243 + .if !empty(.MAKEFLAGS:M-j)
5244 ++ ${INSTALL} -d ${DESTDIR}${INFODIR}
5245 + lockf -k ${DESTDIR}${INFODIR}/${INFODIRFILE} \
5246 + ${INSTALLINFO} ${INSTALLINFOFLAGS} \
5247 +- --defsection=${INFOSECTION} \
5248 +- --defentry=${INFOENTRY_${x}} \
5249 ++ --section=${INFOSECTION} \
5250 ++ --entry=${INFOENTRY_${x}} \
5251 + ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
5252 + .else
5253 ++ ${INSTALL} -d ${DESTDIR}${INFODIR}
5254 + ${INSTALLINFO} ${INSTALLINFOFLAGS} \
5255 +- --defsection=${INFOSECTION} \
5256 +- --defentry=${INFOENTRY_${x}} \
5257 ++ --section=${INFOSECTION} \
5258 ++ --entry=${INFOENTRY_${x}} \
5259 + ${x}.info ${DESTDIR}${INFODIR}/${INFODIRFILE}
5260 + .endif
5261 + .endfor
5262 +diff -Nur share.orig/mk/bsd.lib.mk share/mk/bsd.lib.mk
5263 +--- share.orig/mk/bsd.lib.mk 2012-07-12 13:25:44.000000000 +0900
5264 ++++ share/mk/bsd.lib.mk 2012-07-16 00:01:55.000000000 +0900
5265 +@@ -46,10 +46,6 @@
5266 + .endif
5267 + .endif
5268 +
5269 +-.if !defined(DEBUG_FLAGS)
5270 +-STRIP?= -s
5271 +-.endif
5272 +-
5273 + .include <bsd.libnames.mk>
5274 +
5275 + # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
5276 +@@ -284,14 +280,17 @@
5277 + .ORDER: beforeinstall _libinstall
5278 + _libinstall:
5279 + .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
5280 ++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
5281 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5282 + ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
5283 + .endif
5284 + .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
5285 ++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
5286 + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5287 + ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
5288 + .endif
5289 + .if defined(SHLIB_NAME)
5290 ++ ${INSTALL} -d ${DESTDIR}${SHLIBDIR}
5291 + ${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5292 + ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
5293 + ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
5294 +@@ -329,10 +328,12 @@
5295 + .endif # SHLIB_LINK
5296 + .endif # SHIB_NAME
5297 + .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
5298 ++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
5299 + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5300 + ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
5301 + .endif
5302 + .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB)
5303 ++ ${INSTALL} -d ${DESTDIR}${LINTLIBDIR}
5304 + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
5305 + ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
5306 + .endif
5307 +diff -Nur share.orig/mk/bsd.libnames.mk share/mk/bsd.libnames.mk
5308 +--- share.orig/mk/bsd.libnames.mk 2012-07-12 13:25:44.000000000 +0900
5309 ++++ share/mk/bsd.libnames.mk 2012-07-16 00:01:55.000000000 +0900
5310 +@@ -48,7 +48,7 @@
5311 + LIBEDIT?= ${DESTDIR}${LIBDIR}/libedit.a
5312 + LIBELF?= ${DESTDIR}${LIBDIR}/libelf.a
5313 + LIBFETCH?= ${DESTDIR}${LIBDIR}/libfetch.a
5314 +-LIBFL?= "don't use LIBFL, use LIBL"
5315 ++LIBFL?= ${DESTDIR}${LIBDIR}/libfl.a
5316 + LIBFORM?= ${DESTDIR}${LIBDIR}/libform.a
5317 + LIBFTPIO?= ${DESTDIR}${LIBDIR}/libftpio.a
5318 + LIBG2C?= ${DESTDIR}${LIBDIR}/libg2c.a
5319 +@@ -79,7 +79,7 @@
5320 + LIBKICONV?= ${DESTDIR}${LIBDIR}/libkiconv.a
5321 + LIBKRB5?= ${DESTDIR}${LIBDIR}/libkrb5.a
5322 + LIBKVM?= ${DESTDIR}${LIBDIR}/libkvm.a
5323 +-LIBL?= ${DESTDIR}${LIBDIR}/libl.a
5324 ++LIBL?= ${DESTDIR}${LIBDIR}/libfl.a
5325 + LIBLN?= "don't use LIBLN, use LIBL"
5326 + .if ${MK_BIND} != "no"
5327 + LIBLWRES?= ${DESTDIR}${LIBDIR}/liblwres.a
5328 +diff -Nur share.orig/mk/bsd.links.mk share/mk/bsd.links.mk
5329 +--- share.orig/mk/bsd.links.mk 2012-07-12 13:25:44.000000000 +0900
5330 ++++ share/mk/bsd.links.mk 2012-07-16 00:01:55.000000000 +0900
5331 +@@ -15,6 +15,8 @@
5332 + t=${DESTDIR}$$1; \
5333 + shift; \
5334 + ${ECHO} $$t -\> $$l; \
5335 ++ d=`dirname $$t`; \
5336 ++ test -d $$d || mkdir $$d; \
5337 + ln -f $$l $$t; \
5338 + done; true
5339 + .endif
5340 +@@ -26,6 +28,8 @@
5341 + t=${DESTDIR}$$1; \
5342 + shift; \
5343 + ${ECHO} $$t -\> $$l; \
5344 ++ d=`dirname $$t`; \
5345 ++ test -d $$d || mkdir $$d; \
5346 + ln -fs $$l $$t; \
5347 + done; true
5348 + .endif
5349 +diff -Nur share.orig/mk/bsd.man.mk share/mk/bsd.man.mk
5350 +--- share.orig/mk/bsd.man.mk 2012-07-12 13:25:44.000000000 +0900
5351 ++++ share/mk/bsd.man.mk 2012-07-16 00:01:55.000000000 +0900
5352 +@@ -165,9 +165,11 @@
5353 + .if defined(NO_MANCOMPRESS)
5354 + .if defined(MANFILTER)
5355 + .for __page in ${MAN}
5356 ++ ${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}/${page}
5357 + ${MINSTALL} ${__page:T:S/$/${FILTEXTENSION}/g} \
5358 + ${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}/${__page}
5359 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
5360 ++ ${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page}
5361 + ${MINSTALL} ${__page:T:S/$/${CATEXT}${FILTEXTENSION}/g} \
5362 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page}
5363 + .endif
5364 +@@ -181,11 +183,14 @@
5365 + esac; \
5366 + page=$$1; shift; sect=$$1; shift; \
5367 + d=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}; \
5368 ++ ${ECHO} ${INSTALL} -d $${d}; \
5369 ++ ${INSTALL} -d $${d}; \
5370 + ${ECHO} ${MINSTALL} $${page} $${d}; \
5371 + ${MINSTALL} $${page} $${d}; \
5372 + done
5373 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
5374 + .for __page in ${MAN}
5375 ++ ${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page:T}
5376 + ${MINSTALL} ${__page:T:S/$/${CATEXT}/} \
5377 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T}
5378 + .endfor
5379 +@@ -193,9 +198,11 @@
5380 + .endif
5381 + .else
5382 + .for __page in ${MAN}
5383 ++ ${INSTALL} -d ${DESTDIR}${MANDIR}${page:E}${MANSUBDIR}
5384 + ${MINSTALL} ${__page:T:S/$/${MCOMPRESS_EXT}/g} \
5385 + ${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}
5386 + .if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
5387 ++ ${INSTALL} -d ${DESTDIR}${CATDIR}${page:E}${MANSUBDIR}/${page:T:S/$/${MCOMPRESS_EXT}
5388 + ${MINSTALL} ${__page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} \
5389 + ${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T:S/$/${MCOMPRESS_EXT}/}
5390 + .endif
5391 +diff -Nur share.orig/mk/bsd.nls.mk share/mk/bsd.nls.mk
5392 +--- share.orig/mk/bsd.nls.mk 2012-07-12 13:25:44.000000000 +0900
5393 ++++ share/mk/bsd.nls.mk 2012-07-16 00:01:55.000000000 +0900
5394 +@@ -62,7 +62,8 @@
5395 + # installation rules
5396 + #
5397 + .for file in ${NLS}
5398 +-NLSNAME_${file:T}= ${file:T:R}/${NLSNAME}.cat
5399 ++NLSDIR_${file:T}= ${SHAREDIR}/nls/${file:T:R}/
5400 ++NLSNAME_${file:T}= ${NLSNAME}.cat
5401 + .if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R})
5402 + NLSLINKS+= ${file:R}
5403 + .endif
5404 +diff -Nur share.orig/mk/bsd.own.mk share/mk/bsd.own.mk
5405 +--- share.orig/mk/bsd.own.mk 2012-07-12 13:25:44.000000000 +0900
5406 ++++ share/mk/bsd.own.mk 2012-07-16 00:01:55.000000000 +0900
5407 +@@ -182,9 +182,6 @@
5408 + INCLUDEDIR?= /usr/include
5409 +
5410 + # Common variables
5411 +-.if !defined(DEBUG_FLAGS)
5412 +-STRIP?= -s
5413 +-.endif
5414 +
5415 + COMPRESS_CMD?= gzip -cn
5416 + COMPRESS_EXT?= .gz
5417 +diff -Nur share.orig/mk/bsd.prog.mk share/mk/bsd.prog.mk
5418 +--- share.orig/mk/bsd.prog.mk 2012-07-12 13:25:44.000000000 +0900
5419 ++++ share/mk/bsd.prog.mk 2012-07-16 00:01:55.000000000 +0900
5420 +@@ -33,10 +33,6 @@
5421 + CFLAGS+=${CRUNCH_CFLAGS}
5422 + .endif
5423 +
5424 +-.if !defined(DEBUG_FLAGS)
5425 +-STRIP?= -s
5426 +-.endif
5427 +-
5428 + .if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
5429 + LDFLAGS+= -static
5430 + .endif
5431 +@@ -155,6 +151,7 @@
5432 + .ORDER: beforeinstall _proginstall
5433 + _proginstall:
5434 + .if defined(PROG)
5435 ++ ${INSTALL} -d ${DESTDIR}${BINDIR}
5436 + .if defined(PROGNAME)
5437 + ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
5438 + ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
5439 +@@ -186,6 +183,7 @@
5440 + SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE}
5441 + _scriptsinstall: _SCRIPTSINS_${script:T}
5442 + _SCRIPTSINS_${script:T}: ${script}
5443 ++ ${INSTALL} -d ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}
5444 + ${INSTALL} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
5445 + -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
5446 + ${.ALLSRC} \
5447 +diff -Nur share.orig/mk/bsd.sys.mk share/mk/bsd.sys.mk
5448 +--- share.orig/mk/bsd.sys.mk 2012-07-12 13:25:44.000000000 +0900
5449 ++++ share/mk/bsd.sys.mk 2012-07-16 00:04:14.000000000 +0900
5450 +@@ -28,10 +28,6 @@
5451 + .if defined(WARNS)
5452 + .if ${WARNS} >= 1
5453 + CWARNFLAGS+= -Wsystem-headers
5454 +-.if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && \
5455 +- ${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang))
5456 +-CWARNFLAGS+= -Werror
5457 +-.endif # !NO_WERROR && (!CLANG || !NO_WERROR.clang)
5458 + .endif # WARNS >= 1
5459 + .if ${WARNS} >= 2
5460 + CWARNFLAGS+= -Wall -Wno-format-y2k
5461 +@@ -95,10 +91,6 @@
5462 + CWARNFLAGS+= -Wno-format-nonliteral
5463 + .endif # WARNS <= 3
5464 + .endif # CLANG
5465 +-.if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && \
5466 +- ${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang))
5467 +-CWARNFLAGS+= -Werror
5468 +-.endif # !NO_WERROR && (!CLANG || !NO_WERROR.clang)
5469 + .endif # WFORMAT > 0
5470 + .endif # WFORMAT
5471 + .if defined(NO_WFORMAT) || ((${MK_CLANG_IS_CC} != "no" || \
5472 +diff -Nur share.orig/mk/sys.mk share/mk/sys.mk
5473 +--- share.orig/mk/sys.mk 2012-07-12 13:25:44.000000000 +0900
5474 ++++ share/mk/sys.mk 2012-07-16 00:01:55.000000000 +0900
5475 +@@ -349,12 +349,6 @@
5476 + (${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
5477 + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
5478 +
5479 +-# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef.
5480 +-__MAKE_CONF?=/etc/make.conf
5481 +-.if exists(${__MAKE_CONF})
5482 +-.include "${__MAKE_CONF}"
5483 +-.endif
5484 +-
5485 + .if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL)
5486 + SHELL= ${__MAKE_SHELL}
5487 + .SHELL: path=${__MAKE_SHELL}
5488
5489 diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.1-gnu.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.1-gnu.patch
5490 new file mode 100644
5491 index 0000000..f986ed9
5492 --- /dev/null
5493 +++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-9.1-gnu.patch
5494 @@ -0,0 +1,77 @@
5495 +diff -Nur share.orig/mk/bsd.lib.mk share/mk/bsd.lib.mk
5496 +--- share.orig/mk/bsd.lib.mk 2012-07-16 02:40:07.000000000 +0900
5497 ++++ share/mk/bsd.lib.mk 2012-07-16 02:41:40.000000000 +0900
5498 +@@ -155,11 +155,7 @@
5499 + lib${LIB}.a: ${OBJS} ${STATICOBJS}
5500 + @${ECHO} building static ${LIB} library
5501 + @rm -f ${.TARGET}
5502 +-.if !defined(NM)
5503 +- @${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
5504 +-.else
5505 +- @${AR} cq ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
5506 +-.endif
5507 ++ @${AR} cq ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD}
5508 + ${RANLIB} ${.TARGET}
5509 + .endif
5510 +
5511 +@@ -172,11 +168,7 @@
5512 + lib${LIB}_p.a: ${POBJS}
5513 + @${ECHO} building profiled ${LIB} library
5514 + @rm -f ${.TARGET}
5515 +-.if !defined(NM)
5516 +- @${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD}
5517 +-.else
5518 +- @${AR} cq ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
5519 +-.endif
5520 ++ @${AR} cq ${.TARGET} ${POBJS} ${ARADD}
5521 + ${RANLIB} ${.TARGET}
5522 + .endif
5523 +
5524 +@@ -203,15 +195,9 @@
5525 + .if defined(SHLIB_LINK)
5526 + @ln -fs ${.TARGET} ${SHLIB_LINK}
5527 + .endif
5528 +-.if !defined(NM)
5529 + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
5530 + -o ${.TARGET} -Wl,-soname,${SONAME} \
5531 +- `lorder ${SOBJS} | tsort -q` ${LDADD}
5532 +-.else
5533 +- @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
5534 +- -o ${.TARGET} -Wl,-soname,${SONAME} \
5535 +- `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
5536 +-.endif
5537 ++ `echo ${SOBJS} | xargs -n 1 echo | sort -u` ${LDADD}
5538 + @[ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || \
5539 + (${ECHO} ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} && \
5540 + ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS})
5541 +@@ -259,13 +245,6 @@
5542 +
5543 + .if !target(install)
5544 +
5545 +-.if defined(PRECIOUSLIB)
5546 +-.if !defined(NO_FSCHG)
5547 +-SHLINSTALLFLAGS+= -fschg
5548 +-.endif
5549 +-SHLINSTALLFLAGS+= -S
5550 +-.endif
5551 +-
5552 + _INSTALLFLAGS:= ${INSTALLFLAGS}
5553 + .for ie in ${INSTALLFLAGS_EDIT}
5554 + _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
5555 +diff -Nur share.orig/mk/bsd.prog.mk share/mk/bsd.prog.mk
5556 +--- share.orig/mk/bsd.prog.mk 2012-07-16 02:40:07.000000000 +0900
5557 ++++ share/mk/bsd.prog.mk 2012-07-16 02:40:24.000000000 +0900
5558 +@@ -134,13 +134,6 @@
5559 +
5560 + .if !target(install)
5561 +
5562 +-.if defined(PRECIOUSPROG)
5563 +-.if !defined(NO_FSCHG)
5564 +-INSTALLFLAGS+= -fschg
5565 +-.endif
5566 +-INSTALLFLAGS+= -S
5567 +-.endif
5568 +-
5569 + _INSTALLFLAGS:= ${INSTALLFLAGS}
5570 + .for ie in ${INSTALLFLAGS_EDIT}
5571 + _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
5572
5573 diff --git a/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-add-nossp-cflags.patch b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-add-nossp-cflags.patch
5574 new file mode 100644
5575 index 0000000..8eb80c3
5576 --- /dev/null
5577 +++ b/sys-freebsd/freebsd-mk-defs/files/freebsd-mk-defs-add-nossp-cflags.patch
5578 @@ -0,0 +1,28 @@
5579 +https://bugs.gentoo.org/show_bug.cgi?id=511698
5580 +
5581 +diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
5582 +index e438633..de4a05b 100644
5583 +--- a/share/mk/bsd.sys.mk
5584 ++++ b/share/mk/bsd.sys.mk
5585 +@@ -111,12 +111,18 @@ CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\
5586 + CFLAGS+= -Qunused-arguments
5587 + .endif # CLANG
5588 +
5589 +-.if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \
5590 +- ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
5591 ++.if ${MACHINE_CPUARCH} != "ia64" && ${MACHINE_CPUARCH} != "arm" \
5592 ++ && ${MACHINE_CPUARCH} != "mips"
5593 ++.if ${MK_SSP} != "no"
5594 + # Don't use -Wstack-protector as it breaks world with -Werror.
5595 + SSP_CFLAGS?= -fstack-protector
5596 ++.else
5597 ++# gcc-4.9, -fstack-protector-strong is enabled by default.
5598 ++# Add -fno-stack-protector to disable it. Gentoo Bug #511698.
5599 ++SSP_CFLAGS= -fno-stack-protector
5600 ++.endif #SSP
5601 + CFLAGS+= ${SSP_CFLAGS}
5602 +-.endif # SSP && !IA64 && !ARM && !MIPS
5603 ++.endif # !IA64 && !ARM && !MIPS
5604 +
5605 + # Allow user-specified additional warning flags
5606 + CFLAGS+= ${CWARNFLAGS}
5607
5608 diff --git a/sys-freebsd/freebsd-mk-defs/freebsd-mk-defs-11.0.ebuild b/sys-freebsd/freebsd-mk-defs/freebsd-mk-defs-11.0.ebuild
5609 new file mode 100644
5610 index 0000000..571e0f8
5611 --- /dev/null
5612 +++ b/sys-freebsd/freebsd-mk-defs/freebsd-mk-defs-11.0.ebuild
5613 @@ -0,0 +1,42 @@
5614 +# Copyright 1999-2016 Gentoo Foundation
5615 +# Distributed under the terms of the GNU General Public License v2
5616 +# $Id$
5617 +
5618 +EAPI=5
5619 +
5620 +inherit bsdmk freebsd
5621 +
5622 +DESCRIPTION="Makefiles definitions used for building and installing libraries and system files"
5623 +SLOT="0"
5624 +
5625 +IUSE="userland_GNU"
5626 +
5627 +if [[ ${PV} != *9999* ]]; then
5628 + KEYWORDS="~amd64 ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
5629 +fi
5630 +
5631 +EXTRACTONLY="share/"
5632 +
5633 +RDEPEND=""
5634 +DEPEND=""
5635 +
5636 +RESTRICT="strip"
5637 +
5638 +S="${WORKDIR}/share/mk"
5639 +
5640 +src_prepare() {
5641 + epatch "${FILESDIR}/${PN}-10.3-gentoo.patch"
5642 + epatch "${FILESDIR}/${PN}-add-nossp-cflags.patch"
5643 + use userland_GNU && epatch "${FILESDIR}/${PN}-10.2-gnu.patch"
5644 +}
5645 +
5646 +src_compile() { :; }
5647 +
5648 +src_install() {
5649 + if [[ ${CHOST} != *-freebsd* ]]; then
5650 + insinto /usr/share/mk/freebsd
5651 + else
5652 + insinto /usr/share/mk
5653 + fi
5654 + doins *.mk *.awk
5655 +}
5656
5657 diff --git a/sys-freebsd/freebsd-mk-defs/metadata.xml b/sys-freebsd/freebsd-mk-defs/metadata.xml
5658 new file mode 100644
5659 index 0000000..a00f3ae
5660 --- /dev/null
5661 +++ b/sys-freebsd/freebsd-mk-defs/metadata.xml
5662 @@ -0,0 +1,8 @@
5663 +<?xml version="1.0" encoding="UTF-8"?>
5664 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
5665 +<pkgmetadata>
5666 +<maintainer type="project">
5667 + <email>bsd@g.o</email>
5668 + <name>BSD Project</name>
5669 +</maintainer>
5670 +</pkgmetadata>
5671
5672 diff --git a/sys-freebsd/freebsd-pam-modules/files/README.pamd b/sys-freebsd/freebsd-pam-modules/files/README.pamd
5673 new file mode 100644
5674 index 0000000..10da6cc
5675 --- /dev/null
5676 +++ b/sys-freebsd/freebsd-pam-modules/files/README.pamd
5677 @@ -0,0 +1,63 @@
5678 +/etc/pam.d
5679 +
5680 +This directory contains configuration files for the Pluggable
5681 +Authentication Modules (PAM) library.
5682 +
5683 +Each file details the module chain for a single service, and must be
5684 +named after that service. If no configuration file is found for a
5685 +particular service, the /etc/pam.d/other is used instead. If that
5686 +file does not exist, /etc/pam.conf is searched for entries matching
5687 +the specified service or, failing that, the "other" service.
5688 +
5689 +See the pam(8) manual page for an explanation of the workings of the
5690 +PAM library and descriptions of the various files and modules. Below
5691 +is a summary of the format for the pam.conf and /etc/pam.d/* files.
5692 +
5693 +Configuration lines take the following form:
5694 +
5695 +module-type control-flag module-path arguments
5696 +
5697 +Comments are introduced with a hash mark ('#'). Blank lines and lines
5698 +consisting entirely of comments are ignored.
5699 +
5700 +The meanings of the different fields are as follows:
5701 +
5702 + module-type:
5703 + auth: prompt for a password to authenticate that the user is
5704 + who they say they are, and set any credentials.
5705 + account: non-authentication based authorization, based on time,
5706 + resources, etc.
5707 + session: housekeeping before and/or after login.
5708 + password: update authentication tokens.
5709 +
5710 + control-flag: How libpam handles success or failure of the module.
5711 + required: success is required; on failure all remaining
5712 + modules are run, but the request will be denied.
5713 + requisite: success is required, and on failure no remaining
5714 + modules are run.
5715 + sufficient: success is sufficient, and if no previous required
5716 + module failed, no remaining modules are run.
5717 + binding: success is sufficient; on failure all remaining
5718 + modules are run, but the request will be denied.
5719 + optional: ignored unless the other modules return PAM_IGNORE.
5720 +
5721 + arguments: Module-specific options, plus some generic ones:
5722 + debug: syslog debug info.
5723 + no_warn: return no warning messages to the application.
5724 + Remove this to feed back to the user the
5725 + reason(s) they are being rejected.
5726 + use_first_pass: try authentication using password from the
5727 + preceding auth module.
5728 + try_first_pass: first try authentication using password from
5729 + the preceding auth module, and if that fails
5730 + prompt for a new password.
5731 + use_mapped_pass: convert cleartext password to a crypto key.
5732 + expose_account: allow printing more info about the user when
5733 + prompting.
5734 +
5735 +Note that having a "sufficient" module as the last entry for a
5736 +particular service and module type may result in surprising behaviour.
5737 +To get the intended semantics, add a "required" entry listing the
5738 +pam_deny module at the end of the chain.
5739 +
5740 +$Id$
5741
5742 diff --git a/sys-freebsd/freebsd-pam-modules/files/freebsd-pam-modules-6.0-gentoo.patch b/sys-freebsd/freebsd-pam-modules/files/freebsd-pam-modules-6.0-gentoo.patch
5743 new file mode 100644
5744 index 0000000..ce1a7fb
5745 --- /dev/null
5746 +++ b/sys-freebsd/freebsd-pam-modules/files/freebsd-pam-modules-6.0-gentoo.patch
5747 @@ -0,0 +1,24 @@
5748 +Index: fbsd-6.0/lib/libpam/modules/Makefile.inc
5749 +===================================================================
5750 +--- fbsd-6.0.orig/lib/libpam/modules/Makefile.inc
5751 ++++ fbsd-6.0/lib/libpam/modules/Makefile.inc
5752 +@@ -5,18 +5,10 @@ PAMDIR= ${.CURDIR}/../../../../contrib/
5753 + NO_INSTALLLIB=
5754 + NO_PROFILE=
5755 +
5756 +-CFLAGS+= -I${PAMDIR}/include -I${.CURDIR}/../../libpam
5757 ++CFLAGS+= -I${.CURDIR}/../../libpam
5758 + WARNS?= 4
5759 +
5760 +-# This is nasty.
5761 +-# For the static case, libpam.a depends on the modules.
5762 +-# For the dynamic case, the modules depend on libpam.so.N
5763 +-.if defined(_NO_LIBPAM_SO_YET)
5764 +-NO_PIC=
5765 +-.else
5766 + SHLIB_NAME?= ${LIB}.so.${SHLIB_MAJOR}
5767 +-DPADD+= ${LIBPAM}
5768 + LDADD+= -lpam
5769 +-.endif
5770 +
5771 + .include "../Makefile.inc"
5772
5773 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
5774 new file mode 100644
5775 index 0000000..aa08d40
5776 --- /dev/null
5777 +++ b/sys-freebsd/freebsd-pam-modules/files/freebsd-pam-modules-9.0-gentoo.patch
5778 @@ -0,0 +1,22 @@
5779 +--- lib/libpam/modules/Makefile.inc.old 2011-11-02 20:46:56.000000000 +0000
5780 ++++ lib/libpam/modules/Makefile.inc 2011-11-02 20:47:16.000000000 +0000
5781 +@@ -5,18 +5,10 @@
5782 + NO_INSTALLLIB=
5783 + NO_PROFILE=
5784 +
5785 +-CFLAGS+= -I${PAMDIR}/include -I${.CURDIR}/../../libpam
5786 ++CFLAGS+= -I${.CURDIR}/../../libpam
5787 +
5788 +-# This is nasty.
5789 +-# For the static case, libpam.a depends on the modules.
5790 +-# For the dynamic case, the modules depend on libpam.so.N
5791 +-.if defined(_NO_LIBPAM_SO_YET)
5792 +-NO_PIC=
5793 +-.else
5794 + SHLIB_NAME?= ${LIB}.so.${SHLIB_MAJOR}
5795 +-DPADD+= ${LIBPAM}
5796 + LDADD+= -lpam
5797 +-.endif
5798 +
5799 + .c.o:
5800 + ${CC} ${CFLAGS} -DOPENPAM_STATIC_MODULES -c ${.IMPSRC}
5801
5802 diff --git a/sys-freebsd/freebsd-pam-modules/freebsd-pam-modules-11.0.ebuild b/sys-freebsd/freebsd-pam-modules/freebsd-pam-modules-11.0.ebuild
5803 new file mode 100644
5804 index 0000000..62a7b3e
5805 --- /dev/null
5806 +++ b/sys-freebsd/freebsd-pam-modules/freebsd-pam-modules-11.0.ebuild
5807 @@ -0,0 +1,48 @@
5808 +# Copyright 1999-2016 Gentoo Foundation
5809 +# Distributed under the terms of the GNU General Public License v2
5810 +# $Id$
5811 +
5812 +EAPI=5
5813 +
5814 +inherit bsdmk freebsd multilib pam
5815 +
5816 +DESCRIPTION="FreeBSD's PAM authentication modules"
5817 +SLOT="0"
5818 +
5819 +IUSE="kerberos nis"
5820 +
5821 +if [[ ${PV} != *9999* ]]; then
5822 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
5823 +fi
5824 +
5825 +EXTRACTONLY="lib/"
5826 +
5827 +RDEPEND=">=sys-auth/openpam-20050201-r1
5828 + kerberos? ( dev-libs/openssl:0=
5829 + virtual/krb5 )"
5830 +DEPEND="${RDEPEND}
5831 + =sys-freebsd/freebsd-mk-defs-${RV}*
5832 + =sys-freebsd/freebsd-sources-${RV}*"
5833 +
5834 +S=${WORKDIR}/lib/libpam/modules
5835 +
5836 +PATCHES=( "${FILESDIR}"/${PN}-9.0-gentoo.patch )
5837 +
5838 +pkg_setup() {
5839 + # Avoid installing pam_ssh as that has its own ebuild.
5840 + mymakeopts="${mymakeopts} WITHOUT_OPENSSH= "
5841 + use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS= "
5842 + use nis || mymakeopts="${mymakeopts} WITHOUT_NIS= "
5843 +}
5844 +
5845 +src_prepare() {
5846 + for module in pam_deny pam_passwdqc pam_permit pam_krb5; do
5847 + sed -i -e "s:${module}::" "${S}"/modules.inc || die
5848 + done
5849 +}
5850 +
5851 +src_install() {
5852 + mkinstall "LIBDIR=/$(get_libdir)/security" || die "install failed"
5853 +
5854 + dodoc "${FILESDIR}/README.pamd"
5855 +}
5856
5857 diff --git a/sys-freebsd/freebsd-pam-modules/metadata.xml b/sys-freebsd/freebsd-pam-modules/metadata.xml
5858 new file mode 100644
5859 index 0000000..a00f3ae
5860 --- /dev/null
5861 +++ b/sys-freebsd/freebsd-pam-modules/metadata.xml
5862 @@ -0,0 +1,8 @@
5863 +<?xml version="1.0" encoding="UTF-8"?>
5864 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
5865 +<pkgmetadata>
5866 +<maintainer type="project">
5867 + <email>bsd@g.o</email>
5868 + <name>BSD Project</name>
5869 +</maintainer>
5870 +</pkgmetadata>
5871
5872 diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-10.0-libevent.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-10.0-libevent.patch
5873 new file mode 100644
5874 index 0000000..57474ea
5875 --- /dev/null
5876 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-10.0-libevent.patch
5877 @@ -0,0 +1,16 @@
5878 +diff --git a/usr.sbin/ftp-proxy/ftp-proxy/Makefile b/usr.sbin/ftp-proxy/ftp-proxy/Makefile
5879 +index de49888..2ab32fb 100644
5880 +--- a/usr.sbin/ftp-proxy/ftp-proxy/Makefile
5881 ++++ b/usr.sbin/ftp-proxy/ftp-proxy/Makefile
5882 +@@ -7,10 +7,7 @@ MAN= ftp-proxy.8
5883 +
5884 + SRCS= ftp-proxy.c filter.c
5885 +
5886 +-CFLAGS+= -I${.CURDIR}/../../../contrib/pf/libevent
5887 +-
5888 +-LDADD+= ${LIBEVENT}
5889 +-DPADD+= ${LIBEVENT}
5890 ++LDADD+= -levent
5891 +
5892 + WARNS?= 3
5893 +
5894
5895 diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-10.0-pflogd.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-10.0-pflogd.patch
5896 new file mode 100644
5897 index 0000000..1316d3b
5898 --- /dev/null
5899 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-10.0-pflogd.patch
5900 @@ -0,0 +1,15 @@
5901 +diff --git a/sbin/pflogd/Makefile b/sbin/pflogd/Makefile
5902 +index fcff8eb..0da383d 100644
5903 +--- a/sbin/pflogd/Makefile
5904 ++++ b/sbin/pflogd/Makefile
5905 +@@ -6,10 +6,7 @@ PROG= pflogd
5906 + SRCS= pflogd.c pidfile.c privsep.c privsep_fdpass.c
5907 + MAN= pflogd.8
5908 +
5909 +-CFLAGS+=-include ${.CURDIR}/../../lib/libpcap/config.h
5910 +-
5911 + LDADD= -lpcap
5912 +-DPADD= ${LIBPCAP}
5913 +
5914 + WARNS?= 2
5915 +
5916
5917 diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-7.0-libevent.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-7.0-libevent.patch
5918 new file mode 100644
5919 index 0000000..1425db2
5920 --- /dev/null
5921 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-7.0-libevent.patch
5922 @@ -0,0 +1,12 @@
5923 +--- usr.sbin/ftp-proxy/ftp-proxy/Makefile.orig 2008-06-14 00:01:52 -0300
5924 ++++ usr.sbin/ftp-proxy/ftp-proxy/Makefile 2008-06-14 00:03:19 -0300
5925 +@@ -10,8 +10,7 @@
5926 + CFLAGS+= -I${.CURDIR}/../../../contrib/pf/libevent
5927 + CFLAGS+= -I${.CURDIR}/../../../sys/contrib/pf
5928 +
5929 +-DPADD= ${LIBEVENT}
5930 +-LDADD= ${LIBEVENT}
5931 ++LDADD= -levent
5932 +
5933 + WARNS?= 2
5934 +
5935
5936 diff --git a/sys-freebsd/freebsd-pf/files/freebsd-pf-7.0-pcap_pollution.patch b/sys-freebsd/freebsd-pf/files/freebsd-pf-7.0-pcap_pollution.patch
5937 new file mode 100644
5938 index 0000000..4a7c2e9
5939 --- /dev/null
5940 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-7.0-pcap_pollution.patch
5941 @@ -0,0 +1,18 @@
5942 +--- contrib/pf/pflogd/privsep.c.orig 2007-07-03 09:30:02 -0300
5943 ++++ contrib/pf/pflogd/privsep.c 2008-06-13 23:55:39 -0300
5944 +@@ -31,13 +31,14 @@
5945 + #include <errno.h>
5946 + #include <fcntl.h>
5947 + #include <limits.h>
5948 ++#include <stdio.h>
5949 ++#define HAVE_SNPRINTF
5950 + #ifndef __FreeBSD__
5951 + #include <pcap.h>
5952 + #include <pcap-int.h>
5953 + #endif
5954 + #include <pwd.h>
5955 + #include <signal.h>
5956 +-#include <stdio.h>
5957 + #include <stdlib.h>
5958 + #include <string.h>
5959 + #ifdef __FreeBSD__
5960
5961 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
5962 new file mode 100644
5963 index 0000000..fb3c701
5964 --- /dev/null
5965 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-bpf.patch
5966 @@ -0,0 +1,10 @@
5967 +--- contrib/pf/pflogd/pflogd.c.old 2011-11-02 21:12:57.000000000 +0000
5968 ++++ contrib/pf/pflogd/pflogd.c 2011-11-02 21:13:11.000000000 +0000
5969 +@@ -39,6 +39,7 @@
5970 + #include <sys/stat.h>
5971 + #include <sys/socket.h>
5972 + #include <net/if.h>
5973 ++#include <net/bpf.h>
5974 + #include <stdio.h>
5975 + #include <stdlib.h>
5976 + #include <string.h>
5977
5978 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
5979 new file mode 100644
5980 index 0000000..6679d32
5981 --- /dev/null
5982 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-getline.patch
5983 @@ -0,0 +1,38 @@
5984 +--- contrib/pf/ftp-proxy/ftp-proxy.c.old 2011-11-02 21:18:19.000000000 +0000
5985 ++++ contrib/pf/ftp-proxy/ftp-proxy.c 2011-11-02 21:18:36.000000000 +0000
5986 +@@ -103,7 +103,7 @@
5987 + int drop_privs(void);
5988 + void end_session(struct session *);
5989 + void exit_daemon(void);
5990 +-int getline(char *, size_t *);
5991 ++int ftpgetline(char *, size_t *);
5992 + void handle_connection(const int, short, void *);
5993 + void handle_signal(int, short, void *);
5994 + struct session * init_session(void);
5995 +@@ -249,7 +249,7 @@
5996 + buf_avail);
5997 + s->cbuf_valid += clientread;
5998 +
5999 +- while ((n = getline(s->cbuf, &s->cbuf_valid)) > 0) {
6000 ++ while ((n = ftpgetline(s->cbuf, &s->cbuf_valid)) > 0) {
6001 + logmsg(LOG_DEBUG, "#%d client: %s", s->id, linebuf);
6002 + if (!client_parse(s)) {
6003 + end_session(s);
6004 +@@ -343,7 +343,7 @@
6005 + }
6006 +
6007 + int
6008 +-getline(char *buf, size_t *valid)
6009 ++ftpgetline(char *buf, size_t *valid)
6010 + {
6011 + size_t i;
6012 +
6013 +@@ -1087,7 +1087,7 @@
6014 + buf_avail);
6015 + s->sbuf_valid += srvread;
6016 +
6017 +- while ((n = getline(s->sbuf, &s->sbuf_valid)) > 0) {
6018 ++ while ((n = ftpgetline(s->sbuf, &s->sbuf_valid)) > 0) {
6019 + logmsg(LOG_DEBUG, "#%d server: %s", s->id, linebuf);
6020 + if (!server_parse(s)) {
6021 + end_session(s);
6022
6023 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
6024 new file mode 100644
6025 index 0000000..e488423
6026 --- /dev/null
6027 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-libevent.patch
6028 @@ -0,0 +1,15 @@
6029 +--- usr.sbin/ftp-proxy/ftp-proxy/Makefile.old 2011-11-02 20:57:03.000000000 +0000
6030 ++++ usr.sbin/ftp-proxy/ftp-proxy/Makefile 2011-11-02 20:57:21.000000000 +0000
6031 +@@ -7,11 +7,9 @@
6032 +
6033 + SRCS= ftp-proxy.c filter.c
6034 +
6035 +-CFLAGS+= -I${.CURDIR}/../../../contrib/pf/libevent
6036 + CFLAGS+= -I${.CURDIR}/../../../sys/contrib/pf
6037 +
6038 +-LDADD+= ${LIBEVENT}
6039 +-DPADD+= ${LIBEVENT}
6040 ++LDADD+= -levent
6041 +
6042 + WARNS?= 3
6043 +
6044
6045 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
6046 new file mode 100644
6047 index 0000000..184ab6f
6048 --- /dev/null
6049 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-pcap_pollution.patch
6050 @@ -0,0 +1,17 @@
6051 +--- contrib/pf/pflogd/privsep.c.old 2011-11-02 21:04:01.000000000 +0000
6052 ++++ contrib/pf/pflogd/privsep.c 2011-11-02 21:04:27.000000000 +0000
6053 +@@ -32,11 +32,13 @@
6054 + #include <errno.h>
6055 + #include <fcntl.h>
6056 + #include <limits.h>
6057 ++#include <stdio.h>
6058 ++#define HAVE_SNPRINTF
6059 ++#define HAVE_STRLCPY
6060 + #include <pcap.h>
6061 + #include <pcap-int.h>
6062 + #include <pwd.h>
6063 + #include <signal.h>
6064 +-#include <stdio.h>
6065 + #include <stdlib.h>
6066 + #include <string.h>
6067 + #include <syslog.h>
6068
6069 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
6070 new file mode 100644
6071 index 0000000..d5a65ea
6072 --- /dev/null
6073 +++ b/sys-freebsd/freebsd-pf/files/freebsd-pf-9.0-pflogd.patch
6074 @@ -0,0 +1,13 @@
6075 +--- sbin/pflogd/Makefile.old 2011-11-02 21:08:46.000000000 +0000
6076 ++++ sbin/pflogd/Makefile 2011-11-02 21:08:53.000000000 +0000
6077 +@@ -6,10 +6,7 @@
6078 + SRCS= pflogd.c pidfile.c privsep.c privsep_fdpass.c
6079 + MAN= pflogd.8
6080 +
6081 +-CFLAGS+=-include ${.CURDIR}/../../lib/libpcap/config.h
6082 +-
6083 + LDADD= -lpcap
6084 +-DPADD= ${LIBPCAP} ${LIBUTIL}
6085 +
6086 + WARNS?= 2
6087 +
6088
6089 diff --git a/sys-freebsd/freebsd-pf/files/pf.confd b/sys-freebsd/freebsd-pf/files/pf.confd
6090 new file mode 100644
6091 index 0000000..87c21b2
6092 --- /dev/null
6093 +++ b/sys-freebsd/freebsd-pf/files/pf.confd
6094 @@ -0,0 +1,9 @@
6095 +# Copyright 2006 Gentoo Foundation
6096 +# Distributed under the terms of the GNU General Public License v2
6097 +
6098 +# Defines where the rules file is found, by default /etc/pf.conf
6099 +# pf_conf=/etc/pf.conf
6100 +
6101 +# Extra options to pass to pfctl when loading the rules
6102 +# See pfctl(8)
6103 +# pf_args=
6104
6105 diff --git a/sys-freebsd/freebsd-pf/files/pf.initd b/sys-freebsd/freebsd-pf/files/pf.initd
6106 new file mode 100644
6107 index 0000000..38ee4ea
6108 --- /dev/null
6109 +++ b/sys-freebsd/freebsd-pf/files/pf.initd
6110 @@ -0,0 +1,50 @@
6111 +#!/sbin/openrc-run
6112 +# Copyright 2006 Gentoo Foundation
6113 +# Distributed under the terms of the GNU General Public License v2
6114 +# $Id$
6115 +
6116 +depend() {
6117 + need net
6118 +}
6119 +
6120 +checkconfig() {
6121 + if ! [ -c /dev/pf ]; then
6122 + ewarn "Pseudo-device /dev/pf not found."
6123 +
6124 + ebegin "Loading pf module"
6125 + if ! kldload pf; then
6126 + eerror "Unable to load pf module."
6127 + eend 1
6128 + return 1
6129 + fi
6130 + eend $?
6131 +
6132 + if ! [ -c /dev/pf ]; then
6133 + eerror "Pseudo-device /dev/pf still not found."
6134 + return 1
6135 + fi
6136 + fi
6137 +
6138 + return 0
6139 +}
6140 +
6141 +start() {
6142 + checkconfig || return 1
6143 +
6144 + einfo "Starting firewall"
6145 +
6146 + if [ -r "${PF_RULES_FILE}" ]; then
6147 + einfo "Loading firewall rules"
6148 + /sbin/pfctl -qe -f ${PF_RULES_FILE:-/etc/pf.conf} ${PF_OPTS}
6149 + else
6150 + /sbin/pfctl -qe ${PF_OPTS}
6151 + fi
6152 +
6153 + eend $?
6154 +}
6155 +
6156 +stop() {
6157 + einfo "Stopping firewall"
6158 + /sbin/pfctl -qd || retval=1
6159 + eend $?
6160 +}
6161
6162 diff --git a/sys-freebsd/freebsd-pf/freebsd-pf-11.0.ebuild b/sys-freebsd/freebsd-pf/freebsd-pf-11.0.ebuild
6163 new file mode 100644
6164 index 0000000..14efdcb
6165 --- /dev/null
6166 +++ b/sys-freebsd/freebsd-pf/freebsd-pf-11.0.ebuild
6167 @@ -0,0 +1,73 @@
6168 +# Copyright 1999-2016 Gentoo Foundation
6169 +# Distributed under the terms of the GNU General Public License v2
6170 +# $Id$
6171 +
6172 +EAPI=5
6173 +
6174 +inherit bsdmk freebsd user
6175 +
6176 +DESCRIPTION="FreeBSD's base system libraries"
6177 +SLOT="0"
6178 +
6179 +IUSE=""
6180 +
6181 +# Crypto is needed to have an internal OpenSSL header
6182 +if [[ ${PV} != *9999* ]]; then
6183 + KEYWORDS="~amd64-fbsd ~x86-fbsd"
6184 +fi
6185 +
6186 +EXTRACTONLY="
6187 + usr.sbin/
6188 + sbin/
6189 + contrib/pf/
6190 + etc/
6191 +"
6192 +
6193 +RDEPEND="net-libs/libpcap"
6194 +DEPEND="${RDEPEND}
6195 + dev-libs/libevent
6196 + =sys-freebsd/freebsd-mk-defs-${RV}*
6197 + =sys-freebsd/freebsd-sources-${RV}*"
6198 +
6199 +S="${WORKDIR}"
6200 +
6201 +SUBDIRS="usr.sbin/authpf sbin/pfctl sbin/pflogd usr.sbin/ftp-proxy/ftp-proxy"
6202 +
6203 +pkg_setup() {
6204 + enewgroup authpf 63
6205 + mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS= "
6206 +}
6207 +
6208 +src_prepare() {
6209 + # pcap-int.h redefines snprintf as pcap_snprintf
6210 + epatch "${FILESDIR}/${PN}-9.0-pcap_pollution.patch"
6211 + # Use system's libevent
6212 + epatch "${FILESDIR}/${PN}-10.0-libevent.patch"
6213 + epatch "${FILESDIR}/${PN}-10.0-pflogd.patch"
6214 + epatch "${FILESDIR}/${PN}-9.0-bpf.patch"
6215 + epatch "${FILESDIR}/${PN}-9.0-getline.patch"
6216 + # Link in kernel sources
6217 + [[ ! -e "${WORKDIR}/sys" ]] && ln -s "/usr/src/sys" "${WORKDIR}/sys"
6218 +}
6219 +
6220 +src_compile() {
6221 + for dir in ${SUBDIRS}; do
6222 + einfo "Starting make in ${dir}"
6223 + cd "${S}/${dir}" || die
6224 + mkmake || die "Make ${dir} failed"
6225 + done
6226 +}
6227 +
6228 +src_install() {
6229 + for dir in ${SUBDIRS}; do
6230 + einfo "Starting install in ${dir}"
6231 + cd "${S}/${dir}" || die
6232 + mkinstall || die "Install ${dir} failed"
6233 + done
6234 +
6235 + cd "${WORKDIR}"/etc
6236 + insinto /etc
6237 + doins pf.os
6238 + # pf.initd provided by openrc, but no pf.confd
6239 + newconfd "${FILESDIR}/pf.confd" pf
6240 +}
6241
6242 diff --git a/sys-freebsd/freebsd-pf/metadata.xml b/sys-freebsd/freebsd-pf/metadata.xml
6243 new file mode 100644
6244 index 0000000..a00f3ae
6245 --- /dev/null
6246 +++ b/sys-freebsd/freebsd-pf/metadata.xml
6247 @@ -0,0 +1,8 @@
6248 +<?xml version="1.0" encoding="UTF-8"?>
6249 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
6250 +<pkgmetadata>
6251 +<maintainer type="project">
6252 + <email>bsd@g.o</email>
6253 + <name>BSD Project</name>
6254 +</maintainer>
6255 +</pkgmetadata>
6256
6257 diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-rescue-10.0-zlib.patch b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-10.0-zlib.patch
6258 new file mode 100644
6259 index 0000000..42165c4
6260 --- /dev/null
6261 +++ b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-10.0-zlib.patch
6262 @@ -0,0 +1,22 @@
6263 +diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
6264 +index 13c0d43..1f258f3 100644
6265 +--- a/sbin/savecore/savecore.c
6266 ++++ b/sbin/savecore/savecore.c
6267 +@@ -92,7 +92,7 @@ static int checkfor, compress, clear, force, keep, verbose; /* flags */
6268 + static int nfound, nsaved, nerr; /* statistics */
6269 + static int maxdumps;
6270 +
6271 +-extern FILE *zopen(const char *, const char *);
6272 ++extern FILE *gzopen(const char *, const char *);
6273 +
6274 + static sig_atomic_t got_siginfo;
6275 + static void infohandler(int);
6276 +@@ -626,7 +626,7 @@ DoFile(const char *savedir, const char *device)
6277 + if (compress) {
6278 + snprintf(corename, sizeof(corename), "%s.%d.gz",
6279 + istextdump ? "textdump.tar" : "vmcore", bounds);
6280 +- fp = zopen(corename, "w");
6281 ++ fp = gzopen(corename, "w");
6282 + } else {
6283 + snprintf(corename, sizeof(corename), "%s.%d",
6284 + istextdump ? "textdump.tar" : "vmcore", bounds);
6285
6286 diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-rescue-7.1-zlib.patch b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-7.1-zlib.patch
6287 new file mode 100644
6288 index 0000000..22fb2ec
6289 --- /dev/null
6290 +++ b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-7.1-zlib.patch
6291 @@ -0,0 +1,21 @@
6292 +diff -ur sbin/savecore/savecore.c sbin-zlib/savecore/savecore.c
6293 +--- sbin/savecore/savecore.c 2005-02-26 01:21:50 +0000
6294 ++++ sbin-zlib/savecore/savecore.c 2005-05-06 12:00:06 +0000
6295 +@@ -95,7 +95,7 @@
6296 + static int checkfor, compress, clear, force, keep, verbose; /* flags */
6297 + static int nfound, nsaved, nerr; /* statistics */
6298 +
6299 +-extern FILE *zopen(const char *, const char *);
6300 ++extern FILE *gzopen(const char *, const char *);
6301 +
6302 + static void
6303 + printheader(FILE *f, const struct kerneldumpheader *h, const char *device,
6304 +@@ -553,7 +553,7 @@
6305 + if (compress) {
6306 + sprintf(filename, "%s.%d.gz", istextdump ? "textdump.tar" :
6307 + "vmcore", bounds);
6308 +- fp = zopen(filename, "w");
6309 ++ fp = gzopen(filename, "w");
6310 + } else {
6311 + sprintf(filename, "%s.%d", istextdump ? "textdump.tar" :
6312 + "vmcore", bounds);
6313
6314 diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-rescue-8.0-pkgconfig_static_libarchive.patch b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-8.0-pkgconfig_static_libarchive.patch
6315 new file mode 100644
6316 index 0000000..7d12621
6317 --- /dev/null
6318 +++ b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-8.0-pkgconfig_static_libarchive.patch
6319 @@ -0,0 +1,11 @@
6320 +--- rescue/rescue/Makefile.old 2010-03-12 12:14:17 +0100
6321 ++++ rescue/rescue/Makefile 2010-03-12 12:14:47 +0100
6322 +@@ -209,7 +209,7 @@
6323 + CRUNCH_LIBS+= -lbz2
6324 +
6325 + CRUNCH_PROGS_usr.bin+= tar
6326 +-CRUNCH_LIBS+= -larchive -lmd
6327 ++CRUNCH_LIBS+= `pkg-config --static --libs libarchive` -lmd
6328 + .if ${MK_OPENSSL} != "no"
6329 + CRUNCH_LIBS+= -lcrypto
6330 + .endif
6331
6332 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
6333 new file mode 100644
6334 index 0000000..3d44457
6335 --- /dev/null
6336 +++ b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-8.2-libzcleverlink.patch
6337 @@ -0,0 +1,20 @@
6338 +--- rescue/rescue/Makefile.old 2011-07-06 01:35:13.000000000 +0000
6339 ++++ rescue/rescue/Makefile 2011-07-06 01:35:54.000000000 +0000
6340 +@@ -143,7 +143,7 @@
6341 + .if ${MK_ZFS} != "no"
6342 + CRUNCH_LIBS+= -lzfs -lnvpair -luutil -lavl
6343 + .endif
6344 +-CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs -lz
6345 ++CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs
6346 +
6347 + .if ${MACHINE_ARCH} == "i386"
6348 + CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
6349 +@@ -234,7 +234,7 @@
6350 + CRUNCH_PROGS_usr.sbin+= chown
6351 + CRUNCH_ALIAS_chown= chgrp
6352 + ##################################################################
6353 +-CRUNCH_LIBS+= -lm
6354 ++CRUNCH_LIBS+= -lz -lm
6355 +
6356 + ##################################################################
6357 + # The following is pretty nearly a generic crunchgen-handling makefile
6358
6359 diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-rescue-9.1-bsdtar.patch b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-9.1-bsdtar.patch
6360 new file mode 100644
6361 index 0000000..d4d23d7
6362 --- /dev/null
6363 +++ b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-9.1-bsdtar.patch
6364 @@ -0,0 +1,12 @@
6365 +diff -Nur work.orig/contrib/libarchive/tar/bsdtar.c work/contrib/libarchive/tar/bsdtar.c
6366 +--- work.orig/contrib/libarchive/tar/bsdtar.c 2012-07-12 13:44:29.000000000 +0900
6367 ++++ work/contrib/libarchive/tar/bsdtar.c 2012-07-29 00:57:25.000000000 +0900
6368 +@@ -691,7 +691,7 @@
6369 + {
6370 + printf("bsdtar %s - %s\n",
6371 + BSDTAR_VERSION_STRING,
6372 +- archive_version());
6373 ++ archive_version_string());
6374 + exit(0);
6375 + }
6376 +
6377
6378 diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-rescue-9.1-libcleverlink.patch b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-9.1-libcleverlink.patch
6379 new file mode 100644
6380 index 0000000..a194397
6381 --- /dev/null
6382 +++ b/sys-freebsd/freebsd-rescue/files/freebsd-rescue-9.1-libcleverlink.patch
6383 @@ -0,0 +1,21 @@
6384 +diff -Nur work.orig/rescue/rescue/Makefile work/rescue/rescue/Makefile
6385 +--- work.orig/rescue/rescue/Makefile 2012-07-29 00:50:20.000000000 +0900
6386 ++++ work/rescue/rescue/Makefile 2012-07-29 00:56:01.000000000 +0900
6387 +@@ -125,7 +125,7 @@
6388 + .if ${MK_ZFS} != "no"
6389 + CRUNCH_LIBS+= -lavl -lnvpair -lpthread -lzfs -luutil -lumem
6390 + .endif
6391 +-CRUNCH_LIBS+= -lgeom -lexpat -ljail -lkiconv -lmd -lreadline -lsbuf -lufs -lz
6392 ++CRUNCH_LIBS+= -lgeom -lexpat -ljail -lkiconv -lreadline -lsbuf -lufs
6393 +
6394 + .if ${MACHINE_CPUARCH} == "i386"
6395 + CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
6396 +@@ -216,7 +216,7 @@
6397 + CRUNCH_PROGS_usr.sbin+= chown
6398 + CRUNCH_ALIAS_chown= chgrp
6399 + ##################################################################
6400 +-CRUNCH_LIBS+= -lm
6401 ++CRUNCH_LIBS+= -lmd -lz -lm
6402 +
6403 + .include <bsd.crunchgen.mk>
6404 + .include <bsd.prog.mk>
6405
6406 diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-sbin-bsdxml2expat.patch b/sys-freebsd/freebsd-rescue/files/freebsd-sbin-bsdxml2expat.patch
6407 new file mode 100644
6408 index 0000000..bdda99b
6409 --- /dev/null
6410 +++ b/sys-freebsd/freebsd-rescue/files/freebsd-sbin-bsdxml2expat.patch
6411 @@ -0,0 +1,13 @@
6412 +diff -uNr sbin/ifconfig.old/regdomain.c sbin/ifconfig/regdomain.c
6413 +--- sbin/ifconfig.old/regdomain.c 2010-12-21 17:09:25.000000000 +0000
6414 ++++ sbin/ifconfig/regdomain.c 2011-07-10 15:56:27.000000000 +0000
6415 +@@ -39,7 +39,7 @@
6416 + #include <err.h>
6417 + #include <unistd.h>
6418 +
6419 +-#include <bsdxml.h>
6420 ++#include <expat.h>
6421 +
6422 + #include "regdomain.h"
6423 +
6424 +Los ficheros binarios sbin/ifconfig.old/regdomain.o y sbin/ifconfig/regdomain.o son distintos
6425
6426 diff --git a/sys-freebsd/freebsd-rescue/files/freebsd-ubin-10.2-bsdxml.patch b/sys-freebsd/freebsd-rescue/files/freebsd-ubin-10.2-bsdxml.patch
6427 new file mode 100644
6428 index 0000000..6064717
6429 --- /dev/null
6430 +++ b/sys-freebsd/freebsd-rescue/files/freebsd-ubin-10.2-bsdxml.patch
6431 @@ -0,0 +1,13 @@
6432 +diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c
6433 +index af6562b..3121c81 100644
6434 +--- a/usr.bin/mt/mt.c
6435 ++++ b/usr.bin/mt/mt.c
6436 +@@ -92,7 +92,7 @@ __FBSDID("$FreeBSD: stable/10/usr.bin/mt/mt.c 280438 2015-03-24 14:36:10Z ken $"
6437 + #include <unistd.h>
6438 + #include <stdint.h>
6439 + #include <errno.h>
6440 +-#include <bsdxml.h>
6441 ++#include <expat.h>
6442 + #include <mtlib.h>
6443 +
6444 + #include <cam/cam.h>
6445
6446 diff --git a/sys-freebsd/freebsd-rescue/freebsd-rescue-11.0.ebuild b/sys-freebsd/freebsd-rescue/freebsd-rescue-11.0.ebuild
6447 new file mode 100644
6448 index 0000000..a0eb03f
6449 --- /dev/null
6450 +++ b/sys-freebsd/freebsd-rescue/freebsd-rescue-11.0.ebuild
6451 @@ -0,0 +1,82 @@
6452 +# Copyright 1999-2016 Gentoo Foundation
6453 +# Distributed under the terms of the GNU General Public License v2
6454 +# $Id$
6455 +
6456 +EAPI=5
6457 +
6458 +inherit bsdmk freebsd toolchain-funcs
6459 +
6460 +DESCRIPTION="FreeBSD's rescue binaries"
6461 +SLOT="0"
6462 +LICENSE="BSD zfs? ( CDDL )"
6463 +
6464 +IUSE="atm netware nis zfs"
6465 +
6466 +if [[ ${PV} != *9999* ]]; then
6467 + KEYWORDS="~amd64-fbsd ~x86-fbsd"
6468 +fi
6469 +
6470 +EXTRACTONLY="
6471 + usr.bin/
6472 + contrib/
6473 + lib/
6474 + bin/
6475 + sbin/
6476 + usr.sbin/
6477 + gnu/
6478 + sys/
6479 + libexec/
6480 + rescue/
6481 +"
6482 +
6483 +RDEPEND=""
6484 +DEPEND="sys-devel/flex
6485 + app-arch/xz-utils[static-libs]
6486 + sys-libs/ncurses[static-libs]
6487 + dev-libs/expat[static-libs]
6488 + app-arch/bzip2[static-libs]
6489 + dev-libs/libedit[static-libs]
6490 + dev-libs/libxml2:2[static-libs]
6491 + dev-libs/openssl:0=[static-libs]
6492 + sys-libs/zlib[static-libs]
6493 + sys-libs/readline[static-libs]
6494 + =sys-freebsd/freebsd-lib-${RV}*[atm?,netware?]
6495 + =sys-freebsd/freebsd-sources-${RV}*
6496 + =sys-freebsd/freebsd-mk-defs-${RV}*
6497 + zfs? ( =sys-freebsd/freebsd-cddl-${RV}* )"
6498 +
6499 +S="${WORKDIR}/rescue"
6500 +
6501 +pkg_setup() {
6502 + # Add the required source files.
6503 + use zfs && EXTRACTONLY+="cddl/ "
6504 +
6505 + use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
6506 + use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= "
6507 + use nis || mymakeopts="${mymakeopts} WITHOUT_NIS= "
6508 + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
6509 + mymakeopts="${mymakeopts} NO_PIC= "
6510 +}
6511 +
6512 +src_prepare() {
6513 + # As they are patches from ${WORKDIR} apply them by hand
6514 + cd "${WORKDIR}" || die
6515 + epatch "${FILESDIR}/${PN}"-10.0-zlib.patch
6516 + epatch "${FILESDIR}/freebsd-sbin-bsdxml2expat.patch"
6517 + epatch "${FILESDIR}/freebsd-ubin-10.2-bsdxml.patch"
6518 +}
6519 +
6520 +src_compile() {
6521 + tc-export CC
6522 + # crunchgen is now checks env MAKE.
6523 + # Use to force BSD's make
6524 + export MAKE=/usr/bin/make
6525 +
6526 + cd "${WORKDIR}/lib/libarchive" || die
6527 + echo "#include <expat.h>" > bsdxml.h
6528 + freebsd_src_compile
6529 + export CC="${CC} -L${WORKDIR}/lib/libarchive"
6530 +
6531 + cd "${S}" || die
6532 + freebsd_src_compile
6533 +}
6534
6535 diff --git a/sys-freebsd/freebsd-rescue/metadata.xml b/sys-freebsd/freebsd-rescue/metadata.xml
6536 new file mode 100644
6537 index 0000000..8703f7b
6538 --- /dev/null
6539 +++ b/sys-freebsd/freebsd-rescue/metadata.xml
6540 @@ -0,0 +1,12 @@
6541 +<?xml version="1.0" encoding="UTF-8"?>
6542 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
6543 +<pkgmetadata>
6544 +<maintainer type="project">
6545 + <email>bsd@g.o</email>
6546 + <name>BSD Project</name>
6547 + </maintainer>
6548 + <use>
6549 + <flag name="zfs">Enable ZFS support.</flag>
6550 + <flag name="netware"> Build tools to work with NetWare protocols (IPX and NCP).</flag>
6551 + </use>
6552 +</pkgmetadata>
6553
6554 diff --git a/sys-freebsd/freebsd-sbin/files/adjkerntz-crontab b/sys-freebsd/freebsd-sbin/files/adjkerntz-crontab
6555 new file mode 100644
6556 index 0000000..5fc46f5
6557 --- /dev/null
6558 +++ b/sys-freebsd/freebsd-sbin/files/adjkerntz-crontab
6559 @@ -0,0 +1,4 @@
6560 +# Adjust the time zone if the CMOS clock keeps local time, as opposed to
6561 +# UTC time. See adjkerntz(8) for details.
6562 +1,31 0-5 * * * root /sbin/adjkerntz -a
6563 +
6564
6565 diff --git a/sys-freebsd/freebsd-sbin/files/devd.conf b/sys-freebsd/freebsd-sbin/files/devd.conf
6566 new file mode 100644
6567 index 0000000..fd1e035
6568 --- /dev/null
6569 +++ b/sys-freebsd/freebsd-sbin/files/devd.conf
6570 @@ -0,0 +1,153 @@
6571 +# Refer to devd.conf(5) and devd(8) man pages for the details on how to
6572 +# run and configure devd.
6573 +#
6574 +
6575 +# NB: All regular expressions have an implicit ^$ around them.
6576 +# NB: device-name is shorthand for 'match device-name'
6577 +
6578 +options {
6579 + # Each directory directive adds a directory the list of directories
6580 + # that we scan for files. Files are read-in in the order that they
6581 + # are returned from readdir(3). The rule-sets are combined to
6582 + # create a DFA that's used to match events to actions.
6583 + directory "/etc/devd";
6584 + directory "/usr/local/etc/devd";
6585 + pid-file "/var/run/devd.pid";
6586 +
6587 + # Setup some shorthand for regex that we use later in the file.
6588 + #XXX Yes, these are gross -- imp
6589 + set scsi-controller-regex
6590 + "(aac|adv|adw|aha|ahb|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|\
6591 + esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)\
6592 + [0-9]+";
6593 +};
6594 +
6595 +# Note that the attach/detach with the highest value wins, so that one can
6596 +# override these general rules.
6597 +
6598 +#
6599 +# For ethernet like devices start configuring the interface. Due to
6600 +# a historical accident, this script is called pccard_ether.
6601 +#
6602 +attach 0 {
6603 + media-type "ethernet";
6604 + action "/etc/devd_queue add env IN_HOTPLUG=1 /etc/init.d/net.$device-name start";
6605 +};
6606 +
6607 +detach 0 {
6608 + media-type "ethernet";
6609 + action "/etc/devd_queue add env IN_HOTPLUG=1 /etc/init.d/net.$device-name stop";
6610 +};
6611 +
6612 +#
6613 +# Try to start dhclient on Ethernet like interfaces when the link comes
6614 +# up. Only devices that are configured to support DHCP will actually
6615 +# run it. No link down rule exists because dhclient automaticly exits
6616 +# when the link goes down.
6617 +#
6618 +notify 0 {
6619 + match "system" "IFNET";
6620 + match "type" "LINK_UP";
6621 + media-type "ethernet";
6622 + action "/etc/devd_queue add /etc/init.d/net.$subsystem start";
6623 +};
6624 +notify 0 {
6625 + match "system" "IFNET";
6626 + match "type" "LINK_DOWN";
6627 + media-type "ethernet";
6628 + action "/etc/devd_queue add /etc/init.d/net.$subsystem stop";
6629 +};
6630 +
6631 +#
6632 +# Like Ethernet devices, but separate because
6633 +# they have a different media type. We may want
6634 +# to exploit this later.
6635 +#
6636 +#detach 0 {
6637 +# media-type "802.11";
6638 +# action "env IN_HOTPLUG=1 /etc/init.d/net.$device-name stop";
6639 +#};
6640 +#attach 0 {
6641 +# media-type "802.11";
6642 +# action "env IN_HOTPLUG=1 /etc/init.d/net.$device-name start";
6643 +#};
6644 +
6645 +# Not sure how to handle this in Gentoo yet
6646 +# When a USB Bluetooth dongle appears activate it
6647 +#attach 100 {
6648 +# device-name "ubt[0-9]+";
6649 +# action "/etc/rc.d/bluetooth start $device-name";
6650 +#};
6651 +#detach 100 {
6652 +# device-name "ubt[0-9]+";
6653 +# action "/etc/rc.d/bluetooth stop $device-name";
6654 +#};
6655 +
6656 +# When a USB keyboard arrives, attach it as the console keyboard.
6657 +attach 100 {
6658 + device-name "ukbd0";
6659 + action "kbdcontrol -k /dev/ukbd0 < /dev/console";
6660 +};
6661 +detach 100 {
6662 + device-name "ukbd0";
6663 + action "kbdcontrol -k /dev/kbd0 < /dev/console";
6664 +};
6665 +
6666 +# The entry below starts and stops moused when a mouse is plugged in.
6667 +attach 100 {
6668 + device-name "psm[0-9]+";
6669 + action "/etc/devd_queue add env IN_HOTPLUG=1 /etc/init.d/moused.$device-name start";
6670 +};
6671 +detach 100 {
6672 + device-name "psm[0-9]+";
6673 + action "/etc/devd_queue add env IN_HOTPLUG=1 /etc/init.d/moused.$device-name stop";
6674 +};
6675 +attach 100 {
6676 + device-name "ums[0-9]+";
6677 + action "/etc/devd_queue add env IN_HOTPLUG=1 /etc/init.d/moused.$device-name start";
6678 +};
6679 +detach 100 {
6680 + device-name "ums[0-9]+";
6681 + action "/etc/devd_queue add env IN_HOTPLUG=1 /etc/init.d/moused.$device-name stop";
6682 +};
6683 +
6684 +# Notify all users before beginning emergency shutdown when we get
6685 +# a _CRT or _HOT thermal event and we're going to power down the system
6686 +# very soon.
6687 +notify 10 {
6688 + match "system" "ACPI";
6689 + match "subsystem" "Thermal";
6690 + match "notify" "0xcc";
6691 + action "logger -p kern.emerg 'WARNING: system temperature too high, shutting down soon!'";
6692 +};
6693 +
6694 +/* EXAMPLES TO END OF FILE
6695 +
6696 +
6697 +# Examples of notify hooks. A notify is a generic way for a kernel
6698 +# subsystem to send event notification to userland.
6699 +#
6700 +# Here are some examples of ACPI notify handlers. ACPI subsystems that
6701 +# generate notifies include the AC adapter, power/sleep buttons,
6702 +# control method batteries, lid switch, and thermal zones.
6703 +#
6704 +# Information returned is not always the same as the ACPI notify
6705 +# events. See the ACPI specification for more information about
6706 +# notifies. Here is the information returned for each subsystem:
6707 +#
6708 +# ACAD: AC line state (0 is offline, 1 is online)
6709 +# Button: Button pressed (0 for power, 1 for sleep)
6710 +# CMBAT: ACPI battery events
6711 +# Lid: Lid state (0 is closed, 1 is open)
6712 +# Thermal: ACPI thermal zone events
6713 +#
6714 +# This example calls a script when the AC state changes, passing the
6715 +# notify value as the first argument. If the state is 0x00, it might
6716 +# call some sysctls to implement economy mode. If 0x01, it might set
6717 +# the mode to performance.
6718 +notify 10 {
6719 + match "system" "ACPI";
6720 + match "subsystem" "ACAD";
6721 + action "/etc/acpi_ac $notify";
6722 +};
6723 +*/
6724
6725 diff --git a/sys-freebsd/freebsd-sbin/files/devd.initd b/sys-freebsd/freebsd-sbin/files/devd.initd
6726 new file mode 100644
6727 index 0000000..6171258
6728 --- /dev/null
6729 +++ b/sys-freebsd/freebsd-sbin/files/devd.initd
6730 @@ -0,0 +1,47 @@
6731 +#!/sbin/openrc-run
6732 +# Copyright 1999-2006 Gentoo Foundation
6733 +# Distributed under the terms of the GNU General Public License v2
6734 +
6735 +depend() {
6736 + need localmount
6737 + after bootmisc hostname
6738 + before net
6739 +}
6740 +
6741 +start() {
6742 + # Services may depend on us, so mark us as inactive
6743 + mark_service_inactive "${SVCNAME}"
6744 +
6745 + # Create a queue so that if things went UP DOWN UP DOWN UP DOWN UP
6746 + # We just do an UP
6747 + # This is used by /etc/devd_queue
6748 + mkdir -p /var/run/devd
6749 +
6750 + ebegin "Starting the Device State Change Daemon"
6751 + sysctl hw.bus.devctl_disable=0 >/dev/null
6752 + start-stop-daemon --start --exec /sbin/devd \
6753 + --pidfile /var/run/devd.pid
6754 + eend $? "Failed to start devd" \
6755 + || return $?
6756 +
6757 + ebegin "Waiting for Device State Change Daemon to settle"
6758 + LC_ALL=C sleep "${DEVD_WAIT:-2}"
6759 + eend $?
6760 +
6761 + # Now flush the queue
6762 + einfo "Flushing Device State Change Daemon queue"
6763 + /etc/devd_queue flush
6764 +
6765 + mark_service_started "${SVCNAME}"
6766 + return 0
6767 +}
6768 +
6769 +stop() {
6770 + ebegin "Stopping the Device State Change Daemon"
6771 + sysctl hw.bus.devctl_disable=1 >/dev/null
6772 + start-stop-daemon --stop --exec /sbin/devd \
6773 + --pidfile /var/run/devd.pid
6774 + eend $? "Failed to stop devd"
6775 +}
6776 +
6777 +# vim: ts=4 :
6778
6779 diff --git a/sys-freebsd/freebsd-sbin/files/devd_queue b/sys-freebsd/freebsd-sbin/files/devd_queue
6780 new file mode 100644
6781 index 0000000..d42cb83
6782 --- /dev/null
6783 +++ b/sys-freebsd/freebsd-sbin/files/devd_queue
6784 @@ -0,0 +1,50 @@
6785 +#!/bin/sh
6786 +
6787 +# Notify the rc system that we're in the background
6788 +export IN_BACKGROUND=true
6789 +
6790 +arg1="$1"
6791 +if [ -z "$arg1" ] ; then
6792 + echo "Command required" > /dev/stderr
6793 + exit 1
6794 +fi
6795 +shift
6796 +
6797 +case "$arg1" in
6798 + add)
6799 + if [ -z "$1" ] ; then
6800 + echo "Command missing!" > /dev/stderr
6801 + exit 1
6802 + fi
6803 +
6804 + # If we don't have a queue then just run
6805 + if [ ! -d /var/run/devd ] ; then
6806 + "$@"
6807 + exit $?
6808 + fi
6809 +
6810 + cmd="$1"
6811 + args="$*"
6812 + if [ "$cmd" = "env" ] ; then
6813 + shift
6814 + while echo "$1" | grep -q "="; do
6815 + shift
6816 + [ "$1" = "--" ] && shift && break
6817 + done
6818 + cmd="$1"
6819 + fi
6820 + echo "$args" > /var/run/devd/$(basename "$cmd")
6821 + ;;
6822 + flush)
6823 + while ! rmdir /var/run/devd 2>/dev/null ; do
6824 + for cmd in $(cd /var/run/devd; ls) ; do
6825 + args=$(cat /var/run/devd/$cmd)
6826 + rm -f /var/run/devd/$cmd
6827 + $args
6828 + done
6829 + done
6830 + ;;
6831 + *)
6832 + echo "Unknown command $arg1"
6833 + ;;
6834 +esac
6835
6836 diff --git a/sys-freebsd/freebsd-sbin/files/freebsd-sbin-10.0-zlib.patch b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-10.0-zlib.patch
6837 new file mode 100644
6838 index 0000000..c0a2bf9
6839 --- /dev/null
6840 +++ b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-10.0-zlib.patch
6841 @@ -0,0 +1,22 @@
6842 +diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
6843 +index bdbf7e3..a4c67ec 100644
6844 +--- a/sbin/savecore/savecore.c
6845 ++++ b/sbin/savecore/savecore.c
6846 +@@ -92,7 +92,7 @@ static int checkfor, compress, clear, force, keep, verbose; /* flags */
6847 + static int nfound, nsaved, nerr; /* statistics */
6848 + static int maxdumps;
6849 +
6850 +-extern FILE *zopen(const char *, const char *);
6851 ++extern FILE *gzopen(const char *, const char *);
6852 +
6853 + static sig_atomic_t got_siginfo;
6854 + static void infohandler(int);
6855 +@@ -626,7 +626,7 @@ DoFile(const char *savedir, const char *device)
6856 + if (compress) {
6857 + snprintf(corename, sizeof(corename), "%s.%d.gz",
6858 + istextdump ? "textdump.tar" : "vmcore", bounds);
6859 +- fp = zopen(corename, "w");
6860 ++ fp = gzopen(corename, "w");
6861 + } else {
6862 + snprintf(corename, sizeof(corename), "%s.%d",
6863 + istextdump ? "textdump.tar" : "vmcore", bounds);
6864
6865 diff --git a/sys-freebsd/freebsd-sbin/files/freebsd-sbin-6.1-pr102701.patch b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-6.1-pr102701.patch
6866 new file mode 100644
6867 index 0000000..7b9578c
6868 --- /dev/null
6869 +++ b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-6.1-pr102701.patch
6870 @@ -0,0 +1,17 @@
6871 +Solves the issue reported in Problem Report bin/102701.
6872 +
6873 +Can't delete an inet6 alias address from an interface.
6874 +
6875 +Index: fbsd-6.1/sbin/ifconfig/af_inet6.c
6876 +===================================================================
6877 +--- fbsd-6.1.orig/sbin/ifconfig/af_inet6.c
6878 ++++ fbsd-6.1/sbin/ifconfig/af_inet6.c
6879 +@@ -515,7 +515,7 @@ static struct afswtch af_inet6 = {
6880 + .af_settunnel = in6_set_tunnel,
6881 + .af_difaddr = SIOCDIFADDR_IN6,
6882 + .af_aifaddr = SIOCAIFADDR_IN6,
6883 +- .af_ridreq = &in6_addreq,
6884 ++ .af_ridreq = &in6_ridreq,
6885 + .af_addreq = &in6_addreq,
6886 + };
6887 +
6888
6889 diff --git a/sys-freebsd/freebsd-sbin/files/freebsd-sbin-6.2-ldconfig.patch b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-6.2-ldconfig.patch
6890 new file mode 100644
6891 index 0000000..81ad024
6892 --- /dev/null
6893 +++ b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-6.2-ldconfig.patch
6894 @@ -0,0 +1,13 @@
6895 +diff -ur sbin.orig/ldconfig/elfhints.c sbin/ldconfig/elfhints.c
6896 +--- sbin.orig/ldconfig/elfhints.c 2001-05-03 00:56:18 +0100
6897 ++++ sbin/ldconfig/elfhints.c 2007-08-06 10:16:24 +0100
6898 +@@ -245,6 +245,9 @@
6899 + else
6900 + add_dir(hintsfile, argv[i], 0);
6901 + }
6902 ++ /* Always add our system dirs */
6903 ++ add_dir (hintsfile, "/lib", 1);
6904 ++ add_dir (hintsfile, "/usr/lib", 1);
6905 + write_elf_hints(hintsfile);
6906 + }
6907 +
6908
6909 diff --git a/sys-freebsd/freebsd-sbin/files/freebsd-sbin-7.1-zlib.patch b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-7.1-zlib.patch
6910 new file mode 100644
6911 index 0000000..22fb2ec
6912 --- /dev/null
6913 +++ b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-7.1-zlib.patch
6914 @@ -0,0 +1,21 @@
6915 +diff -ur sbin/savecore/savecore.c sbin-zlib/savecore/savecore.c
6916 +--- sbin/savecore/savecore.c 2005-02-26 01:21:50 +0000
6917 ++++ sbin-zlib/savecore/savecore.c 2005-05-06 12:00:06 +0000
6918 +@@ -95,7 +95,7 @@
6919 + static int checkfor, compress, clear, force, keep, verbose; /* flags */
6920 + static int nfound, nsaved, nerr; /* statistics */
6921 +
6922 +-extern FILE *zopen(const char *, const char *);
6923 ++extern FILE *gzopen(const char *, const char *);
6924 +
6925 + static void
6926 + printheader(FILE *f, const struct kerneldumpheader *h, const char *device,
6927 +@@ -553,7 +553,7 @@
6928 + if (compress) {
6929 + sprintf(filename, "%s.%d.gz", istextdump ? "textdump.tar" :
6930 + "vmcore", bounds);
6931 +- fp = zopen(filename, "w");
6932 ++ fp = gzopen(filename, "w");
6933 + } else {
6934 + sprintf(filename, "%s.%d", istextdump ? "textdump.tar" :
6935 + "vmcore", bounds);
6936
6937 diff --git a/sys-freebsd/freebsd-sbin/files/freebsd-sbin-bsdxml2expat.patch b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-bsdxml2expat.patch
6938 new file mode 100644
6939 index 0000000..bdda99b
6940 --- /dev/null
6941 +++ b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-bsdxml2expat.patch
6942 @@ -0,0 +1,13 @@
6943 +diff -uNr sbin/ifconfig.old/regdomain.c sbin/ifconfig/regdomain.c
6944 +--- sbin/ifconfig.old/regdomain.c 2010-12-21 17:09:25.000000000 +0000
6945 ++++ sbin/ifconfig/regdomain.c 2011-07-10 15:56:27.000000000 +0000
6946 +@@ -39,7 +39,7 @@
6947 + #include <err.h>
6948 + #include <unistd.h>
6949 +
6950 +-#include <bsdxml.h>
6951 ++#include <expat.h>
6952 +
6953 + #include "regdomain.h"
6954 +
6955 +Los ficheros binarios sbin/ifconfig.old/regdomain.o y sbin/ifconfig/regdomain.o son distintos
6956
6957 diff --git a/sys-freebsd/freebsd-sbin/files/freebsd-sbin-setXid.patch b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-setXid.patch
6958 new file mode 100644
6959 index 0000000..c8cbebc
6960 --- /dev/null
6961 +++ b/sys-freebsd/freebsd-sbin/files/freebsd-sbin-setXid.patch
6962 @@ -0,0 +1,20 @@
6963 +diff -ur sbin.orig/ping/Makefile sbin.setXid/ping/Makefile
6964 +--- sbin.orig/ping/Makefile Thu Apr 7 20:27:57 2005
6965 ++++ sbin.setXid/ping/Makefile Thu Apr 7 20:42:02 2005
6966 +@@ -18,4 +18,6 @@
6967 + LDADD+= -lipsec
6968 + .endif
6969 +
6970 ++LDFLAGS+= -Wl,-z,now
6971 ++
6972 + .include <bsd.prog.mk>
6973 +diff -ur sbin.orig/shutdown/Makefile sbin.setXid/shutdown/Makefile
6974 +--- sbin.orig/shutdown/Makefile Thu Apr 7 20:27:57 2005
6975 ++++ sbin.setXid/shutdown/Makefile Thu Apr 7 20:42:17 2005
6976 +@@ -7,4 +7,6 @@
6977 + BINGRP= operator
6978 + BINMODE=4550
6979 +
6980 ++LDFLAGS+= -Wl,-z,now
6981 ++
6982 + .include <bsd.prog.mk>
6983
6984 diff --git a/sys-freebsd/freebsd-sbin/files/idmapd.initd b/sys-freebsd/freebsd-sbin/files/idmapd.initd
6985 new file mode 100644
6986 index 0000000..60a0bb8
6987 --- /dev/null
6988 +++ b/sys-freebsd/freebsd-sbin/files/idmapd.initd
6989 @@ -0,0 +1,20 @@
6990 +#!/sbin/openrc-run
6991 +# Copyright 1999-2008 Gentoo Foundation
6992 +# Distributed under the terms of the GNU General Public License v2
6993 +
6994 +depend() {
6995 + need rpcbind
6996 +}
6997 +
6998 +start() {
6999 + ebegin "Starting NFS idmapd"
7000 + start-stop-daemon --start --quiet --exec \
7001 + /sbin/idmapd -- $idmapdopts
7002 + eend $? "Error starting NFS idmapd"
7003 +}
7004 +
7005 +stop() {
7006 + ebegin "Stopping NFS idmapd"
7007 + start-stop-daemon --stop --quiet --exec /sbin/idmapd
7008 + eend $? "Error stopping NFS idmapd"
7009 +}
7010
7011 diff --git a/sys-freebsd/freebsd-sbin/files/ipfw.confd b/sys-freebsd/freebsd-sbin/files/ipfw.confd
7012 new file mode 100644
7013 index 0000000..687f92d
7014 --- /dev/null
7015 +++ b/sys-freebsd/freebsd-sbin/files/ipfw.confd
7016 @@ -0,0 +1,10 @@
7017 +# ipfw provides a stateful firewall.
7018 +# This means we allow everything out, and if we have a connection we allow it
7019 +# back in. This is very flexable and quite secure.
7020 +
7021 +# For ease of use, we allow auth and ssh ports through as well.
7022 +# To override the list of allowed ports
7023 +#PORTS_IN="auth ssh"
7024 +
7025 +# You may want to enable logging of denied connections
7026 +#LOG_DENY="yes"
7027
7028 diff --git a/sys-freebsd/freebsd-sbin/files/ipfw.initd b/sys-freebsd/freebsd-sbin/files/ipfw.initd
7029 new file mode 100644
7030 index 0000000..13cdaee
7031 --- /dev/null
7032 +++ b/sys-freebsd/freebsd-sbin/files/ipfw.initd
7033 @@ -0,0 +1,110 @@
7034 +#!/sbin/openrc-run
7035 +# Copyright 2007 Gentoo Foundation
7036 +# Distributed under the terms of the GNU General Public License v2
7037 +
7038 +# This is a nice client firewall script which should suit most desktop users.
7039 +# We allow auth and ssh in by default.
7040 +
7041 +PORTS_IN=${PORTS_IN-auth ssh}
7042 +
7043 +opts="panic showstatus"
7044 +
7045 +depend() {
7046 + before net
7047 + provide firewall
7048 +}
7049 +
7050 +ipfw() {
7051 + /sbin/ipfw -f -q "$@"
7052 +}
7053 +
7054 +init() {
7055 + # Load the kernel module
7056 + if ! sysctl net.inet.ip.fw.enable=1 >/dev/null 2>/dev/null ; then
7057 + if ! kldload ipfw ; then
7058 + eend 1 "Unable to load firewall module"
7059 + return 1
7060 + fi
7061 + fi
7062 +
7063 + ipfw flush
7064 +
7065 + ipfw add allow all from any to any via lo0
7066 + ipfw add allow all from any to 127.0.0.0/8
7067 + ipfw add deny ip from 127.0.0.0/8 to any
7068 +
7069 + ipfw add allow ipv6-icmp from :: to ff02::/16
7070 + ipfw add allow ipv6-icmp from fe80::/10 to fe80::/10
7071 + ipfw add allow ipv6-icmp from fe80::/10 to ff02::/16
7072 +}
7073 +
7074 +start() {
7075 + local x= log=
7076 + ebegin "Starting firewall rules"
7077 + if ! init ; then
7078 + eend 1 "Failed to flush firewall ruleset"
7079 + return 1
7080 + fi
7081 +
7082 + [ "${LOG_DENY}" = "yes" ] && log="log"
7083 +
7084 + # Use a statefull firewall
7085 + ipfw add check-state
7086 +
7087 + # Open our configured ports
7088 + if [ -n "${PORTS_IN}" ] ; then
7089 + local pin=
7090 + for x in ${PORTS_IN} ; do
7091 + pin="${pin}${pin:+,}${x}"
7092 + done
7093 + ipfw add allow tcp from any to me ${pin} established keep-state
7094 + ipfw add allow tcp from any to me6 ${pin} established keep-state
7095 + ipfw add allow tcp from any to me ${pin} setup keep-state
7096 + ipfw add allow tcp from any to me6 ${pin} setup keep-state
7097 + ipfw add allow udp from any to me ${pin} established
7098 + ipfw add allow udp from any to me ${pin} keep-state
7099 + ipfw add allow udp from any to me6 ${pin} established
7100 + ipfw add allow udp from any to me6 ${pin} keep-state
7101 + fi
7102 +
7103 + # Nice flexable rules that disallow incoming except for stuff we
7104 + # have asked for, and allow all outgoing.
7105 + ipfw add allow tcp from me to any established keep-state
7106 + ipfw add allow tcp from me to any setup keep-state
7107 + ipfw add allow tcp from me6 to any established keep-state
7108 + ipfw add allow tcp from me6 to any setup keep-state
7109 + ipfw add deny ${log} tcp from any to any
7110 + ipfw add allow udp from me to any established
7111 + ipfw add allow udp from me to any keep-state
7112 + ipfw add allow udp from me6 to any established
7113 + ipfw add allow udp from me6 to any keep-state
7114 + ipfw add deny ${log} udp from any to any
7115 +
7116 + # Be a good firewall and allow some ICMP traffic.
7117 + # Remove 8 if you really want to disallow ping.
7118 + ipfw add allow icmp from any to any icmptypes 0,3,8,11,12
7119 + ipfw add allow ip6 from any to any proto ipv6-icmp
7120 +
7121 + eend 0
7122 +}
7123 +
7124 +stop() {
7125 + ebegin "Stopping firewall rules"
7126 + # We don't unload the kernel module as that action
7127 + # can cause memory leaks as of FreeBSD 6.x
7128 + sysctl net.inet.ip.fw.enable=0 >/dev/null
7129 + eend $?
7130 +}
7131 +
7132 +panic() {
7133 + ebegin "Stopping firewall rules - hard"
7134 + if ! init ; then
7135 + eend 1 "Failed to flush firewall ruleset"
7136 + return 1
7137 + fi
7138 + eend 0
7139 +}
7140 +
7141 +showstatus() {
7142 + ipfw show
7143 +}
7144
7145 diff --git a/sys-freebsd/freebsd-sbin/files/sysctl.initd b/sys-freebsd/freebsd-sbin/files/sysctl.initd
7146 new file mode 100644
7147 index 0000000..9b8aaf8
7148 --- /dev/null
7149 +++ b/sys-freebsd/freebsd-sbin/files/sysctl.initd
7150 @@ -0,0 +1,28 @@
7151 +#!/sbin/openrc-run
7152 +# Copyright 1999-2005 Gentoo Foundation
7153 +# Distributed under the terms of the GNU General Public License v2
7154 +# $Id$
7155 +
7156 +depend() {
7157 + after checkroot root
7158 +}
7159 +
7160 +start() {
7161 + ebegin "Configuring kernel parameters"
7162 +
7163 + if [ ! -f /etc/sysctl.conf ]; then
7164 + eend 1 "/etc/sysctl.conf" "not found"
7165 + return 1
7166 + fi
7167 +
7168 + local retval=0 var= comments=
7169 + while read var comments ; do
7170 + case "${var}" in
7171 + ""|"#"*) continue;;
7172 + esac
7173 + sysctl "${var}" >/dev/null || retval=1
7174 + done < /etc/sysctl.conf
7175 + eend ${retval} "Some errors were encountered"
7176 +}
7177 +
7178 +# vim: set ts=4 :
7179
7180 diff --git a/sys-freebsd/freebsd-sbin/freebsd-sbin-11.0.ebuild b/sys-freebsd/freebsd-sbin/freebsd-sbin-11.0.ebuild
7181 new file mode 100644
7182 index 0000000..738e7a1
7183 --- /dev/null
7184 +++ b/sys-freebsd/freebsd-sbin/freebsd-sbin-11.0.ebuild
7185 @@ -0,0 +1,101 @@
7186 +# Copyright 1999-2016 Gentoo Foundation
7187 +# Distributed under the terms of the GNU General Public License v2
7188 +# $Id$
7189 +
7190 +EAPI=5
7191 +
7192 +inherit bsdmk freebsd multilib
7193 +
7194 +DESCRIPTION="FreeBSD sbin utils"
7195 +SLOT="0"
7196 +
7197 +if [[ ${PV} != *9999* ]]; then
7198 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
7199 +fi
7200 +
7201 +EXTRACTONLY="
7202 + sbin/
7203 + contrib/
7204 + lib/
7205 + libexec/
7206 + usr.sbin/
7207 + etc/
7208 +"
7209 +
7210 +RDEPEND="=sys-freebsd/freebsd-lib-${RV}*[ipv6?,atm?,netware?]
7211 + =sys-freebsd/freebsd-libexec-${RV}*
7212 + >=dev-libs/expat-2.0.1
7213 + ssl? ( dev-libs/openssl:0= )
7214 + >=dev-libs/libedit-20120311.3.0-r1
7215 + sys-libs/readline:0=
7216 + || (
7217 + sys-process/cronie
7218 + sys-process/vixie-cron
7219 + )
7220 + atm? ( net-analyzer/bsnmp )"
7221 +DEPEND="${RDEPEND}
7222 + !build? ( =sys-freebsd/freebsd-sources-${RV}* )
7223 + =sys-freebsd/freebsd-mk-defs-${RV}*"
7224 +
7225 +S="${WORKDIR}/sbin"
7226 +
7227 +IUSE="atm ipfilter +pf ipv6 build ssl +cxx netware"
7228 +
7229 +pkg_setup() {
7230 + # Add the required source files.
7231 + use build && EXTRACTONLY+="sys/ "
7232 +
7233 + use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
7234 + use cxx || mymakeopts="${mymakeopts} WITHOUT_CXX="
7235 + use ipfilter || mymakeopts="${mymakeopts} WITHOUT_IPFILTER= "
7236 + use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6= WITHOUT_INET6_SUPPORT="
7237 + use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
7238 + use pf || mymakeopts="${mymakeopts} WITHOUT_PF= "
7239 + use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL="
7240 +}
7241 +
7242 +REMOVE_SUBDIRS="dhclient pfctl pflogd rcorder resolvconf"
7243 +
7244 +PATCHES=( "${FILESDIR}/${PN}-setXid.patch"
7245 + "${FILESDIR}/${PN}-10.0-zlib.patch"
7246 + "${FILESDIR}/${PN}-6.2-ldconfig.patch"
7247 + "${FILESDIR}/${PN}-6.1-pr102701.patch"
7248 + "${FILESDIR}/${PN}-bsdxml2expat.patch" )
7249 +
7250 +src_prepare() {
7251 + if [[ ! -e "${WORKDIR}/sys" ]]; then
7252 + use build || ln -s "/usr/src/sys" "${WORKDIR}/sys"
7253 + fi
7254 +}
7255 +
7256 +src_install() {
7257 + mymakeopts="${mymakeopts} GEOM_CLASS_DIR=/$(get_libdir)/geom "
7258 + freebsd_src_install
7259 + keepdir /var/log
7260 + # Needed by ldconfig:
7261 + keepdir /var/run
7262 +
7263 + # Maybe ship our own sysctl.conf so things like radvd work out of the box.
7264 + # New wireless config method requires regdomain.xml in /etc
7265 + cd "${WORKDIR}/etc/" || die
7266 + insinto /etc
7267 + doins minfree sysctl.conf regdomain.xml || die
7268 +
7269 + # Install a crontab for adjkerntz
7270 + insinto /etc/cron.d
7271 + newins "${FILESDIR}/adjkerntz-crontab" adjkerntz
7272 +
7273 + # Install the periodic stuff (needs probably to be ported in a more
7274 + # gentooish way)
7275 + cd "${WORKDIR}/etc/periodic" || die
7276 +
7277 + doperiodic security \
7278 + security/*.ipfwlimit \
7279 + security/*.ipfwdenied || die
7280 +
7281 + use ipfilter && { doperiodic security \
7282 + security/*.ipfdenied || die ; }
7283 +
7284 + use pf && { doperiodic security \
7285 + security/*.pfdenied || die ; }
7286 +}
7287
7288 diff --git a/sys-freebsd/freebsd-sbin/metadata.xml b/sys-freebsd/freebsd-sbin/metadata.xml
7289 new file mode 100644
7290 index 0000000..dccfe68
7291 --- /dev/null
7292 +++ b/sys-freebsd/freebsd-sbin/metadata.xml
7293 @@ -0,0 +1,20 @@
7294 +<?xml version="1.0" encoding="UTF-8"?>
7295 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
7296 +<pkgmetadata>
7297 + <maintainer type="project">
7298 + <email>bsd@g.o</email>
7299 + <name>BSD Project</name>
7300 + </maintainer>
7301 + <use>
7302 + <flag name="ipfilter">
7303 + Build tools to administer the ipfilter firewall.
7304 + </flag>
7305 + <flag name="pf">
7306 + Build tools to administer the PF firewall.
7307 + </flag>
7308 + <flag name="netware">
7309 + Build libraries and tools to work with NetWare protocols (IPX
7310 + and NCP).
7311 + </flag>
7312 + </use>
7313 +</pkgmetadata>
7314
7315 diff --git a/sys-freebsd/freebsd-share/files/freebsd-share-10.0-gentoo-eapi3.patch b/sys-freebsd/freebsd-share/files/freebsd-share-10.0-gentoo-eapi3.patch
7316 new file mode 100644
7317 index 0000000..1d0a53e
7318 --- /dev/null
7319 +++ b/sys-freebsd/freebsd-share/files/freebsd-share-10.0-gentoo-eapi3.patch
7320 @@ -0,0 +1,17 @@
7321 +diff --git a/share/i18n/esdb/Makefile.part b/share/i18n/esdb/Makefile.part
7322 +index 9ca8577..329e9fb 100644
7323 +--- a/share/i18n/esdb/Makefile.part
7324 ++++ b/share/i18n/esdb/Makefile.part
7325 +@@ -13,10 +13,10 @@ PART!= sed '/^\#/d;/^ *$$/d' ${PARTFILE}
7326 + .endif
7327 + .if !defined(NO_EPREFIX)
7328 + CODESETS?= ${PART:C/^/${CODE}${SEP}/}
7329 +-EPREFIX?= ${CODE}${SEP}
7330 ++EPREFIX= ${CODE}${SEP}
7331 + .else
7332 + CODESETS?= ${PART}
7333 +-EPREFIX?=
7334 ++EPREFIX=
7335 + .endif
7336 + ESUBDIR?= ${CODE}
7337 + ESDB?= ${CODESETS:C/$/.esdb/:S/:/@/}
7338
7339 diff --git a/sys-freebsd/freebsd-share/files/freebsd-share-10.2-gnu-miscfiles.patch b/sys-freebsd/freebsd-share/files/freebsd-share-10.2-gnu-miscfiles.patch
7340 new file mode 100644
7341 index 0000000..1dc8488
7342 --- /dev/null
7343 +++ b/sys-freebsd/freebsd-share/files/freebsd-share-10.2-gnu-miscfiles.patch
7344 @@ -0,0 +1,30 @@
7345 +diff --git a/share/dict/Makefile b/share/dict/Makefile
7346 +index 3e2a0df..5395077 100644
7347 +--- a/share/dict/Makefile
7348 ++++ b/share/dict/Makefile
7349 +@@ -4,8 +4,7 @@
7350 + NO_OBJ=
7351 +
7352 + # XXX MISSING: connectives words
7353 +-FILES= README propernames web2 web2a freebsd
7354 ++FILES= README freebsd
7355 + FILESDIR= ${BINDIR}/dict
7356 +-SYMLINKS= web2 ${FILESDIR}/words
7357 +
7358 + .include <bsd.prog.mk>
7359 +diff --git a/share/misc/Makefile b/share/misc/Makefile
7360 +index ffd42d8..7eb90bb 100644
7361 +--- a/share/misc/Makefile
7362 ++++ b/share/misc/Makefile
7363 +@@ -5,9 +5,9 @@
7364 +
7365 + .PATH: ${.CURDIR}/../../sys/dev/usb
7366 +
7367 +-FILES= ascii birthtoken bsd-family-tree committers-doc.dot committers-ports.dot \
7368 ++FILES= bsd-family-tree committers-doc.dot committers-ports.dot \
7369 + committers-src.dot eqnchar flowers init.ee \
7370 +- iso3166 iso639 latin1 man.template mdoc.template operator pci_vendors \
7371 ++ iso3166 iso639 man.template mdoc.template pci_vendors \
7372 + scsi_modes \
7373 + organization.dot
7374 +
7375
7376 diff --git a/sys-freebsd/freebsd-share/files/freebsd-share-10.3-gentoo-skel.patch b/sys-freebsd/freebsd-share/files/freebsd-share-10.3-gentoo-skel.patch
7377 new file mode 100644
7378 index 0000000..79e29e9
7379 --- /dev/null
7380 +++ b/sys-freebsd/freebsd-share/files/freebsd-share-10.3-gentoo-skel.patch
7381 @@ -0,0 +1,20 @@
7382 +diff --git a/share/skel/Makefile b/share/skel/Makefile
7383 +index 024985c..6f6e563 100644
7384 +--- a/share/skel/Makefile
7385 ++++ b/share/skel/Makefile
7386 +@@ -2,11 +2,11 @@
7387 + # $FreeBSD: stable/10/share/skel/Makefile 291794 2015-12-04 18:21:05Z bdrewery $
7388 +
7389 + FILESGROUPS= FILES1 FILES2
7390 +-FILES1= dot.cshrc dot.login dot.login_conf dot.mailrc dot.profile \
7391 ++FILES1= dot.login_conf dot.mailrc \
7392 + dot.shrc
7393 +-FILES2= dot.mail_aliases dot.rhosts
7394 +-FILES1DIR= ${SHAREDIR}/skel
7395 +-FILES2DIR= ${SHAREDIR}/skel
7396 ++FILES2= dot.mail_aliases
7397 ++FILES1DIR= /etc/skel
7398 ++FILES2DIR= /etc/skel
7399 + FILES1MODE= 0644
7400 + FILES2MODE= 0600
7401 + NO_OBJ=
7402
7403 diff --git a/sys-freebsd/freebsd-share/files/freebsd-share-5.3-doc-locations.patch b/sys-freebsd/freebsd-share/files/freebsd-share-5.3-doc-locations.patch
7404 new file mode 100644
7405 index 0000000..c0798d3
7406 --- /dev/null
7407 +++ b/sys-freebsd/freebsd-share/files/freebsd-share-5.3-doc-locations.patch
7408 @@ -0,0 +1,20 @@
7409 +--- examples/smbfs/Makefile.orig Tue Mar 22 15:20:20 2005
7410 ++++ examples/smbfs/Makefile Tue Mar 22 15:20:46 2005
7411 +@@ -2,6 +2,7 @@
7412 +
7413 + NOOBJ=
7414 + BINDIR= /usr/share/examples/smbfs
7415 ++FILESDIR= ${DOCDIR}/smbfs
7416 + FILES= dot.nsmbrc
7417 +
7418 + .PATH: ${.CURDIR}/../../../contrib/smbfs/examples
7419 +--- examples/smbfs/print/Makefile.orig Tue Mar 22 15:22:17 2005
7420 ++++ examples/smbfs/print/Makefile Tue Mar 22 15:22:35 2005
7421 +@@ -2,6 +2,7 @@
7422 +
7423 + NOOBJ=
7424 + BINDIR= /usr/share/examples/smbfs/print
7425 ++FILESDIR= ${DOCDIR}/smbfs/print
7426 + FILES= lj6l ljspool printcap.sample tolj
7427 +
7428 + .PATH: ${.CURDIR}/../../../../contrib/smbfs/examples/print
7429
7430 diff --git a/sys-freebsd/freebsd-share/files/freebsd-share-5.4-gentoo-skel.patch b/sys-freebsd/freebsd-share/files/freebsd-share-5.4-gentoo-skel.patch
7431 new file mode 100644
7432 index 0000000..f668d04
7433 --- /dev/null
7434 +++ b/sys-freebsd/freebsd-share/files/freebsd-share-5.4-gentoo-skel.patch
7435 @@ -0,0 +1,20 @@
7436 +Index: fbsd/share/skel/Makefile
7437 +===================================================================
7438 +--- fbsd.orig/share/skel/Makefile
7439 ++++ fbsd/share/skel/Makefile
7440 +@@ -2,11 +2,11 @@
7441 + # $FreeBSD: src/share/skel/Makefile,v 1.9.2.1 2005/02/13 07:23:30 obrien Exp $
7442 +
7443 + FILESGROUPS= FILES1 FILES2
7444 +-FILES1= dot.cshrc dot.login dot.login_conf dot.mailrc dot.profile \
7445 ++FILES1= dot.login_conf dot.mailrc \
7446 + dot.shrc
7447 +-FILES2= dot.mail_aliases dot.rhosts
7448 +-FILES1DIR= /usr/share/skel
7449 +-FILES2DIR= /usr/share/skel
7450 ++FILES2= dot.mail_aliases
7451 ++FILES1DIR= /etc/skel
7452 ++FILES2DIR= /etc/skel
7453 + FILES1MODE= 0644
7454 + FILES2MODE= 0600
7455 + NOOBJ=
7456
7457 diff --git a/sys-freebsd/freebsd-share/files/freebsd-share-8.0-gnu-miscfiles.patch b/sys-freebsd/freebsd-share/files/freebsd-share-8.0-gnu-miscfiles.patch
7458 new file mode 100644
7459 index 0000000..19167a6
7460 --- /dev/null
7461 +++ b/sys-freebsd/freebsd-share/files/freebsd-share-8.0-gnu-miscfiles.patch
7462 @@ -0,0 +1,26 @@
7463 +--- share/misc/Makefile.old 2010-03-12 01:32:39 +0100
7464 ++++ share/misc/Makefile 2010-03-12 01:33:25 +0100
7465 +@@ -3,9 +3,9 @@
7466 +
7467 + .PATH: ${.CURDIR}/../../sys/dev/usb
7468 +
7469 +-FILES= ascii birthtoken bsd-family-tree committers-doc.dot committers-ports.dot \
7470 ++FILES= bsd-family-tree committers-doc.dot committers-ports.dot \
7471 + committers-src.dot eqnchar flowers init.ee \
7472 +- iso3166 iso639 latin1 man.template mdoc.template operator pci_vendors \
7473 ++ iso3166 iso639 man.template mdoc.template pci_vendors \
7474 + scsi_modes usb_hid_usages usbdevs
7475 +
7476 + NO_OBJ=
7477 +--- share/dict/Makefile.old 2010-03-12 01:33:53 +0100
7478 ++++ share/dict/Makefile 2010-03-12 01:34:18 +0100
7479 +@@ -4,8 +4,7 @@
7480 + NO_OBJ=
7481 +
7482 + # XXX MISSING: connectives words
7483 +-FILES= README propernames web2 web2a freebsd
7484 ++FILES= README freebsd
7485 + FILESDIR= ${BINDIR}/dict
7486 +-SYMLINKS= web2 ${FILESDIR}/words
7487 +
7488 + .include <bsd.prog.mk>
7489
7490 diff --git a/sys-freebsd/freebsd-share/files/freebsd-share-9.2-gnu-miscfiles.patch b/sys-freebsd/freebsd-share/files/freebsd-share-9.2-gnu-miscfiles.patch
7491 new file mode 100644
7492 index 0000000..af84dc3
7493 --- /dev/null
7494 +++ b/sys-freebsd/freebsd-share/files/freebsd-share-9.2-gnu-miscfiles.patch
7495 @@ -0,0 +1,28 @@
7496 +diff -Nur share.orig/dict/Makefile share/dict/Makefile
7497 +--- share.orig/dict/Makefile 2012-12-31 18:00:00.000000000 +0900
7498 ++++ share/dict/Makefile 2012-12-31 18:03:15.000000000 +0900
7499 +@@ -4,8 +4,7 @@
7500 + NO_OBJ=
7501 +
7502 + # XXX MISSING: connectives words
7503 +-FILES= README propernames web2 web2a freebsd
7504 ++FILES= README freebsd
7505 + FILESDIR= ${BINDIR}/dict
7506 +-SYMLINKS= web2 ${FILESDIR}/words
7507 +
7508 + .include <bsd.prog.mk>
7509 +diff -Nur share.orig/misc/Makefile share/misc/Makefile
7510 +--- share.orig/misc/Makefile 2012-12-31 18:00:00.000000000 +0900
7511 ++++ share/misc/Makefile 2012-12-31 18:04:22.000000000 +0900
7512 +@@ -3,9 +3,9 @@
7513 +
7514 + .PATH: ${.CURDIR}/../../sys/dev/usb
7515 +
7516 +-FILES= ascii birthtoken bsd-family-tree committers-doc.dot committers-ports.dot \
7517 ++FILES= bsd-family-tree committers-doc.dot committers-ports.dot \
7518 + committers-src.dot eqnchar flowers init.ee \
7519 +- iso3166 iso639 latin1 man.template mdoc.template operator pci_vendors \
7520 ++ iso3166 iso639 man.template mdoc.template pci_vendors \
7521 + scsi_modes usb_hid_usages usbdevs \
7522 + organization.dot
7523 +
7524
7525 diff --git a/sys-freebsd/freebsd-share/freebsd-share-11.0.ebuild b/sys-freebsd/freebsd-share/freebsd-share-11.0.ebuild
7526 new file mode 100644
7527 index 0000000..8ab449e
7528 --- /dev/null
7529 +++ b/sys-freebsd/freebsd-share/freebsd-share-11.0.ebuild
7530 @@ -0,0 +1,113 @@
7531 +# Copyright 1999-2016 Gentoo Foundation
7532 +# Distributed under the terms of the GNU General Public License v2
7533 +# $Id$
7534 +
7535 +EAPI=5
7536 +
7537 +inherit bsdmk freebsd
7538 +
7539 +DESCRIPTION="FreeBSD shared tools/files"
7540 +SLOT="0"
7541 +LICENSE="BSD zfs? ( CDDL )"
7542 +
7543 +IUSE="doc usb zfs"
7544 +
7545 +if [[ ${PV} != *9999* ]]; then
7546 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
7547 +fi
7548 +
7549 +EXTRACTONLY="
7550 + share/
7551 + contrib/
7552 + gnu/
7553 + usr.bin/
7554 + usr.sbin/
7555 + sbin/
7556 + bin/
7557 + lib/
7558 + etc/
7559 +"
7560 +
7561 +DEPEND="=sys-freebsd/freebsd-mk-defs-${RV}*
7562 + =sys-freebsd/freebsd-sources-${RV}*"
7563 +RDEPEND="sys-apps/miscfiles"
7564 +
7565 +RESTRICT="strip"
7566 +
7567 +S="${WORKDIR}/share"
7568 +
7569 +pkg_setup() {
7570 + # Add the required source files.
7571 + use zfs && EXTRACTONLY+="cddl/ "
7572 +
7573 + use doc || mymakeopts="${mymakeopts} NO_SHAREDOCS= "
7574 + use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
7575 + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
7576 + [[ ! -e /usr/bin/vtfontcvt ]] && mymakeopts="${mymakeopts} WITHOUT_VT= "
7577 +
7578 + mymakeopts="${mymakeopts} NO_SENDMAIL= NO_MANCOMPRESS= NO_INFOCOMPRESS= WITHOUT_CLANG= "
7579 +}
7580 +
7581 +REMOVE_SUBDIRS="mk termcap zoneinfo tabset"
7582 +
7583 +PATCHES=( "${FILESDIR}/${PN}-10.3-gentoo-skel.patch"
7584 + "${FILESDIR}/${PN}-10.0-gentoo-eapi3.patch"
7585 + "${FILESDIR}/${PN}-10.2-gnu-miscfiles.patch" )
7586 +
7587 +src_prepare() {
7588 + # Remove make.conf manpage as it describes bsdmk's make.conf.
7589 + sed -i -e 's:make.conf.5::' "${S}/man/man5/Makefile"
7590 + # Remove rc.conf manpage as it describes bsd's rc.conf.
7591 + sed -i -e 's:\brc.conf.5::' "${S}/man/man5/Makefile"
7592 + sed -i -e 's:\brc.conf.local.5::' "${S}/man/man5/Makefile"
7593 + # Remove mailer.conf manpage
7594 + sed -i -e 's:mailer.conf.5::' "${S}/man/man5/Makefile"
7595 + # Remove pbm and moduli(ssh) manpages
7596 + sed -i -e 's:pbm.5::' -e 's:moduli.5::' "${S}/man/man5/Makefile"
7597 + # Remove builtins manpage
7598 + sed -i -e '/builtins\.1/d' "${S}/man/man1/Makefile"
7599 + # Remove rc manpages
7600 + sed -i -e '/rc.8/d' "${S}/man/man8/Makefile"
7601 + # Remove hv_kvp_daemon.8 manpage. It's provided by freebsd-usbin.
7602 + sed -i -e '/hv_kvp_daemon.8/d' "${S}/man/man8/Makefile"
7603 +
7604 + # Don't install the arch-specific directories in subdirectories
7605 + sed -i -e '/MANSUBDIR/d' "${S}"/man/man4/man4.{i386,sparc64}/Makefile
7606 +
7607 + # Remove them so that they can't be included by error
7608 + rm -rf "${S}"/mk/*.mk
7609 +
7610 + # Make proper symlinks by defining the full target.
7611 + local sdir
7612 + for sdir in colldef mklocale monetdef msgdef numericdef timedef
7613 + do
7614 + sed -e 's:\${enc2}$:\${enc2}/\${FILESNAME}:g' -i \
7615 + "${S}/${sdir}/Makefile" || \
7616 + die "Error fixing ${sdir}/Makefile"
7617 + done
7618 + if [[ ! -e "${WORKDIR}/sys" ]]; then
7619 + ln -s "/usr/src/sys" "${WORKDIR}/sys" || die "failed to set sys symlink"
7620 + fi
7621 +}
7622 +
7623 +src_compile() {
7624 + export ESED="/usr/bin/sed"
7625 +
7626 + # libiconv support.
7627 + # i18n/csmapper/APPLE requires mkcsmapper_static
7628 + # i18n/esdb/APPLE requires mkesdb_static
7629 + for pkg in mkcsmapper_static mkesdb_static
7630 + do
7631 + cd "${WORKDIR}"/usr.bin/${pkg} || die
7632 + freebsd_src_compile
7633 + done
7634 +
7635 + # This is a groff problem and not a -shared problem.
7636 + cd "${S}" || die
7637 + export GROFF_TMAC_PATH="/usr/share/tmac/:/usr/share/groff/1.22.2/tmac/"
7638 + freebsd_src_compile -j1 || die "emake failed"
7639 +}
7640 +
7641 +src_install() {
7642 + mkmake -j1 DESTDIR="${D}" DOCDIR=/usr/share/doc/${PF} install || die "Install failed"
7643 +}
7644
7645 diff --git a/sys-freebsd/freebsd-share/metadata.xml b/sys-freebsd/freebsd-share/metadata.xml
7646 new file mode 100644
7647 index 0000000..9a9053f
7648 --- /dev/null
7649 +++ b/sys-freebsd/freebsd-share/metadata.xml
7650 @@ -0,0 +1,12 @@
7651 +<?xml version="1.0" encoding="UTF-8"?>
7652 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
7653 +<pkgmetadata>
7654 + <maintainer type="project">
7655 + <email>bsd@g.o</email>
7656 + <name>BSD Project</name>
7657 + </maintainer>
7658 + <use>
7659 + <flag name="isdn">Enable ISDN support</flag>
7660 + <flag name="zfs">Enable ZFS support.</flag>
7661 + </use>
7662 +</pkgmetadata>
7663
7664 diff --git a/sys-freebsd/freebsd-sources/files/config-GENTOO b/sys-freebsd/freebsd-sources/files/config-GENTOO
7665 new file mode 100644
7666 index 0000000..7c7eb26
7667 --- /dev/null
7668 +++ b/sys-freebsd/freebsd-sources/files/config-GENTOO
7669 @@ -0,0 +1,4 @@
7670 +# Kernel configuration for Gentoo/FreeBSD.
7671 +include GENERIC
7672 +ident GENTOO
7673 +
7674
7675 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-10.0-gentoo.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-10.0-gentoo.patch
7676 new file mode 100644
7677 index 0000000..c7e12bd
7678 --- /dev/null
7679 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-10.0-gentoo.patch
7680 @@ -0,0 +1,22 @@
7681 +diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
7682 +index 2939a59..124ef6f 100644
7683 +--- a/sys/conf/kern.mk
7684 ++++ b/sys/conf/kern.mk
7685 +@@ -5,7 +5,7 @@
7686 + #
7687 + CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
7688 + -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
7689 +- -Wundef -Wno-pointer-sign ${FORMAT_EXTENSIONS} \
7690 ++ -Wundef -Wno-pointer-sign \
7691 + -Wmissing-include-dirs -fdiagnostics-show-option \
7692 + ${CWARNEXTRA}
7693 + #
7694 +@@ -61,7 +61,7 @@ FORMAT_EXTENSIONS= -fformat-extensions
7695 + #
7696 + .if ${MACHINE_CPUARCH} == "i386"
7697 + .if ${COMPILER_TYPE} != "clang"
7698 +-CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2
7699 ++CFLAGS+= -mpreferred-stack-boundary=2
7700 + .else
7701 + CFLAGS+= -mno-aes -mno-avx
7702 + .endif
7703
7704 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-10.1-gcc48.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-10.1-gcc48.patch
7705 new file mode 100644
7706 index 0000000..5cb4cf8
7707 --- /dev/null
7708 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-10.1-gcc48.patch
7709 @@ -0,0 +1,18 @@
7710 +https://svnweb.freebsd.org/base?view=revision&revision=281606
7711 +
7712 +diff --git a/sys/crypto/aesni/aesencdec.h b/sys/crypto/aesni/aesencdec.h
7713 +index d4ed8b3..79847ee 100644
7714 +--- a/sys/crypto/aesni/aesencdec.h
7715 ++++ b/sys/crypto/aesni/aesencdec.h
7716 +@@ -27,6 +27,11 @@
7717 + *
7718 + */
7719 +
7720 ++#if defined(__GNUC__) && defined(_KERNEL)
7721 ++/* Suppress inclusion of gcc's mm_malloc.h header */
7722 ++#define _MM_MALLOC_H_INCLUDED 1
7723 ++#endif
7724 ++
7725 + #include <wmmintrin.h>
7726 +
7727 + static inline void
7728
7729 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-6.0-flex-2.5.31.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.0-flex-2.5.31.patch
7730 new file mode 100644
7731 index 0000000..88710cf
7732 --- /dev/null
7733 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.0-flex-2.5.31.patch
7734 @@ -0,0 +1,22 @@
7735 +Index: fbsd-6/sys/dev/aic7xxx/aicasm/aicasm_scan.l
7736 +===================================================================
7737 +--- fbsd-6.orig/sys/dev/aic7xxx/aicasm/aicasm_scan.l
7738 ++++ fbsd-6/sys/dev/aic7xxx/aicasm/aicasm_scan.l
7739 +@@ -528,7 +528,7 @@ expand_macro(struct symbol *macro_symbol
7740 +
7741 + /* Put back everything up until the replacement. */
7742 + while (body_pos > next_match)
7743 +- unput(*--body_pos);
7744 ++ yyunput(*--body_pos, body_head);
7745 +
7746 + /* Perform the replacement. */
7747 + if (match_marg != NULL) {
7748 +@@ -537,7 +537,7 @@ expand_macro(struct symbol *macro_symbol
7749 + next_match = match_marg->replacement_text;
7750 + strp = next_match + strlen(next_match);
7751 + while (strp > next_match)
7752 +- unput(*--strp);
7753 ++ yyunput(*--strp, next_match);
7754 +
7755 + /* Skip past the unexpanded macro arg. */
7756 + body_pos -= match.rm_eo - match.rm_so;
7757
7758 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-6.1-ntfs.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.1-ntfs.patch
7759 new file mode 100644
7760 index 0000000..e74fcd3
7761 --- /dev/null
7762 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-6.1-ntfs.patch
7763 @@ -0,0 +1,32 @@
7764 +--- sys/fs/ntfs/ntfs_vnops.c.orig 2006-10-17 17:31:36 -0300
7765 ++++ sys/fs/ntfs/ntfs_vnops.c 2006-10-17 17:30:24 -0300
7766 +@@ -507,8 +507,12 @@
7767 +
7768 + /* Simulate . in every dir except ROOT */
7769 + if( ip->i_number != NTFS_ROOTINO ) {
7770 +- struct dirent dot = { NTFS_ROOTINO,
7771 +- sizeof(struct dirent), DT_DIR, 1, "." };
7772 ++ struct dirent dot;
7773 ++ dot.d_fileno = NTFS_ROOTINO;
7774 ++ dot.d_reclen = sizeof(struct dirent);
7775 ++ dot.d_type = DT_DIR;
7776 ++ dot.d_namlen = 1;
7777 ++ bcopy(".", dot.d_name, 1);
7778 +
7779 + if( uio->uio_offset < sizeof(struct dirent) ) {
7780 + dot.d_fileno = ip->i_number;
7781 +@@ -522,8 +526,12 @@
7782 +
7783 + /* Simulate .. in every dir including ROOT */
7784 + if( uio->uio_offset < 2 * sizeof(struct dirent) ) {
7785 +- struct dirent dotdot = { NTFS_ROOTINO,
7786 +- sizeof(struct dirent), DT_DIR, 2, ".." };
7787 ++ struct dirent dotdot;
7788 ++ dotdot.d_fileno = NTFS_ROOTINO;
7789 ++ dotdot.d_reclen = sizeof(struct dirent);
7790 ++ dotdot.d_type = DT_DIR;
7791 ++ dotdot.d_namlen = 2;
7792 ++ bcopy("..", dotdot.d_name, 2);
7793 +
7794 + error = uiomove((char *)&dotdot,sizeof(struct dirent),uio);
7795 + if(error)
7796
7797 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-7.0-tmpfs_whiteout_stub.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.0-tmpfs_whiteout_stub.patch
7798 new file mode 100644
7799 index 0000000..13524ef
7800 --- /dev/null
7801 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.0-tmpfs_whiteout_stub.patch
7802 @@ -0,0 +1,44 @@
7803 +diff -ur sys/fs/tmpfs.orig/tmpfs_vnops.c sys/fs/tmpfs/tmpfs_vnops.c
7804 +--- sys/fs/tmpfs.orig/tmpfs_vnops.c 2008-06-22 12:17:48 -0300
7805 ++++ sys/fs/tmpfs/tmpfs_vnops.c 2008-06-28 12:05:10 -0300
7806 +@@ -1459,6 +1459,30 @@
7807 + return (0);
7808 + }
7809 +
7810 ++
7811 ++/* --------------------------------------------------------------------- */
7812 ++/* This does absolutely nothing */
7813 ++#ifdef GENTOO_LIVECD
7814 ++static int
7815 ++tmpfs_whiteout(struct vop_whiteout_args *ap)
7816 ++{
7817 ++ switch (ap->a_flags) {
7818 ++ case LOOKUP:
7819 ++ return (0);
7820 ++ break;
7821 ++ case CREATE:
7822 ++ return(EOPNOTSUPP);
7823 ++ break;
7824 ++ case DELETE:
7825 ++ return (0);
7826 ++ break;
7827 ++ default:
7828 ++ return(EOPNOTSUPP);
7829 ++ }
7830 ++ return(0);
7831 ++}
7832 ++#endif
7833 ++
7834 + /* --------------------------------------------------------------------- */
7835 +
7836 + /*
7837 +@@ -1484,6 +1508,9 @@
7838 + .vop_mkdir = tmpfs_mkdir,
7839 + .vop_rmdir = tmpfs_rmdir,
7840 + .vop_symlink = tmpfs_symlink,
7841 ++#ifdef GENTOO_LIVECD
7842 ++ .vop_whiteout = tmpfs_whiteout,
7843 ++#endif
7844 + .vop_readdir = tmpfs_readdir,
7845 + .vop_readlink = tmpfs_readlink,
7846 + .vop_inactive = tmpfs_inactive,
7847
7848 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-binutils_link.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-binutils_link.patch
7849 new file mode 100644
7850 index 0000000..43d01ba
7851 --- /dev/null
7852 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-binutils_link.patch
7853 @@ -0,0 +1,37 @@
7854 +diff -ruN sys.orig/conf/kern.post.mk sys/conf/kern.post.mk
7855 +--- sys.orig/conf/kern.post.mk 2007-03-23 18:55:59 -0300
7856 ++++ sys/conf/kern.post.mk 2008-06-18 19:51:13 -0300
7857 +@@ -85,7 +85,9 @@
7858 + ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
7859 + @rm -f ${.TARGET}
7860 + @echo linking ${.TARGET}
7861 +- ${SYSTEM_LD}
7862 ++ ${SYSTEM_LD} -o ${.TARGET}.tmp
7863 ++ @sh $S/tools/gen-ld-u-options ${.TARGET}.tmp > ${.TARGET}.lopt
7864 ++ ${SYSTEM_LD} "@${.TARGET}.lopt"
7865 + .if defined(CTFMERGE)
7866 + ${SYSTEM_CTFMERGE}
7867 + .endif
7868 +diff -ruN sys.orig/conf/kmod.mk sys/conf/kmod.mk
7869 +--- sys.orig/conf/kmod.mk 2008-06-18 09:11:53 -0300
7870 ++++ sys/conf/kmod.mk 2008-06-18 19:50:01 -0300
7871 +@@ -176,7 +176,8 @@
7872 +
7873 + .if ${MACHINE_ARCH} != amd64
7874 + ${FULLPROG}: ${KMOD}.kld
7875 +- ${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld
7876 ++ sh ./@/tools/gen-ld-u-options ${KMOD}.kld > ${KMOD}.lopt
7877 ++ ${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld "@${KMOD}.lopt"
7878 + .if !defined(DEBUG_FLAGS)
7879 + ${OBJCOPY} --strip-debug ${.TARGET}
7880 + .endif
7881 +diff -ruN sys.orig/tools/gen-ld-u-options sys/tools/gen-ld-u-options
7882 +--- sys.orig/tools/gen-ld-u-options 1969-12-31 21:00:00 -0300
7883 ++++ sys/tools/gen-ld-u-options 2008-06-18 19:47:56 -0300
7884 +@@ -0,0 +1,6 @@
7885 ++#!/bin/sh
7886 ++
7887 ++for i in `objdump -h -w $1 | grep set_ | cut -c5- | cut -f1 -d " "`
7888 ++do
7889 ++ echo -n " -u __start_$i -u __stop_$i "
7890 ++done
7891
7892 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-includes.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-includes.patch
7893 new file mode 100644
7894 index 0000000..3db46fa
7895 --- /dev/null
7896 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-includes.patch
7897 @@ -0,0 +1,13 @@
7898 +Make headers usable alone, include the headers they need.
7899 +There are probably much more missing.
7900 +
7901 +--- sys/net/if.h.old 2009-05-15 10:51:50 +0000
7902 ++++ sys/net/if.h 2009-05-15 10:52:05 +0000
7903 +@@ -34,6 +34,7 @@
7904 + #define _NET_IF_H_
7905 +
7906 + #include <sys/cdefs.h>
7907 ++#include <sys/socket.h>
7908 +
7909 + #ifdef _KERNEL
7910 + #include <sys/queue.h>
7911
7912 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-types.h-fix.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-types.h-fix.patch
7913 new file mode 100644
7914 index 0000000..8de5df2
7915 --- /dev/null
7916 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.1-types.h-fix.patch
7917 @@ -0,0 +1,15 @@
7918 +Fixes a compile error if XOPEN_SOURCE 600 is defined.
7919 +
7920 +See: http://www.mailinglistarchive.com/freebsd-current@×××××××.org/msg15011.html
7921 +
7922 +--- sys/sys/types.h.orig
7923 ++++ sys/sys/types.h
7924 +@@ -46,7 +46,7 @@
7925 +
7926 + #include <sys/_pthreadtypes.h>
7927 +
7928 +-#if __BSD_VISIBLE
7929 ++#ifndef _POSIX_SOURCE
7930 + typedef unsigned char u_char;
7931 + typedef unsigned short u_short;
7932 + typedef unsigned int u_int;
7933
7934 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-7.2-debug-O2.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.2-debug-O2.patch
7935 new file mode 100644
7936 index 0000000..4fa3565
7937 --- /dev/null
7938 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-7.2-debug-O2.patch
7939 @@ -0,0 +1,27 @@
7940 +My UltraSPARC U5 panics on boot about a memory alignment error when compiled
7941 +with gcc4 and -O. Compiling with -O2 fixes this, and it should not adversly
7942 +affect debugging.
7943 +
7944 +NOTE: This does not fix the memory alignment panic when loading kernel modules.
7945 +
7946 +Roy Marples (uberlord@g.o)
7947 +
7948 +--- sys/conf/kern.pre.mk.old 2009-05-22 10:09:46 +0000
7949 ++++ sys/conf/kern.pre.mk 2009-05-22 10:10:27 +0000
7950 +@@ -22,15 +22,13 @@
7951 + COPTFLAGS?= -O
7952 + .else
7953 + . if defined(DEBUG)
7954 +-_MINUS_O= -O
7955 + CTFFLAGS+= -g
7956 + . else
7957 +-_MINUS_O= -O2
7958 + . endif
7959 + . if ${MACHINE_ARCH} == "amd64"
7960 + COPTFLAGS?=-O2 -frename-registers -pipe
7961 + . else
7962 +-COPTFLAGS?=${_MINUS_O} -pipe
7963 ++COPTFLAGS?=-O2 -pipe
7964 + . endif
7965 + . if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
7966 + COPTFLAGS+= -fno-strict-aliasing
7967
7968 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-8.0-gentoo.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-8.0-gentoo.patch
7969 new file mode 100644
7970 index 0000000..0f8d070
7971 --- /dev/null
7972 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-8.0-gentoo.patch
7973 @@ -0,0 +1,33 @@
7974 +--- sys/conf/kern.mk.old 2007-05-24 23:53:42.000000000 +0200
7975 ++++ sys/conf/kern.mk 2008-03-14 14:37:47.216420518 +0100
7976 +@@ -12,7 +12,7 @@
7977 + .else
7978 + CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
7979 + -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
7980 +- ${_wundef} ${_Wno_pointer_sign} -fformat-extensions
7981 ++ ${_wundef} ${_Wno_pointer_sign}
7982 + .if !defined(WITH_GCC3)
7983 + _Wno_pointer_sign=-Wno-pointer-sign
7984 + .endif
7985 +@@ -36,7 +36,7 @@
7986 + # reserved for user applications.
7987 + #
7988 + .if ${MACHINE_ARCH} == "i386" && ${CC} != "icc"
7989 +-CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 \
7990 ++CFLAGS+= -mpreferred-stack-boundary=2 \
7991 + -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
7992 + INLINE_LIMIT?= 8000
7993 + .endif
7994 +Only in ./sys/conf: kern.mk.rej
7995 +Only in ./sys/conf: kern.mk~
7996 +--- sys/dev/aic7xxx/aicasm/Makefile.old 2010-03-10 14:01:50 +0100
7997 ++++ sys/dev/aic7xxx/aicasm/Makefile 2010-03-10 14:01:56 +0100
7998 +@@ -14,7 +14,7 @@
7999 + SRCS= ${GENHDRS} ${CSRCS} ${YSRCS} ${LSRCS}
8000 + CLEANFILES+= ${GENHDRS} ${YSRCS:R:C/(.*)/\1.output/g}
8001 + DPADD= ${LIBL}
8002 +-LDADD= -ll
8003 ++LDADD= -lfl
8004 + WARNS?= 6
8005 +
8006 + # Correct path for kernel builds
8007
8008 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-8.0-subnet-route-pr40133.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-8.0-subnet-route-pr40133.patch
8009 new file mode 100644
8010 index 0000000..a7335f6
8011 --- /dev/null
8012 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-8.0-subnet-route-pr40133.patch
8013 @@ -0,0 +1,21 @@
8014 +Fixes changing the default subnet route after removing an ip address.
8015 +
8016 +See: http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40133
8017 +and http://mail-index.netbsd.org/tech-net/2008/12/03/msg000896.html
8018 +
8019 +Thanks to Roy Marples.
8020 +--- sys/netinet/in.c.orig
8021 ++++ sys/netinet/in.c
8022 +@@ -858,6 +858,12 @@
8023 + error = rtinit(&target->ia_ifa, (int)RTM_ADD, flags);
8024 + if (!error)
8025 + target->ia_flags |= IFA_ROUTE;
8026 ++ else if (error == EEXIST) {
8027 ++ /*
8028 ++ * the fact that the route already exists is not an error.
8029 ++ */
8030 ++ error = 0;
8031 ++ }
8032 + return (error);
8033 + }
8034 +
8035
8036 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
8037 new file mode 100644
8038 index 0000000..50dacd0
8039 --- /dev/null
8040 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-8.2-unix2.patch
8041 @@ -0,0 +1,55 @@
8042 +Index: sys/kern/uipc_usrreq.c
8043 +===================================================================
8044 +--- sys/kern/uipc_usrreq.c (revision 225745)
8045 ++++ sys/kern/uipc_usrreq.c (working copy)
8046 +@@ -462,6 +462,8 @@
8047 + unp = sotounpcb(so);
8048 + KASSERT(unp != NULL, ("uipc_bind: unp == NULL"));
8049 +
8050 ++ if (soun->sun_len > sizeof(struct sockaddr_un))
8051 ++ return (EINVAL);
8052 + namelen = soun->sun_len - offsetof(struct sockaddr_un, sun_path);
8053 + if (namelen <= 0)
8054 + return (EINVAL);
8055 +@@ -1252,6 +1254,8 @@
8056 + unp = sotounpcb(so);
8057 + KASSERT(unp != NULL, ("unp_connect: unp == NULL"));
8058 +
8059 ++ if (nam->sa_len > sizeof(struct sockaddr_un))
8060 ++ return (EINVAL);
8061 + len = nam->sa_len - offsetof(struct sockaddr_un, sun_path);
8062 + if (len <= 0)
8063 + return (EINVAL);
8064 +Index: sys/compat/linux/linux_socket.c
8065 +===================================================================
8066 +--- sys/compat/linux/linux_socket.c (revision 225919)
8067 ++++ sys/compat/linux/linux_socket.c (working copy)
8068 +@@ -104,6 +104,7 @@
8069 + int oldv6size;
8070 + struct sockaddr_in6 *sin6;
8071 + #endif
8072 ++ int namelen;
8073 +
8074 + if (*osalen < 2 || *osalen > UCHAR_MAX || !osa)
8075 + return (EINVAL);
8076 +@@ -166,6 +167,20 @@
8077 + }
8078 + }
8079 +
8080 ++ if ((bdom == AF_LOCAL) && (*osalen > sizeof(struct sockaddr_un))) {
8081 ++ for (namelen = 0;
8082 ++ namelen < *osalen - offsetof(struct sockaddr_un, sun_path);
8083 ++ namelen++)
8084 ++ if (!((struct sockaddr_un *)kosa)->sun_path[namelen])
8085 ++ break;
8086 ++ if (namelen + offsetof(struct sockaddr_un, sun_path) >
8087 ++ sizeof(struct sockaddr_un)) {
8088 ++ error = EINVAL;
8089 ++ goto out;
8090 ++ }
8091 ++ alloclen = sizeof(struct sockaddr_un);
8092 ++ }
8093 ++
8094 + sa = (struct sockaddr *) kosa;
8095 + sa->sa_family = bdom;
8096 + sa->sa_len = alloclen;
8097
8098 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
8099 new file mode 100644
8100 index 0000000..4824ff6
8101 --- /dev/null
8102 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-disable-optimization.patch
8103 @@ -0,0 +1,32 @@
8104 +Taken from debian GNU/kFreeBSD.
8105 +
8106 +Regretably, with GCC 4.4 or later this is the only flag combination
8107 +I could find that doesn't cause kernel panics CPU triple-faults or
8108 +other kind of severe breakage. This is Gentoo Bug #410945.
8109 +
8110 +Clang can use -O2, so we do not force -O1 on it
8111 +
8112 +--- a/sys/conf/kern.pre.mk
8113 ++++ b/sys/conf/kern.pre.mk
8114 +@@ -41,6 +41,9 @@
8115 + .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
8116 + COPTFLAGS+= -fno-strict-aliasing
8117 + .endif
8118 ++.if ${CC:T:Mclang} != "clang" && !empty(COPTFLAGS:M-O[23s])
8119 ++COPTFLAGS+= -O1
8120 ++.endif
8121 + .if !defined(NO_CPU_COPTFLAGS)
8122 + COPTFLAGS+= ${_CPUCFLAGS}
8123 + .endif
8124 +--- a/sys/conf/kmod.mk
8125 ++++ b/sys/conf/kmod.mk
8126 +@@ -91,6 +91,9 @@
8127 + .if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
8128 + CFLAGS+= -fno-strict-aliasing
8129 + .endif
8130 ++.if ${CC:T:Mclang} != "clang" && !empty(CFLAGS:M-O[23s])
8131 ++CFLAGS+= -O1
8132 ++.endif
8133 + WERROR?= -Werror
8134 + CFLAGS+= ${WERROR}
8135 + CFLAGS+= -D_KERNEL
8136
8137 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
8138 new file mode 100644
8139 index 0000000..f0984f6
8140 --- /dev/null
8141 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-ipv6refcount.patch
8142 @@ -0,0 +1,128 @@
8143 +Index: sys/netinet6/in6.c
8144 +===================================================================
8145 +--- sys/netinet6/in6.c.orig
8146 ++++ sys/netinet6/in6.c
8147 +@@ -1369,6 +1369,8 @@ in6_purgeaddr(struct ifaddr *ifa)
8148 + }
8149 +
8150 + cleanup:
8151 ++ if (ifa0 != NULL)
8152 ++ ifa_free(ifa0);
8153 +
8154 + plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */
8155 + if ((ia->ia_flags & IFA_ROUTE) && plen == 128) {
8156 +@@ -1393,8 +1395,6 @@ cleanup:
8157 + return;
8158 + ia->ia_flags &= ~IFA_ROUTE;
8159 + }
8160 +- if (ifa0 != NULL)
8161 +- ifa_free(ifa0);
8162 +
8163 + in6_unlink_ifa(ia, ifp);
8164 + }
8165 +@@ -1667,14 +1667,19 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, c
8166 + hostid = IFA_IN6(ifa);
8167 +
8168 + /* prefixlen must be <= 64. */
8169 +- if (64 < iflr->prefixlen)
8170 ++ if (64 < iflr->prefixlen) {
8171 ++ if (ifa != NULL)
8172 ++ ifa_free(ifa);
8173 + return EINVAL;
8174 ++ }
8175 + prefixlen = iflr->prefixlen;
8176 +
8177 + /* hostid part must be zero. */
8178 + sin6 = (struct sockaddr_in6 *)&iflr->addr;
8179 + if (sin6->sin6_addr.s6_addr32[2] != 0 ||
8180 + sin6->sin6_addr.s6_addr32[3] != 0) {
8181 ++ if (ifa != NULL)
8182 ++ ifa_free(ifa);
8183 + return EINVAL;
8184 + }
8185 + } else
8186 +@@ -2265,14 +2265,20 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr
8187 + IN6_IFADDR_RUNLOCK();
8188 + return (struct in6_ifaddr *)ifa;
8189 + }
8190 +- IN6_IFADDR_RUNLOCK();
8191 +
8192 + /* use the last-resort values, that are, deprecated addresses */
8193 +- if (dep[0])
8194 ++ if (dep[0]) {
8195 ++ ifa_ref((struct ifaddr *)dep[0]);
8196 ++ IN6_IFADDR_RUNLOCK();
8197 + return dep[0];
8198 +- if (dep[1])
8199 ++ }
8200 ++ if (dep[1]) {
8201 ++ ifa_ref((struct ifaddr *)dep[1]);
8202 ++ IN6_IFADDR_RUNLOCK();
8203 + return dep[1];
8204 ++ }
8205 +
8206 ++ IN6_IFADDR_RUNLOCK();
8207 + return NULL;
8208 + }
8209 +
8210 +Index: sys/netinet6/ip6_input.c
8211 +===================================================================
8212 +--- sys/netinet6/ip6_input.c.orig
8213 ++++ sys/netinet6/ip6_input.c
8214 +@@ -879,19 +879,23 @@ passin:
8215 + * as our interface address (e.g. multicast addresses, addresses
8216 + * within FAITH prefixes and such).
8217 + */
8218 +- if (deliverifp && !ip6_getdstifaddr(m)) {
8219 ++ if (deliverifp) {
8220 + struct in6_ifaddr *ia6;
8221 +
8222 +- ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst);
8223 +- if (ia6) {
8224 +- if (!ip6_setdstifaddr(m, ia6)) {
8225 +- /*
8226 +- * XXX maybe we should drop the packet here,
8227 +- * as we could not provide enough information
8228 +- * to the upper layers.
8229 +- */
8230 ++ if ((ia6 = ip6_getdstifaddr(m)) != NULL) {
8231 ++ ifa_free(&ia6->ia_ifa);
8232 ++ } else {
8233 ++ ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst);
8234 ++ if (ia6) {
8235 ++ if (!ip6_setdstifaddr(m, ia6)) {
8236 ++ /*
8237 ++ * XXX maybe we should drop the packet here,
8238 ++ * as we could not provide enough information
8239 ++ * to the upper layers.
8240 ++ */
8241 ++ }
8242 ++ ifa_free(&ia6->ia_ifa);
8243 + }
8244 +- ifa_free(&ia6->ia_ifa);
8245 + }
8246 + }
8247 +
8248 +Index: sys/netinet/tcp_input.c
8249 +===================================================================
8250 +--- sys/netinet/tcp_input.c.orig
8251 ++++ sys/netinet/tcp_input.c
8252 +@@ -512,6 +512,8 @@ tcp6_input(struct mbuf **mp, int *offp, int proto)
8253 + (caddr_t)&ip6->ip6_dst - (caddr_t)ip6);
8254 + return IPPROTO_DONE;
8255 + }
8256 ++ if (ia6)
8257 ++ ifa_free(&ia6->ia_ifa);
8258 +
8259 + tcp_input(m, *offp);
8260 + return IPPROTO_DONE;
8261 +@@ -1240,7 +1242,8 @@ relocked:
8262 + rstreason = BANDLIM_RST_OPENPORT;
8263 + goto dropwithreset;
8264 + }
8265 +- ifa_free(&ia6->ia_ifa);
8266 ++ if (ia6)
8267 ++ ifa_free(&ia6->ia_ifa);
8268 + }
8269 + #endif /* INET6 */
8270 + /*
8271
8272 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
8273 new file mode 100644
8274 index 0000000..751a77c
8275 --- /dev/null
8276 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-sysctluint.patch
8277 @@ -0,0 +1,13 @@
8278 +u_int is defined in sys/types.h
8279 +makes header usable alone.
8280 +
8281 +--- sys/sys/sysctl.h.old 2012-05-25 11:08:53.000000000 -0400
8282 ++++ sys/sys/sysctl.h 2012-05-25 11:09:16.000000000 -0400
8283 +@@ -788,6 +788,7 @@
8284 + struct sysctl_req *);
8285 + #else /* !_KERNEL */
8286 + #include <sys/cdefs.h>
8287 ++#include <sys/types.h> /* for u_int */
8288 +
8289 + __BEGIN_DECLS
8290 + int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
8291
8292 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-ciss.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-ciss.patch
8293 new file mode 100644
8294 index 0000000..697984b
8295 --- /dev/null
8296 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-ciss.patch
8297 @@ -0,0 +1,65 @@
8298 +Index: sys/dev/ciss/ciss.c
8299 +===================================================================
8300 +--- sys/dev/ciss/ciss.c (revision 264510)
8301 ++++ sys/dev/ciss/ciss.c (revision 264511)
8302 +@@ -180,8 +180,6 @@
8303 + static void ciss_cam_poll(struct cam_sim *sim);
8304 + static void ciss_cam_complete(struct ciss_request *cr);
8305 + static void ciss_cam_complete_fixup(struct ciss_softc *sc, struct ccb_scsiio *csio);
8306 +-static struct cam_periph *ciss_find_periph(struct ciss_softc *sc,
8307 +- int bus, int target);
8308 + static int ciss_name_device(struct ciss_softc *sc, int bus, int target);
8309 +
8310 + /* periodic status monitoring */
8311 +@@ -3398,27 +3396,6 @@
8312 +
8313 +
8314 + /********************************************************************************
8315 +- * Find a peripheral attached at (target)
8316 +- */
8317 +-static struct cam_periph *
8318 +-ciss_find_periph(struct ciss_softc *sc, int bus, int target)
8319 +-{
8320 +- struct cam_periph *periph;
8321 +- struct cam_path *path;
8322 +- int status;
8323 +-
8324 +- status = xpt_create_path(&path, NULL, cam_sim_path(sc->ciss_cam_sim[bus]),
8325 +- target, 0);
8326 +- if (status == CAM_REQ_CMP) {
8327 +- periph = cam_periph_find(path, NULL);
8328 +- xpt_free_path(path);
8329 +- } else {
8330 +- periph = NULL;
8331 +- }
8332 +- return(periph);
8333 +-}
8334 +-
8335 +-/********************************************************************************
8336 + * Name the device at (target)
8337 + *
8338 + * XXX is this strictly correct?
8339 +@@ -3427,12 +3404,22 @@
8340 + ciss_name_device(struct ciss_softc *sc, int bus, int target)
8341 + {
8342 + struct cam_periph *periph;
8343 ++ struct cam_path *path;
8344 ++ int status;
8345 +
8346 + if (CISS_IS_PHYSICAL(bus))
8347 + return (0);
8348 +- if ((periph = ciss_find_periph(sc, bus, target)) != NULL) {
8349 ++
8350 ++ status = xpt_create_path(&path, NULL, cam_sim_path(sc->ciss_cam_sim[bus]),
8351 ++ target, 0);
8352 ++
8353 ++ if (status == CAM_REQ_CMP) {
8354 ++ mtx_lock(&sc->ciss_mtx);
8355 ++ periph = cam_periph_find(path, NULL);
8356 + sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
8357 + periph->periph_name, periph->unit_number);
8358 ++ mtx_unlock(&sc->ciss_mtx);
8359 ++ xpt_free_path(path);
8360 + return(0);
8361 + }
8362 + sc->ciss_logical[bus][target].cl_name[0] = 0;
8363
8364 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-3077.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-3077.patch
8365 new file mode 100644
8366 index 0000000..23f68ed
8367 --- /dev/null
8368 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-3077.patch
8369 @@ -0,0 +1,26 @@
8370 +Index: sys/netinet/in_mcast.c
8371 +===================================================================
8372 +--- sys/netinet/in_mcast.c (revision 254252)
8373 ++++ sys/netinet/in_mcast.c (working copy)
8374 +@@ -1648,6 +1648,8 @@
8375 + * has asked for, but we always tell userland how big the
8376 + * buffer really needs to be.
8377 + */
8378 ++ if (msfr.msfr_nsrcs > in_mcast_maxsocksrc)
8379 ++ msfr.msfr_nsrcs = in_mcast_maxsocksrc;
8380 + tss = NULL;
8381 + if (msfr.msfr_srcs != NULL && msfr.msfr_nsrcs > 0) {
8382 + tss = malloc(sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
8383 +Index: sys/netinet6/in6_mcast.c
8384 +===================================================================
8385 +--- sys/netinet6/in6_mcast.c (revision 254252)
8386 ++++ sys/netinet6/in6_mcast.c (working copy)
8387 +@@ -1625,6 +1625,8 @@
8388 + * has asked for, but we always tell userland how big the
8389 + * buffer really needs to be.
8390 + */
8391 ++ if (msfr.msfr_nsrcs > in6_mcast_maxsocksrc)
8392 ++ msfr.msfr_nsrcs = in6_mcast_maxsocksrc;
8393 + tss = NULL;
8394 + if (msfr.msfr_srcs != NULL && msfr.msfr_nsrcs > 0) {
8395 + tss = malloc(sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
8396
8397 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-3266.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-3266.patch
8398 new file mode 100644
8399 index 0000000..0d1a894
8400 --- /dev/null
8401 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-3266.patch
8402 @@ -0,0 +1,13 @@
8403 +Index: sys/fs/nfsserver/nfs_nfsdport.c
8404 +===================================================================
8405 +--- sys/fs/nfsserver/nfs_nfsdport.c (revision 249651)
8406 ++++ sys/fs/nfsserver/nfs_nfsdport.c (working copy)
8407 +@@ -1568,6 +1568,8 @@ nfsrvd_readdir(struct nfsrv_descript *nd, int isdg
8408 + nd->nd_repstat = NFSERR_BAD_COOKIE;
8409 + #endif
8410 + }
8411 ++ if (!nd->nd_repstat && vp->v_type != VDIR)
8412 ++ nd->nd_repstat = NFSERR_NOTDIR;
8413 + if (nd->nd_repstat == 0 && cnt == 0) {
8414 + if (nd->nd_flag & ND_NFSV2)
8415 + /* NFSv2 does not have NFSERR_TOOSMALL */
8416
8417 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5209.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5209.patch
8418 new file mode 100644
8419 index 0000000..e6710e3
8420 --- /dev/null
8421 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5209.patch
8422 @@ -0,0 +1,19 @@
8423 +Index: sys/netinet/sctp_output.c
8424 +===================================================================
8425 +--- sys/netinet/sctp_output.c (revision 254337)
8426 ++++ sys/netinet/sctp_output.c (revision 254338)
8427 +@@ -5406,6 +5406,14 @@
8428 + }
8429 + SCTP_BUF_LEN(m) = sizeof(struct sctp_init_chunk);
8430 +
8431 ++ /*
8432 ++ * We might not overwrite the identification[] completely and on
8433 ++ * some platforms time_entered will contain some padding. Therefore
8434 ++ * zero out the cookie to avoid putting uninitialized memory on the
8435 ++ * wire.
8436 ++ */
8437 ++ memset(&stc, 0, sizeof(struct sctp_state_cookie));
8438 ++
8439 + /* the time I built cookie */
8440 + (void)SCTP_GETTIME_TIMEVAL(&stc.time_entered);
8441 +
8442
8443 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5691.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5691.patch
8444 new file mode 100644
8445 index 0000000..9aef150
8446 --- /dev/null
8447 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5691.patch
8448 @@ -0,0 +1,89 @@
8449 +Index: sys/net/if.c
8450 +===================================================================
8451 +--- sys/net/if.c (revision 254941)
8452 ++++ sys/net/if.c (working copy)
8453 +@@ -2553,11 +2553,23 @@
8454 + CURVNET_RESTORE();
8455 + return (EOPNOTSUPP);
8456 + }
8457 ++
8458 ++ /*
8459 ++ * Pass the request on to the socket control method, and if the
8460 ++ * latter returns EOPNOTSUPP, directly to the interface.
8461 ++ *
8462 ++ * Make an exception for the legacy SIOCSIF* requests. Drivers
8463 ++ * trust SIOCSIFADDR et al to come from an already privileged
8464 ++ * layer, and do not perform any credentials checks or input
8465 ++ * validation.
8466 ++ */
8467 + #ifndef COMPAT_43
8468 + error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd,
8469 + data,
8470 + ifp, td));
8471 +- if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL)
8472 ++ if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL &&
8473 ++ cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR &&
8474 ++ cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK)
8475 + error = (*ifp->if_ioctl)(ifp, cmd, data);
8476 + #else
8477 + {
8478 +@@ -2601,7 +2613,9 @@
8479 + data,
8480 + ifp, td));
8481 + if (error == EOPNOTSUPP && ifp != NULL &&
8482 +- ifp->if_ioctl != NULL)
8483 ++ ifp->if_ioctl != NULL &&
8484 ++ cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR &&
8485 ++ cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK)
8486 + error = (*ifp->if_ioctl)(ifp, cmd, data);
8487 + switch (ocmd) {
8488 +
8489 +Index: sys/netinet6/in6.c
8490 +===================================================================
8491 +--- sys/netinet6/in6.c (revision 254941)
8492 ++++ sys/netinet6/in6.c (working copy)
8493 +@@ -431,6 +431,18 @@
8494 + case SIOCGIFSTAT_ICMP6:
8495 + sa6 = &ifr->ifr_addr;
8496 + break;
8497 ++ case SIOCSIFADDR:
8498 ++ case SIOCSIFBRDADDR:
8499 ++ case SIOCSIFDSTADDR:
8500 ++ case SIOCSIFNETMASK:
8501 ++ /*
8502 ++ * Although we should pass any non-INET6 ioctl requests
8503 ++ * down to driver, we filter some legacy INET requests.
8504 ++ * Drivers trust SIOCSIFADDR et al to come from an already
8505 ++ * privileged layer, and do not perform any credentials
8506 ++ * checks or input validation.
8507 ++ */
8508 ++ return (EINVAL);
8509 + default:
8510 + sa6 = NULL;
8511 + break;
8512 +Index: sys/netnatm/natm.c
8513 +===================================================================
8514 +--- sys/netnatm/natm.c (revision 254941)
8515 ++++ sys/netnatm/natm.c (working copy)
8516 +@@ -339,6 +339,21 @@
8517 + npcb = (struct natmpcb *)so->so_pcb;
8518 + KASSERT(npcb != NULL, ("natm_usr_control: npcb == NULL"));
8519 +
8520 ++ switch (cmd) {
8521 ++ case SIOCSIFADDR:
8522 ++ case SIOCSIFBRDADDR:
8523 ++ case SIOCSIFDSTADDR:
8524 ++ case SIOCSIFNETMASK:
8525 ++ /*
8526 ++ * Although we should pass any non-ATM ioctl requests
8527 ++ * down to driver, we filter some legacy INET requests.
8528 ++ * Drivers trust SIOCSIFADDR et al to come from an already
8529 ++ * privileged layer, and do not perform any credentials
8530 ++ * checks or input validation.
8531 ++ */
8532 ++ return (EINVAL);
8533 ++ }
8534 ++
8535 + if (ifp == NULL || ifp->if_ioctl == NULL)
8536 + return (EOPNOTSUPP);
8537 + return ((*ifp->if_ioctl)(ifp, cmd, arg));
8538
8539 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5710.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5710.patch
8540 new file mode 100644
8541 index 0000000..83f30e8
8542 --- /dev/null
8543 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2013-5710.patch
8544 @@ -0,0 +1,28 @@
8545 +Index: sys/fs/nullfs/null_vnops.c
8546 +===================================================================
8547 +--- sys/fs/nullfs/null_vnops.c (revision 254941)
8548 ++++ sys/fs/nullfs/null_vnops.c (working copy)
8549 +@@ -858,6 +858,15 @@
8550 + return (error);
8551 + }
8552 +
8553 ++static int
8554 ++null_link(struct vop_link_args *ap)
8555 ++{
8556 ++
8557 ++ if (ap->a_tdvp->v_mount != ap->a_vp->v_mount)
8558 ++ return (EXDEV);
8559 ++ return (null_bypass((struct vop_generic_args *)ap));
8560 ++}
8561 ++
8562 + /*
8563 + * Global vfs data structures
8564 + */
8565 +@@ -871,6 +880,7 @@
8566 + .vop_getwritemount = null_getwritemount,
8567 + .vop_inactive = null_inactive,
8568 + .vop_islocked = vop_stdislocked,
8569 ++ .vop_link = null_link,
8570 + .vop_lock1 = null_lock,
8571 + .vop_lookup = null_lookup,
8572 + .vop_open = null_open,
8573
8574 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2014-1453.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2014-1453.patch
8575 new file mode 100644
8576 index 0000000..fe9e97e
8577 --- /dev/null
8578 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-cve-2014-1453.patch
8579 @@ -0,0 +1,70 @@
8580 +Index: sys/fs/nfsserver/nfs_nfsdserv.c
8581 +===================================================================
8582 +--- sys/fs/nfsserver/nfs_nfsdserv.c (revision 264251)
8583 ++++ sys/fs/nfsserver/nfs_nfsdserv.c (working copy)
8584 +@@ -1457,10 +1457,23 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgr
8585 + nfsvno_relpathbuf(&fromnd);
8586 + goto out;
8587 + }
8588 ++ /*
8589 ++ * Unlock dp in this code section, so it is unlocked before
8590 ++ * tdp gets locked. This avoids a potential LOR if tdp is the
8591 ++ * parent directory of dp.
8592 ++ */
8593 + if (nd->nd_flag & ND_NFSV4) {
8594 + tdp = todp;
8595 + tnes = *toexp;
8596 +- tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred, p, 0);
8597 ++ if (dp != tdp) {
8598 ++ NFSVOPUNLOCK(dp, 0);
8599 ++ tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred,
8600 ++ p, 0); /* Might lock tdp. */
8601 ++ } else {
8602 ++ tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred,
8603 ++ p, 1);
8604 ++ NFSVOPUNLOCK(dp, 0);
8605 ++ }
8606 + } else {
8607 + tfh.nfsrvfh_len = 0;
8608 + error = nfsrv_mtofh(nd, &tfh);
8609 +@@ -1481,10 +1494,12 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgr
8610 + tnes = *exp;
8611 + tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred,
8612 + p, 1);
8613 ++ NFSVOPUNLOCK(dp, 0);
8614 + } else {
8615 ++ NFSVOPUNLOCK(dp, 0);
8616 + nd->nd_cred->cr_uid = nd->nd_saveduid;
8617 + nfsd_fhtovp(nd, &tfh, LK_EXCLUSIVE, &tdp, &tnes, NULL,
8618 +- 0, p);
8619 ++ 0, p); /* Locks tdp. */
8620 + if (tdp) {
8621 + tdirfor_ret = nfsvno_getattr(tdp, &tdirfor,
8622 + nd->nd_cred, p, 1);
8623 +@@ -1499,7 +1514,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgr
8624 + if (error) {
8625 + if (tdp)
8626 + vrele(tdp);
8627 +- vput(dp);
8628 ++ vrele(dp);
8629 + nfsvno_relpathbuf(&fromnd);
8630 + nfsvno_relpathbuf(&tond);
8631 + goto out;
8632 +@@ -1514,7 +1529,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgr
8633 + }
8634 + if (tdp)
8635 + vrele(tdp);
8636 +- vput(dp);
8637 ++ vrele(dp);
8638 + nfsvno_relpathbuf(&fromnd);
8639 + nfsvno_relpathbuf(&tond);
8640 + goto out;
8641 +@@ -1523,7 +1538,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgr
8642 + /*
8643 + * Done parsing, now down to business.
8644 + */
8645 +- nd->nd_repstat = nfsvno_namei(nd, &fromnd, dp, 1, exp, p, &fdirp);
8646 ++ nd->nd_repstat = nfsvno_namei(nd, &fromnd, dp, 0, exp, p, &fdirp);
8647 + if (nd->nd_repstat) {
8648 + if (nd->nd_flag & ND_NFSV3) {
8649 + nfsrv_wcc(nd, fdirfor_ret, &fdirfor, fdiraft_ret,
8650
8651 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-exec.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-exec.patch
8652 new file mode 100644
8653 index 0000000..c36bed5
8654 --- /dev/null
8655 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-exec.patch
8656 @@ -0,0 +1,66 @@
8657 +Index: sys/kern/kern_exec.c
8658 +===================================================================
8659 +--- sys/kern/kern_exec.c (revision 266979)
8660 ++++ sys/kern/kern_exec.c (working copy)
8661 +@@ -280,6 +280,7 @@ kern_execve(td, args, mac_p)
8662 + struct mac *mac_p;
8663 + {
8664 + struct proc *p = td->td_proc;
8665 ++ struct vmspace *oldvmspace;
8666 + int error;
8667 +
8668 + AUDIT_ARG_ARGV(args->begin_argv, args->argc,
8669 +@@ -296,6 +297,8 @@ kern_execve(td, args, mac_p)
8670 + PROC_UNLOCK(p);
8671 + }
8672 +
8673 ++ KASSERT((td->td_pflags & TDP_EXECVMSPC) == 0, ("nested execve"));
8674 ++ oldvmspace = td->td_proc->p_vmspace;
8675 + error = do_execve(td, args, mac_p);
8676 +
8677 + if (p->p_flag & P_HADTHREADS) {
8678 +@@ -310,6 +313,12 @@ kern_execve(td, args, mac_p)
8679 + thread_single_end();
8680 + PROC_UNLOCK(p);
8681 + }
8682 ++ if ((td->td_pflags & TDP_EXECVMSPC) != 0) {
8683 ++ KASSERT(td->td_proc->p_vmspace != oldvmspace,
8684 ++ ("oldvmspace still used"));
8685 ++ vmspace_free(oldvmspace);
8686 ++ td->td_pflags &= ~TDP_EXECVMSPC;
8687 ++ }
8688 +
8689 + return (error);
8690 + }
8691 +Index: sys/sys/proc.h
8692 +===================================================================
8693 +--- sys/sys/proc.h (revision 266979)
8694 ++++ sys/sys/proc.h (working copy)
8695 +@@ -968,4 +968,5 @@ curthread_pflags_restore(int save)
8696 +
8697 + #endif /* _KERNEL */
8698 +
8699 ++#define TDP_EXECVMSPC 0x40000000 /* Execve destroyed old vmspace */
8700 + #endif /* !_SYS_PROC_H_ */
8701 +Index: sys/vm/vm_map.c
8702 +===================================================================
8703 +--- sys/vm/vm_map.c (revision 266979)
8704 ++++ sys/vm/vm_map.c (working copy)
8705 +@@ -3631,6 +3631,8 @@ vmspace_exec(struct proc *p, vm_offset_t minuser,
8706 + struct vmspace *oldvmspace = p->p_vmspace;
8707 + struct vmspace *newvmspace;
8708 +
8709 ++ KASSERT((curthread->td_pflags & TDP_EXECVMSPC) == 0,
8710 ++ ("vmspace_exec recursed"));
8711 + newvmspace = vmspace_alloc(minuser, maxuser);
8712 + if (newvmspace == NULL)
8713 + return (ENOMEM);
8714 +@@ -3647,7 +3649,7 @@ vmspace_exec(struct proc *p, vm_offset_t minuser,
8715 + PROC_VMSPACE_UNLOCK(p);
8716 + if (p == curthread->td_proc)
8717 + pmap_activate(curthread);
8718 +- vmspace_free(oldvmspace);
8719 ++ curthread->td_pflags |= TDP_EXECVMSPC;
8720 + return (0);
8721 + }
8722 +
8723
8724 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-gentoo.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-gentoo.patch
8725 new file mode 100644
8726 index 0000000..b02d8b6
8727 --- /dev/null
8728 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-gentoo.patch
8729 @@ -0,0 +1,21 @@
8730 +diff -Nur sys.orig/conf/kern.mk sys/conf/kern.mk
8731 +--- sys.orig/conf/kern.mk 2012-07-12 13:26:37.000000000 +0900
8732 ++++ sys/conf/kern.mk 2012-07-16 02:32:19.000000000 +0900
8733 +@@ -5,7 +5,7 @@
8734 + #
8735 + CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
8736 + -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
8737 +- -Wundef -Wno-pointer-sign -fformat-extensions \
8738 ++ -Wundef -Wno-pointer-sign \
8739 + -Wmissing-include-dirs -fdiagnostics-show-option \
8740 + ${CWARNEXTRA}
8741 + #
8742 +@@ -52,7 +52,7 @@
8743 + #
8744 + .if ${MACHINE_CPUARCH} == "i386"
8745 + .if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang"
8746 +-CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2
8747 ++CFLAGS+= -mpreferred-stack-boundary=2
8748 + .else
8749 + CFLAGS+= -mno-aes -mno-avx
8750 + .endif
8751
8752 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-ktrace.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-ktrace.patch
8753 new file mode 100644
8754 index 0000000..0fb6df7
8755 --- /dev/null
8756 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-ktrace.patch
8757 @@ -0,0 +1,12 @@
8758 +Index: sys/kern/kern_ktrace.c
8759 +===================================================================
8760 +--- sys/kern/kern_ktrace.c (revision 266771)
8761 ++++ sys/kern/kern_ktrace.c (working copy)
8762 +@@ -119,6 +119,7 @@ static int data_lengths[] = {
8763 + 0, /* KTR_SYSCTL */
8764 + sizeof(struct ktr_proc_ctor), /* KTR_PROCCTOR */
8765 + 0, /* KTR_PROCDTOR */
8766 ++ 0, /* unused */
8767 + sizeof(struct ktr_fault), /* KTR_FAULT */
8768 + sizeof(struct ktr_faultend), /* KTR_FAULTEND */
8769 + };
8770
8771 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-mmap-2014.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-mmap-2014.patch
8772 new file mode 100644
8773 index 0000000..fd4040a
8774 --- /dev/null
8775 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-mmap-2014.patch
8776 @@ -0,0 +1,20 @@
8777 +Index: sys/vm/vm_map.c
8778 +===================================================================
8779 +--- sys/vm/vm_map.c (revision 259950)
8780 ++++ sys/vm/vm_map.c (revision 259951)
8781 +@@ -1207,6 +1207,7 @@ charged:
8782 + }
8783 + else if ((prev_entry != &map->header) &&
8784 + (prev_entry->eflags == protoeflags) &&
8785 ++ (cow & (MAP_ENTRY_GROWS_DOWN | MAP_ENTRY_GROWS_UP)) == 0 &&
8786 + (prev_entry->end == start) &&
8787 + (prev_entry->wired_count == 0) &&
8788 + (prev_entry->cred == cred ||
8789 +@@ -3339,7 +3340,6 @@ vm_map_stack(vm_map_t map, vm_offset_t addrbos, vm
8790 + * NOTE: We explicitly allow bi-directional stacks.
8791 + */
8792 + orient = cow & (MAP_STACK_GROWS_DOWN|MAP_STACK_GROWS_UP);
8793 +- cow &= ~orient;
8794 + KASSERT(orient != 0, ("No stack grow direction"));
8795 +
8796 + if (addrbos < vm_map_min(map) ||
8797
8798 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-mmap.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-mmap.patch
8799 new file mode 100644
8800 index 0000000..ef2d0a7
8801 --- /dev/null
8802 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-mmap.patch
8803 @@ -0,0 +1,20 @@
8804 +http://www.freebsd.org/security/advisories/FreeBSD-SA-13:06.mmap.asc
8805 +https://bugs.gentoo.org/show_bug.cgi?id=473688
8806 +
8807 +Index: sys/vm/vm_map.c
8808 +===================================================================
8809 +--- sys/vm/vm_map.c (revision 251636)
8810 ++++ sys/vm/vm_map.c (working copy)
8811 +@@ -3761,6 +3761,12 @@ RetryLookup:;
8812 + vm_map_unlock_read(map);
8813 + return (KERN_PROTECTION_FAILURE);
8814 + }
8815 ++ if ((fault_typea & VM_PROT_COPY) != 0 &&
8816 ++ (entry->max_protection & VM_PROT_WRITE) == 0 &&
8817 ++ (entry->eflags & MAP_ENTRY_COW) == 0) {
8818 ++ vm_map_unlock_read(map);
8819 ++ return (KERN_PROTECTION_FAILURE);
8820 ++ }
8821 +
8822 + /*
8823 + * If this page is not pageable, we have to get it for all possible
8824
8825 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-nfsserver.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-nfsserver.patch
8826 new file mode 100644
8827 index 0000000..767588f
8828 --- /dev/null
8829 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-nfsserver.patch
8830 @@ -0,0 +1,16 @@
8831 +http://www.freebsd.org/security/advisories/FreeBSD-SA-13:08.nfsserver.asc
8832 +https://bugs.gentoo.org/show_bug.cgi?id=478314
8833 +
8834 +Index: sys/kern/vfs_export.c
8835 +===================================================================
8836 +--- sys/kern/vfs_export.c (revision 253367)
8837 ++++ sys/kern/vfs_export.c (working copy)
8838 +@@ -208,7 +208,7 @@
8839 + np->netc_anon = crget();
8840 + np->netc_anon->cr_uid = argp->ex_anon.cr_uid;
8841 + crsetgroups(np->netc_anon, argp->ex_anon.cr_ngroups,
8842 +- np->netc_anon->cr_groups);
8843 ++ argp->ex_anon.cr_groups);
8844 + np->netc_anon->cr_prison = &prison0;
8845 + prison_hold(np->netc_anon->cr_prison);
8846 + np->netc_numsecflavors = argp->ex_numsecflavors;
8847
8848 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-random.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-random.patch
8849 new file mode 100644
8850 index 0000000..bb3caba
8851 --- /dev/null
8852 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-random.patch
8853 @@ -0,0 +1,27 @@
8854 +Index: sys/dev/random/probe.c
8855 +===================================================================
8856 +--- sys/dev/random/probe.c (revision 260523)
8857 ++++ sys/dev/random/probe.c (working copy)
8858 +@@ -30,6 +30,8 @@ __FBSDID("$FreeBSD$");
8859 +
8860 + #include <sys/types.h>
8861 + #include <sys/param.h>
8862 ++#include <sys/systm.h>
8863 ++#include <sys/kernel.h>
8864 + #include <sys/malloc.h>
8865 + #include <sys/random.h>
8866 + #include <sys/selinfo.h>
8867 +@@ -57,7 +59,12 @@ random_ident_hardware(struct random_systat *systat
8868 + /* Then go looking for hardware */
8869 + #if defined(__amd64__) || (defined(__i386__) && !defined(PC98))
8870 + if (via_feature_rng & VIA_HAS_RNG) {
8871 +- *systat = random_nehemiah;
8872 ++ int enable;
8873 ++
8874 ++ enable = 0;
8875 ++ TUNABLE_INT_FETCH("hw.nehemiah_rng_enable", &enable);
8876 ++ if (enable)
8877 ++ *systat = random_nehemiah;
8878 + }
8879 + #endif
8880 + }
8881
8882 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-tcp.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-tcp.patch
8883 new file mode 100644
8884 index 0000000..2f82a5f
8885 --- /dev/null
8886 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-tcp.patch
8887 @@ -0,0 +1,32 @@
8888 +Index: sys/netinet/tcp_reass.c
8889 +===================================================================
8890 +--- sys/netinet/tcp_reass.c (revision 264836)
8891 ++++ sys/netinet/tcp_reass.c (working copy)
8892 +@@ -211,7 +211,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int
8893 + * Investigate why and re-evaluate the below limit after the behaviour
8894 + * is understood.
8895 + */
8896 +- if (th->th_seq != tp->rcv_nxt &&
8897 ++ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) &&
8898 + tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) {
8899 + V_tcp_reass_overflows++;
8900 + TCPSTAT_INC(tcps_rcvmemdrop);
8901 +@@ -234,7 +234,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int
8902 + */
8903 + te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT);
8904 + if (te == NULL) {
8905 +- if (th->th_seq != tp->rcv_nxt) {
8906 ++ if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) {
8907 + TCPSTAT_INC(tcps_rcvmemdrop);
8908 + m_freem(m);
8909 + *tlenp = 0;
8910 +@@ -282,7 +282,8 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int
8911 + TCPSTAT_INC(tcps_rcvduppack);
8912 + TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp);
8913 + m_freem(m);
8914 +- uma_zfree(V_tcp_reass_zone, te);
8915 ++ if (te != &tqs)
8916 ++ uma_zfree(V_tcp_reass_zone, te);
8917 + tp->t_segqlen--;
8918 + /*
8919 + * Try to present any queued data
8920
8921 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.2-gentoo-gcc.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.2-gentoo-gcc.patch
8922 new file mode 100644
8923 index 0000000..9076fd2
8924 --- /dev/null
8925 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.2-gentoo-gcc.patch
8926 @@ -0,0 +1,13 @@
8927 +diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
8928 +index e504f75..7aa63df 100644
8929 +--- a/sys/conf/newvers.sh
8930 ++++ b/sys/conf/newvers.sh
8931 +@@ -86,7 +86,7 @@ fi
8932 + touch version
8933 + v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
8934 + i=`${MAKE:-make} -V KERN_IDENT`
8935 +-compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version')
8936 ++compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version' | tail -n 1)
8937 +
8938 + for dir in /bin /usr/bin /usr/local/bin; do
8939 + if [ -x "${dir}/svnversion" ] ; then
8940
8941 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
8942 new file mode 100644
8943 index 0000000..0bf1b61
8944 --- /dev/null
8945 +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-cve-2012-0217.patch
8946 @@ -0,0 +1,26 @@
8947 +Index: sys/amd64/amd64/trap.c
8948 +===================================================================
8949 +--- sys/amd64/amd64/trap.c.orig
8950 ++++ sys/amd64/amd64/trap.c (working copy)
8951 +@@ -972,4 +972,21 @@
8952 + syscallname(td->td_proc, sa.code)));
8953 +
8954 + syscallret(td, error, &sa);
8955 ++
8956 ++ /*
8957 ++ * If the user-supplied value of %rip is not a canonical
8958 ++ * address, then some CPUs will trigger a ring 0 #GP during
8959 ++ * the sysret instruction. However, the fault handler would
8960 ++ * execute with the user's %gs and %rsp in ring 0 which would
8961 ++ * not be safe. Instead, preemptively kill the thread with a
8962 ++ * SIGBUS.
8963 ++ */
8964 ++ if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) {
8965 ++ ksiginfo_init_trap(&ksi);
8966 ++ ksi.ksi_signo = SIGBUS;
8967 ++ ksi.ksi_code = BUS_OBJERR;
8968 ++ ksi.ksi_trapno = T_PROTFLT;
8969 ++ ksi.ksi_addr = (void *)td->td_frame->tf_rip;
8970 ++ trapsignal(td, &ksi);
8971 ++ }
8972 + }
8973
8974 diff --git a/sys-freebsd/freebsd-sources/files/freebsd-ubin-10.3-bmake-workaround.patch b/sys-freebsd/freebsd-sources/files/freebsd-ubin-10.3-bmake-workaround.patch
8975 new file mode 100644
8976 index 0000000..c0ca444
8977 --- /dev/null
8978 +++ b/sys-freebsd/freebsd-sources/files/freebsd-ubin-10.3-bmake-workaround.patch
8979 @@ -0,0 +1,13 @@
8980 +diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile
8981 +index 6c6d8c2..22fec7a 100644
8982 +--- a/usr.bin/bmake/Makefile
8983 ++++ b/usr.bin/bmake/Makefile
8984 +@@ -5,7 +5,7 @@
8985 +
8986 + .sinclude "Makefile.inc"
8987 +
8988 +-SRCTOP?= ${.CURDIR:H:H}
8989 ++SRCTOP= ${.CURDIR:H:H}
8990 +
8991 + # look here first for config.h
8992 + CFLAGS+= -I${.CURDIR}
8993
8994 diff --git a/sys-freebsd/freebsd-sources/freebsd-sources-11.0.ebuild b/sys-freebsd/freebsd-sources/freebsd-sources-11.0.ebuild
8995 new file mode 100644
8996 index 0000000..e01278e
8997 --- /dev/null
8998 +++ b/sys-freebsd/freebsd-sources/freebsd-sources-11.0.ebuild
8999 @@ -0,0 +1,174 @@
9000 +# Copyright 1999-2016 Gentoo Foundation
9001 +# Distributed under the terms of the GNU General Public License v2
9002 +# $Id$
9003 +
9004 +EAPI=5
9005 +
9006 +inherit bsdmk freebsd flag-o-matic toolchain-funcs
9007 +
9008 +DESCRIPTION="FreeBSD kernel sources"
9009 +SLOT="0"
9010 +LICENSE="BSD zfs? ( CDDL )"
9011 +
9012 +IUSE="+build-kernel debug dtrace zfs"
9013 +
9014 +# Security Advisory and Errata patches.
9015 +UPSTREAM_PATCHES=( "SA-16:18/atkbd.patch"
9016 + "SA-16:19/sendmsg.patch"
9017 + "SA-16:20/linux.patch"
9018 + "SA-16:21/stat.patch"
9019 + "EN-16:07/ipi.patch"
9020 + "EN-16:08/zfs.patch"
9021 + "EN-16:11/vmbus.patch"
9022 + "EN-16:12/hv_storvsc.patch"
9023 + "EN-16:13/vmbus.patch"
9024 + "EN-16:14/hv_storvsc.patch"
9025 + "EN-16:15/vmbus.patch"
9026 + "EN-16:16/hv_storvsc.patch" )
9027 +
9028 +if [[ ${PV} != *9999* ]]; then
9029 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
9030 + SRC_URI="${SRC_URI}
9031 + $(freebsd_upstream_patches)"
9032 +fi
9033 +
9034 +EXTRACTONLY="
9035 + sys/
9036 + contrib/bmake/
9037 + usr.bin/bmake/
9038 +"
9039 +
9040 +RDEPEND="dtrace? ( >=sys-freebsd/freebsd-cddl-9.2_rc1 )
9041 + =sys-freebsd/freebsd-mk-defs-${RV}*
9042 + !sys-freebsd/virtio-kmod
9043 + !sys-fs/fuse4bsd
9044 + !<sys-freebsd/freebsd-sources-9.2_beta1"
9045 +DEPEND="build-kernel? (
9046 + dtrace? ( >=sys-freebsd/freebsd-cddl-9.2_rc1 )
9047 + >=sys-freebsd/freebsd-usbin-9.1
9048 + =sys-freebsd/freebsd-mk-defs-${RV}*
9049 + )"
9050 +
9051 +RESTRICT="strip binchecks"
9052 +
9053 +S="${WORKDIR}/sys"
9054 +
9055 +KERN_BUILD=GENTOO
9056 +
9057 +PATCHES=( "${FILESDIR}/${PN}-9.0-disable-optimization.patch"
9058 + "${FILESDIR}/${PN}-10.0-gentoo.patch"
9059 + "${FILESDIR}/${PN}-6.0-flex-2.5.31.patch"
9060 + "${FILESDIR}/${PN}-8.0-subnet-route-pr40133.patch"
9061 + "${FILESDIR}/${PN}-7.1-includes.patch"
9062 + "${FILESDIR}/${PN}-9.0-sysctluint.patch"
9063 + "${FILESDIR}/${PN}-9.2-gentoo-gcc.patch"
9064 + "${FILESDIR}/${PN}-10.1-gcc48.patch" )
9065 +
9066 +pkg_setup() {
9067 + # Add the required source files.
9068 + use zfs && EXTRACTONLY+="cddl/ "
9069 +
9070 + # WITHOUT_SSP= is required to boot kernel that compiled with newer gcc, bug #477914
9071 + [[ $(tc-getCC) == *gcc* ]] && mymakeopts="${mymakeopts} WITHOUT_SSP="
9072 + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL="
9073 +}
9074 +
9075 +src_prepare() {
9076 + local conf="${S}/$(tc-arch-kernel)/conf/${KERN_BUILD}"
9077 +
9078 + cd "${WORKDIR}" || die
9079 + epatch "${FILESDIR}/freebsd-ubin-10.3-bmake-workaround.patch"
9080 + cd "${S}" || die
9081 +
9082 + # This replaces the gentoover patch, it doesn't need reapply every time.
9083 + sed -i -e 's:^REVISION=.*:REVISION="'${PVR}'":' \
9084 + -e 's:^BRANCH=.*:BRANCH="Gentoo":' \
9085 + -e 's:^VERSION=.*:VERSION="${TYPE} ${BRANCH} ${REVISION}":' \
9086 + "${S}/conf/newvers.sh"
9087 +
9088 + # __FreeBSD_cc_version comes from FreeBSD's gcc.
9089 + # on 10.0-RELEASE it's 1000001.
9090 + # FYI, can get it from gnu/usr.bin/cc/cc_tools/freebsd-native.h.
9091 + sed -e "s:-D_KERNEL:-D_KERNEL -D__FreeBSD_cc_version=1000001:g" \
9092 + -i "${S}/conf/kern.pre.mk" \
9093 + -i "${S}/conf/kmod.mk" || die "Couldn't set __FreeBSD_cc_version"
9094 +
9095 + # Remove -Werror
9096 + sed -e "s:-Werror:-Wno-error:g" \
9097 + -i "${S}/conf/kern.pre.mk" \
9098 + -i "${S}/conf/kmod.mk" || die
9099 +
9100 + # Set the kernel configuration using USE flags.
9101 + cp -f "${FILESDIR}/config-GENTOO" "${conf}" || die
9102 + use debug || echo 'nomakeoptions DEBUG' >> "${conf}"
9103 + use dtrace || echo 'nomakeoptions WITH_CTF' >> "${conf}"
9104 +
9105 + # Only used with USE=build-kernel, let the kernel build with its own flags, its safer.
9106 + unset LDFLAGS CFLAGS CXXFLAGS ASFLAGS KERNEL
9107 +}
9108 +
9109 +src_configure() {
9110 + if use build-kernel ; then
9111 + tc-export CC
9112 + cd "${S}/$(tc-arch-kernel)/conf" || die
9113 + config ${KERN_BUILD} || die
9114 + fi
9115 +}
9116 +
9117 +src_compile() {
9118 + if use build-kernel ; then
9119 + if has_version "<sys-freebsd/freebsd-ubin-10.0"; then
9120 + cd "${WORKDIR}"/usr.bin/bmake || die
9121 + CC=${CHOST}-gcc freebsd_src_compile
9122 + export BMAKE="${WORKDIR}/usr.bin/bmake/make"
9123 + fi
9124 + cd "${S}/$(tc-arch-kernel)/compile/${KERN_BUILD}" || die
9125 + freebsd_src_compile depend
9126 + freebsd_src_compile
9127 + else
9128 + einfo "Nothing to compile.."
9129 + fi
9130 +}
9131 +
9132 +src_install() {
9133 + if use build-kernel ; then
9134 + cd "${S}/$(tc-arch-kernel)/compile/${KERN_BUILD}" || die
9135 + freebsd_src_install
9136 + rm -rf "${S}/$(tc-arch-kernel)/compile/${KERN_BUILD}"
9137 + cd "${S}"
9138 + fi
9139 +
9140 + insinto "/usr/src/sys"
9141 + doins -r "${S}/".
9142 + if use zfs ; then
9143 + insinto "/usr/src/cddl"
9144 + doins -r "${WORKDIR}/cddl/".
9145 + fi
9146 +}
9147 +
9148 +pkg_preinst() {
9149 + if [[ -L "${ROOT}/usr/src/sys" ]]; then
9150 + einfo "/usr/src/sys is a symlink, removing it..."
9151 + rm -f "${ROOT}/usr/src/sys"
9152 + fi
9153 +
9154 + if use sparc-fbsd ; then
9155 + ewarn "WARNING: kldload currently causes kernel panics"
9156 + ewarn "on sparc64. This is probably a gcc-4.1 issue, but"
9157 + ewarn "we need gcc-4.1 to compile the kernel correctly :/"
9158 + ewarn "Please compile all modules you need into the kernel"
9159 + fi
9160 +
9161 + ewarn "If you want manual compile (not recommended), please don't forget the following step."
9162 + if ! use sparc-fbsd ; then
9163 + ewarn "export CC=clang"
9164 + ewarn "export CXX=clang++"
9165 + fi
9166 + if ! use zfs ; then
9167 + ewarn "export WITHOUT_CDDL="
9168 + ewarn "Note, Please set USE=zfs if you want to enable modules of CDDL license."
9169 + fi
9170 + if ! use dtrace && ! has_version '>=sys-freebsd/freebsd-cddl-9.2_beta1' ; then
9171 + ewarn "GENERIC config require sys-freebsd/freebsd-cddl. Please emerge it."
9172 + fi
9173 +}
9174
9175 diff --git a/sys-freebsd/freebsd-sources/metadata.xml b/sys-freebsd/freebsd-sources/metadata.xml
9176 new file mode 100644
9177 index 0000000..3860e80
9178 --- /dev/null
9179 +++ b/sys-freebsd/freebsd-sources/metadata.xml
9180 @@ -0,0 +1,13 @@
9181 +<?xml version="1.0" encoding="UTF-8"?>
9182 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
9183 +<pkgmetadata>
9184 +<maintainer type="project">
9185 + <email>bsd@g.o</email>
9186 + <name>BSD Project</name>
9187 + </maintainer>
9188 + <use>
9189 + <flag name="build-kernel">Build and install a kernel (recommended).</flag>
9190 + <flag name="dtrace">Enable DTrace support.</flag>
9191 + <flag name="zfs">Enable ZFS support.</flag>
9192 + </use>
9193 +</pkgmetadata>
9194
9195 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-atf.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-atf.patch
9196 new file mode 100644
9197 index 0000000..d758c48
9198 --- /dev/null
9199 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-atf.patch
9200 @@ -0,0 +1,15 @@
9201 +diff --git a/usr.bin/atf/atf-sh/Makefile b/usr.bin/atf/atf-sh/Makefile
9202 +index 4ebdc33..37ff8fa 100644
9203 +--- a/usr.bin/atf/atf-sh/Makefile
9204 ++++ b/usr.bin/atf/atf-sh/Makefile
9205 +@@ -33,8 +33,8 @@ PROG_CXX= atf-sh
9206 + SRCS= atf-sh.cpp
9207 + MAN= atf-sh.1 atf-sh-api.3
9208 +
9209 +-CFLAGS+= -DHAVE_CONFIG_H
9210 +-CFLAGS+= -I${ATF}
9211 ++CXXFLAGS+= -DHAVE_CONFIG_H
9212 ++CXXFLAGS+= -I${ATF}
9213 +
9214 + DPADD+= ${LIBATF_C} ${LIBATF_CXX}
9215 + LDADD+= -latf-c++ -latf-c
9216
9217 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-dtc-gcc46.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-dtc-gcc46.patch
9218 new file mode 100644
9219 index 0000000..1125238
9220 --- /dev/null
9221 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-dtc-gcc46.patch
9222 @@ -0,0 +1,25 @@
9223 +diff --git a/usr.bin/dtc/string.hh b/usr.bin/dtc/string.hh
9224 +index 45bc4fd..6eaf8e4 100644
9225 +--- a/usr.bin/dtc/string.hh
9226 ++++ b/usr.bin/dtc/string.hh
9227 +@@ -32,6 +32,8 @@
9228 +
9229 + #ifndef _STRING_HH_
9230 + #define _STRING_HH_
9231 ++#include <cstdio>
9232 ++#include <cstring>
9233 + #include "input_buffer.hh"
9234 +
9235 + namespace dtc
9236 +diff --git a/usr.bin/dtc/util.hh b/usr.bin/dtc/util.hh
9237 +index 7f2ec67..8e13b1c 100644
9238 +--- a/usr.bin/dtc/util.hh
9239 ++++ b/usr.bin/dtc/util.hh
9240 +@@ -33,6 +33,7 @@
9241 + #ifndef _UTIL_HH_
9242 + #define _UTIL_HH_
9243 +
9244 ++#include <stdint.h>
9245 + #include <vector>
9246 +
9247 + // If we aren't using C++11, then just ignore static asserts.
9248
9249 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-kdump-ioctl.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-kdump-ioctl.patch
9250 new file mode 100644
9251 index 0000000..e106852
9252 --- /dev/null
9253 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-kdump-ioctl.patch
9254 @@ -0,0 +1,26 @@
9255 +diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile
9256 +index 38e9df6..5e831c6 100644
9257 +--- a/usr.bin/kdump/Makefile
9258 ++++ b/usr.bin/kdump/Makefile
9259 +@@ -22,7 +22,7 @@ CLEANFILES= ioctl.c kdump_subr.c kdump_subr.h linux_syscalls.c
9260 +
9261 + ioctl.c: mkioctls
9262 + env MACHINE=${MACHINE} CPP="${CPP}" \
9263 +- sh ${.CURDIR}/mkioctls print ${DESTDIR}/usr/include > ${.TARGET}
9264 ++ sh ${.CURDIR}/mkioctls print ${.CURDIR}/../../include > ${.TARGET}
9265 +
9266 + kdump_subr.h: mksubr
9267 + sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include | \
9268 +diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile
9269 +index 7a49497..bc8b61f 100644
9270 +--- a/usr.bin/truss/Makefile
9271 ++++ b/usr.bin/truss/Makefile
9272 +@@ -24,7 +24,7 @@ syscalls.h: syscalls.master
9273 +
9274 + ioctl.c: ${.CURDIR}/../kdump/mkioctls
9275 + env MACHINE=${MACHINE} CPP="${CPP}" \
9276 +- /bin/sh ${.CURDIR}/../kdump/mkioctls return ${DESTDIR}/usr/include > ${.TARGET}
9277 ++ /bin/sh ${.CURDIR}/../kdump/mkioctls return ${.CURDIR}/../../include > ${.TARGET}
9278 +
9279 + .if ${MACHINE_CPUARCH} == "i386"
9280 + SRCS+= i386-linux.c linux_syscalls.h
9281
9282 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-mandoc.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-mandoc.patch
9283 new file mode 100644
9284 index 0000000..c5f7706
9285 --- /dev/null
9286 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.0-mandoc.patch
9287 @@ -0,0 +1,13 @@
9288 +diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile
9289 +index 0995534..1bcb3e0 100644
9290 +--- a/usr.bin/mandoc/Makefile
9291 ++++ b/usr.bin/mandoc/Makefile
9292 +@@ -1,7 +1,7 @@
9293 + # $FreeBSD$
9294 +
9295 + MDOCMLDIR= ${.CURDIR}/../../contrib/mdocml
9296 +-LIBMANDOC= ${.OBJDIR}/../../lib/libmandoc/libmandoc.a
9297 ++LIBMANDOC= ${.CURDIR}/../../lib/libmandoc/libmandoc.a
9298 + .PATH: ${MDOCMLDIR}
9299 +
9300 + PROG= mandoc
9301
9302 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.1-kdump-workaround.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.1-kdump-workaround.patch
9303 new file mode 100644
9304 index 0000000..064647c
9305 --- /dev/null
9306 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.1-kdump-workaround.patch
9307 @@ -0,0 +1,13 @@
9308 +diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile
9309 +index cbf31d0..fa0d04d 100644
9310 +--- a/usr.bin/kdump/Makefile
9311 ++++ b/usr.bin/kdump/Makefile
9312 +@@ -8,7 +8,7 @@ SFX= 32
9313 + .PATH: ${.CURDIR}/../ktrace
9314 +
9315 + PROG= kdump
9316 +-SRCS= kdump_subr.c kdump.c ioctl.c subr.c
9317 ++SRCS= kdump_subr.h kdump_subr.c kdump.c ioctl.c subr.c
9318 + DPSRCS= kdump_subr.h
9319 + CFLAGS+= -I${.CURDIR}/../ktrace -I${.CURDIR} -I${.CURDIR}/../.. -I.
9320 +
9321
9322 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.2-bsdxml.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.2-bsdxml.patch
9323 new file mode 100644
9324 index 0000000..6064717
9325 --- /dev/null
9326 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.2-bsdxml.patch
9327 @@ -0,0 +1,13 @@
9328 +diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c
9329 +index af6562b..3121c81 100644
9330 +--- a/usr.bin/mt/mt.c
9331 ++++ b/usr.bin/mt/mt.c
9332 +@@ -92,7 +92,7 @@ __FBSDID("$FreeBSD: stable/10/usr.bin/mt/mt.c 280438 2015-03-24 14:36:10Z ken $"
9333 + #include <unistd.h>
9334 + #include <stdint.h>
9335 + #include <errno.h>
9336 +-#include <bsdxml.h>
9337 ++#include <expat.h>
9338 + #include <mtlib.h>
9339 +
9340 + #include <cam/cam.h>
9341
9342 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.2-talk-workaround.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.2-talk-workaround.patch
9343 new file mode 100644
9344 index 0000000..3a65b37
9345 --- /dev/null
9346 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.2-talk-workaround.patch
9347 @@ -0,0 +1,12 @@
9348 +diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c
9349 +index 4daad7a..1fb9105 100644
9350 +--- a/usr.bin/talk/io.c
9351 ++++ b/usr.bin/talk/io.c
9352 +@@ -50,6 +50,7 @@ static const char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
9353 + #include <stdlib.h>
9354 + #include <string.h>
9355 + #include <unistd.h>
9356 ++#include <wctype.h>
9357 + #define _XOPEN_SOURCE_EXTENDED
9358 + #include <curses.h>
9359 +
9360
9361 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.3-bmake-workaround.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.3-bmake-workaround.patch
9362 new file mode 100644
9363 index 0000000..c0ca444
9364 --- /dev/null
9365 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-10.3-bmake-workaround.patch
9366 @@ -0,0 +1,13 @@
9367 +diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile
9368 +index 6c6d8c2..22fec7a 100644
9369 +--- a/usr.bin/bmake/Makefile
9370 ++++ b/usr.bin/bmake/Makefile
9371 +@@ -5,7 +5,7 @@
9372 +
9373 + .sinclude "Makefile.inc"
9374 +
9375 +-SRCTOP?= ${.CURDIR:H:H}
9376 ++SRCTOP= ${.CURDIR:H:H}
9377 +
9378 + # look here first for config.h
9379 + CFLAGS+= -I${.CURDIR}
9380
9381 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-bsdcmp.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-bsdcmp.patch
9382 new file mode 100644
9383 index 0000000..1a85529
9384 --- /dev/null
9385 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-bsdcmp.patch
9386 @@ -0,0 +1,13 @@
9387 +Index: fbsd-6.0/usr.bin/cmp/Makefile
9388 +===================================================================
9389 +--- fbsd-6.0.orig/usr.bin/cmp/Makefile
9390 ++++ fbsd-6.0/usr.bin/cmp/Makefile
9391 +@@ -1,7 +1,7 @@
9392 + # @(#)Makefile 8.1 (Berkeley) 6/6/93
9393 + # $FreeBSD: src/usr.bin/cmp/Makefile,v 1.6.14.1 2005/09/17 11:33:41 brian Exp $
9394 +
9395 +-PROG= cmp
9396 ++PROG= bsdcmp
9397 + SRCS= cmp.c link.c misc.c regular.c special.c
9398 +
9399 + .include <bsd.prog.mk>
9400
9401 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-fixmakefiles.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-fixmakefiles.patch
9402 new file mode 100644
9403 index 0000000..b135a82
9404 --- /dev/null
9405 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-fixmakefiles.patch
9406 @@ -0,0 +1,35 @@
9407 +Index: usr.bin/calendar/Makefile
9408 +===================================================================
9409 +--- usr.bin/calendar/Makefile.orig
9410 ++++ usr.bin/calendar/Makefile
9411 +@@ -10,6 +10,7 @@ FR_LINKS= fr_FR.ISO8859-15
9412 + TEXTMODE?= 444
9413 +
9414 + beforeinstall:
9415 ++ ${INSTALL} -d ${DESTDIR}${SHAREDIR}/calendar
9416 + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
9417 + ${.CURDIR}/calendars/calendar.* ${DESTDIR}${SHAREDIR}/calendar
9418 + .for lang in ${INTER}
9419 +Index: usr.bin/ee/Makefile
9420 +===================================================================
9421 +--- usr.bin/ee/Makefile.orig
9422 ++++ usr.bin/ee/Makefile
9423 +@@ -12,12 +12,12 @@ LDADD= -lncurses
9424 + NLS= en_US.US-ASCII fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \
9425 + uk_UA.KOI8-U ru_RU.KOI8-R
9426 +
9427 +-NLSLINKS_en_US.US-ASCII= en_US.ISO8859-1 en_US.ISO8859-15
9428 +-NLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
9429 +- fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 fr_CH.ISO8859-15 \
9430 +- fr_FR.ISO8859-15
9431 +-NLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
9432 +- de_CH.ISO8859-15 de_DE.ISO8859-15
9433 ++#NLSLINKS_en_US.US-ASCII= en_US.ISO8859-1 en_US.ISO8859-15
9434 ++#NLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
9435 ++# fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 fr_CH.ISO8859-15 \
9436 ++# fr_FR.ISO8859-15
9437 ++#NLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
9438 ++# de_CH.ISO8859-15 de_DE.ISO8859-15
9439 +
9440 + NLSSRCFILES=ee.msg
9441 + .for lang in ${NLS}
9442
9443 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-kdump-ioctl.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-kdump-ioctl.patch
9444 new file mode 100644
9445 index 0000000..a89cf52
9446 --- /dev/null
9447 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-6.0-kdump-ioctl.patch
9448 @@ -0,0 +1,28 @@
9449 +By default the mkioctl program that generates code for kdump does look for
9450 +ioctls in the whole /usr/include tree, but this does break when xorg is merged.
9451 +This patch allows to look for include files only in the source tree.
9452 +
9453 +Index: fbsd-6/usr.bin/kdump/Makefile
9454 +===================================================================
9455 +--- fbsd-6.orig/usr.bin/kdump/Makefile
9456 ++++ fbsd-6/usr.bin/kdump/Makefile
9457 +@@ -10,6 +10,6 @@ CFLAGS+= -I${.CURDIR}/../ktrace -I${.CUR
9458 + CLEANFILES= ioctl.c
9459 +
9460 + ioctl.c: mkioctls
9461 +- sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include > ${.TARGET}
9462 ++ sh ${.CURDIR}/mkioctls ${.CURDIR}/../../include > ${.TARGET}
9463 +
9464 + .include <bsd.prog.mk>
9465 +Index: fbsd-6/usr.bin/truss/Makefile
9466 +===================================================================
9467 +--- fbsd-6.orig/usr.bin/truss/Makefile
9468 ++++ fbsd-6/usr.bin/truss/Makefile
9469 +@@ -29,6 +29,6 @@ syscalls.h: syscalls.master
9470 + ${.CURDIR}/i386.conf
9471 +
9472 + ioctl.c: ${.CURDIR}/../kdump/mkioctls
9473 +- sh ${.CURDIR}/../kdump/mkioctls ${DESTDIR}/usr/include > ${.TARGET}
9474 ++ sh ${.CURDIR}/../kdump/mkioctls ${.CURDIR}/../../include > ${.TARGET}
9475 +
9476 + .include <bsd.prog.mk>
9477
9478 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.0-bsdar.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.0-bsdar.patch
9479 new file mode 100644
9480 index 0000000..c966b9b
9481 --- /dev/null
9482 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.0-bsdar.patch
9483 @@ -0,0 +1,21 @@
9484 +--- usr.bin/ar/Makefile.old 2010-03-12 14:50:30 +0100
9485 ++++ usr.bin/ar/Makefile 2010-03-12 14:50:53 +0100
9486 +@@ -1,6 +1,6 @@
9487 + # $FreeBSD: src/usr.bin/ar/Makefile,v 1.22.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $
9488 +
9489 +-PROG= ar
9490 ++PROG= freebsd-ar
9491 + SRCS= ar.c acplex.l acpyacc.y read.c util.c write.c y.tab.h
9492 +
9493 + WARNS?= 5
9494 +@@ -10,8 +10,7 @@
9495 +
9496 + CFLAGS+=-I. -I${.CURDIR}
9497 +
9498 +-NO_SHARED?= yes
9499 +-LINKS= ${BINDIR}/ar ${BINDIR}/ranlib
9500 +-MLINKS= ar.1 ranlib.1
9501 ++LINKS= ${BINDIR}/freebsd-ar ${BINDIR}/freebsd-ranlib
9502 ++MLINKS= freebsd-ar.1 freebsd-ranlib.1
9503 +
9504 + .include <bsd.prog.mk>
9505
9506 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.0-xinstall.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.0-xinstall.patch
9507 new file mode 100644
9508 index 0000000..e8f978a
9509 --- /dev/null
9510 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.0-xinstall.patch
9511 @@ -0,0 +1,26 @@
9512 +Parallel make installs often cause 2 concurrent install -d to fail
9513 +while they are creating the path to the target dirs.
9514 +This patch changes the failure to a warning so that a make -j6 install doesn't
9515 +fails as often as it does on Gentoo/FreeBSD, if it uses /usr/bin/install.
9516 +
9517 +--- usr.bin/xinstall/xinstall.c.orig
9518 ++++ usr.bin/xinstall/xinstall.c
9519 +@@ -748,9 +748,17 @@
9520 + ch = *p;
9521 + *p = '\0';
9522 + if (stat(path, &sb)) {
9523 +- if (errno != ENOENT || mkdir(path, 0755) < 0) {
9524 ++ if (errno != ENOENT) {
9525 + err(EX_OSERR, "mkdir %s", path);
9526 + /* NOTREACHED */
9527 ++ } else if (mkdir(path, 0755) < 0) {
9528 ++ /* Previous errno from stat() says that the directory didn't exist (ENOENT)
9529 ++ * But if errno is now EEXIST, then we just hit a parallel make bug.
9530 ++ */
9531 ++ if (errno == EEXIST)
9532 ++ warn("mkdir: %s now exists!", path); /* let me know when this happens */
9533 ++ else
9534 ++ err(EX_OSERR, "mkdir %s", path);
9535 + } else if (verbose)
9536 + (void)printf("install: mkdir %s\n",
9537 + path);
9538
9539 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
9540 new file mode 100644
9541 index 0000000..5bd1d55
9542 --- /dev/null
9543 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-8.2-compress.patch
9544 @@ -0,0 +1,55 @@
9545 +Index: usr.bin/compress/zopen.c
9546 +===================================================================
9547 +--- usr.bin/compress/zopen.c (revision 225020)
9548 ++++ usr.bin/compress/zopen.c (working copy)
9549 +@@ -486,7 +486,7 @@ zread(void *cookie, char *rbp, int num)
9550 + block_compress = maxbits & BLOCK_MASK;
9551 + maxbits &= BIT_MASK;
9552 + maxmaxcode = 1L << maxbits;
9553 +- if (maxbits > BITS) {
9554 ++ if (maxbits > BITS || maxbits < 12) {
9555 + errno = EFTYPE;
9556 + return (-1);
9557 + }
9558 +@@ -513,17 +513,28 @@ zread(void *cookie, char *rbp, int num)
9559 + for (code = 255; code >= 0; code--)
9560 + tab_prefixof(code) = 0;
9561 + clear_flg = 1;
9562 +- free_ent = FIRST - 1;
9563 +- if ((code = getcode(zs)) == -1) /* O, untimely death! */
9564 +- break;
9565 ++ free_ent = FIRST;
9566 ++ oldcode = -1;
9567 ++ continue;
9568 + }
9569 + incode = code;
9570 +
9571 +- /* Special case for KwKwK string. */
9572 ++ /* Special case for kWkWk string. */
9573 + if (code >= free_ent) {
9574 ++ if (code > free_ent || oldcode == -1) {
9575 ++ /* Bad stream. */
9576 ++ errno = EINVAL;
9577 ++ return (-1);
9578 ++ }
9579 + *stackp++ = finchar;
9580 + code = oldcode;
9581 + }
9582 ++ /*
9583 ++ * The above condition ensures that code < free_ent.
9584 ++ * The construction of tab_prefixof in turn guarantees that
9585 ++ * each iteration decreases code and therefore stack usage is
9586 ++ * bound by 1 << BITS - 256.
9587 ++ */
9588 +
9589 + /* Generate output characters in reverse order. */
9590 + while (code >= 256) {
9591 +@@ -540,7 +551,7 @@ middle: do {
9592 + } while (stackp > de_stack);
9593 +
9594 + /* Generate the new entry. */
9595 +- if ((code = free_ent) < maxmaxcode) {
9596 ++ if ((code = free_ent) < maxmaxcode && oldcode != -1) {
9597 + tab_prefixof(code) = (u_short) oldcode;
9598 + tab_suffixof(code) = finchar;
9599 + free_ent = code + 1;
9600
9601 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
9602 new file mode 100644
9603 index 0000000..d34eb9e
9604 --- /dev/null
9605 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.0-fixmakefiles.patch
9606 @@ -0,0 +1,11 @@
9607 +diff -uNr usr.bin.old/calendar/Makefile usr.bin/calendar/Makefile
9608 +--- usr.bin.old/calendar/Makefile 2011-11-02 18:22:09.000000000 +0000
9609 ++++ usr.bin/calendar/Makefile 2011-11-02 18:22:48.000000000 +0000
9610 +@@ -15,6 +15,7 @@
9611 + WARNS?= 7
9612 +
9613 + beforeinstall:
9614 ++ ${INSTALL} -d ${DESTDIR}${SHAREDIR}/calendar
9615 + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \
9616 + ${.CURDIR}/calendars/calendar.* ${DESTDIR}${SHAREDIR}/calendar
9617 + .for lang in ${INTER}
9618
9619 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-ar-libarchive3.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-ar-libarchive3.patch
9620 new file mode 100644
9621 index 0000000..d4d89e1
9622 --- /dev/null
9623 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-ar-libarchive3.patch
9624 @@ -0,0 +1,19 @@
9625 +diff -Nur usr.bin.orig/ar/ar.c usr.bin/ar/ar.c
9626 +--- usr.bin.orig/ar/ar.c 2012-01-03 12:23:45.000000000 +0900
9627 ++++ usr.bin/ar/ar.c 2012-12-25 20:50:29.000000000 +0900
9628 +@@ -386,13 +386,13 @@
9629 + static void
9630 + bsdar_version(void)
9631 + {
9632 +- (void)printf("BSD ar %s - %s\n", BSDAR_VERSION, archive_version());
9633 ++ (void)printf("BSD ar %s - %s\n", BSDAR_VERSION, archive_version_string());
9634 + exit(EX_OK);
9635 + }
9636 +
9637 + static void
9638 + ranlib_version(void)
9639 + {
9640 +- (void)printf("ranlib %s - %s\n", BSDAR_VERSION, archive_version());
9641 ++ (void)printf("ranlib %s - %s\n", BSDAR_VERSION, archive_version_string());
9642 + exit(EX_OK);
9643 + }
9644
9645 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-bsdar.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-bsdar.patch
9646 new file mode 100644
9647 index 0000000..a65185f
9648 --- /dev/null
9649 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-bsdar.patch
9650 @@ -0,0 +1,25 @@
9651 +diff -Nur work.orig/usr.bin/ar/Makefile work/usr.bin/ar/Makefile
9652 +--- work.orig/usr.bin/ar/Makefile 2012-07-16 03:59:48.000000000 +0900
9653 ++++ work/usr.bin/ar/Makefile 2012-07-16 04:02:38.000000000 +0900
9654 +@@ -2,7 +2,7 @@
9655 +
9656 + .include <bsd.own.mk>
9657 +
9658 +-PROG= ar
9659 ++PROG= freebsd-ar
9660 + SRCS= ar.c acplex.l acpyacc.y read.c util.c write.c y.tab.h
9661 +
9662 + DPADD= ${LIBARCHIVE} ${LIBELF}
9663 +@@ -10,10 +10,7 @@
9664 +
9665 + CFLAGS+=-I. -I${.CURDIR}
9666 +
9667 +-.if ${MK_SHARED_TOOLCHAIN} == "no"
9668 +-NO_SHARED?= yes
9669 +-.endif
9670 +-LINKS= ${BINDIR}/ar ${BINDIR}/ranlib
9671 +-MLINKS= ar.1 ranlib.1
9672 ++LINKS= ${BINDIR}/freebsd-ar ${BINDIR}/freebsd-ranlib
9673 ++MLINKS= freebsd-ar.1 freebsd-ranlib.1
9674 +
9675 + .include <bsd.prog.mk>
9676
9677 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-grep.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-grep.patch
9678 new file mode 100644
9679 index 0000000..06cc5d2
9680 --- /dev/null
9681 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-grep.patch
9682 @@ -0,0 +1,17 @@
9683 +diff -Nur work.orig/usr.bin/grep/Makefile work/usr.bin/grep/Makefile
9684 +--- work.orig/usr.bin/grep/Makefile 2012-07-16 04:59:01.000000000 +0900
9685 ++++ work/usr.bin/grep/Makefile 2012-07-16 05:00:15.000000000 +0900
9686 +@@ -40,13 +40,6 @@
9687 + grep.1 lzfgrep.1
9688 + .endif
9689 +
9690 +-LINKS+= ${BINDIR}/${PROG} ${BINDIR}/xzgrep \
9691 +- ${BINDIR}/${PROG} ${BINDIR}/xzegrep \
9692 +- ${BINDIR}/${PROG} ${BINDIR}/xzfgrep \
9693 +- ${BINDIR}/${PROG} ${BINDIR}/lzgrep \
9694 +- ${BINDIR}/${PROG} ${BINDIR}/lzegrep \
9695 +- ${BINDIR}/${PROG} ${BINDIR}/lzfgrep
9696 +-
9697 + LDADD= -lz -llzma
9698 + DPADD= ${LIBZ} ${LIBLZMA}
9699 +
9700
9701 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-kdump-ioctl.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-kdump-ioctl.patch
9702 new file mode 100644
9703 index 0000000..d98e599
9704 --- /dev/null
9705 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-kdump-ioctl.patch
9706 @@ -0,0 +1,24 @@
9707 +diff -Nur work.orig/usr.bin/kdump/Makefile work/usr.bin/kdump/Makefile
9708 +--- work.orig/usr.bin/kdump/Makefile 2012-07-12 13:24:01.000000000 +0900
9709 ++++ work/usr.bin/kdump/Makefile 2012-07-16 03:54:14.000000000 +0900
9710 +@@ -21,7 +21,7 @@
9711 +
9712 + ioctl.c: mkioctls
9713 + env CPP="${CPP}" \
9714 +- sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include > ${.TARGET}
9715 ++ sh ${.CURDIR}/mkioctls ${.CURDIR}/../../include > ${.TARGET}
9716 +
9717 + kdump_subr.c: mksubr
9718 + sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include > ${.TARGET}
9719 +diff -Nur work.orig/usr.bin/truss/Makefile work/usr.bin/truss/Makefile
9720 +--- work.orig/usr.bin/truss/Makefile 2012-07-12 13:24:03.000000000 +0900
9721 ++++ work/usr.bin/truss/Makefile 2012-07-16 03:54:40.000000000 +0900
9722 +@@ -24,7 +24,7 @@
9723 +
9724 + ioctl.c: ${.CURDIR}/../kdump/mkioctls
9725 + env CPP="${CPP}" \
9726 +- sh ${.CURDIR}/../kdump/mkioctls ${DESTDIR}/usr/include > ${.TARGET}
9727 ++ sh ${.CURDIR}/../kdump/mkioctls ${.CURDIR}/../../include > ${.TARGET}
9728 +
9729 + .if ${MACHINE_CPUARCH} == "i386"
9730 + SRCS+= i386-linux.c linux_syscalls.h
9731
9732 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-minigzip.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-minigzip.patch
9733 new file mode 100644
9734 index 0000000..a9c0622
9735 --- /dev/null
9736 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-9.1-minigzip.patch
9737 @@ -0,0 +1,10 @@
9738 +diff -Nur work.orig/usr.bin/minigzip/Makefile work/usr.bin/minigzip/Makefile
9739 +--- work.orig/usr.bin/minigzip/Makefile 2012-07-16 04:39:31.000000000 +0900
9740 ++++ work/usr.bin/minigzip/Makefile 2012-07-16 04:45:30.000000000 +0900
9741 +@@ -10,4 +10,6 @@
9742 + DPADD= ${LIBZ}
9743 + LDADD= -lz
9744 +
9745 ++CFLAGS+= -I${.CURDIR}/../../lib/libz
9746 ++
9747 + .include <bsd.prog.mk>
9748
9749 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-lint-stdarg.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-lint-stdarg.patch
9750 new file mode 100644
9751 index 0000000..9774724
9752 --- /dev/null
9753 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-lint-stdarg.patch
9754 @@ -0,0 +1,24 @@
9755 +diff -ur usr.bin.orig/xlint/llib/llib-lposix usr.bin/xlint/llib/llib-lposix
9756 +--- usr.bin.orig/xlint/llib/llib-lposix 2005-04-29 17:30:03 +0000
9757 ++++ usr.bin/xlint/llib/llib-lposix 2005-05-03 14:12:26 +0000
9758 +@@ -42,7 +42,7 @@
9759 + #include <sys/utsname.h>
9760 + #include <sys/times.h>
9761 + #include <stdio.h>
9762 +-#include <stdarg.h>
9763 ++#include <machine/stdarg.h>
9764 + #include <stdlib.h>
9765 + #include <unistd.h>
9766 + #include <math.h>
9767 +diff -ur usr.bin.orig/xlint/llib/llib-lstdc usr.bin/xlint/llib/llib-lstdc
9768 +--- usr.bin.orig/xlint/llib/llib-lstdc 2005-04-29 17:30:03 +0000
9769 ++++ usr.bin/xlint/llib/llib-lstdc 2005-05-03 14:12:35 +0000
9770 +@@ -44,7 +44,7 @@
9771 + #include <math.h>
9772 + #include <setjmp.h>
9773 + #include <signal.h>
9774 +-#include <stdarg.h>
9775 ++#include <machine/stdarg.h>
9776 + #include <stddef.h>
9777 + #include <stdio.h>
9778 + #include <stdlib.h>
9779
9780 diff --git a/sys-freebsd/freebsd-ubin/files/freebsd-ubin-setXid.patch b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-setXid.patch
9781 new file mode 100644
9782 index 0000000..631ee4f
9783 --- /dev/null
9784 +++ b/sys-freebsd/freebsd-ubin/files/freebsd-ubin-setXid.patch
9785 @@ -0,0 +1,129 @@
9786 +diff -ur usr.bin.orig/at/Makefile usr.bin.setXid/at/Makefile
9787 +--- usr.bin.orig/at/Makefile Thu Apr 7 20:52:57 2005
9788 ++++ usr.bin.setXid/at/Makefile Thu Apr 7 21:21:02 2005
9789 +@@ -15,6 +15,8 @@
9790 + BINMODE= 4555
9791 + CLEANFILES+= at.1
9792 +
9793 ++LDFLAGS+=-Wl,-z,now
9794 ++
9795 + at.1: at.man
9796 + @${ECHO} Making ${.TARGET:T} from ${.ALLSRC:T}; \
9797 + sed -e \
9798 +diff -ur usr.bin.orig/chpass/Makefile usr.bin.setXid/chpass/Makefile
9799 +--- usr.bin.orig/chpass/Makefile Thu Apr 7 20:52:57 2005
9800 ++++ usr.bin.setXid/chpass/Makefile Thu Apr 7 21:22:40 2005
9801 +@@ -15,6 +15,8 @@
9802 + #CFLAGS+=-DRESTRICT_FULLNAME_CHANGE
9803 + CFLAGS+=-I${.CURDIR}/../../usr.sbin/pwd_mkdb -I${.CURDIR}/../../lib/libc/gen -I.
9804 +
9805 ++LDFLAGS+=-Wl,-z,now
9806 ++
9807 + DPADD= ${LIBCRYPT} ${LIBUTIL}
9808 + LDADD= -lcrypt -lutil
9809 + .if !defined(NO_NIS)
9810 +diff -ur usr.bin.orig/fstat/Makefile usr.bin.setXid/fstat/Makefile
9811 +--- usr.bin.orig/fstat/Makefile Thu Apr 7 20:52:57 2005
9812 ++++ usr.bin.setXid/fstat/Makefile Thu Apr 7 21:24:35 2005
9813 +@@ -9,4 +9,6 @@
9814 + BINMODE=2555
9815 + WARNS?= 6
9816 +
9817 ++LDFLAGS+=-Wl,-z,now
9818 ++
9819 + .include <bsd.prog.mk>
9820 +diff -ur usr.bin.orig/lock/Makefile usr.bin.setXid/lock/Makefile
9821 +--- usr.bin.orig/lock/Makefile Thu Apr 7 20:52:57 2005
9822 ++++ usr.bin.setXid/lock/Makefile Thu Apr 7 21:24:45 2005
9823 +@@ -7,4 +7,6 @@
9824 + DPADD= ${LIBCRYPT}
9825 + LDADD= -lcrypt
9826 +
9827 ++LDFLAGS+=-Wl,-z,now
9828 ++
9829 + .include <bsd.prog.mk>
9830 +diff -ur usr.bin.orig/login/Makefile usr.bin.setXid/login/Makefile
9831 +--- usr.bin.orig/login/Makefile Thu Apr 7 20:52:57 2005
9832 ++++ usr.bin.setXid/login/Makefile Thu Apr 7 21:24:55 2005
9833 +@@ -13,4 +13,6 @@
9834 + INSTALLFLAGS=-fschg
9835 + .endif
9836 +
9837 ++LDFLAGS+=-Wl,-z,now
9838 ++
9839 + .include <bsd.prog.mk>
9840 +diff -ur usr.bin.orig/netstat/Makefile usr.bin.setXid/netstat/Makefile
9841 +--- usr.bin.orig/netstat/Makefile Thu Apr 7 20:52:58 2005
9842 ++++ usr.bin.setXid/netstat/Makefile Thu Apr 7 21:25:08 2005
9843 +@@ -14,4 +14,6 @@
9844 + DPADD= ${LIBKVM} ${LIBIPX} ${LIBNETGRAPH} ${LIBUTIL}
9845 + LDADD= -lkvm -lipx -lnetgraph -lutil
9846 +
9847 ++LDFLAGS+=-Wl,-z,now
9848 ++
9849 + .include <bsd.prog.mk>
9850 +diff -ur usr.bin.orig/opieinfo/Makefile usr.bin.setXid/opieinfo/Makefile
9851 +--- usr.bin.orig/opieinfo/Makefile Thu Apr 7 20:52:58 2005
9852 ++++ usr.bin.setXid/opieinfo/Makefile Thu Apr 7 21:25:20 2005
9853 +@@ -11,6 +11,8 @@
9854 + DPADD= ${LIBOPIE} ${LIBMD}
9855 + LDADD= -lopie -lmd
9856 +
9857 ++LDFLAGS+=-Wl,-z,now
9858 ++
9859 + BINOWN= root
9860 + BINMODE=4555
9861 + INSTALLFLAGS=-fschg
9862 +diff -ur usr.bin.orig/opiepasswd/Makefile usr.bin.setXid/opiepasswd/Makefile
9863 +--- usr.bin.orig/opiepasswd/Makefile Thu Apr 7 20:52:58 2005
9864 ++++ usr.bin.setXid/opiepasswd/Makefile Thu Apr 7 21:25:29 2005
9865 +@@ -11,6 +11,8 @@
9866 + DPADD= ${LIBOPIE} ${LIBMD}
9867 + LDADD= -lopie -lmd
9868 +
9869 ++LDFLAGS+=-Wl,-z,now
9870 ++
9871 + BINOWN= root
9872 + BINMODE=4555
9873 + INSTALLFLAGS=-fschg
9874 +diff -ur usr.bin.orig/passwd/Makefile usr.bin.setXid/passwd/Makefile
9875 +--- usr.bin.orig/passwd/Makefile Thu Apr 7 20:52:58 2005
9876 ++++ usr.bin.setXid/passwd/Makefile Thu Apr 7 21:25:37 2005
9877 +@@ -10,6 +10,8 @@
9878 + MLINKS = passwd.1 yppasswd.1
9879 + WARNS ?= 4
9880 +
9881 ++LDFLAGS+=-Wl,-z,now
9882 ++
9883 + beforeinstall:
9884 + .for i in passwd yppasswd
9885 + [ ! -e ${DESTDIR}${BINDIR}/$i ] || \
9886 +--- usr.bin.orig/su/Makefile Thu Apr 7 20:52:58 2005
9887 ++++ usr.bin.setXid/su/Makefile Thu Apr 7 21:26:00 2005
9888 +@@ -10,4 +10,6 @@
9889 + BINMODE=4555
9890 + INSTALLFLAGS=-fschg
9891 +
9892 ++LDFLAGS+=-Wl,-z,now
9893 ++
9894 + .include <bsd.prog.mk>
9895 +diff -ur usr.bin.orig/wall/Makefile usr.bin.setXid/wall/Makefile
9896 +--- usr.bin.orig/wall/Makefile Thu Apr 7 20:52:59 2005
9897 ++++ usr.bin.setXid/wall/Makefile Thu Apr 7 21:26:07 2005
9898 +@@ -5,4 +5,6 @@
9899 + BINGRP= tty
9900 + BINMODE=2555
9901 +
9902 ++LDFLAGS+=-Wl,-z,now
9903 ++
9904 + .include <bsd.prog.mk>
9905 +diff -ur usr.bin.orig/write/Makefile usr.bin.setXid/write/Makefile
9906 +--- usr.bin.orig/write/Makefile Thu Apr 7 20:52:59 2005
9907 ++++ usr.bin.setXid/write/Makefile Thu Apr 7 21:26:13 2005
9908 +@@ -4,4 +4,6 @@
9909 + BINMODE=2555
9910 + BINGRP= tty
9911 +
9912 ++LDFLAGS+=-Wl,-z,now
9913 ++
9914 + .include <bsd.prog.mk>
9915
9916 diff --git a/sys-freebsd/freebsd-ubin/files/locate-updatedb-cron b/sys-freebsd/freebsd-ubin/files/locate-updatedb-cron
9917 new file mode 100644
9918 index 0000000..323f455
9919 --- /dev/null
9920 +++ b/sys-freebsd/freebsd-ubin/files/locate-updatedb-cron
9921 @@ -0,0 +1,6 @@
9922 +#! /bin/sh
9923 +
9924 +if [ -x /usr/libexec/locate.updatedb ]
9925 +then
9926 + echo /usr/libexec/locate.updatedb | nice -n 5 su -fm nobody
9927 +fi
9928
9929 diff --git a/sys-freebsd/freebsd-ubin/files/login.1.pamd b/sys-freebsd/freebsd-ubin/files/login.1.pamd
9930 new file mode 100644
9931 index 0000000..2c09584
9932 --- /dev/null
9933 +++ b/sys-freebsd/freebsd-ubin/files/login.1.pamd
9934 @@ -0,0 +1,4 @@
9935 +auth include system-local-login
9936 +account include system-local-login
9937 +session include system-local-login
9938 +password include system-local-login
9939
9940 diff --git a/sys-freebsd/freebsd-ubin/files/login.pamd b/sys-freebsd/freebsd-ubin/files/login.pamd
9941 new file mode 100644
9942 index 0000000..db1c74f
9943 --- /dev/null
9944 +++ b/sys-freebsd/freebsd-ubin/files/login.pamd
9945 @@ -0,0 +1,20 @@
9946 +#
9947 +# $Id$
9948 +#
9949 +# PAM configuration for the "login" service
9950 +#
9951 +
9952 +# auth
9953 +auth required pam_nologin.so no_warn
9954 +auth sufficient pam_self.so no_warn
9955 +auth include system
9956 +
9957 +# account
9958 +account requisite pam_securetty.so
9959 +account include system
9960 +
9961 +# session
9962 +session include system
9963 +
9964 +# password
9965 +password include system
9966
9967 diff --git a/sys-freebsd/freebsd-ubin/files/passwd.1.pamd b/sys-freebsd/freebsd-ubin/files/passwd.1.pamd
9968 new file mode 100644
9969 index 0000000..bab2eea
9970 --- /dev/null
9971 +++ b/sys-freebsd/freebsd-ubin/files/passwd.1.pamd
9972 @@ -0,0 +1,9 @@
9973 +#
9974 +# $Id$
9975 +#
9976 +# PAM configuration for the "passwd" service
9977 +#
9978 +
9979 +# passwd(1) does not use the auth, account or session services.
9980 +
9981 +password include system-auth
9982
9983 diff --git a/sys-freebsd/freebsd-ubin/files/passwd.pamd b/sys-freebsd/freebsd-ubin/files/passwd.pamd
9984 new file mode 100644
9985 index 0000000..44b7e71
9986 --- /dev/null
9987 +++ b/sys-freebsd/freebsd-ubin/files/passwd.pamd
9988 @@ -0,0 +1,11 @@
9989 +#
9990 +# $Id$
9991 +#
9992 +# PAM configuration for the "passwd" service
9993 +#
9994 +
9995 +# passwd(1) does not use the auth, account or session services.
9996 +
9997 +# password
9998 +#password requisite pam_passwdqc.so enforce=users
9999 +password required pam_unix.so no_warn try_first_pass nullok
10000
10001 diff --git a/sys-freebsd/freebsd-ubin/files/su.1.pamd b/sys-freebsd/freebsd-ubin/files/su.1.pamd
10002 new file mode 100644
10003 index 0000000..72e2bd1
10004 --- /dev/null
10005 +++ b/sys-freebsd/freebsd-ubin/files/su.1.pamd
10006 @@ -0,0 +1,17 @@
10007 +#
10008 +# $Id$
10009 +#
10010 +# PAM configuration for the "su" service
10011 +#
10012 +
10013 +# auth
10014 +auth sufficient pam_rootok.so no_warn
10015 +auth sufficient pam_self.so no_warn
10016 +auth requisite pam_group.so no_warn group=wheel root_only fail_safe
10017 +auth include system-auth
10018 +
10019 +# account
10020 +account include system-auth
10021 +
10022 +# session
10023 +session required pam_permit.so
10024
10025 diff --git a/sys-freebsd/freebsd-ubin/files/su.pamd b/sys-freebsd/freebsd-ubin/files/su.pamd
10026 new file mode 100644
10027 index 0000000..57019c5
10028 --- /dev/null
10029 +++ b/sys-freebsd/freebsd-ubin/files/su.pamd
10030 @@ -0,0 +1,17 @@
10031 +#
10032 +# $Id$
10033 +#
10034 +# PAM configuration for the "su" service
10035 +#
10036 +
10037 +# auth
10038 +auth sufficient pam_rootok.so no_warn
10039 +auth sufficient pam_self.so no_warn
10040 +auth requisite pam_group.so no_warn group=wheel root_only fail_safe
10041 +auth include system
10042 +
10043 +# account
10044 +account include system
10045 +
10046 +# session
10047 +session required pam_permit.so
10048
10049 diff --git a/sys-freebsd/freebsd-ubin/freebsd-ubin-11.0.ebuild b/sys-freebsd/freebsd-ubin/freebsd-ubin-11.0.ebuild
10050 new file mode 100644
10051 index 0000000..3cdde79
10052 --- /dev/null
10053 +++ b/sys-freebsd/freebsd-ubin/freebsd-ubin-11.0.ebuild
10054 @@ -0,0 +1,210 @@
10055 +# Copyright 1999-2016 Gentoo Foundation
10056 +# Distributed under the terms of the GNU General Public License v2
10057 +# $Id$
10058 +
10059 +EAPI=5
10060 +
10061 +inherit bsdmk freebsd flag-o-matic pam multilib multibuild multilib-build
10062 +
10063 +DESCRIPTION="FreeBSD's base system source for /usr/bin"
10064 +SLOT="0"
10065 +IUSE="ar atm audit bluetooth ipv6 kerberos netware nis ssl usb build zfs"
10066 +LICENSE="BSD zfs? ( CDDL )"
10067 +
10068 +# Security Advisory and Errata patches.
10069 +UPSTREAM_PATCHES=( "SA-16:25/bspatch.patch" )
10070 +
10071 +if [[ ${PV} != *9999* ]]; then
10072 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
10073 + SRC_URI="${SRC_URI}
10074 + $(freebsd_upstream_patches)"
10075 +fi
10076 +
10077 +EXTRACTONLY="
10078 + usr.bin/
10079 + contrib/
10080 + lib/
10081 + etc/
10082 + bin/
10083 + include/
10084 +"
10085 +
10086 +RDEPEND="=sys-freebsd/freebsd-lib-${RV}*[usb?,bluetooth?,${MULTILIB_USEDEP}]
10087 + ssl? ( dev-libs/openssl:0= )
10088 + kerberos? ( virtual/krb5 )
10089 + ar? ( >=app-arch/libarchive-3 )
10090 + virtual/pam
10091 + sys-libs/zlib
10092 + >=sys-libs/ncurses-5.9:0=
10093 + !sys-process/fuser-bsd
10094 + !dev-util/csup
10095 + !dev-libs/libiconv
10096 + !sys-freebsd/freebsd-contrib"
10097 +
10098 +DEPEND="${RDEPEND}
10099 + sys-devel/flex
10100 + !build? ( =sys-freebsd/freebsd-sources-${RV}* )
10101 + =sys-freebsd/freebsd-sbin-${RV}*
10102 + =sys-freebsd/freebsd-mk-defs-${RV}*"
10103 +
10104 +RDEPEND="${RDEPEND}
10105 + >=sys-auth/pambase-20080219.1
10106 + sys-process/cronbase"
10107 +
10108 +S="${WORKDIR}/usr.bin"
10109 +
10110 +PATCHES=( "${FILESDIR}/${PN}-6.0-bsdcmp.patch"
10111 + "${FILESDIR}/${PN}-9.0-fixmakefiles.patch"
10112 + "${FILESDIR}/${PN}-setXid.patch"
10113 + "${FILESDIR}/${PN}-lint-stdarg.patch"
10114 + "${FILESDIR}/${PN}-8.0-xinstall.patch"
10115 + "${FILESDIR}/${PN}-9.1-bsdar.patch"
10116 + "${FILESDIR}/${PN}-9.1-minigzip.patch"
10117 + "${FILESDIR}/${PN}-10.0-atf.patch"
10118 + "${FILESDIR}/${PN}-10.0-dtc-gcc46.patch"
10119 + "${FILESDIR}/${PN}-10.0-kdump-ioctl.patch"
10120 + "${FILESDIR}/${PN}-10.0-mandoc.patch"
10121 + "${FILESDIR}/${PN}-10.2-bsdxml.patch"
10122 + "${FILESDIR}/${PN}-10.2-talk-workaround.patch"
10123 + "${FILESDIR}/${PN}-10.3-bmake-workaround.patch" )
10124 +
10125 +# Here we remove some sources we don't need because they are already
10126 +# provided by portage's packages or similar. In order:
10127 +# - Archiving tools, provided by their own ebuilds
10128 +# - ncurses stuff
10129 +# - less stuff
10130 +# - bind utils
10131 +# - rsh stuff
10132 +# - binutils gprof
10133 +# - dc stuff
10134 +# and the rest are misc utils we already provide somewhere else.
10135 +REMOVE_SUBDIRS="bzip2 bzip2recover tar cpio
10136 + gzip gprof
10137 + lzmainfo xz xzdec
10138 + unzip
10139 + tput tset tabs
10140 + less lessecho lesskey
10141 + hesinfo host
10142 + rsh rlogin rusers rwho ruptime
10143 + compile_et lex vi smbutil file vacation nc ftp telnet
10144 + c99 c89
10145 + bc dc
10146 + whois tftp man"
10147 +
10148 +pkg_setup() {
10149 + # Add the required source files.
10150 + use zfs && EXTRACTONLY+="cddl/ "
10151 + use build && EXTRACTONLY+="sys/ "
10152 +
10153 + use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
10154 + use audit || mymakeopts="${mymakeopts} WITHOUT_AUDIT= "
10155 + use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= "
10156 + use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6= WITHOUT_INET6_SUPPORT= "
10157 + use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= "
10158 + use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
10159 + use nis || mymakeopts="${mymakeopts} WITHOUT_NIS= "
10160 + use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
10161 + use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
10162 + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
10163 + mymakeopts="${mymakeopts} WITHOUT_CLANG= WITHOUT_LZMA_SUPPORT= WITHOUT_SVN= WITHOUT_SVNLITE= WITHOUT_OPENSSH= WITHOUT_LDNS_UTILS= "
10164 +}
10165 +
10166 +pkg_preinst() {
10167 + # bison installs a /usr/bin/yacc symlink ...
10168 + # we need to remove it to avoid triggering
10169 + # collision-protect errors
10170 + if [[ -L ${ROOT}/usr/bin/yacc ]] ; then
10171 + rm -f "${ROOT}"/usr/bin/yacc
10172 + fi
10173 +}
10174 +
10175 +src_prepare() {
10176 + if [[ ! -e "${WORKDIR}/sys" ]]; then
10177 + use build || ln -s "/usr/src/sys" "${WORKDIR}/sys"
10178 + fi
10179 +
10180 + # Rename manpage for renamed cmp
10181 + mv "${S}"/cmp/cmp.1 "${S}"/cmp/bsdcmp.1 || die
10182 + # Rename manpage for renamed ar
10183 + mv "${S}"/ar/ar.1 "${S}"/ar/freebsd-ar.1 || die
10184 + # Fix whereis(1) manpath search.
10185 + sed -i -e 's:"manpath -q":"manpath":' "${S}/whereis/pathnames.h"
10186 +
10187 + # Build a dynamic make
10188 + sed -i -e '/^NO_SHARED/ s/^/#/' "${S}"/make/Makefile || die
10189 +
10190 + # Disable it here otherwise our patch wont apply
10191 + use ar || dummy_mk ar
10192 +
10193 + # Preparing to build xlint
10194 + export LINT=xlint
10195 +}
10196 +
10197 +setup_multilib_vars() {
10198 + if ! multilib_is_native_abi ; then
10199 + cd "${WORKDIR}/usr.bin/ldd" || die
10200 + export mymakeopts="${mymakeopts} PROG=ldd32 WITHOUT_MAN="
10201 + else
10202 + cd "${S}" || die
10203 + fi
10204 + "$@"
10205 +}
10206 +
10207 +src_compile() {
10208 + # Preparing to build mandoc
10209 + cd "${WORKDIR}/lib/libmandoc" || die
10210 + freebsd_src_compile -j1
10211 +
10212 + cd "${S}" || die
10213 + local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
10214 + multibuild_foreach_variant freebsd_multilib_multibuild_wrapper setup_multilib_vars freebsd_src_compile -j1
10215 +}
10216 +
10217 +src_install() {
10218 + local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
10219 + multibuild_foreach_variant freebsd_multilib_multibuild_wrapper setup_multilib_vars freebsd_src_install
10220 +
10221 + # baselayout requires these in /bin
10222 + dodir /bin
10223 + for bin in sed printf ; do
10224 + mv "${D}/usr/bin/${bin}" "${D}/bin/" || die "mv ${bin} failed"
10225 + dosym /bin/${bin} /usr/bin/${bin} || die "dosym ${bin} failed"
10226 + done
10227 +
10228 + for pamdfile in login passwd su; do
10229 + newpamd "${FILESDIR}/${pamdfile}.1.pamd" ${pamdfile} || die
10230 + done
10231 +
10232 + cd "${WORKDIR}/etc" || die
10233 + insinto /etc
10234 + doins remote phones opieaccess fbtab || die
10235 +
10236 + exeinto /etc/cron.daily
10237 + newexe "${FILESDIR}/locate-updatedb-cron" locate.updatedb || die
10238 +
10239 + # tip requires /var/spool/lock/, bug #200700
10240 + keepdir /var/spool/lock
10241 +
10242 + # create locate database #472468
10243 + local f=/var/db/locate.database
10244 + mkdir "${ED}${f%/*}" || die
10245 + touch "${ED}${f}" || die
10246 + fowners nobody:nobody ${f}
10247 +}
10248 +
10249 +pkg_postinst() {
10250 + # We need to ensure that login.conf.db is up-to-date.
10251 + if [[ -e "${ROOT}"etc/login.conf ]] ; then
10252 + einfo "Updating ${ROOT}etc/login.conf.db"
10253 + "${ROOT}"usr/bin/cap_mkdb -f "${ROOT}"etc/login.conf "${ROOT}"etc/login.conf
10254 + elog "Remember to run cap_mkdb /etc/login.conf after making changes to it"
10255 + fi
10256 +}
10257 +
10258 +pkg_postrm() {
10259 + # and if we uninstall yacc but keep bison,
10260 + # lets restore the /usr/bin/yacc symlink
10261 + if [[ ! -e ${ROOT}/usr/bin/yacc ]] && [[ -e ${ROOT}/usr/bin/yacc.bison ]] ; then
10262 + ln -s yacc.bison "${ROOT}"/usr/bin/yacc
10263 + fi
10264 +}
10265
10266 diff --git a/sys-freebsd/freebsd-ubin/metadata.xml b/sys-freebsd/freebsd-ubin/metadata.xml
10267 new file mode 100644
10268 index 0000000..a7fa78a
10269 --- /dev/null
10270 +++ b/sys-freebsd/freebsd-ubin/metadata.xml
10271 @@ -0,0 +1,24 @@
10272 +<?xml version="1.0" encoding="UTF-8"?>
10273 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
10274 +<pkgmetadata>
10275 + <maintainer type="project">
10276 + <email>bsd@g.o</email>
10277 + <name>BSD Project</name>
10278 + </maintainer>
10279 + <use>
10280 + <flag name="audit">
10281 + Build auditing tools.
10282 + </flag>
10283 + <flag name="netware">
10284 + Build libraries and tools to work with NetWare protocols (IPX
10285 + and NCP).
10286 + </flag>
10287 + <flag name="ar">
10288 + Build FreeBSD's ar and ranlib replacements based on libarchive. The
10289 + toolchain will still use binutils' version but you can play with it.
10290 + They have been renamed to freebsd-ar and freebsd-ranlib not to collide
10291 + with binutils.
10292 + </flag>
10293 + <flag name="zfs">Enable ZFS support (for fstat actually).</flag>
10294 + </use>
10295 +</pkgmetadata>
10296
10297 diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-10.0-bsdxml2expat.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-10.0-bsdxml2expat.patch
10298 new file mode 100644
10299 index 0000000..a84f96d
10300 --- /dev/null
10301 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-10.0-bsdxml2expat.patch
10302 @@ -0,0 +1,24 @@
10303 +diff -Nur work.orig/usr.sbin/ctladm/ctladm.c work/usr.sbin/ctladm/ctladm.c
10304 +--- work.orig/usr.sbin/ctladm/ctladm.c 2012-07-12 13:25:58.000000000 +0900
10305 ++++ work/usr.sbin/ctladm/ctladm.c 2012-07-16 05:37:14.000000000 +0900
10306 +@@ -60,7 +60,7 @@
10307 + #include <errno.h>
10308 + #include <err.h>
10309 + #include <ctype.h>
10310 +-#include <bsdxml.h>
10311 ++#include <expat.h>
10312 + #include <cam/scsi/scsi_all.h>
10313 + #include <cam/scsi/scsi_message.h>
10314 + #include <cam/ctl/ctl.h>
10315 +diff -Nur work.orig/usr.sbin/ctld/kernel.c work/usr.sbin/ctld/kernel.c
10316 +--- work.orig/usr.sbin/ctld/kernel.c 2013-09-20 21:55:45.000000000 +0900
10317 ++++ work/usr.sbin/ctld/kernel.c 2013-09-20 22:01:17.000000000 +0900
10318 +@@ -45,7 +45,7 @@
10319 + #include <sys/sbuf.h>
10320 + #include <sys/capability.h>
10321 + #include <assert.h>
10322 +-#include <bsdxml.h>
10323 ++#include <expat.h>
10324 + #include <ctype.h>
10325 + #include <errno.h>
10326 + #include <fcntl.h>
10327
10328 diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-10.3-bsdxml2expat.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-10.3-bsdxml2expat.patch
10329 new file mode 100644
10330 index 0000000..207b6ab
10331 --- /dev/null
10332 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-10.3-bsdxml2expat.patch
10333 @@ -0,0 +1,13 @@
10334 +diff --git a/usr.sbin/camdd/camdd.c b/usr.sbin/camdd/camdd.c
10335 +index 88c648e..edf9c8b 100644
10336 +--- a/usr.sbin/camdd/camdd.c
10337 ++++ b/usr.sbin/camdd/camdd.c
10338 +@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD: stable/10/usr.sbin/camdd/camdd.c 293409 2016-01-08 02:56:21Z
10339 + #include <libutil.h>
10340 + #include <pthread.h>
10341 + #include <assert.h>
10342 +-#include <bsdxml.h>
10343 ++#include <expat.h>
10344 +
10345 + #include <cam/cam.h>
10346 + #include <cam/cam_debug.h>
10347
10348 diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-7.0-nowrap.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-7.0-nowrap.patch
10349 new file mode 100644
10350 index 0000000..9b11104
10351 --- /dev/null
10352 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-7.0-nowrap.patch
10353 @@ -0,0 +1,45 @@
10354 +diff -ur usr.sbin.orig/rpcbind/Makefile usr.sbin/rpcbind/Makefile
10355 +--- usr.sbin.orig/rpcbind/Makefile 2007-04-21 12:02:30 +0000
10356 ++++ usr.sbin/rpcbind/Makefile 2007-04-21 12:05:32 +0000
10357 +@@ -8,13 +8,20 @@
10358 + SRCS= check_bound.c rpcb_stat.c rpcb_svc_4.c rpcbind.c pmap_svc.c \
10359 + rpcb_svc.c rpcb_svc_com.c security.c warmstart.c util.c
10360 +
10361 +-CFLAGS+= -DPORTMAP -DLIBWRAP
10362 ++CFLAGS+= -DPORTMAP
10363 +
10364 + .if ${MK_INET6_SUPPORT} != "no"
10365 + CFLAGS+= -DINET6
10366 + .endif
10367 +
10368 +-DPADD= ${LIBWRAP} ${LIBUTIL}
10369 +-LDADD= -lwrap -lutil
10370 ++DPADD= ${LIBUTIL}
10371 ++LDADD= -lutil
10372 ++
10373 ++.if !defined(NO_WRAP)
10374 ++CFLAGS+= -DLIBWRAP
10375 ++DPADD+= ${LIBWRAP}
10376 ++LDADD+= -lwrap
10377 ++.endif
10378 ++
10379 +
10380 + .include <bsd.prog.mk>
10381 +diff -ur usr.sbin.orig/ypserv/Makefile usr.sbin/ypserv/Makefile
10382 +--- usr.sbin.orig/ypserv/Makefile 2007-04-21 12:02:31 +0000
10383 ++++ usr.sbin/ypserv/Makefile 2007-04-21 12:06:53 +0000
10384 +@@ -8,10 +8,13 @@
10385 + SRCS= yp_svc.c yp_server.c yp_dblookup.c yp_dnslookup.c \
10386 + ypxfr_clnt.c yp.h yp_main.c yp_error.c yp_access.c yp_svc_udp.c
10387 +
10388 +-CFLAGS+= -DDB_CACHE -DTCP_WRAPPER -I.
10389 ++CFLAGS+= -DDB_CACHE -I.
10390 +
10391 ++.if !defined(NO_WRAP)
10392 ++CFLAGS+= -DTCP_WRAPPER
10393 + DPADD= ${LIBWRAP}
10394 + LDADD= -lwrap
10395 ++.endif
10396 +
10397 + CLEANFILES= yp_svc.c ypxfr_clnt.c yp.h
10398 +
10399
10400 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
10401 new file mode 100644
10402 index 0000000..a098391
10403 --- /dev/null
10404 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-8.2-newsyslog.patch
10405 @@ -0,0 +1,10 @@
10406 +--- usr.sbin/newsyslog/pathnames.h.orig 2001-07-30 18:17:17.000000000 +0300
10407 ++++ usr.sbin/newsyslog/pathnames.h 2009-09-11 08:32:57.508226240 +0300
10408 +@@ -24,5 +24,5 @@
10409 +
10410 + #define _PATH_CONF "/etc/newsyslog.conf"
10411 + #define _PATH_SYSLOGPID _PATH_VARRUN "syslog.pid"
10412 +-#define _PATH_BZIP2 "/usr/bin/bzip2"
10413 +-#define _PATH_GZIP "/usr/bin/gzip"
10414 ++#define _PATH_BZIP2 "/bin/bzip2"
10415 ++#define _PATH_GZIP "/bin/gzip"
10416
10417 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
10418 new file mode 100644
10419 index 0000000..bfe4794
10420 --- /dev/null
10421 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.0-libarchive.patch
10422 @@ -0,0 +1,12 @@
10423 +--- usr.sbin/bsdinstall/distextract/distextract.c.old 2011-11-02 20:28:08.000000000 +0000
10424 ++++ usr.sbin/bsdinstall/distextract/distextract.c 2011-11-02 20:28:57.000000000 +0000
10425 +@@ -32,6 +32,9 @@
10426 + #include <limits.h>
10427 + #include <archive.h>
10428 + #include <dialog.h>
10429 ++#ifndef archive_read_free
10430 ++#define archive_read_free(x) archive_read_finish(x)
10431 ++#endif
10432 +
10433 + static int extract_files(int nfiles, const char **files);
10434 +
10435
10436 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
10437 new file mode 100644
10438 index 0000000..1d83865
10439 --- /dev/null
10440 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.0-newsyslog.patch
10441 @@ -0,0 +1,12 @@
10442 +diff -uNr usr.sbin/newsyslog.old/pathnames.h usr.sbin/newsyslog/pathnames.h
10443 +--- usr.sbin/newsyslog.old/pathnames.h 2011-11-02 20:12:37.000000000 +0000
10444 ++++ usr.sbin/newsyslog/pathnames.h 2011-11-02 20:12:50.000000000 +0000
10445 +@@ -24,6 +24,6 @@
10446 +
10447 + #define _PATH_CONF "/etc/newsyslog.conf"
10448 + #define _PATH_SYSLOGPID _PATH_VARRUN "syslog.pid"
10449 +-#define _PATH_BZIP2 "/usr/bin/bzip2"
10450 +-#define _PATH_GZIP "/usr/bin/gzip"
10451 ++#define _PATH_BZIP2 "/bin/bzip2"
10452 ++#define _PATH_GZIP "/bin/gzip"
10453 + #define _PATH_XZ "/usr/bin/xz"
10454
10455 diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.1-bsdxml2expat.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.1-bsdxml2expat.patch
10456 new file mode 100644
10457 index 0000000..bddc0c7
10458 --- /dev/null
10459 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.1-bsdxml2expat.patch
10460 @@ -0,0 +1,12 @@
10461 +diff -Nur work.orig/usr.sbin/ctladm/ctladm.c work/usr.sbin/ctladm/ctladm.c
10462 +--- work.orig/usr.sbin/ctladm/ctladm.c 2012-07-12 13:25:58.000000000 +0900
10463 ++++ work/usr.sbin/ctladm/ctladm.c 2012-07-16 05:37:14.000000000 +0900
10464 +@@ -60,7 +60,7 @@
10465 + #include <errno.h>
10466 + #include <err.h>
10467 + #include <ctype.h>
10468 +-#include <bsdxml.h>
10469 ++#include <expat.h>
10470 + #include <cam/scsi/scsi_all.h>
10471 + #include <cam/scsi/scsi_message.h>
10472 + #include <cam/ctl/ctl.h>
10473
10474 diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.1-kldxref.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.1-kldxref.patch
10475 new file mode 100644
10476 index 0000000..95bd665
10477 --- /dev/null
10478 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-9.1-kldxref.patch
10479 @@ -0,0 +1,30 @@
10480 +Index: usr.sbin/kldxref/kldxref.c
10481 +===================================================================
10482 +--- usr.sbin/kldxref/kldxref.c (revision 265111)
10483 ++++ usr.sbin/kldxref/kldxref.c (working copy)
10484 +@@ -274,6 +274,16 @@ usage(void)
10485 + exit(1);
10486 + }
10487 +
10488 ++static int
10489 ++compare(const FTSENT *const *a, const FTSENT *const *b)
10490 ++{
10491 ++ if ((*a)->fts_info == FTS_D && (*b)->fts_info != FTS_D)
10492 ++ return 1;
10493 ++ if ((*a)->fts_info != FTS_D && (*b)->fts_info == FTS_D)
10494 ++ return -1;
10495 ++ return strcmp((*a)->fts_name, (*b)->fts_name);
10496 ++}
10497 ++
10498 + int
10499 + main(int argc, char *argv[])
10500 + {
10501 +@@ -315,7 +325,7 @@ main(int argc, char *argv[])
10502 + err(1, "%s", argv[0]);
10503 + }
10504 +
10505 +- ftsp = fts_open(argv, fts_options, 0);
10506 ++ ftsp = fts_open(argv, fts_options, compare);
10507 + if (ftsp == NULL)
10508 + exit(1);
10509 +
10510
10511 diff --git a/sys-freebsd/freebsd-usbin/files/freebsd-usbin-adduser.patch b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-adduser.patch
10512 new file mode 100644
10513 index 0000000..39177b4
10514 --- /dev/null
10515 +++ b/sys-freebsd/freebsd-usbin/files/freebsd-usbin-adduser.patch
10516 @@ -0,0 +1,20 @@
10517 +--- usr.sbin/adduser/adduser.sh.old 2006-10-01 13:41:16 +0000
10518 ++++ usr.sbin/adduser/adduser.sh 2006-10-01 13:41:38 +0000
10519 +@@ -809,7 +809,7 @@
10520 + NOHOME="/nonexistent"
10521 + NOLOGIN="nologin"
10522 + NOLOGIN_PATH="/usr/sbin/nologin"
10523 +-GREPCMD="/usr/bin/grep"
10524 ++GREPCMD="/bin/grep"
10525 + DATECMD="/bin/date"
10526 +
10527 + # Set default values
10528 +@@ -823,7 +823,7 @@
10529 + uhome=
10530 + upass=
10531 + ushell=
10532 +-udotdir=/usr/share/skel
10533 ++udotdir=/etc/skel
10534 + ugroups=
10535 + uexpire=
10536 + upwexpire=
10537
10538 diff --git a/sys-freebsd/freebsd-usbin/files/iscsid.initd b/sys-freebsd/freebsd-usbin/files/iscsid.initd
10539 new file mode 100644
10540 index 0000000..f16d00e
10541 --- /dev/null
10542 +++ b/sys-freebsd/freebsd-usbin/files/iscsid.initd
10543 @@ -0,0 +1,20 @@
10544 +#!/sbin/openrc-run
10545 +# Copyright 1999-2015 Gentoo Foundation
10546 +# Distributed under the terms of the GNU General Public License v2
10547 +
10548 +depend() {
10549 + need net
10550 +}
10551 +
10552 +start() {
10553 + ebegin "Starting iscsid"
10554 + start-stop-daemon --start --quiet --exec \
10555 + /usr/sbin/iscsid -- $iscsidopts
10556 + eend $? "Error starting iscsid"
10557 +}
10558 +
10559 +stop() {
10560 + ebegin "Stopping iscsid"
10561 + start-stop-daemon --stop --quiet --exec /usr/sbin/iscsid
10562 + eend $? "Error stopping iscsid"
10563 +}
10564
10565 diff --git a/sys-freebsd/freebsd-usbin/files/mountd.patch b/sys-freebsd/freebsd-usbin/files/mountd.patch
10566 new file mode 100644
10567 index 0000000..3cb9f03
10568 --- /dev/null
10569 +++ b/sys-freebsd/freebsd-usbin/files/mountd.patch
10570 @@ -0,0 +1,15 @@
10571 +http://security.freebsd.org/advisories/FreeBSD-SA-11:01.mountd.asc
10572 +
10573 +Index: usr.sbin/mountd/mountd.c
10574 +===================================================================
10575 +--- usr.sbin/mountd/mountd.c 20 Dec 2010 09:28:28 -0000 1.107
10576 ++++ usr.sbin/mountd/mountd.c 1 Mar 2011 11:47:16 -0000 1.108
10577 +@@ -2875,7 +2875,7 @@ makemask(struct sockaddr_storage *ssp, i
10578 +
10579 + for (i = 0; i < len; i++) {
10580 + bits = (bitlen > CHAR_BIT) ? CHAR_BIT : bitlen;
10581 +- *p++ = (1 << bits) - 1;
10582 ++ *p++ = (u_char)~0 << (CHAR_BIT - bits);
10583 + bitlen -= bits;
10584 + }
10585 + return 0;
10586
10587 diff --git a/sys-freebsd/freebsd-usbin/files/moused.confd b/sys-freebsd/freebsd-usbin/files/moused.confd
10588 new file mode 100644
10589 index 0000000..4d64933
10590 --- /dev/null
10591 +++ b/sys-freebsd/freebsd-usbin/files/moused.confd
10592 @@ -0,0 +1,20 @@
10593 +# $Id$
10594 +
10595 +# See the moused man page for available settings.
10596 +
10597 +# Set to your mouse device psm[0-9] for PS/2 ports, ums[0-9] for USB ports
10598 +# Leave blank to try to autodetect it
10599 +MOUSED_DEVICE=""
10600 +
10601 +# Any additional flags requires
10602 +MOUSED_FLAGS=""
10603 +
10604 +# If 0xd0-0xd3 default range is occupied in your language code table, specify
10605 +# alternative range start like MOUSECHAR_START="3", see vidcontrol(1)
10606 +MOUSECHAR_START=""
10607 +
10608 +# You can also multiplex the init script for each device like so
10609 +# ln -s moused /etc/init.d/moused.ums0
10610 +# This enables you to have a config file per mouse (forces MOUSED_DEVICE
10611 +# to ums0 in this case) and control each mouse.
10612 +# devd can also start and stop these mice, which laptop users will find handy.
10613
10614 diff --git a/sys-freebsd/freebsd-usbin/files/moused.initd b/sys-freebsd/freebsd-usbin/files/moused.initd
10615 new file mode 100644
10616 index 0000000..d7ca8e0
10617 --- /dev/null
10618 +++ b/sys-freebsd/freebsd-usbin/files/moused.initd
10619 @@ -0,0 +1,66 @@
10620 +#!/sbin/openrc-run
10621 +# Copyright 1999-2005 Gentoo Foundation
10622 +# Distributed under the terms of the GNU General Public License v2
10623 +# $Id$
10624 +
10625 +MOUSED_NAME=${SVCNAME##*.}
10626 +if [ -n "${MOUSED_NAME}" ] && [ ${MOUSED_NAME} != "moused" ] ; then
10627 + MOUSED_DEVICE=/dev/"${MOUSED_NAME}"
10628 + MOUSED_PIDFILE=/var/run/moused-"${MOUSED_NAME}".pid
10629 +else
10630 + MOUSED_NAME=
10631 + MOUSED_PIDFILE=/var/run/moused.pid
10632 +fi
10633 +
10634 +depend() {
10635 + need localmount
10636 +}
10637 +
10638 +start() {
10639 + ebegin "Starting the Console Mouse Daemon" "${MOUSED_NAME}"
10640 +
10641 + if [ -z ${MOUSED_DEVICE} ] ; then
10642 + for x in /dev/psm[0-9]* /dev/ums[0-9]* ; do
10643 + if [ -e "${x}" ] && \
10644 + [ ! -e /var/run/moused-$(basename "${x}").pid ] ; then
10645 + MOUSED_DEVICE=${x}
10646 + eindent
10647 + einfo "Using mouse on ${MOUSED_DEVICE}"
10648 + eoutdent
10649 + break
10650 + fi
10651 + done
10652 + fi
10653 +
10654 + if [ -z "${MOUSED_DEVICE}" ] ; then
10655 + eend 1 "No device specified in" "/etc/conf.d/${SVCNAME}" \
10656 + "and no mouse detected"
10657 + return 1
10658 + fi
10659 +
10660 + local opts="${MOUSED_FLAGS} -p ${MOUSED_DEVICE}"
10661 + start-stop-daemon --start --quiet --exec /usr/sbin/moused \
10662 + --pidfile "${MOUSED_PIDFILE}" \
10663 + -- ${opts} -I "${MOUSED_PIDFILE}"
10664 + local retval=$?
10665 +
10666 + [ -n "${MOUSE_CHAR_START}" ] && MOUSE_CHAR_START="-M ${MOUSE_CHAR_START}"
10667 + local ttyv=
10668 + for ttyv in /dev/ttyv* ; do
10669 + vidcontrol < "${ttyv}" ${MOUSE_CHAR_START} -m on || retval=1
10670 + done
10671 +
10672 + eend ${retval} "Failed to start moused"
10673 +}
10674 +
10675 +stop() {
10676 + ebegin "Stopping the Console Mouse Daemon" "${MOUSED_NAME}"
10677 + # Don't specify the binary as >1 instance of moused may be running
10678 + # which is perfectly valid as we can be multiplexed.
10679 + start-stop-daemon --stop --exec /usr/sbin/moused \
10680 + --pidfile "${MOUSED_PIDFILE}"
10681 + eend $? "Failed to stop moused"
10682 +}
10683 +
10684 +# vim: set ts=4 :
10685 +
10686
10687 diff --git a/sys-freebsd/freebsd-usbin/files/nfs.confd b/sys-freebsd/freebsd-usbin/files/nfs.confd
10688 new file mode 100644
10689 index 0000000..844252f
10690 --- /dev/null
10691 +++ b/sys-freebsd/freebsd-usbin/files/nfs.confd
10692 @@ -0,0 +1,10 @@
10693 +# Config file for /etc/init.d/nfs
10694 +# Options for nfsd (see man nfsd)
10695 +# Example: 8 nfsd servers started:
10696 +#nfsdopts="-n 8"
10697 +
10698 +# Options for mountd (see man mountd)
10699 +# Example: allow non-root users to mount shares:
10700 +#mountdopts="-n"
10701 +# Specify t he exports file, this is the default:
10702 +#exportsfile="/etc/exports"
10703
10704 diff --git a/sys-freebsd/freebsd-usbin/files/nfs.initd b/sys-freebsd/freebsd-usbin/files/nfs.initd
10705 new file mode 100644
10706 index 0000000..17974ca
10707 --- /dev/null
10708 +++ b/sys-freebsd/freebsd-usbin/files/nfs.initd
10709 @@ -0,0 +1,54 @@
10710 +#!/sbin/openrc-run
10711 +# Copyright 1999-2013 Gentoo Foundation
10712 +# Distributed under the terms of the GNU General Public License v2
10713 +
10714 +#---------------------------------------------------------------------------
10715 +# This script starts/stops nfsd and mountd
10716 +# Daemons rpc.rquotad, rpc.rstatd, rpc.rusersd, rpc.rwalld and rpc.sprayd
10717 +# should be started from inetd on FreeBSD.
10718 +#---------------------------------------------------------------------------
10719 +
10720 +extra_started_commands="reload"
10721 +
10722 +# The binary locations
10723 +nfsd=/usr/sbin/nfsd
10724 +mountd=/usr/sbin/mountd
10725 +
10726 +depend() {
10727 + use ypbind net rpc.lockd
10728 + need rpcbind
10729 + after quota
10730 +}
10731 +
10732 +start() {
10733 + ebegin "Starting NFS daemon"
10734 + start-stop-daemon --start --quiet --exec \
10735 + $nfsd -- ${nfsdopts}
10736 + eend $? "Error starting NFS daemon"
10737 +
10738 + # Start mountd
10739 + ebegin "Starting NFS mountd"
10740 + start-stop-daemon --start --quiet --exec \
10741 + $mountd -- ${mountdopts} ${exportsfile}
10742 + eend $? "Error starting NFS mountd"
10743 +}
10744 +
10745 +stop() {
10746 + ebegin "Stopping NFS mountd"
10747 + start-stop-daemon --stop --quiet --exec $mountd \
10748 + --pidfile /var/run/mountd.pid
10749 + eend $? "Error stopping NFS mountd"
10750 +
10751 + ebegin "Stopping NFS daemon"
10752 + start-stop-daemon --stop --signal USR1 --quiet \
10753 + --name nfsd --user root
10754 + eend $? "Error stopping NFS daemon"
10755 +}
10756 +
10757 +reload() {
10758 + # Hangup signal to mountd reloads /etc/exports.
10759 + ebegin "Reloading /etc/exports"
10760 + start-stop-daemon --signal 1 --quiet --exec $mountd \
10761 + --pidfile /var/run/mountd.pid
10762 + eend $?
10763 +}
10764
10765 diff --git a/sys-freebsd/freebsd-usbin/files/nfsmount.initd b/sys-freebsd/freebsd-usbin/files/nfsmount.initd
10766 new file mode 100644
10767 index 0000000..2fb4901
10768 --- /dev/null
10769 +++ b/sys-freebsd/freebsd-usbin/files/nfsmount.initd
10770 @@ -0,0 +1,63 @@
10771 +#!/sbin/openrc-run
10772 +# Copyright 1999-2004 Gentoo Foundation
10773 +# Distributed under the terms of the GNU General Public License v2
10774 +# $Id$
10775 +
10776 +depend() {
10777 + need net rpcbind
10778 + use ypbind
10779 +}
10780 +
10781 +start_statd() {
10782 + # Don't start rpc.statd if already started by init.d/nfs
10783 + killall -0 rpc.statd 2>/dev/null && return 0
10784 + ebegin "Starting NFS statd"
10785 + rpc.statd
10786 + eend $? "Error starting NFS statd"
10787 +}
10788 +
10789 +stop_statd() {
10790 + # Don't stop rpc.statd if it's in use by init.d/nfs
10791 + killall -0 nfsd 2>/dev/null && return 0
10792 + # Make sure it's actually running
10793 + killall -0 rpc.statd 2>/dev/null || return 0
10794 + # Okay, all tests passed, stop rpc.statd
10795 + ebegin "Stopping NFS statd"
10796 + killall rpc.statd
10797 + eend $? "Error stopping NFS statd"
10798 +}
10799 +
10800 +start_lockd() {
10801 + # Don't start rpc.lockd if already started by init.d/nfs
10802 + killall -0 rpc.lockd 2>/dev/null && return 0
10803 + ebegin "Starting NFS lockd"
10804 + rpc.lockd
10805 + eend $? "Error starting NFS lockd"
10806 +}
10807 +
10808 +stop_lockd() {
10809 + # Don't stop rpc.lockd if it's in use by init.d/nfs
10810 + killall -0 nfsd 2>/dev/null && return 0
10811 + # Make sure it's actually running
10812 + killall -0 rpc.lockd 2>/dev/null || return 0
10813 + # Okay, all tests passed, stop rpc.lockd
10814 + ebegin "Stopping NFS lockd"
10815 + killall rpc.lockd
10816 + eend $? "Error stopping NFS lockd"
10817 +}
10818 +
10819 +start() {
10820 + start_statd
10821 + start_lockd
10822 + ebegin "Mounting NFS filesystems"
10823 + mount -a -t nfs
10824 + eend $? "Error mounting NFS filesystems"
10825 +}
10826 +
10827 +stop() {
10828 + ebegin "Unmounting NFS filesystems"
10829 + umount -a -t nfs
10830 + eend $? "Error unmounting NFS filesystems"
10831 + stop_statd
10832 + stop_lockd
10833 +}
10834
10835 diff --git a/sys-freebsd/freebsd-usbin/files/nfsuserd.confd b/sys-freebsd/freebsd-usbin/files/nfsuserd.confd
10836 new file mode 100644
10837 index 0000000..f8f3ea1
10838 --- /dev/null
10839 +++ b/sys-freebsd/freebsd-usbin/files/nfsuserd.confd
10840 @@ -0,0 +1,5 @@
10841 +# Config file for /etc/init.d/nfsuserd
10842 +# Options for nfsuserd (see man nfsuserd)
10843 +# Example: set domain example.com:
10844 +#nfsuserdopts="-domain example.com"
10845 +
10846
10847 diff --git a/sys-freebsd/freebsd-usbin/files/nfsuserd.initd b/sys-freebsd/freebsd-usbin/files/nfsuserd.initd
10848 new file mode 100644
10849 index 0000000..d690074
10850 --- /dev/null
10851 +++ b/sys-freebsd/freebsd-usbin/files/nfsuserd.initd
10852 @@ -0,0 +1,20 @@
10853 +#!/sbin/openrc-run
10854 +# Copyright 1999-2015 Gentoo Foundation
10855 +# Distributed under the terms of the GNU General Public License v2
10856 +
10857 +depend() {
10858 + need net nfs
10859 +}
10860 +
10861 +start() {
10862 + ebegin "Starting nfsuserd"
10863 + start-stop-daemon --start --quiet --exec \
10864 + /usr/sbin/nfsuserd -- $nfsuserdopts
10865 + eend $? "Error starting nfsuserd"
10866 +}
10867 +
10868 +stop() {
10869 + ebegin "Stopping nfsuserd"
10870 + start-stop-daemon --stop --quiet --exec /usr/sbin/nfsuserd
10871 + eend $? "Error stopping nfsuserd"
10872 +}
10873
10874 diff --git a/sys-freebsd/freebsd-usbin/files/powerd.confd b/sys-freebsd/freebsd-usbin/files/powerd.confd
10875 new file mode 100644
10876 index 0000000..e5db5a1
10877 --- /dev/null
10878 +++ b/sys-freebsd/freebsd-usbin/files/powerd.confd
10879 @@ -0,0 +1,14 @@
10880 +# Copyright 2006 Gentoo Foundation
10881 +# Distributed under the terms of the GNU General Public License v2
10882 +# $Id$
10883 +
10884 +# Mode allowed: maximum, minimum, adaptive
10885 +# Default unless specified is adaptive
10886 +
10887 +AC_MODE="maximum"
10888 +
10889 +#BATTERY_MODE="minimum"
10890 +
10891 +POWERD_OPTS=""
10892 +
10893 +
10894
10895 diff --git a/sys-freebsd/freebsd-usbin/files/powerd.initd b/sys-freebsd/freebsd-usbin/files/powerd.initd
10896 new file mode 100644
10897 index 0000000..ff79f63
10898 --- /dev/null
10899 +++ b/sys-freebsd/freebsd-usbin/files/powerd.initd
10900 @@ -0,0 +1,27 @@
10901 +#!/sbin/openrc-run
10902 +# Copyright 2006 Gentoo Foundation
10903 +# Distributed under the terms of the GNU General Public License v2
10904 +# $Id$
10905 +
10906 +depend() {
10907 + need localmount
10908 +}
10909 +
10910 +start() {
10911 + local args=
10912 + [ -n "${BATTERY_MODE}" ] && args="${args} -b ${BATTERY_MODE}"
10913 + [ -n "${AC_MODE}" ] && args="${args} -a ${AC_MODE}"
10914 +
10915 + ebegin "Starting Power Control Daemon"
10916 + start-stop-daemon --start --exec /usr/sbin/powerd \
10917 + --pidfile /var/run/powerd.pid \
10918 + -- ${args} ${POWERD_OPTS}
10919 + eend $? "Failed to start powerd"
10920 +}
10921 +
10922 +stop() {
10923 + ebegin "Stopping Power Control Daemon"
10924 + start-stop-daemon --stop --exec /usr/sbin/powerd \
10925 + --pidfile /var/run/powerd.pid
10926 + eend $? "Failed to stop powerd"
10927 +}
10928
10929 diff --git a/sys-freebsd/freebsd-usbin/files/pw.conf b/sys-freebsd/freebsd-usbin/files/pw.conf
10930 new file mode 100644
10931 index 0000000..29a246f
10932 --- /dev/null
10933 +++ b/sys-freebsd/freebsd-usbin/files/pw.conf
10934 @@ -0,0 +1,5 @@
10935 +# Change this to Gentoo's Default, instead of FreeBSD's default of
10936 +# /usr/share/skel, so that bash and other packages installs the files on the
10937 +# right place.
10938 +skeleton /etc/skel
10939 +
10940
10941 diff --git a/sys-freebsd/freebsd-usbin/files/rarpd.confd b/sys-freebsd/freebsd-usbin/files/rarpd.confd
10942 new file mode 100644
10943 index 0000000..b56fdd5
10944 --- /dev/null
10945 +++ b/sys-freebsd/freebsd-usbin/files/rarpd.confd
10946 @@ -0,0 +1,7 @@
10947 +# $Id$
10948 +
10949 +# Configuration file for /etc/init.d/rarpd
10950 +
10951 +# To start rarpd only for a given interface, set the
10952 +# following variable
10953 +# RARPD_ONLY_INTERFACE="rl0"
10954
10955 diff --git a/sys-freebsd/freebsd-usbin/files/rarpd.initd b/sys-freebsd/freebsd-usbin/files/rarpd.initd
10956 new file mode 100644
10957 index 0000000..3c2a3ff
10958 --- /dev/null
10959 +++ b/sys-freebsd/freebsd-usbin/files/rarpd.initd
10960 @@ -0,0 +1,35 @@
10961 +#!/sbin/openrc-run
10962 +# Copyright 2006 Gentoo Foundation
10963 +# Distributed under the terms of the GNU General Public License v2
10964 +# $Id$
10965 +
10966 +depend() {
10967 + if [ -z "${RARPD_ONLY_INTERFACE}" ]; then
10968 + need net
10969 + else
10970 + need net."${RARPD_ONLY_INTERFACE}"
10971 + fi
10972 +}
10973 +
10974 +start() {
10975 + local rarpd_opts
10976 +
10977 + if [ -z "${RARPD_ONLY_INTERFACE}" ]; then
10978 + rarpd_opts="${rarpd_opts} -a"
10979 + else
10980 + rarpd_opts="${rarpd_opts} ${RARPD_ONLY_INTERFACE}"
10981 + fi
10982 +
10983 + ebegin "Starting reverse ARP daemon"
10984 + start-stop-daemon --start --background \
10985 + --pidfile /var/run/rarpd.pid --make-pidfile \
10986 + --exec /usr/sbin/rarpd -- -f ${rarpd_opts}
10987 + eend $?
10988 +}
10989 +
10990 +stop() {
10991 + ebegin "Stopping reverse ARP daemon"
10992 + start-stop-daemon --stop --pidfile /var/run/rarpd.pid \
10993 + --exec /usr/sbin/rarpd -- ${rarpd_opts}
10994 + eend $?
10995 +}
10996
10997 diff --git a/sys-freebsd/freebsd-usbin/files/rpc.lockd.initd b/sys-freebsd/freebsd-usbin/files/rpc.lockd.initd
10998 new file mode 100644
10999 index 0000000..dd2fdbe
11000 --- /dev/null
11001 +++ b/sys-freebsd/freebsd-usbin/files/rpc.lockd.initd
11002 @@ -0,0 +1,20 @@
11003 +#!/sbin/openrc-run
11004 +# Copyright 1999-2008 Gentoo Foundation
11005 +# Distributed under the terms of the GNU General Public License v2
11006 +
11007 +depend() {
11008 + need net rpcbind rpc.statd
11009 +}
11010 +
11011 +start() {
11012 + ebegin "Starting NFS lockd"
11013 + start-stop-daemon --start --quiet --exec \
11014 + /usr/sbin/rpc.lockd -- $rpclockdopts
11015 + eend $? "Error starting NFS lockd"
11016 +}
11017 +
11018 +stop() {
11019 + ebegin "Stopping NFS lockd"
11020 + start-stop-daemon --stop --quiet --exec /usr/sbin/rpc.lockd
11021 + eend $? "Error stopping NFS lockd"
11022 +}
11023
11024 diff --git a/sys-freebsd/freebsd-usbin/files/rpc.statd.initd b/sys-freebsd/freebsd-usbin/files/rpc.statd.initd
11025 new file mode 100644
11026 index 0000000..163af5a
11027 --- /dev/null
11028 +++ b/sys-freebsd/freebsd-usbin/files/rpc.statd.initd
11029 @@ -0,0 +1,20 @@
11030 +#!/sbin/openrc-run
11031 +# Copyright 1999-2008 Gentoo Foundation
11032 +# Distributed under the terms of the GNU General Public License v2
11033 +
11034 +depend() {
11035 + need net rpcbind
11036 +}
11037 +
11038 +start() {
11039 + ebegin "Starting NFS statd"
11040 + start-stop-daemon --start --quiet --exec \
11041 + /usr/sbin/rpc.statd -- $rpcstatdopts
11042 + eend $? "Error starting NFS statd"
11043 +}
11044 +
11045 +stop() {
11046 + ebegin "Stopping NFS statd"
11047 + start-stop-daemon --stop --quiet --exec /usr/sbin/rpc.statd
11048 + eend $? "Error stopping NFS statd"
11049 +}
11050
11051 diff --git a/sys-freebsd/freebsd-usbin/files/rpcbind.initd b/sys-freebsd/freebsd-usbin/files/rpcbind.initd
11052 new file mode 100644
11053 index 0000000..1ff98a5
11054 --- /dev/null
11055 +++ b/sys-freebsd/freebsd-usbin/files/rpcbind.initd
11056 @@ -0,0 +1,30 @@
11057 +#!/sbin/openrc-run
11058 +# Copyright 1999-2005 Gentoo Foundation
11059 +# Distributed under the terms of the GNU General Public License v2
11060 +# $Id$
11061 +
11062 +depend() {
11063 + need localmount
11064 + use net
11065 + before inetd
11066 + before xinetd
11067 +}
11068 +
11069 +start() {
11070 + ebegin "Starting rpcbind"
11071 + start-stop-daemon --start --exec /usr/sbin/rpcbind
11072 + local ret=$?
11073 + eend ${ret}
11074 +
11075 + # without, if a service depending on portmap is started too fast,
11076 + # connecting to portmap will fail -- azarah
11077 + # doing that for rpcbind, too -- flameeyes
11078 + sleep 1
11079 + return ${ret}
11080 +}
11081 +
11082 +stop() {
11083 + ebegin "Stopping rpcbind"
11084 + start-stop-daemon --stop --exec /usr/sbin/rpcbind
11085 + eend $?
11086 +}
11087
11088 diff --git a/sys-freebsd/freebsd-usbin/files/syscons.confd b/sys-freebsd/freebsd-usbin/files/syscons.confd
11089 new file mode 100644
11090 index 0000000..7ba81ff
11091 --- /dev/null
11092 +++ b/sys-freebsd/freebsd-usbin/files/syscons.confd
11093 @@ -0,0 +1,14 @@
11094 +# $Id$
11095 +# Example syscons config file. This is the place to set things like keymap, etc.
11096 +
11097 +# Set the keymap to "uk.iso".
11098 +#KEYMAP="uk.iso"
11099 +
11100 +# Set the keyboard rate to 250ms delay, and 34 repeat rate.
11101 +#KEYRATE="250.34"
11102 +
11103 +# Change the behaviour of F-unction keys (see kbdcontrol(1)).
11104 +#KEYCHANGE="10 'ssh myhost'"
11105 +
11106 +# See vidcontrol(1) -t
11107 +#BLANKTIME="off"
11108
11109 diff --git a/sys-freebsd/freebsd-usbin/files/syscons.initd b/sys-freebsd/freebsd-usbin/files/syscons.initd
11110 new file mode 100644
11111 index 0000000..5ab3075
11112 --- /dev/null
11113 +++ b/sys-freebsd/freebsd-usbin/files/syscons.initd
11114 @@ -0,0 +1,78 @@
11115 +#!/sbin/openrc-run
11116 +# Copyright 1999-2006 Gentoo Foundation
11117 +# Distributed under the terms of the GNU General Public License v2
11118 +# $Id$
11119 +
11120 +depend() {
11121 + need localmount
11122 +}
11123 +
11124 +start() {
11125 + ebegin "Configuring system console"
11126 +
11127 + if [ -n "${MODE}" ] ; then
11128 + einfo "Setting mode to ${MODE}"
11129 + vidcontrol "${MODE}"
11130 + eend $?
11131 + fi
11132 +
11133 + # XXX: This should handle serial consoles.
11134 +
11135 + # Set the keymap.
11136 + if [ -n "${KEYMAP}" ]; then
11137 + einfo "Setting keymap to" "${KEYMAP}"
11138 + kbdcontrol -l ${KEYMAP} < /dev/console
11139 + fi
11140 +
11141 + if [ -n "${KEYRATE}" ]; then
11142 + einfo "Setting keyrate to" "${KEYRATE}"
11143 + kbdcontrol -r ${KEYRATE} < /dev/console
11144 + fi
11145 +
11146 + if [ -n "${KEYCHANGE}" ]; then
11147 + einfo "Changing function keys..."
11148 + eval set -- "${KEYCHANGE}"
11149 + eindent
11150 + while [ $# -gt 0 ] ; do
11151 + veinfo "F$1 -> \`$2'"
11152 + kbdcontrol -f "$1" "$2" < /dev/console
11153 + shift ; shift
11154 + done
11155 + eoutdent
11156 + fi
11157 +
11158 + if [ -n "${CURSOR}" ]; then
11159 + einfo "Setting cursor"
11160 + vidcontrol -c ${CURSOR}
11161 + fi
11162 +
11163 + einfo "Setting custom fonts..."
11164 + # Nothing to see here, move along...
11165 + for v in FONT8x16 FONT8x14 FONT8x8; do
11166 + f=$(eval \$"${v}")
11167 + if [ -n "${f}" ]; then
11168 + vidcontrol -f ${v##FONT} ${f}
11169 + fi
11170 + done
11171 +
11172 + if [ -n "${BLANKTIME}" ]; then
11173 + einfo "Setting blanktime"
11174 + vidcontrol -t ${BLANKTIME}
11175 + fi
11176 +
11177 + if [ -n "${SAVER}" ]; then
11178 + for i in `kldstat | awk '$5 ~ "^splash_.*$" { print $5 }'`; do
11179 + kldunload ${i}
11180 + done
11181 + kldstat -v | grep -q _saver || kldload ${SAVER}_saver
11182 + fi
11183 +
11184 + if [ -n "${KBDFLAGS}" ]; then
11185 + einfo "Setting keyboard flags for all screens"
11186 + for ttyv in /dev/ttyv*; do
11187 + kbdcontrol ${KBDFLAGS} <${ttyv} >${ttyv} 2>&1
11188 + done
11189 + fi
11190 +
11191 + eend 0
11192 +}
11193
11194 diff --git a/sys-freebsd/freebsd-usbin/files/syslogd.initd b/sys-freebsd/freebsd-usbin/files/syslogd.initd
11195 new file mode 100644
11196 index 0000000..87c40cd
11197 --- /dev/null
11198 +++ b/sys-freebsd/freebsd-usbin/files/syslogd.initd
11199 @@ -0,0 +1,25 @@
11200 +#!/sbin/openrc-run
11201 +# Copyright 1999-2005 Gentoo Foundation
11202 +# Distributed under the terms of the GNU General Public License v2
11203 +# $Id$
11204 +
11205 +depend() {
11206 + provide logger
11207 + need localmount
11208 +}
11209 +
11210 +start() {
11211 + ebegin "Starting System Logger"
11212 + start-stop-daemon --start --quiet --exec /usr/sbin/syslogd \
11213 + -- ${SYSLOGD_OPTS}
11214 + eend $?
11215 +}
11216 +
11217 +stop() {
11218 + ebegin "Stopping System Logger"
11219 + start-stop-daemon --stop --quiet --pidfile /var/run/syslog.pid
11220 + eend $?
11221 +}
11222 +
11223 +
11224 +
11225
11226 diff --git a/sys-freebsd/freebsd-usbin/freebsd-usbin-11.0.ebuild b/sys-freebsd/freebsd-usbin/freebsd-usbin-11.0.ebuild
11227 new file mode 100644
11228 index 0000000..28374e5
11229 --- /dev/null
11230 +++ b/sys-freebsd/freebsd-usbin/freebsd-usbin-11.0.ebuild
11231 @@ -0,0 +1,187 @@
11232 +# Copyright 1999-2016 Gentoo Foundation
11233 +# Distributed under the terms of the GNU General Public License v2
11234 +# $Id$
11235 +
11236 +EAPI=5
11237 +
11238 +inherit bsdmk freebsd flag-o-matic eutils
11239 +
11240 +DESCRIPTION="FreeBSD /usr/sbin tools"
11241 +SLOT="0"
11242 +LICENSE="BSD zfs? ( CDDL )"
11243 +
11244 +if [[ ${PV} != *9999* ]]; then
11245 + KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
11246 + SRC_URI="${SRC_URI}
11247 + $(freebsd_upstream_patches)"
11248 +fi
11249 +
11250 +EXTRACTONLY="
11251 + usr.sbin/
11252 + contrib/
11253 + usr.bin/
11254 + lib/
11255 + sbin/
11256 + etc/
11257 + gnu/
11258 +"
11259 +
11260 +RDEPEND="=sys-freebsd/freebsd-lib-${RV}*[usb?,bluetooth?,netware?]
11261 + =sys-freebsd/freebsd-libexec-${RV}*
11262 + build? ( sys-apps/baselayout )
11263 + ssl? ( dev-libs/openssl:0 )
11264 + >=app-arch/libarchive-3
11265 + sys-apps/tcp-wrappers
11266 + dev-util/dialog
11267 + >=dev-libs/libedit-20120311.3.0-r1
11268 + net-libs/libpcap
11269 + kerberos? ( app-crypt/heimdal )"
11270 +DEPEND="${RDEPEND}
11271 + =sys-freebsd/freebsd-mk-defs-${RV}*
11272 + =sys-freebsd/freebsd-ubin-${RV}*
11273 + zfs? ( =sys-freebsd/freebsd-cddl-${RV}* )
11274 + !build? ( =sys-freebsd/freebsd-sources-${RV}* )
11275 + sys-apps/texinfo
11276 + sys-devel/flex"
11277 +
11278 +S="${WORKDIR}/usr.sbin"
11279 +
11280 +IUSE="acpi atm audit bluetooth floppy ipv6 kerberos minimal netware nis pam ssl usb build zfs"
11281 +
11282 +pkg_setup() {
11283 + # Add the required source files.
11284 + use nis && EXTRACTONLY+="libexec/ "
11285 + use build && EXTRACTONLY+="sys/ include/ "
11286 + use zfs && EXTRACTONLY+="cddl/ "
11287 +
11288 + # Release crunch is something like minimal. It seems to remove everything
11289 + # which is not needed to work.
11290 + use minimal && mymakeopts="${mymakeopts} RELEASE_CRUNCH= "
11291 +
11292 + use acpi || mymakeopts="${mymakeopts} WITHOUT_ACPI= "
11293 + use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
11294 + use audit || mymakeopts="${mymakeopts} WITHOUT_AUDIT= "
11295 + use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= "
11296 + use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6= WITHOUT_INET6_SUPPORT= "
11297 + use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
11298 + use nis || mymakeopts="${mymakeopts} WITHOUT_NIS= "
11299 + use pam || mymakeopts="${mymakeopts} WITHOUT_PAM_SUPPORT= "
11300 + use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
11301 + use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
11302 + use floppy || mymakeopts="${mymakeopts} WITHOUT_FLOPPY= "
11303 + use kerberos || mymakeopts="${mymakeopts} WITHOUT_GSSAPI= "
11304 + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
11305 +
11306 + mymakeopts="${mymakeopts} WITHOUT_PF= WITHOUT_LPR= WITHOUT_SENDMAIL= WITHOUT_AUTHPF= WITHOUT_MAILWRAPPER= WITHOUT_UNBOUND= "
11307 +
11308 + append-flags $(test-flags -fno-strict-aliasing)
11309 +}
11310 +
11311 +PATCHES=(
11312 + "${FILESDIR}/${PN}-adduser.patch"
11313 + "${FILESDIR}/${PN}-9.0-newsyslog.patch"
11314 + "${FILESDIR}/${PN}-10.0-bsdxml2expat.patch"
11315 + "${FILESDIR}/${PN}-10.3-bsdxml2expat.patch"
11316 + )
11317 +
11318 +REMOVE_SUBDIRS="
11319 + tcpdchk tcpdmatch
11320 + sendmail praliases editmap mailstats makemap
11321 + pc-sysinstall cron mailwrapper ntp bsnmpd
11322 + tcpdump ndp inetd
11323 + wpa/wpa_supplicant wpa/hostapd wpa/hostapd_cli wpa/wpa_cli wpa/wpa_passphrase
11324 + zic amd
11325 + pkg pkg_install freebsd-update service sysrc bsdinstall"
11326 +
11327 +src_prepare() {
11328 + if ! use build; then
11329 + [[ ! -e "${WORKDIR}/sys" ]] && ln -s "/usr/src/sys" "${WORKDIR}/sys"
11330 + [[ ! -e "${WORKDIR}/include" ]] && ln -s "/usr/include" "${WORKDIR}/include"
11331 + else
11332 + dummy_mk mount_smbfs
11333 + fi
11334 + # Don't install mtree format manpage
11335 + # it's installed by libarchive.
11336 + sed -e "s: mtree.5::g" -i "${S}"/mtree/Makefile
11337 +}
11338 +
11339 +src_compile() {
11340 + # Preparing to build nmtree
11341 + cd "${WORKDIR}/lib/libnetbsd" || die
11342 + freebsd_src_compile
11343 +
11344 + cd "${S}" || die
11345 + freebsd_src_compile
11346 +}
11347 +
11348 +src_install() {
11349 + # By creating these directories we avoid having to do a
11350 + # more complex hack
11351 + dodir /usr/share/doc
11352 + dodir /sbin
11353 + dodir /usr/libexec
11354 + dodir /usr/bin
11355 +
11356 + # FILESDIR is used by some makefiles which will install files
11357 + # in the wrong place, just put it in the doc directory.
11358 + mkinstall DOCDIR=/usr/share/doc/${PF} || die "Install failed"
11359 +
11360 + # Most of these now come from openrc.
11361 + for util in iscsid nfs nfsuserd rpc.statd rpc.lockd; do
11362 + newinitd "${FILESDIR}/"${util}.initd ${util} || die
11363 + if [[ -e "${FILESDIR}"/${util}.confd ]]; then \
11364 + newconfd "${FILESDIR}"/${util}.confd ${util} || die
11365 + fi
11366 + done
11367 +
11368 + for class in daily monthly weekly; do
11369 + cat - > "${T}/periodic.${class}" <<EOS
11370 +#!/bin/sh
11371 +/usr/sbin/periodic ${class}
11372 +EOS
11373 + exeinto /etc/cron.${class}
11374 + newexe "${T}/periodic.${class}" periodic
11375 + done
11376 +
11377 + # Install the pw.conf file to let pw use Gentoo's skel location
11378 + insinto /etc
11379 + doins "${FILESDIR}/pw.conf" || die
11380 +
11381 + cd "${WORKDIR}/etc" || die
11382 + doins apmd.conf syslog.conf newsyslog.conf nscd.conf || die
11383 +
11384 + insinto /etc/ppp
11385 + doins ppp/ppp.conf || die
11386 +
11387 + if use bluetooth; then
11388 + insinto /etc/bluetooth
11389 + doins bluetooth/* || die
11390 + rm -f "${D}"/etc/bluetooth/Makefile
11391 + fi
11392 +
11393 + # Install the periodic stuff (needs probably to be ported in a more
11394 + # gentooish way)
11395 + cd "${WORKDIR}/etc/periodic" || die
11396 +
11397 + doperiodic daily daily/*.accounting
11398 + doperiodic monthly monthly/*.accounting
11399 +}
11400 +
11401 +pkg_postinst() {
11402 + # We need to run pwd_mkdb if key files are not present
11403 + # If they are, then there is no need to run pwd_mkdb
11404 + if [[ ! -e "${ROOT}etc/passwd" || ! -e "${ROOT}etc/pwd.db" || ! -e "${ROOT}etc/spwd.db" ]] ; then
11405 + if [[ -e "${ROOT}etc/master.passwd" ]] ; then
11406 + einfo "Generating passwd files from ${ROOT}etc/master.passwd"
11407 + "${ROOT}"usr/sbin/pwd_mkdb -p -d "${ROOT}etc" "${ROOT}etc/master.passwd"
11408 + else
11409 + eerror "${ROOT}etc/master.passwd does not exist!"
11410 + eerror "You will no be able to log into your system!"
11411 + fi
11412 + fi
11413 +
11414 + for logfile in messages security auth.log maillog lpd-errs xferlog cron \
11415 + debug.log slip.log ppp.log; do
11416 + [[ -f "${ROOT}/var/log/${logfile}" ]] || touch "${ROOT}/var/log/${logfile}"
11417 + done
11418 +}
11419
11420 diff --git a/sys-freebsd/freebsd-usbin/metadata.xml b/sys-freebsd/freebsd-usbin/metadata.xml
11421 new file mode 100644
11422 index 0000000..45c930b
11423 --- /dev/null
11424 +++ b/sys-freebsd/freebsd-usbin/metadata.xml
11425 @@ -0,0 +1,19 @@
11426 +<?xml version="1.0" encoding="UTF-8"?>
11427 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
11428 +<pkgmetadata>
11429 + <maintainer type="project">
11430 + <email>bsd@g.o</email>
11431 + <name>BSD Project</name>
11432 + </maintainer>
11433 + <use>
11434 + <flag name="floppy">Enable floppy disk utilities (fdcontrol, fdformat, fdread, fdwrite).</flag>
11435 + <flag name="audit">
11436 + Build auditing tools.
11437 + </flag>
11438 + <flag name="netware">
11439 + Build libraries and tools to work with NetWare protocols (IPX
11440 + and NCP).
11441 + </flag>
11442 + <flag name='zfs'>Enable ZFS support.</flag>
11443 + </use>
11444 +</pkgmetadata>