glfs/multilib/mesoncross.xml

83 lines
2.6 KiB
XML
Raw Normal View History

2024-05-14 21:02:30 +08:00
<?xml version="1.0" encoding="UTF-8"?>
<!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="mesoncross" xreflabel="Meson Cross Toolchain File">
<?dbhtml filename="mesoncross.html"?>
<title>Meson Cross Toolchain File</title>
<para>
Most applications that rely on the <application>Meson</application>
build system have decent support for cross compilation, ie. compiling
32-bit binaries on a 64-bit system. It can be as easy as setting the
<envar>CC</envar>, <envar>CXX</envar>, and <envar>PKG_CONFIG_PATH
</envar> variables before using the <userinput>meson setup ..
</userinput> command to compile 32-bit binaries on a 64-bit system.
However, some projects are more complicated for many different
reasons, leading to the necessity of a <application>Meson
</application> cross toolchain file. It specifies the compilers,
options that should be invoked, the <application>pkg-conf</application>
binary (or rather symlink that uses a certain personality file) to use,
<command>llvm-config</command> to use, etc. This isn't required for
<xref linkend="steam"/> unless you want to install Mesa's NVK driver,
which isn't in the book at the moment. It is needed for Gstreamer which
is a recommended dependency of <xref linkend="wine"/>.
</para>
<para>
The instructions below will show how to create and use the file if
necessary.
</para>
<sect2 role="installation">
<title>Creating the Cross Toolchain File</title>
<para>
Create the following toolchain file by running the following
commands as the <systemitem class="username">root</systemitem>
user:
</para>
<screen role="root"><userinput>mkdir -v /usr/share/meson/cross
cat &gt; /usr/share/meson/cross/lib32 &lt;&lt; "EOF"
<literal>[binaries]
c = ['gcc', '-m32']
cpp = ['g++', '-m32']
rust = ['rustc', '--target', 'i686-unknown-linux-gnu']
pkg-config = 'i686-pc-linux-gnu-pkg-config'
cups-config = 'cups-config'
llvm-config = 'llvm-config32'
strip = 'strip'
[built-in options]
libdir = 'lib32'
[host_machine]
system = 'linux'
subsystem = 'linux'
kernel = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'</literal>
EOF</userinput></screen>
</sect2>
<sect2>
<title>How to Use the File</title>
<para>
Instead of setting environment variables before invoking
<userinput>meson setup ..</userinput>, you can simply do:
</para>
<screen><userinput>meson setup .. --cross-file lib32 &lt;other-options&gt;</userinput></screen>
</sect2>
</sect1>