sys-libs/tapi: version bump to support recent ld64 by Michael Weiser

I made some small changes to use a tarball because repoman does not
permit a live-ebuild (one that uses git-r3) to be in the tree unmasked.

Closes: https://bugs.gentoo.org/642292
Package-Manager: Portage-2.3.13, Repoman-2.3.3
This commit is contained in:
Fabian Groffen
2017-12-29 15:36:17 +01:00
parent 4bd6f57909
commit 861716fce0
4 changed files with 452 additions and 0 deletions

View File

@@ -1 +1,5 @@
DIST cfe-5.0.1.src.tar.xz 11483036 BLAKE2B c4eb54cd8271b62cf7a2219db0b599b68c00b6e574d1946220efbd1633e841796e6717d6eeb35e84a6db32a731a3285b59cedeb3b1a8f3c3c502b799fdd0a720 SHA512 6619177a2ff9934fe8b15d6aa229abb8e34d0b1a75228d9efba9393daf71d6419a7256de57b31e2f9f829f71f842118556f996e86ee076f1e0a7cd394dfd31a2
DIST clang-800.0.42.1.tar.gz 41165807 BLAKE2B 89e3ddc0268c2302f6679089648163a1b7457c3133f8f07de12c5980a66b6b7efdfa65966f5d9425ca20bd622cb1739bc009fe45edb4f0986ffd36af77a2480e SHA512 7fec6236996e4647043697f0f62d2eddb064a4604a7c64c11d2df2ff89aff95f4eb9fe1c2e604c0e276296927dd06b8a7794e0343bf0352cf65400dde40aab41
DIST llvm-5.0.1.src.tar.xz 23428720 BLAKE2B 3db4d33df21018d17eef0042c0d8d82a8412bd5daa99cfb5405a6ec83c5774178fa76b220e8731c2a9a64dabf898aa90fe29c685327bd63a4f078e8e94a9a77e SHA512 bee1d45fca15ce725b1f2b1339b13eb6f750a3a321cfd099075477ec25835a8ca55b5366172c4aad46592dfd8afe372349ecf264f581463d017f9cee2d63c1cb
DIST tapi-1.30.tar.gz 29071 BLAKE2B e5eb4f2eea6500d4f06c490c8b7f70070fe2ba31579133b92c1d162c33afb3c422c2fba1249734a5749455185a4fc3d79b1eb00820387990cc65fe0fc69ac55a SHA512 fa495da150c6b6ff9e0bf667a9a06f0b932363297b75379fd59a5c728168a3ac103a656d1a59fa1b0c0012a18c9874439237bbf2a3c26f9bdf202b4d78e31520
DIST tapi-2.0.0.tar.gz 195080 BLAKE2B 28c31f4cb119525edb1a755895d8a3a05c9a606610fbf0c135790c0caf85a26d3b7e7fbbf856d001c26641a755e0d836f2f697a5856153d9dfc7c258e28427a1 SHA512 fc7209556ff75285a99ce64225831d53f9d959f7d6d9562cbfe91b019591860a00196c93de2258bbdaba02301af38990557b7e241ad3f66d09eb9440f4edf5ab

View File

@@ -0,0 +1,130 @@
Provide standalone cmake project file that allows compilation outside the LLVM
source tree and installs the headers as well.
Tune other CMakeLists for out-of-tree build.
Provide missing isDynamic() method for Objective C properties. (Best-guess
implementation based on
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html
and llvm-objdump -m -objc-meta-data output). Does not seem to be used anywhere
anyways - but the control flow of the code is somewhat encrypted.
Adjust to some minor API differencies between Apple clang 8.0.0 and upstream
LLVM 5.0.1.
--- objcmetadata-800.0.42.1/CMakeLists.txt.orig 2017-12-25 22:23:41.000000000 +0100
+++ objcmetadata-800.0.42.1/CMakeLists.txt 2017-12-25 20:54:39.000000000 +0100
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 3.4.3)
+project(ObjCMetadata)
+
+find_package(LLVM REQUIRED CONFIG)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+include(AddLLVM)
+
+include_directories(${LLVM_INCLUDE_DIRS})
+link_directories(${LLVM_LIBRARY_DIRS})
+add_definitions(${LLVM_DEFINITIONS})
+set(LLVM_COMMON_LIBS Object Support Analysis Core)
+
+include_directories(BEFORE
+ ${CMAKE_CURRENT_BINARY_DIR}/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ )
+
+install(FILES
+ include/llvm/${PROJECT_NAME}/ObjCBitcode.h
+ include/llvm/${PROJECT_NAME}/ObjCMachOBinary.h
+ include/llvm/${PROJECT_NAME}/ObjCMetadata.h
+ DESTINATION include/llvm/${PROJECT_NAME}
+ )
+
+add_subdirectory(lib/${PROJECT_NAME})
--- objcmetadata-800.0.42.1/include/llvm/ObjCMetadata/ObjCMetadata.h.orig 2017-12-25 20:09:28.000000000 +0100
+++ objcmetadata-800.0.42.1/include/llvm/ObjCMetadata/ObjCMetadata.h 2017-12-25 20:10:11.000000000 +0100
@@ -110,6 +110,7 @@
// Return empty string if doesn't exists.
Expected<std::string> getGetter() const;
Expected<std::string> getSetter() const;
+ Expected<bool> isDynamic() const;
};
class ObjCMethod : public ObjCInfoBase {
--- objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCMetadata.cpp.orig 2017-12-25 20:09:11.000000000 +0100
+++ objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCMetadata.cpp 2017-12-25 20:13:33.000000000 +0100
@@ -164,6 +164,20 @@
return setter;
}
+Expected<bool> ObjCProperty::isDynamic() const {
+ auto Attr = getAttribute();
+ if (!Attr)
+ return Attr.takeError();
+ // Find setter attribute.
+ SmallVector<StringRef, 4> Attrs;
+ Attr->split(Attrs, ',');
+ for (auto a : Attrs) {
+ if (a == "D")
+ return true;
+ }
+ return false;
+}
+
Expected<StringRef> ObjCMethod::getName() const {
return MetadataReader->getMethodName(*this);
}
--- objcmetadata-800.0.42.1/lib/ObjCMetadata/CMakeLists.txt.orig 2017-12-25 17:29:01.000000000 +0100
+++ objcmetadata-800.0.42.1/lib/ObjCMetadata/CMakeLists.txt 2017-12-25 20:59:31.000000000 +0100
@@ -1,3 +1,10 @@
+set(LLVM_LINK_COMPONENTS
+ Object
+ Support
+ Analysis
+ Core
+)
+
add_llvm_library(LLVMObjCMetadata
ObjCBitcode.cpp
ObjCMetadata.cpp
@@ -5,7 +12,4 @@
ADDITIONAL_HEADER_DIRS
${LLVM_MAIN_INCLUDE_DIR}/llvm/ObjCMetadata
-
- DEPENDS
- intrinsics_gen
)
--- objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCBitcode.cpp.orig 2017-12-25 17:14:29.000000000 +0100
+++ objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCBitcode.cpp 2017-12-25 17:17:51.000000000 +0100
@@ -20,7 +20,7 @@
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Operator.h"
-#include "llvm/Support/Error.h"
+#include "llvm/Object/Error.h"
#include "macho-obj.h"
@@ -75,7 +75,7 @@
Operator::getOpcode(V) == Instruction::AddrSpaceCast) {
V = cast<Operator>(V)->getOperand(0);
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) {
- if (GA->mayBeOverridden())
+ if (GA->isInterposable())
return V;
V = GA->getAliasee();
} else if (PtrToIntOperator *PTI = dyn_cast<PtrToIntOperator>(V)) {
--- objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCMachOBinary.cpp.orig 2017-12-25 17:24:23.000000000 +0100
+++ objcmetadata-800.0.42.1/lib/ObjCMetadata/ObjCMachOBinary.cpp 2017-12-25 17:27:15.000000000 +0100
@@ -1262,9 +1262,9 @@
const char *SymbolName = nullptr;
if (reloc_found && isExtern) {
offset = Symbol.getValue();
- ErrorOr<StringRef> NameOrError = Symbol.getName();
+ Expected<StringRef> NameOrError = Symbol.getName();
if (!NameOrError) {
- return errorOrToExpected(std::move(NameOrError));
+ return NameOrError;
}
StringRef Name = *NameOrError;
if (!Name.empty()) {

View File

@@ -0,0 +1,141 @@
Tune CMakeLists for out-of-tree build.
Adjust for API discrepancies between Apple clang-8.0.0 and upstream LLVM 5.0.1.
Allow all clients to link against the library, not just ld. Main reason: Our ld
is called ld64 when we link it.
--- tapi-2.0.0/tools/tapi/CMakeLists.txt.orig 2017-12-25 22:36:06.620886714 +0100
+++ tapi-2.0.0/tools/tapi/CMakeLists.txt 2017-12-25 22:41:43.867893060 +0100
@@ -6,6 +6,12 @@
target_link_libraries(tapi
tapiDriver
+ clangAST
+ clangFrontend
+ LLVMOption
+ LLVMDemangle
+ LLVMSupport
+ LLVMCore
)
if (TAPI_BUILD_LIBIOSSDK)
--- tapi-2.0.0/tools/libtapi/CMakeLists.txt.orig 2017-12-25 22:26:06.816905789 +0100
+++ tapi-2.0.0/tools/libtapi/CMakeLists.txt 2017-12-25 22:31:22.914862289 +0100
@@ -1,4 +1,7 @@
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libtapi.exports)
+set(LLVM_LINK_COMPONENTS
+ Support
+ )
add_tapi_library(libtapi
SHARED
@@ -19,5 +22,5 @@
set_property(TARGET libtapi APPEND_STRING
PROPERTY
- LINK_FLAGS " -current_version ${TAPI_FULL_VERSION} -compatibility_version 1 -allowable_client ld"
+ LINK_FLAGS " -current_version ${TAPI_FULL_VERSION} -compatibility_version 1"
)
--- tapi-2.0.0/tools/tapi-run/CMakeLists.txt.orig 2017-12-26 15:12:39.605057352 +0100
+++ tapi-2.0.0/tools/tapi-run/CMakeLists.txt 2017-12-26 15:15:53.304983942 +0100
@@ -5,6 +5,8 @@
target_link_libraries(tapi-run
tapiCore
libtapi
+ LLVMSupport
+ LLVMCore
)
set_property(TARGET tapi-run APPEND_STRING
--- tapi-2.0.0/CMakeLists.txt.orig 2017-12-24 15:27:56.000000000 +0100
+++ tapi-2.0.0/CMakeLists.txt 2017-12-26 15:50:01.199506782 +0100
@@ -4,6 +4,24 @@
message(FATAL_ERROR "Unsupported configuration.")
endif()
+project(tapi)
+set(PACKAGE_VENDOR Apple CACHE STRING "")
+add_definitions(-DTAPI_BUG_REPORT_URL="https://bugs.gentoo.org/")
+
+find_package(LLVM REQUIRED CONFIG)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+include(AddLLVM)
+
+add_definitions(${LLVM_DEFINITIONS})
+include_directories(${LLVM_INCLUDE_DIRS} ${OBJCMETADATA_INCLUDE_DIRS})
+link_directories(${LLVM_LIBRARY_DIRS} ${OBJCMETADATA_LIBRARY_DIRS})
+
+# make tblgen happy
+include(TableGen)
+foreach(IPATH ${LLVM_INCLUDE_DIRS})
+ list(APPEND LLVM_TABLEGEN_FLAGS -I ${IPATH})
+endforeach(IPATH)
+
set(TAPI_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(TAPI_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
--- tapi-2.0.0/lib/Core/MachODylibReader.cpp.orig 2017-12-24 15:27:56.000000000 +0100
+++ tapi-2.0.0/lib/Core/MachODylibReader.cpp 2017-12-25 22:15:53.075478606 +0100
@@ -254,8 +254,7 @@
auto arch = getArchType(H.cputype, H.cpusubtype);
assert(arch != Architecture::unknown && "unknown architecture slice");
- Error error = Error::success();
- for (const auto &symbol : object->exports(error)) {
+ for (const auto &symbol : object->exports()) {
StringRef name;
XPIKind kind;
std::tie(name, kind) = parseSymbol(symbol.name());
@@ -272,7 +271,7 @@
file->addSymbol(kind, name, arch, flags);
}
- return error;
+ return Error::success();
}
static Error readUndefinedSymbols(MachOObjectFile *object,
@@ -309,10 +308,7 @@
auto H = object->getHeader();
auto arch = getArchType(H.cputype, H.cpusubtype);
- auto error = Error::success();
- MachOMetadata metadata(object, error);
- if (error)
- return std::move(error);
+ MachOMetadata metadata(object);
///
/// Classes
--- tapi-2.0.0/lib/Driver/Snapshot.cpp.orig 2017-12-24 15:27:56.000000000 +0100
+++ tapi-2.0.0/lib/Driver/Snapshot.cpp 2017-12-26 15:49:09.864184826 +0100
@@ -14,7 +14,7 @@
#include "tapi/Defines.h"
#include "clang/Frontend/FrontendOptions.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/xxhash.h"
@@ -356,7 +356,7 @@
}
if (isCrash) {
- outs() << "PLEASE submit a bug report to " BUG_REPORT_URL
+ outs() << "PLEASE submit a bug report to " TAPI_BUG_REPORT_URL
" and include the "
"crash backtrace and snapshot.\n\n"
"********************************************************\n\n"
--- tapi-2.0.0/lib/Driver/Options.cpp.orig 2017-12-25 22:17:40.506874748 +0100
+++ tapi-2.0.0/lib/Driver/Options.cpp 2017-12-25 22:18:04.181989766 +0100
@@ -1023,7 +1023,7 @@
table->PrintHelp(
outs(),
(programName + " " + getNameFromTAPICommand(command)).str().c_str(),
- toolName, /*FlagsToInclude=*/getIncludeOptionFlagMasks(command),
+ toolName, /*FlagsToInclude=*///getIncludeOptionFlagMasks(command),
/*FlagsToExclude=*/0, /*ShowAllAliases=*/false);
}

View File

@@ -0,0 +1,177 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
inherit cmake-utils llvm
# This is a hog: We need to carve ObjCMetadata out of Apple's clang. We also
# need llvm-tblgen and clang-tblgen because tapi uses them to generate some
# source. It's assumed that they're only ever needed when building LLVM and
# clang. So they don't get installed in the system and we need to compile them
# fresh from LLVM and clang sources. And finally we need an installed LLVM and
# clang to build tapi against.
LLVM_PV=5.0.1
LLVM_PN=llvm
LLVM_P=${LLVM_PN}-${LLVM_PV}
CLANG_PN=cfe
CLANG_P=${CLANG_PN}-${LLVM_PV}
APPLE_LLVM_PV=800.0.42.1
APPLE_LLVM_PN=clang
APPLE_LLVM_P=${APPLE_LLVM_PN}-${APPLE_LLVM_PV}
OBJCMD_PN=objcmetadata
OBJCMD_P=${OBJCMD_PN}-${APPLE_LLVM_PV}
DESCRIPTION="Text-based Application Programming Interface"
HOMEPAGE="https://opensource.apple.com/source/tapi"
SRC_URI="https://opensource.apple.com/tarballs/clang/${APPLE_LLVM_P}.tar.gz
http://releases.llvm.org/${LLVM_PV}/${LLVM_P}.src.tar.xz
http://releases.llvm.org/${LLVM_PV}/${CLANG_P}.src.tar.xz"
if [[ ${PV} == 9999* ]] ; then
EGIT_REPO_URI="https://github.com/ributzka/tapi.git"
TAPI_P=${P}
inherit git-r3
else
TAPI_COMMIT=b9205695b4edee91000383695be8de5ba8e0db41
SRC_URI+=" https://github.com/ributzka/${PN}/archive/${TAPI_COMMIT}.tar.gz -> ${P}.tar.gz"
TAPI_P=${PN}-${TAPI_COMMIT}
fi
LICENSE="|| ( UoI-NCSA MIT )"
SLOT="0"
KEYWORDS="~x64-macos ~x86-macos"
DEPEND="sys-devel/llvm:=
sys-devel/clang:="
RDEPEND="${DEPEND}"
DOCS=( Readme.md )
LLVM_S="${WORKDIR}"/${LLVM_P}.src
LLVM_BUILD="${WORKDIR}"/${LLVM_P}_build
CLANG_S="${WORKDIR}"/${CLANG_P}.src
APPLE_LLVM_S="${WORKDIR}/${APPLE_LLVM_P}"/src
TAPI_S="${WORKDIR}"/${TAPI_P}
# to avoid ebuild dying
S=${WORKDIR}
TAPI_BUILD="${WORKDIR}"/${P}_build
OBJCMD_S="${WORKDIR}"/${OBJCMD_P}
OBJCMD_BUILD="${WORKDIR}"/${OBJCMD_P}_build
# put temporary install root into tapi build dir so that it does not end up on
# libtapi's rpath
OBJCMD_ROOT="${TAPI_BUILD}"/${OBJCMD_PN}_root
src_prepare() {
# carve ObjCMetadata out of llvm and make it stand on its own
mkdir -p "${OBJCMD_S}"/{include/llvm,lib} || die
cd ${OBJCMD_S} || die
cp -r ${APPLE_LLVM_S}/include/llvm/ObjCMetadata include/llvm || die
cp -r ${APPLE_LLVM_S}/lib/ObjCMetadata lib || die
eapply "${FILESDIR}"/${OBJCMD_PN}-800.0.42.1-standalone.patch
CMAKE_USE_DIR="${PWD}" \
cmake-utils_src_prepare
cd "${LLVM_S}" || die
CMAKE_USE_DIR="${PWD}" \
cmake-utils_src_prepare
cd "${TAPI_S}" || die
eapply "${FILESDIR}"/${PN}-2.0.0-standalone.patch
CMAKE_USE_DIR="${PWD}" \
cmake-utils_src_prepare
}
src_configure() {
# configure LLVM and clang for tablegen build
local mycmakeargs=(
# shared libs cause all kinds of problems and we don't need them just
# to run tblgen a couple of times
-DBUILD_SHARED_LIBS=OFF
# configure less targets to speed up configuration. We don't build them
# anyway.
-DLLVM_TARGETS_TO_BUILD=X86
-DLLVM_EXTERNAL_PROJECTS=clang
-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=${CLANG_S}
)
cd "${LLVM_S}" || die
BUILD_DIR="${LLVM_BUILD}" \
CMAKE_USE_DIR="${PWD}" \
CMAKE_BUILD_TYPE=RelWithDebInfo \
cmake-utils_src_configure
local llvm_prefix=$(get_llvm_prefix)
# configure ObjCMetadata
local mycmakeargs=(
# fails to compile without -std=c++11
-DCMAKE_CXX_STANDARD=11
# compile against currently installed LLVM
-DLLVM_DIR="${llvm_prefix}/lib/cmake/llvm"
# install into temporary root in work dir just so we can compile and
# link against it. Static lib will be pulled into libtapi and tools.
-DCMAKE_INSTALL_PREFIX="${OBJCMD_ROOT}"
)
cd "${OBJCMD_S}" || die
BUILD_DIR="${OBJCMD_BUILD}" \
CMAKE_USE_DIR="${PWD}" \
cmake-utils_src_configure
# configure tapi
local mycmakeargs=(
# fails to compile without -std=c++11
-DCMAKE_CXX_STANDARD=11
# compile against currently installed LLVM
-DLLVM_DIR="${llvm_prefix}"/lib/cmake/llvm
# use tblgens from LLVM build directory directly. They generate source
# from description files. Therefore it shouldn't matter if they
# match up with the installed LLVM.
-DLLVM_TABLEGEN_EXE="${LLVM_BUILD}"/bin/llvm-tblgen
-DCLANG_TABLEGEN_EXE="${LLVM_BUILD}"/bin/clang-tblgen
# pull in includes and libs from ObjCMetadata's temporary install root
-DOBJCMETADATA_INCLUDE_DIRS="${OBJCMD_ROOT}"/include
-DOBJCMETADATA_LIBRARY_DIRS="${OBJCMD_ROOT}"/lib
)
cd "${TAPI_S}" || die
BUILD_DIR="${TAPI_BUILD}/" \
CMAKE_USE_DIR="${PWD}" \
cmake-utils_src_configure
}
src_compile() {
# build LLVM and clang tablegen
cd "${LLVM_S}" || die
BUILD_DIR="${LLVM_BUILD}" \
CMAKE_USE_DIR="${PWD}" \
cmake-utils_src_compile llvm-tblgen clang-tblgen
# build ObjCMetadata
cd "${OBJCMD_S}" || die
BUILD_DIR="${OBJCMD_BUILD}" \
CMAKE_USE_DIR="${PWD}" \
cmake-utils_src_compile
# install into temporary root in work dir
cd "${OBJCMD_BUILD}" || die
${CMAKE_MAKEFILE_GENERATOR} install
# finally build tapi
cd "${TAPI_S}" || die
BUILD_DIR="${TAPI_BUILD}" \
CMAKE_USE_DIR="${PWD}" \
cmake-utils_src_compile
}