From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4A5C7138010 for ; Tue, 18 Sep 2012 15:46:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 206AD21C005; Tue, 18 Sep 2012 15:46:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B318D21C005 for ; Tue, 18 Sep 2012 15:46:20 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C4FCB33C206 for ; Tue, 18 Sep 2012 15:46:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 8ACFFE5444 for ; Tue, 18 Sep 2012 15:46:18 +0000 (UTC) From: "Yuta SATOH" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Yuta SATOH" Message-ID: <1347982882.48ba130fbfba9adfe642f56c2db6b5c79ca9a4cd.yuta_satoh@gentoo> Subject: [gentoo-commits] proj/gentoo-bsd:master commit in: sys-freebsd/freebsd-lib/, sys-freebsd/freebsd-lib/files/ X-VCS-Repository: proj/gentoo-bsd X-VCS-Files: sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch sys-freebsd/freebsd-lib/files/freebsd-lib-7.0-CVE-2008-1391.patch sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch sys-freebsd/freebsd-lib/files/freebsd-lib-7.2-rtldnoload.patch sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-trylock-adaptive.pat ch sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch sys-freebsd/freebsd-lib/files/libmap.conf sys-freebsd/freebsd-lib/files/libusb.pc.in sys-freebsd/freebsd-lib/freebsd-lib-9.1_rc1.ebuild X-VCS-Directories: sys-freebsd/freebsd-lib/ sys-freebsd/freebsd-lib/files/ X-VCS-Committer: yuta_satoh X-VCS-Committer-Name: Yuta SATOH X-VCS-Revision: 48ba130fbfba9adfe642f56c2db6b5c79ca9a4cd X-VCS-Branch: master Date: Tue, 18 Sep 2012 15:46:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 76b0d29b-f73c-4dab-8c05-dff09a9e77ad X-Archives-Hash: 79b1c8c16e22e86d901612254c6bf263 commit: 48ba130fbfba9adfe642f56c2db6b5c79ca9a4cd Author: Yuta SATOH gentoo gr jp> AuthorDate: Tue Sep 18 15:41:22 2012 +0000 Commit: Yuta SATOH 0x100 com> CommitDate: Tue Sep 18 15:41:22 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=commit;h=48ba130f freebsd-lib-9.1_rc1 -- readded from latest portage tree --- .../files/freebsd-lib-6.0-flex-2.5.31.patch | 13 + .../files/freebsd-lib-6.0-gccfloat.patch | 16 + .../freebsd-lib/files/freebsd-lib-6.0-pmc.patch | 13 + .../freebsd-lib/files/freebsd-lib-6.1-csu.patch | 20 + .../files/freebsd-lib-6.2-bluetooth.patch | 11 + .../files/freebsd-lib-7.0-CVE-2008-1391.patch | 11 + .../files/freebsd-lib-7.1-types.h-fix.patch | 15 + .../files/freebsd-lib-7.2-rtldnoload.patch | 30 ++ .../freebsd-lib/files/freebsd-lib-8.0-gcc45.patch | 28 + .../freebsd-lib/files/freebsd-lib-8.0-log2.patch | 21 + .../files/freebsd-lib-8.0-rpcsec_gss.patch | 12 + .../files/freebsd-lib-8.2-liblink.patch | 19 + .../files/freebsd-lib-8.2-nlm_syscall.patch | 10 + .../files/freebsd-lib-9.0-liblink.patch | 21 + .../files/freebsd-lib-9.0-opieincludes.patch | 122 +++++ .../files/freebsd-lib-9.0-trylock-adaptive.patch | 14 + .../freebsd-lib/files/freebsd-lib-bsdxml.patch | 13 + .../files/freebsd-lib-bsdxml2expat.patch | 26 + .../freebsd-lib/files/freebsd-lib-includes.patch | 13 + .../freebsd-lib/files/freebsd-lib-new_as.patch | 68 +++ .../files/freebsd-sources-9.0-sysctluint.patch | 13 + sys-freebsd/freebsd-lib/files/libmap.conf | 8 + sys-freebsd/freebsd-lib/files/libusb.pc.in | 11 + sys-freebsd/freebsd-lib/freebsd-lib-9.1_rc1.ebuild | 535 ++++++++++++++++++++ 24 files changed, 1063 insertions(+), 0 deletions(-) diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch new file mode 100644 index 0000000..00de8a6 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch @@ -0,0 +1,13 @@ +Index: fbsd-6/lib/libipsec/policy_token.l +=================================================================== +--- fbsd-6.orig/lib/libipsec/policy_token.l ++++ fbsd-6/lib/libipsec/policy_token.l +@@ -138,8 +138,6 @@ void + __policy__strbuffer__init__(msg) + char *msg; + { +- if (yy_current_buffer) +- yy_delete_buffer(yy_current_buffer); + strbuffer = (YY_BUFFER_STATE)yy_scan_string(msg); + yy_switch_to_buffer(strbuffer); + diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch new file mode 100644 index 0000000..a3e7d5e --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch @@ -0,0 +1,16 @@ +This patch is needed to avoid inclusion of GCC's float.h that defines +LDBL_MANT_DIG at 53 (while the source file checks for 113 or 64. + +Index: freebsd-6.0_beta4/lib/msun/src/s_fmal.c +=================================================================== +--- freebsd-6.0_beta4.orig/lib/msun/src/s_fmal.c ++++ freebsd-6.0_beta4/lib/msun/src/s_fmal.c +@@ -28,7 +28,7 @@ + __FBSDID("$FreeBSD: src/lib/msun/src/s_fmal.c,v 1.2 2005/03/18 02:27:59 das Exp $"); + + #include +-#include ++#include + #include + + /* diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch new file mode 100644 index 0000000..2f6de46 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch @@ -0,0 +1,13 @@ +Index: freebsd-6.0_beta4/lib/libpmc/Makefile +=================================================================== +--- freebsd-6.0_beta4.orig/lib/libpmc/Makefile ++++ freebsd-6.0_beta4/lib/libpmc/Makefile +@@ -9,6 +9,8 @@ WARNS?= 6 + + MAN= pmc.3 pmclog.3 + ++CFLAGS+= -I${.CURDIR} ++ + MLINKS+= \ + pmc.3 pmc_allocate.3 \ + pmc.3 pmc_attach.3 \ diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch new file mode 100644 index 0000000..075f278 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch @@ -0,0 +1,20 @@ +--- lib/csu/amd64/Makefile.orig 2006-07-04 07:49:58 -0300 ++++ lib/csu/amd64/Makefile 2006-07-04 07:50:15 -0300 +@@ -16,6 +16,7 @@ + ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c + + realinstall: ++ ${INSTALL} -d ${DESTDIR}${LIBDIR} + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${OBJS} ${DESTDIR}${LIBDIR} + +--- lib/csu/sparc64/Makefile.orig 2006-10-06 15:13:55 +0100 ++++ lib/csu/sparc64/Makefile 2006-10-06 15:15:06 +0100 +@@ -15,6 +15,7 @@ + ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC} + + realinstall: ++ ${INSTALL} -d ${DESTDIR}${LIBDIR} + ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${OBJS} ${DESTDIR}${LIBDIR} + diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch new file mode 100644 index 0000000..a9b8435 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch @@ -0,0 +1,11 @@ +--- lib/libsdp/Makefile 2007-06-15 12:04:37 +0200 ++++ lib.sdp/libsdp/Makefile 2007-06-15 12:26:14 +0200 +@@ -5,7 +5,7 @@ + MAN= sdp.3 + + WARNS?= 2 +-CFLAGS+= -I${.CURDIR} ++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libbluetooth + + SHLIB_MAJOR= 2 + diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-7.0-CVE-2008-1391.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.0-CVE-2008-1391.patch new file mode 100644 index 0000000..2b8d401 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.0-CVE-2008-1391.patch @@ -0,0 +1,11 @@ +--- lib/libc/stdlib/strfmon.c 2008/04/22 13:23:34 ++++ lib/libc/stdlib/strfmon.c 2008/04/24 07:49:00 +@@ -65,6 +65,8 @@ + #define GET_NUMBER(VAR) do { \ + VAR = 0; \ + while (isdigit((unsigned char)*fmt)) { \ ++ if (VAR > INT_MAX / 10) \ ++ goto e2big_error; \ + VAR *= 10; \ + VAR += *fmt - '0'; \ + if (VAR < 0) \ diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch new file mode 100644 index 0000000..8de5df2 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch @@ -0,0 +1,15 @@ +Fixes a compile error if XOPEN_SOURCE 600 is defined. + +See: http://www.mailinglistarchive.com/freebsd-current@freebsd.org/msg15011.html + +--- sys/sys/types.h.orig ++++ sys/sys/types.h +@@ -46,7 +46,7 @@ + + #include + +-#if __BSD_VISIBLE ++#ifndef _POSIX_SOURCE + typedef unsigned char u_char; + typedef unsigned short u_short; + typedef unsigned int u_int; diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-7.2-rtldnoload.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.2-rtldnoload.patch new file mode 100644 index 0000000..77bbe2e --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.2-rtldnoload.patch @@ -0,0 +1,30 @@ +Backported from 8.0. +Even if RTLD_NOLOAD is not standard, dev-libs/nss expects it. +Since it has made it to 8.0 we can afford backporting it. + +--- include/dlfcn.h.old 2010-01-10 18:42:04 +0100 ++++ include/dlfcn.h 2010-01-10 18:42:19 +0100 +@@ -47,6 +47,7 @@ + #define RTLD_GLOBAL 0x100 /* Make symbols globally available. */ + #define RTLD_LOCAL 0 /* Opposite of RTLD_GLOBAL, and the default. */ + #define RTLD_TRACE 0x200 /* Trace loaded objects and exit. */ ++#define RTLD_NOLOAD 0x02000 /* Do not load if not already loaded. */ + + /* + * Request arguments for dlinfo(). +--- lib/libc/gen/dlopen.3.old 2010-01-10 18:43:15 +0100 ++++ lib/libc/gen/dlopen.3 2010-01-10 18:45:27 +0100 +@@ -141,6 +141,13 @@ + With this flag + .Fn dlopen + will return to the caller only in the case of error. ++.It Dv RTLD_NOLOAD ++Only return valid handle for the object if it is already loaded in ++the process address space, otherwise ++.Dv NULL ++is returned. ++Other mode flags may be specified, which will be applied for promotion ++for the found object. + .El + .Pp + If diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch new file mode 100644 index 0000000..2ddb9ea --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch @@ -0,0 +1,28 @@ +diff -Nur work.orig/include/rpcsvc/nis.x work/include/rpcsvc/nis.x +--- work.orig/include/rpcsvc/nis.x 2009-10-25 10:10:29.000000000 +0900 ++++ work/include/rpcsvc/nis.x 2011-04-13 21:25:13.000000000 +0900 +@@ -399,10 +399,7 @@ + %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) + %#define WORLD_DEFAULT (NIS_READ_ACC) + %#define GROUP_DEFAULT (NIS_READ_ACC << 8) +-%#define OWNER_DEFAULT ((NIS_READ_ACC +\ +- NIS_MODIFY_ACC +\ +- NIS_CREATE_ACC +\ +- NIS_DESTROY_ACC) << 16) ++%#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16) + %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) + % + %/* Result manipulation defines ... */ +@@ -431,10 +428,8 @@ + % * these definitions they take an nis_object *, and an int and return + % * a u_char * for Value, and an int for length. + % */ +-%#define ENTRY_VAL(obj, col) \ +- (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val +-%#define ENTRY_LEN(obj, col) \ +- (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len ++%#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val ++%#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len + % + %#ifdef __cplusplus + %} diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch new file mode 100644 index 0000000..a9fd189 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch @@ -0,0 +1,21 @@ +log2 and log2f are required by C99 and are not implemented. +Workaround the deficiency. + +--- lib/msun/src/math.h.old 2010-03-14 17:02:25.000000000 +0100 ++++ lib/msun/src/math.h 2010-03-14 17:07:03.000000000 +0100 +@@ -203,6 +203,7 @@ + double frexp(double, int *); /* fundamentally !__pure2 */ + double ldexp(double, int); + double log(double); ++#define log2(x) log(x)/log(2.0) + double log10(double); + double modf(double, double *); /* fundamentally !__pure2 */ + +@@ -319,6 +320,7 @@ + float log10f(float); + float log1pf(float); + float logf(float); ++#define log2f(x) logf(x)/logf(2.0) + float modff(float, float *); /* fundamentally !__pure2 */ + + float powf(float, float); diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch new file mode 100644 index 0000000..3b23387 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch @@ -0,0 +1,12 @@ +Without this linking fails during a stage3 build. + +--- lib/librpcsec_gss/Makefile.orig ++++ lib/librpcsec_gss/Makefile +@@ -8,6 +8,7 @@ + + DPADD+= ${LIBGSSAPI} + LDADD+= -lgssapi ++LDFLAGS+= -L${.CURDIR}/../libgssapi + + VERSION_DEF= ${.CURDIR}/../libc/Versions.def + SYMBOL_MAPS= ${.CURDIR}/Symbol.map diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch new file mode 100644 index 0000000..c8be7f4 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch @@ -0,0 +1,19 @@ +--- lib/libproc/Makefile.old 2011-07-06 00:58:04.000000000 +0000 ++++ lib/libproc/Makefile 2011-07-06 00:58:58.000000000 +0000 +@@ -18,5 +18,6 @@ + WARNS?= 6 + + WITHOUT_MAN= yes ++LDADD=-lelf + + .include +--- lib/librtld_db/Makefile.old 2011-07-06 00:58:12.000000000 +0000 ++++ lib/librtld_db/Makefile 2011-07-06 00:59:27.000000000 +0000 +@@ -10,5 +10,7 @@ + INCS= rtld_db.h + + CFLAGS+= -I${.CURDIR} ++LDADD=-lutil -lproc ++LDFLAGS+=-L${.CURDIR}/../libutil -L${.CURDIR}/../libproc + + .include diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch new file mode 100644 index 0000000..556ade5 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch @@ -0,0 +1,10 @@ +--- include/unistd.h 2010/12/20 20:39:49 216602 ++++ include/unistd.h 2010/12/20 21:12:18 216603 +@@ -529,6 +529,7 @@ + #define _MKTEMP_DECLARED + #endif + int nfssvc(int, void *); ++int nlm_syscall(int, int, int, char **); + int profil(char *, size_t, vm_offset_t, int); + int rcmd(char **, int, const char *, const char *, const char *, int *); + int rcmd_af(char **, int, const char *, diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch new file mode 100644 index 0000000..5d7526f --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch @@ -0,0 +1,21 @@ +diff -uNr lib.ol/libproc/Makefile lib/libproc/Makefile +--- lib.ol/libproc/Makefile 2011-11-02 14:02:17.000000000 +0000 ++++ lib/libproc/Makefile 2011-11-02 14:03:09.000000000 +0000 +@@ -16,5 +16,6 @@ + SHLIB_MAJOR= 2 + + WITHOUT_MAN= ++LDADD+=-lelf + + .include +diff -uNr lib.ol/librtld_db/Makefile lib/librtld_db/Makefile +--- lib.ol/librtld_db/Makefile 2011-11-02 14:02:13.000000000 +0000 ++++ lib/librtld_db/Makefile 2011-11-02 14:04:00.000000000 +0000 +@@ -10,5 +10,7 @@ + INCS= rtld_db.h + + CFLAGS+= -I${.CURDIR} ++LDADD+=-lutil -lproc ++LDFLAGS+=-L${.CURDIR}/../libutil -L${.CURDIR}/../libproc + + .include diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch new file mode 100644 index 0000000..bf77a0a --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch @@ -0,0 +1,122 @@ +Fixes warnings like: +/var/tmp/portage/sys-freebsd/freebsd-lib-9.0-r2/work/lib/libopie/../../contrib/opie/libopie/randomchallenge.c:43:5: +warning: incompatible implicit declaration of built-in function ‘strcpy’ + +diff -uNr contrib.old/opie/libopie/accessfile.c contrib/opie/libopie/accessfile.c +--- contrib.old/opie/libopie/accessfile.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/accessfile.c 2012-05-25 09:12:34.000000000 -0400 +@@ -46,6 +46,7 @@ + #ifdef DEBUG + #include + #endif /* DEBUG */ ++#include + + #include "opie.h" + +diff -uNr contrib.old/opie/libopie/generator.c contrib/opie/libopie/generator.c +--- contrib.old/opie/libopie/generator.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/generator.c 2012-05-25 08:58:10.000000000 -0400 +@@ -50,6 +50,7 @@ + #include + #endif /* DEBUG */ + #include "opie.h" ++#include + + static char *algids[] = { NULL, NULL, NULL, "sha1", "md4", "md5" }; + +diff -uNr contrib.old/opie/libopie/lookup.c contrib/opie/libopie/lookup.c +--- contrib.old/opie/libopie/lookup.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/lookup.c 2012-05-25 09:15:08.000000000 -0400 +@@ -14,6 +14,7 @@ + #include "opie_cfg.h" + #include + #include "opie.h" ++#include + + int opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal) + { +diff -uNr contrib.old/opie/libopie/newseed.c contrib/opie/libopie/newseed.c +--- contrib.old/opie/libopie/newseed.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/newseed.c 2012-05-25 09:14:37.000000000 -0400 +@@ -36,6 +36,9 @@ + #include + #endif /* DEBUG */ + #include "opie.h" ++#include ++#include ++#include + + int opienewseed FUNCTION((seed), char *seed) + { +diff -uNr contrib.old/opie/libopie/parsechallenge.c contrib/opie/libopie/parsechallenge.c +--- contrib.old/opie/libopie/parsechallenge.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/parsechallenge.c 2012-05-25 09:15:54.000000000 -0400 +@@ -20,6 +20,8 @@ + #include + #endif /* HAVE_STRING_H */ + #include "opie.h" ++#include ++#include + + struct algorithm { + char *name; +diff -uNr contrib.old/opie/libopie/passwd.c contrib/opie/libopie/passwd.c +--- contrib.old/opie/libopie/passwd.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/passwd.c 2012-05-25 09:13:45.000000000 -0400 +@@ -22,6 +22,7 @@ + + #include "opie_cfg.h" + #include "opie.h" ++#include + + int opiepasswd FUNCTION((old, flags, principal, n, seed, ks), struct opie *old AND int flags AND char *principal AND int n AND char *seed AND char *ks) + { +diff -uNr contrib.old/opie/libopie/randomchallenge.c contrib/opie/libopie/randomchallenge.c +--- contrib.old/opie/libopie/randomchallenge.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/randomchallenge.c 2012-05-25 09:00:27.000000000 -0400 +@@ -28,6 +28,9 @@ + + #include "opie_cfg.h" + #include "opie.h" ++#include ++#include ++#include + + static char *algids[] = { 0, 0, 0, "sha1", "md4", "md5" }; + +diff -uNr contrib.old/opie/libopie/verify.c contrib/opie/libopie/verify.c +--- contrib.old/opie/libopie/verify.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/verify.c 2012-05-25 09:12:09.000000000 -0400 +@@ -25,6 +25,7 @@ + #include + #endif /* HAVE_STRING_H */ + #include "opie.h" ++#include + + #define RESPONSE_STANDARD 0 + #define RESPONSE_WORD 1 +diff -uNr contrib.old/opie/libopie/version.c contrib/opie/libopie/version.c +--- contrib.old/opie/libopie/version.c 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/libopie/version.c 2012-05-25 09:13:15.000000000 -0400 +@@ -19,6 +19,8 @@ + */ + #include "opie_cfg.h" + #include "opie.h" ++#include ++#include + + VOIDRET opieversion FUNCTION_NOARGS + { +diff -uNr contrib.old/opie/opie.h contrib/opie/opie.h +--- contrib.old/opie/opie.h 2012-05-25 08:54:33.000000000 -0400 ++++ contrib/opie/opie.h 2012-05-25 09:21:28.000000000 -0400 +@@ -158,6 +158,9 @@ + int __opiereadrec __P((struct opie *)); + int __opiewriterec __P((struct opie *)); + int __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts)); ++VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND VOIDPTR in AND struct opie_otpkey *out AND int n); ++int opieinsecure FUNCTION_NOARGS; ++int opienewseed FUNCTION((seed), char *seed); + __END_DECLS + + #define opiestrncpy(dst, src, n) \ diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-trylock-adaptive.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-trylock-adaptive.patch new file mode 100644 index 0000000..e72b171 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-trylock-adaptive.patch @@ -0,0 +1,14 @@ +http://www.freebsd.org/cgi/query-pr.cgi?pr=168317 + +Index: lib/libthr/thread/thr_mutex.c +=================================================================== +--- lib/libthr/thread/thr_mutex.c (revision 235924) ++++ lib/libthr/thread/thr_mutex.c (working copy) +@@ -538,6 +538,7 @@ + switch (PMUTEX_TYPE(m->m_flags)) { + case PTHREAD_MUTEX_ERRORCHECK: + case PTHREAD_MUTEX_NORMAL: ++ case PTHREAD_MUTEX_ADAPTIVE_NP: + ret = EBUSY; + break; + diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch new file mode 100644 index 0000000..ec90def --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml.patch @@ -0,0 +1,13 @@ +diff -u lib/libgeom/Makefile lib.xml/libgeom/Makefile +--- lib/libgeom/Makefile 2004-03-07 16:07:57 +0000 ++++ lib.xml/libgeom/Makefile 2005-05-06 10:38:41 +0000 +@@ -8,7 +8,8 @@ + SRCS+= geom_ctl.c + INCS= libgeom.h + +-CFLAGS += -I${.CURDIR} ++CFLAGS += -I${.CURDIR} -I${.CURDIR}/../libexpat ++LDFLAGS += -L${.CURDIR}/../libexpat + + WARNS?= 3 + diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch new file mode 100644 index 0000000..1b4e791 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch @@ -0,0 +1,26 @@ +diff -ur lib/libgeom.old/Makefile lib/libgeom/Makefile +--- lib/libgeom.old/Makefile 2011-07-10 14:23:51.000000000 +0000 ++++ lib/libgeom/Makefile 2011-07-10 15:12:39.000000000 +0000 +@@ -13,8 +13,8 @@ + + WARNS?= 3 + +-DPADD= ${LIBBSDXML} ${LIBSBUF} +-LDADD= -lbsdxml -lsbuf ++DPADD= ${LIBSBUF} ++LDADD= -lexpat -lsbuf + + MAN= libgeom.3 + +diff -ur lib/libgeom.old/geom_xml2tree.c lib/libgeom/geom_xml2tree.c +--- lib/libgeom.old/geom_xml2tree.c 2010-12-21 17:09:25.000000000 +0000 ++++ lib/libgeom/geom_xml2tree.c 2011-07-10 15:12:52.000000000 +0000 +@@ -43,7 +43,7 @@ + #include + #include + #include +-#include ++#include + #include + + struct mystate { diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch new file mode 100644 index 0000000..c2cf142 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch @@ -0,0 +1,13 @@ +Fix headers dependencies so that they can be included alone. + +--- include/ifaddrs.h.old 2009-05-15 13:50:10 +0000 ++++ include/ifaddrs.h 2009-05-15 13:50:23 +0000 +@@ -28,6 +28,8 @@ + #ifndef _IFADDRS_H_ + #define _IFADDRS_H_ + ++#include ++ + struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch new file mode 100644 index 0000000..c9288a4 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-new_as.patch @@ -0,0 +1,68 @@ +--- lib/msun/i387/fenv.c.orig 2007-01-05 04:15:26 -0300 ++++ lib/msun/i387/fenv.c 2008-06-14 00:49:30 -0300 +@@ -152,7 +152,8 @@ + int + feupdateenv(const fenv_t *envp) + { +- int mxcsr, status; ++ int mxcsr; ++ short status; + + __fnstsw(&status); + if (__HAS_SSE()) +--- lib/msun/i387/fenv.h.orig 2007-01-06 18:46:23 -0300 ++++ lib/msun/i387/fenv.h 2008-06-14 01:06:40 -0300 +@@ -134,7 +134,8 @@ + static __inline int + fegetexceptflag(fexcept_t *__flagp, int __excepts) + { +- int __mxcsr, __status; ++ int __mxcsr; ++ short __status; + + __fnstsw(&__status); + if (__HAS_SSE()) +@@ -151,7 +152,8 @@ + static __inline int + fetestexcept(int __excepts) + { +- int __mxcsr, __status; ++ int __mxcsr; ++ short __status; + + __fnstsw(&__status); + if (__HAS_SSE()) +--- lib/msun/amd64/fenv.c.orig 2007-01-05 04:15:26 -0300 ++++ lib/msun/amd64/fenv.c 2008-06-14 01:02:41 -0300 +@@ -101,7 +101,8 @@ + int + feupdateenv(const fenv_t *envp) + { +- int mxcsr, status; ++ int mxcsr; ++ short status; + + __fnstsw(&status); + __stmxcsr(&mxcsr); +--- lib/msun/amd64/fenv.h.orig 2007-01-06 18:46:23 -0300 ++++ lib/msun/amd64/fenv.h 2008-06-14 01:08:23 -0300 +@@ -110,7 +110,8 @@ + static __inline int + fegetexceptflag(fexcept_t *__flagp, int __excepts) + { +- int __mxcsr, __status; ++ int __mxcsr; ++ short __status; + + __stmxcsr(&__mxcsr); + __fnstsw(&__status); +@@ -124,7 +125,8 @@ + static __inline int + fetestexcept(int __excepts) + { +- int __mxcsr, __status; ++ int __mxcsr; ++ short __status; + + __stmxcsr(&__mxcsr); + __fnstsw(&__status); diff --git a/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch b/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch new file mode 100644 index 0000000..751a77c --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch @@ -0,0 +1,13 @@ +u_int is defined in sys/types.h +makes header usable alone. + +--- sys/sys/sysctl.h.old 2012-05-25 11:08:53.000000000 -0400 ++++ sys/sys/sysctl.h 2012-05-25 11:09:16.000000000 -0400 +@@ -788,6 +788,7 @@ + struct sysctl_req *); + #else /* !_KERNEL */ + #include ++#include /* for u_int */ + + __BEGIN_DECLS + int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); diff --git a/sys-freebsd/freebsd-lib/files/libmap.conf b/sys-freebsd/freebsd-lib/files/libmap.conf new file mode 100644 index 0000000..7a879f9 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/libmap.conf @@ -0,0 +1,8 @@ +# /etc/libmap.conf + +# Ensure that libthr does all threading +libpthread.so.2 libthr.so.2 +libpthread.so libthr.so +libc_r.so.6 libthr.so.2 +libc_r.so libthr.so + diff --git a/sys-freebsd/freebsd-lib/files/libusb.pc.in b/sys-freebsd/freebsd-lib/files/libusb.pc.in new file mode 100644 index 0000000..f63c6e3 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/libusb.pc.in @@ -0,0 +1,11 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=@LIBDIR@ +includedir=${prefix}/include + +Name: libusb +Description: USB access library (FreeBSD version) +Version: 0.1.12 +Libs: -L${libdir} -lusb +Cflags: -I${includedir} + diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-9.1_rc1.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-9.1_rc1.ebuild new file mode 100644 index 0000000..39bb356 --- /dev/null +++ b/sys-freebsd/freebsd-lib/freebsd-lib-9.1_rc1.ebuild @@ -0,0 +1,535 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=2 + +inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils + +DESCRIPTION="FreeBSD's base system libraries" +SLOT="0" +KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd" + +# Crypto is needed to have an internal OpenSSL header +# sys is needed for libalias, probably we can just extract that instead of +# extracting the whole tarball +SRC_URI="mirror://gentoo/${LIB}.tar.bz2 + mirror://gentoo/${CONTRIB}.tar.bz2 + mirror://gentoo/${CRYPTO}.tar.bz2 + mirror://gentoo/${LIBEXEC}.tar.bz2 + mirror://gentoo/${ETC}.tar.bz2 + mirror://gentoo/${INCLUDE}.tar.bz2 + mirror://gentoo/${USBIN}.tar.bz2 + mirror://gentoo/${GNU}.tar.bz2 + build? ( + mirror://gentoo/${SYS}.tar.bz2 ) + zfs? ( + mirror://gentoo/${CDDL}.tar.bz2 )" + +if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then + RDEPEND="ssl? ( dev-libs/openssl ) + hesiod? ( net-dns/hesiod ) + kerberos? ( virtual/krb5 ) + usb? ( !dev-libs/libusb !dev-libs/libusbx ) + userland_GNU? ( sys-apps/mtree ) + zfs? ( =sys-freebsd/freebsd-cddl-${RV}* ) + >=dev-libs/expat-2.0.1 + !sys-libs/libutempter + !sys-freebsd/freebsd-headers" + DEPEND="${RDEPEND} + >=sys-devel/flex-2.5.31-r2 + =sys-freebsd/freebsd-sources-${RV}* + !bootstrap? ( app-arch/bzip2 )" +else + SRC_URI="${SRC_URI} + mirror://gentoo/${SYS}.tar.bz2" +fi + +DEPEND="${DEPEND} + =sys-freebsd/freebsd-mk-defs-${RV}*" + +S="${WORKDIR}/lib" + +export CTARGET=${CTARGET:-${CHOST}} +if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then + export CTARGET=${CATEGORY/cross-} +fi + +IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware + build bootstrap crosscompile_opts_headers-only zfs + userland_GNU userland_BSD multilib" + +pkg_setup() { + [ -c /dev/zero ] || \ + die "You forgot to mount /dev; the compiled libc would break." + + if ! use ssl && use kerberos; then + eerror "If you want kerberos support you need to enable ssl support, too." + fi + + use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= " + use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= " + use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= " + use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= " + use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= " + use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= " + use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= " + use usb || mymakeopts="${mymakeopts} WITHOUT_USB= " + use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= " + + mymakeopts="${mymakeopts} WITHOUT_BIND= WITHOUT_BIND_LIBS= WITHOUT_SENDMAIL= WITHOUT_CLANG= " + + if [ "${CTARGET}" != "${CHOST}" ]; then + mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})" + mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})" + fi +} + +PATCHES=( + "${FILESDIR}/${PN}-6.0-pmc.patch" + "${FILESDIR}/${PN}-6.0-gccfloat.patch" + "${FILESDIR}/${PN}-6.0-flex-2.5.31.patch" + "${FILESDIR}/${PN}-6.1-csu.patch" + "${FILESDIR}/${PN}-8.0-rpcsec_gss.patch" + "${FILESDIR}/${PN}-9.0-liblink.patch" + "${FILESDIR}/${PN}-bsdxml2expat.patch" ) + +# Here we disable and remove source which we don't need or want +# In order: +# - ncurses stuff +# - libexpat creates a bsdxml library which is the same as expat +# - archiving libraries (have their own ebuild) +# - sendmail libraries (they are installed by sendmail) +# - SNMP library and dependency (have their own ebuilds) +# - Clang (compiler_rt and blocksruntime) +# +# The rest are libraries we already have somewhere else because +# they are contribution. +# Note: libtelnet is an internal lib used by telnet and telnetd programs +# as it's not used in freebsd-lib package itself, it's pointless building +# it here. +REMOVE_SUBDIRS="ncurses \ + libexpat \ + libz libbz2 libarchive liblzma \ + libsm libsmdb libsmutil \ + libbegemot libbsnmp \ + libcompiler_rt libblocksruntime \ + libpam libpcap bind libwrap libmagic \ + libcom_err libtelnet + libelf libedit" + +# Are we building a cross-compiler? +is_crosscompile() { + [ "${CATEGORY#*cross-}" != "${CATEGORY}" ] +} + +src_prepare() { + sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc" + + # Upstream Display Managers default to using VT7 + # We should make FreeBSD allow this by default + local x= + for x in "${WORKDIR}"/etc/etc.*/ttys ; do + sed -i.bak \ + -e '/ttyv5[[:space:]]/ a\ +# Display Managers default to VT7.\ +# If you use the xdm init script, keep ttyv6 commented out\ +# unless you force a different VT for the DM being used.' \ + -e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \ + || die "Failed to sed ${x}" + rm "${x}".bak + done + + # This one is here because it also + # patches "${WORKDIR}/include" + cd "${WORKDIR}" + epatch "${FILESDIR}/${PN}-includes.patch" + epatch "${FILESDIR}/${PN}-8.0-gcc45.patch" + epatch "${FILESDIR}/${PN}-9.0-opieincludes.patch" + + # Don't install the hesiod man page or header + rm "${WORKDIR}"/include/hesiod.h || die + sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die + sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \ + "${WORKDIR}"/lib/libc/net/Makefile.inc || die + + # Fix the Makefiles of these few libraries that will overwrite our LDADD. + cd "${S}" + for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \ + libsmb; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \ + die "Problem fixing \"${dir}/Makefile" + done + # Call LD with LDFLAGS, rename them to RAW_LDFLAGS + sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \ + -i "${S}/csu/i386-elf/Makefile" \ + -i "${S}/csu/ia64/Makefile" || die + if use build; then + cd "${WORKDIR}" + # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it + # shouldn't be a symlink to /usr/src/sys (which should be already patched) + epatch "${FILESDIR}"/${PN}-7.1-types.h-fix.patch + epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch + return 0 + fi + + if ! is_crosscompile ; then + ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" || die "Couldn't make sys symlink!" + else + sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \ + "${S}/libc/rpc/Makefile.inc" \ + "${S}/libc/yp/Makefile.inc" + fi + + if install --version 2> /dev/null | grep -q GNU; then + sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile" + fi + + # Let arch-specific includes to be found + local machine + machine=$(tc-arch-kernel ${CTARGET}) + ln -s "${WORKDIR}/sys/${machine}/include" "${WORKDIR}/include/machine" || \ + die "Couldn't make ${machine}/include symlink." + + cd "${S}" + use bootstrap && dummy_mk libstand + # Try to fix sed calls for GNU sed. Do it only with GNU userland and force + # BSD's sed on BSD. + if use userland_GNU; then + find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \; + fi +} + +get_csudir() { + if [ -d "${WORKDIR}/lib/csu/$1-elf" ]; then + echo "lib/csu/$1-elf" + else + echo "lib/csu/$1" + fi +} + +bootstrap_csu() { + local csudir="$(get_csudir $(tc-arch-kernel ${CTARGET}))" + export RAW_LDFLAGS=$(raw-ldflags) + cd "${WORKDIR}/${csudir}" || die "Missing ${csudir}." + freebsd_src_compile + + CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}" + append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}" +} + +# Compile libssp_nonshared.a and add it's path to LDFLAGS. +bootstrap_libssp_nonshared() { + cd "${WORKDIR}/gnu/lib/libssp/libssp_nonshared/" || die "missing libssp." + freebsd_src_compile + append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/libssp/libssp_nonshared/" + export LDADD="-lssp_nonshared" +} + +# What to build for a non-native build: cross-compiler, non-native abi in +# multilib. We also need the csu but this has to be handled separately. +NON_NATIVE_SUBDIRS="lib/libc lib/msun gnu/lib/libssp/libssp_nonshared lib/libthr lib/libutil" + +# Subdirs for a native build: +NATIVE_SUBDIRS="lib gnu/lib/libssp/libssp_nonshared gnu/lib/libregex" + +# Is my $ABI native ? +is_native_abi() { + is_crosscompile && return 1 + use multilib || return 0 + [ "${ABI}" = "${DEFAULT_ABI}" ] +} + +# Do we need to bootstrap the csu and libssp_nonshared? +need_bootstrap() { + is_crosscompile || use build || ! is_native_abi || has_version "<${CATEGORY}/${P}" +} + +# Get the subdirs we are building. +get_subdirs() { + local ret="" + if is_native_abi ; then + # If we are building for the native ABI, build everything + ret="${NATIVE_SUBDIRS}" + elif is_crosscompile ; then + # With a cross-compiler we only build the very core parts. + ret="${NON_NATIVE_SUBDIRS}" + if [ "${EBUILD_PHASE}" = "install" ]; then + # Add the csu dir first when installing. We treat it separately for + # compiling. + ret="$(get_csudir $(tc-arch-kernel ${CTARGET})) ${ret}" + fi + elif use build ; then + # For the non-native ABIs we only build the csu parts and very core + # libraries for now. + ret="gnu/lib/libssp/libssp_nonshared" + if [ "${EBUILD_PHASE}" = "install" ]; then + ret="$(get_csudir $(tc-arch-kernel ${CHOST})) ${ret}" + fi + else + # Only build the csu parts and core libraries for now. + ret="gnu/lib/libssp/libssp_nonshared" + if [ "${EBUILD_PHASE}" = "install" ]; then + ret="$(get_csudir $(tc-arch-kernel ${CHOST})) ${ret}" + fi + # Finally, with a non-native ABI without USE=build, we build everything + # too. + #ret="${NATIVE_SUBDIRS}" + fi + echo "${ret}" +} + +# Bootstrap the core libraries and setup the flags so that the other parts can +# build against it. +do_bootstrap() { + einfo "Bootstrapping on ${CHOST} for ${CTARGET}" + if ! is_crosscompile ; then + # Pre-install headers, but not when building a cross-compiler since we + # assume they have been installed in the previous pass. + einfo "Pre-installing includes in include_proper_${ABI}" + mkdir "${WORKDIR}/include_proper_${ABI}" || die + CTARGET="${CHOST}" install_includes "/include_proper_${ABI}" + CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}" + fi + bootstrap_csu + bootstrap_libssp_nonshared +} + +# Compile it. Assume we have the toolchain setup correctly. +do_compile() { + export MAKEOBJDIRPREFIX="${WORKDIR}/${CHOST}" + mkdir "${MAKEOBJDIRPREFIX}" || die "Could not create ${MAKEOBJDIRPREFIX}." + need_bootstrap && do_bootstrap + + export RAW_LDFLAGS=$(raw-ldflags) + + #fixes bug 419477, multilib support + cd "${S}" + sed -i -e "s:^LDFLAGS+=.*:LDFLAGS+=-L ${MAKEOBJDIRPREFIX}/${S}/libgssapi:" \ + librpcsec_gss/Makefile || die "Problem fixing \"librpcsec_gss/Makefile" + sed -i -e "s:^LDFLAGS+=.*:LDFLAGS+=-L ${MAKEOBJDIRPREFIX}/${S}/libutil -L ${MAKEOBJDIRPREFIX}/${S}/libproc:" \ + librtld_db/Makefile || die "Problem fixing \"librtld_db/Makefile" + + # Everything is now setup, build it! + for i in $(get_subdirs) ; do + einfo "Building in ${i}... with CC=${CC} and CFLAGS=${CFLAGS}" + cd "${WORKDIR}/${i}/" || die "missing ${i}." + freebsd_src_compile || die "make ${i} failed" + done +} + +src_compile() { + # Does not work with GNU sed + # Force BSD's sed on BSD. + if use userland_BSD ; then + export ESED=/usr/bin/sed + unalias sed + fi + + cd "${WORKDIR}/include" + $(freebsd_get_bmake) CC="$(tc-getCC)" || die "make include failed" + + use crosscompile_opts_headers-only && return 0 + + # Bug #270098 + append-flags $(test-flags -fno-strict-aliasing) + + # Bug #324445 + append-flags $(test-flags -fno-strict-overflow) + + # strip flags and do not do it later, we only add safe, and in fact + # needed flags after all + strip-flags + export NOFLAGSTRIP=yes + if is_crosscompile ; then + export YACC='yacc -by' + CHOST=${CTARGET} tc-export CC LD CXX RANLIB + mymakeopts="${mymakeopts} NLS=" + append-flags "-I/usr/${CTARGET}/usr/include" + append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc" + fi + + if is_crosscompile ; then + do_compile + else + for ABI in $(get_all_abis) ; do + # First, save the variables: CFLAGS, CXXFLAGS, LDFLAGS and mymakeopts. + for i in CFLAGS CXXFLAGS LDFLAGS mymakeopts ; do + export ${i}_SAVE="${!i}" + done + + multilib_toolchain_setup ${ABI} + + local target="$(tc-arch-kernel ${CHOST})" + mymakeopts="${mymakeopts} TARGET=${target} MACHINE=${target} MACHINE_ARCH=${target}" + CFLAGADD="" + if ! is_native_abi ; then + mymakeopts="${mymakeopts} COMPAT_32BIT=" + else + use build || CFLAGS="${CFLAGS} -isystem /usr/include"; + fi + + einfo "Building for ABI ${ABI} and TARGET=$(tc-arch-kernel ${CHOST})" + + CTARGET="${CHOST}" do_compile + + # Restore the variables now. + for i in CFLAGS CXXFLAGS LDFLAGS mymakeopts ; do + ii="${i}_SAVE" + export ${i}="${!ii}" + done + done + fi +} + +gen_libc_ldscript() { + # Parameters: + # $1 = target libdir + # $2 = source libc dir + # $3 = source libssp_nonshared dir + + # Clear the symlink. + rm -f "${D}/$2/libc.so" || die + + # Move the library if needed + if [ "$1" != "$2" ] ; then + mv "${D}/$2/libc.so.7" "${D}/$1/" || die + fi + + # Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking + # this is done to avoid having to touch gcc spec file as it is currently + # done on FreeBSD upstream, mostly because their binutils aren't able to + # cope with linker scripts yet. + # Taken from toolchain-funcs.eclass: + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat > "${D}/$2/libc.so" <<-END_LDSCRIPT +/* GNU ld script + SSP (-fstack-protector) requires __stack_chk_fail_local to be local. + GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if + this symbol was provided by a shared libc. So we link in + libssp_nonshared.a from here. + */ +${output_format} +GROUP ( /$1/libc.so.7 /$3/libssp_nonshared.a ) +END_LDSCRIPT +} + +do_install() { + export MAKEOBJDIRPREFIX="${WORKDIR}/${CHOST}" + for i in $(get_subdirs) ; do + einfo "Installing in ${i}..." + cd "${WORKDIR}/${i}/" || die "missing ${i}." + freebsd_src_install || die "Install ${i} failed" + done +} + +src_install() { + [ "${CTARGET}" = "${CHOST}" ] \ + && INCLUDEDIR="/usr/include" \ + || INCLUDEDIR="/usr/${CTARGET}/usr/include" + dodir ${INCLUDEDIR} + einfo "Installing for ${CTARGET} in ${CHOST}.." + install_includes ${INCLUDEDIR} + + use crosscompile_opts_headers-only && return 0 + local mylibdir=$(get_libdir) + + if is_crosscompile ; then + mymakeopts="${mymakeopts} NO_MAN= \ + INCLUDEDIR=/usr/${CTARGET}/usr/include \ + SHLIBDIR=/usr/${CTARGET}/usr/lib \ + LIBDIR=/usr/${CTARGET}/usr/lib" + + dosym "usr/include" "/usr/${CTARGET}/sys-include" + do_install + else + if ! use multilib ; then + # Set SHLIBDIR and LIBDIR for multilib + mymakeopts="${mymakeopts} SHLIBDIR=/usr/${mylibdir} LIBDIR=/usr/${mylibdir}" + do_install + else + for ABI in $(get_all_abis) ; do + mymakeopts_SAVE="${mymakeopts}" + multilib_toolchain_setup ${ABI} + mymakeopts="${mymakeopts} SHLIBDIR=/usr/$(get_libdir) LIBDIR=/usr/$(get_libdir)" + do_install + mymakeopts="${mymakeopts_SAVE}" + done + fi + fi + + # Don't install the rest of the configuration files if crosscompiling + if is_crosscompile ; then + # This is to get it stripped with the correct tools, otherwise it gets + # stripped with the host strip. + # And also get the correct OUTPUT_FORMAT in the libc ldscript. + export CHOST=${CTARGET} + gen_libc_ldscript "usr/${CTARGET}/usr/lib" "usr/${CTARGET}/usr/lib" "usr/${CTARGET}/usr/lib" + return 0 + fi + + cd "${WORKDIR}/etc/" + insinto /etc + doins auth.conf nls.alias mac.conf netconfig + + # Install ttys file + local MACHINE="$(tc-arch-kernel)" + doins "etc.${MACHINE}"/* + + # Generate ldscripts for core libraries that will go in / + gen_usr_ldscript -a alias cam geom ipsec jail kiconv \ + kvm m md procstat sbuf thr ufs util + + gen_libc_ldscript "${mylibdir}" "usr/${mylibdir}" "usr/${mylibdir}" + + # Install a libusb.pc for better compat with Linux's libusb + if use usb ; then + dodir /usr/$(get_libdir)/pkgconfig + sed -e "s:@LIBDIR@:/usr/$(get_libdir):" "${FILESDIR}/libusb.pc.in" > "${D}/usr/$(get_libdir)/pkgconfig/libusb.pc" || die + fi +} + +install_includes() +{ + local INCLUDEDIR="$1" + + # The idea is to be called from either install or unpack. + # During unpack it's required to install them as portage's user. + if [[ "${EBUILD_PHASE}" == "install" ]]; then + local DESTDIR="${D}" + BINOWN="root" + BINGRP="wheel" + else + local DESTDIR="${WORKDIR}" + [[ -z "${USER}" ]] && USER="portage" + BINOWN="${USER}" + [[ -z "${GROUPS}" ]] && GROUPS="portage" + BINGRP="${GROUPS}" + fi + + # Must exist before we use it. + [[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes." + cd "${WORKDIR}/include" + + local MACHINE="$(tc-arch-kernel)" + + einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..." + $(freebsd_get_bmake) installincludes \ + MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \ + DESTDIR="${DESTDIR}" \ + INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \ + BINGRP="${BINGRP}" || die "install_includes() failed" + einfo "includes installed ok." + EXTRA_INCLUDES="lib/librtld_db lib/libutil lib/msun gnu/lib/libregex" + for i in $EXTRA_INCLUDES; do + einfo "Installing $i includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..." + cd "${WORKDIR}/$i" || die + $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \ + MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \ + INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \ + BINGRP="${BINGRP}" || die "problem installing $i includes." + einfo "$i includes installed ok." + done +}