Name:           redland
Version:        1.0.17
Release:        23
Summary:        RDF iprovids support for the Resource Description Framework.
License:        LGPL-2.1-or-later OR Apache-2.0
URL:            https://librdf.org/
Source0:        https://download.librdf.org/source/%{name}-%{version}.tar.gz

Patch0:         0001-Fix-unreachable-codes-break-after-return-mostly.patch
Patch6000:      0001-Add-Wunreachable-code.patch
Patch6001:      Fix-test-failed.patch

BuildRequires:  curl-devel gcc-c++ libtool-ltdl-devel libxml2-devel >= 2.4.0
BuildRequires:  perl-interpreter raptor2-devel rasqal-devel >= 0.9.26 
BuildRequires:  mariadb-connector-c-devel sqlite-devel libpq-devel

Obsoletes: redland-virtuoso < 1.0.17-8

%description
Redland is a set of free software C libraries that provide
support for the Resource Description Framework (RDF).

%package         devel
Summary:         Libraries when using redland to do some developments
Provides:        %{name}-static = %{version}-%{release}
Obsoletes:       %{name}-static = %{version}-%{release}
%description     devel
Libs when developing with Redland.

%package         mysql
Summary:         Redland MySQL storage
Requires:        %{name}-static = %{version}-%{release}
%description     mysql
Provides mysql as storage for in Redland

%package         pgsql
Summary:         Redland PostgreSQL storage 
Requires:        %{name}-static = %{version}-%{release}
%description     pgsql
Provides PostgreSQL as storage for in Redland

%package_help

%prep
%autosetup -p1 

%if "%{_libdir}" != "/usr/lib"
sed -i -e 's|"/lib /usr/lib|"%{_lib} %{_libdir}|' configure
%endif


%build
%define distrooptions --with-sqlite --with-mysql --with-postgresql

CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
%configure --enable-release --disable-static --without-bdb --with-sqlite --with-virtuoso=no %{distrooptions}

%make_build


%install
%make_install

%delete_la 

%check
make check

%files
%doc AUTHORS NEWS README NOTICE TODO
%license COPYING COPYING.LIB LICENSE.txt LICENSE-2.0.txt
%{_bindir}/rdfproc
%{_bindir}/redland-db-upgrade
%{_libdir}/librdf.so.0*
%dir %{_datadir}/redland
%{_datadir}/redland/mysql-v1.ttl
%{_datadir}/redland/mysql-v2.ttl
%dir %{_libdir}/redland
%{_libdir}/redland/librdf_storage_sqlite.so

%files devel
%doc ChangeLog RELEASE.html
%{_bindir}/redland-config
%{_datadir}/redland/Redland.i
%{_datadir}/gtk-doc/*
%{_includedir}/*.h
%{_libdir}/librdf.so
%{_libdir}/pkgconfig/redland.pc

%files mysql
%{_libdir}/redland/librdf_storage_mysql.so

%files pgsql
%{_libdir}/redland/librdf_storage_postgresql.so

%files help 
%doc FAQS.html LICENSE.html NEWS.html README.html TODO.html
%{_mandir}/man1/redland-config.1*
%{_mandir}/man1/redland-db-upgrade.1*
%{_mandir}/man1/rdfproc.1*
%{_mandir}/man3/redland.3*

%changelog
* Fri May 30 2025 Funda Wang <fundawang@yeah.net> - 1.0.17-23
- build with connectors rather than server devel packages
- cleanup spec

* Fri Jul 12 2024 yaoxin <yao_xin001@hoperun.com> - 1.0.17-22
- Fix test failed

* Tue Mar 19 2024 xu_ping <707078654@qq.com> -   1.0.17-21
- drop libdb dependency from redland

* Tue Jul 18 2023 caofei <caofei@xfusion.com> -   1.0.17-20
- Add -Wunreachable-code

* Tue Jan 17 2023 caofei <caofei@xfusion.com> -   1.0.17-19
- Fix unreachable codes - break after return mostly

* Sat Mar 5 2022  duyiwei <duyiwei@kylinos.cn> - 1.0.17-18 
- add support of sqlite and mariadb

* Sun Dec 1 2019  jiaxiya <jiaxiyajiaxiya@168.com> - 1.0.17-17 
- Package init