mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 09:46:17 +01:00
docs: Move the cross-compilation documentation to Markdown
Helps: #3037
This commit is contained in:
parent
057f4fa2a5
commit
4784bb10b1
88
docs/reference/glib/cross-compiling.md
Normal file
88
docs/reference/glib/cross-compiling.md
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
Title: Cross-compiling the GLib package
|
||||||
|
|
||||||
|
# Cross-compiling the GLib Package
|
||||||
|
|
||||||
|
## Building the Library for a different architecture
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
These notes cover things specific to cross-compiling GLib; for general
|
||||||
|
information about cross-compilation, see the [Meson
|
||||||
|
documentation](http://mesonbuild.com/Cross-compilation.html).
|
||||||
|
|
||||||
|
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 to be provided to meson via a ‘cross file’.
|
||||||
|
|
||||||
|
As an example of using a cross file, to cross compile for the ‘MingW32’
|
||||||
|
Win64 runtime environment on a Linux system, create a file `cross_file.txt`
|
||||||
|
with the following contents:
|
||||||
|
|
||||||
|
```
|
||||||
|
[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'
|
||||||
|
ld = 'x86_64-w64-mingw32-ld'
|
||||||
|
objcopy = 'x86_64-w64-mingw32-objcopy'
|
||||||
|
strip = 'x86_64-w64-mingw32-strip'
|
||||||
|
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
|
||||||
|
windres = 'x86_64-w64-mingw32-windres'
|
||||||
|
```
|
||||||
|
|
||||||
|
Then execute the following commands:
|
||||||
|
|
||||||
|
meson setup --cross-file cross_file.txt builddir
|
||||||
|
|
||||||
|
The complete list of cross properties follows. Most of these won't need to
|
||||||
|
be set in most cases.
|
||||||
|
|
||||||
|
## Cross properties
|
||||||
|
|
||||||
|
`have_[function]`
|
||||||
|
: When meson checks if a function is supported, the test can be overridden by
|
||||||
|
setting the `have_function` property to `true` or `false`. For example:
|
||||||
|
|
||||||
|
Checking for function "fsync" : YES
|
||||||
|
|
||||||
|
can be overridden by setting
|
||||||
|
|
||||||
|
have_fsync = false
|
||||||
|
|
||||||
|
`growing_stack=[true/false]`
|
||||||
|
: Whether the stack grows up or down. Most places will want `false`. A few
|
||||||
|
architectures, such as PA-RISC need `true`.
|
||||||
|
|
||||||
|
`have_strlcpy=[true/false]`
|
||||||
|
: Whether you have `strlcpy()` that matches OpenBSD. Defaults to `false`,
|
||||||
|
which is safe, since GLib uses a built-in version in that case.
|
||||||
|
|
||||||
|
`va_val_copy=[true/false]`
|
||||||
|
: Whether `va_list` can be copied as a pointer. If set to `false`, then
|
||||||
|
`memcopy()` will be used. Only matters if you don't have `va_copy()` or
|
||||||
|
`__va_copy()`. (So, doesn't matter for GCC.) Defaults to `true` which is
|
||||||
|
slightly more common than `false`.
|
||||||
|
|
||||||
|
`have_c99_vsnprintf=[true/false]`
|
||||||
|
: Whether you have a `vsnprintf()` 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 `false`.
|
||||||
|
|
||||||
|
`have_c99_snprintf=[true/false]`
|
||||||
|
: Whether you have a `snprintf()` 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 `false`.
|
@ -1,147 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
||||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
||||||
]>
|
|
||||||
<refentry id="glib-cross-compiling" revision="7 Aug 2018">
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<refsect1 id="cross">
|
|
||||||
<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
|
|
||||||
<ulink url="http://mesonbuild.com/Cross-compilation.html">meson</ulink>
|
|
||||||
info pages.
|
|
||||||
</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
|
|
||||||
to be provided to meson via a ‘cross file’.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
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:
|
|
||||||
</para>
|
|
||||||
<programlisting>
|
|
||||||
[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'
|
|
||||||
ld = 'x86_64-w64-mingw32-ld'
|
|
||||||
objcopy = 'x86_64-w64-mingw32-objcopy'
|
|
||||||
strip = 'x86_64-w64-mingw32-strip'
|
|
||||||
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
|
|
||||||
windres = 'x86_64-w64-mingw32-windres'
|
|
||||||
</programlisting>
|
|
||||||
<para>
|
|
||||||
Then execute the following commands:
|
|
||||||
</para>
|
|
||||||
<programlisting>
|
|
||||||
meson --cross-file cross_file.txt builddir
|
|
||||||
</programlisting>
|
|
||||||
<para>
|
|
||||||
The complete list of cross properties follows. Most
|
|
||||||
of these won't need to be set in most cases.
|
|
||||||
</para>
|
|
||||||
</refsect1>
|
|
||||||
<refsect1 id="cross-properties">
|
|
||||||
<title>Cross properties</title>
|
|
||||||
<formalpara>
|
|
||||||
<title>have_[function]</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
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>.
|
|
||||||
For example <programlisting>Checking for function "fsync" : YES</programlisting>
|
|
||||||
can be overridden by setting <programlisting>have_fsync = false</programlisting>
|
|
||||||
</para>
|
|
||||||
</formalpara>
|
|
||||||
<formalpara>
|
|
||||||
<title>growing_stack=[true/false]</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
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>
|
|
||||||
</formalpara>
|
|
||||||
<formalpara>
|
|
||||||
<title>have_strlcpy=[true/false]</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
Whether you have <function>strlcpy()</function> that matches
|
|
||||||
OpenBSD. Defaults to <constant>false</constant>, which is safe,
|
|
||||||
since GLib uses a built-in version in that case.
|
|
||||||
</para>
|
|
||||||
</formalpara>
|
|
||||||
<formalpara>
|
|
||||||
<title>va_val_copy=[true/false]</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
Whether <type>va_list</type> can be copied as a pointer. If set
|
|
||||||
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>
|
|
||||||
</formalpara>
|
|
||||||
<formalpara>
|
|
||||||
<title>have_c99_vsnprintf=[true/false]</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
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>.
|
|
||||||
</para>
|
|
||||||
</formalpara>
|
|
||||||
<formalpara>
|
|
||||||
<title>have_c99_snprintf=[true/false]</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
Whether you have a <function>snprintf()</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>.
|
|
||||||
</para>
|
|
||||||
</formalpara>
|
|
||||||
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
</refentry>
|
|
@ -25,7 +25,6 @@
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<xi:include href="building.xml" />
|
<xi:include href="building.xml" />
|
||||||
<xi:include href="cross.xml" />
|
|
||||||
<xi:include href="programming.xml" />
|
<xi:include href="programming.xml" />
|
||||||
<xi:include href="xml/compiling.xml" />
|
<xi:include href="xml/compiling.xml" />
|
||||||
<xi:include href="changes.xml" />
|
<xi:include href="changes.xml" />
|
||||||
|
@ -40,6 +40,7 @@ show_class_hierarchy = true
|
|||||||
urlmap_file = "urlmap.js"
|
urlmap_file = "urlmap.js"
|
||||||
# The same order will be used when generating the index
|
# The same order will be used when generating the index
|
||||||
content_files = [
|
content_files = [
|
||||||
|
"cross-compiling.md",
|
||||||
"running.md",
|
"running.md",
|
||||||
|
|
||||||
"gvariant-format-strings.md",
|
"gvariant-format-strings.md",
|
||||||
|
@ -71,7 +71,6 @@ if get_option('gtk_doc')
|
|||||||
'--ignore-headers=' + ' '.join(ignore_headers),
|
'--ignore-headers=' + ' '.join(ignore_headers),
|
||||||
],
|
],
|
||||||
content_files : [
|
content_files : [
|
||||||
'cross.xml',
|
|
||||||
'building.xml',
|
'building.xml',
|
||||||
'changes.xml',
|
'changes.xml',
|
||||||
'compiling.xml',
|
'compiling.xml',
|
||||||
@ -150,6 +149,7 @@ endif
|
|||||||
# gi-docgen version
|
# gi-docgen version
|
||||||
expand_content_files = [
|
expand_content_files = [
|
||||||
'character-set.md',
|
'character-set.md',
|
||||||
|
'cross-compiling.md',
|
||||||
'error-reporting.md',
|
'error-reporting.md',
|
||||||
'gvariant-format-strings.md',
|
'gvariant-format-strings.md',
|
||||||
'gvariant-text-format.md',
|
'gvariant-text-format.md',
|
||||||
|
Loading…
Reference in New Issue
Block a user