# http://ftp.rpm.org/max-rpm/s1-rpm-inside-scripts.html # https://rpm-software-management.github.io/rpm/manual/macros.html # https://rpm-packaging-guide.github.io/ %global _owner pgnd %global _lib_legacy %( echo %{_lib} | sed 's|64$||g' ) %global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc ) %global _dist .%{_build_timestamp}.%{_owner}.fc%{fedora} # https://stackoverflow.com/questions/47838041/rpmbuild-how-to-disable-check-buildroot # https://rpm-software-management.github.io/rpm/manual/dependency_generators.html # %%global __spec_install_pre /bin/true # %%global __arch_install_post %%{nil} # %%global __os_install_post %%{nil} %global _disable_source_fetch 0 %global debug_package %{nil} # %%undefine _auto_set_build_flags %global _hardened_build 1 # %%global __brp_mangle_shebangs %%{nil} # %%global __brp_strip %%{nil} # %%global __requires_exclude ^.*/xxx/bin/python.*$ # %%global __requires_exclude_from ^.*/xxx/bin/python.*$ # %%global _build_id_links none # %%bcond_with XXX : opt build with XXX; default, without # %%bcond_without XXX : opt build without XXX; default, with # %%bcond_without _hsm_frontend_svr # SOFTHSM2 # https://github.com/softhsm/SoftHSMv2 # https://src.fedoraproject.org/rpms/softhsm/raw/rawhide/f/softhsm.spec %global _hsm_name softhsm2 %global _hsm_pkgnm softhsm2 %global _hsm_unitnm softhsm2 %global _hsm_comment SoftHSM PKCS #11 cryptographic store %global _hsm_descrip %{expand: %{_hsm_comment}.} # https://spdx.org/licenses/BSD-3-Clause.html %global _license BSD-3-Clause %global _hsm_conf_dir /usr/local/etc/softhsm2 %global _hsm_install_dir /usr/local/softhsm2 %global _hsm_shlib_dir_r lib64 # https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/ # SOFTHSM2 # https://github.com/softhsm/SoftHSMv2 %global _hsm0_scm_repo softhsm/SoftHSMv2 # %%global _hsm0_scm_branch xxxx %global _hsm0_scm_branch develop %global _hsm0_scm_repo_esc %( echo %{_hsm0_scm_repo} | sed 's|_|-|g' | sed 's|/|%2F|g') %global _hsm0_scm_repo_norm %( echo %{_hsm0_scm_repo} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _hsm0_scm_branch_norm %( echo %{_hsm0_scm_branch} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _hsm0_scm_host https://github.com %global _hsm0_scm_host_api https://api.github.com/repos %global _hsm0_scm_url %{_hsm0_scm_host}/%{_hsm0_scm_repo} %global _hsm0_commit %( git ls-remote %{_hsm0_scm_url} | grep /%{_hsm0_scm_branch}$ | cut -f1 ) %global _hsm0_shortcommit %( c=%{_hsm0_commit}; echo ${c} | head -c 7 ) # https://docs.github.com/en/rest/repos/contents %global _hsm0_scm_tarball %{_hsm0_scm_host_api}/%{_hsm0_scm_repo}/tarball/%{_hsm0_commit} # !!NOTE!! GH API tarball extracts to: %global _hsm0_scm_extract_dir %{_hsm0_scm_repo_norm}-%{shortcommit0} %global forgeurl0 %{_hsm0_scm_url} %global commit0 %{_hsm0_commit} %global shortcommit0 %{_hsm0_shortcommit} %global forgesource0 %{_hsm0_scm_tarball} %global extractdir0 %{_hsm0_scm_extract_dir} %global forgesetupargs0 -T -D -b 0 -n %{extractdir0} %forgemeta -i -a %global dist %{_dist} # Vendor Pinning Vendor: %{_owner} # NEVRA (n-e:v-r.a) Name: %{_hsm_pkgnm} Epoch: 3 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ Version: %{scm0}_%( echo %{_hsm0_scm_branch} | sed 's|-|_|g' ) Release: 0%{?dist} # https://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/ %global _same_evr %{epoch}:%{version}-%{release} Summary: %{_hsm_comment} License: %{_license} URL: %{forgeurl0} Source0: %{forgesource0} BuildRequires: autoconf BuildRequires: automake BuildRequires: cppunit-devel BuildRequires: gcc-c++ BuildRequires: libtool BuildRequires: make BuildRequires: openssl-devel-engine BuildRequires: pkgconf BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(sqlite3) BuildRequires: p11-kit-devel Requires(pre): shadow-utils Requires: p11-kit Requires: openssl-libs Requires: /usr/bin/pkcs11-tool Provides: softhsm2 = %{_same_evr} Obsoletes: softhsm2 < %{_same_evr} Conflicts: softhsm %description %{_hsm_descrip} %prep echo '##### STARTING PREP #####' %forgesetup -a %build echo '##### STARTING BUILD #####' cd %{_builddir}/%{extractdir0} export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS chmod +x ./autogen.sh ./autogen.sh ./configure \ --prefix=%{_hsm_install_dir} \ --libdir=%{_hsm_install_dir}/%{_hsm_shlib_dir_r} \ --with-p11-kit=%{_hsm_install_dir}/share/p11-kit/modules/ \ --sysconfdir=%{_hsm_conf_dir} \ --enable-shared --disable-static \ --enable-64bit \ --with-openssl=%{_prefix} \ --with-objectstore-backend-db \ --with-sqlite3=%{_prefix} \ --enable-ecc \ --enable-eddsa \ --disable-fips \ --disable-gost \ --enable-visibility make V=0 -j${RPM_BUILD_NCPUS} %install echo '##### PATHS #####' echo "RPM_BUILD_ROOT: ${RPM_BUILD_ROOT}" echo 'BUILDDIR: %{_builddir}' echo 'BUILDROOT: %{buildroot}' # RPM_BUILD_ROOT: ${RPM_BUILD_ROOT} # BUILDDIR: /builddir/build/BUILD/softhsm2-git_develop-build # BUILDROOT: /builddir/build/BUILD/softhsm2-git_develop-build/BUILDROOT echo '##### STARTING INSTALL #####' cd %{_builddir}/%{extractdir0} make DESTDIR=%{buildroot} install cp \ ${RPM_BUILD_ROOT}/%{_hsm_conf_dir}/softhsm2.conf \ ${RPM_BUILD_ROOT}/%{_hsm_conf_dir}/softhsm2.conf.ORIG %pre %post -e %preun %postun %check %files # http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html %{_hsm_install_dir} %dir %attr(0500,root,root) %{_hsm_conf_dir}/ %config %attr(0400,root,root) %{_hsm_conf_dir}/softhsm2.conf %{_hsm_conf_dir}/softhsm2.conf.ORIG %{_hsm_conf_dir}/softhsm2.conf.sample %changelog * Sun Jan 26 2025 pgnd _ - bump 1737908160