RPM 制作-l-000001

编译 libarchive ^libarchive

https://github.com/libarchive/libarchive/releases?page=2
tar -zxvf /opt/libarchive-3.3.3.tar.gz -C /usr/local/src
cd /usr/local/src/libarchive-3.3.3
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 install

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libarchive.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libarchive.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global debug_package %{nil}
# 定义基础名称(不带 local- 前缀)
%global base_name libarchive

# 统一设置编译器
# 如果 use_clang 未定义,默认为 1
%{!?use_clang:%global use_clang 1}

%if %{use_clang}
%define _cc /usr/local/bin/clang
%define _cxx /usr/local/bin/clang++
%else
%define _cc /usr/local/bin/gcc
%define _cxx /usr/local/bin/g++
%endif

Name:       local-%{base_name}
Version:    3.3.3
Release:    1%{?dist}
Summary:    %{base_name}

License:    GPLv3+
Source0:    %{base_name}-%{version}.tar.gz

%description
%{base_name}

%prep
%setup -q -n %{base_name}-%{version}

%build
# 验证编译器
echo "Using CC: ${CC:-%{_cc}}"
${CC:-%{_cc}} --version
export CC=%{_cc}
export CXX=%{_cxx}
#export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64

mkdir -p build
cd build
../configure --prefix=/usr/local --with-gmp=/usr/local --with-mpfr=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
cd build
make install DESTDIR=%{buildroot}

# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%files -f %{_builddir}/files.list

%post
# 安装后注册 info 文档
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi
%postun
# 卸载后取消注册
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --delete --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi

%changelog
* %(LANG=en_US.UTF-8 date +"%%a %%b %%d %%Y") Your Name <1284524409@qq.com> - %{version}-%{release}
- Initial RPM release

编译 libdb ^libdb

RPM 制作
dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libdb.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libdb.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libdb
%define __soversion_major 5
%define __soversion %{__soversion_major}.3

Summary: The Berkeley DB database library for C
Name:       local-%{base_name}
Version: 5.3.28
Release: 42%{?dist}
Source0: http://download.oracle.com/berkeley-db/db-%{version}.tar.gz
Source1: http://download.oracle.com/berkeley-db/db.1.85.tar.gz
# For mt19937db.c
Source2: http://www.gnu.org/licenses/lgpl-2.1.txt
# libdb man pages generated from the 5.3.28 documentation
Source3: libdb-5.3.28-manpages.tar.gz
Patch0: libdb-multiarch.patch
# db-1.85 upstream patches
Patch10: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.1
Patch11: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.2
Patch12: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.3
Patch13: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.4
# other patches
Patch20: db-1.85-errno.patch
Patch22: db-4.6.21-1.85-compat.patch
Patch24: db-4.5.20-jni-include-dir.patch
# License clarification patch
# http://devel.trisquel.info/gitweb/?p=package-helpers.git;a=blob;f=helpers/DATA/db4.8/007-mt19937db.c_license.patch;h=1036db4d337ce4c60984380b89afcaa63b2ef88f;hb=df48d40d3544088338759e8bea2e7f832a564d48
Patch25: 007-mt19937db.c_license.patch
#Adds missing constant to Optcodes.java and changes ClassReader.java to use it. This makes package to build with Java 8. 
Patch26: java8-fix.patch
# memp_stat fix provided by upstream (rhbz#1211871)
Patch27: db-5.3.21-memp_stat-upstream-fix.patch
# fix for mutexes not being released provided by upstream (rhbz#1277887)
Patch28: db-5.3.21-mutex_leak.patch
# fix for overflowing hash variable inside bundled lemon
Patch29: db-5.3.28-lemon_hash.patch
# upstream patch adding the ability to recreate libdb's environment on version mismatch
# or when libpthread.so is modified (rhbz#1394862)
Patch30: db-5.3.28-condition_variable.patch
# additional changes to the upstream patch to address rhbz#1460003
Patch31: db-5.3.28-condition-variable-ppc.patch
# downstream patch that adds a check for rpm transaction lock in order to be able to update libdb
# FIXME: remove when able
Patch32: db-5.3.28-rpm-lock-check.patch
# downstream patch to hotfix rhbz#1464033, sent upstream
Patch33: db-5.3.28-cwd-db_config.patch
Patch34: libdb-5.3.21-region-size-check.patch
# Patch sent upstream
Patch35: checkpoint-opd-deadlock.patch
Patch36: db-5.3.28-atomic_compare_exchange.patch
# CDB race (rhbz #1616259)
Patch37: libdb-cbd-race.patch

# Use AES from openssl
Patch38: db-5.3.28-openssl.patch
# Limit concurrency to max 1024 CPUs (rhbz#1245410)
# A fix for the issue should be in an upstream release already
# https://community.oracle.com/message/13274780#13274780
Patch39: libdb-limit-cpu.patch

# rhbz#1670768 Patch sent upstream
# Expects libdb-5.3.21-mutex_leak.patch applied
Patch40: libdb-5.3.21-trickle_cpu.patch

Patch41: db-5.3.28_cve-2019-2708.patch

# https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libdb-5.3.28-31.el8+7/scan-results-imp.html#def182
Patch200: db-5.3.28-add_getopt_h.patch
# https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libdb-5.3.28-31.el8+7/scan-results-imp.html#def1
Patch201: db-5.3.28-add_stdio_h.patch
# https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libdb-5.3.28-31.el8+7/scan-results-imp.html#def141
Patch202: db-5.3.28-add_sys_file_h.patch
# https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libdb-5.3.28-31.el8+7/scan-results-imp.html#def41
# https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libdb-5.3.28-31.el8+7/scan-results-imp.html#def42
# https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libdb-5.3.28-31.el8+7/scan-results-imp.html#def44
# https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libdb-5.3.28-31.el8+7/scan-results-imp.html#def45
Patch203: db-5.3.28-wbool_compare.patch
Patch42: db-5.3.28-mmap-high-cpu-usage.patch

URL: http://www.oracle.com/database/berkeley-db/
License: BSD and LGPLv2 and Sleepycat
Group: System Environment/Libraries
BuildRequires: local-perl5 local-libtool
BuildRequires: local-tcl >= 8.5.2-3
#BuildRequires: java-devel >= 1:1.6.0
BuildRequires: chrpath
BuildRequires: local-zlib
BuildRequires: local-openssl
Conflicts: filesystem < 3

%description
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. The Berkeley DB includes B+tree, Extended
Linear Hashing, Fixed and Variable-length record access methods,
transactions, locking, logging, shared memory caching, and database
recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
used by many applications, including Python and Perl, so this should
be installed on all systems.

%package utils
Summary: Command line tools for managing Berkeley DB databases
Group: Applications/Databases
Requires: %{name}%{?_isa} = %{version}-%{release}

%description utils
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. Berkeley DB includes B+tree, Extended
Linear Hashing, Fixed and Variable-length record access methods,
transactions, locking, logging, shared memory caching, and database
recovery. DB supports C, C++, Java and Perl APIs.

%package devel
Summary: C development files for the Berkeley DB library
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains the header files,
libraries, and documentation for building programs which use the
Berkeley DB.

%package devel-doc
Summary: C development documentation files for the Berkeley DB library
Group: Documentation
Requires: %{name} = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
BuildArch: noarch

%description devel-doc
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains the header files,
libraries, and documentation for building programs which use the
Berkeley DB.

%package devel-static
Summary: Berkeley DB static libraries
Group: Development/Libraries
Requires: %{name}-devel%{?_isa} = %{version}-%{release}

%description devel-static
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains static libraries
needed for applications that require static linking of
Berkeley DB.

%package cxx
Summary: The Berkeley DB database library for C++
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description cxx
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. The Berkeley DB includes B+tree, Extended
Linear Hashing, Fixed and Variable-length record access methods,
transactions, locking, logging, shared memory caching, and database
recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
used by many applications, including Python and Perl, so this should
be installed on all systems.

%package cxx-devel
Summary: The Berkeley DB database library for C++
Group: System Environment/Libraries
Requires: %{name}-cxx%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}

%description cxx-devel
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. The Berkeley DB includes B+tree, Extended
Linear Hashing, Fixed and Variable-length record access methods,
transactions, locking, logging, shared memory caching, and database
recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
used by many applications, including Python and Perl, so this should
be installed on all systems.

%package tcl
Summary: Development files for using the Berkeley DB with tcl
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description tcl
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains the libraries
for building programs which use the Berkeley DB in Tcl.

%package tcl-devel
Summary: Development files for using the Berkeley DB with tcl
Group: Development/Libraries
Requires: %{name}-tcl%{?_isa} = %{version}-%{release}

%description tcl-devel
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains the libraries
for building programs which use the Berkeley DB in Tcl.

%package sql
Summary: Development files for using the Berkeley DB with sql
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description sql
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains the libraries
for building programs which use the Berkeley DB in SQL.

%package sql-devel
Summary: Development files for using the Berkeley DB with sql
Group: Development/Libraries
Requires: %{name}-sql%{?_isa} = %{version}-%{release}

%description sql-devel
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains the libraries
for building programs which use the Berkeley DB in SQL.

%package java
Summary: Development files for using the Berkeley DB with Java
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description java
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains the libraries
for building programs which use the Berkeley DB in Java.

%package java-devel
Summary: Development files for using the Berkeley DB with Java
Group: Development/Libraries
Requires: %{name}-java%{?_isa} = %{version}-%{release}

%description java-devel
The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. This package contains the libraries
for building programs which use the Berkeley DB in Java.

%prep
%setup -q -n db-%{version} -a 1
cp %{SOURCE2} .
tar -xf %{SOURCE3}

%patch0 -p1
pushd db.1.85/PORT/linux
%patch10 -p0
popd
pushd db.1.85
%patch11 -p0
%patch12 -p0
%patch13 -p0
%patch20 -p1
popd

%patch22 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1 -b .openssl
%patch39 -p1
%patch40 -p1
%patch41 -p1 -b .cve-2019-2708
%patch200 -p1
%patch201 -p1
%patch202 -p1
%patch203 -p1
%patch42 -p1


# Delete internal AES implementation
rm -rf src/crypto/rijndael

cd dist
./s_include
./s_config
cd ..

%build
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
CFLAGS="$CFLAGS -DSHAREDSTATEDIR='\"%{_sharedstatedir}\"' -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -I../../../lang/sql/sqlite/ext/fts3/"
export CFLAGS

# building with PIE
LDFLAGS="$LDFLAGS $RPM_LD_FLAGS"
export LDFLAGS

# Build the old db-185 libraries.
make -C db.1.85/PORT/%{_os} OORG="$CFLAGS"

test -d dist/dist-tls || mkdir dist/dist-tls
# Static link db_dump185 with old db-185 libraries.
/bin/sh libtool --tag=CC --mode=compile	%{__cc} $RPM_OPT_FLAGS -Idb.1.85/PORT/%{_os}/include -D_REENTRANT -c util/db_dump185.c -o dist/dist-tls/db_dump185.lo
/bin/sh libtool --tag=CC --mode=link %{__cc} $RPM_LD_FLAGS -o dist/dist-tls/db_dump185 dist/dist-tls/db_dump185.lo db.1.85/PORT/%{_os}/libdb.a

# Update config files to understand aarch64
for dir in dist lang/sql/sqlite lang/sql/jdbc lang/sql/odbc; do
  cp /usr/lib/rpm/config.{guess,sub} "$dir"
done

pushd dist/dist-tls
%define _configure ../configure
%configure -C \
	--enable-compat185 --enable-dump185 \
	--enable-shared --enable-static \
	--enable-tcl --with-tcl=%{_libdir} \
	--enable-cxx --enable-sql \
    --with-cryptography=openssl \
	--disable-rpath \
    --with-tcl=%{_libdir}/tcl8.6
#	--enable-java \
#	--enable-test \
# Remove libtool predep_objects and postdep_objects wonkiness so that
# building without -nostdlib doesn't include them twice.  Because we
# already link with g++, weird stuff happens if you don't let the
# compiler handle this.
perl -pi -e 's/^predep_objects=".*$/predep_objects=""/' libtool
perl -pi -e 's/^postdep_objects=".*$/postdep_objects=""/' libtool
perl -pi -e 's/-shared -nostdlib/-shared/' libtool

make %{?_smp_mflags}

# XXX hack around libtool not creating ./libs/libdb_java-X.Y.lai
LDBJ=./.libs/libdb_java-%{__soversion}.la
if test -f ${LDBJ} -a ! -f ${LDBJ}i; then
	sed -e 's,^installed=no,installed=yes,' < ${LDBJ} > ${LDBJ}i
fi

# Run some quick subsystem checks
echo "source ../../test/tcl/test.tcl; r env; r mut; r memp" | tclsh
popd

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_includedir}
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/docs/csharp
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/docs/installation

%makeinstall STRIP=/bin/true -C dist/dist-tls || true

# XXX Nuke non-versioned archives and symlinks
rm -f ${RPM_BUILD_ROOT}%{_libdir}/{libdb.a,libdb_cxx.a,libdb_tcl.a,libdb_sql.a}

chmod +x ${RPM_BUILD_ROOT}%{_libdir}/*.so*

# Move the header files to a subdirectory, in case we're deploying on a
# system with multiple versions of DB installed.
mkdir -p ${RPM_BUILD_ROOT}%{_includedir}/%{base_name}
mv ${RPM_BUILD_ROOT}%{_includedir}/*.h ${RPM_BUILD_ROOT}%{_includedir}/%{base_name}/

# Create symlinks to includes so that "use <db.h> and link with -ldb" works.
for i in db.h db_cxx.h db_185.h; do
	ln -s %{base_name}/$i ${RPM_BUILD_ROOT}%{_includedir}
done

# Move java jar file to the correct place
# mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/java
# mv ${RPM_BUILD_ROOT}%{_libdir}/*.jar ${RPM_BUILD_ROOT}%{_datadir}/java

# Eliminate installed doco
rm -rf ${RPM_BUILD_ROOT}%{_prefix}/docs

# XXX Avoid Permission denied. strip when building as non-root.
chmod u+w ${RPM_BUILD_ROOT}%{_bindir} ${RPM_BUILD_ROOT}%{_bindir}/*

# remove unneeded .la files (#225675)
rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la

# remove RPATHs
chrpath -d ${RPM_BUILD_ROOT}%{_libdir}/*.so ${RPM_BUILD_ROOT}%{_bindir}/*

# unify documentation and examples, remove stuff we don't need
rm -rf docs/csharp
rm -rf examples/csharp
rm -rf docs/installation
# mv examples docs
# mv man/* ${RPM_BUILD_ROOT}%{_mandir}/man1

%clean
rm -rf ${RPM_BUILD_ROOT}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -p /sbin/ldconfig cxx

%postun -p /sbin/ldconfig cxx

%post -p /sbin/ldconfig sql

%postun -p /sbin/ldconfig sql

%post -p /sbin/ldconfig tcl

%postun -p /sbin/ldconfig tcl

# %post -p /sbin/ldconfig java

# %postun -p /sbin/ldconfig java

%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE lgpl-2.1.txt
%doc README
%{_libdir}/libdb-%{__soversion}.so
%{_libdir}/libdb-%{__soversion_major}.so

%files devel
%defattr(-,root,root,-)
%{_libdir}/libdb.so
%dir %{_includedir}/%{base_name}
%{_includedir}/%{base_name}/db.h
%{_includedir}/%{base_name}/db_185.h
%{_includedir}/db.h
%{_includedir}/db_185.h

%files devel-doc
%defattr(-,root,root,-)
%doc	docs/*

%files devel-static
%defattr(-,root,root,-)
%{_libdir}/libdb-%{__soversion}.a
%{_libdir}/libdb_cxx-%{__soversion}.a
%{_libdir}/libdb_tcl-%{__soversion}.a
%{_libdir}/libdb_sql-%{__soversion}.a
# %{_libdir}/libdb_java-%{__soversion}.a

%files utils
%defattr(-,root,root,-)
%{_bindir}/db*_archive
%{_bindir}/db*_checkpoint
%{_bindir}/db*_deadlock
%{_bindir}/db*_dump*
%{_bindir}/db*_hotbackup
%{_bindir}/db*_load
%{_bindir}/db*_printlog
%{_bindir}/db*_recover
%{_bindir}/db*_replicate
%{_bindir}/db*_stat
%{_bindir}/db*_upgrade
%{_bindir}/db*_verify
%{_bindir}/db*_tuner
# %{_mandir}/man1/db_*

%files cxx
%defattr(-,root,root,-)
%{_libdir}/libdb_cxx-%{__soversion}.so
%{_libdir}/libdb_cxx-%{__soversion_major}.so

%files cxx-devel
%defattr(-,root,root,-)
%{_includedir}/%{base_name}/db_cxx.h
%{_includedir}/db_cxx.h
%{_libdir}/libdb_cxx.so

%files tcl
%defattr(-,root,root,-)
%{_libdir}/libdb_tcl-%{__soversion}.so
%{_libdir}/libdb_tcl-%{__soversion_major}.so

%files tcl-devel
%defattr(-,root,root,-)
%{_libdir}/libdb_tcl.so

%files sql
%defattr(-,root,root,-)
%{_libdir}/libdb_sql-%{__soversion}.so
%{_libdir}/libdb_sql-%{__soversion_major}.so

%files sql-devel
%defattr(-,root,root,-)
%{_bindir}/dbsql
%{_libdir}/libdb_sql.so
%{_includedir}/%{base_name}/dbsql.h

# %files java
# %defattr(-,root,root,-)
# %{_libdir}/libdb_java-%{__soversion_major}*.so
# %{_datadir}/java/*.jar

# %files java-devel
# %defattr(-,root,root,-)
# %{_libdir}/libdb_java.so

%changelog
* Wed Sep 8 2021 Filip Januš <fjanus@redhat.com> 5.3.28-42
- Apply the previous change only on aarch64 to limit the risk of unwanted impact
- Resolves: #1992402


编译 libelf ^libelf

https://sourceware.org/elfutils/ftp/0.190/elfutils-0.190.tar.bz2
tar -jxvf /opt/elfutils-0.190.tar.bz2 -C /usr/local/src
cd /usr/local/src/elfutils-0.190
mkdir -p build
cd build
../configure --prefix=/usr/local --disable-debuginfod --enable-install-elfh --enable-libdebuginfod=dummy --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 -C libelf install
install -vm644 config/libelf.pc /usr/local/lib/pkgconfig/libelf.pc

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libelf.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "use_clang 0" \
~/rpmbuild/SPECS/libelf.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global debug_package %{nil}
# 定义基础名称(不带 local- 前缀)
%global base_name libelf

# 统一设置编译器
# 如果 use_clang 未定义,默认为 1
%{!?use_clang:%global use_clang 1}

%if %{use_clang}
%define _cc /usr/local/bin/clang
%define _cxx /usr/local/bin/clang++
%else
%define _cc /usr/local/bin/gcc
%define _cxx /usr/local/bin/g++
%endif

Name:       local-%{base_name}
Version:    0.190
Release:    1%{?dist}
Summary:    %{base_name}

License:    GPLv3+
Source0:    elfutils-%{version}.tar.bz2

%description
%{base_name}

%prep
%setup -q -n elfutils-%{version}

%build
# 验证编译器
echo "Using CC: ${CC:-%{_cc}}"
${CC:-%{_cc}} --version
export CC=%{_cc}
export CXX=%{_cxx}
#export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64

mkdir -p build
cd build
../configure --prefix=/usr/local --disable-debuginfod --enable-install-elfh --enable-libdebuginfod=dummy --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
cd build
make install DESTDIR=%{buildroot}

# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%files -f %{_builddir}/files.list

%post
# 安装后注册 info 文档
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi
%postun
# 卸载后取消注册
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --delete --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi

%changelog
* %(LANG=en_US.UTF-8 date +"%%a %%b %%d %%Y") Your Name <1284524409@qq.com> - %{version}-%{release}
- Initial RPM release

编译 libenvent ^libenvent

https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -zxvf /opt/libevent-2.1.8-stable.tar.gz -C /usr/local/src
cd /usr/local/src/libevent-2.1.8-stable

./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4
make -j4 install

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libevent.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libevent.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global debug_package %{nil}
# 定义基础名称(不带 local- 前缀)
%global base_name libevent

# 统一设置编译器
%{!?use_clang:%global use_clang 1}
%if %{use_clang}
%define _cc /usr/local/bin/clang
%define _cxx /usr/local/bin/clang++
%else
%define _cc /usr/local/bin/gcc
%define _cxx /usr/local/bin/g++
%endif

Name:       local-%{base_name}
Version:    2.1.8
Release:    1%{?dist}
Summary:    %{base_name}

License:    GPLv3+
Source0:    %{base_name}-%{version}-stable.tar.gz

%description
%{base_name}

%prep
# 这个宏会:rm -rf 旧目录 → 解压源码 → 打补丁
%setup -q -n %{base_name}-%{version}-stable

%build
# 验证编译器
echo "Using CC: ${CC:-%{_cc}}"
${CC:-%{_cc}} --version
export CC=%{_cc}
export CXX=%{_cxx}
export CFLAGS="-Wno-incompatible-function-pointer-types"
export CXXFLAGS="-Wno-incompatible-function-pointer-types"
#export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64

mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
cd build
make install DESTDIR=%{buildroot}

# ==========================================
# 通用 Python 字节码生成
# 尝试 Python 2 和 Python 3,哪个能工作就用哪个
# ==========================================
# 定义函数:尝试用指定 Python 编译
try_compile() {
    local python=$1
    if [ -x "$python" ]; then
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        return 0
    fi
    return 1
}
# 优先尝试 Python 2(兼容旧语法)
try_compile /usr/bin/python3
try_compile /usr/bin/python2


# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
echo %{buildroot}
ls -la ./usr/local/lib/ || true
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%files -f %{_builddir}/files.list

%post
# 安装后注册 info 文档
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi
%postun
# 卸载后取消注册
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --delete --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi

%changelog
* %(LANG=en_US.UTF-8 date +"%%a %%b %%d %%Y") Your Name <1284524409@qq.com> - %{version}-%{release}
- Initial RPM release

编译 libev ^libev

https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -zxvf /opt/libevent-2.1.8-stable.tar.gz -C /usr/local/src
cd /usr/local/src/libevent-2.1.8-stable

./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4
make -j4 install

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libev.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libev.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libev
%global source_dir  %{_datadir}/%{name}-source
%global inst_srcdir %{buildroot}/%{source_dir}

Name:       local-%{base_name}
Summary:          High-performance event loop/event model with lots of features
Version:          4.24
Release:          6%{?dist}
License:          BSD or GPLv2+
URL:              http://software.schmorp.de/pkg/libev.html
Source0:          http://dist.schmorp.de/libev/Attic/%{base_name}-%{version}.tar.gz

BuildRequires:    local-autoconf
BuildRequires:    local-automake
BuildRequires:    coreutils
BuildRequires:    findutils
BuildRequires:    local-gcc
BuildRequires:    local-libtool
BuildRequires:    local-make
BuildRequires:    tar

Provides:         bundled(libecb) = 1.05

%description
Libev is modeled (very loosely) after libevent and the Event Perl
module, but is faster, scales better and is more correct, and also more
featureful. And also smaller.

%package devel
Summary:          Development headers for libev
Requires:         %{name}%{?_isa} = %{version}-%{release}

%description devel
This package contains the development headers and libraries for libev.

%package libevent-devel
Summary:          Compatibility development header with libevent for %{name}.
Requires:         %{name}-devel%{?_isa} = %{version}-%{release}

# The event.h file actually conflicts with the one from libevent-devel
Conflicts:        libevent-devel

%description libevent-devel
This package contains a development header to make libev compatible with
libevent.

%package source
Summary:          High-performance event loop/event model with lots of features
%if 0%{?fedora} >= 12 || 0%{?rhel} > 5
BuildArch:        noarch
%endif
Provides:         bundled(libecb) = 1.05

%description source
This package contains the source code for libev.

%prep
# 这个宏会:rm -rf 旧目录 → 解压源码 → 打补丁
%setup -q -n %{base_name}-%{version}
autoreconf -vfi

%build
%configure --disable-static --with-pic
%make_build

%check
make check

%install
make install DESTDIR=%{buildroot} INSTALL="install -p"
rm -rf %{buildroot}%{_libdir}/%{base_name}.la

# Make the source package
mkdir -p %{inst_srcdir}
find . -type f | grep -E '.*\.(c|h|am|ac|inc|m4|h.in|man.pre|pl|txt)$' | xargs tar cf - | (cd %{inst_srcdir} && tar xf -)
install -p -m 0644 Changes ev.pod LICENSE README %{inst_srcdir}

%ldconfig_scriptlets

%files
%license LICENSE
%doc Changes README
%{_libdir}/%{base_name}.so.4*

%files devel
%{_includedir}/ev++.h
%{_includedir}/ev.h
%{_libdir}/%{base_name}.so
%{_mandir}/man?/*

%files libevent-devel
%{_includedir}/event.h

%files source
%{source_dir}

%changelog
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.24-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild


编译 itstool ^itstool

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/itstool.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
--define "__python3 /usr/local/bin/python3" \
~/rpmbuild/SPECS/itstool.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name expat
%global unversion 2_5_0

Summary: An XML parser library
Name:       local-%{base_name}
Version: %(echo %{unversion} | sed 's/_/./g')
Release: 2%{?dist}
Source: https://github.com/libexpat/libexpat/archive/R_%{unversion}.tar.gz#/expat-%{version}.tar.gz
URL: https://libexpat.github.io/
License: MIT
BuildRequires: local-autoconf, local-libtool, local-xmlto, local-gcc
BuildRequires: local-make
# https://issues.redhat.com/browse/RHEL-24227
Patch0: expat-2.5.0-CVE-2023-52425.patch
# https://issues.redhat.com/browse/RHEL-28700
Patch1: expat-2.5.0-CVE-2024-28757.patch
# https://issues.redhat.com/browse/RHEL-56761
Patch2: expat-2.5.0-CVE-2024-45490.patch
# https://issues.redhat.com/browse/RHEL-57520
Patch3: expat-2.5.0-CVE-2024-45491.patch
# https://issues.redhat.com/browse/RHEL-57511
Patch4: expat-2.5.0-CVE-2024-45492.patch
# https://issues.redhat.com/browse/RHEL-65066
Patch5: expat-2.5.0-CVE-2024-50602.patch
# https://issues.redhat.com/browse/RHEL-57489
Patch6: expat-2.5.0-CVE-2024-8176.patch
# https://issues.redhat.com/browse/RHEL-114618
Patch7: expat-2.5.0-CVE-2025-59375.patch
# https://issues.redhat.com/browse/RHEL-177979
# https://github.com/libexpat/libexpat/pull/1216
Patch8: expat-2.5.0-CVE-2026-45186.patch

%description
This is expat, the C library for parsing XML, written by James Clark. Expat
is a stream oriented XML parser. This means that you register handlers with
the parser prior to starting the parse. These handlers are called when the
parser discovers the associated structures in the document being parsed. A
start tag is an example of the kind of structures for which you may
register handlers.

%package devel
Summary: Libraries and header files to develop applications using expat
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The expat-devel package contains the libraries, include files and documentation
to develop XML applications with expat.

%package static
Summary: expat XML parser static library
Requires: %{name}-devel%{?_isa} = %{version}-%{release}

%description static
The expat-static package contains the static version of the expat library.
Install it if you need to link statically with expat.

%prep
%setup -q -n libexpat-R_%{unversion}/expat
%patch0 -p2 -b .CVE-2023-52425
%patch1 -p2 -b .CVE-2024-28757
%patch2 -p2 -b .CVE-2024-45490
%patch3 -p2 -b .CVE-2024-45491
%patch4 -p2 -b .CVE-2024-45492
%patch5 -p2 -b .CVE-2024-50602
%patch6 -p2 -b .CVE-2024-8176
%patch7 -p2 -b .CVE-2025-59375
%patch8 -p2 -b .CVE-2026-45186

sed -i 's/install-data-hook/do-nothing-please/' lib/Makefile.am
./buildconf.sh

%build
export CFLAGS="$RPM_OPT_FLAGS -fPIC"
export DOCBOOK_TO_MAN="xmlto man --skip-validation"
%configure
make %{?_smp_mflags}

%install
make install DESTDIR=$RPM_BUILD_ROOT

rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%check
make check

%ldconfig_scriptlets

%files
%{!?_licensedir:%global license %%doc}
%doc AUTHORS Changes
%license COPYING
%{_bindir}/*
%{_libdir}/lib*.so.*
%{_mandir}/*/*
%{_docdir}/expat/*

%files devel
%doc doc/reference.html doc/*.css examples/*.c
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc
%{_includedir}/*.h
%{_libdir}/cmake/expat-%{version}

%files static
%{_libdir}/lib*.a

%changelog
* Thu May 28 2026 RHEL Packaging Agent <redhat-ymir-agent@redhat.com> - 2.5.0-2
- Fix CVE-2026-45186
- Resolves: RHEL-177979

编译libffi ^libffi

https://codeload.github.com/libffi/libffi/tar.gz/refs/tags/v3.4.4
tar -zxvf /opt/libffi-3.4.4.tar.gz -C /usr/local/src
cd /usr/local/src/libffi-3.4.4
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4
make -j4 install
ln -sf /usr/local/lib64/libffi.so /usr/local/lib/libffi.so

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/openssl.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libffi.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global debug_package %{nil}
# 定义基础名称(不带 local- 前缀)
%global base_name libffi

Name:       local-%{base_name}
Version:    3.4.4
Release:    1%{?dist}
Summary:    %{base_name}

License:    GPLv3+
Source0:    %{base_name}-%{version}.tar.gz

%description
%{base_name}

%prep
%setup -q -n %{base_name}-%{version}

%build
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
cd build
make install DESTDIR=%{buildroot}
ln -sf /usr/local/lib64/libffi.so /usr/local/lib/libffi.so

# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%files -f %{_builddir}/files.list

%changelog
* %(LANG=en_US.UTF-8 date +"%%a %%b %%d %%Y") Your Name <1284524409@qq.com> - %{version}-%{release}
- Initial RPM release

编译 libgcrypt ^libgcrypt

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libgcrypt.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libgcrypt.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libgcrypt
Name:       local-%{base_name}
Version: 1.8.5
Release: 8%{?dist}
URL: http://www.gnupg.org/
Source0: libgcrypt-%{version}-hobbled.tar.xz
# The original libgcrypt sources now contain potentially patented ECC
# cipher support. We have to remove it in the tarball we ship with
# the hobble-libgcrypt script. 
# (We replace it with RH approved ECC in Source4-5)
#Source0: ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-{version}.tar.bz2
#Source1: ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-{version}.tar.bz2.sig
Source2: wk@g10code.com
Source3: hobble-libgcrypt
# Approved ECC support
Source4: ecc-curves.c
Source5: curves.c
Source6: t-mpi-point.c
Source7: random.conf
# make FIPS hmac compatible with fipscheck - non upstreamable
# update on soname bump
Patch2: libgcrypt-1.8.5-use-fipscheck.patch
# modify FIPS RSA and DSA keygen to comply with requirements
Patch5: libgcrypt-1.8.4-fips-keygen.patch
# fix the tests to work correctly in the FIPS mode
Patch6: libgcrypt-1.8.4-tests-fipsmode.patch
# update the CAVS tests
Patch7: libgcrypt-1.7.3-fips-cavs.patch
# use poll instead of select when gathering randomness
Patch11: libgcrypt-1.8.4-use-poll.patch
# slight optimalization of mpicoder.c to silence Valgrind (#968288)
Patch13: libgcrypt-1.6.1-mpicoder-gccopt.patch
# fix tests to work with approved ECC
Patch14: libgcrypt-1.7.3-ecc-test-fix.patch
# Run the FIPS mode initialization in the shared library constructor
Patch18: libgcrypt-1.8.3-fips-ctor.patch
# Block some operations if in FIPS non-operational state
Patch22: libgcrypt-1.7.3-fips-reqs.patch
# Do not try to open /dev/urandom if getrandom() works
Patch24: libgcrypt-1.8.5-getrandom.patch
# CMAC selftest for FIPS POST
Patch25: libgcrypt-1.8.3-cmac-selftest.patch
# Continuous FIPS entropy test
Patch26: libgcrypt-1.8.3-fips-enttest.patch
# Disable non-approved FIPS hashes in the enforced FIPS mode
Patch27: libgcrypt-1.8.3-md-fips-enforce.patch
# Intel CET support, in upstream master
Patch28: libgcrypt-1.8.5-intel-cet.patch
# Fix build on ARMv7
Patch29: libgcrypt-1.8.5-build.patch
# FIPS module is redefined a little bit (implicit by kernel FIPS mode)
Patch30: libgcrypt-1.8.5-fips-module.patch
# Backported AES performance improvements
Patch31: libgcrypt-1.8.5-aes-perf.patch
# FIPS selftest for PBKDF2
Patch32: libgcrypt-1.8.5-kdf-selftest.patch
# ppc64 performance for SHA2 (#1855231)
Patch33: libgcrypt-1.8.5-ppc-sha2.patch
# ppc64 performance for CRC32 (#1855231)
Patch34: libgcrypt-1.8.5-ppc-crc32.patch
# ppc64 bugfixes (#1855231)
Patch35: libgcrypt-1.8.5-ppc-bugfix.patch
# ppc64 performance AES-GCM (#1855231)
Patch36: libgcrypt-1.8.5-ppc-aes-gcm.patch
# Fix elgamal cross-configuration (CVE-2021-40528)
Patch37: libgcrypt-1.9.3-CVE-2021-40528.patch
# We can use HW optimizations in FIPS (#1976137)
Patch38: libgcrypt-1.8.5-fips-hwfeatures.patch
# ppc64 performance chacha20 and poly1305 (#1855231)
Patch39: libgcrypt-1.8.5-ppc-chacha20-poly1305.patch
# Fix CVE-2021-33560 (elgamal blinding)
Patch40: libgcrypt-1.8.5-elgamal-blinding.patch
# https://dev.gnupg.org/T8211.html
Patch41: libgcrypt-1.8.5-montgomery-zeroes.patch

%define gcrylibdir %{_libdir}

# Technically LGPLv2.1+, but Fedora's table doesn't draw a distinction.
# Documentation and some utilities are GPLv2+ licensed. These files
# are in the devel subpackage.
License: LGPLv2+
Summary: A general-purpose cryptography library
BuildRequires: local-gcc
BuildRequires: gawk, local-libgpg-error-devel >= 1.11, local-pkgconf
BuildRequires: local-fipscheck
# This is needed only when patching the .texi doc.
BuildRequires: local-texinfo
BuildRequires: local-autoconf, local-automake, local-libtool

%package devel
Summary: Development files for the %{name} package
License: LGPLv2+ and GPLv2+
Requires(pre): /sbin/install-info
Requires(post): /sbin/install-info
Requires: local-libgpg-error-devel
Requires: %{name} = %{version}-%{release}

%description
Libgcrypt is a general purpose crypto library based on the code used
in GNU Privacy Guard.  This is a development version.

%description devel
Libgcrypt is a general purpose crypto library based on the code used
in GNU Privacy Guard.  This package contains files needed to develop
applications using libgcrypt.

%prep
%setup -q -n %{base_name}-%{version}
%{SOURCE3}
%patch2 -p1 -b .use-fipscheck
%patch5 -p1 -b .fips-keygen
%patch6 -p1 -b .tests-fipsmode
%patch7 -p1 -b .cavs
%patch11 -p1 -b .use-poll
%patch13 -p1 -b .gccopt
%patch14 -p1 -b .eccfix
%patch18 -p1 -b .fips-ctor
%patch22 -p1 -b .fips-reqs
%patch24 -p1 -b .getrandom
%patch25 -p1 -b .cmac-selftest
%patch26 -p1 -b .fips-enttest
%patch27 -p1 -b .fips-enforce
%patch28 -p1 -b .intel-cet
%patch29 -p1 -b .build
%patch30 -p1 -b .fips-module
%patch31 -p1 -b .aes-perf
%patch32 -p1 -b .kdf-selftest
%patch33 -p1 -b .ppc-sha2
%patch34 -p1 -b .ppc-crc32
%patch35 -p1 -b .ppc-bugfix
%patch36 -p1 -b .ppc-aes-gcm
%patch37 -p1 -b .CVE-2021-40528
%patch38 -p1 -b .hw-fips
%patch39 -p1 -b .ppc-chacha
%patch40 -p1 -b .elgamal-blinding
%patch41 -p1 -b .montgomery-zeroes

cp %{SOURCE4} cipher/
cp %{SOURCE5} %{SOURCE6} tests/

%build
autoreconf -f
%configure --disable-static \
%ifarch sparc64
     --disable-asm \
%endif
     --enable-noexecstack \
     --enable-hmac-binary-check \
     --enable-pubkey-ciphers='dsa elgamal rsa ecc' \
     --disable-O-flag-munging
sed -i -e '/^sys_lib_dlsearch_path_spec/s,/lib /usr/lib,/usr/lib /lib64 /usr/lib64 /lib,g' libtool
make %{?_smp_mflags}

%check
fipshmac src/.libs/libgcrypt.so.??
make check

# Add generation of HMAC checksums of the final stripped binaries 
%define __spec_install_post \
    %{?__debug_package:%{__debug_install_post}} \
    %{__arch_install_post} \
    %{__os_install_post} \
    fipshmac $RPM_BUILD_ROOT%{gcrylibdir}/*.so.?? \
%{nil}

%install
make install DESTDIR=$RPM_BUILD_ROOT

# Change /usr/lib64 back to /usr/lib.  This saves us from having to patch the
# script to "know" that -L/usr/lib64 should be suppressed, and also removes
# a file conflict between 32- and 64-bit versions of this package.
# Also replace my_host with none.
sed -i -e 's,^libdir="/usr/lib.*"$,libdir="/usr/lib",g' $RPM_BUILD_ROOT/%{_bindir}/libgcrypt-config
sed -i -e 's,^my_host=".*"$,my_host="none",g' $RPM_BUILD_ROOT/%{_bindir}/libgcrypt-config

rm -f ${RPM_BUILD_ROOT}/%{_infodir}/dir ${RPM_BUILD_ROOT}/%{_libdir}/*.la
/sbin/ldconfig -n $RPM_BUILD_ROOT/%{_libdir}

%if "%{gcrylibdir}" != "%{_libdir}"
# Relocate the shared libraries to %{gcrylibdir}.
mkdir -p $RPM_BUILD_ROOT%{gcrylibdir}
for shlib in $RPM_BUILD_ROOT%{_libdir}/*.so* ; do
	if test -L "$shlib" ; then
		rm "$shlib"
	else
		mv "$shlib" $RPM_BUILD_ROOT%{gcrylibdir}/
	fi
done

# Add soname symlink.
/sbin/ldconfig -n $RPM_BUILD_ROOT/%{_lib}/
%endif

# Overwrite development symlinks.
pushd $RPM_BUILD_ROOT/%{gcrylibdir}
for shlib in lib*.so.?? ; do
	target=$RPM_BUILD_ROOT/%{_libdir}/`echo "$shlib" | sed -e 's,\.so.*,,g'`.so
%if "%{gcrylibdir}" != "%{_libdir}"
	shlib=%{gcrylibdir}/$shlib
%endif
	ln -sf $shlib $target
done
popd

# Create /etc/gcrypt (hardwired, not dependent on the configure invocation) so
# that _someone_ owns it.
mkdir -p -m 755 $RPM_BUILD_ROOT/etc/gcrypt
install -m644 %{SOURCE7} $RPM_BUILD_ROOT/etc/gcrypt/random.conf

# Drop the pkgconfig as it would require an updated libgpg-error
rm $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/libgcrypt.pc

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post devel
[ -f %{_infodir}/gcrypt.info.gz ] && \
    /sbin/install-info %{_infodir}/gcrypt.info.gz %{_infodir}/dir
exit 0

%preun devel
if [ $1 = 0 -a -f %{_infodir}/gcrypt.info.gz ]; then
    /sbin/install-info --delete %{_infodir}/gcrypt.info.gz %{_infodir}/dir
fi
exit 0

%files
%dir /etc/gcrypt
%config(noreplace) /etc/gcrypt/random.conf
%{gcrylibdir}/libgcrypt.so.*
%{gcrylibdir}/.libgcrypt.so.*.hmac
%{!?_licensedir:%global license %%doc}
%license COPYING.LIB
%doc AUTHORS NEWS THANKS

%files devel
%{_bindir}/%{base_name}-config
%{_bindir}/dumpsexp
%{_bindir}/hmac256
%{_bindir}/mpicalc
%{_includedir}/*
%{_libdir}/*.so
%{_datadir}/aclocal/*
%{_mandir}/man1/*

%{_infodir}/gcrypt.info*
%{!?_licensedir:%global license %%doc}
%license COPYING

%changelog
* Mon Jun 29 2026 Jakub Jelen <jjelen@redhat.com> - 1.8.5-8
- Fix CVE-2026-41989: Denial of Service and buffer overflow via crafted ECDH ciphertext


编译 libgpg-error ^libgpg-error

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libgpg-error.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libgpg-error.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libgpg-error
Summary: Library for error values used by GnuPG components
Name:       local-%{base_name}
Version: 1.31
Release: 1%{?dist}
URL: https://www.gnupg.org/related_software/libgpg-error/
Source0: ftp://ftp.gnupg.org/gcrypt/libgpg-error/%{base_name}-%{version}.tar.bz2
Source1: ftp://ftp.gnupg.org/gcrypt/libgpg-error/%{base_name}-%{version}.tar.bz2.sig
Patch1: libgpg-error-1.29-multilib.patch
Group: System Environment/Libraries
License: LGPLv2+

BuildRequires: local-gcc
BuildRequires: gawk, local-gettext, local-autoconf, local-automake, local-gettext, local-libtool
BuildRequires: local-texinfo
%if 0%{?fedora} > 13
BuildRequires: local-gettext
%endif

%description
This is a library that defines common error values for all GnuPG
components.  Among these are GPG, GPGSM, GPGME, GPG-Agent, libgcrypt,
pinentry, SmartCard Daemon and possibly more in the future.

%package devel
Summary: Development files for the %{name} package
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires(pre): /sbin/install-info
Requires(post): /sbin/install-info

%description devel
This is a library that defines common error values for all GnuPG
components.  Among these are GPG, GPGSM, GPGME, GPG-Agent, libgcrypt,
pinentry, SmartCard Daemon and possibly more in the future. This package
contains files necessary to develop applications using libgpg-error.

%prep
%setup -q -n %{base_name}-%{version}
%patch1 -p1 -b .multilib
# The config script already suppresses the -L if it's /usr/lib, so cheat and
# set it to a value which we know will be suppressed.
sed -i -e 's|^libdir=@libdir@$|libdir=@exec_prefix@/lib|g;s|@GPG_ERROR_CONFIG_HOST@|none|g' src/gpg-error-config.in

# Modify configure to drop rpath for /usr/lib64
sed -i -e 's|sys_lib_dlsearch_path_spec="/lib /usr/lib|sys_lib_dlsearch_path_spec="/lib /usr/lib %{_libdir}|g' configure

%build
%configure --disable-static --disable-rpath --disable-languages

# 修复gawk 5.x兼容性问题
# 1. 修改Makefile中的namespace变量
sed -i 's/-v namespace=/-v mynamespace=/g' src/Makefile

# 2. 修改mkstrtable.awk脚本中的所有namespace引用
sed -i 's/namespace = ""/mynamespace = ""/g' src/mkstrtable.awk
sed -i 's/namespace != ""/mynamespace != ""/g' src/mkstrtable.awk
sed -i 's/namespace "/mynamespace "/g' src/mkstrtable.awk
sed -i 's/namespace}/mynamespace}/g' src/mkstrtable.awk
sed -i 's/print namespace/print mynamespace/g' src/mkstrtable.awk

make %{?_smp_mflags}

%install
rm -fr $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT/%{_infodir}/dir

%find_lang %{base_name}

%check
make check

%ldconfig_scriptlets

%post devel
[ -f %{_infodir}/gpgrt.info.gz ] && \
    /sbin/install-info %{_infodir}/gpgrt.info.gz %{_infodir}/dir
exit 0

%preun devel
if [ $1 = 0 -a -f %{_infodir}/gpgrt.info.gz ]; then
    /sbin/install-info --delete %{_infodir}/gpgrt.info.gz %{_infodir}/dir
fi
exit 0

%files -f %{base_name}.lang
%defattr(-,root,root)
%{!?_licensedir:%global license %%doc}
%license COPYING COPYING.LIB
%doc AUTHORS README NEWS ChangeLog
%{_bindir}/gpg-error
%{_libdir}/libgpg-error.so.0*
%{_datadir}/libgpg-error

%files devel
%defattr(-,root,root)
%{_bindir}/gpg-error-config
%{_bindir}/gpgrt-config
%{_bindir}/yat2m
%{_libdir}/libgpg-error.so
%{_includedir}/gpg-error.h
%{_includedir}/gpgrt.h
%{_datadir}/aclocal/gpg-error.m4
%{_datadir}/aclocal/gpgrt.m4
%{_infodir}/gpgrt.info*
%{_mandir}/man1/gpg-error-config.*

%changelog
* Mon Jun 11 2018 Tomáš Mráz <tmraz@redhat.com> 1.31-1
- new upstream release 1.31

编译 libICE ^libICE

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libICE.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libICE.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libICE
Summary: X.Org X11 ICE runtime library
Name:       local-%{base_name}
Version: 1.0.9
Release: 15%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

Source0: https://www.x.org/pub/individual/lib/%{base_name}-%{version}.tar.bz2

Patch0: 0001-Use-getentropy-if-arc4random_buf-is-not-available.patch
Patch1: 0002-Add-getentropy-emulation-through-syscall.patch
Patch2: 0001-IceListenForWellKnownConnections-Fix-memleak.patch
Patch3: 0002-_IceRead-Avoid-possible-use-after-free.patch
Patch4: 0003-cleanup-Separate-variable-assignment-and-test.patch

BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-pkgconf
BuildRequires: local-xorg-x11-proto-devel
BuildRequires: local-xorg-x11-xtrans-devel >= 1.0.3-5

%description
The X.Org X11 ICE (Inter-Client Exchange) runtime library.

%package devel
Summary: X.Org X11 ICE development package
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The X.Org X11 ICE (Inter-Client Exchange) development package.

%prep
%setup -q -n %{base_name}-%{version}

%patch0 -p1 -b .cve-2017-2626
%patch1 -p1 -b .cve-2017-2626
%patch2 -p1 -b .IceListenForWellKnownConnections-memleak
%patch3 -p1 -b .IceRead-use-after-free
%patch4 -p1 -b .var-assignment-and-test

%build
autoreconf -v --install --force
%configure --disable-static \
	   --without-fop --without-xmlto
V=1 make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

# We intentionally don't ship *.la files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

# adding to installed docs in order to avoid using %%doc magic
for f in AUTHORS ChangeLog COPYING ; do
    cp -p $f ${RPM_BUILD_ROOT}%{_docdir}/%{base_name}/${f}
done

%ldconfig_post
%ldconfig_postun

%files
%{_libdir}/libICE.so.6
%{_libdir}/libICE.so.6.3.0
# not using %%doc because of side-effect (#1001256)
%dir %{_docdir}/%{base_name}
%{_docdir}/%{base_name}/AUTHORS
%{_docdir}/%{base_name}/ChangeLog
%{_docdir}/%{base_name}/COPYING

%files devel
%{_docdir}/%{base_name}/*.xml
%{_includedir}/X11/ICE
%{_libdir}/libICE.so
%{_libdir}/pkgconfig/ice.pc

%changelog
* Tue Jun  4 2019 Olivier Fourdan <ofourdan@redhat.com> - 1.0.9-15
- Bump version for gating

编译 libiconv ^libiconv

https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
tar -zxvf /opt/libiconv-1.16.tar.gz -C /usr/local/src
cd /usr/local/src/libiconv-1.16/
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 install

编译 libidn2 ^libidn2

https://ftp.gnu.org/gnu/libidn/libidn2-2.2.0.tar.gz
tar -zxvf /opt/libidn2-2.2.0.tar.gz -C /usr/local/src
cd /usr/local/src/libidn2-2.2.0/
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 install

编译 libjpeg ^libjpeg

http://www.ijg.org/files/jpegsrc.v9f.tar.gz
tar -zxvf /opt/jpegsrc.v9f.tar.gz -C /usr/local/src
cd /usr/local/src/jpeg-9f
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 install

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libjpeg.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libjpeg.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global debug_package %{nil}
# 定义基础名称(不带 local- 前缀)
%global base_name libjpeg

# 统一设置编译器
%{!?use_clang:%global use_clang 1}
%if %{use_clang}
%define _cc /usr/local/bin/clang
%define _cxx /usr/local/bin/clang++
%else
%define _cc /usr/local/bin/gcc
%define _cxx /usr/local/bin/g++
%endif

Name:       local-%{base_name}
Version:    9f
Release:    1%{?dist}
Summary:    %{base_name}

License:    GPLv3+
Source0:    jpegsrc.v9f.tar.gz

%description
%{base_name}

%prep
# 这个宏会:rm -rf 旧目录 → 解压源码 → 打补丁
%setup -q -n jpeg-9f

%build
# 验证编译器
echo "Using CC: ${CC:-%{_cc}}"
${CC:-%{_cc}} --version
export CC=%{_cc}
export CXX=%{_cxx}
export CFLAGS="-Wno-incompatible-function-pointer-types"
export CXXFLAGS="-Wno-incompatible-function-pointer-types"
#export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64

mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
cd build
make install DESTDIR=%{buildroot}

# ==========================================
# 通用 Python 字节码生成
# 尝试 Python 2 和 Python 3,哪个能工作就用哪个
# ==========================================
# 定义函数:尝试用指定 Python 编译
try_compile() {
    local python=$1
    if [ -x "$python" ]; then
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        return 0
    fi
    return 1
}
# 优先尝试 Python 2(兼容旧语法)
try_compile /usr/bin/python3
try_compile /usr/bin/python2


# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
echo %{buildroot}
ls -la ./usr/local/lib/ || true
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%files -f %{_builddir}/files.list

%post
# 安装后注册 info 文档
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi
%postun
# 卸载后取消注册
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --delete --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi

%changelog
* %(LANG=en_US.UTF-8 date +"%%a %%b %%d %%Y") Your Name <1284524409@qq.com> - %{version}-%{release}
- Initial RPM release

编译 libmagic ^libmagic

https://codeload.github.com/file/file/tar.gz/refs/tags/FILE5_33
tar -zxvf /opt/file-FILE5_33.tar.gz -C /usr/local/src
cd /usr/local/src/file-FILE5_33
autoreconf -vifs
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 install

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libmagic.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libmagic.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global debug_package %{nil}
# 定义基础名称(不带 local- 前缀)
%global base_name libmagic

# 统一设置编译器
# 如果 use_clang 未定义,默认为 1
%{!?use_clang:%global use_clang 1}

%if %{use_clang}
%define _cc /usr/local/bin/clang
%define _cxx /usr/local/bin/clang++
%else
%define _cc /usr/local/bin/gcc
%define _cxx /usr/local/bin/g++
%endif

Name:       local-%{base_name}
Version:    5.33
Release:    1%{?dist}
Summary:    %{base_name}

License:    GPLv3+
Source0:    file-FILE5_33.tar.gz

%description
%{base_name}

%prep
%setup -q -n file-FILE5_33

%build
# 验证编译器
echo "Using CC: ${CC:-%{_cc}}"
${CC:-%{_cc}} --version
export CC=%{_cc}
export CXX=%{_cxx}
#export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64

autoreconf -vifs
mkdir -p build
cd build
../configure --prefix=/usr/local --with-gmp=/usr/local --with-mpfr=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
cd build
make install DESTDIR=%{buildroot}

# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%files -f %{_builddir}/files.list

%post
# 安装后注册 info 文档
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi
%postun
# 卸载后取消注册
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --delete --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi

%changelog
* %(LANG=en_US.UTF-8 date +"%%a %%b %%d %%Y") Your Name <1284524409@qq.com> - %{version}-%{release}
- Initial RPM release

编译 libmd ^libmd

https://archive.hadrons.org/software/libmd/libmd-1.1.0.tar.xz
tar -xvf /opt/libmd-1.1.0.tar.xz -C /usr/local/src
cd /usr/local/src/libmd-1.1.0/
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4
make -j4 install

编译 libpaper ^libpaper

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libpaper.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libpaper.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global nmu +nmu4
%global base_name libpaper
Name:       local-%{base_name}
Version:	1.1.24
Release:	22%{?dist}
Summary:	Library and tools for handling papersize
License:	GPLv2
URL:		http://packages.qa.debian.org/libp/libpaper.html
Source0:	http://ftp.debian.org/debian/pool/main/libp/libpaper/%{base_name}_%{version}%{nmu}.tar.gz
# Filed upstream as:
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213
Patch2:		libpaper-useglibcfallback.patch
# Memory leak
Patch3:   libpaper-file-leak.patch
# 1606989 - Please review important issues found by covscan in "libpaper-1.1.24-21.el8+7" package
Patch4: libpaper-covscan.patch

# gcc is no longer in buildroot by default
BuildRequires:  local-gcc
BuildRequires:	local-libtool, local-gettext, gawk

%description
The paper library and accompanying files are intended to provide a 
simple way for applications to take actions based on a system- or 
user-specified paper size. This release is quite minimal, its purpose 
being to provide really basic functions (obtaining the system paper name 
and getting the height and width of a given kind of paper) that 
applications can immediately integrate.

%package devel
Summary:	Headers/Libraries for developing programs that use libpaper
Requires:	%{name} = %{version}-%{release}

%description devel
This package contains headers and libraries that programmers will need 
to develop applications which use libpaper.

%prep
%setup -q -n %{base_name}-%{version}%{nmu}
%patch2 -p1 -b .useglibcfallback
%patch3 -p1 -b .file-leak
%patch4 -p1 -b .covscan
libtoolize

%build
touch AUTHORS NEWS
aclocal
autoconf
automake -a
%configure --disable-static
# Disable rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags}

%install
make DESTDIR=$RPM_BUILD_ROOT install
rm $RPM_BUILD_ROOT%{_libdir}/*.la
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
echo '# Simply write the paper name. See papersize(5) for possible values' > $RPM_BUILD_ROOT%{_sysconfdir}/papersize
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/libpaper.d
for i in cs da de es fr gl hu it ja nl pt_BR sv tr uk vi; do
	mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/$i/LC_MESSAGES/;
	msgfmt debian/po/$i.po -o $RPM_BUILD_ROOT%{_datadir}/locale/$i/LC_MESSAGES/%{base_name}.mo;
done
%find_lang %{base_name}

%ldconfig_scriptlets

%files -f %{base_name}.lang
%doc ChangeLog README
%license COPYING
%config(noreplace) %{_sysconfdir}/papersize
%dir %{_sysconfdir}/libpaper.d
%{_bindir}/paperconf
%{_libdir}/libpaper.so.1.1.2
%{_libdir}/libpaper.so.1
%{_sbindir}/paperconfig
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*

%files devel
%{_includedir}/paper.h
%{_libdir}/libpaper.so
%{_mandir}/man3/*

%changelog
* Mon Dec 03 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.1.24-22
- 1606989 - Please review important issues found by covscan in "libpaper-1.1.24-21.el8+7" package

编译 libpng ^libpng


https://jaist.dl.sourceforge.net/project/libpng/libpng16/1.6.44/libpng-1.6.44.tar.gz?viasf=1
tar -zxvf /opt/libpng-1.6.44.tar.gz -C /usr/local/src
cd /usr/local/src/libpng-1.6.44
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 install

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libpng.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libpng.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global debug_package %{nil}
# 定义基础名称(不带 local- 前缀)
%global base_name libpng

# 统一设置编译器
%{!?use_clang:%global use_clang 1}
%if %{use_clang}
%define _cc /usr/local/bin/clang
%define _cxx /usr/local/bin/clang++
%else
%define _cc /usr/local/bin/gcc
%define _cxx /usr/local/bin/g++
%endif

Name:       local-%{base_name}
Version:    1.6.44
Release:    1%{?dist}
Summary:    %{base_name}

License:    GPLv3+
Source0:    %{base_name}-%{version}.tar.gz

%description
%{base_name}

%prep
# 这个宏会:rm -rf 旧目录 → 解压源码 → 打补丁
%setup -q -n %{base_name}-%{version}

%build
# 验证编译器
echo "Using CC: ${CC:-%{_cc}}"
${CC:-%{_cc}} --version
export CC=%{_cc}
export CXX=%{_cxx}
export CFLAGS="-Wno-incompatible-function-pointer-types"
export CXXFLAGS="-Wno-incompatible-function-pointer-types"
#export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64

mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
cd build
make install DESTDIR=%{buildroot}

# ==========================================
# 通用 Python 字节码生成
# 尝试 Python 2 和 Python 3,哪个能工作就用哪个
# ==========================================
# 定义函数:尝试用指定 Python 编译
try_compile() {
    local python=$1
    if [ -x "$python" ]; then
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        return 0
    fi
    return 1
}
# 优先尝试 Python 2(兼容旧语法)
try_compile /usr/bin/python3
try_compile /usr/bin/python2


# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
echo %{buildroot}
ls -la ./usr/local/lib/ || true
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%files -f %{_builddir}/files.list

%post
# 安装后注册 info 文档
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi
%postun
# 卸载后取消注册
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --delete --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi

%changelog
* %(LANG=en_US.UTF-8 date +"%%a %%b %%d %%Y") Your Name <1284524409@qq.com> - %{version}-%{release}
- Initial RPM release

编译 libselinux ^libselinux

[[[#^selinux|依赖 selinux]]]

RPM 制作命令
dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libselinux.spec

rpmbuild -ba \
	--define "_prefix /usr/local" \
	--define "__python3 /usr/local/bin/python3" \
	--without ruby \
	--without python2 \
	--without hardening_test \
	--without bundler_tests \
  ~/rpmbuild/SPECS/libselinux.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup

SPEC 文件

# 使用后删除,容易和系统自带的冲突
# **系统工具(`sed`、`ls`、`mkdir`、`install` 等)在运行时被强制加载了不兼容的 [libselinux.so](https://libselinux.so/).1 库**。
%global base_name libselinux

%if 0%{?with_ruby}
%global ruby_inc %(pkg-config --cflags ruby)
%endif

%define libsepolver 2.9-1
%define libselinuxrelease 11

Summary: SELinux library and simple utilities
Name:       local-%{base_name}
Version: 2.9
Release: %{libselinuxrelease}%{?dist}
License: Public Domain
# https://github.com/SELinuxProject/selinux/wiki/Releases
Source0: https://github.com/SELinuxProject/selinux/releases/download/20190315/libselinux-2.9.tar.gz
Source1: selinuxconlist.8
Source2: selinuxdefcon.8
Url: https://github.com/SELinuxProject/selinux/wiki
# i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done
Patch0001: 0001-Fix-selinux-man-page-to-refer-seinfo-and-sesearch-to.patch
Patch0002: 0002-Verify-context-input-to-funtions-to-make-sure-the-co.patch
Patch0003: 0003-libselinux-Allow-to-override-OVERRIDE_GETTID-from-co.patch
Patch0004: 0004-Bring-some-old-permission-and-flask-constants-back-t.patch
Patch0005: 0005-libselinux-add-missing-av_permission-values.patch
Patch0006: 0006-libselinux-Use-Python-distutils-to-install-SELinux-p.patch
Patch0007: 0007-libselinux-Do-not-use-SWIG_CFLAGS-when-Python-bindin.patch
Patch0008: 0008-Fix-mcstrans-secolor-examples.patch
Patch0009: 0009-libselinux-Eliminate-use-of-security_compute_user.patch
Patch0010: 0010-libselinux-deprecate-security_compute_user-update-ma.patch
Patch0011: 0011-selinux-8-5-Describe-fcontext-regular-expressions.patch
Patch0012: 0012-libselinux-Strip-spaces-before-values-in-config.patch
Patch0013: 0013-libselinux-Ignore-missing-directories-when-i-is-used.patch
Patch0014: 0014-libselinux-restorecon-Fix-memory-leak-xattr_value.patch
Patch0015: 0015-libselinux-restorecon-Include-selinux-label.h.patch
Patch0016: 0016-libselinux-Fix-NULL-pointer-use-in-selinux_restoreco.patch
Patch0017: 0017-libselinux-Close-old-selabel-handle-when-setting-a-n.patch
Patch0018: 0018-libselinux-Ignore-files-removed-during-relabeling.patch

BuildRequires: local-gcc
%if 0%{?with_ruby}
BuildRequires: ruby-devel ruby local-libsepol >= %{libsepolver} local-swig local-pcre2 local-xz
%else
BuildRequires: local-libsepol >= %{libsepolver} local-swig local-pcre2 local-xz
%endif
BuildRequires: local-python3
%if 0%{?with_python2}
BuildRequires: python2 python2-devel
%endif
BuildRequires: systemd
Requires: libsepol%{?_isa} >= %{libsepolver} pcre2
Conflicts: filesystem < 3, selinux-policy-base < 3.13.1-138

%description
Security-enhanced Linux is a feature of the Linux® kernel and a number
of utilities with enhanced security functionality designed to add
mandatory access controls to Linux.  The Security-enhanced Linux
kernel contains new architectural components originally developed to
improve the security of the Flask operating system. These
architectural components provide general support for the enforcement
of many kinds of mandatory access control policies, including those
based on the concepts of Type Enforcement®, Role-based Access
Control, and Multi-level Security.

libselinux provides an API for SELinux applications to get and set
process and file security contexts and to obtain security policy
decisions.  Required for any applications that use the SELinux API.

%package utils
Summary: SELinux libselinux utilities
Requires: %{name}%{?_isa} = %{version}-%{release}

%description utils
The libselinux-utils package contains the utilities

%if 0%{?with_python2}
%package -n libselinux-python
%{?python_provide:%python_provide python2-libselinux}
Provides: python2-%{name} = %{version}-%{release}
Provides: python2-%{name}%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python < %{version}-%{release}
Summary: SELinux python bindings for libselinux
Requires: %{name}%{?_isa} >= %{version}-%{libselinuxrelease}

%description -n libselinux-python
The libselinux-python package contains the python bindings for developing
SELinux applications.
%endif

%package -n python3-libselinux
Summary: SELinux python 3 bindings for libselinux
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-libselinux}
# Remove before F30
Provides: %{name}-python3 = %{version}-%{release}
Provides: %{name}-python3%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python3 < %{version}-%{release}

%description -n python3-libselinux
The libselinux-python3 package contains python 3 bindings for developing
SELinux applications. 

%if 0%{?with_ruby}
%package ruby
Summary: SELinux ruby bindings for libselinux
Requires: %{name}%{?_isa} = %{version}-%{release}
Provides: ruby(selinux)

%description ruby
The libselinux-ruby package contains the ruby bindings for developing 
SELinux applications. 
%endif # with_ruby

%package devel
Summary: Header files and libraries used to build SELinux
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: libsepol-devel%{?_isa} >= %{libsepolver}

%description devel
The libselinux-devel package contains the libraries and header files
needed for developing SELinux applications. 

%package static
Summary: Static libraries used to build SELinux
Requires: %{name}-devel%{?_isa} = %{version}-%{release}

%description static
The libselinux-static package contains the static libraries
needed for developing SELinux applications. 

%prep
%autosetup -p 2 -n libselinux-%{version}

%build
export DISABLE_RPM="n"
export USE_PCRE2="y"

%set_build_flags

# To support building the Python wrapper against multiple Python runtimes
# Define a function, for how to perform a "build" of the python wrapper against
# a specific runtime:
BuildPythonWrapper() {
  BinaryName=$1

  # Perform the build from the upstream Makefile:
  make \
    PYTHON=$BinaryName \
    LIBDIR="%{_libdir}" %{?_smp_mflags} \
    pywrap
}

make clean
make LIBDIR="%{_libdir}" %{?_smp_mflags} swigify
make \
    PREFIX="%{_prefix}" \
    LIBDIR="%{_libdir}" \
    SHLIBDIR="%{_libdir}" \
    BINDIR="%{_bindir}" \
    SBINDIR="%{_sbindir}" \
    INCLUDEDIR="%{_includedir}" \
    MANDIR="%{_mandir}" \
    %{?_smp_mflags} all

%if 0%{?with_python2}
export RHEL_ALLOW_PYTHON2_FOR_BUILD=1
BuildPythonWrapper %{__python2}
%endif
BuildPythonWrapper %{__python3}

%if 0%{?with_ruby}
make RUBYINC="%{ruby_inc}" SHLIBDIR="%{_libdir}" LIBDIR="%{_libdir}" LIBSEPOLA="%{_libdir}/libsepol.a" %{?_smp_mflags} rubywrap
%endif

%install
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
InstallPythonWrapper() {
  BinaryName=$1

  make \
    PYTHON=$BinaryName \
    PREFIX="%{_prefix}" \
    LIBDIR="%{_libdir}" %{?_smp_mflags} \
    LIBSEPOLA="%{_libdir}/libsepol.a" \
    INCLUDEDIR="%{_includedir}" \
    MANDIR="%{_mandir}" \
    pywrap

  make \
    PYTHON=$BinaryName \
    PREFIX="%{_prefix}" \
    DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" \
    SHLIBDIR="%{_lib}" BINDIR="%{_bindir}" \
    SBINDIR="%{_sbindir}" \
    LIBSEPOLA="%{_libdir}/libsepol.a" \
    INCLUDEDIR="%{_includedir}" \
    MANDIR="%{_mandir}" \
    install-pywrap
}

rm -rf %{buildroot}
mkdir -p %{buildroot}%{_tmpfilesdir}
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}
mkdir -p %{buildroot}%{_sbindir}
install -d -m 0755 %{buildroot}%{_rundir}/setrans
echo "d %{_rundir}/setrans 0755 root root" > %{buildroot}%{_tmpfilesdir}/libselinux.conf

%if 0%{?with_python2}
export RHEL_ALLOW_PYTHON2_FOR_BUILD=1
InstallPythonWrapper %{__python2}
mv %{buildroot}%{python2_sitearch}/selinux/_selinux.so %{buildroot}%{python2_sitearch}/
%endif
InstallPythonWrapper %{__python3}
mv %{buildroot}%{python3_sitearch}/selinux/_selinux.*.so %{buildroot}%{python3_sitearch}/

%if 0%{?with_ruby}
make DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" BINDIR="%{_bindir}" SBINDIR="%{_sbindir}" RUBYINSTALL=%{ruby_vendorarchdir} install install-rubywrap
%else
make DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" BINDIR="%{_bindir}" SBINDIR="%{_sbindir}" install
%endif

# Nuke the files we don't want to distribute
rm -f %{buildroot}%{_sbindir}/compute_*
rm -f %{buildroot}%{_sbindir}/deftype
rm -f %{buildroot}%{_sbindir}/execcon
rm -f %{buildroot}%{_sbindir}/getenforcemode
rm -f %{buildroot}%{_sbindir}/getfilecon
rm -f %{buildroot}%{_sbindir}/getpidcon
rm -f %{buildroot}%{_sbindir}/mkdircon
rm -f %{buildroot}%{_sbindir}/policyvers
rm -f %{buildroot}%{_sbindir}/setfilecon
rm -f %{buildroot}%{_sbindir}/selinuxconfig
rm -f %{buildroot}%{_sbindir}/selinuxdisable
rm -f %{buildroot}%{_sbindir}/getseuser
rm -f %{buildroot}%{_sbindir}/togglesebool
rm -f %{buildroot}%{_sbindir}/selinux_check_securetty_context
mv %{buildroot}%{_sbindir}/getdefaultcon %{buildroot}%{_sbindir}/selinuxdefcon
mv %{buildroot}%{_sbindir}/getconlist %{buildroot}%{_sbindir}/selinuxconlist
install -d %{buildroot}%{_mandir}/man8/
install -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man8/
install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man8/
rm -f %{buildroot}%{_mandir}/man8/togglesebool*

# 将头文件从 /usr/include 移到 /usr/local/include
if [ -d "${RPM_BUILD_ROOT}/usr/include" ]; then
    mkdir -p ${RPM_BUILD_ROOT}%{_includedir}
    cp -a ${RPM_BUILD_ROOT}/usr/include/* ${RPM_BUILD_ROOT}%{_includedir}/
    rm -rf ${RPM_BUILD_ROOT}/usr/include
fi

# 将 man 文件从 /usr/share/man 移到 /usr/local/share/man
if [ -d "${RPM_BUILD_ROOT}/usr/lib" ]; then
    mkdir -p ${RPM_BUILD_ROOT}%{_libdir}
    cp -a ${RPM_BUILD_ROOT}/usr/lib/* ${RPM_BUILD_ROOT}%{_libdir}/
    rm -rf ${RPM_BUILD_ROOT}/usr/lib
fi

# 将 man 文件从 /usr/share/man 移到 /usr/local/share/man
if [ -d "${RPM_BUILD_ROOT}/usr/share/man" ]; then
    mkdir -p ${RPM_BUILD_ROOT}%{_mandir}
    cp -a ${RPM_BUILD_ROOT}/usr/share/man/* ${RPM_BUILD_ROOT}%{_mandir}/
    rm -rf ${RPM_BUILD_ROOT}/usr/share/man
fi

# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
echo %{buildroot}
ls -la ./usr/local/lib/ || true
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%ldconfig_scriptlets

%files -f %{_builddir}/files.list

%changelog
* Tue Jan 20 2026 Vit Mojzis <vmojzis@redhat.com> - 2.9-11
- Ignore files removed during relabeling (RHEL-123885)

编译 libsepol ^libsepol

RPM 制作命令
dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libsepol.spec

rpmbuild -ba \
  --define "_prefix /usr/local" \
  --define "_libdir /usr/local/lib64" \
  --define "_includedir /usr/local/include" \
  --define "_bindir /usr/local/bin" \
  --define "_mandir /usr/local/share/man" \
  ~/rpmbuild/SPECS/libsepol.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup

SPEC 文件

%global base_name libsepol

Summary: SELinux binary policy manipulation library
Name:       local-%{base_name}
Version: 2.9
Release: 3%{?dist}
License: LGPLv2+
Source0: https://github.com/SELinuxProject/selinux/releases/download/20190315/libsepol-2.9.tar.gz
Patch0001: 0001-libsepol-cil-Fix-out-of-bound-read-of-file-context-p.patch
Patch0002: 0002-libsepol-cil-Destroy-classperms-list-when-resetting-.patch
Patch0003: 0003-libsepol-cil-Destroy-classperm-list-when-resetting-m.patch
Patch0004: 0004-libsepol-cil-cil_reset_classperms_set-should-not-res.patch
Patch0005: 0005-libsepol-cil-Set-class-field-to-NULL-when-resetting-.patch
Patch0006: 0006-libsepol-cil-More-strict-verification-of-constraint-.patch
Patch0007: 0007-libsepol-cil-Exit-with-an-error-if-declaration-name-.patch
Patch0008: 0008-libsepol-cil-Allow-permission-expressions-when-using.patch
Patch0009: 0009-libsepol-cil-Reorder-checks-for-invalid-rules-when-b.patch
Patch0010: 0010-libsepol-cil-Cleanup-build-AST-helper-functions.patch
Patch0011: 0011-libsepol-cil-Create-new-first-child-helper-function-.patch
Patch0012: 0012-libsepol-cil-Remove-unused-field-from-struct-cil_arg.patch
Patch0013: 0013-libsepol-cil-Destroy-disabled-optional-blocks-after-.patch
Patch0014: 0014-libsepol-cil-Check-if-name-is-a-macro-parameter-firs.patch
Patch0015: 0015-libsepol-cil-fix-NULL-pointer-dereference-in-__cil_i.patch
Patch0016: 0016-libsepol-cil-Report-disabling-an-optional-block-only.patch
Patch0017: 0017-libsepol-cil-Use-AST-to-track-blocks-and-optionals-w.patch
Patch0018: 0018-libsepol-cil-Reorder-checks-for-invalid-rules-when-r.patch
Patch0019: 0019-libsepol-cil-Sync-checks-for-invalid-rules-in-boolea.patch
Patch0020: 0020-libsepol-cil-Check-for-statements-not-allowed-in-opt.patch
URL: https://github.com/SELinuxProject/selinux/wiki
BuildRequires: local-gcc
BuildRequires: local-flex

%description
Security-enhanced Linux is a feature of the Linux® kernel and a number
of utilities with enhanced security functionality designed to add
mandatory access controls to Linux.  The Security-enhanced Linux
kernel contains new architectural components originally developed to
improve the security of the Flask operating system. These
architectural components provide general support for the enforcement
of many kinds of mandatory access control policies, including those
based on the concepts of Type Enforcement®, Role-based Access
Control, and Multi-level Security.

libsepol provides an API for the manipulation of SELinux binary policies.
It is used by checkpolicy (the policy compiler) and similar tools, as well
as by programs like load_policy that need to perform specific transformations
on binary policies such as customizing policy boolean settings.

%package devel
Summary: Header files and libraries used to build policy manipulation tools
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The libsepol-devel package contains the libraries and header files
needed for developing applications that manipulate binary policies. 

%package static
Summary: static libraries used to build policy manipulation tools
Requires: %{name}-devel%{?_isa} = %{version}-%{release}

%description static
The libsepol-static package contains the static libraries and header files
needed for developing applications that manipulate binary policies. 

%prep
%autosetup -p 2 -n libsepol-%{version}

# sparc64 is an -fPIC arch, so we need to fix it here
%ifarch sparc64
sed -i 's/fpic/fPIC/g' src/Makefile
%endif

%build
make clean
make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}"

%install
mkdir -p ${RPM_BUILD_ROOT}/%{_lib} 
mkdir -p ${RPM_BUILD_ROOT}/%{_libdir} 
mkdir -p ${RPM_BUILD_ROOT}%{_includedir} 
mkdir -p ${RPM_BUILD_ROOT}%{_bindir} 
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man3
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8

make DESTDIR="${RPM_BUILD_ROOT}" LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" install

# 将头文件从 /usr/include 移到 /usr/local/include
if [ -d "${RPM_BUILD_ROOT}/usr/include/sepol" ]; then
    mkdir -p ${RPM_BUILD_ROOT}%{_includedir}
    cp -a ${RPM_BUILD_ROOT}/usr/include/sepol ${RPM_BUILD_ROOT}%{_includedir}/
    rm -rf ${RPM_BUILD_ROOT}/usr/include
fi

# 将 man 文件从 /usr/share/man 移到 /usr/local/share/man
if [ -d "${RPM_BUILD_ROOT}/usr/share/man" ]; then
    mkdir -p ${RPM_BUILD_ROOT}%{_mandir}
    cp -a ${RPM_BUILD_ROOT}/usr/share/man/* ${RPM_BUILD_ROOT}%{_mandir}/
    rm -rf ${RPM_BUILD_ROOT}/usr/share/man
fi

# 将 bin 文件从 /usr/bin 移到 /usr/local/bin
if [ -d "${RPM_BUILD_ROOT}/usr/bin" ]; then
    mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
    cp -a ${RPM_BUILD_ROOT}/usr/bin/* ${RPM_BUILD_ROOT}%{_bindir}/
    rm -rf ${RPM_BUILD_ROOT}/usr/bin
fi

rm -f ${RPM_BUILD_ROOT}%{_bindir}/genpolbools
rm -f ${RPM_BUILD_ROOT}%{_bindir}/genpolusers
rm -f ${RPM_BUILD_ROOT}%{_bindir}/chkcon
rm -rf ${RPM_BUILD_ROOT}%{_mandir}/man8
rm -rf ${RPM_BUILD_ROOT}%{_mandir}/ru/man8

# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
echo %{buildroot}
ls -la ./usr/local/lib/ || true
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%post
/sbin/ldconfig
exit 0

%postun -p /sbin/ldconfig

%files -f %{_builddir}/files.list

%changelog
* Wed Aug 18 2021 Vit Mojzis <vmojzis@redhat.com> - 2.9-3

编译 libSM ^libSM

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libSM.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libSM.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libSM
Summary: X.Org X11 SM runtime library
Name:       local-%{base_name}
Version: 1.2.3
Release: 1%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

Source0: https://www.x.org/pub/individual/lib/%{base_name}-%{version}.tar.bz2

BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-pkgconf
BuildRequires: local-xorg-x11-proto-devel
BuildRequires: local-xorg-x11-xtrans-devel >= 1.0.3-4
BuildRequires: local-libICE-devel
BuildRequires: local-uuid-devel
BuildRequires: local-xmlto

%description
The X.Org X11 SM (Session Management) runtime library.

%package devel
Summary: X.Org X11 SM development package
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The X.Org X11 SM (Session Management) development package.

%prep
%setup -q -n %{base_name}-%{version}

%build
autoreconf -v --install --force

%configure --with-libuuid --disable-static
make %{_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

# We intentionally don't ship *.la files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

# we %%doc these ourselves, later, and only the text versions
rm -rf $RPM_BUILD_ROOT%{_docdir}

%ldconfig_post
%ldconfig_postun

%files
%doc AUTHORS COPYING ChangeLog
%{_libdir}/libSM.so.6
%{_libdir}/libSM.so.6.*

%files devel
%dir %{_includedir}/X11/SM
%{_includedir}/X11/SM/SM.h
%{_includedir}/X11/SM/SMlib.h
%{_includedir}/X11/SM/SMproto.h
%{_libdir}/libSM.so
%{_libdir}/pkgconfig/sm.pc

%changelog
* Wed Oct 10 2018 Adam Jackson <ajax@redhat.com> - 1.2.3-1
- libSM 1.2.3

编译 libssh2 ^libssh2

[[[#^openssl|依赖 openssl]]] | [[[#^zlib|依赖 zlib]]]
依赖 zlib | 依赖 openssl

  1. 下载安装包
https://libssh2.org/download/libssh2-1.11.1.tar.xz
tar -xvf /opt/libssh2-1.11.1.tar.xz -C /usr/local/src
cd /usr/local/src/libssh2-1.11.1
mkdir cmake-build
cd cmake-build/
cmake -D OPENSSL_ROOT_DIR="/usr/local" -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENSSL_CRYPTO_LIBRARY="/usr/local/lib64/libcrypto.so" -D OPENSSL_SSL_LIBRARY="/usr/local/lib64/libssl.so" -D ZLIB_INCLUDE_DIR="/usr/local/include" -D ZLIB_LIBRARY="/usr/local/lib/libz.so" -D CMAKE_INSTALL_PREFIX=/usr/local/ ..

gmake -j4 && gmake install

编译 libtasn1 ^libtasn1

https://ftp.gnu.org/gnu/libtasn1/libtasn1-4.13.tar.gz
tar -zxvf /opt/libtasn1-4.13.tar.gz -C /usr/local/src
cd /usr/local/src/libtasn1-4.13/
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 install

编译 libtool ^libtool


https://mirrors.sjtug.sjtu.edu.cn/gnu/libtool/libtool-2.4.6.tar.gz
tar -zxvf /opt/libtool-2.4.6.tar.gz -C /usr/local/src
cd /usr/local/src/libtool-2.4.6
mkdir -p build
cd build/
# ../configure --prefix=/usr/local/libtool-2.4.6/libtool --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 && make install

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libtool.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libtool.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global debug_package %{nil}
# 定义基础名称(不带 local- 前缀)
%global base_name libtool

# 统一设置编译器
%{!?use_clang:%global use_clang 1}
%if %{use_clang}
%define _cc /usr/local/bin/clang
%define _cxx /usr/local/bin/clang++
%else
%define _cc /usr/local/bin/gcc
%define _cxx /usr/local/bin/g++
%endif

Name:       local-%{base_name}
Version:    2.4.6
Release:    1%{?dist}
Summary:    %{base_name}

License:    GPLv3+
Source0:    %{base_name}-%{version}.tar.gz

%description
%{base_name}

%prep
# 这个宏会:rm -rf 旧目录 → 解压源码 → 打补丁
%setup -q -n %{base_name}-%{version}

%build
# 验证编译器
echo "Using CC: ${CC:-%{_cc}}"
${CC:-%{_cc}} --version
export CC=%{_cc}
export CXX=%{_cxx}
export CFLAGS="-Wno-incompatible-function-pointer-types"
export CXXFLAGS="-Wno-incompatible-function-pointer-types"
#export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib:/usr/lib64

mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
cd build
make install DESTDIR=%{buildroot}

# ==========================================
# 通用 Python 字节码生成
# 尝试 Python 2 和 Python 3,哪个能工作就用哪个
# ==========================================
# 定义函数:尝试用指定 Python 编译
try_compile() {
    local python=$1
    if [ -x "$python" ]; then
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        return 0
    fi
    return 1
}
# 优先尝试 Python 2(兼容旧语法)
try_compile /usr/bin/python3
try_compile /usr/bin/python2


# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
echo %{buildroot}
ls -la ./usr/local/lib/ || true
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%files -f %{_builddir}/files.list

%post
# 安装后注册 info 文档
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi
%postun
# 卸载后取消注册
if [ -f %{_prefix}/share/info/%{base_name}.info ]; then
    install-info --delete --info-dir=%{_prefix}/share/info %{_prefix}/share/info/%{base_name}.info 2>/dev/null || true
fi

%changelog
* %(LANG=en_US.UTF-8 date +"%%a %%b %%d %%Y") Your Name <1284524409@qq.com> - %{version}-%{release}
- Initial RPM release

编译 libunistring ^libunistring

https://ftp.gnu.org/gnu/libunistring/libunistring-0.9.9.tar.gz
tar -zxvf /opt/libunistring-0.9.9.tar.gz -C /usr/local/src
cd /usr/local/src/libunistring-0.9.9/
# sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
# echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 
make -j4 install

编译 libtiff ^libtiff


RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libtiff.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libtiff.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libtiff
Summary:       Library of functions for manipulating TIFF format image files
Name:       local-%{base_name}
Version:       4.0.9
Release:       38%{?dist}
License:       libtiff
Group:         System Environment/Libraries
URL:           http://www.simplesystems.org/libtiff/

Source:        ftp://ftp.simplesystems.org/pub/libtiff/tiff-%{version}.tar.gz


# Patches generated from https://gitlab.cee.redhat.com/mmuzila/libtiff/-/tree/rhel-8.7.0
# Patches were generated by: git format-patch -N --no-signature ...
Patch0001: 0001-Back-off-the-minimum-required-automake-version-to-1..patch
Patch0002: 0002-Fix-Makefile.patch
Patch0003: 0003-CVE-2018-5784-Fix-for-bug-2772.patch
Patch0004: 0004-CVE-2018-7456-Fix-NULL-pointer-dereference-in-TIFFPr.patch
Patch0005: 0005-CVE-2017-9935-tiff2pdf-Fix-CVE-2017-9935.patch
Patch0006: 0006-CVE-2017-9935-tiff2pdf-Fix-apparent-incorrect-type-f.patch
Patch0007: 0007-CVE-2017-18013-libtiff-tif_print.c-TIFFPrintDirector.patch
Patch0008: 0008-CVE-2018-8905-LZWDecodeCompat-fix-potential-index-ou.patch
Patch0009: 0009-CVE-2018-10963-TIFFWriteDirectorySec-avoid-assertion.patch
Patch0010: 0010-CVE-2018-17100-avoid-potential-int32-overflows-in-mu.patch
Patch0011: 0011-CVE-2018-18557-JBIG-fix-potential-out-of-bounds-writ.patch
Patch0012: 0012-CVE-2018-18661-tiff2bw-avoid-null-pointer-dereferenc.patch
Patch0013: 0013-bz1602597-Fix-two-resource-leaks.patch
Patch0014: 0014-CVE-2018-12900-check-that-Tile-Width-Samples-Pixel-d.patch
Patch0015: 0015-CVE-2019-14973-Fix-integer-overflow-in-_TIFFCheckMal.patch
Patch0016: 0016-CVE-2019-17546-RGBA-interface-fix-integer-overflow-p.patch
Patch0017: 0017-CVE-2020-35521-CVE-2020-35522-enforce-configurable-m.patch
Patch0018: 0018-CVE-2020-35523-gtTileContig-check-Tile-width-for-ove.patch
Patch0019: 0019-CVE-2020-35524-tiff2pdf.c-properly-calculate-datasiz.patch
Patch0020: 0020-CVE-2020-19131-tiffcrop.c-fix-invertImage-for-bps-2-.patch
Patch0021: 0021-CVE-2022-0561-TIFFFetchStripThing-avoid-calling-memc.patch
Patch0022: 0022-CVE-2022-0562-TIFFReadDirectory-avoid-calling-memcpy.patch
Patch0023: 0023-CVE-2022-22844-tiffset-fix-global-buffer-overflow-fo.patch
Patch0024: 0024-CVE-2022-0865-tif_jbig.c-fix-crash-when-reading-a-fi.patch
Patch0025: 0025-CVE-2022-0891-tiffcrop-fix-issue-380-and-382-heap-bu.patch
Patch0026: 0026-CVE-2022-0924-fix-heap-buffer-overflow-in-tiffcp-278.patch
Patch0027: 0027-CVE-2022-0909-fix-the-FPE-in-tiffcrop-393.patch
Patch0028: 0028-CVE-2022-0908-TIFFFetchNormalTag-avoid-calling-memcp.patch
Patch0029: 0029-CVE-2022-1355-tiffcp-avoid-buffer-overflow-in-mode-s.patch
Patch0030: 0030-move-_TIFFClampDoubleToFloat-to-tif_aux.c.patch
Patch0031: 0031-CVE-2022-2056-CVE-2022-2057-CVE-2022-2058-fix-the-FP.patch
Patch0032: 0032-CVE-2022-2867-CVE-2022-2868-tiffcrop.c-Fix-issue-352.patch
Patch0033: 0033-CVE-2022-2519-CVE-2022-2520-CVE-2022-2521-CVE-2022-2.patch
Patch0034: 0034-CVE-2022-2519-CVE-2022-2520-CVE-2022-2521-CVE-2022-2.patch
Patch0035: 0035-CVE-2022-3597-CVE-2022-3626-CVE-2022-3627-tiffcrop-d.patch
Patch0036: 0036-CVE-2022-3970-TIFFReadRGBATileExt-fix-unsigned-integ.patch
Patch0037: 0037-CVE-2022-48281-tiffcrop-Correct-simple-copy-paste-er.patch
Patch0038: 0038-CVE-2023-0800-CVE-2023-0801-CVE-2023-0802-CVE-2023-0.patch
Patch0039: 0039-CVE-2022-3599-Revised-handling-of-TIFFTAG_INKNAMES-a.patch
Patch0040: 0040-CVE-2018-15209-Merge-branch-avoid_memory_exhaustion_.patch
Patch0041: 0041-CVE-2023-25433-Merge-branch-tiffcrop_correctly_updat.patch
Patch0042: 0042-CVE-2023-52356-Merge-branch-fix_622-into-master.patch
Patch0043: 0043-CVE-2023-6228-Merge-branch-fix_606_tiffcp_check_also.patch

# from upstream, for <=4.6.0, RHEL-52927
# https://gitlab.com/libtiff/libtiff/-/commit/3705f82b6483c7906cf08cd6b9dcdcd59c61d779
Patch44:       libtiff-4.6.0-CVE-2024-7006.patch

# from upstream, for < 4.0.10, RHEL-87363
# https://gitlab.com/libtiff/libtiff/-/commit/9171da596c88e6a2dadcab4a3a89dddd6e1b4655
Patch45:       libtiff-4.0.9-CVE-2017-17095.patch

# Fix buffer underflow crash for less raster rows at TIFFReadRGBAImageOriented(), RHEL-112533
# CVE-2025-9900
Patch46:       RHEL-112533.patch

# Fix skipping first line of input image in tiffdither and tiffmedian, RHEL-120230
# CVE-2025-8176
Patch47:       RHEL-120230.patch

# from upstream, for <= 4.7.1, RHEL-159316
# https://gitlab.com/libtiff/libtiff/-/commit/782a11d6b5b61c6dc21e714950a4af5bf89f023c
Patch48:       libtiff-4.4.0-CVE-2026-4775.patch

# from upstream, for < 4.7.2, RHEL-189387
# https://gitlab.com/libtiff/libtiff/-/merge_requests/873
Patch49:       libtiff-4.4.0-cve-2026-12912p1of2.patch
# https://gitlab.com/libtiff/libtiff/-/commit/f9bda11bf2fc819b971517582666d56f18b1bc3f
Patch50:       libtiff-4.4.0-cve-2026-12912p2of2.patch

BuildRequires: local-gcc
BuildRequires: local-zlib local-libjpeg local-jbigkit
BuildRequires: local-libtool local-automake local-autoconf local-pkgconf

%description
The libtiff package contains a library of functions for manipulating
TIFF (Tagged Image File Format) image format files.  TIFF is a widely
used file format for bitmapped images.  TIFF files usually end in the
.tif extension and they are often quite large.

The libtiff package should be installed if you need to manipulate TIFF
format image files.

%package devel
Summary:       Development tools for programs which will use the libtiff library
Group:         Development/Libraries
Requires:      %{name}%{?_isa} = %{version}-%{release}
Requires:      local-pkgconf%{?_isa}

%description devel
This package contains the header files and documentation necessary for
developing programs which will manipulate TIFF format image files
using the libtiff library.

If you need to develop programs which will manipulate TIFF format
image files, you should install this package.  You'll also need to
install the libtiff package.

%package static
Summary:     Static TIFF image format file library
Group:       Development/Libraries
Requires:    %{name}-devel%{?_isa} = %{version}-%{release}

%description static
The libtiff-static package contains the statically linkable version of libtiff.
Linking to static libraries is discouraged for most applications, but it is
necessary for some boot packages.

%package tools
Summary:    Command-line utility programs for manipulating TIFF files
Group:      Development/Libraries
Requires:   %{name}%{?_isa} = %{version}-%{release}

%description tools
This package contains command-line programs for manipulating TIFF format
image files using the libtiff library.

%prep
%autosetup -p1 -n tiff-%{version}

# Use build system's libtool.m4, not the one in the package.
rm -f libtool.m4

libtoolize --force  --copy
aclocal -I . -I m4
automake --add-missing --copy
autoconf
autoheader

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure --enable-ld-version-script
make %{?_smp_mflags}

%install
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
make DESTDIR=$RPM_BUILD_ROOT install

# remove what we didn't want installed
rm $RPM_BUILD_ROOT%{_libdir}/*.la
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/

# no libGL dependency, please
rm -f $RPM_BUILD_ROOT%{_bindir}/tiffgt

# no sgi2tiff or tiffsv, either
rm -f $RPM_BUILD_ROOT%{_bindir}/sgi2tiff
rm -f $RPM_BUILD_ROOT%{_bindir}/tiffsv

rm -f $RPM_BUILD_ROOT%{_mandir}/man1/tiffgt.1
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/sgi2tiff.1
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/tiffsv.1
rm -f html/man/tiffgt.1.html
rm -f html/man/sgi2tiff.1.html
rm -f html/man/tiffsv.1.html

# multilib header hack
# we only apply this to known Red Hat multilib arches, per bug #233091
case `uname -i` in
  i386 | ppc | s390 | sparc )
    wordsize="32"
    ;;
  x86_64 | ppc64 | s390x | sparc64 )
    wordsize="64"
    ;;
  *)
    wordsize=""
    ;;
esac

if test -n "$wordsize"
then
  mv $RPM_BUILD_ROOT%{_includedir}/tiffconf.h \
     $RPM_BUILD_ROOT%{_includedir}/tiffconf-$wordsize.h

  cat >$RPM_BUILD_ROOT%{_includedir}/tiffconf.h <<EOF
#ifndef TIFFCONF_H_MULTILIB
#define TIFFCONF_H_MULTILIB

#include <bits/wordsize.h>

#if __WORDSIZE == 32
# include "tiffconf-32.h"
#elif __WORDSIZE == 64
# include "tiffconf-64.h"
#else
# error "unexpected value for __WORDSIZE macro"
#endif

#endif
EOF

fi

%ldconfig_scriptlets

%check
LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH make check

# don't include documentation Makefiles, they are a multilib hazard
find html -name 'Makefile*' | xargs rm

%files
%doc COPYRIGHT README RELEASE-DATE VERSION
%{_libdir}/libtiff.so.*
%{_libdir}/libtiffxx.so.*

%files devel
%doc TODO ChangeLog html
%{_includedir}/*
%{_libdir}/libtiff.so
%{_libdir}/libtiffxx.so
%{_libdir}/pkgconfig/libtiff*.pc
%{_mandir}/man3/*

%files static
%{_libdir}/*.a

%files tools
%{_bindir}/*
%{_mandir}/man1/*

%changelog
* Wed Jul 15 2026 Michal Hlavinka <mhlavink@redhat.com> - 4.0.9-38
- fix CVE-2026-12912: heap-buffer-overflow in PixarLog 8BITABGR decode with stride 3 (RHEL-189371)




编译 libverto ^libverto


RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libverto.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libverto.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
# 定义基础名称(不带 local- 前缀)
%global base_name libverto
%global homepage https://github.com/latchset/libverto
Name:       local-%{base_name}
Version:        0.3.2
Release:        2%{?dist}
Summary:        Main loop abstraction library

License:        MIT
URL:            %{homepage}
Source0:        %{homepage}/releases/download/%{version}/%{base_name}-%{version}.tar.gz

BuildRequires:  local-autoconf
BuildRequires:  local-automake
BuildRequires:  local-libtool
BuildRequires:  local-make

BuildRequires:  glib2-devel
BuildRequires:  local-libevent
BuildRequires:  local-libev-devel

BuildRequires:  git

Obsoletes:      libverto-tevent < 0.3.0-2
Obsoletes:      libverto-tevent-devel < 0.3.0-2

%description
libverto provides a way for libraries to expose asynchronous interfaces
without having to choose a particular event loop, offloading this
decision to the end application which consumes the library.

If you are packaging an application, not library, based on libverto,
you should depend either on a specific implementation module or you
can depend on the virtual provides 'libverto-module-base'. This will
ensure that you have at least one module installed that provides io,
timeout and signal functionality. Currently glib is the only module
that does not provide these three because it lacks signal. However,
glib will support signal in the future.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       pkgconfig

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package        glib
Summary:        glib module for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    glib
Module for %{name} which provides integration with glib.

This package does NOT yet provide %{name}-module-base.

%package        glib-devel
Summary:        Development files for %{name}-glib
Requires:       %{name}-glib%{?_isa} = %{version}-%{release}
Requires:       %{name}-devel%{?_isa} = %{version}-%{release}

%description    glib-devel
The %{name}-glib-devel package contains libraries and header files for
developing applications that use %{name}-glib.

%package        libevent
Summary:        libevent module for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Provides:       %{name}-module-base = %{version}-%{release}

%description    libevent
Module for %{name} which provides integration with libevent.

%package        libevent-devel
Summary:        Development files for %{name}-libevent
Requires:       %{name}-libevent%{?_isa} = %{version}-%{release}
Requires:       %{name}-devel%{?_isa} = %{version}-%{release}

%description    libevent-devel
The %{name}-libevent-devel package contains libraries and header files for
developing applications that use %{name}-libevent.

%package        libev
Summary:        libev module for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Provides:       %{name}-module-base = %{version}-%{release}

%description    libev
Module for %{name} which provides integration with libev.

This package provides %{name}-module-base since it supports io, timeout
and signal.

%package        libev-devel
Summary:        Development files for %{name}-libev
Requires:       %{name}-libev%{?_isa} = %{version}-%{release}
Requires:       %{name}-devel%{?_isa} = %{version}-%{release}

%description    libev-devel
The %{name}-libev-devel package contains libraries and header files for
developing applications that use %{name}-libev.

This package provides %{name}-module-base since it supports io, timeout
and signal.

%prep
# 这个宏会:rm -rf 旧目录 → 解压源码 → 打补丁
%setup -q -n %{base_name}-%{version}

%build
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH
autoreconf -fiv
%configure --disable-static
make %{?_smp_mflags}

%install
# 忽略标准 RPATH、无效 RPATH 和包含 '..' 的 RPATH
export QA_RPATHS=$(( 0x0001|0x0002|0x0020 ))
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

%ldconfig_scriptlets
%ldconfig_scriptlets glib
%ldconfig_scriptlets libevent
%ldconfig_scriptlets libev

%files
%{!?_licensedir:%global license %%doc}
%license COPYING
%doc AUTHORS ChangeLog NEWS README
%{_libdir}/%{base_name}.so.*

%files devel
%{_includedir}/verto.h
%{_includedir}/verto-module.h
%{_libdir}/%{base_name}.so
%{_libdir}/pkgconfig/%{base_name}.pc

%files glib
%{_libdir}/%{base_name}-glib.so.*

%files glib-devel
%{_includedir}/verto-glib.h
%{_libdir}/%{base_name}-glib.so
%{_libdir}/pkgconfig/%{base_name}-glib.pc

%files libevent
%{_libdir}/%{base_name}-libevent.so.*

%files libevent-devel
%{_includedir}/verto-libevent.h
%{_libdir}/%{base_name}-libevent.so
%{_libdir}/pkgconfig/%{base_name}-libevent.pc

%files libev
%{_libdir}/%{base_name}-libev.so.*

%files libev-devel
%{_includedir}/verto-libev.h
%{_libdir}/%{base_name}-libev.so
%{_libdir}/pkgconfig/%{base_name}-libev.pc

%changelog
* Wed Jun 29 2022 Julien Rische <jrische@redhat.com> - 0.3.2-1
- New upstream release (0.3.2)
- Resolves: rhbz#2100916

编译 libX11 ^libX11

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libX11.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libX11.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libX11
%global tarball libX11
#global gitdate 20130524
%global gitversion a3bdd2b09

Summary: Core X11 protocol client library
Name:       local-%{base_name}
Version: 1.6.8
Release: 9%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

%if 0%{?gitdate}
Source0:    %{tarball}-%{gitdate}.tar.bz2
Source1:    make-git-snapshot.sh
Source2:    commitid
%else
Source0: https://xorg.freedesktop.org/archive/individual/lib/%{base_name}-%{version}.tar.bz2
%endif

Patch2: dont-forward-keycode-0.patch
Patch3: 0001-Fix-XTS-regression-in-XCopyColormapAndFree.patch
Patch4: 0001-Fix-poll_for_response-race-condition.patch

# CVE-2020-14363
Patch5: 0001-Fix-an-integer-overflow-in-init_om.patch
Patch6: CVE-2021-31535.patch
# CVE-2023-3138
Patch7: 0001-InitExt.c-Add-bounds-checks-for-extension-request-ev.patch

# CVE-2023-43785
Patch8: 0001-CVE-2023-43785-out-of-bounds-memory-access-in-_XkbRe.patch

# CVE-2023-43786
Patch9: 0001-CVE-2023-43786-stack-exhaustion-from-infinite-recurs.patch
Patch10: 0002-XPutImage-clip-images-to-maximum-height-width-allowe.patch
Patch11: 0003-XCreatePixmap-trigger-BadValue-error-for-out-of-rang.patch

# CVE-2023-43787
Patch12: 0001-CVE-2023-43787-Integer-overflow-in-XCreateImage-lead.patch

# RHEL-23452
Patch13: 0001-Avoid-recursing-through-_XError-due-to-sequence-adju.patch

# https://issues.redhat.com/browse/RHEL-58444
Patch14: 0001-imDefLkup-verify-that-a-pointer-isn-t-NULL-before-us.patch

BuildRequires: local-xorg-x11-util-macros >= 1.11
BuildRequires: local-pkgconf
BuildRequires: local-xorg-x11-xtrans-devel >= 1.0.3-4
BuildRequires: local-libxcb-devel >= 1.2
BuildRequires: local-perl5

Requires: %{name}-common >= %{version}-%{release}

%description
Core X11 protocol client library.

%package common
Summary: Common data for libX11
Group: System Environment/Libraries
BuildArch: noarch

%description common
libX11 common data

%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: %{name}-xcb = %{version}-%{release}

%description devel
X.Org X11 libX11 development package

%package xcb
Summary: XCB interop for libX11
Group: System Environment/Libraries
Conflicts: %{name} < %{version}-%{release}

%description xcb
libX11/libxcb interoperability library

%prep
%setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
%patch2 -p1 -b .dont-forward-keycode-0
%patch3 -p1 -b .copycolormapandfree
%patch4 -p1 -b .race
%patch5 -p1 -b .fix-an-integer-overflow-in-init_om
%patch6 -p1 -b .cve-2021-31535
%patch7 -p1 -b .cve-2023-3138
%patch8 -p1 -b .cve-2023-43785
%patch9 -p1 -b .cve-2023-43786
%patch10 -p1 -b .xputimage-clip-images-to-maximum-height-width-allowe
%patch11 -p1 -b .xcreatepixmap-trigger-badvalue-error-for-out-of-rang
%patch12 -p1 -b .cve-2023-43787
%patch13 -p1 -b .rhel-23452
%patch14 -p1 -b .rhel-58444

%build
autoreconf -v --install --force
%configure --disable-silent-rules --disable-static

make %{?_smp_mflags}

%install
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"

# create/own compose cache dir
mkdir -p $RPM_BUILD_ROOT/var/cache/libX11/compose

# We intentionally don't ship *.la files
find $RPM_BUILD_ROOT -type f -name '*.la' -delete

# FIXME: Don't install Xcms.txt - find out why upstream still ships this.
find $RPM_BUILD_ROOT -name 'Xcms.txt' -delete

# FIXME package these properly
rm -rf $RPM_BUILD_ROOT%{_docdir}

%check
make %{?_smp_mflags} check

%ldconfig_post
%ldconfig_postun

%files
%{_libdir}/libX11.so.6
%{_libdir}/libX11.so.6.3.0

%files xcb
%{_libdir}/libX11-xcb.so.1
%{_libdir}/libX11-xcb.so.1.0.0

%files common
%doc AUTHORS COPYING README.md NEWS
%{_datadir}/X11/locale/
%{_datadir}/X11/XErrorDB
%dir /var/cache/libX11
%dir /var/cache/libX11/compose

%files devel
%{_includedir}/X11/ImUtil.h
%{_includedir}/X11/XKBlib.h
%{_includedir}/X11/Xcms.h
%{_includedir}/X11/Xlib.h
%{_includedir}/X11/XlibConf.h
%{_includedir}/X11/Xlibint.h
%{_includedir}/X11/Xlib-xcb.h
%{_includedir}/X11/Xlocale.h
%{_includedir}/X11/Xregion.h
%{_includedir}/X11/Xresource.h
%{_includedir}/X11/Xutil.h
%{_includedir}/X11/cursorfont.h
%{_libdir}/libX11.so
%{_libdir}/libX11-xcb.so
%{_libdir}/pkgconfig/x11.pc
%{_libdir}/pkgconfig/x11-xcb.pc
%{_mandir}/man3/*.3*
%{_mandir}/man5/*.5*

%changelog
* Fri Sep 13 2024 José Expósito <jexposit@redhat.com> - 1.6.8-9
- Backport NULL check to avoid a crash
  Resolves: https://issues.redhat.com/browse/RHEL-58444

编译 libXau ^libXau

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libXau.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libXau.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libXau
Name:       local-%{base_name}
Summary: Sample Authorization Protocol for X
Version: 1.0.9
Release: 3%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

Source0: https://www.x.org/pub/individual/lib/%{base_name}-%{version}.tar.bz2

#Patch0: xau-1.0.4-local.patch

BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-pkgconf
BuildRequires: local-xorg-x11-proto-devel

%description
This is a very simple mechanism for providing individual access to an X Window
System display.It uses existing core protocol and library hooks for specifying
authorization data in the connection setup block to restrict use of the display
to only those clients that show that they know a server-specific key 
called a "magic cookie".

%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: xorg-x11-proto-devel
Requires: pkgconfig
BuildRequires: local-xorg-x11-proto-devel

%description devel
X.Org X11 libXau development package

%prep
%setup -q -n %{base_name}-%{version}
#patch0 -p1 -b .local

%build
autoreconf -v --install --force

%configure --disable-static
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"

# We intentionally don't ship *.la files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%check
make check

%ldconfig_post
%ldconfig_postun

%files
%doc AUTHORS COPYING README ChangeLog
%{_libdir}/libXau.so.6
%{_libdir}/libXau.so.6.0.0

%files devel
%{_includedir}/X11/Xauth.h
%{_libdir}/libXau.so
%{_libdir}/pkgconfig/xau.pc
%{_mandir}/man3/*.3*

%changelog
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

编译 libXaw ^libXaw

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libXaw.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libXaw.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libXaw
Name:       local-%{base_name}
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{base_name}-%{version}}

Summary: X Athena Widget Set

Version: 1.0.13
Release: 10%{?dist}
License: MIT
URL: http://www.x.org
Group: System Environment/Libraries

Source0: https://www.x.org/pub/individual/lib/%{base_name}-%{version}.tar.bz2

BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-pkgconf
BuildRequires: local-xorg-x11-util-macros local-lynx local-libX11 local-xorg-x11-proto-devel
BuildRequires: local-xmlto

%description
Xaw is a widget set based on the X Toolkit Intrinsics (Xt) Library.

%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: local-pkgconf

%description devel
X.Org X11 libXaw development package

%prep
%setup -q -n %{base_name}-%{version}

%build
autoreconf -v --install --force
export CFLAGS="$RPM_OPT_FLAGS -Os"
%configure \
	    --docdir=%{_pkgdocdir} \
	    --disable-xaw8 --disable-static \
	    --disable-xaw6 \
	    --without-fop --without-xmlto
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
install -pm 644 COPYING README ChangeLog $RPM_BUILD_ROOT%{_pkgdocdir}
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%ldconfig_post
%ldconfig_postun

%files
%dir %{_pkgdocdir}
%{_pkgdocdir}/ChangeLog
%{_pkgdocdir}/COPYING
%{_pkgdocdir}/README
%{_libdir}/libXaw.so.7
%{_libdir}/libXaw7.so.7
%{_libdir}/libXaw7.so.7.0.0

%files devel
%dir %{_includedir}/X11/Xaw
%{_includedir}/X11/Xaw/*.h
# FIXME:  Is this C file really supposed to be here?
%{_includedir}/X11/Xaw/Template.c
%{_libdir}/libXaw.so
%{_libdir}/libXaw7.so
%{_libdir}/pkgconfig/xaw7.pc
%{_mandir}/man3/*.3*
%{_pkgdocdir}/*.xml
#{_pkgdocdir}/%{base_name}.html
#{_pkgdocdir}/%{base_name}.txt

%changelog
* Thu Jul 05 2018 Adam Jackson <ajax@redhat.com> - 1.0.13-10
- Drop useless %%defattr

编译 libxcb ^libxcb

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libxcb.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libxcb.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libxcb
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
Name:       local-%{base_name}
Version:    1.13.1
Release:    1%{?dist}
Summary:    A C binding to the X11 protocol
License:    MIT
URL:        https://xcb.freedesktop.org/

Source0:    https://xcb.freedesktop.org/dist/%{base_name}-%{version}.tar.bz2

# This is stolen straight from the pthread-stubs source:
# http://cgit.freedesktop.org/xcb/pthread-stubs/blob/?id=6900598192bacf5fd9a34619b11328f746a5956d
# we don't need the library because glibc has working pthreads, but we need
# the pkgconfig file so libs that link against libxcb know this...
Source1:    pthread-stubs.pc.in

BuildRequires:  local-doxygen
# BuildRequires:  graphviz
BuildRequires:  local-libtool
BuildRequires:  local-libxslt
BuildRequires:  local-pkgconf
BuildRequires:  local-python3
BuildRequires:  local-xcb-proto

%description
The X protocol C-language Binding (XCB) is a replacement for Xlib featuring a
small footprint, latency hiding, direct access to the protocol, improved
threading support, and extensibility.

%package devel
Summary:    Development files for %{name}
Requires:   %{name}%{?_isa} = %{version}-%{release}

%description devel
The %{name}-devel package contains libraries and header files for developing
applications that use %{name}.

%package doc
Summary:    Documentation for %{name}
BuildArch:  noarch

%description doc
The %{name}-doc package contains documentation for the %{name} library.

%prep
%setup -q -n %{base_name}-%{version}

%build
sed -i 's/pthread-stubs //' configure.ac
# autoreconf -f needed to expunge rpaths
autoreconf -v -f --install
%configure \
    --disable-static \
    --docdir=%{_pkgdocdir} \
    --enable-selinux \
    --enable-xkb \
    --enable-xinput \
    --disable-xprint \
    --disable-silent-rules

# Remove rpath from libtool (extra insurance if autoreconf is ever dropped)
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

make %{?_smp_mflags}

%install
make install DESTDIR=$RPM_BUILD_ROOT
install -pm 644 COPYING NEWS README $RPM_BUILD_ROOT%{_pkgdocdir}
sed 's,@libdir@,%{_libdir},;s,@prefix@,%{_prefix},;s,@exec_prefix@,%{_exec_prefix},' %{SOURCE1} \
    > $RPM_BUILD_ROOT%{_libdir}/pkgconfig/pthread-stubs.pc

find $RPM_BUILD_ROOT -name '*.la' -delete

%ldconfig_post

%ldconfig_postun

%files
%{_libdir}/libxcb-composite.so.0*
%{_libdir}/libxcb-damage.so.0*
%{_libdir}/libxcb-dpms.so.0*
%{_libdir}/libxcb-dri2.so.0*
%{_libdir}/libxcb-dri3.so.0*
%{_libdir}/libxcb-glx.so.0*
%{_libdir}/libxcb-present.so.0*
%{_libdir}/libxcb-randr.so.0*
%{_libdir}/libxcb-record.so.0*
%{_libdir}/libxcb-render.so.0*
%{_libdir}/libxcb-res.so.0*
%{_libdir}/libxcb-screensaver.so.0*
%{_libdir}/libxcb-shape.so.0*
%{_libdir}/libxcb-shm.so.0*
%{_libdir}/libxcb-sync.so.1*
%{_libdir}/libxcb-xf86dri.so.0*
%{_libdir}/libxcb-xfixes.so.0*
%{_libdir}/libxcb-xinerama.so.0*
%{_libdir}/libxcb-xinput.so.0*
%{_libdir}/libxcb-xkb.so.1*
%{_libdir}/libxcb-xselinux.so.0*
%{_libdir}/libxcb-xtest.so.0*
%{_libdir}/libxcb-xv.so.0*
%{_libdir}/libxcb-xvmc.so.0*
%{_libdir}/libxcb.so.1*

%files devel
%{_includedir}/xcb
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man3/*.3*

%files doc
%{_pkgdocdir}

%changelog
* Tue Nov 19 2019 Adam Jackson <ajax@redhat.com> - 1.13.1-1
- libxcb 1.13.1

编译 libXext ^libXext

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libXext.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libXext.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libXext
%global tarball libXext
#global gitdate 20130524
%global gitversion dfe6e1f3b

Summary: X.Org X11 libXext runtime library
Name:       local-%{base_name}
Version: 1.3.4
Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

%if 0%{?gitdate}
Source0:    %{tarball}-%{gitdate}.tar.bz2
Source1:    make-git-snapshot.sh
Source2:    commitid
%else
Source0: http://xorg.freedesktop.org/archive/individual/lib/%{base_name}-%{version}.tar.bz2
%endif

Requires: local-libX11 >= 1.5.99.902

BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-xorg-x11-proto-devel >= 7.4-23
BuildRequires: local-libX11-devel >= 1.5.99.902
BuildRequires: libXau-devel
BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-autoconf local-automake local-libtool local-pkgconf
BuildRequires: local-xmlto

%description
X.Org X11 libXext runtime library

%package devel
Summary: X.Org X11 libXext development package
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
X.Org X11 libXext development package

%prep
%setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}

%build
autoreconf -v --install --force
%configure --disable-static
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

# We intentionally don't ship *.la files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

# do this with %%doc below
rm -rf $RPM_BUILD_ROOT%{_docdir}

%ldconfig_post
%ldconfig_postun

%files
%doc AUTHORS COPYING
%{_libdir}/libXext.so.6
%{_libdir}/libXext.so.6.4.0

%files devel
%{_includedir}/X11/extensions/MITMisc.h
%{_includedir}/X11/extensions/XEVI.h
%{_includedir}/X11/extensions/XLbx.h
%{_includedir}/X11/extensions/XShm.h
%{_includedir}/X11/extensions/Xag.h
%{_includedir}/X11/extensions/Xcup.h
%{_includedir}/X11/extensions/Xdbe.h
%{_includedir}/X11/extensions/Xext.h
%{_includedir}/X11/extensions/Xge.h
%{_includedir}/X11/extensions/dpms.h
%{_includedir}/X11/extensions/extutil.h
%{_includedir}/X11/extensions/multibuf.h
%{_includedir}/X11/extensions/security.h
%{_includedir}/X11/extensions/shape.h
%{_includedir}/X11/extensions/sync.h
%{_includedir}/X11/extensions/xtestext1.h
%{_libdir}/libXext.so
%{_libdir}/pkgconfig/xext.pc
#%dir %{_mandir}/man3x
%{_mandir}/man3/*.3*

%changelog
* Thu Jun 04 2020 Benjamin Tissoires <benjamin.tissoires@redhat.com> - 1.3.4-1
- libXext 1.3.4

编译 libXi ^libXi

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libXi.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libXi.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libXi
%global tarball libXi
#global gitdate 20130524
%global gitversion 661c45ca1

Summary: X.Org X11 libXi runtime library
Name:       local-%{base_name}
Version: 1.7.10
Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

%if 0%{?gitdate}
Source0:    %{tarball}-%{gitdate}.tar.bz2
Source1:    make-git-snapshot.sh
%else
Source0: https://www.x.org/pub/individual/lib/%{base_name}-%{version}.tar.bz2
%endif

BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-xorg-x11-proto-devel
BuildRequires: local-pkgconf
BuildRequires: local-libX11-devel >= 1.5.99.902
BuildRequires: local-libXext-devel local-libXfixes-devel
BuildRequires: local-xmlto
# BuildRequires: asciidoc >= 8.4.5

Requires: local-libX11 >= 1.5.99.902

%description
X.Org X11 libXi runtime library

%package devel
Summary: X.Org X11 libXi development package
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
# required by xi.pc
Requires: local-xorg-x11-proto-devel
Requires: local-pkgconf

%description devel
X.Org X11 libXi development package

%prep
%setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}

%build
autoreconf -v --install || exit 1
%configure --disable-specs \
	   --disable-static

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

# We intentionally don't ship *.la files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%ldconfig_post
%ldconfig_postun

%files
%doc COPYING
%{_libdir}/libXi.so.6
%{_libdir}/libXi.so.6.1.0

%files devel
%{_includedir}/X11/extensions/XInput.h
%{_includedir}/X11/extensions/XInput2.h
%{_libdir}/libXi.so
%{_libdir}/pkgconfig/xi.pc
%{_mandir}/man3/*.3*

%changelog
* Thu Jun 04 2020 Benjamin Tissoires <benjamin.tissoires@redhat.com> - 1.7.10-1
- libXi 1.7.10

编译 libXfixes ^libXfixes

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libXfixes.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libXfixes.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libXfixes
%global tarball libXfixes
#global gitdate 20130524
%global gitversion c480fe327

Summary: X Fixes library
Name:       local-%{base_name}
Version: 5.0.3
Release: 7%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

%if 0%{?gitdate}
Source0:    %{tarball}-%{gitdate}.tar.bz2
Source1:    make-git-snapshot.sh
Source2:    commitid
%else
Source0: http://xorg.freedesktop.org/archive/individual/lib/%{base_name}-%{version}.tar.bz2
%endif

Requires: local-libX11 >= 1.6

BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-pkgconf
BuildRequires: local-libX11 >= 1.5.99.902

%description
X Fixes library.

%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: local-pkgconf

%description devel
libXfixes development package

%prep
%setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}

%build
autoreconf -v --install --force
%configure --disable-static
make V=1 %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"

# We intentionally don't ship *.la files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%ldconfig_post
%ldconfig_postun

%files
%doc AUTHORS COPYING README
%{_libdir}/libXfixes.so.3
%{_libdir}/libXfixes.so.3.1.0

%files devel
%{_includedir}/X11/extensions/Xfixes.h
%{_libdir}/libXfixes.so
%{_libdir}/pkgconfig/xfixes.pc
%{_mandir}/man3/Xfixes.3*

%changelog
* Thu Jul 05 2018 Adam Jackson <ajax@redhat.com> - 5.0.3-7
- Drop useless %%defattr

编译 libxml2 ^libxml2

http://xmlsoft.org/sources/libxml2-2.9.7.tar.gz
tar -zxvf /opt/libxml2-2.9.7.tar.gz -C /usr/local/src
cd /usr/local/src/libxml2-2.9.7
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4
make -j4 install
ln -sf /usr/local/include/libxml2/libxml /usr/local/include/libxml

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libxml2.spec

rpmbuild -ba \
    --define "_prefix /usr/local" \
    --define "__python3 /usr/local/bin/python3" \
    --define "python3_version 3.11" \
    --without python2 \
    ~/rpmbuild/SPECS/libxml2.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libxml2

%if 0%{?rhel} > 7
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif

Name:       local-%{base_name}
Version:        2.12.10
Release:        21%{?dist}.6
Summary:        Library providing XML and HTML support

License:        MIT
URL:            http://xmlsoft.org/
Source:         ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.xz


BuildRequires:  local-gcc
BuildRequires:  local-cmake
BuildRequires:  local-pkgconf

%description
This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DtDs, either
at parse time or later once the document has been modified. The output
can be a simple SAX stream or and in-memory DOM like representations.
In this case one can use the built-in XPath and XPointer implementation
to select sub nodes or ranges. A flexible Input/Output mechanism is
available, with existing HTTP and FTP modules and combined to an
URI library.

%package devel
Summary:        Libraries, includes, etc. to develop XML and HTML applications
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       zlib-devel%{?_isa}
Requires:       xz-devel%{?_isa}

%description devel
Libraries, include files, etc you can use to develop XML applications.
This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DtDs, either
at parse time or later once the document has been modified. The output
can be a simple SAX stream or and in-memory DOM like representations.
In this case one can use the built-in XPath and XPointer implementation
to select sub nodes or ranges. A flexible Input/Output mechanism is
available, with existing HTTP and FTP modules and combined to an
URI library.

%package static
Summary:        Static library for libxml2

%description static
Static library for libxml2 provided for specific uses or shaving a few
microseconds when parsing, do not link to them for generic purpose packages.

%if %{with python2}
%package -n python2-%{name}
%{?python_provide:%python_provide python2-%{name}}
Summary:        Python bindings for the libxml2 library
BuildRequires:  python2-devel
Requires:       %{name}%{?_isa} = %{version}-%{release}
Obsoletes:      %{name}-python < %{version}-%{release}
Provides:       %{name}-python = %{version}-%{release}

%description -n python2-%{name}
The libxml2-python package contains a Python 2 module that permits applications
written in the Python programming language, version 2, to use the interface
supplied by the libxml2 library to manipulate XML files.

This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
%endif # with python2

%package -n python3-%{name}
Summary:        Python 3 bindings for the libxml2 library
BuildRequires:  python3-devel
Requires:       %{name}%{?_isa} = %{version}-%{release}
Obsoletes:      %{name}-python3 < %{version}-%{release}
Provides:       %{name}-python3 = %{version}-%{release}

%description -n python3-%{name}
The libxml2-python3 package contains a Python 3 module that permits
applications written in the Python programming language, version 3, to use the
interface supplied by the libxml2 library to manipulate XML files.

This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.

%prep
# 这个宏会:rm -rf 旧目录 → 解压源码 → 打补丁
%setup -q -n %{base_name}-%{version}
find doc -type f -executable -print -exec chmod 0644 {} ';'

%build
# 设置环境变量强制使用 Python 3
export PYTHON=%{__python3}
export PYTHON_VERSION=%{python3_version}
mkdir -p py3
cd py3
../configure \
    --cache-file=../config.cache \
    --with-python=/usr/local/bin/python3 \
    --disable-werror \
    PYTHON=/usr/local/bin/python3 \
    PYTHON_VERSION=3.11
make install DESTDIR=%{buildroot}

# multiarch crazyness on timestamp differences or Makefile/binaries for examples
touch -m --reference=%{buildroot}%{_includedir}/libxml2/libxml/parser.h %{buildroot}%{_bindir}/xml2-config

find %{buildroot} -type f -name '*.la' -print -delete
rm -vf %{buildroot}{%{python2_sitearch},%{python3_sitearch}}/*.a
rm -vrf %{buildroot}%{_datadir}/doc/

# 创建软链接(相对路径)
cd %{buildroot}%{_prefix}/include
ln -sf libxml2/libxml libxml

# 修正:将 Python 文件从系统目录移动到 /usr/local
if [ -d %{buildroot}/usr/lib/python3.7/site-packages ]; then
    mkdir -p %{buildroot}%{_prefix}/lib/python3.11/site-packages
    mv %{buildroot}/usr/lib/python3.7/site-packages/* %{buildroot}%{_prefix}/lib/python3.11/site-packages/ 2>/dev/null || true
    rm -rf %{buildroot}/usr/lib/python3.7
fi

if [ -d %{buildroot}/usr/lib/python2.7/site-packages ]; then
    mkdir -p %{buildroot}%{_prefix}/lib/python2.7/site-packages
    mv %{buildroot}/usr/lib/python2.7/site-packages/* %{buildroot}%{_prefix}/lib/python2.7/site-packages/ 2>/dev/null || true
    rm -rf %{buildroot}/usr/lib/python2.7
fi

# ==========================================
# 通用 Python 字节码生成
# 尝试 Python 2 和 Python 3,哪个能工作就用哪个
# ==========================================
# 定义函数:尝试用指定 Python 编译
try_compile() {
    local python=$1
    if [ -x "$python" ]; then
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        return 0
    fi
    return 1
}
# 优先尝试 Python 2(兼容旧语法)
try_compile /usr/bin/python3
try_compile /usr/bin/python2


# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
echo %{buildroot}
ls -la ./usr/local/lib/ || true
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%check
%if %{with python2}
%make_build runtests -C py2
%endif # with python2
%make_build runtests -C py3

%ldconfig_scriptlets

%files -f %{_builddir}/files.list

%changelog
* Tue Jun 16 2026 David King <dking@redhat.com> - 2.9.7-21.6
- Fix CVE-2025-6170 (RHEL-182012)

编译 libXmu ^libXmu

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libXmu.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libXmu.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libXmu
# TODO: libXmuu split and/or elf filter emulation

Summary: X.Org X11 libXmu/libXmuu runtime libraries
Name:       local-%{base_name}
Version: 1.1.3
Release: 1%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

Source0: https://www.x.org/pub/individual/lib/%{base_name}-%{version}.tar.bz2

BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-libX11-devel
BuildRequires: local-libXext-devel
BuildRequires: local-libXt-devel
BuildRequires: local-xmlto

%description
X.Org X11 libXmu/libXmuu runtime libraries

%package devel
Summary: X.Org X11 libXmu development package
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
X.Org X11 libXmu development package

%prep
%setup -q -n %{base_name}-%{version}

%build
autoreconf -v --install --force
%configure --disable-static
make  %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

# We intentionally don't ship *.la files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

# fixup later
rm -rf $RPM_BUILD_ROOT%{_docdir}

%ldconfig_post
%ldconfig_postun

%files
%doc COPYING README.md ChangeLog
%{_libdir}/libXmu.so.6
%{_libdir}/libXmu.so.6.2.0
%{_libdir}/libXmuu.so.1
%{_libdir}/libXmuu.so.1.0.0

%files devel
%dir %{_includedir}/X11/Xmu
%{_includedir}/X11/Xmu/Atoms.h
%{_includedir}/X11/Xmu/CharSet.h
%{_includedir}/X11/Xmu/CloseHook.h
%{_includedir}/X11/Xmu/Converters.h
%{_includedir}/X11/Xmu/CurUtil.h
%{_includedir}/X11/Xmu/CvtCache.h
%{_includedir}/X11/Xmu/DisplayQue.h
%{_includedir}/X11/Xmu/Drawing.h
%{_includedir}/X11/Xmu/Editres.h
%{_includedir}/X11/Xmu/EditresP.h
%{_includedir}/X11/Xmu/Error.h
%{_includedir}/X11/Xmu/ExtAgent.h
%{_includedir}/X11/Xmu/Initer.h
%{_includedir}/X11/Xmu/Lookup.h
%{_includedir}/X11/Xmu/Misc.h
%{_includedir}/X11/Xmu/StdCmap.h
%{_includedir}/X11/Xmu/StdSel.h
%{_includedir}/X11/Xmu/SysUtil.h
%{_includedir}/X11/Xmu/WhitePoint.h
%{_includedir}/X11/Xmu/WidgetNode.h
%{_includedir}/X11/Xmu/WinUtil.h
%{_includedir}/X11/Xmu/Xct.h
%{_includedir}/X11/Xmu/Xmu.h
%{_libdir}/libXmu.so
%{_libdir}/libXmuu.so
%{_libdir}/pkgconfig/xmu.pc
%{_libdir}/pkgconfig/xmuu.pc

%changelog
* Thu Jun 04 2020 Benjamin Tissoires <benjamin.tissoires@redhat.com> - 1.1.3-1
- libXmu 1.1.3



编译 libXpm ^libXpm

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libXpm.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libXpm.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libXpm
Summary: X.Org X11 libXpm runtime library
Name:       local-%{base_name}
Version: 3.5.12
Release: 11%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.x.org

Source0: https://www.x.org/pub/individual/lib/%{base_name}-%{version}.tar.bz2

BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-gettext
BuildRequires: local-pkgconf
BuildRequires: local-ncompress gzip

Patch0: 0001-After-fdopen-use-fclose-instead-of-close-in-error-pa.patch

# CVE-2022-46285
Patch0001: 0001-Fix-CVE-2022-46285-Infinite-loop-on-unclosed-comment.patch
# CVE-2022-44617
Patch0002: 0002-Fix-CVE-2022-44617-Runaway-loop-with-width-of-0-and-.patch
Patch0003: 0003-Prevent-a-double-free-in-the-error-code-path.patch
# CVE-2022-4883
Patch0004: 0004-configure-add-disable-open-zfile-instead-of-requirin.patch
Patch0005: 0005-Fix-CVE-2022-4883-compression-commands-depend-on-PAT.patch
Patch0006: 0006-Use-gzip-d-instead-of-gunzip.patch
# CVE-2023-43788
Patch0007: 0001-Fix-CVE-2023-43788-Out-of-bounds-read-in-XpmCreateXp.patch
# CVE-2023-43789
Patch0008: 0001-Fix-CVE-2023-43789-Out-of-bounds-read-on-XPM-with-co.patch

%description
X.Org X11 libXpm runtime library

%package devel
Summary: X.Org X11 libXpm development package
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
X.Org X11 libXpm development package

%prep
%setup -q -n %{base_name}-%{version}
%patch0 -p1 -b .covscan
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1

%build
autoreconf -v --install --force
%configure --disable-static
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

# We intentionally don't ship *.la files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%ldconfig_post
%ldconfig_postun

%files
%doc AUTHORS COPYING ChangeLog
%{_libdir}/libXpm.so.4
%{_libdir}/libXpm.so.4.11.0

%files devel
%{_bindir}/cxpm
%{_bindir}/sxpm
%{_includedir}/X11/xpm.h
%{_libdir}/libXpm.so
%{_libdir}/pkgconfig/xpm.pc
#%dir %{_mandir}/man1x
%{_mandir}/man1/*.1*
#%{_mandir}/man1/*.1x*

%changelog
* Wed Oct 11 2023 José Expósito <jexposit@redhat.com> - 3.5.12-11
- Drop hardening patches from previous version to keep ABI compatibility

编译 libxslt ^libxslt

https://codeload.github.com/GNOME/libxslt/tar.gz/refs/tags/v1.1.32
tar -zxvf /opt/libxslt-1.1.32.tar.gz -C /usr/local/src
cd /usr/local/src/libxslt-1.1.32
mkdir m4
export ACLOCAL_PATH="/usr/local/share/aclocal"
autoreconf -vifs
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4
make -j4 install

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libxslt.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--without python2 \
~/rpmbuild/SPECS/libxslt.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libxslt
%if 0%{?rhel} > 7
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif

Name:       local-%{base_name}
Summary:        Library providing the Gnome XSLT engine
Version:        1.1.32
Release:        6.4%{?dist}

License:        MIT
URL:            http://xmlsoft.org/XSLT
Source:         ftp://xmlsoft.org/XSLT/%{base_name}-%{version}.tar.gz

BuildRequires:  local-autoconf
BuildRequires:  local-automake
BuildRequires:  local-libtool
BuildRequires:  local-make
BuildRequires:  local-gcc
BuildRequires:  %{_bindir}/libgcrypt-config

# Fedora specific patches
Patch0:         multilib.patch
Patch1:         libxslt-1.1.26-utf8-docs.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1765632
Patch2:         multilib2.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1775517
Patch3:         libxslt-1.1.32-CVE-2019-18197.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1715732
Patch4:         libxslt-1.1.32-CVE-2019-11068.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1860467
Patch5:         libxslt-1.1.32-unexpected-rvt-flag.patch
# https://issues.redhat.com/browse/RHEL-83506
Patch6:         libxslt-1.1.32-CVE-2024-55549.patch
# https://issues.redhat.com/browse/RHEL-83492
Patch7:         libxslt-1.1.32-CVE-2025-24855.patch
# https://issues.redhat.com/browse/RHEL-89374
Patch8:         libxslt-1.1.32-CVE-2023-40403.patch
# https://redhat.atlassian.net/browse/RHEL-171739
Patch9:         libxslt-1.1.32-CVE-2025-10911.patch

%description
This C library allows to transform XML files into other XML files
(or HTML, text, ...) using the standard XSLT stylesheet transformation
mechanism. To use it you need to have a version of libxml2 >= 2.6.27
installed. The xsltproc command is a command line interface to the XSLT engine

%package devel
Summary:        Development libraries and header files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       libgcrypt-devel%{?_isa}
Requires:       libgpg-error-devel%{?_isa}

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%if %{with python2}
%package -n python2-libxslt
Summary:        Python 2 bindings for %{name}
BuildRequires:  python2-devel
BuildRequires:  python2-libxml2
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       python2-libxml2
%{?python_provide:%python_provide python2-libxslt}
# Remove before F30
Provides:       %{name}-python = %{version}-%{release}
Provides:       %{name}-python%{?_isa} = %{version}-%{release}
Obsoletes:      %{name}-python < %{version}-%{release}

%description -n python2-libxslt
The libxslt-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libxslt library to apply XSLT transformations.

This library allows to parse sytlesheets, uses the libxml2-python
to load and save XML and HTML files. Direct access to XPath and
the XSLT transformation context are possible to extend the XSLT language
with XPath functions written in Python.
%endif # with python2

%prep
%setup -q -n %{base_name}-%{version}
chmod 644 python/tests/*

%build
autoreconf -vfi
%configure --disable-static --disable-silent-rules
%make_build

%install
%make_install
find %{buildroot} -name '*.la' -print -delete
# multiarch crazyness on timestamp differences
touch -m --reference=%{buildroot}%{_includedir}/libxslt/xslt.h %{buildroot}%{_bindir}/xslt-config
rm -vrf %{buildroot}%{_docdir}

# ==========================================
# 通用 Python 字节码生成
# 尝试 Python 2 和 Python 3,哪个能工作就用哪个
# ==========================================
# 定义函数:尝试用指定 Python 编译
try_compile() {
    local python=$1
    if [ -x "$python" ]; then
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib 2>/dev/null || true
        $python -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        $python -O -m compileall -q -f %{buildroot}%{_prefix}/lib64 2>/dev/null || true
        return 0
    fi
    return 1
}
# 优先尝试 Python 2(兼容旧语法)
try_compile /usr/bin/python3
try_compile /usr/bin/python2


# 删除 dir 文件,避免和系统中已有的 dir 冲突
rm -f %{buildroot}/usr/local/share/info/dir
# 使用 find 命令生成文件列表
cd %{buildroot}
echo %{buildroot}
ls -la ./usr/local/lib/ || true
find . -mindepth 4 -maxdepth 4 -type f -o -type l -o -type d | sed 's/^\.//' | grep "%{_prefix}" > %{_builddir}/files.list

%check
%make_build tests

%ldconfig_scriptlets

%files -f %{_builddir}/files.list

%changelog
* Tue May 19 2026 David King <dking@redhat.com> - 1.1.32-6.4
- Fix CVE-2025-10911 (RHEL-171739)

编译 libXt ^libXt

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libXt.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/libXt.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libXt
%global tarball libXt
#global gitdate 20130524
%global gitversion 1f4802b74

Summary: X.Org X11 libXt runtime library
Name:       local-%{base_name}
Version: 1.1.5
Release: 12%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
License: MIT
URL: http://www.x.org

%if 0%{?gitdate}
Source0:    %{tarball}-%{gitdate}.tar.bz2
Source1:    make-git-snapshot.sh
Source2:    commitid
%else
Source0: http://xorg.freedesktop.org/archive/individual/lib/%{base_name}-%{version}.tar.bz2
%endif

Patch1:  0001-no-need-to-check-XFree-arguments.patch
Patch2:  0002-no-need-to-check-args-for-free.patch
Patch3:  0003-resolv-shadows-a-global-declaration.patch
Patch4:  0004-fix-build-when-XT_GEO_TATTLER-is-defined.patch
Patch5:  0005-fix-bug-introduced-by.patch
Patch6:  0006-Use-standard-size_t-type-in-the-casts-for-length-par.patch
Patch7:  0007-Fix-leaks-detected-by-covscan.patch
Patch8:  0008-dummy-fix-for-covscan.patch
Patch9:  0009-Fix-covscan-complain.patch

Requires: libX11%{?_isa} >= 1.5.99.902

BuildRequires: local-xorg-x11-util-macros
BuildRequires: local-autoconf local-automake local-libtool
BuildRequires: local-pkgconf
BUildRequires: local-libX11 >= 1.5.99.902

%description
X.Org X11 libXt runtime library

%package devel
Summary: X.Org X11 libXt development package
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
X.Org X11 libXt development package

%prep
%setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
%patch1  -p1 -b .git_102ba41a668568d7e7e506b0ab9f064d1f2c4ec5
%patch2  -p1 -b .git_12eda76f2c7ff5d43dd68d7ff0ebc29cf27e9897
%patch3  -p1 -b .git_57c8b133bbcf38a9a1e345eabeeabe2a3e07c1c8
%patch4  -p1 -b .git_fe32434ab1a6a85d222b15e730fed9a5d8a74a2d
%patch5  -p1 -b .git_283db645c56a5aa55af1665c309182e492a3c863
%patch6  -p1 -b .git_91c08f4d9cb915d5f7c3074db3e72ad15ec14c01
%patch7  -p1 -b .git_bca67f981dd3bcf730ac3816836b66049dd09f33
%patch8  -p1 -b .git_6a7584e0337bb5cfec7f786231597f46c6d5fb16
%patch9  -p1 -b .git_ba4ec937680ee72f2fcd463752766340a4b3729d

%build
autoreconf -v --install --force
# FIXME: Work around pointer aliasing warnings from compiler for now
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%configure --disable-static \
  --with-xfile-search-path="%{_sysconfdir}/X11/%%L/%%T/%%N%%C%%S:%{_sysconfdir}/X11/%%l/%%T/\%%N%%C%%S:%{_sysconfdir}/X11/%%T/%%N%%C%%S:%{_sysconfdir}/X11/%%L/%%T/%%N%%S:%{_sysconfdir}/X\11/%%l/%%T/%%N%%S:%{_sysconfdir}/X11/%%T/%%N%%S:%{_datadir}/X11/%%L/%%T/%%N%%C%%S:%{_datadir}/X1\1/%%l/%%T/%%N%%C%%S:%{_datadir}/X11/%%T/%%N%%C%%S:%{_datadir}/X11/%%L/%%T/%%N%%S:%{_datadir}/X11/%%\l/%%T/%%N%%S:%{_datadir}/X11/%%T/%%N%%S"

V=1 make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p -m 0755 $RPM_BUILD_ROOT%{_datadir}/X11/app-defaults
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

# adding to installed docs in order to avoid using %%doc magic
cp -p COPYING ${RPM_BUILD_ROOT}%{_datadir}/doc/%{base_name}/COPYING

%ldconfig_post
%ldconfig_postun

%files
%{_libdir}/libXt.so.6
%{_libdir}/libXt.so.6.0.0
%dir %{_datadir}/X11/app-defaults
# not using %%doc because of side-effect (#1001246)
%dir %{_docdir}/%{base_name}
%{_docdir}/%{base_name}/COPYING

%files devel
%{_docdir}/%{base_name}/*.xml
%{_includedir}/X11/CallbackI.h
%{_includedir}/X11/Composite.h
%{_includedir}/X11/CompositeP.h
%{_includedir}/X11/ConstrainP.h
%{_includedir}/X11/Constraint.h
%{_includedir}/X11/ConvertI.h
%{_includedir}/X11/Core.h
%{_includedir}/X11/CoreP.h
%{_includedir}/X11/CreateI.h
%{_includedir}/X11/EventI.h
%{_includedir}/X11/HookObjI.h
%{_includedir}/X11/InitialI.h
%{_includedir}/X11/Intrinsic.h
%{_includedir}/X11/IntrinsicI.h
%{_includedir}/X11/IntrinsicP.h
%{_includedir}/X11/Object.h
%{_includedir}/X11/ObjectP.h
%{_includedir}/X11/PassivGraI.h
%{_includedir}/X11/RectObj.h
%{_includedir}/X11/RectObjP.h
%{_includedir}/X11/ResConfigP.h
%{_includedir}/X11/ResourceI.h
%{_includedir}/X11/SelectionI.h
%{_includedir}/X11/Shell.h
%{_includedir}/X11/ShellI.h
%{_includedir}/X11/ShellP.h
%{_includedir}/X11/StringDefs.h
%{_includedir}/X11/ThreadsI.h
%{_includedir}/X11/TranslateI.h
%{_includedir}/X11/VarargsI.h
%{_includedir}/X11/Vendor.h
%{_includedir}/X11/VendorP.h
%{_includedir}/X11/Xtos.h
%{_libdir}/libXt.so
%{_libdir}/pkgconfig/xt.pc
%{_mandir}/man3/*.3*

%changelog
* Tue Jun  4 2019 Olivier Fourdan <ofourdan@redhat.com> - 1.1.5-12
- Bump version for gating



编译 libyaml ^yaml


RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/libyaml.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
~/rpmbuild/SPECS/libyaml.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name libyaml
%define tarballname yaml

#====================================================================#

Name:       local-%{base_name}
Version:    0.1.7
Release:    5%{?dist}
Summary:    YAML 1.1 parser and emitter written in C

Group:      System Environment/Libraries
License:    MIT
URL:        http://pyyaml.org/
Source0:    http://pyyaml.org/download/libyaml/%{tarballname}-%{version}.tar.gz
BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
YAML is a data serialization format designed for human readability and
interaction with scripting languages.  LibYAML is a YAML parser and
emitter written in C.


%package devel
Summary:   Development files for LibYAML applications
Group:     Development/Libraries
Requires:  local-libyaml = %{version}-%{release}, pkgconfig


%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use LibYAML.


%prep
%setup -q -n %{tarballname}-%{version}


%build
%configure
make %{?_smp_mflags}


%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} INSTALL="install -p" install
rm -f %{buildroot}%{_libdir}/*.{la,a}

soname=$(readelf -d %{buildroot}%{_libdir}/libyaml.so | awk '$2 == "(SONAME)" {print $NF}' | tr -d '[]')
rm -f %{buildroot}%{_libdir}/libyaml.so
echo "INPUT($soname)" > %{buildroot}%{_libdir}/libyaml.so


%check
make check


%ldconfig_scriptlets


%files
%license LICENSE
%doc README
%{_libdir}/%{base_name}*.so.*


%files devel
%doc doc/html
%{_libdir}/%{base_name}*.so
%{_libdir}/pkgconfig/yaml-0.1.pc
%{_includedir}/yaml.h


%changelog
* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.1.7-5
- Switch to %%ldconfig_scriptlets

编译 lcms2 ^lcms2

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/lcms2.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/lcms2.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name lcms2
Name:       local-%{base_name}
Version:        2.9
Release:        2%{?dist}
Summary:        Color Management Engine
License:        MIT
URL:            http://www.littlecms.com/
Source0:        http://www.littlecms.com/lcms2-%{version}.tar.gz

## upstream patches

BuildRequires:  local-libjpeg
BuildRequires:  local-libtiff
BuildRequires:  local-zlib

%description
LittleCMS intends to be a small-footprint, speed optimized color management
engine in open source form. LCMS2 is the current version of LCMS, and can be
parallel installed with the original (deprecated) lcms.

%package        utils
Summary:        Utility applications for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    utils
The %{name}-utils package contains utility applications for %{name}.

%package        devel
Summary:        Development files for LittleCMS
Requires:       %{name}%{?_isa} = %{version}-%{release}
Provides:       littlecms-devel = %{version}-%{release}

%description    devel
Development files for LittleCMS.

%prep
%setup -q -n %{base_name}-%{version}


%build
%configure --disable-static --program-suffix=2

# remove rpath from libtool
sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

make %{?_smp_mflags}

%install
make install DESTDIR=${RPM_BUILD_ROOT} INSTALL="install -p"

rm -fv ${RPM_BUILD_ROOT}%{_libdir}/lib*.la

# rename docs (for use with %%doc below)
cp -alf doc/LittleCMS2.?\ API.pdf api.pdf
cp -alf doc/LittleCMS2.?\ Plugin\ API.pdf plugin-api.pdf
cp -alf doc/LittleCMS2.?\ tutorial.pdf tutorial.pdf


%check
make check -k ||:


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%doc AUTHORS
%license COPYING
%{_libdir}/liblcms2.so.2*

%files utils
%{_bindir}/*
%{_mandir}/man1/*

%files devel
%doc api.pdf plugin-api.pdf tutorial.pdf
%{_includedir}/lcms2*.h
%{_libdir}/liblcms2.so
%{_libdir}/pkgconfig/lcms2.pc

%changelog
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

编译 lua ^lua

这个无需安装

https://www.lua.org/ftp/lua-5.3.4.tar.gz
tar -zxvf /opt/lua-5.3.4.tar.gz -C /usr/local/src
cd /usr/local/src/lua-5.3.4
sed -i -e "/^\TO_LIB/s/=.*/= liblua.a liblua.so/" /usr/local/src/lua-5.3.4/Makefile
sed -i -e "/^\CFLAGS/s/=.*/= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 \$(SYSCFLAGS) \$(MYCFLAGS) -fPIC/"  /usr/local/src/lua-5.3.4/src/Makefile
sed -i -e "/^LUA_SO/d" /usr/local/src/lua-5.3.4/src/Makefile
sed -i -e "/^LUA_A/a\LUA_SO= liblua.so" /usr/local/src/lua-5.3.4/src/Makefile
sed -i -e "/^\ALL_T/s/=.*/= \$(LUA_A) \$(LUA_T) \$(LUAC_T) \$(LUA_SO)/"  /usr/local/src/lua-5.3.4/src/Makefile
sed -i -e "/^\$(LUA_T)/i\$(LUA_SO): \$(CORE_O) \$(LIB_O)\n\t\$(CC) -o \$@ -shared \$? -ldl -lm" /usr/local/src/lua-5.3.4/src/Makefile
make -j4 linux
make -j4 linux install

cat > /usr/local/lib/pkgconfig/lua.pc << EOF
prefix=/usr/local
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
sharedlibdir=\${libdir}
includedir=\${prefix}/include

Name: lua
Description: lua
Version: 5.3.4

Requires:
Libs: -L\${libdir} -L\${sharedlibdir} -lz
Cflags: -I\${includedir}
EOF

chmod +x /usr/local/lib/liblua.so

编译 lynx ^lynx

RPM 制作

dnf install gcc make autoconf automake libtool rpmlint
rpmlint ~/rpmbuild/SPECS/lynx.spec

rpmbuild -ba \
--define "_prefix /usr/local" \
--define "_sysconfdir /usr/local/etc" \
~/rpmbuild/SPECS/lynx.spec

find /root/rpmbuild/BUILDROOT -mindepth 5 -maxdepth 5 -type f -o -type l -o -type d | grep "usr/local"
base_name、Version、setup
%global base_name lynx 
Name:       local-%{base_name}
%global devrel 1

Summary: A text-based Web browser

Version: 2.8.9
Release: 4%{?dist}
License: GPLv2
Group: Applications/Internet
Source: https://invisible-mirror.net/archives/lynx/tarballs/lynx%{version}rel.%{devrel}.tar.bz2
URL: http://lynx.browser.org/

# RH specific tweaks - directory layout, utf-8 by default, misc. configuration
Patch0: lynx-2.8.9-redhat.patch

# patch preparing upstream sources for rpmbuild, in particular for parallel make
Patch1: lynx-2.8.9-build.patch

# prompt user before executing command via a lynxcgi link even in advanced mode,
# as the actual URL may not be shown but hidden behind an HTTP redirect and set
# TRUSTED_LYNXCGI:none in lynx.cfg to disable all lynxcgi URLs by default
# [CVE-2008-4690]
Patch2: lynx-CVE-2008-4690.patch

# avoid build failure caused by mistakenly excluded <locale.h>
Patch3: lynx-2.8.8-locale.patch

# fix bugs detected by static analysis (#1602612)
Patch4: lynx-2.8.9-static-analysis.patch

# fix disclosure of HTTP auth credentials via SNI data (CVE-2021-38165)
Patch5: lynx-2.8.9-CVE-2021-38165.patch

Provides: webclient
Provides: text-www-browser
BuildRequires: local-dos2unix
BuildRequires: local-gcc
BuildRequires: local-gettext
BuildRequires: local-openssl
BuildRequires: local-ncurses
BuildRequires: local-slang
BuildRequires: telnet
BuildRequires: unzip
BuildRequires: zip
BuildRequires: local-zlib

# provides /usr/share/doc/HTML/en-US/index.html used as STARTFILE on RHEL
%if 0%{?rhel}
Requires: redhat-indexhtml
%endif

%description
Lynx is a text-based Web browser. Lynx does not display any images,
but it does support frames, tables, and most other HTML tags. One
advantage Lynx has over graphical browsers is speed; Lynx starts and
exits quickly and swiftly displays web pages.

%prep
%setup -q -n lynx2.8.9rel.%{devrel}

%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{base_name}-%{version}}
sed -e "s,^HELPFILE:.*,HELPFILE:file://localhost%{_pkgdocdir}/lynx_help/lynx_help_main.html,g" -i lynx.cfg
%if 0%{?rhel}
sed -e 's,^STARTFILE:.*,STARTFILE:file:/usr/share/doc/HTML/en-US/index.html,' -i lynx.cfg
%endif

%build
%configure --libdir=/etc            \
    --disable-font-switch           \
    --disable-rpath-hack            \
    --enable-addrlist-page          \
    --enable-charset-choice         \
    --enable-cgi-links              \
    --enable-cjk                    \
    --enable-debug                  \
    --enable-default-colors         \
    --enable-externs                \
    --enable-file-upload            \
    --enable-internal-links         \
    --enable-ipv6                   \
    --enable-japanese-utf8          \
    --enable-justify-elts           \
    --enable-locale-charset         \
    --enable-kbd-layout             \
    --enable-libjs                  \
    --enable-nls                    \
    --enable-nsl-fork               \
    --enable-persistent-cookies     \
    --enable-prettysrc              \
    --enable-read-eta               \
    --enable-scrollbar              \
    --enable-source-cache           \
    --enable-warnings               \
    --with-screen=ncursesw          \
    --with-ssl=%{_libdir}           \
    --with-zlib                     \
    ac_cv_path_RLOGIN=/usr/bin/rlogin

make -C po
make %{?_smp_mflags}

# remove zero-length tests files to silence rpmlint
rm -fv test/X test/nobody

%install
chmod -x samples/mailto-form.pl
make install DESTDIR=$RPM_BUILD_ROOT

# remove unneeded files with incompatible encoding
rm -f docs/{OS-390.announce,README.jp}
rm -f samples/*.bat

# convert line endings
dos2unix samples/lynx-demo.cfg
dos2unix samples/midnight.lss

# Install Lang dependent resources
mkdir -p $RPM_BUILD_ROOT/usr/share/locale/ja/LC_MESSAGES/

cat >$RPM_BUILD_ROOT%{_sysconfdir}/lynx-site.cfg <<EOF
# Place any local lynx configuration options (proxies etc.) here.
EOF

%find_lang %{base_name}

%files -f %{base_name}.lang
%doc docs README INSTALLATION samples
%doc test lynx.hlp lynx_help
%{_bindir}/lynx
%{_mandir}/*/*
%config(noreplace) %{_sysconfdir}/lynx.cfg
%config(noreplace) %{_sysconfdir}/lynx.lss
%config(noreplace,missingok) %{_sysconfdir}/lynx-site.cfg

%changelog
* Tue Aug 31 2021 Kamil Dudka <kdudka@redhat.com> - 2.8.9-4
- fix disclosure of HTTP auth credentials via SNI data (CVE-2021-38165)

编译安装 lz4 ^lz4

https://github.com/lz4/lz4/releases
tar -zxvf /opt/lz4-1.10.0.tar.gz -C /usr/local/src
cd /usr/local/src/lz4-1.10.0/build/cmake/
mkdir cmake-build
cd cmake-build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
make -j4 && make -j4 install

编译安装 lzo ^lzo

http://www.oberhumer.com/opensource/lzo/download/lzo-2.08.tar.gz
tar -zxvf /opt/lzo-2.08.tar.gz -C /usr/local/src
cd /usr/local/src/lzo-2.08
mkdir -p build
cd build
../configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath,/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib"
make -j4 && make -j4 install

posted @ 2026-09-01 19:29  NoYoWiFi  阅读(3)  评论(0)    收藏  举报