2010-01-07 11:31:24 +02:00
|
|
|
|
<?xml version="1.0"?>
|
2012-04-23 02:45:08 +01:00
|
|
|
|
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
2010-01-07 11:31:24 +02:00
|
|
|
|
]>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<refentry id="glib-cross-compiling" revision="7 Aug 2018">
|
2003-04-07 23:20:57 +00:00
|
|
|
|
<refmeta>
|
|
|
|
|
<refentrytitle>Cross-compiling the GLib package</refentrytitle>
|
|
|
|
|
<manvolnum>3</manvolnum>
|
|
|
|
|
<refmiscinfo>GLib Library</refmiscinfo>
|
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>Cross-compiling the GLib Package</refname>
|
|
|
|
|
<refpurpose>
|
|
|
|
|
How to cross-compile GLib
|
|
|
|
|
</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
|
2003-05-11 22:29:50 +00:00
|
|
|
|
<refsect1 id="cross">
|
2003-04-07 23:20:57 +00:00
|
|
|
|
<title>Building the Library for a different architecture</title>
|
|
|
|
|
<para>
|
|
|
|
|
Cross-compilation is the process of compiling a program or
|
|
|
|
|
library on a different architecture or operating system then
|
|
|
|
|
it will be run upon. GLib is slightly more difficult to
|
|
|
|
|
cross-compile than many packages because much of GLib is
|
|
|
|
|
about hiding differences between different systems.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
These notes cover things specific to cross-compiling GLib;
|
|
|
|
|
for general information about cross-compilation, see the
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<ulink url="http://mesonbuild.com/Cross-compilation.html">meson</ulink>
|
|
|
|
|
info pages.
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
GLib tries to detect as much information as possible about
|
|
|
|
|
the target system by compiling and linking programs without
|
|
|
|
|
actually running anything; however, some information GLib
|
|
|
|
|
needs is not available this way. This information needs
|
2018-08-07 10:25:55 -04:00
|
|
|
|
to be provided to meson via a ‘cross file’.
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</para>
|
|
|
|
|
<para>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
As an example of using a cross file, to cross compile for
|
|
|
|
|
the ‘MingW32’ Win64 runtime environment on a Linux system,
|
|
|
|
|
create a file <filename>cross_file.txt</filename> with the following
|
|
|
|
|
contents:
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</para>
|
|
|
|
|
<programlisting>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
[host_machine]
|
|
|
|
|
system = 'windows'
|
|
|
|
|
cpu_family = 'x86_64'
|
|
|
|
|
cpu = 'x86_64'
|
|
|
|
|
endian = 'little'
|
|
|
|
|
|
|
|
|
|
[properties]
|
|
|
|
|
c_args = []
|
|
|
|
|
c_link_args = []
|
|
|
|
|
|
|
|
|
|
[binaries]
|
|
|
|
|
c = 'x86_64-w64-mingw32-gcc'
|
|
|
|
|
cpp = 'x86_64-w64-mingw32-g++'
|
|
|
|
|
ar = 'x86_64-w64-mingw32-ar'
|
|
|
|
|
strip = 'x86_64-w64-mingw32-strip'
|
|
|
|
|
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
|
|
|
|
|
windres = 'x86_64-w64-mingw32-windres'
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</programlisting>
|
|
|
|
|
<para>
|
|
|
|
|
Then execute the following commands:
|
|
|
|
|
</para>
|
|
|
|
|
<programlisting>
|
2019-05-20 12:11:24 +01:00
|
|
|
|
meson --cross-file cross_file.txt builddir
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</programlisting>
|
|
|
|
|
<para>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
The complete list of cross properties follows. Most
|
2003-04-07 23:20:57 +00:00
|
|
|
|
of these won't need to be set in most cases.
|
|
|
|
|
</para>
|
|
|
|
|
</refsect1>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<refsect1 id="cross-properties">
|
|
|
|
|
<title>Cross properties</title>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
<formalpara>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<title>have_[function]</title>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
When meson checks if a function is supported, the test can be
|
|
|
|
|
overridden by setting the
|
|
|
|
|
<literal>have_<replaceable>function</replaceable></literal> property
|
|
|
|
|
to <constant>true</constant> or <constant>false</constant>.
|
2018-08-23 17:35:56 +02:00
|
|
|
|
For example <programlisting>Checking for function "fsync" : YES</programlisting>
|
|
|
|
|
can be overridden by setting <programlisting>have_fsync = false</programlisting>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</para>
|
|
|
|
|
</formalpara>
|
|
|
|
|
<formalpara>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<title>growing_stack=[true/false]</title>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
Whether the stack grows up or down. Most places will want
|
|
|
|
|
<constant>false</constant>.
|
|
|
|
|
A few architectures, such as PA-RISC need <constant>true</constant>.
|
|
|
|
|
</para>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</formalpara>
|
|
|
|
|
<formalpara>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<title>have_strlcpy=[true/false]</title>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
Whether you have <function>strlcpy()</function> that matches
|
2018-08-07 10:25:55 -04:00
|
|
|
|
OpenBSD. Defaults to <constant>false</constant>, which is safe,
|
|
|
|
|
since GLib uses a built-in version in that case.
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</para>
|
|
|
|
|
</formalpara>
|
2011-03-31 09:00:27 +02:00
|
|
|
|
<formalpara>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<title>va_val_copy=[true/false]</title>
|
2011-03-31 09:00:27 +02:00
|
|
|
|
|
2003-04-07 23:20:57 +00:00
|
|
|
|
<para>
|
|
|
|
|
Whether <type>va_list</type> can be copied as a pointer. If set
|
2018-08-07 10:25:55 -04:00
|
|
|
|
to <constant>false</constant>, then <function>memcopy()</function>
|
|
|
|
|
will be used. Only matters if you don't have
|
|
|
|
|
<function>va_copy()</function> or <function>__va_copy()</function>.
|
|
|
|
|
(So, doesn't matter for GCC.)
|
|
|
|
|
Defaults to <constant>true</constant> which is slightly more common
|
|
|
|
|
than <constant>false</constant>.
|
|
|
|
|
</para>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</formalpara>
|
|
|
|
|
<formalpara>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<title>have_c99_vsnprintf=[true/false]</title>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
Whether you have a <function>vsnprintf()</function> with C99
|
|
|
|
|
semantics. (C99 semantics means returning the number of bytes
|
|
|
|
|
that would have been written had the output buffer had enough
|
|
|
|
|
space.) Defaults to <constant>false</constant>.
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</para>
|
|
|
|
|
</formalpara>
|
|
|
|
|
<formalpara>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
<title>have_c99_snprintf=[true/false]</title>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
|
|
|
|
|
<para>
|
2018-08-07 10:25:55 -04:00
|
|
|
|
Whether you have a <function>snprintf()</function> with C99
|
2003-04-07 23:20:57 +00:00
|
|
|
|
semantics. (C99 semantics means returning the number of bytes
|
|
|
|
|
that would have been written had the output buffer had enough
|
2018-08-07 10:25:55 -04:00
|
|
|
|
space.) Defaults to <constant>false</constant>.
|
2003-04-07 23:20:57 +00:00
|
|
|
|
</para>
|
|
|
|
|
</formalpara>
|
|
|
|
|
|
2018-08-07 10:25:55 -04:00
|
|
|
|
</refsect1>
|
2003-04-07 23:20:57 +00:00
|
|
|
|
|
|
|
|
|
</refentry>
|