在Ubuntu 18.04上,如何从源代码构建Brotli
Tianye
・3 分钟阅读
使用不同的系统?
Brotli是一种比GZIP有更好压缩比的新压缩方法,它的源代码发布在github , 本指南将向你展示从源代码运行和构建Brotli所需的命令。
开始之前
检查Ubuntu版本。
lsb_release -ds
# Ubuntu 18.04 LTS
使用sudo
访问创建一个新的非root用户帐户,并且切换到它。
adduser johndoe --gecos"John Doe"
usermod -aG sudo johndoe
su - johndoe
注:将johndoe
替换为你的用户名。
设置时区。
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
克隆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
。
有关帮助,请运行./configure --help
命令。
现在,建立布罗特里。
./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.5
就这样,你已经成功地从源代码构建了Brotli 。