File ncbi-vdb.spec of Package ncbi-vdb
#
# spec file for package ncbi-vdb
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: ncbi-vdb
Version: 3.0.2
Release: 0
Summary: VDB database engine for SRA
License: SUSE-Public-Domain
Group: Productivity/Scientific/Other
URL: https://github.com/ncbi/ncbi-vdb
Source: https://github.com/ncbi/ncbi-vdb/archive/refs/tags/%{version}.tar.gz#/ncbi-vdb-%{version}.tar.gz
BuildRequires: chrpath
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: file-devel
BuildRequires: gcc-c++
BuildRequires: hdf5-devel
BuildRequires: libbz2-devel
BuildRequires: libxml2-devel
BuildRequires: libzstd-devel
BuildRequires: mbedtls-devel
ExclusiveArch: x86_64 aarch64 %{arm}
%description
The (US) National Center for Biotechnology Information (NCBI)'s
Virtual/Vertical Database (VDB) is a highly compressed column-oriented
data warehousing technology developed initially to address the needs
of the Sequence Read Archive (SRA).
%package devel
Summary: Development files for ncbi-vdb
Group: Development/Languages/C and C++
Requires: libbz2-devel
Requires: libncbi-vdb = %{version}
Requires: libxml2-devel
Requires: libzstd-devel
Requires: mbedtls-devel
%description devel
Header files for ncbi-vdb development.
%package -n libncbi-vdb
Summary: NCBI vdb shared libraries
Group: System/Libraries
%description -n libncbi-vdb
Header files for ncbi-vdb development.
%prep
%autosetup -p1
# Unvendor system libraries
sed -i -e '/add_subdirectory(ext).*/ d' -e 's/ ext / /' libs/CMakeLists.txt test/CMakeLists.txt
sed -i -e '/mbed.*/ d' -e '/bz2/ d' -e '/zstd/ d' -e '/\bz\b/ d' libs/ncbi-vdb/CMakeLists.txt
sed -i -e 's/;dl;/;dl;bz2;zstd;z;mbedtls;mbedcrypto;mbedx509;/' libs/ncbi-vdb/CMakeLists.posix.txt
sed -i -e '/COMMON_LIBS_/ s/ncbi-.*vdb/\0-shared/' test/CMakeLists.txt
sed -i -e 's/vdb_mbed/mbed/g' -e 's/vdb_ ## func_name/func_name/' libs/{krypto,kns,cloud}/*.c
sed -i -e '/#include/ s@ext/@@' libs/*/*.c
rm -Rf libs/ext
rm -Rf interfaces/ext
# Disable installation of static libraries
find . -iname \*CMakeLists\*.txt -print -exec sed -i '/ExportStatic/ s/ true / false /' '{}' \+
# Fixup arm64/aarch64 confusion
cp -R interfaces/cc/gcc/arm64 interfaces/cc/gcc/aarch64
%build
export CFLAGS="-DH5_USE_18_API %{optflags}"
%cmake \
-DINST_BINDIR=%{_bindir} \
-DINST_LIBDIR=%{_libdir} \
-DINST_INCDIR=%{_includedir}/ncbi-vdb/interfaces \
-DLIBS_ONLY:BOOL=ON \
%{nil}
%cmake_build
%install
%cmake_install
rm -Rf %{buildroot}/%{_includedir}/ncbi-vdb/interfaces/os/sun
rm -Rf %{buildroot}/%{_includedir}/ncbi-vdb/interfaces/cc/vc++
rm -Rf %{buildroot}/%{_includedir}/ncbi-vdb/interfaces/cc/cc
%fdupes %{buildroot}/%{_includedir}
chrpath --delete %{buildroot}/%{_libdir}/lib*.so.*
%post -n libncbi-vdb -p /sbin/ldconfig
%postun -n libncbi-vdb -p /sbin/ldconfig
%files -n libncbi-vdb
%{_libdir}/*.so.*
%files devel
%{_libdir}/*.so
%{_includedir}/ncbi-vdb
%license LICENSE
%doc README.md CHANGES.md
%changelog