如何在 Debian 9 上从源代码编译 Brotli 压缩工具
本教程适用于这些操作系统版本
- Debian 10(克星)
- Debian 9(延伸)
在此页
- 要求
- 初始步骤
- 构建 Brotli
- 链接
Brotli 是一种通用无损压缩算法,它结合使用 LZ77 算法的现代变体、霍夫曼编码和二阶上下文建模来压缩数据,其压缩率可与目前最好的通用压缩方法相媲美。它的速度与放气相似,但提供更密集的压缩。它在 MIT 许可证下是开源的。你可以在 Github 上浏览它的源代码。 Brotli 压缩数据格式的规范在 RFC 7932 中定义。
本教程展示了如何在 Debian 9 (stretch) 上从源代码编译 Brotli 压缩库和程序。
要求
- Debian 9 系统。
- 具有 sudo 访问权限的非根用户。
初始步骤
检查 Debian 版本。
lsb_release -ds
# Debian GNU/Linux 9.6 (stretch)
设置时区。
sudo dpkg-reconfigure tzdata
更新您的操作系统包。
sudo apt update && sudo apt upgrade -y
构建 Brotli
安装构建工具和所需的包。
sudo apt install -y build-essential gcc make bc sed autoconf automake libtool git apt-transport-https tree
克隆 Brotli 存储库。
git clone https://github.com/google/brotli.git
导航到 Brotli 源代码树目录。
cd brotli
为 Brotli 命令创建手册页。
sudo cp ~/brotli/docs/brotli.1 /usr/share/man/man1 && sudo gzip /usr/share/man/man1/brotli.1
检查手册页。
man brotli
要生成 Autotools configure
文件,请先运行 ./bootstrap
命令。
./bootstrap
执行上述命令后,您应该可以访问通常的 C 程序构建步骤:configure
、make
和 make install
available。
如需帮助,您可以运行 ./configure --help
命令。现在我们准备好按照以下说明构建 Brotli。
构建和安装 brotli 的基本命令是:
./configure --prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--libexecdir=/usr/lib/brotli \
--libdir=/usr/lib/brotli \
--datarootdir=/usr/share \
--mandir=/usr/share/man/man1 \
--docdir=/usr/share/doc
make
sudo make install
成功构建过程后,您可以检查 Brotli 版本。
brotli --version
# brotli 1.0.7
要查看有关 brotli 命令的帮助,您可以运行:
brotli -h
链接
- https://brotli.org/
- https://github.com/google/brotli
- https://en.wikipedia.org/wiki/Brotli