fix link against libllvm by changing and extending build arguments and external llvm subpackages [release 5.0.0-2mamba;Tue Nov 28 2017]

This commit is contained in:
Silvan Calarco 2024-01-06 06:26:09 +01:00
parent d1cfc76935
commit ecc78e2f5e
4 changed files with 157 additions and 117 deletions

View File

@ -0,0 +1,26 @@
Description: Silent a test failing on yakkety amd64
/tmp/buildd/llvm-toolchain-snapshot-4.0~svn279801/test/tools/llvm-symbolizer/print_context.c:16:11: error: expected string not found in input
// CHECK: inc
^
<stdin>:1:1: note: scanning from here
_fini
^
<stdin>:1:3: note: possible intended match here
_fini
^
Author: Sylvestre <sylvestre@debian.org>
Last-Update: 2016-08-26
Index: llvm-toolchain-3.9-3.9~+rc1/test/tools/llvm-symbolizer/print_context.c
===================================================================
--- llvm-toolchain-3.9-3.9~+rc1.orig/test/tools/llvm-symbolizer/print_context.c
+++ llvm-toolchain-3.9-3.9~+rc1/test/tools/llvm-symbolizer/print_context.c
@@ -1,7 +1,7 @@
// REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s
-
+// XFAIL: *
#include <stdio.h>
int inc(int a) {

View File

@ -0,0 +1,12 @@
--- llvm-5.0.0.src/tools/llvm-shlib/CMakeLists.txt.orig 2017-11-28 10:25:33.606319245 +0100
+++ llvm-5.0.0.src/tools/llvm-shlib/CMakeLists.txt 2017-11-28 10:24:41.439227412 +0100
@@ -36,7 +36,9 @@
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
+if(LIB_NAMES)
list(REMOVE_DUPLICATES LIB_NAMES)
+endif()
if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf"
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in

View File

@ -1,6 +1,6 @@
--- llvm-3.7.0.src/tools/clang/lib/Driver/ToolChains.cpp.orig 2015-09-16 00:05:59.717766100 +0200
+++ llvm-3.7.0.src/tools/clang/lib/Driver/ToolChains.cpp 2015-09-16 00:13:50.282779926 +0200
@@ -1272,7 +1272,8 @@
--- llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp.orig 2017-11-28 09:10:30.171661497 +0100
+++ llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp 2017-11-28 09:11:30.022800395 +0100
@@ -1808,7 +1808,8 @@
"aarch64_be-linux-gnu"};
static const char *const ARMLibDirs[] = {"/lib"};
@ -9,22 +9,20 @@
+ "arm-linux-gnueabi",
"arm-linux-androideabi"};
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
"armv7hl-redhat-linux-gnueabi"};
@@ -1284,7 +1285,7 @@
"armv7hl-redhat-linux-gnueabi",
@@ -1822,6 +1823,7 @@
static const char *const X86_64LibDirs[] = {"/lib64", "/lib"};
static const char *const X86_64Triples[] = {
- "x86_64-linux-gnu", "x86_64-unknown-linux-gnu",
+ "x86_64-openmamba-linux-gnu", "x86_64-linux-gnu", "x86_64-unknown-linux-gnu",
+ "x86_64-openmamba-linux-gnu",
"x86_64-linux-gnu", "x86_64-unknown-linux-gnu",
"x86_64-pc-linux-gnu", "x86_64-redhat-linux6E",
"x86_64-redhat-linux", "x86_64-suse-linux",
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
@@ -1293,7 +1294,7 @@
@@ -1831,6 +1833,7 @@
static const char *const X32LibDirs[] = {"/libx32"};
static const char *const X86LibDirs[] = {"/lib32", "/lib"};
static const char *const X86Triples[] = {
- "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu",
+ "i586-openmamba-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu",
+ "i586-openmamba-linux-gnu",
"i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu",
"i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux",
"i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
"i486-slackware-linux", "i686-montavista-linux", "i686-linux-android",

212
llvm.spec
View File

@ -1,26 +1,34 @@
%define gccver %(gcc -dumpversion)
%define majver %(echo %version | cut -d. -f1-2)
Name: llvm
Version: 3.8.1
Release: 1mamba
Version: 5.0.0
Release: 2mamba
Summary: The Low Level Virtual Machine
Group: Development/Languages
Vendor: openmamba
Distribution: openmamba
Packager: Davide Madrisan <davide.madrisan@gmail.com>
URL: http://llvm.org/
Source0: http://llvm.org/releases/%{version}/llvm-%{version}.src.tar.xz
Source1: http://llvm.org/releases/%{version}/cfe-%{version}.src.tar.xz
Source0: http://releases.llvm.org/%{version}/llvm-%{version}.src.tar.xz
Source1: http://releases.llvm.org/%{version}/cfe-%{version}.src.tar.xz
Source2: http://releases.llvm.org/%{version}/compiler-rt-%{version}.src.tar.xz
Source3: http://releases.llvm.org/%{version}/clang-tools-extra-%{version}.src.tar.xz
Source4: http://releases.llvm.org/%{version}/lld-%{version}.src.tar.xz
Source5: http://releases.llvm.org/%{version}/lldb-%{version}.src.tar.xz
Patch0: %{name}-3.1-llvm-config.patch
Patch1: llvm-3.4-default-to-i586.patch
Patch2: llvm-3.7.0-openmamba-triplet.patch
Patch2: llvm-5.0.0-openmamba-triplet.patch
Patch3: llvm-3.5.0-buildfix-CommandLine_h-getOption.patch
Patch4: llvm-3.5.0-x86_64-llvm-config.patch
Patch5: llvm-3.5.0-llvm-config.patch
Patch6: llvm-3.8.0-ocamldoc-install.patch
Patch7: llvm-5.0.0-llvm-shlib-build-fix.patch
Patch8: llvm-5.0.0-disable-symbolizer-test.patch
License: NCSA
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libedit-devel
BuildRequires: libffi-devel
BuildRequires: libgcc
BuildRequires: libncurses-devel
BuildRequires: libperl
@ -34,8 +42,11 @@ BuildRequires: glibc-devel
BuildRequires: ocaml
BuildRequires: ocaml-ctypes
BuildRequires: ocaml-ounit
BuildRequires: z3
BuildRequires: libz3-devel
#Requires: gcc >= %{gccver}
#Requires: gcc-c++ >= %{gccver}
BuildConflicts: llvm-ocaml
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
@ -73,6 +84,16 @@ The LLVM Project is a collection of modular and reusable compiler and toolchain
Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them.
This package contains library and header files needed to develop new native programs that use the LLVM infrastructure.
%package tools
Summary: Additional LLVM tools
Group: Development/Languages
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description tools
The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them.
This package contains additional LLVM tools.
%package -n clang
Summary: LLVM native C/C++/Objective-C compiler
Group: Development/Languages
@ -118,11 +139,17 @@ Requires: ocaml
The %{name}-ocaml-devel package contains libraries and signature files for developing applications that use %{name}-ocaml.
%prep
%setup -q -a1 -n %{name}-%{version}.src -D -T
:<< __EOF
%setup -q -a1 -a2 -a3 -a4 -a5 -n %{name}-%{version}.src
#-D -T
#:<< __EOF
#%patch0 -p1
#%patch1 -p1
mv cfe-%{version}.src tools/clang
mv compiler-rt-%{version}.src projects/compiler-rt
mv clang-tools-extra-%{version}.src tools/clang/tools/extra
mv lld-%{version}.src tools/lld
mv lldb-%{version}.src tools/lldb
%patch2 -p1
#%patch3 -p1
#%ifarch x86_64
@ -131,10 +158,18 @@ mv cfe-%{version}.src tools/clang
#%patch5 -p1
#%endif
%patch6 -p1
%patch7 -p1
%patch8 -p1
# https://bugs.llvm.org/show_bug.cgi?id=34123
sed -i '/LLVMSupport/d' tools/clang/tools/extra/clangd/tool/CMakeLists.txt
%build
#:<< _EOF
%cmake -d build \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_HOST_TRIPLE="%{_target_platform}" \
-DLLVM_DEFAULT_TARGET_TRIPLE="%{_target_platform}" \
%ifarch x86_64
-DLLVM_LIBDIR_SUFFIX="64/llvm" \
%else
@ -142,58 +177,24 @@ mv cfe-%{version}.src tools/clang
%endif
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_DYLIB_EXPORT_ALL=ON \
-DLLVM_LINK_LLVM_DYLIB=OFF \
%ifnarch arm
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_BUILD_DOCS=ON \
%else
-DLLVM_BUILD_EXTERNAL_COMPILER_RT=OFF \
%endif
-DLLVM_ENABLE_FFI=ON \
%ifnarch arm
-DLLVM_BUILD_TESTS=ON \
-DLLVM_BUILD_DOCS=ON \
%endif
-DLLVM_ENABLE_SPHINX=ON \
-DLLVM_ENABLE_DOXYGEN=OFF \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DFFI_INCLUDE_DIR=`pkg-config --variable=includedir libffi` \
-DLLVM_BINUTILS_INCDIR=/usr/include \
-DLLVM_INSTALL_UTILS=ON \
-DLLDB_DISABLE_PYTHON=ON
:<< __OLD
mkdir -p build
cd build
# 3.8.0: set libdir as %{_libdir}/llvm
%ifarch x86_64
sed -i 's|@LLVM_LIBDIR_SUFFIX@|64/%{name}|g' ../tools/llvm-config/BuildVariables.inc.in
%else
sed -i 's|@LLVM_LIBDIR_SUFFIX@|/%{name}|g' ../tools/llvm-config/BuildVariables.inc.in
%endif
#:<< ___EOF
ln -sf ../configure .
%configure \
--with-arch=%{_target_cpu} \
--target=%{_target_cpu} \
--libdir=%{_libdir}/%{name} \
--datadir=%{_libdir}/%{name} \
--disable-assertions \
--disable-expensive-checks \
--disable-debug-runtime \
--enable-jit \
--enable-shared \
--enable-lffi \
--enable-targets=all \
--with-gcc-toolchain=%{_prefix} \
--with-c-include-dirs=%{_includedir}:%{_libdir}/gcc/%{_target_platform}/%{gccver}/include \
--with-cxx-include-root=%{_includedir}/c++/%{gccver} \
--with-cxx-include-arch=%{_target_platform} \
--with-extra-ld-options="-Wl,-R,%{_libdir}/gcc/%{_target_platform}/%{gccver}"
# --enable-doxygen
sed -i 's|(PROJ_prefix)/lib|(PROJ_prefix)/%{_lib}/%{name}|g' Makefile.config
#___EOF
__OLD
# -DLLVM_LINK_LLVM_DYLIB=OFF \
# -DBUILD_SHARED_LIBS=ON \
%make
@ -209,38 +210,6 @@ EOF
rm -f %{buildroot}%{_datadir}/doc/clang/html/.buildinfo
rm -f %{buildroot}%{_datadir}/doc/llvm/html/.buildinfo
mv %{buildroot}%{_prefix}/docs/ocaml %{buildroot}%{_docdir}/ocaml
%ifarch x86_64
mv %{buildroot}%{_prefix}/lib/ocaml %{buildroot}%{_libdir}/
%endif
# Static analyzer not installed by default:
# http://clang-analyzer.llvm.org/installation#OtherPlatforms
#install -d %{buildroot}%{_libdir}/cfe-analyzer
## create launchers
#for f in scan-{build,view}; do
# ln -s %{_libdir}/cfe-analyzer/$f/$f %{buildroot}%{_bindir}/$f
#done
#( cd tools/clang/tools &&
# cp -pr scan-{build,view} %{buildroot}%{_libdir}/cfe-analyzer/ )
#rm -rf ./llvm-extradocs
#mv %{buildroot}%{_prefix}/docs/llvm ./llvm-extradocs || true
#rm -f ./llvm-extradocs/*.tar.gz
#rm -f ./llvm-extradocs/ocamldoc/html/*.tar.gz
#
#install -d cfe-extradocs
#for f in LICENSE.TXT NOTES.txt README.txt; do
# cp tools/clang/$f cfe-extradocs/
#done
##rm -rf tools/clang/docs/{doxygen*,Makefile*,*.graffle,tools}
#rm %{buildroot}%{_libdir}/%{name}/*LLVMHello.*
#find examples -name 'Makefile' | xargs -0r rm -f
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
@ -263,6 +232,7 @@ mv %{buildroot}%{_prefix}/lib/ocaml %{buildroot}%{_libdir}/
#%{_bindir}/c-index-test
%{_bindir}/obj2yaml
%{_bindir}/sancov
%{_bindir}/sanstats
%{_bindir}/verify-uselistorder
%{_bindir}/yaml2obj
#%{_libdir}/ocaml/META.llvm
@ -274,6 +244,8 @@ mv %{buildroot}%{_prefix}/lib/ocaml %{buildroot}%{_libdir}/
%{_datadir}/scan-build/*
%dir %{_datadir}/scan-view
%{_datadir}/scan-view/*
%dir %{_datadir}/opt-viewer
%{_datadir}/opt-viewer/*
%{_mandir}/man1/FileCheck.1*
%{_mandir}/man1/bugpoint.1*
%{_mandir}/man1/lit.1*
@ -302,20 +274,55 @@ mv %{buildroot}%{_prefix}/lib/ocaml %{buildroot}%{_libdir}/
%doc CREDITS.TXT LICENSE.TXT
#doc llvm-testlog.txt
%files tools
%defattr(-,root,root)
%{_bindir}/FileCheck
%{_bindir}/clangd
%{_bindir}/count
%{_bindir}/find-all-symbols
%{_bindir}/ld.lld
%{_bindir}/liblldb-intel-mpxtable.so
%{_bindir}/lld
%{_bindir}/lld-link
%{_bindir}/lldb
%{_bindir}/lldb-argdumper
%{_bindir}/lldb-mi
%{_bindir}/lldb-server
%{_bindir}/lli-child-target
%{_bindir}/modularize
%{_bindir}/not
%{_bindir}/yaml-bench
%dir %{_docdir}/clang-tools
%{_docdir}/clang-tools/*
%dir %{_docdir}/lld
%{_docdir}/lld/*
%{_mandir}/man1/extraclangtools.1*
%files -n libllvm
%defattr(-,root,root)
%{_sysconfdir}/ld.so.conf.d/llvm-%{_arch}.conf
%dir %{_libdir}/llvm
%{_libdir}/llvm/*.so
%{_libdir}/llvm/*.so.*
%{_libdir}/llvm/libLLVM-%{majver}.so
%exclude %{_libdir}/llvm/libclang.so.*
%files -n libllvm-devel
%defattr(-,root,root)
%{_bindir}/llvm-config
%{_includedir}/%{name}
%{_includedir}/%{name}-c
%dir %{_includedir}/lld
%{_includedir}/lld/*
%dir %{_includedir}/lldb
%{_includedir}/lldb/*
#%{_libdir}/%{name}/*.a
%dir %{_datadir}/doc/llvm/html/
%{_datadir}/doc/llvm/html/*
%{_libdir}/llvm/*.a
%{_libdir}/llvm/*.so
%exclude %{_libdir}/llvm/libLLVM-%{majver}.so
%dir %{_libdir}/llvm/cmake/llvm
%{_libdir}/llvm/cmake/llvm/*.cmake
%doc README.txt
%files -n clang
@ -324,10 +331,8 @@ mv %{buildroot}%{_prefix}/lib/ocaml %{buildroot}%{_libdir}/
%{_bindir}/c-index-test
%{_bindir}/clang
%{_bindir}/clang++
%{_bindir}/clang-3.8
%{_bindir}/clang-cl
%{_bindir}/clang-check
%{_bindir}/clang-format
%{_bindir}/clang-%{majver}
%{_bindir}/clang-*
%{_bindir}/git-clang-format
#%{_bindir}/clang-tblgen
#%{_bindir}/count
@ -367,7 +372,6 @@ mv %{buildroot}%{_prefix}/lib/ocaml %{buildroot}%{_libdir}/
%{_includedir}/clang/ASTMatchers/*.h
%dir %{_includedir}/clang/ASTMatchers/Dynamic
%{_includedir}/clang/ASTMatchers/Dynamic/*.h
%dir %{_includedir}/clang/Analysis/Analyses
%{_includedir}/clang/Analysis/Analyses/*.h
%{_includedir}/clang/Analysis/*.h
%dir %{_includedir}/clang/Basic
@ -396,8 +400,7 @@ mv %{buildroot}%{_prefix}/lib/ocaml %{buildroot}%{_libdir}/
%dir %{_includedir}/clang/Lex
%{_includedir}/clang/Lex/*.h
%dir %{_includedir}/clang/Parse
%{_includedir}/clang/Parse/*.h
%{_includedir}/clang/Parse/AttrParserStringSwitches.inc
%{_includedir}/clang/Parse/*
%dir %{_includedir}/clang/Rewrite
%dir %{_includedir}/clang/Rewrite/Core
%{_includedir}/clang/Rewrite/Core/*.h
@ -411,48 +414,49 @@ mv %{buildroot}%{_prefix}/lib/ocaml %{buildroot}%{_libdir}/
%{_includedir}/clang/Serialization/*.inc
%dir %{_includedir}/clang/StaticAnalyzer
%dir %{_includedir}/clang/StaticAnalyzer/Checkers
%{_includedir}/clang/StaticAnalyzer/Checkers/*.h
%{_includedir}/clang/StaticAnalyzer/Checkers/*
%dir %{_includedir}/clang/StaticAnalyzer/Core
%{_includedir}/clang/StaticAnalyzer/Core/*.h
%{_includedir}/clang/StaticAnalyzer/Core/Analyses.def
%dir %{_includedir}/clang/StaticAnalyzer/Core/BugReporter
%{_includedir}/clang/StaticAnalyzer/Core/BugReporter/*.h
%dir %{_includedir}/clang/StaticAnalyzer/Core/PathSensitive
%{_includedir}/clang/StaticAnalyzer/Core/PathSensitive/*.h
%{_includedir}/clang/StaticAnalyzer/Core/PathSensitive/*
%dir %{_includedir}/clang/StaticAnalyzer/Frontend
%{_includedir}/clang/StaticAnalyzer/Frontend/*.h
%dir %{_includedir}/clang/Tooling
%{_includedir}/clang/Tooling/*
#%dir %{_prefix}/lib/clang
#%dir %{_prefix}/lib/clang/%{version}
#%dir %{_prefix}/lib/clang/%{version}/include
#%{_prefix}/lib/clang/%{version}/include/*.h
#%{_prefix}/lib/clang/%{version}/include/module.modulemap
%dir %{_datadir}/doc/clang/html/
%{_datadir}/doc/clang/html/*
%dir %{_datadir}/llvm/cmake
%{_datadir}/llvm/cmake/*.cmake
%dir %{_libdir}/llvm/cmake/clang
%{_libdir}/llvm/cmake/clang/*.cmake
%doc tools/clang/{NOTES.txt,README.txt}
%doc tools/clang/docs
%files ocaml
%defattr(-,root,root)
%{_libdir}/ocaml/*.cma
%{_libdir}/ocaml/*.cmi
%{_libdir}/ocaml/llvm/*.cma
%{_libdir}/ocaml/llvm/*.cmi
%{_libdir}/ocaml/llvm/*.mli
%{_libdir}/ocaml/META.llvm*
%{_libdir}/ocaml/dllllvm*.so
%{_libdir}/ocaml/stublibs/dllllvm*.so
%files ocaml-devel
%defattr(-,root,root)
%{_libdir}/ocaml/*.a
%{_libdir}/ocaml/*.cmx*
%{_libdir}/ocaml/llvm/*.a
%{_libdir}/ocaml/llvm/*.cmx*
#%{_libdir}/ocaml/*.mli
%dir %{_docdir}/ocaml
%dir %{_docdir}/ocaml/html
%{_docdir}/ocaml/html/*
%dir %{_docdir}/llvm/ocaml-html
%{_docdir}/llvm/ocaml-html/*
#%doc llvm-extradocs/ocamldoc/html
%changelog
* Tue Nov 28 2017 Silvan Calarco <silvan.calarco@mambasoft.it> 5.0.0-2mamba
- fix link against libllvm by changing and extending build arguments and external llvm subpackages
* Tue Nov 28 2017 Silvan Calarco <silvan.calarco@mambasoft.it> 5.0.0-1mamba
- update to 5.0.0
* Wed Jul 13 2016 Automatic Build System <autodist@mambasoft.it> 3.8.1-1mamba
- automatic version update by autodist