Browse Source

2015-03-25 Ryoichi INAGAKI <ryo1@toki.waseda.jp>

	* llvm: updated and added compat32 subpackage
	


git-svn-id: http://trac.vinelinux.org/repos/projects/specs@9470 ec354946-7b23-47d6-9f5a-488ba84defc7
inagaki 9 years ago
parent
commit
f94d8d936b
1 changed files with 247 additions and 98 deletions
  1. 247 98
      l/llvm/llvm-vl.spec

+ 247 - 98
l/llvm/llvm-vl.spec

@@ -1,12 +1,15 @@
+%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
+
 # Build options:
-#
-# --with doxygen
-#   The doxygen docs are HUGE, so they are not built by default.
-%define build_apidoc %{?_with_doxygen:1}%{!?_with_doxygen:0}
+# Components skipped by default:
+%bcond_with doxygen
+
+# Documentation install path
+%global llvmdocdir() %{_docdir}/%1-%{version}
 
 Name:           llvm
-Version:        3.5.0
-Release:        2%{?_dist_release}
+Version:        3.5.1
+Release:        1%{?_dist_release}
 Summary:        The Low Level Virtual Machine
 Summary(ja):    LLVM - 低レベルバーチャルマシン
 
@@ -16,16 +19,27 @@ 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
 Source2:        http://llvm.org/releases/%{version}/compiler-rt-%{version}.src.tar.xz
+Source3:        http://llvm.org/releases/%{version}/lldb-%{version}.src.tar.xz
 
 # multilib fixes
 Source10:        llvm-Config-config.h
 Source11:        llvm-Config-llvm-config.h
 
-# Data files should be installed with timestamps preserved
-Patch0:         llvm-2.6-timestamp.patch
+# patches
+Patch1:         llvm-3.5.0-build-fix.patch
+Patch2:         0001-data-install-preserve-timestamps.patch
 
-# hack the link flags for the shared libs for speed and memory usage
-Patch21:        llvm-3.2-symbolic-shlib.patch
+# newish glibc hides the definition of __extern_always_inline behind
+# a check for gcc 4.3, clang pretends to be gcc 4.2.  a proper fix would
+# be to build everything herein with gcc, but i don't have the patience
+# atm, so in the interest of bootstrapping...
+Patch100:       clang-fake-gcc43.patch
+# http://llvm.org/bugs/show_bug.cgi?id=22625
+Patch101:       clang-pr22625.patch
+
+Patch200:       lldb-python.patch
+Patch201:       lldb-fix-expression-parser.patch
+Patch202:       lldb-python-module-symlink.patch
 
 # Vine Patch
 Patch1000: clang-3.5.0-driver-ld.gold.patch
@@ -43,11 +57,17 @@ BuildRequires:  groff
 BuildRequires:  libffi-devel
 BuildRequires:  libtool-ltdl-devel
 BuildRequires:  ocaml
+BuildRequires:  perl
 # for DejaGNU test suite
 BuildRequires:  dejagnu tcl python
-%if %{build_apidoc}
+%if %{with doxygen}
 BuildRequires:  doxygen graphviz
 %endif
+# lldb
+BuildRequires:  swig
+BuildRequires:  libedit-devel
+BuildRequires:  python-devel
+
 Requires:       llvm-libs = %{version}-%{release}
 
 # LLVM is not supported on PPC64
@@ -65,13 +85,12 @@ functionality.
 %package devel
 Summary:        Libraries and header files for LLVM
 Summary(ja):    LLVM のライブラリおよびヘッダファイル
-Group:          Development/Languages
+Group:          Development/Libraries
 Requires:       %{name} = %{version}-%{release}
 Requires:       libstdc++-devel
 Requires:       libffi-devel
 Provides:       llvm-static = %{version}-%{release}
 
-
 %description devel
 This package contains library and header files needed to develop new
 native programs that use the LLVM infrastructure.
@@ -81,7 +100,10 @@ native programs that use the LLVM infrastructure.
 Summary:        Documentation for LLVM
 Summary(ja):    LLVM のドキュメント
 Group:          Documentation
+BuildArch:      noarch
 Requires:       %{name} = %{version}-%{release}
+# might seem redundant, but needed to kill off the old arch-ed -doc subpackage
+Obsoletes:      %{name}-doc < %{version}-%{release}
 
 %description doc
 Documentation for the LLVM compiler infrastructure.
@@ -89,7 +111,7 @@ Documentation for the LLVM compiler infrastructure.
 
 %package libs
 Summary:        LLVM shared libraries
-Summary(ja):    LLVM シェアードライブラリ
+Summary(ja):    LLVM 共有ライブラリ
 Group:          System Environment/Libraries
 
 %description libs
@@ -98,11 +120,14 @@ Shared libraries for the LLVM compiler infrastructure.
 
 %package -n clang
 Summary:        A C language family front-end for LLVM
-Summary(ja):    LLVM の C 言語フロントエンド
+Summary(ja):    LLVM の C 言語フロントエンド
 License:        NCSA
 Group:          Development/Languages
-Requires:       gcc
-%(rpm -q --qf 'Requires: %{name} = %{version}' libstdc++-devel)
+Requires:       %{name} = %{version}-%{release}
+# clang requires gcc, clang++ requires libstdc++-devel
+Requires:       libstdc++-devel
+# remove clang-doc pacakge
+Obsoletes:      clang-doc < %{version}-%{release}
 
 %description -n clang
 clang: noun
@@ -114,11 +139,19 @@ 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 -n clang-libs
+Summary:        Runtime library for clang
+Summary(ja):    Clang のランタイムライブラリ
+Group:          System Environment/Libraries
+
+%description -n clang-libs
+Runtime library for clang.
+
 
 %package -n clang-devel
 Summary:        Header files for clang
-Summary(ja):    clang のヘッダファイル
-Group:          Development/Languages
+Summary(ja):    Clang のヘッダファイル
+Group:          Development/Libraries
 Requires:       clang = %{version}-%{release}
 
 %description -n clang-devel
@@ -141,41 +174,69 @@ 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 -n clang-doc
+#Summary:        Documentation for Clang
+#Summary(ja):    Clang のドキュメント
+#Group:          Documentation
+#Requires:       %{name} = %{version}-%{release}
+#
+#%description -n clang-doc
+#Documentation for the Clang compiler front-end.
 
-%package -n clang-doc
-Summary:        Documentation for Clang
-Summary(ja):    Clang のドキュメント
-Group:          Documentation
+%package -n lldb
+Summary:        Next generation high-performance debugger
+Summary(ja):    高性能デバッガー
+License:        NCSA
+Group:          Development/Debuggers
 Requires:       %{name} = %{version}-%{release}
 
-%description -n clang-doc
-Documentation for the Clang compiler front-end.
+%description -n lldb
+LLDB is a next generation, high-performance debugger. It is built as a set
+of reusable components which highly leverage existing libraries in the
+larger LLVM Project, such as the Clang expression parser and LLVM
+disassembler.
+
+%package -n lldb-devel
+Summary:        Header files for LLDB
+Summary(ja):    LLDB のヘッダファイル
+Group:          Development/Libraries
+Requires:       lldb = %{version}-%{release}
 
+%description -n lldb-devel
+This package contains header files for the LLDB debugger.
 
-%if %{build_apidoc}
+
+%if %{with doxygen}
 %package apidoc
 Summary:        API documentation for LLVM
 Summary(ja):    LLVM の API ドキュメント
-Group:          Development/Languages
+Group:          Documentation
+BuildArch:      noarch
 Requires:       %{name}-docs = %{version}-%{release}
 
-
 %description apidoc
 API documentation for the LLVM compiler infrastructure.
-%endif
 
+%package -n clang-apidoc
+Summary:        API documentation for Clang
+Summary(ja):    Clang の API ドキュメント
+Group:          Documentation
+BuildArch:      noarch
+
+%description -n clang-apidoc
+API documentation for the Clang compiler.
+%endif
 
 %package        ocaml
 Summary:        OCaml binding for LLVM
 Summary(ja):    LLVM の OCaml バインディング
-Group:          Development/Libraries
+Group:          System Environment/Libraries
 Requires:       %{name} = %{version}-%{release}
 Requires:       ocaml
 
 %description    ocaml
 OCaml binding for LLVM.
 
-
 %package        ocaml-devel
 Summary:        Development files for %{name}-ocaml
 Summary(ja):    %{name}-ocaml の開発ファイル
@@ -188,38 +249,63 @@ Requires:       ocaml
 The %{name}-ocaml-devel package contains libraries and signature files
 for developing applications that use %{name}-ocaml.
 
-
 %package ocaml-doc
 Summary:        Documentation for %{name}-ocaml
 Summary(ja):    %{name}-ocaml のドキュメント
 Group:          Documentation
+BuildArch:      noarch
 Requires:       %{name}-ocaml = %{version}-%{release}
+# might seem redundant, but needed to kill off the old arch-ed -doc subpackage
+Obsoletes:      %{name}-ocaml-doc < %{version}-%{release}
 
 %description ocaml-doc
 HTML documentation for LLVM's OCaml binding.
 
+# compat32'
+%package -n compat32-%{name}-libs
+Summary:        LLVM shared libraries
+Summary(ja):    LLVM 共有ライブラリ
+Group:          System Environment/Libraries
+Requires: 	%{name}-libs = %{version}-%{release}
+
+%description -n compat32-%{name}-libs
+Shared libraries for the LLVM compiler infrastructure.
 
 
 %prep
-%setup -q -n llvm-%{version}.src -a1 -a2
-rm -f tools/clang
+%setup -q -a1 -a2 -a3 -n llvm-%{version}.src 
+rm -rf tools/clang tools/lldb projects/compiler-rt
 mv cfe-%{version}.src tools/clang
+mv compiler-rt-%{version}.src projects/compiler-rt
+mv lldb-%{version}.src tools/lldb
 
-# llvm patches
-%patch0 -p1 -b .timestamp
+%patch1 -p1
+%patch2 -p1
 
-# fix llvm-config --libs
-%patch21 -p1 -b .orig
+# clang
+pushd tools/clang
+%patch100 -p1
+%patch101 -p0
+popd
+
+# lldb
+pushd tools/lldb
+# careful when recreating this patch...
+%patch200 -p1 -b .python
+%patch201 -p2
+%patch202 -p1
+sed -i s/@lib@/%{_lib}/g scripts/Python/modules/readline/Makefile
+popd
 
+# Vine Linux
 %patch1000 -p1 -b .driver-ld.gold
 %ifarch x86_64
 %patch1001 -p1 -b .driver-lib64
 %endif
 %patch1002 -p1 -b .driver-vine
 
-# fix ld search path
-sed -i 's|/lib /usr/lib $lt_ld_extra|/%{_lib} %{_libdir} $lt_ld_extra|' \
-    ./configure
+# fix library paths
+sed -i 's|/lib /usr/lib $lt_ld_extra|%{_libdir} $lt_ld_extra|' configure
 sed -i 's|(PROJ_prefix)/lib|(PROJ_prefix)/%{_lib}/%{name}|g' Makefile.config.in
 sed -i 's|/lib\>|/%{_lib}/%{name}|g' tools/llvm-config/llvm-config.cpp
 
@@ -227,14 +313,17 @@ sed -i 's|/lib\>|/%{_lib}/%{name}|g' tools/llvm-config/llvm-config.cpp
 export CC=/usr/bin/gcc
 export CXX=/usr/bin/g++
 
-# Disabling assertions now, rec. by pure and needed for OpenGTL
-# TESTFIX no PIC on ix86: http://llvm.org/bugs/show_bug.cgi?id=3801
+# -fno-devirtualize shouldn't be necessary, but gcc has scary template-related
+# bugs that make it so.  gcc 5 ought to be fixed.
 %configure \
-  --prefix=%{_prefix} \
+  --with-extra-options="-fno-devirtualize" \
+  --with-extra-ld-options=-Wl,-Bsymbolic \
   --libdir=%{_libdir}/%{name} \
   --datadir=%{_libdir}/%{name} \
-%if %{?_with_doxygen:1}%{!?_with_doxygen:0}
+%if %{with doxygen}
   --enable-doxygen \
+%else
+  --disable-doxygen \
 %endif
 %ifarch armv7hl armv7l
   --with-cpu=cortex-a8 \
@@ -254,12 +343,10 @@ export CXX=/usr/bin/g++
   --with-c-include-dirs=%{_includedir}:$(echo %{_prefix}/lib/gcc/%{_target_cpu}*/*/include) \
   --with-binutils-include=%{_includedir} \
   --enable-targets=x86,powerpc,arm,aarch64,cpp,nvptx \
-  --enable-experimental-targets=R600
+  --enable-experimental-targets=R600 \
+  --with-optimize-option=-O3
   
-make %{_smp_mflags} \
-  REQUIRES_RTTI=1 \
-  OPTIMIZE_OPTION="%{optflags}"
-
+make %{?_smp_mflags} REQUIRES_RTTI=1 VERBOSE=1
 
 %install
 rm -rf %{buildroot}
@@ -288,55 +375,77 @@ EOF
 
 # Static analyzer not installed by default:
 # http://clang-analyzer.llvm.org/installation#OtherPlatforms
-mkdir -p %{buildroot}%{_libdir}/clang-analyzer
-# create launchers
+# scan-view
+mkdir -p %{buildroot}%{_libexecdir}/clang-analyzer/
+cp -pr tools/clang/tools/scan-view %{buildroot}%{_libexecdir}/clang-analyzer/
+
+# scan-build
+mkdir -p %{buildroot}%{_libexecdir}/clang-analyzer/scan-build
+for file in c++-analyzer ccc-analyzer scan-build scanview.css sorttable.js; do
+    cp -p tools/clang/tools/scan-build/$file \
+       %{buildroot}%{_libexecdir}/clang-analyzer/scan-build/
+done
+
+# scan-build manual page
+mkdir -p %{buildroot}%{_mandir}/man1
+cp -p tools/clang/tools/scan-build/scan-build.1 %{buildroot}%{_mandir}/man1/
+
+# scan-build requires clang in search path
+ln -s ../../../bin/clang %{buildroot}%{_libexecdir}/clang-analyzer/scan-build/clang
+
+# launchers in /bin
 for f in scan-{build,view}; do
-  ln -s %{_libdir}/clang-analyzer/$f/$f %{buildroot}%{_bindir}/$f
+  ln -s %{_libexecdir}/clang-analyzer/$f/$f %{buildroot}%{_bindir}/$f
 done
 
-(cd tools/clang/tools && cp -pr scan-{build,view} \
- %{buildroot}%{_libdir}/clang-analyzer/)
+# Get rid of erroneously installed example files.
+rm %{buildroot}%{_libdir}/%{name}/*LLVMHello.*
+
+# remove executable bit from static libraries
+find %{buildroot}%{_libdir} -name "*.a" -type f -print0 | xargs -0 chmod -x
 
+# Install man page for LLDB
+mkdir -p %{buildroot}%{_mandir}/man1
+cp tools/lldb/docs/lldb.1 %{buildroot}%{_mandir}/man1/
 
-# Move documentation back to build directory
-# 
-pwd
-mv %{buildroot}/moredocs .
-rm -f moredocs/*.tar.gz
-rm -f moredocs/ocamldoc/html/*.tar.gz
+# llvm-doc
+mkdir -p %{buildroot}%{llvmdocdir %{name}-doc}
+cp -ar examples %{buildroot}%{llvmdocdir %{name}-doc}/examples
+find %{buildroot}%{llvmdocdir %{name}-doc} -name Makefile -o -name CMakeLists.txt -o -name LLVMBuild.txt -print0 | xargs -0 rm -f
 
-# and separate the apidoc
-%if %{build_apidoc}
-mv moredocs/html/doxygen apidoc
-mv tools/clang/docs/doxygen/html clang-apidoc
+# llvm-apidoc
+%if %{with doxygen}
+mv %{buildroot}/moredocs/html/doxygen %{buildroot}%{llvmdocdir %{name}-apidoc}
 %endif
 
-# And prepare Clang documentation
-#
-mkdir clang-docs
-for f in LICENSE.TXT NOTES.txt README.txt; do
-  ln tools/clang/$f clang-docs/
-done
-rm -rf tools/clang/docs/{doxygen*,Makefile*,*.graffle,tools}
+# llvm-ocaml-doc
+mv %{buildroot}/moredocs/ocamldoc/html %{buildroot}%{llvmdocdir %{name}-ocaml-doc}
 
+# clang
+mkdir -p %{buildroot}%{llvmdocdir clang}
+for f in LICENSE.TXT NOTES.txt README.txt CODE_OWNERS.TXT; do
+  cp tools/clang/$f %{buildroot}%{llvmdocdir clang}/
+done
 
-#find %%{buildroot} -name .dir -print0 | xargs -0r rm -f
-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
-#chrpath -d %%{buildroot}/%%{_libexecdir}/clang-cc
+# clang-apidoc
+%if %{with doxygen}
+cp -ar tools/clang/docs/doxygen/html %{buildroot}%{llvmdocdir clang-apidoc}
+%endif
 
-# Get rid of erroneously installed example files.
-rm %{buildroot}%{_libdir}/%{name}/*LLVMHello.*
+# lldb
+mkdir -p %{buildroot}%{llvmdocdir lldb}
+cp tools/lldb/LICENSE.TXT %{buildroot}%{llvmdocdir lldb}/
 
-# FIXME file this bug
-sed -i 's,ABS_RUN_DIR/lib",ABS_RUN_DIR/%{_lib}/%{name}",' \
-  %{buildroot}%{_bindir}/llvm-config-%{__isa_bits}
+# delete the rest of installed documentation (because it's bad)
+rm -rf %{buildroot}/moredocs
 
-chmod -x %{buildroot}%{_libdir}/%{name}/*.a
+# install CMake modules
+mkdir -p %{buildroot}%{_datadir}/llvm/cmake/
+cp -p cmake/modules/*.cmake %{buildroot}%{_datadir}/llvm/cmake/
 
-# remove documentation makefiles:
-# they require the build directory to work
-find examples -name 'Makefile' | xargs -0r rm -f
+# remove RPATHs
+file %{buildroot}/%{_bindir}/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
+file %{buildroot}/%{_libdir}/%{name}/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
 
 
 %check
@@ -349,11 +458,13 @@ rm -rf %{buildroot}
 
 
 %post libs -p /sbin/ldconfig
-%post -n clang -p /sbin/ldconfig
+%postun libs -p /sbin/ldconfig
 
+%post -n clang-libs -p /sbin/ldconfig
+%postun -n clang-libs -p /sbin/ldconfig
 
-%postun libs -p /sbin/ldconfig
-%postun -n clang -p /sbin/ldconfig
+%post -n lldb -p /sbin/ldconfig
+%postun -n lldb -p /sbin/ldconfig
 
 
 %posttrans devel
@@ -377,7 +488,7 @@ exit 0
 
 %files
 %defattr(-,root,root,-)
-%doc CREDITS.TXT LICENSE.TXT README.txt
+%doc CREDITS.TXT README.txt
 %{_bindir}/bugpoint
 %{_bindir}/llc
 %{_bindir}/lli
@@ -386,11 +497,15 @@ exit 0
 %{_bindir}/llvm*
 %{_bindir}/macho-dump
 %{_bindir}/opt
+%dir %{_datadir}/llvm
 %exclude %{_mandir}/man1/clang.1.*
+%exclude %{_mandir}/man1/scan-build.1.*
+%exclude %{_mandir}/man1/lldb.1.*
 %doc %{_mandir}/man1/*.1.*
 
 %files devel
 %defattr(-,root,root,-)
+#doc %{llvmdocdir %{name}-devel}/
 %{_bindir}/llvm-config-%{__isa_bits}
 %{_includedir}/%{name}
 %{_includedir}/%{name}-c
@@ -399,22 +514,28 @@ exit 0
 
 %files libs
 %defattr(-,root,root,-)
+%doc LICENSE.TXT
 %config(noreplace) %{_sysconfdir}/ld.so.conf.d/llvm-%{_arch}.conf
 %dir %{_libdir}/%{name}
 %exclude %{_libdir}/%{name}/libclang.so
+%exclude %{_libdir}/%{name}/liblldb.so
 %{_libdir}/%{name}/*.so
 
 %files -n clang
 %defattr(-,root,root,-)
-%doc clang-docs/*
+%doc %{llvmdocdir clang}/
 %{_bindir}/clang*
 %{_bindir}/c-index-test
-%{_libdir}/%{name}/libclang.so
 %{_prefix}/lib/clang
 %doc %{_mandir}/man1/clang.1.*
 
+%files -n clang-libs
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/libclang.so
+
 %files -n clang-devel
 %defattr(-,root,root,-)
+#doc %{llvmdocdir clang-devel}/
 %{_includedir}/clang
 %{_includedir}/clang-c
 
@@ -422,15 +543,26 @@ exit 0
 %defattr(-,root,root,-)
 %{_bindir}/scan-build
 %{_bindir}/scan-view
-%{_libdir}/clang-analyzer
+%{_libexecdir}/clang-analyzer
+%{_mandir}/man1/scan-build.1.*
 
-%files -n clang-doc
+%files -n lldb
+%defattr(-,root,root,-)
+%doc %{llvmdocdir lldb}/
+%{_bindir}/lldb
+%{_bindir}/lldb-*
+%{_libdir}/%{name}/liblldb.so
+# XXX double check this
+%{python_sitearch}/*
+%doc %{_mandir}/man1/lldb.1.*
+
+%files -n lldb-devel
 %defattr(-,root,root,-)
-%doc tools/clang/docs/*
+%{_includedir}/lldb
 
 %files doc
 %defattr(-,root,root,-)
-%doc examples moredocs/html
+%doc %{llvmdocdir %{name}-doc}/
 
 %files ocaml
 %defattr(-,root,root,-)
@@ -447,20 +579,37 @@ exit 0
 
 %files ocaml-doc
 %defattr(-,root,root,-)
-%doc moredocs/ocamldoc/html/*
+%doc %{llvmdocdir %{name}-ocaml-doc}/
 
 %if 0%{?_with_doxygen}
 %files apidoc
 %defattr(-,root,root,-)
-%doc apidoc/*
+%doc %{llvmdocdir %{name}-apidoc}/
 
 %files -n clang-apidoc
 %defattr(-,root,root,-)
-%doc clang-apidoc/*
+%doc %{llvmdocdir clang-apidoc}/
 %endif
 
+%if %{build_compat32}
+%files -n compat32-%{name}-libs
+%defattr(-,root,root)
+%doc LICENSE.TXT
+%config(noreplace) %{_sysconfdir}/ld.so.conf.d/llvm-%{_arch}.conf
+%dir %{_libdir}/%{name}
+%exclude %{_libdir}/%{name}/libclang.so
+%exclude %{_libdir}/%{name}/liblldb.so
+%{_libdir}/%{name}/*.so
+%endif
 
 %changelog
+* Tue Mar 24 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.5.1-1
+- updated to 3.5.1
+- added Patch1, 2, 100, 101, 200, 201 and 202 from Fedora 
+- added clang-libs, lldb, lldb-devel and compat32-llvm-libs subpackage
+- obsoleted clang-doc
+- built with ocaml 4.02.1
+
 * Sat Nov 29 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.5.0-2
 - fix <BTS:2832>
   - fix configure option "--with-c-include-dirs"