diff --git a/rpm/0001-Make-funwind-tables-the-default-for-all-archs.patch b/rpm/0001-Make-funwind-tables-the-default-for-all-archs.patch new file mode 100644 index 00000000..d9e91253 --- /dev/null +++ b/rpm/0001-Make-funwind-tables-the-default-for-all-archs.patch @@ -0,0 +1,39 @@ +From 690373af5a5d50cf115ed6e4d2849bb786f9dc8e Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Tue, 10 Dec 2019 09:18:03 +0000 +Subject: [PATCH] Make -funwind-tables the default for all archs + +--- + clang/lib/Driver/ToolChain.cpp | 2 +- + clang/lib/Driver/ToolChains/Gnu.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp +index b1fddb0af55..43af40ed0e8 100644 +--- a/clang/lib/Driver/ToolChain.cpp ++++ b/clang/lib/Driver/ToolChain.cpp +@@ -244,7 +244,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const { + } + + bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const { +- return false; ++ return true; + } + + Tool *ToolChain::getClang() const { +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index 33cdd3585c2..15e82be8f3a 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2535,7 +2535,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const { + } + + bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const { +- return getArch() == llvm::Triple::x86_64; ++ return true; + } + + bool Generic_GCC::isPICDefault() const { +-- +2.20.1 + diff --git a/rpm/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch b/rpm/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch new file mode 100644 index 00000000..c4510396 --- /dev/null +++ b/rpm/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch @@ -0,0 +1,50 @@ +From 09ae3ef5710a89505318ec721c65b6c838147276 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Thu, 7 Feb 2019 21:05:37 -0800 +Subject: [PATCH] ToolChain: Add -lgcc_s to the linker flags when using libc++ + +The libc++ build for Fedora does not include an implementation of +libunwind, so we need to explicitly link against something that +provides this implementation. +--- + clang/lib/Driver/ToolChain.cpp | 1 + + clang/test/Driver/netbsd.cpp | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp +index 88a627e..cb99844 100644 +--- a/clang/lib/Driver/ToolChain.cpp ++++ b/clang/lib/Driver/ToolChain.cpp +@@ -767,6 +767,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args, + switch (Type) { + case ToolChain::CST_Libcxx: + CmdArgs.push_back("-lc++"); ++ CmdArgs.push_back("-lgcc_s"); + break; + + case ToolChain::CST_Libstdcxx: +diff --git a/clang/test/Driver/netbsd.cpp b/clang/test/Driver/netbsd.cpp +index 4af7d83..ff18c62 100644 +--- a/clang/test/Driver/netbsd.cpp ++++ b/clang/test/Driver/netbsd.cpp +@@ -131,7 +131,7 @@ + // ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi" + // ARM-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so" + // ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o" +-// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc" ++// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc" + // ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" + + // AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd" +@@ -250,7 +250,7 @@ + // S-ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi" + // S-ARM-7: ld{{.*}}" "--eh-frame-hdr" "-Bstatic" + // S-ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o" +-// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc" ++// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc" + // S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" + + // S-AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd" +-- +1.8.3.1 + diff --git a/rpm/clang-sailfishos-toolchain.patch b/rpm/clang-sailfishos-toolchain.patch new file mode 100644 index 00000000..9717b6b1 --- /dev/null +++ b/rpm/clang-sailfishos-toolchain.patch @@ -0,0 +1,105 @@ +diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h +index 67dc764fb7d..2ae6c555515 100644 +--- a/clang/include/clang/Driver/Distro.h ++++ b/clang/include/clang/Driver/Distro.h +@@ -41,6 +41,7 @@ public: + Fedora, + Gentoo, + OpenSUSE, ++ Sailfish, + UbuntuHardy, + UbuntuIntrepid, + UbuntuJaunty, +@@ -117,6 +118,10 @@ public: + return DistroVal >= DebianLenny && DistroVal <= DebianBullseye; + } + ++ bool IsSailfish() const { ++ return DistroVal == Sailfish; ++ } ++ + bool IsUbuntu() const { + return DistroVal >= UbuntuHardy && DistroVal <= UbuntuEoan; + } +diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp +index f2a3074d1e7..b9971b63a81 100644 +--- a/clang/lib/Driver/Distro.cpp ++++ b/clang/lib/Driver/Distro.cpp +@@ -145,6 +145,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) { + if (VFS.exists("/etc/gentoo-release")) + return Distro::Gentoo; + ++ if (VFS.exists("/etc/sailfish-release")) ++ return Distro::Sailfish; ++ + return Distro::UnknownDistro; + } + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index 33cdd3585c2..e1890849100 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -1927,7 +1927,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; + static const char *const AArch64Triples[] = { + "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", +- "aarch64-suse-linux", "aarch64-linux-android"}; ++ "aarch64-suse-linux", "aarch64-linux-android", "aarch64-meego-linux-gnu"}; + static const char *const AArch64beLibDirs[] = {"/lib"}; + static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu", + "aarch64_be-linux-gnu"}; +@@ -1937,6 +1937,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + "arm-linux-androideabi"}; + static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf", + "armv7hl-redhat-linux-gnueabi", ++ "armv7hl-meego-linux-gnueabi", + "armv6hl-suse-linux-gnueabi", + "armv7hl-suse-linux-gnueabi"}; + static const char *const ARMebLibDirs[] = {"/lib"}; +@@ -1964,7 +1965,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux", + "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu", + "i686-linux-android", "i386-gnu", "i486-gnu", +- "i586-gnu", "i686-gnu"}; ++ "i586-gnu", "i686-gnu", "i486-meego-linux"}; + + static const char *const MIPSLibDirs[] = {"/lib"}; + static const char *const MIPSTriples[] = { +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index 7f59bc77f52..9cf648e2c08 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + } + + if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() || +- Triple.isAndroid()) { ++ Triple.isAndroid() || Distro.IsSailfish()) { + ExtraOpts.push_back("-z"); + ExtraOpts.push_back("relro"); + } +@@ -289,13 +289,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + // Hexagon linker/loader does not support .gnu.hash + if (!IsMips && !IsHexagon) { + if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() || +- (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) || ++ (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) || Distro.IsSailfish() || + (IsAndroid && !Triple.isAndroidVersionLT(23))) + ExtraOpts.push_back("--hash-style=gnu"); + + if (Distro.IsDebian() || Distro.IsOpenSUSE() || + Distro == Distro::UbuntuLucid || Distro == Distro::UbuntuJaunty || +- Distro == Distro::UbuntuKarmic || ++ Distro == Distro::UbuntuKarmic || Distro.IsSailfish() || + (IsAndroid && Triple.isAndroidVersionLT(23))) + ExtraOpts.push_back("--hash-style=both"); + } +@@ -304,7 +304,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + ExtraOpts.push_back("--build-id"); + #endif + +- if (IsAndroid || Distro.IsOpenSUSE()) ++ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsSailfish()) + ExtraOpts.push_back("--enable-new-dtags"); + + // The selection of paths to try here is designed to match the patterns which diff --git a/rpm/clang.spec b/rpm/clang.spec new file mode 100644 index 00000000..b05e64fb --- /dev/null +++ b/rpm/clang.spec @@ -0,0 +1,227 @@ +%global maj_ver 9 +%global min_ver 0 +%global patch_ver 1 + +%global clang_tools_binaries \ + %{_bindir}/clangd \ + %{_bindir}/clang-apply-replacements \ + %{_bindir}/clang-change-namespace \ + %{_bindir}/clang-doc \ + %{_bindir}/clang-include-fixer \ + %{_bindir}/clang-query \ + %{_bindir}/clang-refactor \ + %{_bindir}/clang-reorder-fields \ + %{_bindir}/clang-rename \ + %{_bindir}/clang-tidy + +%global clang_binaries \ + %{_bindir}/clang \ + %{_bindir}/clang++ \ + %{_bindir}/clang-%{maj_ver} \ + %{_bindir}/clang++-%{maj_ver} \ + %{_bindir}/clang-check \ + %{_bindir}/clang-cl \ + %{_bindir}/clang-cpp \ + %{_bindir}/clang-extdef-mapping \ + %{_bindir}/clang-format \ + %{_bindir}/clang-import-test \ + %{_bindir}/clang-offload-bundler \ + %{_bindir}/clang-scan-deps \ + %{_bindir}/diagtool \ + %{_bindir}/hmaptool + +Name: clang +Version: %{maj_ver}.%{min_ver}.%{patch_ver} +Release: 0 +Summary: A C language family front-end for LLVM +License: NCSA +URL: http://llvm.org +Source: %{version}/%{name}-%{version}.tar.gz + +# LLVM patch +Patch0: llvm-sailfishos-toolchain.patch +# clang patches +Patch1: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch +Patch2: 0001-Make-funwind-tables-the-default-for-all-archs.patch +Patch3: clang-sailfishos-toolchain.patch + +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: cmake +BuildRequires: ninja +BuildRequires: llvm-devel +BuildRequires: libxml2-devel +BuildRequires: python3-base + +# clang requires gcc, clang++ requires libstdc++-devel +# - https://bugzilla.redhat.com/show_bug.cgi?id=1021645 +# - https://bugzilla.redhat.com/show_bug.cgi?id=1158594 +Requires: libstdc++-devel +Requires: gcc-c++ + +Provides: clang(major) = %{maj_ver} + +%description +clang: noun + 1. A loud, resonant, metallic sound. + 2. The strident call of a crane or goose. + 3. C-language family front-end toolkit. + +The goal of the Clang project is to create a new C, C++, Objective C +and Objective C++ front-end for the LLVM compiler. Its tools are built +as libraries and designed to be loosely-coupled and extensible. + +%package devel +Summary: Development header files for clang +Requires: %{name}%{?_isa} = %{version}-%{release} +# The clang CMake files reference tools from clang-tools-extra. +Requires: %{name}-tools-extra%{?_isa} = %{version}-%{release} + +%description devel +Development header files for clang. + +%package analyzer +Summary: A source code analysis framework +License: NCSA and MIT +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description analyzer +The Clang Static Analyzer consists of both a source code analysis +framework and a standalone tool that finds bugs in C and Objective-C +programs. The standalone tool is invoked from the command-line, and is +intended to run in tandem with a build of a project or code base. + +%package tools-extra +Summary: Extra tools for clang +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description tools-extra +A set of extra tools built using Clang's tooling API. + + +%prep +%autosetup -p1 -n %{name}-%{version}/llvm + +# symlink clang extra tools to enable build +ln -s ../../clang-tools-extra clang/tools/extra || : + +%build + +pushd clang + +mkdir -p build +pushd build + +# Decrease debuginfo verbosity to reduce memory consumption during final library linking +%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') + +# -DCMAKE_INSTALL_RPATH=";" is a workaround for llvm manually setting the +# rpath of libraries and binaries. llvm will skip the manual setting +# if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value +# as nothing, so it sets the rpath to "" when installing. +%cmake .. -G Ninja \ + -DLLVM_PARALLEL_LINK_JOBS=1 \ + -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DPYTHON_EXECUTABLE=%{__python3} \ + -DCMAKE_INSTALL_RPATH:BOOL=";" \ +%ifarch s390 s390x %{arm} aarch64 %ix86 ppc64le + -DCMAKE_C_FLAGS="%{optflags} -DNDEBUG" \ + -DCMAKE_CXX_FLAGS="%{optflags} -DNDEBUG" \ +%endif + -DCLANG_INCLUDE_TESTS:BOOL=OFF \ + -DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \ +%if 0%{?__isa_bits} == 64 + -DLLVM_LIBDIR_SUFFIX=64 \ +%else + -DLLVM_LIBDIR_SUFFIX= \ +%endif + \ + -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \ + -DCLANG_ENABLE_ARCMT:BOOL=ON \ + -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \ + -DCLANG_INCLUDE_DOCS:BOOL=ON \ + -DCLANG_PLUGIN_SUPPORT:BOOL=ON \ + -DENABLE_LINKER_BUILD_ID:BOOL=ON \ + -DLLVM_ENABLE_EH=OFF \ + -DLLVM_ENABLE_RTTI=OFF \ + -DLLVM_BUILD_DOCS=OFF \ + -DLLVM_ENABLE_SPHINX=OFF \ + -DCLANG_LINK_CLANG_DYLIB=ON \ + -DSPHINX_WARNINGS_AS_ERRORS=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DCLANG_BUILD_EXAMPLES:BOOL=OFF + +%ninja_build +popd + +popd + +%install +pushd clang + +%ninja_install -C build + +# remove editor integrations (bbedit, sublime, emacs, vim) +rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript +rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py* +rm -vf %{buildroot}%{_datadir}/clang/*.el + +# TODO: Package html docs +rm -Rvf %{buildroot}%{_docdir}/%{name}-%{version}} +rm -Rvf %{buildroot}%{_prefix}/share/clang/clang-doc-default-stylesheet.css +rm -Rvf %{buildroot}%{_prefix}/share/clang/index.js +rm -Rvf %{buildroot}%{_mandir}/man1 + +# TODO: What are the Fedora guidelines for packaging bash autocomplete files? +rm -vf %{buildroot}%{_datadir}/clang/bash-autocomplete.sh + +# Add clang++-{version} symlink +ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver} + +# remove static libs +rm -Rvf %{buildroot}%{_libdir}/*.a + +# remove git-clang-format +rm -vf %{buildroot}%{_bindir}/git-clang-format + +popd + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%license clang/LICENSE.TXT +%{clang_binaries} +%{_bindir}/c-index-test +%{_datadir}/clang/clang-format.py* +%{_datadir}/clang/clang-format-diff.py* +%{_libdir}/clang/ +%{_libdir}/*.so.* + +%files devel +%{_libdir}/*.so +%{_includedir}/clang/ +%{_includedir}/clang-c/ +%{_libdir}/cmake/* +%dir %{_datadir}/clang/ + +%files analyzer +%{_bindir}/scan-view +%{_bindir}/scan-build +%{_libexecdir}/ccc-analyzer +%{_libexecdir}/c++-analyzer +%{_datadir}/scan-view/ +%{_datadir}/scan-build/ + +%files tools-extra +%{clang_tools_binaries} +%{_bindir}/find-all-symbols +%{_bindir}/modularize +%{_datadir}/clang/clang-include-fixer.py* +%{_datadir}/clang/clang-tidy-diff.py* +%{_datadir}/clang/run-clang-tidy.py* +%{_datadir}/clang/run-find-all-symbols.py* +%{_datadir}/clang/clang-rename.py* diff --git a/rpm/llvm-sailfishos-toolchain.patch b/rpm/llvm-sailfishos-toolchain.patch new file mode 100644 index 00000000..e09526bf --- /dev/null +++ b/rpm/llvm-sailfishos-toolchain.patch @@ -0,0 +1,82 @@ +diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h +index edeb31efab8..fd9e38db0ac 100644 +--- a/llvm/include/llvm/ADT/Triple.h ++++ b/llvm/include/llvm/ADT/Triple.h +@@ -149,7 +149,8 @@ public: + Mesa, + SUSE, + OpenEmbedded, +- LastVendorType = OpenEmbedded ++ MeeGo, ++ LastVendorType = MeeGo + }; + enum OSType { + UnknownOS, +diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp +index d419463e6a5..916ebc28856 100644 +--- a/llvm/lib/Support/Triple.cpp ++++ b/llvm/lib/Support/Triple.cpp +@@ -166,6 +166,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) { + case AMD: return "amd"; + case Mesa: return "mesa"; + case SUSE: return "suse"; ++ case MeeGo: return "meego"; + case OpenEmbedded: return "oe"; + } + +@@ -476,6 +477,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) { + .Case("mesa", Triple::Mesa) + .Case("suse", Triple::SUSE) + .Case("oe", Triple::OpenEmbedded) ++ .Case("meego", Triple::MeeGo) + .Default(Triple::UnknownVendor); + } + +@@ -738,6 +740,9 @@ Triple::Triple(const Twine &Str) + OS = parseOS(Components[2]); + if (Components.size() > 3) { + Environment = parseEnvironment(Components[3]); ++ // MeeGo uses "gnueabi" to mean "gnueabihf" ++ if (Vendor == Triple::MeeGo && Environment == Triple::GNUEABI) ++ Environment = Triple::GNUEABIHF; + ObjectFormat = parseFormat(Components[3]); + } + } +@@ -789,6 +794,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr, + ObjectFormat(parseFormat(EnvironmentStr.str())) { + if (ObjectFormat == Triple::UnknownObjectFormat) + ObjectFormat = getDefaultFormat(*this); ++ ++ // MeeGo uses "gnueabi" to mean "gnueabihf" ++ if (Vendor == Triple::MeeGo && Environment == Triple::GNUEABI) ++ Environment = Triple::GNUEABIHF; + } + + std::string Triple::normalize(StringRef Str) { +@@ -1051,6 +1065,9 @@ void Triple::getEnvironmentVersion(unsigned &Major, unsigned &Minor, + unsigned &Micro) const { + StringRef EnvironmentName = getEnvironmentName(); + StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment()); ++ // MeeGo uses "gnueabi" to mean "gnueabihf" ++ if (Vendor == Triple::MeeGo && getEnvironment() == Triple::GNUEABIHF) ++ EnvironmentTypeName = "gnueabi"; + if (EnvironmentName.startswith(EnvironmentTypeName)) + EnvironmentName = EnvironmentName.substr(EnvironmentTypeName.size()); + +diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp +index 37ebe5dbcb2..2a69a2af8f5 100644 +--- a/llvm/unittests/ADT/TripleTest.cpp ++++ b/llvm/unittests/ADT/TripleTest.cpp +@@ -336,6 +336,12 @@ TEST(TripleTest, ParsedIDs) { + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNUEABI, T.getEnvironment()); + ++ T = Triple("armv7hl-meego-linux-gnueabi"); ++ EXPECT_EQ(Triple::arm, T.getArch()); ++ EXPECT_EQ(Triple::MeeGo, T.getVendor()); ++ EXPECT_EQ(Triple::Linux, T.getOS()); ++ EXPECT_EQ(Triple::GNUEABIHF, T.getEnvironment()); ++ + T = Triple("i586-pc-haiku"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); diff --git a/rpm/llvm.spec b/rpm/llvm.spec index 0d761284..9a5e0f91 100644 --- a/rpm/llvm.spec +++ b/rpm/llvm.spec @@ -14,9 +14,14 @@ Version: 9.0.1 Release: 0 Summary: The Low Level Virtual Machine (An Optimizing Compiler Infrastructure) License: University of Illinois/NCSA Open Source License -Group: Development/Tools URL: http://llvm.org/ Source: %{version}/%{name}-%{version}.tar.gz +# LLVM patch +Patch0: llvm-sailfishos-toolchain.patch +# clang patches +Patch1: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch +Patch2: 0001-Make-funwind-tables-the-default-for-all-archs.patch +Patch3: clang-sailfishos-toolchain.patch Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: cmake, ninja @@ -41,9 +46,10 @@ Requires: %{name} = %{version} LLVM Header files %prep -%setup -q -n %{name}-%{version}/%{name}/llvm +%autosetup -p1 -n %{name}-%{version}/%{name} %build +pushd llvm mkdir -p build pushd build @@ -80,16 +86,23 @@ pushd build %ninja_build popd +popd + %install +pushd llvm + rm -rf %{buildroot} %ninja_install -C build +popd + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-, root, root) +%license llvm/LICENSE.TXT %{_bindir}/* %{_libdir}/*.so.* %{_libdir}/libLLVM-*.so