summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2006-04-30 09:13:12 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2006-04-30 09:13:12 +0000
commitb642c6175c257841bdfa89f179bb0d7e806bf80d (patch)
treeb75f4bf2e97e84eaaf2588016dd87f0dedb21b68 /sys-freebsd/freebsd-lib
parentRemove nossp masking and unmask hardened useflag. (diff)
downloadgentoo-2-b642c6175c257841bdfa89f179bb0d7e806bf80d.tar.gz
gentoo-2-b642c6175c257841bdfa89f179bb0d7e806bf80d.tar.bz2
gentoo-2-b642c6175c257841bdfa89f179bb0d7e806bf80d.zip
New patch for ssp support, based on OpenBSD code, too. This version has now the patch by default. Please re-compile gcc if you want to have ssp support, tho.
(Portage version: 2.1_pre10)
Diffstat (limited to 'sys-freebsd/freebsd-lib')
-rw-r--r--sys-freebsd/freebsd-lib/ChangeLog11
-rw-r--r--sys-freebsd/freebsd-lib/files/digest-freebsd-lib-6.0-r324
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-ssp.patch96
-rw-r--r--sys-freebsd/freebsd-lib/freebsd-lib-6.0-r3.ebuild219
4 files changed, 343 insertions, 7 deletions
diff --git a/sys-freebsd/freebsd-lib/ChangeLog b/sys-freebsd/freebsd-lib/ChangeLog
index bd7089b94566..de479ad887e7 100644
--- a/sys-freebsd/freebsd-lib/ChangeLog
+++ b/sys-freebsd/freebsd-lib/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for sys-freebsd/freebsd-lib
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog,v 1.11 2006/04/30 03:27:40 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/ChangeLog,v 1.12 2006/04/30 09:13:12 flameeyes Exp $
+
+*freebsd-lib-6.0-r3 (30 Apr 2006)
+
+ 30 Apr 2006; Diego Pettenò <flameeyes@gentoo.org>
+ files/freebsd-lib-6.0-ssp.patch, -freebsd-lib-6.0-r2.ebuild,
+ +freebsd-lib-6.0-r3.ebuild:
+ New patch for ssp support, based on OpenBSD code, too. This version has now
+ the patch by default. Please re-compile gcc if you want to have ssp support,
+ tho.
30 Apr 2006; Diego Pettenò <flameeyes@gentoo.org>
+files/freebsd-lib-6.0-ssp.patch, freebsd-lib-6.0-r2.ebuild:
diff --git a/sys-freebsd/freebsd-lib/files/digest-freebsd-lib-6.0-r3 b/sys-freebsd/freebsd-lib/files/digest-freebsd-lib-6.0-r3
new file mode 100644
index 000000000000..dfc73a573b49
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/digest-freebsd-lib-6.0-r3
@@ -0,0 +1,24 @@
+MD5 b5b626909c9707d0bab0c54b50e132b9 freebsd-contrib-6.0.tar.bz2 34972594
+RMD160 3f045dd7d1ddbcf20da670051459f0a2fc508a8b freebsd-contrib-6.0.tar.bz2 34972594
+SHA256 9c76affcddb3a8257d3b612dd7cc8ff43bc7417e47e215c01909a81c79e9d443 freebsd-contrib-6.0.tar.bz2 34972594
+MD5 3f5ace196589dee4044fd717abf4b57c freebsd-crypto-6.0.tar.bz2 3978650
+RMD160 361efbba1f651925a7cc2284665b044bc232f181 freebsd-crypto-6.0.tar.bz2 3978650
+SHA256 e86223d40ef2747de98f575f3875a6ce8a5e913baa850a5ef547ffef00ace480 freebsd-crypto-6.0.tar.bz2 3978650
+MD5 7c2af3af5be2f46372f9cc0efaeda4c7 freebsd-etc-6.0.tar.bz2 178941
+RMD160 48d0eb51f291e5d706ef076151964b88a9fc1796 freebsd-etc-6.0.tar.bz2 178941
+SHA256 c4bd9401dad72bd869b89aa12a61339a30746caadb741bb0d094f522ee117616 freebsd-etc-6.0.tar.bz2 178941
+MD5 0a5937660818157a2a0bf09fe705f24c freebsd-include-6.0.tar.bz2 127219
+RMD160 683fe6cf84961d0019c742f4e1fc0e4bfb18b60c freebsd-include-6.0.tar.bz2 127219
+SHA256 9da34ffd474e023fe7dd203cb035d97726eb8e7bea7e9566249e62da4039be8b freebsd-include-6.0.tar.bz2 127219
+MD5 3888da5da1cb329a65a3ac9d316f99ea freebsd-lib-6.0.tar.bz2 2613087
+RMD160 30bf04438a00408284f135c2670106141cae4873 freebsd-lib-6.0.tar.bz2 2613087
+SHA256 dab1140d52597f37d768d2210a49cb29db5404a7df35306462e3642074426a53 freebsd-lib-6.0.tar.bz2 2613087
+MD5 44996c2edac20108da43add45b599d94 freebsd-libexec-6.0.tar.bz2 277631
+RMD160 5121414524c9dfceab1f5ad8b8bc91c65141db82 freebsd-libexec-6.0.tar.bz2 277631
+SHA256 2eddc867d69afa6c5d0a2f3ce18d4570688b5fa49924adb478dc7d548ba8197e freebsd-libexec-6.0.tar.bz2 277631
+MD5 fa4633806f9ecd13eba57e45e5b6031f freebsd-sys-6.0.tar.bz2 16069887
+RMD160 02b446bb5a3dde2f91ecba2617a887e817d038a9 freebsd-sys-6.0.tar.bz2 16069887
+SHA256 416fc69ab15d28686d461ca115964091409abc9e5855260d89e2370cad77ad70 freebsd-sys-6.0.tar.bz2 16069887
+MD5 df8c3764da190437a1d47c6ff1872520 freebsd-usbin-6.0.tar.bz2 2635411
+RMD160 9a8f5cdc041df1ad2b388c432a1829b5c8adc51d freebsd-usbin-6.0.tar.bz2 2635411
+SHA256 46ac3c581fd20d9980bcf2d80aba7c2f874ad3e29058939bee0c6f1a4af8ff64 freebsd-usbin-6.0.tar.bz2 2635411
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-ssp.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-ssp.patch
index 98e07710f123..e94e5573c3f0 100644
--- a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-ssp.patch
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-ssp.patch
@@ -15,20 +15,90 @@ Index: fbsd-6/lib/libc/sys/ssp.c
===================================================================
--- /dev/null
+++ fbsd-6/lib/libc/sys/ssp.c
-@@ -0,0 +1,13 @@
-+#include <stdlib.h>
+@@ -0,0 +1,83 @@
++/*
++ * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat.
++ * Copyright (c) 2006 Ned Ludd <solar@gentoo.org>
++ * Diego Pettenò <flameeyes@gentoo.org>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
++ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
++ * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
++ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
++ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
++ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
++ * POSSIBILITY OF SUCH DAMAGE.
++ *
++ */
++
+#include <sys/param.h>
+#include <sys/sysctl.h>
++#include <signal.h>
++#include <string.h>
++#include <syslog.h>
++#include <unistd.h>
++#include <stdlib.h>
++
++extern int __sysctl(int *, u_int, void *, size_t *, void *, size_t);
+
+unsigned long __guard = 0UL;
+void __guard_setup(void) __attribute__ ((constructor));
-+void __stack_smash_handler(char func[], int damaged __attribute__ ((unused)));
-+void __guard_setup(void) { if (__guard != 0UL) return; __guard = 0xFF0A0D00UL; }
++void __stack_smash_handler(char func[], int damaged __attribute__((unused)));
+
-+void __stack_smash_handler(char func[], int damaged) {
-+ _exit(127);
++void
++__guard_setup(void)
++{
++ int i, mib[2];
++ size_t len = 4;
++
++ __guard = 0xFF0A0D00UL;
++ if (__guard != 0) return;
++
++ srandomdev();
++
++ __guard = random();
+}
+
++void
++__stack_smash_handler(char func[], int damaged)
++{
++ static const char message[] = "stack overflow in function ";
++ struct sigaction sa;
++ sigset_t mask;
++
++ /* Immediately block all signal handlers from running code */
++ sigfillset(&mask);
++ sigdelset(&mask, SIGABRT);
++ sigprocmask(SIG_BLOCK, &mask, NULL);
++
++ write(2, message, sizeof(message));
++ write(2, func, strlen(func));
++ write(2, "\n", 1);
++
++ bzero(&sa, sizeof(struct sigaction));
++ sigemptyset(&sa.sa_mask);
++ sa.sa_flags = 0;
++ sa.sa_handler = SIG_DFL;
++ sigaction(SIGABRT, &sa, NULL);
++
++ kill(getpid(), SIGABRT);
++
++ _exit(127);
++}
Index: fbsd-6/lib/csu/i386-elf/crt1.c
===================================================================
--- fbsd-6.orig/lib/csu/i386-elf/crt1.c
@@ -49,3 +119,17 @@ Index: fbsd-6/lib/csu/i386-elf/crt1.c
exit( main(argc, argv, env) );
}
+Index: fbsd-6/lib/libc/Makefile
+===================================================================
+--- fbsd-6.orig/lib/libc/Makefile
++++ fbsd-6/lib/libc/Makefile
+@@ -15,6 +15,9 @@ SHLIBDIR?= /lib
+ WARNS?= 2
+ CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include
+ CFLAGS+=-I${.CURDIR}/${MACHINE_ARCH}
++# Disable stack protection for the only libc, and leave it for the rest of
++# the libraries.
++CFLAGS+= -fno-stack-protector
+ CLEANFILES+=tags
+ INSTALL_PIC_ARCHIVE=
+ PRECIOUSLIB=
diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-6.0-r3.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-6.0-r3.ebuild
new file mode 100644
index 000000000000..78e41d4af92b
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/freebsd-lib-6.0-r3.ebuild
@@ -0,0 +1,219 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-lib/freebsd-lib-6.0-r3.ebuild,v 1.1 2006/04/30 09:13:12 flameeyes Exp $
+
+inherit bsdmk freebsd flag-o-matic toolchain-funcs
+
+DESCRIPTION="FreeBSD's base system libraries"
+SLOT="6.0"
+KEYWORDS="~x86-fbsd"
+
+IUSE="atm bluetooth ssl ipv6 kerberos nis gpib"
+
+# 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
+ nis? ( mirror://gentoo/${USBIN}.tar.bz2 )
+ !kernel_FreeBSD? (
+ mirror://gentoo/${SYS}.tar.bz2 )"
+
+RDEPEND="ssl? ( dev-libs/openssl )
+ kerberos? ( virtual/krb5 )
+ !sys-freebsd/freebsd-headers"
+DEPEND="${RDEPEND}
+ >=sys-devel/flex-2.5.31-r2
+ =sys-freebsd/freebsd-mk-defs-${RV}*
+ =sys-freebsd/freebsd-sources-${RV}*"
+
+if [[ ${CATEGORY/cross-} == {CATEGORY} ]]; then
+ PROVIDE="virtual/libc
+ virtual/os-headers"
+fi
+
+S="${WORKDIR}/lib"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then
+ export CTARGET=${CATEGORY/cross-}
+fi
+
+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} NO_ATM= "
+ use bluetooth || mymakeopts="${mymakeopts} NO_BLUETOOTH= "
+ use ssl || mymakeopts="${mymakeopts} NO_OPENSSL= NO_CRYPT= "
+ use ipv6 || mymakeopts="${mymakeopts} NO_INET6= "
+ use kerberos || mymakeopts="${mymakeopts} NO_KERBEROS= "
+ use nis || mymakeopts="${mymakeopts} NO_NIS= "
+ use gpib || mymakeopts="${mymakeopts} NO_GPIB= "
+
+ mymakeopts="${mymakeopts} NO_OPENSSH= NO_BIND= NO_SENDMAIL= "
+
+ replace-flags "-O?" -"O1"
+
+ if [[ ${CTARGET} != ${CHOST} ]]; then
+ mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})"
+ mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})"
+ fi
+
+ einfo "Using mymakeopts: ${mymakeopts}"
+}
+
+PATCHES="${FILESDIR}/${PN}-bsdxml.patch
+ ${FILESDIR}/${PN}-fixmp.patch
+ ${FILESDIR}/${PN}-${RV}-pmc.patch
+ ${FILESDIR}/${PN}-${RV}-gccfloat.patch
+ ${FILESDIR}/${PN}-${RV}-flex-2.5.31.patch
+ ${FILESDIR}/${PN}-${RV}-binutils-asm.patch"
+
+# Here we disable and remove source which we don't need or want
+# In order:
+# - ncurses stuff
+# - archiving libraries (have their own ebuild)
+# - sendmail libraries (they are installed by sendmail)
+# - SNMP library and dependency (have their own ebuilds)
+#
+# 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="libncurses libform libmenu libpanel \
+ libz libbz2 libarchive \
+ libsm libsmdb libsmutil \
+ libbegemot libbsnmp \
+ libsmb libpam libpcap bind libwrap libmagic \
+ libcom_err libtelnet"
+
+src_unpack() {
+ freebsd_src_unpack
+
+ if [[ ${CTARGET} == ${CHOST} ]]; then
+ ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys"
+ else
+ sed -i -e 's:/usr/include:/usr/'${CTARGET}'/usr/include:g' \
+ "${S}/libc/"{yp,rpc}"/Makefile.inc"
+ fi
+
+ [[ -n $(install --version 2> /dev/null | grep GNU) ]] && \
+ sed -i -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile"
+
+ sed -i -e 's:-o/dev/stdout:-t:' ${S}/libc/net/Makefile.inc
+ epatch "${FILESDIR}/${PN}-${RV}-ssp.patch"
+}
+
+src_compile() {
+ cd "${WORKDIR}/include"
+ $(freebsd_get_bmake) CC=$(tc-getCC) || die "make include failed"
+
+ use _E_CROSS_HEADERS_ONLY && return 0
+
+ append-flags -fno-stack-protector # Don't use ssp until properly fixed
+
+ if [[ ${CTARGET} != ${CHOST} ]]; then
+ export YACC='yacc -by'
+ CHOST=${CTARGET} tc-export CC LD CXX
+
+ local machine
+ machine=$(tc-arch-kernel ${CTARGET})
+
+ local csudir
+ if [[ -d "${S}/csu/${machine}-elf" ]]; then
+ csudir="${S}/csu/${machine}-elf"
+ else
+ csudir="${S}/csu/${machine}"
+ fi
+ cd "${csudir}"
+ $(freebsd_get_bmake) ${mymakeopts} || die "make csu failed"
+
+ append-flags "-isystem /usr/${CTARGET}/usr/include"
+ append-flags "-B ${csudir}"
+ append-ldflags "-B ${csudir}"
+ cd "${S}/libc"
+ $(freebsd_get_bmake) ${mymakeopts} || die "make libc failed"
+
+ append-flags "-isystem ${WORKDIR}/lib/msun/${machine/i386/i387}"
+ cd "${S}/msun"
+ $(freebsd_get_bmake) ${mymakeopts} || die "make libc failed"
+ else
+ cd "${S}"
+ freebsd_src_compile
+ fi
+}
+
+src_install() {
+ cd "${WORKDIR}/include"
+
+ [[ ${CTARGET} == ${CHOST} ]] \
+ && INCLUDEDIR="/usr/include" \
+ || INCLUDEDIR="/usr/${CTARGET}/usr/include"
+
+ einfo "Installing for ${CTARGET} in ${CHOST}.."
+
+ dodir "${INCLUDEDIR}"
+ $(freebsd_get_bmake) installincludes \
+ MACHINE=$(tc-arch-kernel) \
+ DESTDIR="${D}" INCLUDEDIR="${INCLUDEDIR}" || die "Install failed"
+
+ # Install math.h when crosscompiling, at this point
+ if [[ ${CHOST} != ${CTARGET} ]]; then
+ insinto "/usr/${CTARGET}/usr/include"
+ doins "${S}/msun/src/math.h"
+ fi
+
+ use _E_CROSS_HEADERS_ONLY && return 0
+
+ if [[ ${CTARGET} != ${CHOST} ]]; then
+ local csudir
+ if [[ -d "${S}/csu/$(tc-arch-kernel ${CTARGET})-elf" ]]; then
+ csudir="${S}/csu/$(tc-arch-kernel ${CTARGET})-elf"
+ else
+ csudir="${S}/csu/$(tc-arch-kernel ${CTARGET})"
+ fi
+ cd "${csudir}"
+ $(freebsd_get_bmake) ${mymakeopts} DESTDIR="${D}" install \
+ FILESDIR="/usr/${CTARGET}/usr/lib" || die "Install csu failed"
+
+ cd "${S}/libc"
+ $(freebsd_get_bmake) ${mymakeopts} DESTDIR="${D}" install NO_MAN= \
+ SHLIBDIR="/usr/${CTARGET}/lib" LIBDIR="/usr/${CTARGET}/usr/lib" || die "Install failed"
+
+ cd "${S}/msun"
+ $(freebsd_get_bmake) ${mymakeopts} DESTDIR="${D}" install NO_MAN= \
+ INCLUDEDIR="/usr/${CTARGET}/usr/include" \
+ SHLIBDIR="/usr/${CTARGET}/lib" LIBDIR="/usr/${CTARGET}/usr/lib" || die "Install failed"
+
+ dosym "usr/include" "/usr/${CTARGET}/sys-include"
+ else
+ cd "${S}"
+ mkinstall || die "Install failed"
+ fi
+
+ # Don't install the rest of the configuration files if crosscompiling
+ [[ ${CTARGET} != ${CHOST} ]] && return 0
+
+ # install libstand files
+ dodir /usr/include/libstand
+ insinto /usr/include/libstand
+ doins ${S}/libstand/*.h
+
+ cd ${WORKDIR}/etc/
+ insinto /etc
+ doins auth.conf nls.alias mac.conf netconfig
+
+ # Install ttys file
+ doins "etc.$(tc-arch-kernel)"/*
+}
+