Name:          guile
Version:       2.0.14
Release:       15
Epoch:         5
Summary:       GNU's Ubiquitous Intelligent Language for Extension
License:       LGPLv3+
URL:           https://www.gnu.org/software/guile/
Source:        https://ftp.gnu.org/gnu/guile/%{name}-%{version}.tar.xz

Patch1:        guile-multilib.patch
Patch2:        guile-i18ntest.patch
Patch3:        guile-threadstest.patch
Patch4:        guile-2.0.14-gc_pkgconfig_private.patch

BuildRequires: gcc libtool gmp-devel readline-devel gc-devel  libffi-devel
BuildRequires: gettext-devel libunistring-devel  libtool-ltdl-devel git gdb
Requires:      coreutils

%description
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       devel
Summary:       Development files and Header files for %{name}
Requires:      guile = %{epoch}:%{version}-%{release} gmp-devel gc-devel pkgconfig 

%description   devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package_help

%prep
%autosetup  -n %{name}-%{version} -p1 -S git 

%build
%configure --disable-error-on-warning
sed -i 's|" $sys_lib_dlsearch_path "|" $sys_lib_dlsearch_path %{_libdir} "|' libtool
%make_build

%install
%make_install
install -d  %{buildroot}%{_datadir}/guile/site/2.0
%delete_la_and_a
rm -f %{buildroot}%{_infodir}/dir
bzip2 NEWS

for i in %{buildroot}%{_infodir}/goops.info; do
    iconv -f iso8859-1 -t utf-8 < $i > $i.utf8 && mv -f ${i}{.utf8,}
done

touch %{buildroot}%{_datadir}/guile/site/2.0/slibcat

ln -s guile %{buildroot}%{_bindir}/guile2
ln -s guile-tools %{buildroot}%{_bindir}/guile2-tools

find %{buildroot}%{_datadir} -name '*.scm' -exec touch -r "%{_specdir}/guile.spec" '{}' \;
find %{buildroot}%{_libdir} -name '*.go' -exec touch -r "%{_specdir}/guile.spec" '{}' \;

%check
make  check

%ldconfig_scriptlets

%triggerin -- slib >= 3b4-1
export SCHEME_LIBRARY_PATH=%{_datadir}/slib/

%{_bindir}/guile --fresh-auto-compile --no-auto-compile -c \
    "(use-modules (ice-9 slib)) (require 'new-catalog)" &> /dev/null || \
    rm -f %{_datadir}/guile/site/%{mver}/slibcat
:
%triggerun -- slib >= 3b4-1
if [ "$2" = 0 ]; then
    rm -f %{_datadir}/guile/site/%{mver}/slibcat
fi

%files
%doc AUTHORS 
%license COPYING COPYING.LESSER LICENSE
%{_datadir}/guile/2.0/*
%dir %{_datadir}/guile/site/2.0
%{_bindir}/guild
%{_bindir}/guile
%{_bindir}/guile2*
%{_bindir}/guile-tools
%{_libdir}/guile/2.0/ccache/*
%{_libdir}/libguile-2.0.so.*
%{_libdir}/libguilereadline-v-18.so*
%{_infodir}/guile.info*.gz
%{_infodir}/r5rs.info.gz
%ghost %{_datadir}/guile/site/2.0/slibcat
%exclude %{_libdir}/libguile*gdb.scm

%files devel
%{_bindir}/guile-config
%{_bindir}/guile-snarf
%{_includedir}/guile/2.0/libguile/*.h
%{_includedir}/guile/2.0/*.h
%{_libdir}/pkgconfig/guile-2.0.pc
%{_libdir}/libguile-2.0.so
%{_datadir}/aclocal/guile.m4

%files help
%doc HACKING NEWS.bz2 README THANKS
%{_mandir}/man1/guile.1.gz

%changelog
* Fri Mar 20 2020 songnannan <songnannan2@huawei.com> - 2.0.14-15
- add gdb in buildrequires

* Sat Sep 28 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.0.14-14
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:remove the libguile-2.0.so.22.8.1-gdb.scm from package

* Tue Sep 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.0.14-13
- Package init
