其他分享
首页 > 其他分享> > meson 工具使用 glib-2.68.1交叉编译

meson 工具使用 glib-2.68.1交叉编译

作者:互联网

 需要python meson ninja,安装方法百度即可

meson手册 https://mesonbuild.com/Manual.html

防止忘记,仅仅记录如下


#!/bin/bash
set -e

DEVEL=/home/username/build_root/devel

if [ -d _build ];then
rm -r _build
fi
mkdir _build

arch='arm-linux-gnueabi-'
sys_root='/home/username/build_root/devel'
#创建交叉编译配置文件cross_file.txt

#还可设置c_args等等类似 CFLAGS
echo "[constants]" > cross_file.txt
echo "arch = '${arch}'" >> cross_file.txt
echo "[binaries]" >> cross_file.txt
echo "c = arch + 'gcc'" >> cross_file.txt
echo "cpp = arch + 'g++'" >> cross_file.txt
echo "ar = arch + 'ar'" >> cross_file.txt
echo "ld = arch + 'ld'" >> cross_file.txt
echo "srtip = arch + 'strip'" >> cross_file.txt
echo "sys_root = '${sys_root}'" >> cross_file.txt
echo "pkg_config_libdir = '${sys_root}/usr/lib/pkgconfig'" >> cross_file.txt

#编译结果可运行平台的架构
echo "[host_machine]" >> cross_file.txt
echo "system = 'linux'" >> cross_file.txt
echo "cpu_family = 'arm'" >> cross_file.txt
echo "cpu = 'armv7hl'" >> cross_file.txt
echo "endian = 'little'" >> cross_file.txt

#类似于configure功能 meson configure 获取到可配置项
echo "[project options]" >> cross_file.txt
echo "prefix = '/usr'" >> cross_file.txt
echo "selinux = 'disabled'" >> cross_file.txt
echo "libelf = 'disabled'" >> cross_file.txt

#类似于执行configure
meson setup _build --cross-file cross_file.txt
cd _build
#编译 类似于make
ninja
cd ../ 
#类似于make install DESTDIR=$DEVEL
DESTDIR=$DEVEL meson install

 

标签:glib,meson,2.68,cross,echo,build,file,txt,arch
来源: https://blog.csdn.net/suxingtian/article/details/115632209