File swipl.spec of Package swipl

#
# spec file for package swipl, for use with Pharos
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%define version_unconverted 8.4.1
%define sover 8
Name:           swipl
Version:        8.4.1
Release:        0
Summary:        SWI Prolog compiler
License:        GPL-2.0-or-later AND LGPL-2.1-or-later
Group:          Development/Languages/Other
URL:            http://www.swi-prolog.org
Source0:        %{name}-%{version}.tar.gz
Patch0:         use-lib64.patch
BuildRequires:  cmake
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  libunwind-devel
BuildRequires:  freetype2-devel
%if 0%{?sle_version} == 150300 && 0%{?is_opensuse}
BuildRequires:  gcc10-c++
%else
BuildRequires:  gcc-c++
%endif
BuildRequires:  gmp-devel
BuildRequires:  gperftools-devel
BuildRequires:  java-11-openjdk-devel
BuildRequires:  junit
BuildRequires:  libICE-devel
BuildRequires:  libjpeg8-devel
BuildRequires:  libSM-devel
BuildRequires:  libX11-devel
BuildRequires:  libXaw-devel
BuildRequires:  libXext-devel
BuildRequires:  libXft-devel
BuildRequires:  libXinerama-devel
BuildRequires:  libXmu-devel
BuildRequires:  libXpm-devel
BuildRequires:  libXrender-devel
BuildRequires:  libXt-devel
BuildRequires:  ncurses-devel
BuildRequires:  openssl-devel
BuildRequires:  readline-devel
BuildRequires:  libedit-devel
BuildRequires:  unixODBC-devel
BuildRequires:  db-devel
BuildRequires:  zlib-devel
BuildRequires:  uuid-devel
BuildRequires:  libarchive-devel
BuildRequires:  libyaml-devel
BuildRequires:  pcre-devel
BuildRequires:  libqt5-qtbase-devel

%description
SWI-Prolog offers a comprehensive free Prolog environment. Since its start
in 1987, SWI-Prolog development has been driven by the needs of real world
applications. SWI-Prolog is widely used in research and education as well
as commercial applications.

%package -n swi-prolog
Summary:        SWI Prolog compiler
Group:          Development/Languages/Other
Requires:       swi-prolog-nox = %{version}

%description -n swi-prolog
SWI-Prolog offers a comprehensive free Prolog environment. Since its start
in 1987, SWI-Prolog development has been driven by the needs of real world
applications. SWI-Prolog is widely used in research and education as well
as commercial applications.

%package -n swi-prolog-nox
Summary:        Libraries for SWI Prolog that do not require X
Group:          System/Libraries

%description -n swi-prolog-nox
SWI-Prolog offers a comprehensive free Prolog environment. Since its start
in 1987, SWI-Prolog development has been driven by the needs of real world
applications. SWI-Prolog is widely used in research and education as well
as commercial applications.

This subpackage contains the runtime library needed for SWI Prolog and
other projects.

%package -n swi-prolog-x
Summary:        GUI for SWI Prolog using X
Group:          System/Libraries
Requires:       swi-prolog = %{version}

%description -n swi-prolog-x
SWI-Prolog offers a comprehensive free Prolog environment. Since its start
in 1987, SWI-Prolog development has been driven by the needs of real world
applications. SWI-Prolog is widely used in research and education as well
as commercial applications.

This subpackage contains the GUI for SWI Prolog.

%package -n swi-prolog-win
Summary:        Qt GUI for SWI Prolog
Group:          System/Libraries
Requires:       swi-prolog = %{version}
Requires:       swi-prolog-x = %{version}

%description -n swi-prolog-win
Qt GUI for SWI Prolog

%package -n swi-prolog-doc
Summary:        Documentation files for SWI Prolog
Group:          Development/Languages/Other

%description -n swi-prolog-doc
Documentation files for the SWI Prolog library.

%package -n swi-prolog-demo
Summary:        Demo files for SWI Prolog
Group:          Development/Languages/Other
Requires:       swi-prolog = %{version}

%description -n swi-prolog-demo
Demo files for the SWI Prolog library.

%package -n swi-prolog-devel
Summary:        Development files for SWI Prolog
Group:          Development/Languages/Other
Requires:       swi-prolog = %{version}

%description -n swi-prolog-devel
Development files for the SWI Prolog library.

%package -n swi-prolog-java
Summary:        Java interface files for SWI Prolog
Group:          Development/Languages/Other
Requires:       swi-prolog = %{version}

%description -n swi-prolog-java
Java interface files for the SWI Prolog library.

%prep
%setup -q -n %{name}-%{version}
#setup -c -q
%patch0 -p1

%build
%define __builder ninja
%if 0%{?sle_version} == 150300 && 0%{?is_opensuse}
# perform Leap 15.3
export CC=gcc-10
export CXX=g++-10
%else
# e.g. tumbleweed
export CC=gcc
export CXX=g++
%endif
%cmake \
    -DSWIPL_INSTALL_IN_LIB=YES \
    -DSWIPL_INSTALL_IN_SHARE=YES \
    -DCXX_STANDARD="14" \
    -DCXX_STANDARD_REQUIRED="ON" \
    -DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=1' \
    -DCMAKE_C_COMPILER=$CC \
    -DCMAKE_CXX_COMPILER=$CXX

%cmake_build

%install
%cmake_install

%post -n swi-prolog-nox -p /sbin/ldconfig
%postun -n swi-prolog-nox -p /sbin/ldconfig

%files -n swi-prolog
%license LICENSE
%doc README.md Code-of-Conduct.md
%{_bindir}/swipl
%{_bindir}/swipl-ld

%files -n swi-prolog-nox
%{_libdir}/libswipl.so.*
%dir %{_libdir}/swipl/
%{_libdir}/swipl/LICENSE
%{_libdir}/swipl/README.md
%{_libdir}/swipl/*.rc
%{_libdir}/swipl/*.home
%dir %{_libdir}/swipl/bin/
%{_libdir}/swipl/bin/latex2html
%{_libdir}/swipl/bin/swipl.home
%{_libdir}/swipl/boot.prc
%dir %{_libdir}/swipl/boot/
%{_libdir}/swipl/boot/*.pl
%dir %{_libdir}/swipl/customize/
%{_libdir}/swipl/customize/README.md
%{_libdir}/swipl/customize/edit
%{_libdir}/swipl/customize/*.pl
%dir %{_libdir}/swipl/library/
%{_libdir}/swipl/library/*
%dir %{_libdir}/swipl/lib
%dir %{_libdir}/swipl/lib/x86_64-linux/
%{_libdir}/swipl/lib/x86_64-linux/*.so
%dir %{_libdir}/swipl/lib/swiplserver/
%{_libdir}/swipl/lib/swiplserver/LICENSE
%{_libdir}/swipl/lib/swiplserver/__init__.py
%{_libdir}/swipl/lib/swiplserver/prologmqi.p

%files -n swi-prolog-win
%{_bindir}/swipl-win

%files -n swi-prolog-x
%dir %{_libdir}/swipl/xpce/
%{_libdir}/swipl/xpce/*

%files -n swi-prolog-demo
%dir %{_libdir}/swipl/demo/
%{_libdir}/swipl/demo/README.md
%{_libdir}/swipl/demo/*.pl

%files -n swi-prolog-doc
%{_mandir}/man1/swipl*
%dir /usr/share/swipl
%dir /usr/share/swipl/doc
/usr/share/swipl/doc/manindex.db
%dir /usr/share/swipl/doc/Manual
/usr/share/swipl/doc/Manual/*.html
/usr/share/swipl/doc/Manual/*.gif
/usr/share/swipl/doc/Manual/*.png
%dir /usr/share/swipl/doc/packages
/usr/share/swipl/doc/packages/*.html
/usr/share/swipl/doc/packages/*.png

%files -n swi-prolog-devel
#{_includedir}/z3*.h
%{_libdir}/libswipl.so
%dir %{_libdir}/swipl/include/
%{_libdir}/swipl/include/*.h
%dir %{_libdir}/swipl/include/Yap
%{_libdir}/swipl/include/Yap/*.h
%dir %{_libdir}/swipl/include/sicstus
%{_libdir}/swipl/include/sicstus/*.h
%dir %{_libdir}/cmake/swipl/
%{_libdir}/cmake/swipl/*.cmake
/usr/share/pkgconfig/swipl.pc
%dir /usr/share/swipl/doc/packages/examples
/usr/share/swipl/doc/packages/examples/*

%files -n swi-prolog-java
%dir %{_libdir}/swipl/
%dir %{_libdir}/swipl/lib
%{_libdir}/swipl/lib/*.jar

%changelog
openSUSE Build Service is sponsored by