sys-libs/tapi: initial ebuild by Michael Weiser, bug #609436
authorFabian Groffen <grobian@gentoo.org>
Sun, 26 Feb 2017 17:36:14 +0000 (18:36 +0100)
committerFabian Groffen <grobian@gentoo.org>
Sun, 26 Feb 2017 19:06:16 +0000 (20:06 +0100)
Package-Manager: Portage-2.3.3, Repoman-2.3.1

sys-libs/tapi/Manifest [new file with mode: 0644]
sys-libs/tapi/files/tapi-1.30-allow-all-clients.patch [new file with mode: 0644]
sys-libs/tapi/files/tapi-1.30-llvm-config.patch [new file with mode: 0644]
sys-libs/tapi/files/tapi-1.30-llvm-new-error-api.patch [new file with mode: 0644]
sys-libs/tapi/files/tapi-1.30-llvm-out-of-tree.patch [new file with mode: 0644]
sys-libs/tapi/metadata.xml [new file with mode: 0644]
sys-libs/tapi/tapi-1.30.ebuild [new file with mode: 0644]

diff --git a/sys-libs/tapi/Manifest b/sys-libs/tapi/Manifest
new file mode 100644 (file)
index 0000000..e1a098b
--- /dev/null
@@ -0,0 +1 @@
+DIST tapi-1.30.tar.gz 29071 SHA256 be2f3732c4ba7e9d78696fe43f0b31fa4963925ee6e4e5e11cc45603a83ff9a1 SHA512 fa495da150c6b6ff9e0bf667a9a06f0b932363297b75379fd59a5c728168a3ac103a656d1a59fa1b0c0012a18c9874439237bbf2a3c26f9bdf202b4d78e31520 WHIRLPOOL 966cfd8149ab9952858d1985c96039b2f21cccc6d415b557c860d307823ea323bf66cec03a1ab572e160ad21590fd2584ea9037a5c3d769b22aeaacc934fcfe2
diff --git a/sys-libs/tapi/files/tapi-1.30-allow-all-clients.patch b/sys-libs/tapi/files/tapi-1.30-allow-all-clients.patch
new file mode 100644 (file)
index 0000000..9830913
--- /dev/null
@@ -0,0 +1,17 @@
+libtapi is by default limited to be linked to binaries called ld only. When
+trying to link it into e.g. our ld64 we get:
+
+ld: cannot link directly with ${EPREFIX}/usr/lib/libtapi.dylib for architecture
+x86_64
+
+Drop that limitation in order to be able to use the library.
+
+--- libtapi-1.30/tools/libtapi/CMakeLists.txt.orig     2017-02-12 17:35:55.000000000 +0100
++++ libtapi-1.30/tools/libtapi/CMakeLists.txt  2017-02-12 17:36:17.000000000 +0100
+@@ -18,5 +18,5 @@
+ set_property(TARGET libtapi APPEND_STRING
+   PROPERTY
+-  LINK_FLAGS " -current_version ${TAPI_VERSION_MAJOR}.${TAPI_VERSION_MINOR}.${TAPI_VERSION_PATCH} -compatibility_version 1 -allowable_client ld"
++  LINK_FLAGS " -current_version ${TAPI_VERSION_MAJOR}.${TAPI_VERSION_MINOR}.${TAPI_VERSION_PATCH} -compatibility_version 1"
+   )
diff --git a/sys-libs/tapi/files/tapi-1.30-llvm-config.patch b/sys-libs/tapi/files/tapi-1.30-llvm-config.patch
new file mode 100644 (file)
index 0000000..ea5a462
--- /dev/null
@@ -0,0 +1,11 @@
+--- libtapi-1.30/lib/Core/Symbol.cpp.orig      2017-02-11 21:51:53.000000000 +0100
++++ libtapi-1.30/lib/Core/Symbol.cpp   2017-02-11 21:52:00.000000000 +0100
+@@ -9,7 +9,7 @@
+ #include "tapi/Core/Symbol.h"
+ #include "tapi/Core/LLVM.h"
+-#include "llvm/Config/config.h"
++#include "llvm/Config/llvm-config.h"
+ #include "llvm/Support/raw_ostream.h"
+ #if HAVE_CXXABI_H
diff --git a/sys-libs/tapi/files/tapi-1.30-llvm-new-error-api.patch b/sys-libs/tapi/files/tapi-1.30-llvm-new-error-api.patch
new file mode 100644 (file)
index 0000000..814ca30
--- /dev/null
@@ -0,0 +1,65 @@
+--- libtapi-1.30/lib/Core/MachODylibReader.cpp.orig    2017-02-11 21:36:40.000000000 +0100
++++ libtapi-1.30/lib/Core/MachODylibReader.cpp 2017-02-11 21:48:25.000000000 +0100
+@@ -37,7 +37,11 @@
+   }
+   auto binaryOrErr = createBinary(bufferRef);
++#if LLVM_NEW_ERROR_API
++  if (binaryOrErr.takeError())
++#else
+   if (binaryOrErr.getError())
++#endif
+     return FileType::Invalid;
+   Binary &bin = *binaryOrErr.get();
+@@ -49,7 +53,11 @@
+   for (auto OI = UB->begin_objects(), OE = UB->end_objects(); OI != OE; ++OI) {
+     auto objOrErr = OI->getAsObjectFile();
+     // Ignore archives.
++#if LLVM_NEW_ERROR_API
++    if (objOrErr.takeError())
++#else
+     if (objOrErr.getError())
++#endif
+       continue;
+     auto &obj = *objOrErr.get();
+@@ -228,7 +236,11 @@
+                      ? SymbolFlags::WeakReferenced
+                      : SymbolFlags::None;
+     auto symbolName = symbol.getName();
++#if LLVM_NEW_ERROR_API
++    if (symbolName.takeError())
++#else
+     if (symbolName.getError())
++#endif
+       continue;
+     StringRef name;
+@@ -244,8 +256,14 @@
+   file->setPath(memBuffer.getBufferIdentifier());
+   auto binaryOrErr = createBinary(memBuffer);
++// no way to figure this out from the headers :-(
++#if LLVM_NEW_ERROR_API
++  if (auto ec = binaryOrErr.takeError()) {
++    file->setErrorCode(llvm::errorToErrorCode(std::move(ec)));
++#else
+   if (auto ec = binaryOrErr.getError()) {
+     file->setErrorCode(ec);
++#endif
+     return std::move(file);
+   }
+@@ -263,7 +281,11 @@
+     auto objOrErr = OI->getAsObjectFile();
+     // Ignore archives.
++#if LLVM_NEW_ERROR_API
++    if (objOrErr.takeError())
++#else
+     if (objOrErr.getError())
++#endif
+       continue;
+     auto &object = *objOrErr.get();
diff --git a/sys-libs/tapi/files/tapi-1.30-llvm-out-of-tree.patch b/sys-libs/tapi/files/tapi-1.30-llvm-out-of-tree.patch
new file mode 100644 (file)
index 0000000..5638647
--- /dev/null
@@ -0,0 +1,10 @@
+--- libtapi-1.30/CMakeLists.txt.orig   2017-02-11 21:04:56.000000000 +0100
++++ libtapi-1.30/CMakeLists.txt        2017-02-11 21:05:12.000000000 +0100
+@@ -34,6 +34,7 @@
+   ${CMAKE_CURRENT_SOURCE_DIR}/include/tapi/Version.inc.in
+   ${CMAKE_CURRENT_BINARY_DIR}/include/tapi/Version.inc)
++include(AddLLVM)
+ macro(add_tapi_library name)
+   cmake_parse_arguments(ARG
+     "SHARED"
diff --git a/sys-libs/tapi/metadata.xml b/sys-libs/tapi/metadata.xml
new file mode 100644 (file)
index 0000000..0c982d8
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="project">
+               <email>prefix@gentoo.org</email>
+               <name>Gentoo Prefix</name>
+       </maintainer>
+</pkgmetadata>
diff --git a/sys-libs/tapi/tapi-1.30.ebuild b/sys-libs/tapi/tapi-1.30.ebuild
new file mode 100644 (file)
index 0000000..c3f2490
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit cmake-utils flag-o-matic
+
+DESCRIPTION="Text-based Application Programming Interface"
+HOMEPAGE="https://opensource.apple.com/source/tapi"
+SRC_URI="https://opensource.apple.com/tarballs/${PN}/${P}.tar.gz"
+S="${WORKDIR}/lib${P}"
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+KEYWORDS="~x64-macos ~x86-macos"
+
+DOCS=( Readme.md )
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.30-llvm-out-of-tree.patch
+       "${FILESDIR}"/${PN}-1.30-llvm-new-error-api.patch
+       "${FILESDIR}"/${PN}-1.30-llvm-config.patch
+       "${FILESDIR}"/${PN}-1.30-allow-all-clients.patch
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DCMAKE_MODULE_PATH="${EPREFIX}/usr/lib/cmake/llvm;${EPREFIX}/usr/share/llvm/cmake"
+       )
+
+       # poor man's configure
+       [ -f "${EPREFIX}"/usr/include/llvm/Support/Error.h ] && \
+               append-cxxflags -DLLVM_NEW_ERROR_API=1
+
+       append-cxxflags -std=c++11
+       cmake-utils_src_configure
+}