File kompozer.spec of Package kompozer

#
# spec file for package kompozer
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           kompozer
BuildRequires:  fdupes gcc-c++
BuildRequires:  gtk2-devel
BuildRequires:  krb5-devel
BuildRequires:  gnome-vfs2-devel
BuildRequires:  libgnome-devel
BuildRequires:  libgnomeui-devel
BuildRequires:  libidl-devel
BuildRequires:  mozilla-nss-devel >= 3.12
BuildRequires:  mozilla-nspr-devel >= 4.7.2
BuildRequires:  cairo-devel >= 0.5
BuildRequires:  startup-notification-devel
# BuildRequires:  tcsh
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRequires:  hicolor-icon-theme
BuildRequires:  zip
%if 0%{?suse_version} <= 1210
# Only needed for openSUSE <= 12.1; later it is pulled in by rpm-build.
BuildRequires:  xz
%endif
BuildRequires:  pango-devel
%if 0%{?suse_version} > 1220
BuildRequires:  pangox-devel  
%endif
BuildRequires:  freetype2-devel
BuildRequires:  myspell-dictionary
%if 0%{?suse_version} > 1310
BuildRequires:  myspell-en  
%endif
BuildRequires:  Mesa-devel
BuildRequires:  libidl-devel
BuildRequires:  xorg-x11-libXt-devel
BuildRequires:  zlib-devel
BuildRequires:  autoconf213
BuildRequires:  libpng-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libmng-devel
BuildRequires:  pkgconfig(xp)
BuildRequires:  hunspell-devel
Requires:       hunspell
Requires:       myspell-dictionary
%define progdir %{_libdir}/%{name}
License:        GPL-2.0+ or LGPL-2.1+ or SUSE-MPL-1.1+
Version:        0.8b3svn.225
Release:        0
Summary:        Web Authoring System
Url:            http://www.kompozer.net/
Group:          Productivity/Publishing/HTML/Editors
Source:         %{name}-%{version}.tar.xz
Source1:        kompozer.desktop
Source2:        kompozer.png
Source3:        l10n-%{name}-0.8b3.tar.xz
#
# The patchwork below is a port from the old nvu/kompozer
Patch200:       mozilla-freetype218.patch
Patch211:       unused-includes.patch
#
# The patchwork below is a backport from OBS mozilla firefox2 package
# last change: Thu Apr 23 2009 - wr@rosenauer.org
# Patches commented with #B are browser only.
# Patches commented with #N don't apply, but maybe may be useful.
# Patches commented with #X don't compile, but maybe may be useful.
# Patches with name kompozer-* required porting.
# Patch100 needs to be regenerated from scratch calling autoconf-2.13 from package autoconf213.
Patch1:         x11-session.patch
#NPatch2:       rpath.patch
Patch3:         gcc-undefined-ops.patch
Patch4:         mozilla-gcc4.3-fixes.patch
Patch5:         abuild.patch
# Patch6:         kompozer-png14.patch
#http://sourceforge.net/p/kompozer/patches/_discuss/thread/e00a786c/45b0/attachment/kompozer-0.8-png15-build.patch
#applies to png14, as well
Patch6:         kompozer-0.8-png15-build.patch
Patch7:         locale.patch
# lockdown infrastructure
#BPatch8:       firefox-ui-lockdown.patch
#BPatch9:       gecko-lockdown.patch
#BPatch10:      gconf-backend.patch
Patch11:        gnome-vfs.patch
Patch12:        misc.diff
Patch13:        nss-opt.patch
#BPatch14:      credits.patch
Patch15:        em-356370.patch
# bmo #273524 (only for NLD)
#NPatch16:      gnome-vfs-default.patch
# integration
#BPatch17:      firefox-appname.patch
#BPatch18:      firefox-no-update.patch
#BPatch19:      dbus.patch
Patch1020:      kompozer-path_len.patch
# customization
Patch22:        cjk-postscript-fonts.diff
Patch23:        startup.patch
# bmo #324060
#XPatch24:      cups-paper.patch
Patch25:        system-extensions.patch
#NPatch27:      system-proxies.patch
# bmo #331522
Patch32:        postscript.patch
Patch33:        proxy-dev.patch
# integration
#NPatch34:      skin-selection.patch
Patch36:        greasemonkey.patch
Patch37:        firefox-381370.patch
Patch40:        synaptics-scroll-358863.patch
Patch41:        firefox-ntlm.patch
# gconf-backend.patch dbus.patch startup.patch
Patch100:       configure.patch
Patch101:       gcc46_default_ctors.patch
#http://svnweb.mageia.org/packages/cauldron/kompozer/current/SOURCES/kompozer-0.8b3-NS_DEFCALL.patch?view=markup&pathrev=388801
#https://aur.archlinux.org/packages/xulrunner192/?comments=all
#should fix compile issue with gcc47+i686 (arch.: 32-bit) (openSUSE 12.2+)
Patch1030:      kompozer-0.8b3-NS_DEFCALL.patch
#From Arch linux community
Patch300:       freetype-header.patch
Patch301:       any_kernel_26_plus.patch
# %%define _use_internal_dependency_generator 0
# %%define my_provides %%{_builddir}/%%{?buildsubdir}/my-provides
# %%define my_requires %%{_builddir}/%%{?buildsubdir}/my-requires
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# before 11.1:
Provides:       nvu = 1.0.0.%{version}
Obsoletes:      nvu < 1.0.0.%{version}

%description
KompoZer is a complete web authoring system that combines web file 
management and easy-to-use WYSIWYG web page editing.

KompoZer is designed to be extremely easy to use, making it ideal for 
non-technical computer users who want to create an attractive, 
professional-looking web site without needing to know HTML or web coding. 

Features
* WYSIWYG editing of pages, making Web creation as easy as typing a
  letter with your word processor.
* Integrated file management via FTP.  Simply log in to your Web
  site and navigate through your files, editing Web pages on the
  fly, directly from your site.
* Reliable HTML code creation that works with today's most popular
  browsers.
* Jump between WYSIWYG editing mode and HTML using tabs.
* Tabbed editing to make working on multiple pages a snap.
* Powerful support for frames, forms, tables, and templates.


%package translations
Summary:        Translations for KompoZer
Group:          System/Localization
Provides:       locale(%{name}:ca;cs;da;de;eo;es_ES;fi;fr;hsb;hu;it;ja;ko;lt;nl;pl;pt_BR;pt_PT;ru;sl;uk;zh_CN;zh_TW)
Requires:       %{name} = %{version}
Obsoletes:      %{name}-translations < %{version}-%{release}

%description translations
This package contains several languages for the user interface
of KompoZer.


%prep
%setup -q -a 3 -n %{name}-%{version}
%patch6 -p1
%if 0%{?suse_version} >= 1220
%ifarch i586
%patch1030
%endif
%endif
cd mozilla/
cp composer/config/mozconfig.fedora composer/config/mozconfig.opensuse
%patch200
%patch211
%patch1 -p1
#%%patch2
%patch3
%patch4
%patch5 -p2
# %%patch6
%patch7
# lockdown stuff
#%%patch8 -p1
#%%patch9
#%%patch10 -p2
%patch11
%patch12
%patch13
#%%patch14
%patch15
#%%patch17
#%%patch18
#%%patch19
%patch1020 -p1
%patch22
%patch23 -p1
#%%patch24
%patch25
#%%patch27
#if #nld9
#%%patch16
#endif
%patch32
%patch33 -p1
#%%patch34
%patch36
%patch37 -p2
%patch40 -p0
%patch41 -p2
%patch100
%patch101
%patch300
%patch301

%build
cd mozilla/
# no need to add build time to binaries
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
find . -regex ".*\.c\|.*\.cpp\|.*\.h" -exec sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" {} +
#
export SUSE_ASNEEDED=0
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CPPFLAGS="-I/usr/include/freetype2"
# -fpermissive no more needed see Patch6
%ifarch ppc64
export CFLAGS="$CFLAGS -mminimal-toc"
%endif
cp composer/config/mozconfig.opensuse .mozconfig
echo "ac_add_options --with-system-nspr" >>.mozconfig
echo "ac_add_options --with-system-nss" >>.mozconfig
echo "ac_add_options --enable-startup-notification" >>.mozconfig
echo "export CFLAGS=\"$CFLAGS\"" >>.mozconfig
echo "export CXXFLAGS=\"$CXXFLAGS\"" >>.mozconfig
echo "export HOST_CFLAGS=\"$CFLAGS\"" >>.mozconfig
echo "export HOST_CXXFLAGS=\"$CXXFLAGS\"" >>.mozconfig
#
# The configuration below is a backport from OBS mozilla firefox2 package
# last change: Thu Apr 23 2009 - wr@rosenauer.org
cat << EOF >> .mozconfig
#mk_add_options MOZILLA_OFFICIAL=1
#mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZ_MAKE_FLAGS=%{?jobs:-j%jobs}
#. \$topsrcdir/browser/config/mozconfig
#ac_add_options --prefix=%%{_prefix}
ac_add_options --libdir=%{_libdir}
#ac_add_options --sysconfdir=%%{_sysconfdir}
ac_add_options --mandir=%{_mandir}
#ac_add_options --includedir=%%{_includedir}
ac_add_options --enable-optimize="$CFLAGS"
ac_add_options --with-system-jpeg
ac_add_options --with-system-png
ac_add_options --with-system-mng
ac_add_options --with-system-zlib
ac_add_options --enable-default-toolkit=gtk2
#Bac_add_options --enable-gconf
ac_add_options --enable-svg
ac_add_options --enable-canvas
ac_add_options --enable-xft
#ac_add_options --disable-freetype2
ac_add_options --disable-installer
#ac_add_options --enable-static
#ac_add_options --disable-shared
#ac_add_options --disable-tests
#ac_add_options --disable-debug
ac_add_options --with-default-mozilla-five-home=%{_libdir}/kompozer
EOF
make -f client.mk build_all

%install

pushd obj-kompozer/xpfe/components && %__make ; popd
pushd obj-kompozer && %__make install DESTDIR=%{buildroot} ;popd

%__install -D -m 644 %{S:1} %{buildroot}%{_datadir}/applications/%{name}.desktop
%__install -d -m 755 %{buildroot}%{_datadir}/pixmaps
ln -sfT %{_libdir}/%{name}/icons/mozicon50.xpm %{buildroot}%{_datadir}/pixmaps/%{name}.xpm
%suse_update_desktop_file %{name}

# manpage:m
install -D -m 644 packages/debian/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
gzip -9 %{buildroot}%{_mandir}/man1/%{name}.1

# spellchecker support:
rm -rf %{buildroot}%{_libdir}/%{name}/dictionaries/
ln -sf %{_datadir}/myspell %{buildroot}%{_libdir}/kompozer/dictionaries

# cleaning non used devel and debug files
rm %{buildroot}%{_bindir}/kompozer-config
rm -rf %{buildroot}%{_libdir}/pkgconfig/
rm -rf %{buildroot}%{_libdir}/debug/
rm -rf %{buildroot}%{_datadir}/idl/
rm -rf %{buildroot}%{_includedir}

# Remove exec bit from .js files to prevent lintian warnings.
chmod -x %{buildroot}/%{_libdir}/%{name}/components/*.js

#$RPM_BUILD_ROOT/usr/lib/kompozer/run-mozilla.sh $RPM_BUILD_ROOT/usr/lib/kompozer/regxpcom
#$RPM_BUILD_ROOT/usr/lib/kompozer/run-mozilla.sh $RPM_BUILD_ROOT/usr/lib/kompozer/kompozer-bin -register
#sed -i s:$RPM_BUILD_ROOT::g $RPM_BUILD_ROOT/usr/lib/kompozer/components/xpti.dat
# cat << EOF > %%{my_provides}
# cat > /dev/null
# #! /bin/sh
# echo /usr/bin/kompozer
# EOF
# cat << EOF > %%{my_requires}
# #! /bin/sh
# /usr/lib/rpm/find-requires |
# while read ; do
#     if ! test -e $RPM_BUILD_ROOT/usr/lib/kompozer/\${REPLY%%%%(*} ; then #)
# 	echo "\$REPLY"
#     fi
# done
# EOF
# chmod 755 %%{my_provides} %%{my_requires}
# %%define __find_provides %%{my_provides}
# %%define __find_requires %%{my_requires}
# find $RPM_BUILD_ROOT/usr/lib/kompozer -name '*.xpm' -exec chmod -x {} \;
# chmod -x $RPM_BUILD_ROOT/usr/lib/kompozer/LICENSE

install -d -m 755 %{buildroot}%{progdir}/extensions
# install additional locales
rm -f %{_tmppath}/translations.*
touch %{_tmppath}/translations.lst
for locale in `tr ';_' ' -' <<<'ca;cs;da;de;eo;es_ES;fi;fr;hsb;hu;it;ja;ko;lt;nl;pl;pt_BR;pt_PT;ru;sl;uk;zh_CN;zh_TW'`; do
  case $locale in
   ja-JP|en-US)
        ;;
   *)
        [ -f "l10n-%{name}-0.8b3/%{name}-0.8b3.${locale}.xpi" ] || continue
        unzip l10n-%{name}-0.8b3/%{name}-0.8b3.${locale}.xpi \
          -d %{buildroot}%{progdir}/extensions/langpack-$locale@kompozer.net
#        remove prefs, profile defaults, and hyphenation from langpack
        rm -rf $RPM_BUILD_ROOT%{progdir}/extensions/langpack-$locale@kompozer.net/defaults
        rm -rf $RPM_BUILD_ROOT%{progdir}/extensions/langpack-$locale@kompozer.net/hyphenation
#        fix max version in rdf
        sed -i 's|<em:maxVersion>.*</em:maxVersion>|<em:maxVersion>1.0</em:maxVersion>|' \
          %{buildroot}%{progdir}/extensions/langpack-$locale@kompozer.net/install.rdf
        echo %{progdir}/extensions/langpack-$locale@kompozer.net \
          >> %{_tmppath}/translations.lst
        ;;
  esac
done
sed 's/^\(.\+\)$/\%exclude \1/' %{_tmppath}/translations.lst > %{_tmppath}/translations.xcld

%fdupes $RPM_BUILD_ROOT%{_prefix}

%clean
rm -rf $RPM_BUILD_ROOT

%post
%desktop_database_post
%icon_theme_cache_post
/sbin/ldconfig

%postun
%desktop_database_postun
%icon_theme_cache_postun
/sbin/ldconfig

%files -f %{_tmppath}/translations.xcld
%defattr(-,root,root)
%doc mozilla/LEGAL mozilla/LICENSE mozilla/README.txt
%{_mandir}/man1/%{name}.1.gz
%{_bindir}/*
%{_libdir}/%{name}
%{_datadir}/*/%{name}.*

%files translations -f %{_tmppath}/translations.lst
%defattr(-,root,root)
%dir %{progdir}
%dir %{progdir}/extensions/

%changelog
openSUSE Build Service is sponsored by