rust: chapter05: add LLVM pass 1

This commit is contained in:
Xi Ruoyao 2022-10-08 15:24:47 +08:00
parent 3f6167ca9b
commit d3daea34d6
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3
3 changed files with 112 additions and 0 deletions

View File

@ -18,5 +18,6 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="cmake.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="llvm-pass1.xml"/>
</chapter>

103
chapter05/llvm-pass1.xml Normal file
View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-llvm-pass1" role="wrap">
<?dbhtml filename="llvm-pass1.html"?>
<sect1info condition="script">
<productname>LLVM</productname>
<productnumber>&llvm-version;</productnumber>
<address>&llvm-url;</address>
</sect1info>
<title>LLVM-&llvm-version; - Pass 1</title>
<indexterm zone="ch-tools-llvm-pass1">
<primary sortas="a-LLVM">LLVM</primary>
<secondary>tools, pass 1</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The LLVM package contains a collection of modular and reusable
compiler and toolchain technologies.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&llvm-tmpp1-sbu;</seg>
<seg>&llvm-tmpp1-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of LLVM</title>
<para>Prepare some CMake modules needed by LLVM building system:</para>
<screen><userinput remap="pre">tar -xf ../llvm-cmake-&llvm-version;.src.tar.xz
mv cmake-&llvm-version;.src ../cmake</userinput></screen>
<para>The LLVM documentation recommends building LLVM in a dedicated
build directory:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare LLVM for compilation:</para>
<screen><userinput remap="configure">CC=gcc CXX=g++ cmake \
-DCMAKE_INSTALL_PREFIX=$LFS/tools \
-DLLVM_ENABLE_FFI=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-Wno-dev ..</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>-DLLVM_ENABLE_FFI=OFF</parameter></term>
<listitem>
<para>Allow building LLVM without libffi installed on the host
distro.</para>
</listitem>
</varlistentry>
</variablelist>
<para>For the meaning of other CMake options, see TODO.</para>
<para>Compile LLVM by running:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>Clean up the source directory:</para>
<screen><userinput remap="install">rm -rf ../../cmake</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in TODO.</para>
</sect2>
</sect1>

View File

@ -452,6 +452,14 @@
<!ENTITY linux-headers-fin-du "1 GB">
<!ENTITY linux-headers-fin-sbu "0.1 SBU">-->
<!ENTITY llvm-version "15.0.1">
<!ENTITY llvm-size "52,272 KB">
<!ENTITY llvm-url "https://github.com/llvm/llvm-project/releases/download/llvmorg-&llvm-version;/llvm-&llvm-version;.src.tar.xz">
<!ENTITY llvm-md5 "f517bb2708fe68907bd48642c4fac5fe">
<!ENTITY llvm-home "https://llvm.org/">
<!ENTITY llvm-tmpp1-sbu "20 SBU">
<!ENTITY llvm-tmpp1-du "3,800 MB">
<!ENTITY m4-version "1.4.19">
<!ENTITY m4-size "1,617 KB">
<!ENTITY m4-url "&gnu;m4/m4-&m4-version;.tar.xz">