%define major 8 %define intllibname %mklibname intl %{major} %define misclibname %mklibname gettextmisc %define textstylemajor 0 %define textstylelibname %mklibname textstyle %{textstylemajor} %bcond_with bootstrap %bcond_with check %bcond_with java %bcond_with csharp %define versi %(echo %{version} | cut -d. -f1-3) Name: gettext Summary: GNU libraries and utilities for producing multi-lingual messages Version: 0.22.5 Release: %mkrel 3 License: GPLv3+ and LGPLv2+ and GFDL Group: System/Internationalization URL: https://www.gnu.org/software/gettext/ Source: https://ftp.gnu.org/pub/gnu/%{name}/%{name}-%{version}.tar.xz Source1: https://ftp.gnu.org/pub/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source2: po-mode-init.el Patch0: gettext-0.20.1-unescaped-left-brace.patch # from fedora Patch11: gettext-0.21.1-covscan.patch Patch12: gettext-0.22-disable-libtextstyle.patch # https://lists.gnu.org/archive/html/bug-gettext/2020-08/msg00026.html # CVE-2020-12825 Patch20: 0001-Backport-libcroco-upstream-merge-request-parser-limi.patch %if %{with csharp} BuildRequires: mono %endif %if %{with java} BuildRequires: eclipse-ecj BuildRequires: gcc-java BuildRequires: gcj-tools BuildRequires: fastjar %endif BuildRequires: automake BuildRequires: bison BuildRequires: diffutils BuildRequires: flex BuildRequires: texinfo BuildRequires: pkgconfig(glib-2.0) BuildRequires: libgomp-devel # not necessary best way to do it but without gettext-devel # the bootstrap game is lost %if !%{with bootstrap} BuildRequires: emacs-bin BuildRequires: pkgconfig(libxml-2.0) %endif BuildRequires: unistring-devel BuildRequires: pkgconfig(ncurses) BuildRequires: pkgconfig(libacl) # test suite BuildRequires: locales-fa BuildRequires: locales-fr BuildRequires: locales-ja BuildRequires: locales-zh BuildRequires: gawk >= 4.2.1 # see mga#27108 Provides: bundled(libcroco) = 0.6.13 Requires: %{name}-base = %{version} Requires: %{misclibname} = %{version} Obsoletes: %textstylelibname < %{version}-%{release} %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. If you would like to internationalize or incorporate multi-lingual messages into programs that you're developing, you should install gettext. Build Option: --with csharp Enables C# support in gettext --without java Disables Java support in gettext %package -n autopoint Group: Development/Other Summary: Tool for setting up gettext infrastructure in a source package # autopoint archive License: GPLv3+ # /usr/bin/autopoint: line 677: cmp: command not found Requires: diffutils Conflicts: gettext-devel < 0.21-9 %description -n autopoint The 'autopoint' program copies standard gettext infrastructure files into a source package. It extracts from a macro call of the form 'AM_GNU_GETTEXT_VERSION(VERSION)', found in the package's 'configure.in' or 'configure.ac' file, the gettext version used by the package, and copies the infrastructure files belonging to this version into the package. %package -n %{intllibname} Summary: Basic libintl library for internationalization Group: System/Libraries License: LGPLv2+ Requires(pre): filesystem >= 2.1.9-18 Provides: libintl = %{version}-%{release} %description -n %{intllibname} This package contains the libintl library, which is important for system internationalization. %package -n %{misclibname} Summary: Other %{name} libraries needed by %{name} utilities Group: System/Libraries License: LGPLv2+ Provides: libgettextmisc %description -n %{misclibname} This package contains all other libraries used by %{name} utilities, and are not very widely used outside %{name}. %package devel Summary: Development files for %{name} Group: Development/C # libasprintf is LGPLv2+ # libgettextpo is GPLv3+ License: LGPLv2+ and GFDL Requires: %{name} = %{version} Requires: autopoint = %{version} %description devel This package contains all development related files necessary for developing or compiling applications/libraries that needs internationalization capability. You also need this package if you want to add gettext support for your project. %package base Summary: Basic binary for showing translation of textual messages Group: System/Internationalization Requires(pre): filesystem >= 2.1.9-18 Requires: %{intllibname} = %{version} # see mga#26216 Conflicts: gettext < 0.20.1-3 %description base This package contains the basic binary from %{name}. It is split from %{name} because initscript needs it to show translated boot messages. %if %{with java} %package java Summary: Java binding for GNU gettext Group: System/Internationalization Requires: %{name} = %{version} %description java This package contains class file that implements the main GNU libintl functions in Java. This allows compiling GNU gettext message catalogs into Java ResourceBundle classes. %endif %if %{with csharp} %package csharp Summary: C# binding for GNU gettext Group: System/Internationalization Requires: mono %description csharp This package contains class file that implements the main GNU libintl functions in C#. This allows compiling GNU gettext message catalogs into C# dll or resource files. %endif %prep %autosetup -p1 %if !%{with bootstrap} # Defeat libtextstyle attempt to bundle libglib and libxml2. The # comments indicate this is done because the libtextstyle authors do not want # applications using their code to suffer startup delays due to the relocations # in the two libraries. This is not a sufficient reason for Mageia. # # ovitters: do use bundled libcroco as it is unmaintained upstream and has # several security bugs, see mga#27108 rm -rf libtextstyle/lib/{glib,libxml} for l in LIBGLIB LIBXML; do sed -i -e "s,\(gl_$l(\[\).*\(\])\),\1no\2,g" $(grep -rl -e "gl_$l(\[.*\])") done %endif %build autoreconf -fi %if %{with java} export GCJ="%{_bindir}/gcj" export JAVAC="%{_bindir}/gcj -C" export JAR="%{_bindir}/fastjar" %endif %configure \ --enable-shared \ --disable-static \ --disable-rpath \ --with-included-gettext \ --with-included-libcroco \ %if %{with csharp} --enable-csharp=mono \ %else --disable-csharp \ %endif %if ! %{with java} --disable-java \ %endif # Eliminate hardcoded rpaths; workaround libtool reordering -Wl,--as-needed # after all the libraries. sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \ -e 's|CC=.g..|& -Wl,--as-needed|' \ -i $(find . -name libtool) %make_build %if %{with check} %check export JAVAC=ecj # this takes quite a lot of time to run # adapt to rpath removal export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:$PWD/gettext-tools/intl/.libs # override LIBUNISTRING to prevent reordering of lib objects LC_ALL=UTF-8 make check LIBUNISTRING=-lunistring %endif %install %make_install # remove unwanted files rm -f %{buildroot}%{_includedir}/libintl.h \ %{buildroot}%{_datadir}/locale/locale.alias rm -f gettext-runtime/intl-java/javadoc2/package-list install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/emacs/site-start.d/%{name}.el # remove non-standard lc directories for i in en@boldquot en@quot ; do rm -rf %{buildroot}/%{_datadir}/locale/$i; done # move installed doc back to %%doc rm -rf htmldoc examples mkdir htmldoc for i in gettext-runtime/man/*.html; do rm -f %{buildroot}%{_datadir}/doc/gettext/`basename $i` done rm -rf %{buildroot}%{_datadir}/doc/gettext/javadoc* # remove java stuff, otherwise rpm complains %if !%{with java} rm -f %{buildroot}%{_libdir}/%{name}/gnu.gettext.* \ %{buildroot}%{_datadir}/%{name}/*.jar %endif # don't ship .la find %{buildroot} -name '*.la' -delete # fix rights chmod 755 %{buildroot}%{_libdir}/$(readlink %{buildroot}%{_libdir}/libintl.so) rm -fr %{buildroot}/usr/share/doc/{libasprintf/autosprintf_all.html,gettext/examples} %find_lang %{name} --all-name %files %doc AUTHORS README COPYING gettext-runtime/ABOUT-NLS gettext-runtime/BUGS NEWS THANKS %config(noreplace) %{_sysconfdir}/emacs/site-start.d/*.el %{_bindir}/envsubst %{_bindir}/gettext.sh %{_bindir}/msg* %{_bindir}/recode-sr-latin %{_bindir}/xgettext %dir %{_datadir}/gettext %{_datadir}/%{name}/msgunfmt.tcl %{_datadir}/%{name}/projects %{_datadir}/%{name}/javaversion.class %{_datadir}/%{name}/styles %dir %{_datadir}/%{name}-%{versi} %{_datadir}/%{name}-%{versi}/its %dir %{_libdir}/%{name} %{_libdir}/%{name}/cldr-plurals %{_libdir}/%{name}/hostname %{_libdir}/%{name}/project-id %{_libdir}/%{name}/urlget %{_libdir}/%{name}/user-email %if %{with java} %exclude %{_libdir}/%{name}/gnu.gettext.* %endif %{_infodir}/gettext.* %if !%{with bootstrap} %{_datadir}/emacs/site-lisp/*.el* %endif %{_mandir}/man1/envsubst.* %{_mandir}/man1/msg* %{_mandir}/man1/xgettext.* %{_mandir}/man1/recode-sr-latin.* %files base -f %{name}.lang %doc gettext-runtime/man/*.1.html %{_bindir}/gettext %{_bindir}/ngettext %{_mandir}/man1/gettext* %{_mandir}/man1/ngettext* %files -n %{intllibname} %doc gettext-runtime/intl/COPYING* %{_libdir}/libintl.so.%{major} %{_libdir}/libintl.so.%{major}.* %files -n %{misclibname} %doc gettext-runtime/intl/COPYING* %{_libdir}/libgettext*-*.*.so %{_libdir}/libgettext*.so.* %{_libdir}/libasprintf*.so.* %files -n autopoint %{_bindir}/autopoint %{_datadir}/%{name}/archive.dir.tar.xz %{_mandir}/man1/autopoint.1* %files devel %doc gettext-runtime/man/*.3.html htmldoc %doc /usr/share/doc/gettext/*.html %doc /usr/share/doc/gettext/*/*.html %{_bindir}/gettextize %{_datadir}/%{name}/ABOUT-NLS %{_datadir}/%{name}/config.rpath %{_datadir}/%{name}/*.h %{_datadir}/%{name}/po %{_datadir}/aclocal/* %{_includedir}/* %{_infodir}/autosprintf* # "lib*.so" cannot be used (it should be 'lib[^\.]*\.so' regexp in fact # but using regexp is not possible here; so we list all files manually %{_libdir}/libasprintf.so %{_libdir}/libgettextlib.so %{_libdir}/libgettextpo.so %{_libdir}/libgettextsrc.so %{_libdir}/libintl.so %{_mandir}/man3/* %if %{with java} %files java %doc gettext-runtime/intl-java/javadoc* %{_libdir}/%{name}/gnu.gettext.* %{_datadir}/%{name}/*.jar %endif %if %{with csharp} %files csharp %doc gettext-runtime/intl-csharp/csharpdoc/* %{_libdir}/*.dll %{_libdir}/gettext/*.exe %endif