From 3804ac39becf1496d369969dd440951c3f34287e Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 22 Dec 2017 11:48:50 +0300 Subject: llvm-5-git from gentoo //they have removed 5x git ebuilds after release --- dev-util/lldb/lldb-5.0.9999.ebuild | 120 +++++++++ .../clang-runtime/clang-runtime-5.0.9999.ebuild | 26 ++ sys-devel/clang/clang-5.0.9999.ebuild | 289 +++++++++++++++++++++ sys-devel/lld/lld-5.0.9999.ebuild | 74 ++++++ sys-devel/llvm-common/llvm-common-5.0.9999.ebuild | 37 +++ sys-devel/llvm/llvm-5.0.9999.ebuild | 230 ++++++++++++++++ .../compiler-rt-sanitizers-5.0.9999.ebuild | 134 ++++++++++ sys-libs/compiler-rt/compiler-rt-5.0.9999.ebuild | 100 +++++++ sys-libs/libcxx/libcxx-5.0.9999.ebuild | 212 +++++++++++++++ sys-libs/libcxxabi/libcxxabi-5.0.9999.ebuild | 97 +++++++ sys-libs/libomp/libomp-5.0.9999.ebuild | 74 ++++++ 11 files changed, 1393 insertions(+) create mode 100644 dev-util/lldb/lldb-5.0.9999.ebuild create mode 100644 sys-devel/clang-runtime/clang-runtime-5.0.9999.ebuild create mode 100644 sys-devel/clang/clang-5.0.9999.ebuild create mode 100644 sys-devel/lld/lld-5.0.9999.ebuild create mode 100644 sys-devel/llvm-common/llvm-common-5.0.9999.ebuild create mode 100644 sys-devel/llvm/llvm-5.0.9999.ebuild create mode 100644 sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-5.0.9999.ebuild create mode 100644 sys-libs/compiler-rt/compiler-rt-5.0.9999.ebuild create mode 100644 sys-libs/libcxx/libcxx-5.0.9999.ebuild create mode 100644 sys-libs/libcxxabi/libcxxabi-5.0.9999.ebuild create mode 100644 sys-libs/libomp/libomp-5.0.9999.ebuild diff --git a/dev-util/lldb/lldb-5.0.9999.ebuild b/dev-util/lldb/lldb-5.0.9999.ebuild new file mode 100644 index 0000000..63218bc --- /dev/null +++ b/dev-util/lldb/lldb-5.0.9999.ebuild @@ -0,0 +1,120 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit cmake-utils git-r3 llvm python-single-r1 toolchain-funcs + +DESCRIPTION="The LLVM debugger" +HOMEPAGE="https://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/lldb.git + https://github.com/llvm-mirror/lldb.git" +EGIT_BRANCH="release_50" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="" +IUSE="libedit ncurses python test" +RESTRICT="!test? ( test )" + +RDEPEND=" + libedit? ( dev-libs/libedit:0= ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:0= ) + python? ( dev-python/six[${PYTHON_USEDEP}] + ${PYTHON_DEPS} ) + ~sys-devel/clang-${PV}[xml] + ~sys-devel/llvm-${PV} + ! clang-X.Y + # - clang++, clang-cl, clang-cpp -> clang + # we want to have: + # - clang-X.Y + # - clang++-X.Y, clang-cl-X.Y, clang-cpp-X.Y -> clang-X.Y + # - clang, clang++, clang-cl, clang-cpp -> clang*-X.Y + # also in CHOST variant + for i in "${clang_tools[@]:1}"; do + rm "${ED%/}/usr/lib/llvm/${SLOT}/bin/${i}" || die + dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}-${clang_version}" + dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}" + done + + # now create target symlinks for all supported ABIs + for abi in $(get_all_abis); do + local abi_chost=$(get_abi_CHOST "${abi}") + for i in "${clang_tools[@]}"; do + dosym "${i}-${clang_version}" \ + "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}-${clang_version}" + dosym "${abi_chost}-${i}-${clang_version}" \ + "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}" + done + done + + # Remove unnecessary headers on FreeBSD, bug #417171 + if use kernel_FreeBSD; then + rm "${ED}"usr/lib/clang/${clang_full_version}/include/{std,float,iso,limits,tgmath,varargs}*.h || die + fi +} + +multilib_src_install() { + cmake-utils_src_install + + # move headers to /usr/include for wrapping & ABI mismatch checks + # (also drop the version suffix from runtime headers) + rm -rf "${ED%/}"/usr/include || die + mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die + mv "${ED%/}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED%/}"/usr/include/clangrt || die +} + +multilib_src_install_all() { + python_fix_shebang "${ED}" + if use static-analyzer; then + python_optimize "${ED}"usr/lib/llvm/${SLOT}/share/scan-view + fi + + docompress "/usr/lib/llvm/${SLOT}/share/man" + # match 'html' non-compression + use doc && docompress -x "/usr/share/doc/${PF}/tools-extra" + # +x for some reason; TODO: investigate + use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT}/share/man/man1/scan-build.1" +} + +pkg_postinst() { + if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then + eselect compiler-shadow update all + fi +} + +pkg_postrm() { + if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then + eselect compiler-shadow clean all + fi +} diff --git a/sys-devel/lld/lld-5.0.9999.ebuild b/sys-devel/lld/lld-5.0.9999.ebuild new file mode 100644 index 0000000..018ca40 --- /dev/null +++ b/sys-devel/lld/lld-5.0.9999.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit cmake-utils git-r3 llvm python-any-r1 + +DESCRIPTION="The LLVM linker (link editor)" +HOMEPAGE="https://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/lld.git + https://github.com/llvm-mirror/lld.git" +EGIT_BRANCH="release_50" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND="~sys-devel/llvm-${PV}" +DEPEND="${RDEPEND} + test? ( $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]") )" + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + LLVM_MAX_SLOT=${PV%%.*} llvm_pkg_setup + use test && python-any-r1_pkg_setup +} + +src_unpack() { + if use test; then + # needed for patched gtest + git-r3_fetch "https://git.llvm.org/git/llvm.git + https://github.com/llvm-mirror/llvm.git" + fi + git-r3_fetch + + if use test; then + git-r3_checkout https://llvm.org/git/llvm.git \ + "${WORKDIR}"/llvm '' utils/{lit,unittest} + fi + git-r3_checkout +} + +src_configure() { + local mycmakeargs=( + -DBUILD_SHARED_LIBS=ON + + -DLLVM_INCLUDE_TESTS=$(usex test) + ) + use test && mycmakeargs+=( + -DLLVM_BUILD_TESTS=ON + -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" + -DLIT_COMMAND="${EPREFIX}/usr/bin/lit" + ) + + cmake-utils_src_configure +} + +src_test() { + cmake-utils_src_make check-lld +} diff --git a/sys-devel/llvm-common/llvm-common-5.0.9999.ebuild b/sys-devel/llvm-common/llvm-common-5.0.9999.ebuild new file mode 100644 index 0000000..cc7ed2a --- /dev/null +++ b/sys-devel/llvm-common/llvm-common-5.0.9999.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit git-r3 + +DESCRIPTION="Common files shared between multiple slots of LLVM" +HOMEPAGE="https://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/llvm.git + https://github.com/llvm-mirror/llvm.git" +EGIT_BRANCH="release_50" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="" +IUSE="" + +RDEPEND="!sys-devel/llvm:0" + +src_unpack() { + git-r3_fetch + git-r3_checkout '' '' '' utils/vim +} + +src_configure() { :; } +src_compile() { :; } +src_test() { :; } + +src_install() { + insinto /usr/share/vim/vimfiles + doins -r utils/vim/*/ + # some users may find it useful + newdoc utils/vim/README README.vim + dodoc utils/vim/vimrc +} diff --git a/sys-devel/llvm/llvm-5.0.9999.ebuild b/sys-devel/llvm/llvm-5.0.9999.ebuild new file mode 100644 index 0000000..f41a0c9 --- /dev/null +++ b/sys-devel/llvm/llvm-5.0.9999.ebuild @@ -0,0 +1,230 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit cmake-utils eapi7-ver flag-o-matic git-r3 multilib-minimal \ + pax-utils python-any-r1 toolchain-funcs + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="https://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/llvm.git + https://github.com/llvm-mirror/llvm.git" +EGIT_BRANCH="release_50" + +# Keep in sync with CMakeLists.txt +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 + NVPTX PowerPC Sparc SystemZ X86 XCore ) +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) + +# Additional licenses: +# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD. +# 2. ARM backend: LLVM Software Grant by ARM. +# 3. MD5 code: public-domain. +# 4. Tests (not installed): +# a. gtest: BSD. +# b. YAML tests: MIT. + +LICENSE="UoI-NCSA rc BSD public-domain + llvm_targets_ARM? ( LLVM-Grant )" +SLOT="$(ver_cut 1)" +KEYWORDS="" +IUSE="debug doc gold libedit +libffi ncurses test + kernel_Darwin ${ALL_LLVM_TARGETS[*]}" +RESTRICT="!test? ( test )" + +RDEPEND=" + sys-libs/zlib:0= + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${RDEPEND} + dev-lang/perl + || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + kernel_Darwin? ( "${T}/10llvm-${revord}" || die + PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin" + # we need to duplicate it in ROOTPATH for Portage to respect... + ROOTPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin" + MANPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" + LDPATH="$( IFS=:; echo "${LLVM_LDPATHS[*]}" )" +_EOF_ + doenvd "${T}/10llvm-${revord}" + + docompress "/usr/lib/llvm/${SLOT}/share/man" +} diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-5.0.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-5.0.9999.ebuild new file mode 100644 index 0000000..f1c9f6b --- /dev/null +++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-5.0.9999.ebuild @@ -0,0 +1,134 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit check-reqs cmake-utils flag-o-matic git-r3 llvm python-any-r1 + +DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)" +HOMEPAGE="https://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/compiler-rt.git + https://github.com/llvm-mirror/compiler-rt.git" +EGIT_BRANCH="release_50" + +LICENSE="|| ( UoI-NCSA MIT )" +# Note: this needs to be updated to match version of clang-9999 +SLOT="5.0.1" +KEYWORDS="" +IUSE="test" + +LLVM_SLOT=${SLOT%%.*} +# llvm-4 needed for --cmakedir +DEPEND=" + >=sys-devel/llvm-4 + test? ( + app-portage/unsandbox + $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]") + =sys-devel/clang-${PV%_*}*:${LLVM_SLOT} + sys-libs/compiler-rt:${SLOT} ) + ${PYTHON_DEPS}" + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +check_space() { + if use test; then + local CHECKREQS_DISK_BUILD=11G + check-reqs_pkg_pretend + fi +} + +pkg_pretend() { + check_space +} + +pkg_setup() { + check_space + llvm_pkg_setup + python-any-r1_pkg_setup +} + +src_unpack() { + if use test; then + # needed for patched gtest + git-r3_fetch "https://git.llvm.org/git/llvm.git + https://github.com/llvm-mirror/llvm.git" + fi + git-r3_fetch + + if use test; then + git-r3_checkout https://llvm.org/git/llvm.git \ + "${WORKDIR}"/llvm '' utils/unittest + fi + git-r3_checkout +} + +src_configure() { + # pre-set since we need to pass it to cmake + BUILD_DIR=${WORKDIR}/${P}_build + + local mycmakeargs=( + -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}" + # use a build dir structure consistent with install + # this makes it possible to easily deploy test-friendly clang + -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}" + + -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) + # built-ins installed by sys-libs/compiler-rt + -DCOMPILER_RT_BUILD_BUILTINS=OFF + -DCOMPILER_RT_BUILD_SANITIZERS=ON + -DCOMPILER_RT_BUILD_XRAY=ON + ) + if use test; then + mycmakeargs+=( + -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" + -DLIT_COMMAND="${EPREFIX}/usr/bin/unsandbox;${EPREFIX}/usr/bin/lit" + + # they are created during src_test() + -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang" + -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang++" + ) + + # same flags are passed for build & tests, so we need to strip + # them down to a subset supported by clang + CC=${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang \ + CXX=${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang++ \ + strip-unsupported-flags + fi + + cmake-utils_src_configure + + if use test; then + local sys_dir=( "${EPREFIX}"/usr/lib/clang/${SLOT}/lib/* ) + [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}" + [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}" + + # copy clang over since resource_dir is located relatively to binary + # therefore, we can put our new libraries in it + mkdir -p "${BUILD_DIR}"/lib/{llvm/${LLVM_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die + cp "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/bin/clang{,++} \ + "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/bin/ || die + cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \ + "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die + cp "${sys_dir}"/*builtins*.a \ + "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die + # we also need LLVMgold.so for gold-based tests + if [[ -f ${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so ]]; then + ln -s "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so \ + "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/$(get_libdir)/ || die + fi + fi +} + +src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + + cmake-utils_src_make check-all +} diff --git a/sys-libs/compiler-rt/compiler-rt-5.0.9999.ebuild b/sys-libs/compiler-rt/compiler-rt-5.0.9999.ebuild new file mode 100644 index 0000000..460f6da --- /dev/null +++ b/sys-libs/compiler-rt/compiler-rt-5.0.9999.ebuild @@ -0,0 +1,100 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit cmake-utils flag-o-matic git-r3 llvm python-any-r1 toolchain-funcs + +DESCRIPTION="Compiler runtime library for clang (built-in part)" +HOMEPAGE="https://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/compiler-rt.git + https://github.com/llvm-mirror/compiler-rt.git" +EGIT_BRANCH="release_50" + +LICENSE="|| ( UoI-NCSA MIT )" +# Note: this needs to be updated to match version of clang-9999 +SLOT="5.0.1" +KEYWORDS="" +IUSE="+clang test" +RESTRICT="!test? ( test ) !clang? ( test )" + +LLVM_SLOT=${SLOT%%.*} +# llvm-4 needed for --cmakedir +DEPEND=" + >=sys-devel/llvm-4 + clang? ( sys-devel/clang ) + test? ( + $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]") + =sys-devel/clang-${PV%_*}*:${LLVM_SLOT} ) + ${PYTHON_DEPS}" + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +pkg_pretend() { + if ! use clang && ! tc-is-clang; then + ewarn "Building using a compiler other than clang may result in broken atomics" + ewarn "library. Enable USE=clang unless you have a very good reason not to." + fi +} + +pkg_setup() { + llvm_pkg_setup + python-any-r1_pkg_setup +} + +test_compiler() { + $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \ + <<<'int main() { return 0; }' &>/dev/null +} + +src_configure() { + # pre-set since we need to pass it to cmake + BUILD_DIR=${WORKDIR}/${P}_build + + local nolib_flags=( -nodefaultlibs -lc ) + if use clang; then + local -x CC=${CHOST}-clang + local -x CXX=${CHOST}-clang++ + # ensure we can use clang before installing compiler-rt + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}" + strip-unsupported-flags + elif ! test_compiler; then + if test_compiler "${nolib_flags[@]}"; then + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}" + ewarn "${CC} seems to lack runtime, trying with ${nolib_flags[*]}" + fi + fi + + local mycmakeargs=( + -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}" + + -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) + -DCOMPILER_RT_BUILD_SANITIZERS=OFF + -DCOMPILER_RT_BUILD_XRAY=OFF + ) + + if use test; then + mycmakeargs+=( + -DLIT_COMMAND="${EPREFIX}/usr/bin/lit" + + -DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang" + -DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang++" + ) + fi + + cmake-utils_src_configure +} + +src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + + cmake-utils_src_make check-builtins +} diff --git a/sys-libs/libcxx/libcxx-5.0.9999.ebuild b/sys-libs/libcxx/libcxx-5.0.9999.ebuild new file mode 100644 index 0000000..bd31b16 --- /dev/null +++ b/sys-libs/libcxx/libcxx-5.0.9999.ebuild @@ -0,0 +1,212 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +# Ninja provides better scalability and cleaner verbose output, and is used +# throughout all LLVM projects. +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +EGIT_REPO_URI="https://git.llvm.org/git/libcxx.git + https://github.com/llvm-mirror/libcxx.git" +EGIT_BRANCH="release_50" +PYTHON_COMPAT=( python2_7 ) + +[[ ${PV} == *9999 ]] && SCM="git-r3" || SCM="" + +inherit ${SCM} cmake-multilib llvm python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +if [[ ${PV} != *9999 ]] ; then + SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz" + S="${WORKDIR}/${P}.src" +else + SRC_URI="" +fi + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +if [[ ${PV} != *9999 ]] ; then + KEYWORDS="~amd64 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" +else + KEYWORDS="" +fi +IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test" +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) ) + ?? ( libcxxabi libcxxrt )" +RESTRICT="!test? ( test )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )" +# LLVM 4 required for llvm-config --cmakedir +# clang-3.9.0 installs necessary target symlinks unconditionally +# which removes the need for MULTILIB_USEDEP +DEPEND="${RDEPEND} + test? ( >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') ) + app-arch/xz-utils + >=sys-devel/llvm-4" + +DOCS=( CREDITS.TXT ) + +PATCHES=( + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a + # out-of-tree build. + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" +) + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + llvm_pkg_setup + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then + eerror "To build ${PN} against libsupc++, you have to use gcc. Other" + eerror "compilers are not supported. Please set CC=gcc and CXX=g++" + eerror "and try again." + die + fi + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later (or other" + eerror "conformant compilers). Please use gcc-config to switch to" + eerror "gcc-4.7 or later version." + die + fi +} + +multilib_src_configure() { + local cxxabi cxxabi_incs + if use libcxxabi; then + cxxabi=libcxxabi + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi" + elif use libcxxrt; then + cxxabi=libcxxrt + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt" + else + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)" + cxxabi=libsupc++ + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" + fi + + # we want -lgcc_s for unwinder, and for compiler runtime when using + # gcc, clang with gcc runtime (or any unknown compiler) + local extra_libs=() want_gcc_s=ON + if use libunwind; then + # work-around missing -lunwind upstream + extra_libs+=( -lunwind ) + # if we're using libunwind and clang with compiler-rt, we want + # to link to compiler-rt instead of -lgcc_s + if tc-is-clang; then + # get the full library list out of 'pretend mode' + # and grep it for libclang_rt references + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) ) + local i + for i in "${args[@]}"; do + if [[ ${i} == *libclang_rt* ]]; then + want_gcc_s=OFF + extra_libs+=( "${i}" ) + fi + done + fi + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib} + -DLIBCXX_ENABLE_SHARED=ON + -DLIBCXX_ENABLE_STATIC=$(usex static-libs) + -DLIBCXX_CXX_ABI=${cxxabi} + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs} + # we're using our own mechanism for generating linker scripts + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s} + -DLIBCXX_INCLUDE_TESTS=$(usex test) + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" + ) + + if use test; then + mycmakeargs+=( + # this can be any directory, it just needs to exist... + # FIXME: remove this once https://reviews.llvm.org/D25093 is merged + -DLLVM_MAIN_SRC_DIR="${T}" + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit + ) + fi + cmake-utils_src_configure +} + +multilib_src_test() { + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) + + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die + + cmake-utils_src_make check-libcxx +} + +# Usage: deps +gen_ldscript() { + 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 <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + local libdir=$(get_libdir) + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")") + + # Move it first. + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps+=" libpthread.a libdl.a" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die +} + +gen_shared_ldscript() { + local libdir=$(get_libdir) + # libsupc++ doesn't have a shared version + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")") + + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die +} + +multilib_src_install() { + cmake-utils_src_install + gen_shared_ldscript + use static-libs && gen_static_ldscript +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxxabi/libcxxabi-5.0.9999.ebuild b/sys-libs/libcxxabi/libcxxabi-5.0.9999.ebuild new file mode 100644 index 0000000..e0e65a3 --- /dev/null +++ b/sys-libs/libcxxabi/libcxxabi-5.0.9999.ebuild @@ -0,0 +1,97 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit cmake-multilib git-r3 llvm python-any-r1 + +DESCRIPTION="Low level support for a standard C++ library" +HOMEPAGE="https://libcxxabi.llvm.org/" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/libcxxabi.git + https://github.com/llvm-mirror/libcxxabi.git" +EGIT_BRANCH="release_50" + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +KEYWORDS="" +IUSE="+libunwind +static-libs test" +RESTRICT="!test? ( test )" + +RDEPEND=" + libunwind? ( + || ( + >=sys-libs/libunwind-1.0.1-r1[static-libs?,${MULTILIB_USEDEP}] + >=sys-libs/llvm-libunwind-3.9.0-r1[static-libs?,${MULTILIB_USEDEP}] + ) + )" +# LLVM 4 required for llvm-config --cmakedir +DEPEND="${RDEPEND} + >=sys-devel/llvm-4 + test? ( >=sys-devel/clang-3.9.0 + ~sys-libs/libcxx-${PV}[libcxxabi(-)] + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )" + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + llvm_pkg_setup + use test && python-any-r1_pkg_setup +} + +src_unpack() { + # we need the headers + git-r3_fetch "https://git.llvm.org/git/libcxx.git + https://github.com/llvm-mirror/libcxx.git" + git-r3_fetch + + git-r3_checkout https://llvm.org/git/libcxx.git \ + "${WORKDIR}"/libcxx '' include utils/libcxx + git-r3_checkout +} + +multilib_src_configure() { + local libdir=$(get_libdir) + local mycmakeargs=( + -DLIBCXXABI_LIBDIR_SUFFIX=${libdir#lib} + -DLIBCXXABI_ENABLE_SHARED=ON + -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs) + -DLIBCXXABI_USE_LLVM_UNWINDER=$(usex libunwind) + -DLIBCXXABI_INCLUDE_TESTS=$(usex test) + + -DLIBCXXABI_LIBCXX_INCLUDES="${WORKDIR}"/libcxx/include + # upstream is omitting standard search path for this + # probably because gcc & clang are bundling their own unwind.h + -DLIBCXXABI_LIBUNWIND_INCLUDES="${EPREFIX}"/usr/include + ) + if use test; then + mycmakeargs+=( + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit + ) + fi + cmake-utils_src_configure +} + +multilib_src_test() { + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) + + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die + + cmake-utils_src_make check-libcxxabi +} + +multilib_src_install_all() { + insinto /usr/include/libcxxabi + doins -r include/. +} diff --git a/sys-libs/libomp/libomp-5.0.9999.ebuild b/sys-libs/libomp/libomp-5.0.9999.ebuild new file mode 100644 index 0000000..fc51f56 --- /dev/null +++ b/sys-libs/libomp/libomp-5.0.9999.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit cmake-multilib git-r3 python-any-r1 + +DESCRIPTION="OpenMP runtime library for LLVM/clang compiler" +HOMEPAGE="https://openmp.llvm.org" +SRC_URI="" +EGIT_REPO_URI="https://git.llvm.org/git/openmp.git + https://github.com/llvm-mirror/openmp.git" +EGIT_BRANCH="release_50" + +# Additional licenses: +# - MIT-licensed Intel code, +# - LLVM Software Grant from Intel. + +LICENSE="|| ( UoI-NCSA MIT ) MIT LLVM-Grant" +SLOT="0" +KEYWORDS="" +IUSE="hwloc ompt test" +RESTRICT="!test? ( test )" + +RDEPEND="hwloc? ( sys-apps/hwloc:0=[${MULTILIB_USEDEP}] )" +# tests: +# - dev-python/lit provides the test runner +# - sys-devel/llvm provide test utils (e.g. FileCheck) +# - sys-devel/clang provides the compiler to run tests +DEPEND="${RDEPEND} + dev-lang/perl + test? ( + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') + sys-devel/llvm + >=sys-devel/clang-3.9.0 + )" + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + use test && python-any-r1_pkg_setup +} + +multilib_src_configure() { + local libdir="$(get_libdir)" + local mycmakeargs=( + -DLIBOMP_LIBDIR_SUFFIX="${libdir#lib}" + -DLIBOMP_USE_HWLOC=$(usex hwloc) + -DLIBOMP_OMPT_SUPPORT=$(usex ompt) + # do not install libgomp.so & libiomp5.so aliases + -DLIBOMP_INSTALL_ALIASES=OFF + # disable unnecessary hack copying stuff back to srcdir + -DLIBOMP_COPY_EXPORTS=OFF + -DLIBOMP_TEST_COMPILER="$(type -P "${CHOST}-clang")" + ) + cmake-utils_src_configure +} + +multilib_src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + + cmake-utils_src_make check-libomp +} -- cgit v1.2.3