当前位置:网站首页>20.移植Freetype字体库
20.移植Freetype字体库
2022-07-05 23:08:00 【anieoo】
FreeType 支持 Gzip 压缩文件,会使用到 zlib 库。同时FreeType 可以加载 PNG 格式的彩色位
图字形,需要依赖于 libpng 库,因此在移植Freetype字体库前需要先移植zlib库和libpng库。
一、移植zlib库
下载源码
进入源码官网https://www.zlib.net/fossils/,下载源码
将下载的源码通过命令tar -vxzf xxx进行解压,创建一个目录zlib作为源码的安装目录,如下图所示:
配置zlib源码,首先执行脚本environment-setup-cortexa7hf-neon-poky-linux-gnueabi 文件进行环境变量初始化。
source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
配置完环境变量如下所示:
指定安装路径:./configure --prefix=/home/zyc/tools/zlib/
使用make命令编译zlib源码,编译结束后在使用make install进行安装:
将源码移植到IMX6ULL开发板:
由于scp命令会导致文件的符号链接解除,因此将源码压缩在传过去再解压缩,如下图所示:
随后将库文件拷贝到目录/usr/lib下
二、移植libpng库
下载源码
进入网址下载 https://github.com/glennrp/libpng/releases,:
解压libpng源码,并创建一个png文件夹用来安装libpng库:
libpng 依赖于 zlib 库,前面我们已经将 zlib 库编译成功了,但是我们得告知编译器 zlib 库的安装目录,这样编译器才能找到 zlib 的库文件以及头文件,编译 libpng 的时才不会报错,执行以下三条命令将 zlib 库安装目录下的 include 和 lib 路径导出到环境变量:
export LDFLAGS="${LDFLAGS} -L/home/zyc/tools/zlib/lib"
export CFLAGS="${CFLAGS} -I/home/zyc/tools/zlib/include"
export CPPFLAGS="${CPPFLAGS} -I/home/zyc/tools/zlib/include"
接着执行以下命令对源码进行配置:
./configure --prefix=/home/zyc/tools/png --host=arm-poky-linux-gnueabi
最后进行编译make和安装make install:
将源码移植到IMX6ULL开发板:
和之前的操作一样将bin目录下的文件拷贝到usr/bin/目录下,lib目录下的文件拷贝到/usr/lib目录下:
三、移植Freetype字体库
下载源码
解压源码并创建一个文件夹freetype用来保存安装文件:
配置文件
打开 include/freetype/config/ftoption.h 文件,打开以下两个宏定义:
#define FT_CONFIG_OPTION_SYSTEM_ZLIB
#define FT_CONFIG_OPTION_USE_PNG
对源码进行如下配置:
./configure --prefix=/home/zyc/tools/freetype/ --host=arm-poky-linux-gnueabi --with-
zlib=yes --with-bzip2=no --with-png=yes --with-harfbuzz=no ZLIB_CFLAGS="-
I/home/zyc/tools/zlib/include -L/home/zyc/tools/zlib/lib" ZLIB_LIBS=-lz LIBPNG_CFLAGS="-
I/home/zyc/tools/png/include -L/home/zyc/tools/png/lib" LIBPNG_LIBS=-lpng
--prefix 选项指定 FreeType 库的安装目录; --host 选项设置为交叉编译器名称的前缀
--with-zlib=yes 表示使用 zlib;
--with-bzip2=no 表示不使用 bzip2 库;
--with-png=yes 表示使用 libpng 库;
--with-harfbuzz=no 表示不使用 harfbuzz 库。
ZLIB_CFLAGS 选项用于指定 zlib 的头文件路径和库文件路径,根据实际安装路径填写;
ZLIB_LIBS 选项指定链接的 zlib 库的名称;
LIBPNG_CFLAGS 选项用于指定 libpng 的头文件路径和库文件路径,根据实际安装路径填写;
LIBPNG_LIBS 选项用于指定链接的 libpng 库的名称。
配置完进行编译make和安装make install,如下图所示:
将源码移植到IMX6ULL开发板:
将lib目录下的文件拷贝到开发板的/usr/lib目录下:
边栏推荐
- Go语言实现原理——锁实现原理
- (4)UART应用设计及仿真验证2 —— RX模块设计(无状态机)
- Basic knowledge of database (interview)
- Initial experience | purchase and activate typora software
- Neural structured learning 4 antagonistic learning for image classification
- 698. Divided into k equal subsets ●●
- 成为程序员的你,后悔了吗?
- Leecode learning notes
- Practice of concurrent search
- idea 连接mysql ,直接贴配置文件的url 比较方便
猜你喜欢
Data analysis - Thinking foreshadowing
Debian 10 installation configuration
Spécifications techniques et lignes directrices pour la sélection des tubes TVS et ESD - Recommandation de jialichuang
Brushless drive design -- on MOS drive circuit
两数之和、三数之和(排序+双指针)
Douban scoring applet Part-2
YML configuration, binding and injection, verification, unit of bean
Go语言实现原理——锁实现原理
Getting started stm32--gpio (running lantern) (nanny level)
并查集实践
随机推荐
UVA – 11637 Garbage Remembering Exam (组合+可能性)
6-axis and 9-axis IMU attitude estimation
2.13 summary
UVA11294-Wedding(2-SAT)
98. Verify the binary search tree ●●
The maximum happiness of the party
Scala concurrent programming (II) akka
Data type, variable declaration, global variable and i/o mapping of PLC programming basis (CoDeSys)
Judge whether the binary tree is a complete binary tree
Selenium+pytest automated test framework practice
Multi sensor fusion of imu/ optical mouse / wheel encoder (nonlinear Kalman filter)
Objective C message dispatch mechanism
Use of metadata in golang grpc
AsyncSocket长连接棒包装问题解决
February 13, 2022-4-symmetric binary tree
The interface of grafana tool displays an error, incluxdb error
The PostgreSQL column reference 'ID' is ambiguous - PostgreSQL column reference'id'is ambiguous
YML configuration, binding and injection, verification, unit of bean
判断二叉树是否为完全二叉树
Spécifications techniques et lignes directrices pour la sélection des tubes TVS et ESD - Recommandation de jialichuang