openhitls/openhitls.spec
xuhuiyue 695a980c9f Update patch
Signed-off-by: xuhuiyue <xuhuiyue@huawei.com>
(cherry picked from commit 1cae02f84d65c32a283141bf1a44c04e2df97c3b)
2024-12-12 09:37:16 +08:00

118 lines
3.1 KiB
RPMSpec

# spec file for package openHiTLS
#
# Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
#
Name: openhitls
Summary: Cryptography and SSL/TLS Toolkit
Version: 0.1.0
Release: 3
License: Mulan PSL V2
URL: https://www.openhitls.net/
Source0: https://raw.gitcode.com/openHiTLS/openHiTLS/archive/refs/heads/%{name}-%{version}.tar.gz
# Add all patch files in order
Patch0: 0001-provider_revise.patch
Patch1: 0002-param_revise.patch
Patch2: 0003-add-default-user-id-using-tlcp.patch
Patch3: 0004-init-add-const.patch
Patch4: 0005-add-uio_mem-comment.patch
Patch5: 0006-Rename-Refactor-some-code.patch
Patch6: 0007-provider-document.patch
Patch7: 0008-fix-some-bugs.patch
Patch8: 0009-add-github-action-for-openhitls-0.1-branch.patch
Patch9: 0010-Rename-get-time-cmd.patch
Patch10: 0011-fix-the-possible-CBC-Padding-Oracle-vulnerability.patch
BuildRoot: %{_tmppath}/%{name}-v%{release}-build
BuildRequires: gcc cmake make rpm libboundscheck
Requires: glibc libboundscheck
%description
openHiTLS is an efficient and agile open-source SDK of Cryptography
and TLS Transport Layer Security (TLS).
%package devel
Summary: Development kits for openHiTLS
%description devel
%{summary}.
%prep
%autosetup -n %{name}-%{version} -p1
%build
openhitls_build_platform=%{_os}-%{_target_cpu}
%ifarch i686
build_arch=x86
%endif
%ifarch x86_64
build_arch=x8664
%endif
%ifarch aarch64
build_arch=armv8
%endif
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wa,--noexecstack -Wa,--generate-missing-build-notes=yes $RPM_LD_FLAGS"
mkdir build
cd build
python3 ../configure.py --enable hitls_bsl hitls_crypto hitls_tls hitls_pki \
--lib_type shared --bits=64 --system=linux --asm_type $build_arch \
--add_options="$RPM_OPT_FLAGS"
cmake ..
make -j 16
%install
# Install openHiTLS
install -d %{buildroot}/%{_libdir}
install build/libhitls_bsl.so %{buildroot}/%{_libdir}/
install build/libhitls_crypto.so %{buildroot}/%{_libdir}/
install build/libhitls_tls.so %{buildroot}/%{_libdir}/
install build/libhitls_pki.so %{buildroot}/%{_libdir}/
install -d %{buildroot}/%{_includedir}/openhitls
install include/bsl/* %{buildroot}/%{_includedir}/openhitls/
install include/crypto/* %{buildroot}/%{_includedir}/openhitls/
install include/tls/* %{buildroot}/%{_includedir}/openhitls/
%check
cd testcode/demo
mkdir -p build
cd build
cmake ..
make -j 16
executales=$(find ./ -maxdepth 1 -type f -perm -a=x )
for e in $executales
do
if [[ ! "$e" == *"client"* ]] && [[ ! "$e" == *"server"* ]]; then
echo "${e} start"
eval "${e}"
fi
done
# run server and client in order.
./server >/dev/null &
sleep 1
./client
%files devel
%defattr(-,root,root)
%{_includedir}/openhitls
%{_libdir}/libhitls_bsl.so
%{_libdir}/libhitls_crypto.so
%{_libdir}/libhitls_tls.so
%{_libdir}/libhitls_pki.so
%license LICENSE
%license Third_Party_Open_Source_Software_Notice
%doc README.md
%doc README-zh.md
%changelog
* Wed Dec 11 2024 xuhuiyue <xuhuiyue@huawei.com> - 0.1.0-3
- Package update
* Wed Nov 27 2024 xuhuiyue <xuhuiyue@huawei.com> - 0.1.0-2
- Package update
* Thu Nov 14 2024 xuhuiyue <xuhuiyue@huawei.com> - 0.1.0-1
- Package init