Last active
March 29, 2020 01:14
-
-
Save rcls/22cab4e1675e55d87c938f93fc1a8c18 to your computer and use it in GitHub Desktop.
Meson build for debian obsolete.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################## | |
# Using up-to-date meson to build for obsolete Debian as a cross-build. | |
######################################################################## | |
# | |
# This got me building C & C++ code for Debian Jessie using current | |
# meson & ninja on Fedora 31. | |
# | |
# 1. Install a Debian Jessie (or whatever) system image into a | |
# subdirectory using debootstrap e.g., | |
# sudo debootstrap jessie /opt/debian-8 | |
# | |
# 2. Use chroot into this, to install the compilers etc. & the symlinks | |
# package. | |
# | |
# 3. Use chroot ... symlinks to relativise links in the system image. | |
# E.g., chroot /opt/debian-8 symlinks -cr /usr | |
# | |
# Set LD_LIBRARY_PATH appropriately, e.g., | |
# | |
# export LD_LIBRARY_PATH=/usr/lib64:/opt/debian-8/usr/lib/x86_64-linux-gnu | |
# | |
# for both meson and ninja. | |
# | |
# (I had to put the build library path before the host library path to | |
# get ninja to run.) | |
# | |
# 4. Do a cross compile using this cross file. YMMV. | |
# meson --cross-file jessie-build.ini jessie | |
# ninja -C jessie | |
# | |
# I had to manually set pkgconfig here even though the usual one works fine. | |
# It seems otherwise meson doesn't believe the one in my path is OK for | |
# the cross-build. Setting the pkg_config_libdir is essential though. | |
# | |
# For C code very likely you could use the host compiler, and target | |
# libc, for C++ that is unlikely to work, libstdc++ is more complex | |
# and more coupled to the compiler. | |
# | |
[binaries] | |
c = '/opt/debian-8/usr/bin/gcc' | |
cpp = '/opt/debian-8/usr/bin/g++' | |
ar = '/opt/debian-8/usr/bin/gcc-ar' | |
strip = '/opt/debian-8/usr/bin/strip' | |
pkgconfig = 'pkg-config' | |
[properties] | |
c_args = ['--sysroot=/opt/debian-8'] | |
c_link_args = ['--sysroot=/opt/debian-8'] | |
cpp_args = ['--sysroot=/opt/debian-8'] | |
cpp_link_args = ['--sysroot=/opt/debian-8'] | |
[host_machine] | |
system = 'linux' | |
cpu_family = 'x86_64' | |
cpu = 'x86_64' | |
endian = 'little' | |
pkg_config_libdir = '/opt/debian-8/usr/lib/x86_64-linux-gnu/pkgconfig:/opt/debian-8/usr/share/pkgconfig' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment