当前位置:网站首页>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目录下:
边栏推荐
- C# Linq Demo
- Multi camera stereo calibration
- LabVIEW打开PNG 图像正常而 Photoshop打开得到全黑的图像
- 判斷二叉樹是否為完全二叉樹
- 3: Chapter 1: understanding JVM specification 2: JVM specification, introduction;
- 成为程序员的你,后悔了吗?
- 98. 验证二叉搜索树 ●●
- Dynamic planning: robbing families and houses
- It is proved that POJ 1014 module is optimized and pruned, and some recursion is wrong
- VS2010编写动态链接库DLL和单元测试,转让DLL测试的正确性
猜你喜欢
Go language implementation principle -- lock implementation principle
Alibaba Tianchi SQL training camp task4 learning notes
《牛客刷verilog》Part III Verilog企业真题
Xinyuan & Lichuang EDA training camp - brushless motor drive
2: Chapter 1: understanding JVM specification 1: introduction to JVM;
Creative mode 1 - single case mode
[original] what is the core of programmer team management?
进击的技术er——自动化
698. 划分为k个相等的子集 ●●
698. Divided into k equal subsets ●●
随机推荐
The PostgreSQL column reference 'ID' is ambiguous - PostgreSQL column reference'id'is ambiguous
698. 划分为k个相等的子集 ●●
CIS基准测试工具kube-bench使用
3: Chapter 1: understanding JVM specification 2: JVM specification, introduction;
Neural structured learning - Part 2: training with natural graphs
What is the process of building a website
Leetcode sword finger offer brush questions - day 21
Hj16 shopping list
idea 连接mysql ,直接贴配置文件的url 比较方便
Media query: importing resources
二叉树递归套路总结
Hainan Nuanshen tea recruits warmhearted people: recruitment of the product experience recommender of Nuanshen multi bubble honey orchid single cluster
February 13, 2022-4-symmetric binary tree
yate. conf
golang代码检查工具
C Primer Plus Chapter 9 question 9 POW function
98. 验证二叉搜索树 ●●
Design and implementation of secsha system
asp.net弹出层实例
Idea rundashboard window configuration