File swipl.spec of Package swipl

# spec file for package swipl
# Copyright (c) 2017 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

Name:           swipl
Version:        7.4.1
Release:        0
Summary:        Prolog Compiler
License:        GPL-2.0+ and LGPL-2.1+
Group:          Development/Languages/Other
Source98:       swipl-rpmlintrc
# For SOURCE_DATE_EPOCH variable- reproducible builds
Source99:       %{name}.changes
# PATCH-FIX-OPENSUSE swipl-ppc64.patch - Fix configure on PowerPC architecture
Patch0:         swipl-ppc64.patch
# PATCH-FIX-UPSTREAM pkgconfig.patch - Fix location of include files in pkgconfig file
Patch1:         pkgconfig.patch
# PATCH-FEATURE-UPSTREAM reproducible-builds.patch - and
Patch2:         reproducible-builds.patch
# PATCH-FIX-UPSTREAM fix-implicit-fortify-decl.patch -
Patch3:         fix-implicit-fortify-decl.patch
Patch4:         no-timestamps.patch
BuildRequires:  db-devel
BuildRequires:  fdupes
BuildRequires:  freetype2-devel
BuildRequires:  gcc-c++
BuildRequires:  gmp-devel
BuildRequires:  java-devel >= 1.7.0
BuildRequires:  libarchive-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libunwind-devel
BuildRequires:  ncurses-devel
BuildRequires:  pkgconfig
BuildRequires:  readline-devel
BuildRequires:  unixODBC-devel
BuildRequires:  pkgconfig(ice)
BuildRequires:  pkgconfig(libedit)
BuildRequires:  pkgconfig(libssl)
BuildRequires:  pkgconfig(ossp-uuid)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xft)
BuildRequires:  pkgconfig(xinerama)
BuildRequires:  pkgconfig(xpm)
BuildRequires:  pkgconfig(xrender)
BuildRequires:  pkgconfig(xt)
# For %%check
BuildRequires:  junit
Provides:       swi-prolog = %{version}
Provides:       swi_pl = %{version}
Obsoletes:      swi-prolog < %{version}
Obsoletes:      swi_pl < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Edinburgh-style Prolog compiler including modules, autoload, libraries,
Garbage collector, stack expandor, C interface, GNU readline and GNU
Emacs interface, a very fast compiler,and an X11 interface using XPCE.

%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

export SOURCE_DATE_EPOCH="$(sed -n '/^----/n;s/ - .*$//;p;q' %{SOURCE99} | date -u -f - +%%s)"
%configure --with-world
make %{?_smp_mflags}

make %{?_smp_mflags} check

make DESTDIR=%{buildroot} install-world

# Fix installation of documentation
mkdir -p %{buildroot}%{_docdir}
mv -v %{buildroot}%{_libdir}/%{name}-%{version}/doc  %{buildroot}%{_docdir}/%{name}-%{version}
mv -v %{buildroot}%{_libdir}/%{name}-%{version}/demo %{buildroot}%{_docdir}/%{name}-%{version}
ln -s %{_docdir}/%{name}-%{version} %{buildroot}%{_libdir}/%{name}-%{version}/doc
ln -s %{_docdir}/%{name}-%{version} %{buildroot}%{_libdir}/%{name}-%{version}/demo

# Fix script
chmod +x %{buildroot}%{_libdir}/swipl-%{version}/library/dialect/sicstus/
sed -i "s@%{_bindir}/../{_bindir}/swipl@" %{buildroot}%{_docdir}/%{name}-%{version}/packages/examples/pldoc/

# Create common symlink for "pl"
ln -s swipl %{buildroot}%{_bindir}/pl

%fdupes %{buildroot}/%{_libdir}/%{name}-%{version}
%fdupes %{buildroot}/%{_docdir}/%{name}-%{version}

%license LICENSE
%doc %{_docdir}/%{name}-%{version}