850fbc2
Name:           edflib
ac14395
Version:        1.21
850fbc2
# Upstream has been encouraged to provide a shared library with proper ABI
850fbc2
# versioning (https://gitlab.com/Teuniz/EDFlib/-/issues/6#note_732772193).
850fbc2
#
850fbc2
# For now, we must make do with downstream .so name versioning
850fbc2
# (https://docs.fedoraproject.org/en-US/packaging-guidelines/#_downstream_so_name_versioning).
850fbc2
# Make sure to increment the following integer each time there is an ABI change
850fbc2
# upstream.
850fbc2
%global downstream_so_number 1
850fbc2
Release:        %autorelease
850fbc2
Summary:        C/C++ library to read/write EDF+ and BDF+ files
850fbc2
850fbc2
# The entire source is BSD, except for the contents of unittest/, which are
850fbc2
# GPLv3+ (but do not contribute to the installed contents of the binary RPMs).
850fbc2
License:        BSD
850fbc2
URL:            https://gitlab.com/Teuniz/EDFlib/
850fbc2
%global tar_version %(echo '%{version}' | tr -d .)
850fbc2
Source0:        https://www.teuniz.net/edflib/edflib_%{tar_version}.tar.gz
850fbc2
# Upstream intends this library primarily as a copylib. The following is based
850fbc2
# on a sample Makefile from
850fbc2
# https://gitlab.com/Teuniz/EDFlib/-/issues/6#note_628056608, with
850fbc2
# modifications to pass LDFLAGS and to implement downstream .so name
850fbc2
# versioning.
850fbc2
Source1:        Makefile
850fbc2
850fbc2
# Add support for big-endian platforms (fixes #9)
850fbc2
# https://gitlab.com/Teuniz/EDFlib/-/merge_requests/1
850fbc2
# See also: https://gitlab.com/Teuniz/EDFlib/-/issues/9
41b780d
#
41b780d
# Since upstream decided against supporting big-endian platforms, this patch is
41b780d
# applied *only* on s390x to keep the other architectures closer to upstream.
850fbc2
Patch0:         0001-Add-support-for-big-endian-platforms.patch
850fbc2
850fbc2
BuildRequires:  make
850fbc2
BuildRequires:  gcc
850fbc2
850fbc2
%global common_description %{expand: \
850fbc2
EDFlib is a programming library for C/C++ for reading and writing EDF+ and BDF+
850fbc2
files. It also reads “old style” EDF and BDF files. EDF means European Data
850fbc2
Format. BDF is the 24-bits version of EDF.
850fbc2
850fbc2
Documentation is available at https://www.teuniz.net/edflib/index.html.}
850fbc2
850fbc2
%description
850fbc2
%common_description
850fbc2
850fbc2
Documentation is available at https://www.teuniz.net/edflib/index.html.
850fbc2
850fbc2
850fbc2
%package devel
850fbc2
Summary:        Development files for edflib
850fbc2
Requires:       edflib%{?_isa} = %{version}-%{release}
850fbc2
850fbc2
%description devel
850fbc2
%common_description
850fbc2
850fbc2
The edflib-devel package contains libraries and header files for developing
850fbc2
applications that use edflib.
850fbc2
850fbc2
d80debb
%ldconfig_scriptlets
d80debb
d80debb
850fbc2
%prep
41b780d
%setup -n edflib_%{tar_version} -q
41b780d
%ifarch s390x
41b780d
%patch0 -p1
41b780d
%endif
850fbc2
cp -p '%{SOURCE1}' Makefile.shared
850fbc2
850fbc2
850fbc2
%build
850fbc2
%set_build_flags
850fbc2
%make_build -f Makefile.shared DOWNSTREAM_SO_NUMBER='%{downstream_so_number}'
850fbc2
%make_build -C unittest CC="${CC-gcc}" \
850fbc2
    CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE ${LDFLAGS}"
850fbc2
850fbc2
850fbc2
%install
850fbc2
%make_install -f Makefile.shared \
850fbc2
    DOWNSTREAM_SO_NUMBER='%{downstream_so_number}' \
850fbc2
    PREFIX='%{_prefix}' \
850fbc2
    INCLUDEDIR='%{_includedir}' \
850fbc2
    LIBDIR='%{_libdir}'
850fbc2
850fbc2
%check
850fbc2
./unittest/edflib_test
850fbc2
850fbc2
850fbc2
%files
850fbc2
%license LICENSE
850fbc2
%doc README.md
850fbc2
%{_libdir}/libedf.so.0.%{downstream_so_number}
850fbc2
850fbc2
850fbc2
%files devel
850fbc2
%{_includedir}/edflib.h
850fbc2
%{_libdir}/libedf.so
850fbc2
850fbc2
850fbc2
%changelog
850fbc2
%autochangelog