File guile1.spec of Package guile1

#
# spec file for package guile1
#
# Copyright (c) 2023 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/
#


%define guilemaj    2
%define guilemin    2
%define guilevers   %{guilemaj}.%{guilemin}
%define libgver     1
%define gsuff       %{guilemaj}_%{guilemin}-%{libgver}
Name:           guile1
Version:        2.2.6
Release:        0
Summary:        GNU's Ubiquitous Intelligent Language for Extension
License:        GFDL-1.3-only AND GPL-3.0-or-later AND LGPL-3.0-or-later
Group:          Development/Languages/Scheme
URL:            https://www.gnu.org/software/guile/
Source0:        guile-%{version}.tar.xz
#Source1:        https://ftp.gnu.org/gnu/guile/guile-%%{version}.tar.xz.sig
Source2:        https://savannah.gnu.org/project/memberlist-gpgkeys.php?group=guile&download=1#/guile.keyring
Source3:        %{name}-rpmlintrc
# Fix the resulting /usr/lib64/pkgconfig/guile-2.2.pc
Patch0:         guile-2.2-gc_pkgconfig_private.patch
# test fails always with heap error
Patch1:         disable-test-out-of-memory.patch
BuildRequires:  flex
BuildRequires:  gmp-devel
BuildRequires:  libffi-devel
BuildRequires:  libltdl-devel
BuildRequires:  libunistring-devel
BuildRequires:  makeinfo
BuildRequires:  pkgconfig
BuildRequires:  readline-devel
BuildRequires:  pkgconfig(bdw-gc)
Requires(pre):  fileutils
Requires(pre):  sh-utils

%description
This package is to enable lilypond >= 2.24 to build for SLE and Leap
distributions due to CVE-2020-17354 and will be deleted when no longer
needed. It is installable alongside the normal guile executable.
This is Guile, a portable, embeddable Scheme implementation written in
C. Guile provides a machine independent execution platform that can be
linked in as a library when building extensible programs.

%package -n libguile-%{gsuff}
Summary:        GNU's Ubiquitous Intelligent Language for Extension
License:        GFDL-1.3-only AND GPL-3.0-or-later AND LGPL-3.0-or-later
Group:          Development/Languages/Scheme
Requires:       %{name}-modules-%{guilemaj}_%{guilemin} >= %{version}
# workaround for bnc#948804
Requires:       glibc-locale

%description -n libguile-%{gsuff}
This is Guile, a portable, embeddable Scheme implementation written in
C. Guile provides a machine independent execution platform that can be
linked in as a library when building extensible programs. This package
contains the shared libraries.

%package modules-%{guilemaj}_%{guilemin}
Summary:        GNU's Ubiquitous Intelligent Language for Extension
License:        GFDL-1.3-only AND GPL-3.0-or-later AND LGPL-3.0-or-later
Group:          Development/Languages/Scheme

%description modules-%{guilemaj}_%{guilemin}
This is Guile, a portable, embeddable Scheme implementation written in
C. Guile provides a machine independent execution platform that can be
linked in as a library when building extensible programs. This package
contains guile modules.

%package -n lib%{name}-devel
Summary:        GNU's Ubiquitous Intelligent Language for Extension
License:        LGPL-2.1-or-later
Group:          Development/Languages/Scheme
Conflicts:      guile-devel
Requires:       gmp-devel
# following Requires needed because /usr/bin/guile-config needs /usr/bin/guile
Requires:       %{name} = %{version}
Requires:       libffi-devel
Requires:       libguile-%{gsuff} = %{version}
Requires:       libunistring-devel
Requires:       ncurses-devel
Requires:       readline-devel
Requires:       pkgconfig(bdw-gc)
Requires(post): %{install_info_prereq}
Requires(preun):%{install_info_prereq}

%description -n lib%{name}-devel
This is Guile, a portable, embeddable Scheme implementation written in
C. Guile provides a machine independent execution platform that can be
linked in as a library when building extensible programs.

%prep
%setup -q -n guile-%{version}
%autopatch -p1

# remove broken prebuilt objects
rm -r prebuilt/32-bit-big-endian

%build
#sed -i "s:GUILE_:GUILE1_:" guile-config/guile.m4
#sed -i "s:guile:guile1:" guile-config/guile.m4
autoreconf -i --force --verbose
%configure \
  --disable-static \
  --with-pic \
  --with-threads \
  --program-transform-name="s:guile:%{name}:" \
  --disable-silent-rules
# do sequential build for reproducible .go files = https://issues.guix.gnu.org/issue/20272 - boo#1102408
make
rm -f test-suite/tests/version.test

%check
LD_LIBRARY_PATH="." make %{?_smp_mflags} check

%install
%make_install
mkdir -p %{buildroot}%{_datadir}/%{name}/site
find %{buildroot} -type f -name "*.la" -delete -print
# bug #874028
mkdir -p %{buildroot}%{_datadir}/gdb/auto-load%{_libdir}
mv %{buildroot}%{_libdir}/libguile*-gdb.scm %{buildroot}%{_datadir}/gdb/auto-load%{_libdir}/
# The next lines are to prevent conflict with guile
# use /usr/bin/guile1 instead of /usr/bin/guile
sed -i "s:${GUILE-guile}:${GUILE-guile1}:" %{buildroot}%{_datadir}/guile/*/scripts/*
sed -i "s:%{_bindir}/guile:%{_bindir}/%{name}:" %{buildroot}%{_bindir}/%{name}-config
# Don't forget guild
pushd %{buildroot}%{_bindir}
sed -i "s:%{_bindir}/guile:%{_bindir}/guile1:" guile1-config
sed -i 's/guild/guild1/' guild
mv guild guild1
ln -sf guild1 guile1-tools
popd
sed -i 's/\${bindir}\/guild/\${bindir}\/guild1/' %{buildroot}%{_libdir}/pkgconfig/guile-%{guilevers}.pc
rm -rf %{buildroot}%{_infodir}
mv %{buildroot}%{_datadir}/aclocal/guile{,1}.m4
#hack to fix pkg-config --modversion
sed -i 's/UNKNOWN/%{version}/' %{buildroot}%{_libdir}/pkgconfig/guile-%{guilevers}.pc

%post -n lib%{name}-devel
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}
%install_info --info-dir=%{_infodir} %{_infodir}/r5rs.info%{ext_info}

%preun -n lib%{name}-devel
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}
%install_info_delete --info-dir=%{_infodir} %{_infodir}/r5rs.info%{ext_info}

%pre
# Remove obsolete files (< SuSE Linux 10.2)
rm -f var/adm/SuSEconfig/md5%{_datadir}/%{name}/*/slibcat
rm -f usr/share/%{name}/site/slibcat.SuSEconfig

%post -n libguile-%{gsuff} -p /sbin/ldconfig
%postun -n libguile-%{gsuff} -p /sbin/ldconfig

%files
%doc ABOUT-NLS AUTHORS ChangeLog GUILE-VERSION HACKING
%doc NEWS README THANKS
%{_bindir}/%{name}-tools
%{_bindir}/guild1
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1%{ext_man}

%files -n libguile-%{gsuff}
%license LICENSE COPYING*
%{_libdir}/libguile-%{guilevers}.so.%{libgver}*

%files modules-%{guilemaj}_%{guilemin}
%{_libdir}/guile
# Own usr/share/guile1/site; side effect of not doing so is slib failing to install correctly.
%{_datadir}/%{name}
%{_datadir}/guile

%files -n lib%{name}-devel
%{_bindir}/%{name}-snarf
%{_bindir}/%{name}-config
%dir %{_includedir}/guile
%dir %{_includedir}/guile/%{guilevers}
%{_includedir}/guile/%{guilevers}/*
%{_datadir}/aclocal/guile1.m4
%{_libdir}/libguile-%{guilevers}.so
%{_libdir}/pkgconfig/guile-%{guilevers}.pc
# bug #874028
%dir %{_datadir}/gdb
%dir %{_datadir}/gdb/auto-load
%dir %{_datadir}/gdb/auto-load%{_prefix}
%dir %{_datadir}/gdb/auto-load/%{_libdir}
%{_datadir}/gdb/auto-load/%{_libdir}/libguile*-gdb.scm

%changelog
openSUSE Build Service is sponsored by