diff options
author | Alexis Ballier <aballier@gentoo.org> | 2012-05-31 20:48:43 +0000 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2012-05-31 20:48:43 +0000 |
commit | 31fccd5c937216c710ff7999b978b6e0acb69606 (patch) | |
tree | ac83664daee78a2cf8f1d034f68fc296945922e4 /sys-libs | |
parent | Bump LeechCraft to 0.5.70 "Hessian Blade" (diff) | |
download | gentoo-2-31fccd5c937216c710ff7999b978b6e0acb69606.tar.gz gentoo-2-31fccd5c937216c710ff7999b978b6e0acb69606.tar.bz2 gentoo-2-31fccd5c937216c710ff7999b978b6e0acb69606.zip |
Use our own makefiles, its so simple that we do not need to rely on cmake for this. Build it on top of libunwind instead of using libgcc_s for unwinding. Remove their libunwind bundled headers and ship a reduced one with only the added macros libcxxrt needs. Build with -nodefaultlibs to ensure we do not link to gcc libs. Add static-libs useflag. Give it a src_test.
(Portage version: 2.2.0_alpha108/cvs/Linux x86_64)
Diffstat (limited to 'sys-libs')
-rw-r--r-- | sys-libs/libcxxrt/ChangeLog | 10 | ||||
-rw-r--r-- | sys-libs/libcxxrt/files/Makefile | 23 | ||||
-rw-r--r-- | sys-libs/libcxxrt/files/Makefile.test | 7 | ||||
-rw-r--r-- | sys-libs/libcxxrt/files/unwind.h | 94 | ||||
-rw-r--r-- | sys-libs/libcxxrt/libcxxrt-9999.ebuild | 39 |
5 files changed, 160 insertions, 13 deletions
diff --git a/sys-libs/libcxxrt/ChangeLog b/sys-libs/libcxxrt/ChangeLog index 34cd83992446..24ed7cbb0d7d 100644 --- a/sys-libs/libcxxrt/ChangeLog +++ b/sys-libs/libcxxrt/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-libs/libcxxrt # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/libcxxrt/ChangeLog,v 1.1 2012/05/28 13:58:04 aballier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libcxxrt/ChangeLog,v 1.2 2012/05/31 20:48:43 aballier Exp $ + + 31 May 2012; Alexis Ballier <aballier@gentoo.org> libcxxrt-9999.ebuild, + +files/Makefile, +files/Makefile.test, +files/unwind.h: + Use our own makefiles, its so simple that we do not need to rely on cmake for + this. Build it on top of libunwind instead of using libgcc_s for unwinding. + Remove their libunwind bundled headers and ship a reduced one with only the + added macros libcxxrt needs. Build with -nodefaultlibs to ensure we do not + link to gcc libs. Add static-libs useflag. Give it a src_test. *libcxxrt-9999 (28 May 2012) *libcxxrt-0.0_p20120528 (28 May 2012) diff --git a/sys-libs/libcxxrt/files/Makefile b/sys-libs/libcxxrt/files/Makefile new file mode 100644 index 000000000000..18b90a7cf712 --- /dev/null +++ b/sys-libs/libcxxrt/files/Makefile @@ -0,0 +1,23 @@ +LIB=cxxrt +MAJ=1 +OBJS=dynamic_cast.o exception.o guard.o stdexcept.o typeinfo.o memory.o auxhelper.o libelftc_dem_gnu3.o +SOBJS=${OBJS:.o=.So} + +static: lib$(LIB).a + +shared: lib$(LIB).so + +%.So: %.cc + $(CXX) -fPIC $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +%.So: %.c + $(CC) -fPIC $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +lib$(LIB).a: $(OBJS) + $(AR) cr $@ $^ + +lib$(LIB).so.$(MAJ): $(SOBJS) + $(CXX) -fPIC -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^ $(LIBS) + +lib$(LIB).so: lib$(LIB).so.$(MAJ) + ln -s $< $@ diff --git a/sys-libs/libcxxrt/files/Makefile.test b/sys-libs/libcxxrt/files/Makefile.test new file mode 100644 index 000000000000..55099426e7b4 --- /dev/null +++ b/sys-libs/libcxxrt/files/Makefile.test @@ -0,0 +1,7 @@ +OBJS=test.o test_exception.o test_guard.o test_typeinfo.o + +cxxrttest: $(OBJS) + $(CXX) -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + +check: cxxrttest + ./cxxrttest diff --git a/sys-libs/libcxxrt/files/unwind.h b/sys-libs/libcxxrt/files/unwind.h new file mode 100644 index 000000000000..04b1f1d18b8f --- /dev/null +++ b/sys-libs/libcxxrt/files/unwind.h @@ -0,0 +1,94 @@ +/* + * Copyright 2012 David Chisnall. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include_next <unwind.h> + +#ifndef CXXRT_UNWIND_H_INCLUDED +#define CXXRT_UNWIND_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __arm__ +#define DECLARE_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(_Unwind_State state,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context); + +#define BEGIN_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(_Unwind_State state,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context)\ +{\ + int version = 1;\ + uint64_t exceptionClass = exceptionObject->exception_class;\ + int actions;\ + switch (state)\ + {\ + default: return _URC_FAILURE;\ + case _US_VIRTUAL_UNWIND_FRAME:\ + {\ + actions = _UA_SEARCH_PHASE;\ + break;\ + }\ + case _US_UNWIND_FRAME_STARTING:\ + {\ + actions = _UA_CLEANUP_PHASE;\ + if (exceptionObject->barrier_cache.sp == _Unwind_GetGR(context, 13))\ + {\ + actions |= _UA_HANDLER_FRAME;\ + }\ + break;\ + }\ + case _US_UNWIND_FRAME_RESUME:\ + {\ + return continueUnwinding(exceptionObject, context);\ + break;\ + }\ + }\ + _Unwind_SetGR (context, 12, (unsigned long)exceptionObject);\ + +#define CALL_PERSONALITY_FUNCTION(name) name(state,exceptionObject,context) +#else +#define DECLARE_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(int version,\ + _Unwind_Action actions,\ + uint64_t exceptionClass,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context); +#define BEGIN_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(int version,\ + _Unwind_Action actions,\ + uint64_t exceptionClass,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context)\ +{ + +#define CALL_PERSONALITY_FUNCTION(name) name(version, actions, exceptionClass, exceptionObject, context) +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sys-libs/libcxxrt/libcxxrt-9999.ebuild b/sys-libs/libcxxrt/libcxxrt-9999.ebuild index 3d47de5158c0..aed04fc631d1 100644 --- a/sys-libs/libcxxrt/libcxxrt-9999.ebuild +++ b/sys-libs/libcxxrt/libcxxrt-9999.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/libcxxrt/libcxxrt-9999.ebuild,v 1.1 2012/05/28 13:58:04 aballier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libcxxrt/libcxxrt-9999.ebuild,v 1.2 2012/05/31 20:48:43 aballier Exp $ EAPI=4 @@ -8,7 +8,7 @@ EGIT_REPO_URI="git://github.com/pathscale/libcxxrt.git" [ "${PV%9999}" != "${PV}" ] && SCM="git-2" || SCM="" -inherit cmake-utils ${SCM} base flag-o-matic +inherit base flag-o-matic toolchain-funcs portability ${SCM} DESCRIPTION="C++ Runtime from PathScale, FreeBSD and NetBSD." HOMEPAGE="https://github.com/pathscale/libcxxrt http://www.pathscale.com/node/265" @@ -26,29 +26,44 @@ if [ "${PV%9999}" = "${PV}" ] ; then else KEYWORDS="" fi -IUSE="" +IUSE="static-libs" -RDEPEND="" +RDEPEND=">=sys-libs/libunwind-1.0.1-r1" DEPEND="${RDEPEND} ${DEPEND}" -PATCHES=( "${FILESDIR}/0001-Link-to-libdl-where-needed-for-dladdr-exception.cc.patch" ) - src_prepare() { base_src_prepare + cp "${FILESDIR}/Makefile" src/ || die + cp "${FILESDIR}/Makefile.test" test/Makefile || die + rm -f src/unwind* || die + cp -f "${FILESDIR}/unwind.h" src/ || die +} + +src_compile() { + # Notes: we build -nodefaultlibs to avoid linking to gcc libs. + # libcxxrt needs: dladdr (dlopen_lib), libunwind (or libgcc_s but we build + # over libunwind) and the libc. + tc-export CC CXX AR + append-ldflags "-Wl,-z,defs" # make sure we are not underlinked + cd "${S}/src" + LIBS="$(dlopen_lib) -lunwind -lc" emake shared + use static-libs && emake static +} + +src_test() { + cd "${S}/test" + LD_LIBRARY_PATH="${S}/src:${LD_LIBRARY_PATH}" LIBS="-L${S}/src -lcxxrt -lc" emake check } src_install() { # TODO: See README. Maybe hide it in a subdir and let only libcxx know about # it. FreeBSD head installs it in /lib - cd "${CMAKE_BUILD_DIR}" - dolib.so lib/${PN}.so - dolib.a lib/${PN}.a - - cd "${S}" + dolib.so src/${PN}.so* + use static-libs && dolib.a src/${PN}.a insinto /usr/include/libcxxrt/ - doins src/cxxabi.h src/unwind*.h + doins src/cxxabi.h dodoc AUTHORS COPYRIGHT README } |