Generating a Compression Algorithm RPM Package
This document uses GLZ 1.0.0 as an example. Replace it with the actual GLZ version number.
- Install rpmbuild.
1 2
yum install rpmdevtools -y rpmdev-setuptree
If building is performed as the root user, the rpmbuild folder is generated in the /root directory. The building process occupies about 20 to 30 GB space. If the space of the /root directory is small, you can move the rpmbuild folder to another directory, for example, /home.
- Modify the .rpmmacros file after running the rpmbuild command.
1vi /root/.rpmmacrosChange %_topdir to /home/rpmbuild.

- Execute the following command again:
1rpmdev-setuptree
- Modify the .rpmmacros file after running the rpmbuild command.
- Copy the algorithm dynamic library.
Copy the compression algorithm dynamic library to /home/rpmbuild/BUILD/.
1 2
mkdir -p /home/rpmbuild/BUILD/glz-1.0.0 cp /usr/lib64/libglz.so /home/rpmbuild/BUILD/glz-1.0.0/
- Edit the GLZ specification file.
1vi /home/rpmbuild/SPECS/glz.spec1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# os_type %{!?os_type: %define os_type centos} Name: glz Version: 1.0.0 Release: centos Summary: glz compress License: Commercial %description %install mkdir -p %{buildroot}/usr/lib64 cp %{_builddir}/%{name}-%{version}/*.so %{buildroot}/usr/lib64/ %files %{_libdir}/*.so
- Build an RPM package.
1rpmbuild -bb /home/rpmbuild/SPECS/glz.spec