%define srcname openoffice.org %define ooname %srcname %define unopkg %{_libdir}/%{ooodir}/program/unopkg %define binpkg %nil %define ooo_version %(rpm -q --qf '%%{epoch}:%%{version}' %{ooname}-devel 2>/dev/null) # TODO: why is OOo not in constant location as on debian? %define ooo_shortver %(rpm -ql %{ooname}-devel 2>/dev/null | sed -nr 's,^%{_libdir}/ooo-([0-9\\\.]+)(_64)?/basis[0-9.]+/sdk/setsdkenv_unix.sh$,\\\1,p') #define ooo_shortver %(echo %ooo_version | perl -p -e 's/^([^\\\.]+\\\.[^\\\.]+)\\\..*/\\\1/') %define ooodir ooo-%{ooo_shortver} # This is a hack, but we have to follow openoffice.org.spec naming %ifarch x86_64 %define ooname %{srcname}64 %define ooodir ooo-%{ooo_shortver}_64 %define binpkg -n %{binname} %endif %define binname %{ooname}-voikko %define name %{srcname}-voikko %define version 3.0 %define rel 3 %define unopkgname voikko.oxt # NOTE: There is a duplicate package section below for openoffice.org64 naming # hack. Summary: Finnish spellchecker and hyphenator for OpenOffice.org Name: %name Version: %version Release: %mkrel %rel License: GPL Group: Office URL: http://voikko.sourceforge.net/ Source: http://downloads.sourceforge.net/voikko/%name-%version.tar.gz BuildRoot: %{_tmppath}/%{name}-root BuildRequires: %ooname-devel BuildRequires: zip BuildRequires: voikko-devel >= 1.5 Requires: locales-fi # Binaries are hidden inside a zip, so automatic dependencies won't work Requires: %{mklibname voikko 1} Requires: voikko-dictionary Requires: %ooname-common = %ooo_version Requires(pre): %ooname-common = %ooo_version Requires(post): %ooname-common = %ooo_version Requires(preun): %ooname-common = %ooo_version %description Finnish spellchecker and hyphenator component for OpenOffice.org. Usually Voikko is automatically activated after the installation. If that won't happen, you can manually activate it from the Writing Aids section of the OpenOffice.org options. %ifarch x86_64 %package -n %binname Summary: Finnish spellchecker and hyphenator for OpenOffice.org Group: Office Requires: locales-fi # Binaries are hidden inside a zip, so automatic dependencies won't work Requires: %{mklibname voikko 1} Requires: voikko-dictionary Requires: %ooname-common = %ooo_version Requires(pre): %ooname-common = %ooo_version Requires(post): %ooname-common = %ooo_version Requires(preun): %ooname-common = %ooo_version %description -n %binname Finnish spellchecker and hyphenator component for OpenOffice.org. Usually Voikko is automatically activated after the installation. If that won't happen, you can manually activate it from the Writing Aids section of the OpenOffice.org options. %endif %prep %setup -q %build . %{_libdir}/%{ooodir}/basis-link/sdk/setsdkenv_unix.sh # (Anssi 09/2008) Our current OOo has some broken make variables. # Some devel library symlinks also appear to be nowhere. %make OPT_FLAGS="%optflags" all \ URE_TYPES=%{_libdir}/%{ooodir}/basis-link/ure-link/share/misc/types.rdb \ OFFICE_TYPES=%{_libdir}/%{ooodir}/basis-link/program/offapi.rdb \ SALLIB=%{_libdir}/%{ooodir}/ure/lib/libuno_sal.so.3 \ CPPULIB=%{_libdir}/%{ooodir}/ure/lib/libuno_cppu.so.3 \ CPPUHELPERLIB=%{_libdir}/%{ooodir}/ure/lib/libuno_cppuhelpergcc3.so.3 %install rm -rf %{buildroot} install -d -m755 %{buildroot}%{_libdir}/%{binname} install -m644 build/%{unopkgname} %{buildroot}%{_libdir}/%{binname} %clean rm -rf %{buildroot} %pre %binpkg if ! [ -x %unopkg ]; then echo "ERROR: Compatible version of OpenOffice.org is not installed, aborting the" echo " installation or upgrade of %{binname}!" exit 1 fi # (anssi) Map of triggercity: # Note that installation of voikko implies automatic uninstallation of old # versions for the compatible instance of openoffice.org. # Upgrade of openoffice.org-voikko: # - TRIGGERUN of old version is run, but $1 = 1 and $2 = 1, thus no action is # taken # - POSTTRANS of new version installs new version # Upgrade of openoffice.org to a compatible version: # - TRIGGERUN is run, but $1 = 1 and $2 = 1, thus no action is taken # Upgrade of openoffice.org and openoffice.org-voikko to a compatible version: # - TRIGGERUN of old version is run, but $1 = 1 and $2 = 1, thus no action is # taken # - TRIGGERUN of old version is run again, but $1 = 1 and $2 = 1, thus no # action is taken # - POSTTRANS of new version installs new version # Upgrade of openoffice.org and openoffice.org-voikko to an incompatible # version: # - TRIGGERIN of old version removes old version # - TRIGGERUN of old version is run, but $1 = 1 and $2 = 1, thus no action is # taken # - openoffice.org files are replaced with new versions # - POSTTRANS of new version installs new version # Upgrade of openoffice.org to an incompatible version, with # openoffice.org-voikko being removed: # - TRIGGERIN removes voikko # - TRIGGERUN is run, but $1 = 1 and $2 = 1, thus no action is taken # - openoffice.org files are replaced with new versions # Downgrade of openoffice.org-voikko: # - TRIGGERUN of new version is run, but $1 = 1 and $2 = 1, thus no action is # taken # - POSTTRANS of old version installs old version # Removal of openoffice.org-voikko: # - TRIGGERUN removes voikko as $1 = 0 and $2 = 1 # Removal of openoffice.org and openoffice.org-voikko # - TRIGGERUN removes voikko as $1 = 1 and $2 = 0 # - openoffice.org files are removed # # Posttrans is used instead of post to allow upgrade from old # openoffice.org-voikko with preun that would remove the new version installed # in post, without adding triggers for that. %posttrans %binpkg if [ -x %unopkg ]; then # unopkg writes into $HOME TMP_HOME=$(mktemp -t -d %{binname}.XXXXXX) || exit 1 export HOME=$TMP_HOME # make sure no other version is installed for pkg in $(%unopkg list --shared 2>/dev/null | sed -ne 's/^Identifier: \(org.puimula.ooovoikko\)/\1/p'); do %unopkg remove --shared $pkg # empty line due to macro expansion done %unopkg add --shared %{_libdir}/%{binname}/%{unopkgname} rm -rf $TMP_HOME fi %triggerun %binpkg -- %ooname-common = %ooo_version # Preun script cannot be used for this as rpm doesn't honor Requires(preun), # but just removes OOo before preun would be run. # Executed just before OOo or voikko is being completely removed. Does not run # on normal upgrades. if [ $1 -eq 0 ] || [ $2 -eq 0 ]; then if [ -x %unopkg ]; then # unopkg writes into $HOME TMP_HOME=$(mktemp -t -d %{binname}.XXXXXX) || exit 1 export HOME=$TMP_HOME %unopkg remove --shared org.puimula.ooovoikko # get rid of cache: %unopkg list --shared &>/dev/null rm -rf $TMP_HOME fi fi true %triggerin %binpkg -- %ooname-common > %ooo_version # Executed just before OOo is being upgraded to an incompatible version. # Cannot be in preun for the same reason as above triggerun. if [ -x %unopkg ]; then # unopkg writes into $HOME TMP_HOME=$(mktemp -t -d %{binname}.XXXXXX) || exit 1 export HOME=$TMP_HOME %unopkg remove --shared org.puimula.ooovoikko # get rid of cache: %unopkg list --shared &>/dev/null rm -rf $TMP_HOME fi %files %binpkg %defattr(-,root,root) %doc README ChangeLog %{_libdir}/%{binname} %changelog * Fri Oct 03 2008 Anne Nicolas <anne.nicolas@mandriva.com> 3.0-3mdv2009.0 + Revision: 291079 - Rebuild against last version * Sat Sep 20 2008 Anssi Hannula <anssi@mandriva.org> 3.0-2mdv2009.0 + Revision: 286170 - rebuild for new OOo * Sat Sep 13 2008 Anssi Hannula <anssi@mandriva.org> 3.0-1mdv2009.0 + Revision: 284569 - new version - adapt for OOo 3.0 directories - add hacks around broken OOo 3.0 sdk things * Sat Apr 26 2008 Anssi Hannula <anssi@mandriva.org> 2.2-5mdv2009.0 + Revision: 197768 - rebuild for new OOo * Fri Mar 28 2008 Anssi Hannula <anssi@mandriva.org> 2.2-4mdv2008.1 + Revision: 190805 - rebuild for new OOo * Thu Mar 20 2008 Ademar de Souza Reis Jr <ademar@mandriva.com.br> 2.2-3mdv2008.1 + Revision: 189209 - rebuild with new OOo * Sun Mar 02 2008 Anssi Hannula <anssi@mandriva.org> 2.2-2mdv2008.1 + Revision: 177791 - rebuild for new OOo * Fri Feb 29 2008 Anssi Hannula <anssi@mandriva.org> 2.2-1mdv2008.1 + Revision: 176601 - new version - more hacks for OOo versioning * Sat Jan 05 2008 Anssi Hannula <anssi@mandriva.org> 2.1-3mdv2008.1 + Revision: 145849 - use unopkg list command to clear cache instead of rm + Olivier Blin <oblin@mandriva.com> - restore BuildRoot * Wed Dec 26 2007 Anssi Hannula <anssi@mandriva.org> 2.1-2mdv2008.1 + Revision: 137913 - adapt for OOo 2.3 - remove duplicate ooo_version define + Thierry Vignaud <tvignaud@mandriva.com> - kill re-definition of %%buildroot on Pixel's request * Sat Sep 01 2007 Anssi Hannula <anssi@mandriva.org> 2.1-1mdv2008.0 + Revision: 77710 - 2.1 - remove now unneeded build flags * Sat Jul 21 2007 Anssi Hannula <anssi@mandriva.org> 2.0.1-4mdv2008.0 + Revision: 54356 - redefine HOME before calling unopkg as it writes there * Wed Jul 18 2007 Anssi Hannula <anssi@mandriva.org> 2.0.1-3mdv2008.0 + Revision: 53235 - add triggers to workaround rpm not honoring Requires(preun) - document upgrade paths extensively in spec * Fri Jul 06 2007 Anssi Hannula <anssi@mandriva.org> 2.0.1-2mdv2008.0 + Revision: 49173 - rebuild for new openoffice.org * Tue May 15 2007 Anssi Hannula <anssi@mandriva.org> 2.0.1-1mdv2008.0 + Revision: 27050 - 2.0.1 * Mon Apr 30 2007 Anssi Hannula <anssi@mandriva.org> 2.0-2mdv2008.0 + Revision: 19580 - fix license * Mon Apr 30 2007 Anssi Hannula <anssi@mandriva.org> 2.0-1mdv2008.0 + Revision: 19515 - 2.0 - ignore unopkg failure during preun * Wed Feb 28 2007 Anssi Hannula <anssi@mandriva.org> 1.2-3mdv2007.0 + Revision: 127331 - allow co-installation with openoffice.org(64)-go-ooo-voikko - update package name in %%pre incompatibility error message * Mon Feb 12 2007 Anssi Hannula <anssi@mandriva.org> 1.2-2mdv2007.1 + Revision: 119899 - adapt .spec for building with different OOo versions - add Requires(post) to x86_64 package too - rebuild for new openoffice.org - update URL * Sat Nov 11 2006 Anssi Hannula <anssi@mandriva.org> 1.2-1mdv2007.1 + Revision: 83154 - 1.2 - adapt spec for upstream name change - Import openoffice.org-voikko * Sat Sep 16 2006 Anssi Hannula <anssi@mandriva.org> 1.1-2mdv2007.0 - change ooodir to match latest openoffice.org on x86_64 * Sun Sep 03 2006 Anssi Hannula <anssi@mandriva.org> 1.1-1mdv2007.0 - 1.1 (bugfixes) * Sat Sep 02 2006 Anssi Hannula <anssi@mandriva.org> 1.0-4mdv2007.0 - more robust update handling with posttrans * Sat Aug 26 2006 Anssi Hannula <anssi@mnadriva.org> 1.0-3mdv2007.0 - report correct src.rpm name on x86_64 - fix no-documentation * Thu Aug 24 2006 Anssi Hannula <anssi@mandriva.org> 1.0-2mdv2007.0 - use openoffice.org naming on x86_64 * Wed Aug 23 2006 Anssi Hannula <anssi@mandriva.org> 1.0-1mdv2007.0 - initial Mandriva release