File libpostal.spec of Package libpostal

#
# spec file for package libpostal
#
# Copyright (c) 2021 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:           libpostal
Version:        1.1.0+git53.g9e5af6b
Release:        0
Summary:        A C library for parsing/normalizing street addresses
License:        MIT
URL:            https://github.com/openvenues/libpostal
Source:         %{name}-%{version}.tar.gz
Group:          Development/Libraries/Other
BuildRequires:  gcc-c++
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
libpostal is a C library for parsing/normalizing street addresses around the
world using statistical NLP and open data. The goal of this project is to
understand location-based strings in every language, everywhere.

%package -n %{name}1
Summary:        A C library for parsing/normalizing street addresses
Provides:       %{name} = %{version}-%{release}
Obsoletes:      %{name} < %{version}-%{release}

%description -n %{name}1
libpostal is a C library for parsing/normalizing street addresses around the
world using statistical NLP and open data. The goal of this project is to
understand location-based strings in every language, everywhere.

%package devel
Summary:        Development files for the postal library
Group:          Development/Libraries/C and C++
Provides:       %{name}-devel = %{version}-%{release}
Requires:       %{name}1 = %{version}

%description devel
This package contains the headers needed to build against
the postal library.


%package devel-static
Summary:        Static library for postal
Group:          Development/Libraries/C and C++
Provides:       %{name}-devel:%{_libdir}/%{name}.a
Requires:       %{name}-devel = %{version}


%description devel-static
This subpackage contains the static version of the library
used for development.


%prep
%autosetup -p1

%build
autoreconf -fiv --warning=no-portability

export CFLAGS="$CFLAGS -fPIC -ffat-lto-objects -lstdc++ %{optflags} -pthread -Wno-incompatible-pointer-types"
export CXXFLAGS="$CXXFLAGS -fPIC -ffat-lto-objects %{optflags} -pthread -Wno-incompatible-pointer-types"

./configure \
    --host=%{_host} \
    --build=%{_build} \
	  --target=%{_target_platform} \
	  --program-prefix=%{?_program_prefix} \
 	  --prefix=%{_prefix} \
	  --exec-prefix=%{_exec_prefix} \
	  --bindir=%{_bindir} \
	  --sbindir=%{_sbindir} \
	  --sysconfdir=%{_sysconfdir} \
	  --datadir=%{_datadir}/%{name} \
	  --includedir=%{_includedir} \
	  --libdir=%{_libdir} \
	  --libexecdir=%{_libexecdir} \
	  --localstatedir=%{_localstatedir} \
	  --sharedstatedir=%{_sharedstatedir} \
	  --mandir=%{_mandir} \
	  --infodir=%{_infodir} \
    --enable-static \
    --enable-shared \
%ifarch aarch64 armv7hl
    --disable-sse2 \
%endif
%ifarch armv7hl
    --with-cflags-scanner-extra=-marm \
%endif
    --disable-data-download

%{__make} %{?_smp_mflags}

%install
%make_install
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_docdir}/%{name}
#empty dependecy_libs
find %{buildroot} -type f -name "*.la" -delete -print

%post -n %{name}1 -p /sbin/ldconfig
%postun -n %{name}1 -p /sbin/ldconfig

%files -n %{name}1
%license LICENSE
%{_datadir}/%{name}
%{_bindir}/%{name}_data
%{_libdir}/%{name}.so.*

%files devel
%doc README.md
%dir %{_docdir}/%{name}/
%dir %{_includedir}/%{name}/
%{_includedir}/%{name}/%{name}.h
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc

%files devel-static
%{_libdir}/%{name}.a

%changelog

openSUSE Build Service is sponsored by