Blob Blame History Raw
# TODO:	sunbird.i386: E: shared-lib-without-dependency-information /usr/lib/sunbird-0.9/libnspr4.so
# 	we should be linking against system nspr
# TODO: link against system libical (rishi)
# TODO: language packs, also for lightning

%define progdir %{_prefix}/%{_lib}/%{name}-%{version}pre
%define docs LEGAL LICENSE README.txt
%{?_with_official:%define official 1}

# This is to filter unwanted provides, that should be provided only by gecko-devel
%define _use_internal_dependency_generator 0
%define __find_requires %{SOURCE100} %{buildroot}

Name:           sunbird
Version:        0.9
Release:        0.3.20080824cvs%{?dist}
Summary:        Mozilla Sunbird Calendar

Group:          Applications/Productivity
License:        MPLv1.1 or GPLv2+ or LGPLv2+
URL:            http://www.mozilla.org/projects/calendar/sunbird/
Source0:        sunbird-0.9pre.tar.gz
#http://releases.mozilla.org/pub/mozilla.org/calendar/sunbird/releases/%{version}/source/lightning-sunbird-%{version}-source.tar.bz2
Source1:        sunbird.desktop
Source2:        sunbird-langpacks-0.9pre.tar.gz
Source3:        mozilla-extension-update.sh
Source100:      find-external-requires

# build patches
Patch2:         sunbird-0.7-path.patch
Patch3:         sunbird-0.7-uilocale.patch
   
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  libIDL-devel
BuildRequires:  desktop-file-utils
BuildRequires:  libgnomeui-devel
BuildRequires:  krb5-devel
BuildRequires:  pango-devel
BuildRequires:  freetype-devel >= 2.1.9
BuildRequires:  libXt-devel
BuildRequires:  desktop-file-utils
BuildRequires:  zip

Requires(post):  desktop-file-utils
Requires(postun):  desktop-file-utils

AutoProv: 0

%description
Mozilla Sunbird™ is a cross-platform calendar application, built upon
Mozilla Toolkit. Our goal is to bring Mozilla-style ease-of-use to your
calendar, without tying you to a particular storage solution.

%package -n thunderbird-lightning
Summary:        The calendar extension to Thunderbird
Group:          Applications/Productivity
Requires:       thunderbird >= 2
Obsoletes:      thunderbird-lightning-wcap <= 0.8
Provides:       thunderbird-lightning-wcap = %{version}-%{release}
AutoProv: 0

%description -n thunderbird-lightning
Lightning brings the Sunbird calendar to the popular email client,
Mozilla Thunderbird. Since it's an extension, Lightning is tightly
integrated with Thunderbird, allowing it to easily perform email-related
calendaring tasks.


%define lightning_extname '{e2fda1a4-762b-4020-b5ad-a41df1933103}'

%define tbupdate_lightning                                      \\\
  %{_libdir}/thunderbird-lightning/mozilla-extension-update.sh  \\\
  --appname thunderbird                                         \\\
  --extname %{lightning_extname}                                \\\
  --basedir %{_libdir}                                          \\\
  --extpath %{_libdir}/thunderbird-lightning                    \\\
  --action 


%prep
%setup -q -n mozilla
%patch2 -p1 -b .path
%patch3 -p1 -b .uilocale
# Fix source perms to avoid errors in the debuginfo RPM (bug 357661)
find . -type f \( -name "*.cpp" -o -name "*.h" \) -exec chmod -x '{}' \;


%build
%if 0%{?official}
export MOZILLA_OFFICIAL=1
export BUILD_OFFICIAL=1
%endif
export CFLAGS="$(echo $RPM_OPT_FLAGS |sed 's/-O2/-Os/;s/-Wall//')"
export CXXFLAGS="$CFLAGS"
cat << EOF > .mozconfig
%if 0%{?official}
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
ac_add_options --enable-official-branding
%endif
mk_add_options MOZ_MAKE_FLAGS=%{?_smp_mflags}
ac_add_options --enable-application=calendar
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 --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-jpeg
ac_add_options --with-system-zlib
ac_add_options --with-pthreads
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-installer
ac_add_options --enable-optimize="$CFLAGS"
ac_add_options --enable-xinerama
ac_add_options --disable-xprint
ac_add_options --disable-strip
ac_add_options --enable-pango
ac_add_options --enable-system-cairo
ac_add_options --enable-svg
ac_add_options --enable-canvas
ac_add_options --enable-extensions=default,lightning
ac_add_options --disable-updater
ac_add_options --disable-crashreporter
EOF
make -f client.mk MOZ_CAIRO_LIBS='-lcairo -lX11 -lXrender' build
# make package directory
make -C xpinstall/packager STRIP=/bin/true

#ac_add_options --enable-default-toolkit=cairo-gtk2
# configure: error: Toolkit must be cairo-gtk2.

#ac_add_options --with-system-png
# checking for png_get_valid in -lpng... yes
# checking for png_get_acTL in -lpng... no
# configure: error: --with-system-png won't work because the system's libpng doesn't have APNG support

%install
rm -rf $RPM_BUILD_ROOT
# The make install does not work (it tries to build additional stuff that break)
#make install DESTDIR=$RPM_BUILD_ROOT
# TODO: Is the above still true? Recheck!

# copy tree into RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{progdir}
cp -rf $RPM_BUILD_DIR/mozilla/dist/%{name}/* $RPM_BUILD_ROOT%{progdir}
mkdir $RPM_BUILD_ROOT%{_bindir}
mv $RPM_BUILD_ROOT%{progdir}/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}


desktop-file-install --vendor="fedora"                  \
  --dir=$RPM_BUILD_ROOT%{_datadir}/applications/        \
  %{SOURCE1}

# Fix some permissions
find $RPM_BUILD_ROOT%{progdir} -name "*.xpm" -o -name "*.png" |xargs chmod -x
chmod -x $RPM_BUILD_ROOT%{progdir}/defaults/profile/prefs.js    \
  $RPM_BUILD_ROOT%{progdir}/js/calAlarmMonitor.js               \
  $RPM_BUILD_ROOT%{progdir}/js/calFreeBusyService.js

# Avoid "Chrome Registration Failed" message on first startup and extension installation
touch $RPM_BUILD_ROOT%{progdir}/extensions/%{lightning_extname}/chrome.manifest

# Icon
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps
cp $RPM_BUILD_ROOT%{progdir}/icons/mozicon128.png \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps/%{name}.png

# Docs in %%doc
for doc in %{docs}; do
  rm -f $RPM_BUILD_ROOT%{progdir}/$doc
done

# Install langpacks
mkdir -p $RPM_BUILD_ROOT%{progdir}/extensions
rm -rf sunbird-langpacks
mkdir sunbird-langpacks
tar xzf %{SOURCE2} -C sunbird-langpacks
for langpack in sunbird-langpacks/*.xpi; do
  language=$(basename $langpack .xpi)
  extensiondir=$RPM_BUILD_ROOT%{progdir}/extensions/langpack-$language@sunbird.mozilla.org
  mkdir -p $extensiondir
  unzip $langpack -d $extensiondir
  find $extensiondir -type f -print0 |xargs -0 chmod 644
  # Fix #441500
  sed 's/\r//g' $extensiondir/install.rdf |awk '/^$/ {next} {print}' >lala
  mv lala $extensiondir/install.rdf
done

# Lightning
unzip -d $RPM_BUILD_ROOT%{_libdir}/thunderbird-lightning dist/xpi-stage/lightning.xpi
install -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libdir}/thunderbird-lightning/mozilla-extension-update.sh
# Fix some permissions
chmod -x $RPM_BUILD_ROOT%{_libdir}/thunderbird-lightning/js/calAlarmMonitor.js \
  $RPM_BUILD_ROOT%{_libdir}/thunderbird-lightning/js/calFreeBusyService.js


%clean
rm -rf $RPM_BUILD_ROOT


%post
update-desktop-database %{_datadir}/applications
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%postun
update-desktop-database %{_datadir}/applications
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%post -n thunderbird-lightning
%{tbupdate_lightning} install || :


%preun -n thunderbird-lightning
if [ $1 = 0 ]; then
  %{tbupdate_lightning} remove || :
fi


%postun -n thunderbird-lightning
# This is needed not to reverse the effect of our preun, which
# is guarded against upgrade, but because of our triggerun,
# which is run on self-upgrade, though triggerpostun isn't
if [ $1 != 0 ]; then
  %{tbupdate_lightning} install || :
fi

%triggerin -n thunderbird-lightning -- thunderbird
%{tbupdate_lightning} install || :

%triggerun -n thunderbird-lightning -- thunderbird
%{tbupdate_lightning} remove || :

%triggerpostun -n thunderbird-lightning -- thunderbird
# Guard against being run post-self-uninstall, even though that
# doesn't happen currently (see comment above)
if [ $1 != 0 ]; then
  %{tbupdate_lightning} install || :
fi


%files
%defattr(-,root,root,-)
%doc %{docs}
%{progdir}
%{_bindir}/sunbird
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/128x128/apps/sunbird.png


%files -n thunderbird-lightning
%defattr(-,root,root,-)
%{_libdir}/thunderbird-lightning


%changelog
* Sun Aug 24 2008 Lubomir Rintel <lkundrak@v3.sk> 0.9-0.3.20080824cvs
- Newer snapshot closer to RC
- New langpacks
- Fix install root path

* Mon Aug 11 2008 Lubomir Rintel <lkundrak@v3.sk> 0.9-0.2.20080807cvs
- Get rid of relative symlinks
- Remove lignthing's libcalbasecomps.so provide
- Fix dependencies of scriptlets

* Sun Aug 10 2008 Lubomir Rintel <lkundrak@v3.sk> 0.9-0.1.20080807cvs
- First attempt at 0.9, CVS snapshot close to first RC
- Rewrite the requires generation, for it suffered bitrot

* Mon May 19 2008 Lubomir Rintel <lkundrak@v3.sk> 0.8-4
- Rebuild for new hunspell

* Tue Apr 08 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.8-3
- Really fix lightning dependencies (#441340)
- Fix "da" and "it" lanugage packs (#441500)

* Mon Apr 07 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.8-2
- Blacklist dependencies of lightning on files included in tb (#441340)
- Fix the extension update scriptlet escaping

* Fri Apr 04 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.8-1
- 0.8 GA

* Fri Apr 04 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.8-0.3.cvs20080331
- Translations

* Tue Apr 01 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.8-0.2.cvs20080331
- Unbreak dependencies (hopefully)
- Try concurrent builds again, they seem to work now

* Tue Apr 01 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.8-0.1.cvs20080331
- Corrected license tag to mention all the applicable Licenses
- Use libxul from XULrunner
- Post 0.8 Release Candidate 1
- Obsolete wcap subpackage -- got merged into mainline lightning

* Sun Mar 09 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.7-10
- Parralel makes were failing unpredictably

* Thu Feb 28 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.7-9
- Try to use the correct locale (#436693)

* Mon Jan 21 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.7-8
- Streamlined BuildRequires a bit
- Do not provide stuff that has to be provided by firefox
- Do not require what's in our fileset
- Removed redundant and useless Source0 without upstream

* Thu Jan 03 2008 Lubomir Kundrak <lkundrak@redhat.com> 0.7-7
- Add patch to correct build with FORTIFY_SOURCE
- Replace the name in .desktop file with a more descriptive one
- Add translations to .desktop file

* Sun Dec 30 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.7-6
- disable updater

* Tue Dec 11 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.7-5
- fix debuginfo package

* Tue Oct 30 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.7-4
- rename the mozilla-lightning subpackage to thunderbird-lightning
  since it's a thunderbird extension
- create a "chrome.manifest" file to avoid "Chrome Registration Failed" message

* Mon Oct 29 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.7-3
- be even more complicated: build the wcap-enabler extension
  (really, it's just cut'n'paste)

* Mon Oct 29 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.7-2
- split the lightning package
- use scriptlets and triggers based on the mugshot package

* Sat Oct 27 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.7-1
- version 0.7

* Tue Sep 11 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.5-3
- minor spec cleanups
- build the Lightning extension
- add an option to build with official branding

* Sun Sep 09 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.5-2
- fix icon

* Wed Jul 25 2007 Aurelien Bompard <abompard@fedoraproject.org> 0.5-1
- initial release