openhitls/openhitls.spec
xuhuiyue 68392df07c Update tar
Signed-off-by: xuhuiyue <xuhuiyue@huawei.com>
(cherry picked from commit 953e22989f7054b8ee8b8ada7d302a38126b6832)
2024-11-27 18:34:09 +08:00

103 lines
2.5 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: 2
License: Mulan PSL V2
URL: https://www.openhitls.net/
Source0: https://raw.gitcode.com/openHiTLS/openHiTLS/archive/refs/heads/%{name}-%{version}.tar.gz
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 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