aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2022-10-08 15:24:47 +0800
committerXi Ruoyao <xry111@xry111.site>2022-10-09 13:36:18 +0800
commitd3daea34d65bfca5bfcdb3bd51ee1d53b3492042 (patch)
treeaeb3843816c26fae3cfc093a8168675bd0706934
parent3f6167ca9b1dec9e133f8e18bc91dd684f82e865 (diff)
rust: chapter05: add LLVM pass 1
-rw-r--r--chapter05/chapter05.xml1
-rw-r--r--chapter05/llvm-pass1.xml103
-rw-r--r--packages.ent8
3 files changed, 112 insertions, 0 deletions
diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml
index 00652debb..417b9b1b7 100644
--- a/chapter05/chapter05.xml
+++ b/chapter05/chapter05.xml
@@ -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>
diff --git a/chapter05/llvm-pass1.xml b/chapter05/llvm-pass1.xml
new file mode 100644
index 000000000..04d33f9a9
--- /dev/null
+++ b/chapter05/llvm-pass1.xml
@@ -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>
diff --git a/packages.ent b/packages.ent
index 870a5e491..c8c81745d 100644
--- a/packages.ent
+++ b/packages.ent
@@ -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">