File Gauche.spec of Package gauche

# Spec file to build Gauche RPM package
#
# In order to build different encoding-specific packages (like
# Gauche-euc-jp, etc) from a single source rpm, the actual package
# is created as a subpackage.  The command
#
#   rpm -ba Gauche.spec
#
# builds three packages:
#    Gauche-VERS.ARCH.rpm         ;; dummy package (no use; discard it)
#    Gauche-ENC-VERS.ARCH.rpm     ;; binary package with encoding ENC
#    Gauche-VERS.src.rpm          ;; source package

%define version  0.9.9
%define abi_version 0.97
%define encoding utf8
%define threads  pthreads

Summary: Scheme script engine with multibyte character handling
Name: Gauche
Version: %{version}
Release: 1
Source: Gauche-%{version}.tgz
License: BSD-3-Clause
Group: Development/Languages/Scheme
BuildRoot: %{_tmppath}/rpm
URL: http://practical-scheme.net/gauche/

Requires: zlib-devel
BuildRequires: gcc gcc-c++ zlib-devel fdupes libopenssl-devel
# PATCH-FIX-OPENSUSE filelist-i686.patch -- predefined RPM file list
Patch1: filelist-i586.patch
# PATCH-FIX-OPENSUSE filelist-x86_64.patch -- predefined RPM file list
Patch2: filelist-x86_64.patch

%description
Gauche is an R7RS Scheme implementation developed to be a handy script
interpreter, which allows programmers and system administrators to write
small to large scripts for their daily chores. Quick startup, built-in
system interface, native multilingual support are some of my goals.

Gauche runs on several Unix-like platforms. 

%package %{encoding}
Summary: Scheme script engine with multibyte character handling
Group: Development/Languages/Scheme
License: BSD-3-Clause
Requires: Gauche-common
%description %{encoding}
Gauche is an R7RS Scheme implementation developed to be a handy script
interpreter, which allows programmers and system administrators to write
small to large scripts for their daily chores. Quick startup, built-in
system interface, native multilingual support are some of my goals.

Gauche runs on several Unix-like platforms. 

This package is compiled with %{encoding} as the native character encoding.

%package -n gosh
Summary: Scheme script engine with multibyte character handling
Group: Development/Languages/Scheme
Provides: Gauche
License: BSD-3-Clause
Requires: Gauche-common Gauche-%{encoding} libgauche-0_97
%description -n gosh
Gauche is an R7RS Scheme implementation developed to be a handy script
interpreter, which allows programmers and system administrators to write
small to large scripts for their daily chores. Quick startup, built-in
system interface, native multilingual support are some of my goals.

Gauche runs on several Unix-like platforms. 

This package is compiled with %{encoding} as the native character encoding.

%package common
Summary: Scheme script engine with multibyte character handling
Group: Development/Languages/Scheme
License: BSD-3-Clause
%description common
Gauche is an R7RS Scheme implementation developed to be a handy script
interpreter, which allows programmers and system administrators to write
small to large scripts for their daily chores. Quick startup, built-in
system interface, native multilingual support are some of my goals.

Gauche runs on several Unix-like platforms. 

This package includes common part that is independent from any
native character encoding.  You need either Gauche-eucjp or Gauche-utf8
package as well.

%package -n libgauche-0_97
Summary: Scheme script engine with multibyte character handling
Group: Development/Languages/Scheme
Provides: libgauche-%{abi_version}.so.0
License: BSD-3-Clause
Requires: Gauche-common Gauche-%{encoding}
%description -n libgauche-0_97
Gauche is an R7RS Scheme implementation developed to be a handy script
interpreter, which allows programmers and system administrators to write
small to large scripts for their daily chores. Quick startup, built-in
system interface, native multilingual support are some of my goals.

Gauche runs on several Unix-like platforms. 

This package includes the library file that is required for
Gauche environment.

%package devel
Summary: Scheme script engine with multibyte character handling
Group: Development/Languages/Scheme
License: BSD-3-Clause
Requires: libgauche-0_97
%description devel
Gauche is an R7RS Scheme implementation developed to be a handy script
interpreter, which allows programmers and system administrators to write
small to large scripts for their daily chores. Quick startup, built-in
system interface, native multilingual support are some of my goals.

Gauche runs on several Unix-like platforms. 

This package contains all necessary include files and libraries
needed to develop applications that require these.

%package gdbm-%{encoding}
Summary: Gdbm binding for Gauche Scheme system
Group: Development/Languages/Scheme
License: GPL-3.0+
Provides: Gauche-gdbm
Requires: gdbm >= 1.8.0, Gauche-%{encoding}
BuildRequires: gdbm-devel
%description gdbm-%{encoding}
This package adds gdbm binding to the Gauche Scheme system.

%prep
%setup
%ifarch i386 i486 i586 i686
%patch1 -p1
%endif
%if %{?_lib} == "lib64"
%patch2 -p1
%endif

%build
%configure --enable-threads=%{threads} --enable-multibyte=%{encoding} --libexecdir=%{_libdir} --enable-ipv6
%ifarch i386 i486 i586 i686
make OPTFLAGS="-fomit-frame-pointer -ffat-lto-objects"
%else
make OPTFLAGS="-ffat-lto-objects"
%endif


%install
# These dirs are not cleared after rpm -ba --clean.   To ensure clean
# install, we remove them.
find ${RPM_BUILD_ROOT}/; true
rm -rf ${RPM_BUILD_ROOT}%{_libdir}/gauche-%{abi_version}
rm -rf ${RPM_BUILD_ROOT}/usr/share/gauche-%{abi_version}
rm -rf ${RPM_BUILD_ROOT}/usr/share/man/man1
export LD_LIBRARY_PATH=${RPM_BUILD_ROOT}%{_libdir}:${LD_LIBRARY_PATH}
make DESTDIR=${RPM_BUILD_ROOT}/ install-pkg
make DESTDIR=${RPM_BUILD_ROOT}/ install-doc INSTALL_ROOT=${RPM_BUILD_ROOT}
make DESTDIR=${RPM_BUILD_ROOT}/ install

%fdupes -s %buildroot/%_mandir
%fdupes -s ${RPM_BUILD_ROOT}/usr/share
%fdupes -s ${RPM_BUILD_ROOT}%{_libdir}
rm -rf ${RPM_BUILD_ROOT}/usr/share/info

%clean

%post -n libgauche-0_97 -p /sbin/ldconfig

%post %{encoding}
# creates slib catalog, if possible.
/usr/bin/gosh -u slib -e "(require 'logical)" -e "(exit 0)" > /dev/null 2>&1 || echo

%postun -n libgauche-0_97 -p /sbin/ldconfig

%files common -f rpmfiles-common.txt
%defattr(-,root,root)
%doc COPYING ChangeLog Gauche.spec
%dir /usr/share/gauche-%{abi_version}
%dir /usr/share/gauche-%{abi_version}/%{version}
%dir /usr/share/gauche-%{abi_version}/%{version}/lib
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/binary
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/compat
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/control
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/crypt
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/data
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/dbd
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/dbm
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/file
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/cgen
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/experimental
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/interactive
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/mop
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/package
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/regexp
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/serializer
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/test
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/uvector
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/gauche/vm
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/lang
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/lang/asm
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/math
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/os
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/os/windows
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/os/windows/console
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/parser
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/parser/peg
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/rfc
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/rfc/http
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/rfc/tls
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/scheme
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/scheme/mapping
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/scheme/stream
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/scheme/vector
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/srfi
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/srfi-14
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/srfi-146
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/srfi-29
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/srfi/160
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/sxml
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/text
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/text/console
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/text/unicode
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/util
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/www
%dir /usr/share/gauche-%{abi_version}/%{version}/lib/www/cgi
%exclude /usr/share/gauche-%{abi_version}/%{version}/lib/dbm/ndbm.scm
%exclude /usr/share/gauche-%{abi_version}/%{version}/lib/dbm/odbm.scm
%exclude /usr/share/gauche-%{abi_version}/%{version}/lib/dbm/gdbm.scm
%exclude /usr/share/gauche-%{abi_version}/%{version}/template.configure.ac
%exclude /usr/share/gauche-%{abi_version}/%{version}/template.extension.c
%exclude /usr/share/gauche-%{abi_version}/%{version}/aclocal.m4
%exclude /usr/share/gauche-%{abi_version}/%{version}/template.extension.h
%exclude /usr/share/gauche-%{abi_version}/%{version}/template.extensionlib.stub
%exclude /usr/share/gauche-%{abi_version}/%{version}/template.Makefile.in
%exclude /usr/share/gauche-%{abi_version}/%{version}/template.test.scm

%files %{encoding} -f rpmfiles-encoding.txt
%defattr(-,root,root)
/usr/bin/gauche-config
/usr/bin/gauche-cesconv
/usr/bin/gauche-install
/usr/bin/gauche-package
%dir %{_libdir}/gauche-%{abi_version}
%dir %{_libdir}/gauche-%{abi_version}/%{version}
/usr/share/man/man1/gauche-cesconv.1.gz
/usr/share/man/man1/gauche-config.1.gz
/usr/share/man/man1/gauche-install.1.gz
/usr/share/man/man1/gauche-package.1.gz
%ifarch i386 i486 i586 i686
%dir %{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu/dbm--odbm.so
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu/dbm--gdbm.so
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu/dbm--ndbm.so
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu/libgauche-%{abi_version}.so
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu/libgauche-static-%{abi_version}.a
%else
%dir %{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu/dbm--odbm.so
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu/dbm--gdbm.so
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu/dbm--ndbm.so
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu/libgauche-%{abi_version}.so
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu/libgauche-static-%{abi_version}.a
%endif
%exclude %{_libdir}/gauche-%{abi_version}/%{version}/include

%files -n libgauche-0_97
%defattr(-,root,root)
%{_libdir}/libgauche-%{abi_version}.so.0
%{_libdir}/libgauche-%{abi_version}.so.0.9
%ifarch i386 i486 i586 i686
%{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu/libgauche-%{abi_version}.so.0
%else
%{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu/libgauche-%{abi_version}.so.0
%endif

%files -n gosh
%defattr(-,root,root)
/usr/bin/gosh
/usr/share/man/man1/gosh.1.gz

%files devel
%defattr(-,root,root)
/usr/share/aclocal/gauche.m4
%dir /usr/share/aclocal
%{_libdir}/libgauche-%{abi_version}.so
%attr(644, root, root) %{_libdir}/libgauche-static-%{abi_version}.a
%ifarch i386 i486 i586 i686
%{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu/libgauche-%{abi_version}.so
%attr(644, root, root) %{_libdir}/gauche-%{abi_version}/%{version}/i586-suse-linux-gnu/libgauche-static-%{abi_version}.a
%else
%{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu/libgauche-%{abi_version}.so
%attr(644, root, root) %{_libdir}/gauche-%{abi_version}/%{version}/x86_64-suse-linux-gnu/libgauche-static-%{abi_version}.a
%endif

%files gdbm-%{encoding} -f rpmfiles-gdbm.txt
%defattr(-,root,root)

%changelog
openSUSE Build Service is sponsored by