From 861fec9cdd648c76c677c1e7a3a06f9854278a80 Mon Sep 17 00:00:00 2001 From: Andrey Bondrov Date: Fri, 11 Oct 2013 00:27:42 +1100 Subject: [PATCH] LOG New version 3.3, too many spec changes to mention --- .abf.yml | 6 +- 0000-clang-mandriva.patch | 144 +++++++++++++++++ clang-hardfloat-hack.patch | 13 ++ llvm.rpmlintrc | 1 + llvm.spec | 306 ++++++++++++++++++++++++------------- 5 files changed, 363 insertions(+), 107 deletions(-) create mode 100644 0000-clang-mandriva.patch create mode 100644 clang-hardfloat-hack.patch create mode 100644 llvm.rpmlintrc diff --git a/.abf.yml b/.abf.yml index 41d834b..7a26d3d 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,3 +1,5 @@ sources: - "clang-3.1.src.tar.gz": 19f33b187a50d22fda2a6f9ed989699a9a9efd62 - "llvm-3.1.src.tar.gz": 234c96e73ef81aec9a54da92fc2a9024d653b059 + llvm-3.3.src.tar.gz: c6c22d5593419e3cb47cbcf16d967640e5cce133 + cfe-3.3.src.tar.gz: ccd6dbf2cdb1189a028b70bcb8a22509c25c74c8 + clang-tools-extra-3.3.src.tar.gz: 6f7af9ba8014f7e286a02e4ae2e3f2017b8bfac2 + polly-3.3.src.tar.gz: eb75f5674fedf77425d16c9c0caec04961f03e04 diff --git a/0000-clang-mandriva.patch b/0000-clang-mandriva.patch new file mode 100644 index 0000000..e4192c4 --- /dev/null +++ b/0000-clang-mandriva.patch @@ -0,0 +1,144 @@ +--- clang/lib/Driver/ToolChains.cpp.orig 2013-05-06 12:08:21.033135389 +0200 ++++ clang/lib/Driver/ToolChains.cpp 2013-05-06 12:53:31.740246887 +0200 +@@ -1082,11 +1082,23 @@ Generic_GCC::GCCInstallationDetector::GC + static const char *const ARMLibDirs[] = { "/lib" }; + static const char *const ARMTriples[] = { + "arm-linux-gnueabi", +- "arm-linux-androideabi" ++ "arm-linux-androideabi", ++ "arm-mandriva-linux-gnueabi", ++ "arm-mandriva-linux-androideabi", ++ "armv6-mandriva-linux-gnueabi", ++ "armv6-mandriva-linux-androideabi", ++ "armv7-mandriva-linux-gnueabi", ++ "armv7-mandriva-linux-androideabi", ++ "armv7hl-mandriva-linux-gnueabi", ++ "armv7hl-mandriva-linux-androideabi", + }; + static const char *const ARMHFTriples[] = { + "arm-linux-gnueabihf", + "armv7hl-redhat-linux-gnueabi" ++ "arm-mandriva-linux-gnueabihf", ++ "armv6-mandriva-linux-gnueabihf", ++ "armv7-mandriva-linux-gnueabihf", ++ "armv7hl-mandriva-linux-gnueabihf", + }; + + static const char *const X86_64LibDirs[] = { "/lib64", "/lib" }; +@@ -1094,6 +1106,7 @@ Generic_GCC::GCCInstallationDetector::GC + "x86_64-linux-gnu", + "x86_64-unknown-linux-gnu", + "x86_64-pc-linux-gnu", ++ "x86_64-mandriva-linux-gnu", + "x86_64-redhat-linux6E", + "x86_64-redhat-linux", + "x86_64-suse-linux", +@@ -1107,6 +1120,8 @@ Generic_GCC::GCCInstallationDetector::GC + "i686-pc-linux-gnu", + "i486-linux-gnu", + "i386-linux-gnu", ++ "i586-mandriva-linux-gnu", ++ "i686-mandriva-linux-gnu", + "i386-redhat-linux6E", + "i686-redhat-linux", + "i586-redhat-linux", +@@ -1135,11 +1150,13 @@ Generic_GCC::GCCInstallationDetector::GC + "powerpc-linux-gnu", + "powerpc-unknown-linux-gnu", + "powerpc-linux-gnuspe", ++ "powerpc-mandriva-linux-gnu", + "powerpc-suse-linux", + "powerpc-montavista-linuxspe" + }; + static const char *const PPC64LibDirs[] = { "/lib64", "/lib" }; + static const char *const PPC64Triples[] = { ++ "powerpc64-mandriva-linux-gnu", + "powerpc64-linux-gnu", + "powerpc64-unknown-linux-gnu", + "powerpc64-suse-linux", +@@ -1993,6 +2010,9 @@ enum Distro { + UbuntuPrecise, + UbuntuQuantal, + UbuntuRaring, ++ Mandriva, ++ OpenMandriva, ++ ROSA, + UnknownDistro + }; + +@@ -2013,6 +2033,10 @@ static bool IsUbuntu(enum Distro Distro) + return Distro >= UbuntuHardy && Distro <= UbuntuRaring; + } + ++static bool IsMandriva(enum Distro Distro) { ++ return Distro >= Mandriva && Distro <= ROSA; ++} ++ + static Distro DetectDistro(llvm::Triple::ArchType Arch) { + OwningPtr File; + if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) { +@@ -2020,7 +2044,15 @@ static Distro DetectDistro(llvm::Triple: + SmallVector Lines; + Data.split(Lines, "\n"); + Distro Version = UnknownDistro; +- for (unsigned i = 0, s = Lines.size(); i != s; ++i) ++ for (unsigned i = 0, s = Lines.size(); i != s; ++i) { ++ if (Version == UnknownDistro && Lines[i].startswith("DISTRIB_ID=MandrivaLinux")) ++ Version = Mandriva; // It's either Mandriva or a close derivate, will get details from DISTRIB_DESCRIPTION ++ if (Version == Mandriva && Lines[i].startswith("DISTRIB_DESCRIPTION=")) { ++ if(Lines[i].substr(20).find("ROSA") != StringRef::npos) ++ Version = ROSA; ++ else if(Lines[i].substr(20).find("Open") != StringRef::npos) ++ Version = OpenMandriva; ++ } + if (Version == UnknownDistro && Lines[i].startswith("DISTRIB_CODENAME=")) + Version = llvm::StringSwitch(Lines[i].substr(17)) + .Case("hardy", UbuntuHardy) +@@ -2035,6 +2067,7 @@ static Distro DetectDistro(llvm::Triple: + .Case("quantal", UbuntuQuantal) + .Case("raring", UbuntuRaring) + .Default(UnknownDistro); ++ } + return Version; + } + +@@ -2181,8 +2214,10 @@ static bool isMipsR2Arch(llvm::Triple::A + + static StringRef getMultilibDir(const llvm::Triple &Triple, + const ArgList &Args) { +- if (!isMipsArch(Triple.getArch())) +- return Triple.isArch32Bit() ? "lib32" : "lib64"; ++ llvm::Triple::ArchType Arch = Triple.getArch(); ++ Distro Distro = DetectDistro(Arch); ++ if (!isMipsArch(Arch)) ++ return Triple.isArch32Bit() ? (IsMandriva(Distro) ? "lib" : "lib32") : "lib64"; + + // lib32 directory has a special meaning on MIPS targets. + // It contains N32 ABI binaries. Use this folder if produce +@@ -2208,7 +2243,7 @@ Linux::Linux(const Driver &D, const llvm + + Distro Distro = DetectDistro(Arch); + +- if (IsOpenSuse(Distro) || IsUbuntu(Distro)) { ++ if (IsOpenSuse(Distro) || IsUbuntu(Distro) || IsMandriva(Distro)) { + ExtraOpts.push_back("-z"); + ExtraOpts.push_back("relro"); + } +@@ -2228,7 +2263,7 @@ Linux::Linux(const Driver &D, const llvm + // ABI requires a mapping between the GOT and the symbol table. + // Android loader does not support .gnu.hash. + if (!IsMips && !IsAndroid) { +- if (IsRedhat(Distro) || IsOpenSuse(Distro) || ++ if (IsRedhat(Distro) || IsOpenSuse(Distro) || IsMandriva(Distro) || + (IsUbuntu(Distro) && Distro >= UbuntuMaverick)) + ExtraOpts.push_back("--hash-style=gnu"); + +@@ -2246,7 +2281,7 @@ Linux::Linux(const Driver &D, const llvm + (IsUbuntu(Distro) && Distro >= UbuntuKarmic)) + ExtraOpts.push_back("--build-id"); + +- if (IsOpenSuse(Distro)) ++ if (IsOpenSuse(Distro) || IsMandriva(Distro)) + ExtraOpts.push_back("--enable-new-dtags"); + + // The selection of paths to try here is designed to match the patterns which diff --git a/clang-hardfloat-hack.patch b/clang-hardfloat-hack.patch new file mode 100644 index 0000000..d7d981a --- /dev/null +++ b/clang-hardfloat-hack.patch @@ -0,0 +1,13 @@ +--- llvm-3.2.src.orig/lib/Driver/Tools.cpp 2012-11-21 01:56:23.000000000 -0600 ++++ llvm-3.2.src/lib/Driver/Tools.cpp 2013-03-31 21:08:41.890206683 -0500 +@@ -688,8 +688,8 @@ + } + default: + // Assume "soft", but warn the user we are guessing. +- FloatABI = "soft"; +- D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft"; ++ FloatABI = "hard"; ++ D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "hard"; + break; + } + } diff --git a/llvm.rpmlintrc b/llvm.rpmlintrc new file mode 100644 index 0000000..1a60d9f --- /dev/null +++ b/llvm.rpmlintrc @@ -0,0 +1 @@ +addFilter("E: hardcoded-library-path") diff --git a/llvm.spec b/llvm.spec index 242bfab..7e7ad86 100644 --- a/llvm.spec +++ b/llvm.spec @@ -9,39 +9,52 @@ %bcond_without clang -Name: llvm -Version: 3.1 -Release: 2 Summary: Low Level Virtual Machine (LLVM) -License: University of Illinois/NCSA Open Source License +Name: llvm +Version: 3.3 +Release: 4 +License: NCSA Group: Development/Other -URL: http://llvm.org/ +Url: http://llvm.org/ +# There's a branch of LLVM maintained at +# git://people.freedesktop.org/~tstellar/llvm +# Ir is the working branch of the AMDGPU/R600 backend needed by Mesa (and is otherwise +# more or less identical to upstream llvm). +# At times it may be necessary to package this branch instead. Source0: http://llvm.org/releases/%{version}/llvm-%{version}.src.tar.gz -Source1: http://llvm.org/releases/%{version}/clang-%{version}.src.tar.gz +Source1: http://llvm.org/releases/%{version}/cfe-%{version}.src.tar.gz +Source2: http://llvm.org/releases/%{version}/clang-tools-extra-%{version}.src.tar.gz +Source3: http://llvm.org/releases/%{version}/polly-%{version}.src.tar.gz +Source1000: llvm.rpmlintrc # Versionize libclang.so (Anssi 08/2012): Patch0: clang-soname.patch -# Add libclangTooling.a to libclang.so, backport from upstream -Patch1: clang-shared-tooling.patch -Obsoletes: llvm-ocaml -Requires: libstdc++-devel +# Adjust search paths to match the OS +Patch1: 0000-clang-mandriva.patch +# ARM hardfloat hack +# see http://llvm.org/bugs/show_bug.cgi?id=15557 +# and https://bugzilla.redhat.com/show_bug.cgi?id=803433 +Patch2: clang-hardfloat-hack.patch BuildRequires: bison -BuildRequires: groff BuildRequires: chrpath +BuildRequires: flex +BuildRequires: graphviz +BuildRequires: groff +BuildRequires: libtool BuildRequires: ocaml +BuildRequires: sed BuildRequires: tcl +BuildRequires: zip +BuildRequires: libstdc++-devel +BuildRequires: pkgconfig(cloog-isl) +BuildRequires: pkgconfig(isl) +BuildRequires: pkgconfig(libffi) %if %{compile_apidox} BuildRequires: doxygen %endif -BuildRequires: flex -BuildRequires: sed -BuildRequires: graphviz -BuildRequires: libstdc++-devel -BuildRequires: libtool -BuildRequires: zip -BuildRequires: libffi-devel +Requires: libstdc++-devel %description -LLVM is a robust system, particularly well suited for developing new mid-level +LVM is a robust system, particularly well suited for developing new mid-level language-independent analyses and optimizations of all sorts, including those that require extensive interprocedural analysis. LLVM is also a great target for front-end development for conventional or research programming languages, @@ -60,7 +73,6 @@ for effective implementation, proper tail calls or garbage collection. %{_bindir}/llvm-diff %{_bindir}/llvm-dis %{_bindir}/llvm-extract -%{_bindir}/llvm-ld %{_bindir}/llvm-link %{_bindir}/llvm-mc %{_bindir}/llvm-nm @@ -68,54 +80,51 @@ for effective implementation, proper tail calls or garbage collection. %{_bindir}/llvm-prof %{_bindir}/llvm-ranlib %{_bindir}/llvm-readobj -%{_bindir}/llvm-stub %{_bindir}/llvm-cov %{_bindir}/llvm-dwarfdump +%{_bindir}/llvm-mcmarkup %{_bindir}/llvm-rtdyld %{_bindir}/llvm-size %{_bindir}/llvm-stress +%{_bindir}/llvm-symbolizer %{_bindir}/llvm-tblgen %{_bindir}/macho-dump -%{_mandir}/man1/bugpoint.1* -%{_mandir}/man1/l* -%{_mandir}/man1/opt.1* -%{_mandir}/man1/tblgen.1* %{_libdir}/ocaml/* -#----------------------------------------------------------- +#---------------------------------------------------------------------------- -%define major %version -%define libname %mklibname %name %major +%define major %{version} +%define libname %mklibname %{name} %{major} -%package -n %libname -Summary: LLVM shared libraries -Group: System/Libraries -Conflicts: llvm < 3.0-4 +%package -n %{libname} +Summary: LLVM shared libraries +Group: System/Libraries +Conflicts: llvm < 3.0-4 -%description -n %libname +%description -n %{libname} Shared libraries for the LLVM compiler infrastructure. This is needed by programs that are dynamically linked against libLLVM. -%files -n %libname -%{_libdir}/libLLVM-%major.so +%files -n %{libname} +%{_libdir}/libLLVM-%{major}.so -#----------------------------------------------------------- +#---------------------------------------------------------------------------- -%define libname_devel %mklibname -d %name +%define devname %mklibname -d %{name} -%package -n %{libname_devel} -Summary: Development files for LLVM -Group: Development/Other -Provides: llvm-devel = %version-%release -Requires: %libname = %version-%release -Requires: %name = %version-%release -Conflicts: llvm < 3.0-7 -Conflicts: %{_lib}llvm3.0 < 3.0-9 +%package -n %{devname} +Summary: Development files for LLVM +Group: Development/Other +Provides: llvm-devel = %{EVRD} +Requires: %{libname} = %{EVRD} +Requires: %{name} = %{EVRD} +Conflicts: llvm < 3.0-7 +Conflicts: %{_lib}llvm3.0 < 3.0-9 -%description -n %{libname_devel} +%description -n %{devname} This package contains the development files for LLVM. -%files -n %{libname_devel} +%files -n %{devname} %{_bindir}/%{name}-config %{_libdir}/libLLVM.so %{_includedir}/%{name} @@ -130,24 +139,21 @@ This package contains the development files for LLVM. %{_libdir}/%{name}/libprofile_rt.so %{_libdir}/%{name}/libllvm*.a -#----------------------------------------------------------- +#---------------------------------------------------------------------------- %package doc -Summary: Documentation for LLVM -Group: Books/Computer books -Requires: %{name} = %{version} -BuildArch: noarch -Obsoletes: llvm-doc-devel +Summary: Documentation for LLVM +Group: Books/Computer books +Requires: %{name} = %{EVRD} +BuildArch: noarch %description doc Documentation for the LLVM compiler infrastructure. %files doc -%defattr(-,root,root,-) %doc README.txt %doc docs/*.css %doc docs/*.html -%doc docs/img %doc docs/tutorial %doc docs/ocamldoc %doc examples @@ -155,24 +161,74 @@ Documentation for the LLVM compiler infrastructure. %doc docs/doxygen %endif -#----------------------------------------------------------- +#---------------------------------------------------------------------------- + +%package polly +Summary: Polyhedral optimizations for LLVM +License: MIT +Group: Development/Other + +%description polly +Polly is a polyhedral optimizer for LLVM. + +Using an abstract mathematical representation it analyzes and optimizes +the memory access pattern of a program. This includes data-locality +optimizations for cache locality as well as automatic parallelization +for thread-level and SIMD parallelism. + +Our overall goal is an integrated optimizer for data-locality and +parallelism that takes advantage of multi-cores, cache hierarchies, +short vector instructions as well as dedicated accelerators. + +%files polly +%{_bindir}/pollycc +%{_bindir}/pollyc++ +%{_libdir}/llvm/LLVMPolly.so + +#---------------------------------------------------------------------------- + +%package polly-devel +Summary: Development files for Polly +License: MIT +Group: Development/Other + +%description polly-devel +Development files for Polly. + +Polly is a polyhedral optimizer for LLVM. + +Using an abstract mathematical representation it analyzes and optimizes +the memory access pattern of a program. This includes data-locality +optimizations for cache locality as well as automatic parallelization +for thread-level and SIMD parallelism. + +Our overall goal is an integrated optimizer for data-locality and +parallelism that takes advantage of multi-cores, cache hierarchies, +short vector instructions as well as dedicated accelerators. + +%files polly-devel +%{_includedir}/polly +%{_libdir}/llvm/libpollyanalysis.a +%{_libdir}/llvm/libpollycodegen.a +%{_libdir}/llvm/libpollyexchange.a +%{_libdir}/llvm/libpollyjson.a +%{_libdir}/llvm/libpollysupport.a + +#---------------------------------------------------------------------------- %if %{with clang} -%define clang_major %version -%define clang_libname %mklibname clang %clang_major - # TODO: %{_bindir}/clang is linked against static libclang.a, could it be # linked against libclang.so instead, like llvm-* are against livLLVM.so? %package -n clang -Summary: A C language family front-end for LLVM -License: NCSA -Group: Development/Other +Summary: A C language family front-end for LLVM +License: NCSA +Group: Development/Other # TODO: is this requires:llvm needed, or just legacy from fedora pkg layout? -Requires: llvm%{?_isa} = %{version}-%{release} +Requires: llvm = %{EVRD} # clang requires gcc, clang++ requires libstdc++-devel -Requires: gcc -Requires: libstdc++-devel >= %{gcc_version} +Requires: gcc +Requires: libstdc++-devel >= %{gcc_version} %description -n clang clang: noun @@ -187,53 +243,68 @@ as libraries and designed to be loosely-coupled and extensible. %files -n clang %doc clang-docs/* %{_bindir}/clang* +%{_bindir}/cpp11-migrate +%{_libdir}/llvm/libmigrateCore.a %{_bindir}/c-index-test %{_prefix}/lib/clang %doc %{_mandir}/man1/clang.1.* +%endif -%package -n %clang_libname -Summary: Shared library for clang -Group: System/Libraries +#---------------------------------------------------------------------------- -%description -n %clang_libname +%if %{with clang} +%define clang_major %{version} +%define libclang %mklibname clang %{clang_major} + +%package -n %{libclang} +Summary: Shared library for clang +Group: System/Libraries + +%description -n %{libclang} Shared libraries for the clang compiler. This is needed by programs that are dynamically linked against libclang. -%files -n %clang_libname -%{_libdir}/libclang-%clang_major.so +%files -n %{libclang} +%{_libdir}/libclang-%{clang_major}.so +%endif -#----------------------------------------------------------- +#---------------------------------------------------------------------------- -%define clang_libname_devel %mklibname -d clang +%if %{with clang} +%define devclang %mklibname -d clang -%package -n %{clang_libname_devel} -Summary: Development files for clang -Group: Development/Other -Requires: %clang_libname = %version-%release -Provides: clang-devel = %version-%release +%package -n %{devclang} +Summary: Development files for clang +Group: Development/Other +Requires: %{libclang} = %{EVRD} +Provides: clang-devel = %{EVRD} Conflicts: llvm-devel < 3.1 Obsoletes: clang-devel < 3.1 -%description -n %{clang_libname_devel} +%description -n %{devclang} This package contains header files and libraries needed for using libclang. -%files -n %{clang_libname_devel} +%files -n %{devclang} %{_includedir}/clang %{_includedir}/clang-c %{_libdir}/libclang.so %dir %{_libdir}/%{name} %{_libdir}/%{name}/libclang*.a %{_libdir}/%{name}/libclang*.so +%endif +#---------------------------------------------------------------------------- + +%if %{with clang} %package -n clang-analyzer -Summary: A source code analysis framework -License: NCSA -Group: Development/Other -Requires: clang%{?_isa} = %{version}-%{release} +Summary: A source code analysis framework +License: NCSA +Group: Development/Other +Requires: clang = %{EVRD} # not picked up automatically since files are currently not instaled # in standard Python hierarchies yet -Requires: python +Requires: python %description -n clang-analyzer The Clang Static Analyzer consists of both a source code analysis @@ -245,42 +316,51 @@ intended to run in tandem with a build of a project or code base. %{_bindir}/scan-build %{_bindir}/scan-view %{_libdir}/clang-analyzer +%endif +#---------------------------------------------------------------------------- +%if %{with clang} %package -n clang-doc -Summary: Documentation for Clang -Group: Books/Computer books -BuildArch: noarch -Requires: %{name} = %{version}-%{release} +Summary: Documentation for Clang +Group: Books/Computer books +BuildArch: noarch +Requires: %{name} = %{EVRD} %description -n clang-doc Documentation for the Clang compiler front-end. %files -n clang-doc %doc clang-docs-full/* - %endif -#----------------------------------------------------------- +#---------------------------------------------------------------------------- %prep -%setup -qn %{name}-%{version}.src %{?with_clang:-a1} +%setup -qn %{name}-%{version}.src %{?with_clang:-a1 -a2 -a3} rm -rf tools/clang %if %{with clang} -mv clang-%{version}%{?prerel}.src tools/clang +mv cfe-%{version}%{?prerel}.src tools/clang +mv polly-%{version}%{?prerel}.src tools/polly +mv clang-tools-extra-%{version}%{?prerel}.src tools/clang/tools/extra cd tools/clang %patch0 -p1 -%patch1 -p1 +%patch1 -p1 -b .mandriva~ +%patch2 -p1 -b .armhf cd - %endif -%build +# Upstream tends to forget to remove "rc" and "svn" markers from version +# numbers before making releases +sed -i -re 's|^(AC_INIT[^,]*,\[)([0-9.]*)([^]])*(.*)|\1\2\4|' autoconf/configure.ac +sed -i -re "s|(PACKAGE_VERSION='[0-9.]*)([^']*)(.*)|\1\3|g;s|(PACKAGE_STRING='LLVM [0-9.]*)([^']*)(.*)|\1\3|g" configure +%build # Build with gcc/g++, not clang if it happens to be installed # (blino) clang < 3.1 does not handle system headers from gcc 4.7 # http://llvm.org/bugs/show_bug.cgi?id=11916 -export CC=gcc -export CXX=g++ +export CC=%__cc +export CXX=%__cxx %configure2_5x \ --libdir=%{_libdir}/%{name} \ @@ -289,11 +369,14 @@ export CXX=g++ --enable-jit \ --enable-libffi \ --enable-optimized \ - --enable-targets=host-only \ + --enable-targets=all \ + --enable-experimental-targets=R600 \ --disable-expensive-checks \ --enable-debug-runtime \ --disable-assertions \ --enable-threads \ + --with-cloog=%{_prefix} \ + --with-isl=%{_prefix} \ %if %{compile_apidox} --enable-doxygen %endif @@ -317,15 +400,15 @@ cp bindings/ocaml/llvm/META.llvm bindings/ocaml/llvm/Release/ PROJ_libdir=%{_libdir}/%{name} # Invalid dir -rm -rf %buildroot%_bindir/.dir +rm -rf %{buildroot}%{_bindir}/.dir # wrong rpath entries (Anssi 11/2011) file %{buildroot}/%{_bindir}/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d file %{buildroot}/%{_libdir}/llvm/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d # move shared library to standard library path and add devel symlink (Anssi 11/2011) -mv %{buildroot}%{_libdir}/llvm/libLLVM-%major.so %{buildroot}%{_libdir} -ln -s libLLVM-%major.so %{buildroot}%{_libdir}/libLLVM.so +mv %{buildroot}%{_libdir}/llvm/libLLVM-%{major}.so %{buildroot}%{_libdir} +ln -s libLLVM-%{major}.so %{buildroot}%{_libdir}/libLLVM.so # Also, create shared library symlinks corresponding to all the static library # names, so that using e.g. "-lLLVMBitReader" will cause the binary to be linked # against the shared library instead of static library by default. (Anssi 08/2012) @@ -335,10 +418,10 @@ for staticlib in %{buildroot}%{_libdir}/llvm/libLLVM*.a; do ln -s ../libLLVM.so "$sharedlib" done -%if %with clang +%if %{with clang} # Versionize libclang.so (patch0 makes the same change to soname) and move it to standard path. -mv %{buildroot}%{_libdir}/llvm/libclang.so %{buildroot}%{_libdir}/libclang-%version.so -ln -s libclang-%clang_major.so %{buildroot}%{_libdir}/libclang.so +mv %{buildroot}%{_libdir}/llvm/libclang.so %{buildroot}%{_libdir}/libclang-%{version}.so +ln -s libclang-%{clang_major}.so %{buildroot}%{_libdir}/libclang.so ln -s ../libclang.so %{buildroot}%{_libdir}/llvm/libclang.so # NOTE: We don't create devel symlinks for the libclang.so for libclang*.a libraries @@ -352,7 +435,6 @@ ln -s ../libclang.so %{buildroot}%{_libdir}/llvm/libclang.so strip --strip-debug %{buildroot}%{_libdir}/llvm/*.a %if %{with clang} - # Static analyzer not installed by default: # http://clang-analyzer.llvm.org/installation#OtherPlatforms mkdir -p %{buildroot}%{_libdir}/clang-analyzer @@ -375,7 +457,21 @@ rm -rf clang-docs-full cp -al tools/clang/docs clang-docs-full rm -rf clang-docs-full/{doxygen*,Makefile*,*.graffle,tools} +# Polly bits as described on +# http://polly.llvm.org/example_load_Polly_into_clang.html +cat >%{buildroot}%{_bindir}/pollycc <<'EOF' +#!/bin/sh +exec %{_bindir}/clang -O3 -Xclang -load -Xclang %{_libdir}/llvm/LLVMPolly.so "$@" +EOF +cat >%{buildroot}%{_bindir}/pollyc++ <<'EOF' +#!/bin/sh +exec %{_bindir}/clang++ -O3 -Xclang -load -Xclang %{_libdir}/llvm/LLVMPolly.so "$@" +EOF +chmod 0755 %{buildroot}%{_bindir}/pollycc %{buildroot}%{_bindir}/pollyc++ %endif # Get rid of erroneously installed example files. rm %{buildroot}%{_libdir}/%{name}/LLVMHello.so + +# Fix bogus permissions +find %{buildroot} -name "*.a" -a -type f|xargs chmod 0644