%if "%{?stage1}" != "1"
%ifnarch arm
%define        with_java 1
%endif
%define        with_csharp 1
%endif
%define        perl_major_ver  %(eval `perl -V:version`; echo ${version%*.[0-9]*}.0)

Name:          gettext
Version:       0.22
Release:       1mamba
Summary:       GNU libraries and utilities for producing multi-lingual messages
Group:         System/Libraries
Vendor:        openmamba
Distribution:  openmamba
Packager:      Silvan Calarco <silvan.calarco@mambasoft.it>
URL:           https://ftp.gnu.org/pub/gnu/gettext/
Source:        https://ftp.gnu.org/pub/gnu/gettext/gettext-%{version}.tar.lz
Patch0:        %{name}-0.17-wchar-fix.patch
License:       GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libacl-devel
BuildRequires: libattr-devel
BuildRequires: libgcc
BuildRequires: libgomp-devel
BuildRequires: libncurses-devel
BuildRequires: libstdc++6-devel
BuildRequires: libunistring-devel
BuildRequires: libxml2-devel
BuildRequires: mono-devel
## AUTOBUILDREQ-END
%if "%{?stage1}" != "1"
BuildRequires: perl >= %perl_major_ver
BuildRequires: emacs
BuildRequires: tetex-dvips
BuildRequires: emacs-nox
BuildRequires: texinfo
%endif
BuildRequires: gcc-c++
%if "%{?with_java}"
BuildRequires: java-sdk
%endif
%if "%{?with_csharp}"
BuildRequires: mono
%endif
BuildRequires: libunistring-devel >= 0.9.6
Requires(post):%{__install_info}

%description
The GNU gettext package provides a set of tools and documentation for producing multi-lingual messages in programs.
Tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs, a runtime library which supports the retrieval of translated  
messages, and stand-alone programs for handling the translatable and the already translated strings.
Gettext provides an easy to use library and tools for creating, using, and modifying natural language catalogs and is a powerful and simple method for internationalizing programs.

%package devel
Summary:       Tools and documentation for developers and translators
Group:         Development/Libraries
Requires:      %{name} = %{?epoch:%epoch:}%{version}-%{release}

%description devel
The GNU gettext package provides a set of tools and documentation for producing multi-lingual messages in programs.
Tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs, a runtime library which supports the retrieval of translated  
messages, and stand-alone programs for handling the translatable and the already translated strings.
Gettext provides an easy to use library and tools for creating, using, and modifying natural language catalogs and is a powerful and simple method for internationalizing programs.

If you would like to internationalize or incorporate multi-lingual messages into programs that you're developing, you should install this package.

%package -n java-gettext
Summary:       Java GNU library for producing multi-lingual messages
Group:         System/Libraries
Requires:      %{name} = %{?epoch:%epoch:}%{version}-%{release}

%description -n java-gettext
The GNU gettext package provides a set of tools and documentation for producing multi-lingual messages in programs.
Tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs, a runtime library which supports the retrieval of translated  
messages, and stand-alone programs for handling the translatable and the already translated strings.
Gettext provides an easy to use library and tools for creating, using, and modifying natural language catalogs and is a powerful and simple method for internationalizing programs.
This package provides the GNU java library for producing multi-lingual messages.

%package -n mono-gettext
Summary:       Mono (C-sharp) GNU library for producing multi-lingual messages
Group:         System/Libraries
Requires:      %{name} = %{?epoch:%epoch:}%{version}-%{release}

%description -n mono-gettext
The GNU gettext package provides a set of tools and documentation for producing multi-lingual messages in programs.
Tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs, a runtime library which supports the retrieval of translated  
messages, and stand-alone programs for handling the translatable and the already translated strings.
Gettext provides an easy to use library and tools for creating, using, and modifying natural language catalogs and is a powerful and simple method for internationalizing programs.
This package provides the Mono (C-sharp) GNU library for producing multi-lingual messages.

%debug_package

%prep
%setup -q
#%patch0 -p1

%build
%configure \
   --enable-nls \
%if "%{?with_csharp}"
   --enable-csharp \
%else
   --disable-csharp \
%endif
%if "%{?with_java}"
   --enable-java \
%else
   --disable-java \
%endif
   --enable-shared \
%ifarch arm
   --without-emacs
%endif

%make -j1

%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeoldinstall \
   aclocaldir=%{buildroot}%{_datadir}/aclocal \
   lispdir=%{buildroot}%{_datadir}/emacs/site-lisp

# '+x' required by ldd
chmod +x %{buildroot}%{_libdir}/preloadable_libintl.so

%if "%{?stage1}" != "1"
%ifnarch arm
for f in po-compat.elc po-mode.elc start-po.elc; do
   sed -i "s,^;;; from file %{_builddir}/,;;; from file ," \
      %{buildroot}%{_datadir}/emacs/site-lisp/$f
done
%endif
%endif

%find_lang gettext-runtime
%find_lang gettext-tools

%post
%install_info autosprintf.info
%install_info %{name}.info
/sbin/ldconfig
:

%postun -p /sbin/ldconfig
%postun devel -p /sbin/ldconfig

%preun
%uninstall_info autosprintf.info
%uninstall_info %{name}.info
:

%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

%files -f gettext-runtime.lang
%defattr(-,root,root)
%{_bindir}/*
%exclude %{_bindir}/autopoint
%exclude %{_bindir}/gettextize
%{_libdir}/libgettextlib*.so
%{_libdir}/libgettextpo.so.*
%{_libdir}/libgettextsrc*.so
%{_libdir}/libasprintf.so*
%{_libdir}/libtextstyle.so.*
%{_libdir}/preloadable_libintl.so
%{_datadir}/doc/gettext/FAQ.html
%{_datadir}/doc/gettext/envsubst.1.html
%{_datadir}/doc/gettext/gettext.1.html
%{_datadir}/doc/gettext/gettext_*.html
%{_datadir}/doc/gettext/msg*.1.html
%{_datadir}/doc/gettext/ngettext.1.html
%{_datadir}/doc/gettext/xgettext.1.html
%{_datadir}/doc/gettext/tutorial.html
%dir %{_datadir}/gettext-*
%dir %{_datadir}/gettext-*/its
%{_datadir}/gettext-*/its/*
%{_datadir}/gettext/ABOUT-NLS
%{_infodir}/gettext.info.*
%{_infodir}/autosprintf.info.*
%{_infodir}/libtextstyle.info.gz
%{_mandir}/man1/*
%exclude %{_mandir}/man1/gettextize.*
%exclude %{_mandir}/man1/autopoint.*

%files devel -f gettext-tools.lang
%defattr(-,root,root)
%{_bindir}/autopoint
%{_bindir}/gettextize
%{_includedir}/*.h
%dir %{_includedir}/textstyle
%{_includedir}/textstyle/*
%{_libdir}/libtextstyle.so
%{_libdir}/libgettextpo.so
%{_libdir}/gettext/*
%{_libdir}/lib*.a
%{_datadir}/aclocal/*
%if "%{?stage1}" != "1"
%ifnarch arm
%{_datadir}/emacs/site-lisp/*
%endif
%endif
%{_datadir}/gettext/archive.dir.tar.xz
%{_datadir}/gettext/config.rpath
%{_datadir}/gettext/gettext.h
%{_datadir}/gettext/javaversion.class
#%{_datadir}/gettext/mkinstalldirs
%{_datadir}/gettext/msgunfmt.tcl
#%{_datadir}/gettext/intl/*
%{_datadir}/gettext/po/*
%{_datadir}/gettext/projects/*
%{_datadir}/gettext/styles/*.css
%{_datadir}/doc/gettext/*.3.html
%{_datadir}/doc/gettext/autopoint.1.html
%{_datadir}/doc/gettext/gettextize.1.html
%{_datadir}/doc/gettext/recode-sr-latin.1.html
%{_datadir}/doc/gettext/examples/*
%{_datadir}/doc/gettext/csharpdoc/*
#%{_datadir}/doc/gettext/javadoc1/*
%{_datadir}/doc/gettext/javadoc2/*
%{_datadir}/doc/libasprintf/autosprintf_all.html
%dir %{_datadir}/doc/libtextstyle
%{_datadir}/doc/libtextstyle/*
%{_mandir}/man1/autopoint.*
%{_mandir}/man1/gettextize.*
%{_mandir}/man3/*

%if "%{?with_java}"
%files -n java-gettext
%defattr(-,root,root)
# gettext.jar is only built if gcj is not available
%{_datadir}/gettext/gettext.jar
%{_datadir}/gettext/libintl.jar
%endif

%if "%{?with_csharp}"
%files -n mono-gettext
%defattr(-,root,root)
%{_libdir}/GNU.Gettext.dll
%endif

%changelog
* Sun Jun 18 2023 Automatic Build System <autodist@mambasoft.it> 0.22-1mamba
- automatic version update by autodist

* Sat Oct 29 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 0.21.1-1mamba
- update to 0.21.1

* Wed Jul 29 2020 Automatic Build System <autodist@mambasoft.it> 0.21-1mamba
- automatic version update by autodist

* Sun Apr 26 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 0.20.2-1mamba
- update to 0.20.2

* Mon May 13 2019 Automatic Build System <autodist@mambasoft.it> 0.20.1-1mamba
- automatic version update by autodist

* Sat May 11 2019 Automatic Build System <autodist@mambasoft.it> 0.20-1mamba
- automatic version update by autodist

* Thu Aug 02 2018 Silvan Calarco <silvan.calarco@mambasoft.it> 0.19.8.1-3mamba
- rebuilt with libgcj4 6.4.0

* Tue Aug 30 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 0.19.8.1-2mamba
- rebuilt with gcc 6.2.0

* Sun Jun 12 2016 Automatic Build System <autodist@mambasoft.it> 0.19.8.1-1mamba
- automatic version update by autodist

* Thu Jun 09 2016 Automatic Build System <autodist@mambasoft.it> 0.19.8-1mamba
- automatic version update by autodist

* Fri May 13 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 0.19.7-3mamba
- fix libgcj4 versioned build requirement

* Fri May 06 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 0.19.7-2mamba
- rebuilt with gcc 6.1.0

* Tue Dec 29 2015 Automatic Build System <autodist@mambasoft.it> 0.19.7-1mamba
- automatic version update by autodist

* Wed Nov 25 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 0.19.6-2mamba
- rebuilt with gcc 5.2.0

* Fri Sep 11 2015 Automatic Build System <autodist@mambasoft.it> 0.19.6-1mamba
- automatic version update by autodist

* Wed Jul 15 2015 Automatic Build System <autodist@mambasoft.it> 0.19.5.1-1mamba
- automatic version update by autodist

* Fri Jul 10 2015 Automatic Build System <autodist@mambasoft.it> 0.19.5-1mamba
- automatic version update by autodist

* Wed Dec 24 2014 Automatic Build System <autodist@mambasoft.it> 0.19.4-1mamba
- automatic version update by autodist

* Thu Oct 16 2014 Automatic Build System <autodist@mambasoft.it> 0.19.3-1mamba
- automatic version update by autodist

* Tue Jul 15 2014 Automatic Build System <autodist@mambasoft.it> 0.19.2-1mamba
- automatic update by autodist

* Tue Jun 10 2014 Automatic Build System <autodist@mambasoft.it> 0.19.1-1mamba
- automatic version update by autodist

* Wed Jun 04 2014 Automatic Build System <autodist@mambasoft.it> 0.19-1mamba
- automatic version update by autodist

* Fri May 16 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 0.18.3.2-2mamba
- rebuilt with gcj 4.9.0

* Sun Jan 12 2014 Automatic Build System <autodist@mambasoft.it> 0.18.3.2-1mamba
- automatic version update by autodist

* Sun Aug 18 2013 Automatic Build System <autodist@mambasoft.it> 0.18.3.1-1mamba
- automatic version update by autodist

* Mon Jul 08 2013 Automatic Build System <autodist@mambasoft.it> 0.18.3-1mamba
- automatic version update by autodist

* Wed May 29 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 0.18.2.1-3mamba
- arm: rebuilt with new ncurses

* Mon Apr 08 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 0.18.2.1-2mamba
- rebuilt with gcc 4.8.0

* Thu Mar 07 2013 Automatic Build System <autodist@mambasoft.it> 0.18.2.1-1mamba
- automatic version update by autodist

* Mon Dec 31 2012 Automatic Build System <autodist@mambasoft.it> 0.18.2-1mamba
- automatic version update by autodist

* Sun Jun 24 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 0.18.1.1-2mamba
- rebuilt with gcc 4.7.1

* Sat Jun 12 2010 Automatic Build System <autodist@mambasoft.it> 0.18.1.1-1mamba
- automatic update to 0.18.1.1 by autodist

* Sat May 15 2010 Automatic Build System <autodist@mambasoft.it> 0.18-1mamba
- automatic update to 0.18 by autodist

* Thu Sep 11 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 0.17-2mamba
- rebuilt against gcj 4.3.2

* Tue Dec 11 2007 Aleph0 <aleph0@openmamba.org> 0.17-1mamba
- update to 0.17

* Fri May 18 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 0.16.1-1mamba
- update to 0.16.1
- added build requirements for emacs-nox and libgomp-devel

* Sun Nov 05 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 0.16-2qilnx
- rebuilt for devel-sc repository with gcc 4.1.1

* Thu Nov 02 2006 Davide Madrisan <davide.madrisan@qilinux.it> 0.16-1qilnx
- update to version 0.16 by autospec

* Thu Oct 12 2006 Davide Madrisan <davide.madrisan@qilinux.it> 0.14.6-1qilnx
- update to version 0.14.6 by autospec

* Fri Jan 13 2006 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 0.14.5-2qilnx
- conditional C# support building

* Mon Sep 26 2005 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 0.14.5-1qilnx
- update to version 0.14.5 by autospec
- preloadable_libintl.so library moved to main package
- added C# support

* Wed Apr 13 2005 Davide Madrisan <davide.madrisan@qilinux.it> 0.14.4-2qilnx
- added missing build requirements

* Tue Apr 12 2005 Davide Madrisan <davide.madrisan@qilinux.it> 0.14.4-1qilnx
- update to version 0.14.4 by autospec

* Wed Apr 06 2005 Davide Madrisan <davide.madrisan@qilinux.it> 0.14.3-2qilnx
- added missing %%post, %%postun, and %%preun scripts
- moved some binaries from devel to main package because they are used
  by the LSB software when checking the runtime environment
- moved most of the documentation in the devel package

* Wed Mar 16 2005 Davide Madrisan <davide.madrisan@qilinux.it> 0.14.3-1qilnx
- update to version 0.14.3 by autospec

* Fri Feb 25 2005 Davide Madrisan <davide.madrisan@qilinux.it> 0.14.2-1qilnx
- update to version 0.14.2 by autospec

* Sat Jan 31 2004 Davide Madrisan <davide.madrisan@qilinux.it> 0.14.1-1qilnx
- package update (main new feature: C# support)
- added the compilation note

* Thu Jan 29 2004 Davide Madrisan <davide.madrisan@qilinux.it> 0.14-1qilnx
- package update

* Thu Dec 18 2003 Davide Madrisan <davide.madrisan@qilinux.it> 0.13.1-1qilnx
- rebuilt with latest version (bug fixes in the testsuite and in the examples)

* Tue Dec 02 2003 Davide Madrisan <davide.madrisan@qilinux.it> 0.13-1qilnx
- rebuilt with latest version.
- various specfile updates. RPM package splitted into two packages.

* Mon Apr 14 2003 Alessandro Ramazzina <alessandro.ramazzina@qinet.it>
- creation of gettext package
