File moonlight.spec of Package moonlight
#
# spec file for package moonlight
#
# 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/
#
# Decide if we use FFmpeg
%define with_ffmpeg no
%if 0%{?packman_bs}
%define with_ffmpeg yes
%endif
# Decide if we use the system cairo
%define with_cairo embedded
%define required_cairo 1.8.4
%if 0%{?suse_version} >= 1120
%define with_cairo system
%endif
# The version we must have on the system to build the plugin
%define required_mono 2.6
# If the system mono is older we must disable the desktop parts
# because there will be problems with libmono.so
%define with_desktop yes
%define desktop_support --enable-desktop-support --enable-sdk
# Comment this section out if you know you have mono >= required_mono
#if 0%{?suse_version} < 1120
#define with_desktop no
#define desktop_support --disable-desktop-support --disable-sdk
#endif
# The version included with the sources (for the plugin assemblies)
%define included_mono 2.6.1
%define included_basic 2.6
# I have not parameterized this spec file to facilitate building only
# the desktop assemblies (or the plugin) but that should be possible
Name: moonlight
ExclusiveArch: %ix86 x86_64
License: LGPLv2.0
Group: Productivity/Multimedia/Other
Summary: Novell Moonlight
Url: http://go-mono.com/moonlight/
Version: 2.4
Release: 1.<RELEASE2>
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: %{name}-%{version}.tar.bz2
Source1: mono-%{included_mono}.tar.bz2
Source2: mono-basic-%{included_basic}.tar.bz2
Patch0: %{name}-2.4-underlinking.patch
# Required to build the included mono
BuildRequires: bison
# Always required
BuildRequires: gcc-c++
BuildRequires: gtk2-devel
BuildRequires: libexpat-devel
%if %{with_cairo} == system
BuildRequires: cairo-devel >= %required_cairo
%endif
# Technically these two could be optional
BuildRequires: alsa-devel
BuildRequires: libpulse-devel
# Required to build the desktop assemblies
%if %{with_desktop} == yes
BuildRequires: monodoc-core
BuildRequires: gtk-sharp2
BuildRequires: rsvg2-sharp
BuildRequires: wnck-sharp
BuildRequires: mono-devel >= %required_mono
%endif
# Required to build the plugin
BuildRequires: zip
# Choose the right version of xul
%define xul_version 190
%if 0%{?suse_version} >= 1120
%define xul_version 191
%endif
%if 0%{?suse_version} >= 1130
%define xul_version 192
%endif
BuildRequires: mozilla-xulrunner%{xul_version}-devel
%if %{with_ffmpeg} == yes
BuildRequires: libffmpeg-devel
%endif
%define debug_package_requires libmoon0 = %{version}-%{release}
%description
Moonlight is an open source implementation of Microsoft Silverlight for
Unix systems.
%package -n libmoon0
License: LGPLv2.0
Summary: Novell Moonlight
Group: Productivity/Multimedia/Other
%if %{with_desktop} == yes
Requires: mono-core >= %required_mono
%endif
%description -n libmoon0
Moonlight is an open source implementation of Microsoft Silverlight for
Unix systems.
%files -n libmoon0
%defattr(-, root, root)
%doc AUTHORS COPYING README TODO NEWS
%{_libdir}/libmoon.so.*
%dir %{_libdir}/moonlight
%{_libdir}/moonlight/libmono.so.0
%post -n libmoon0 -p /sbin/ldconfig
%postun -n libmoon0 -p /sbin/ldconfig
%package -n libmoon-devel
License: LGPLv2.0
Summary: Development files for libmoon
Group: Development/Languages/C and C++
%if %{with_desktop} == yes
Requires: mono-devel >= %required_mono
%endif
%description -n libmoon-devel
Development files for libmoon.
Moonlight is an open source implementation of Microsoft Silverlight for
Unix systems.
%files -n libmoon-devel
%defattr(-, root, root)
%{_libdir}/libmoon.so
%package plugin
License: LGPLv2.0 ; MIT License (or similar) ; Ms-Pl
Summary: Novell Moonlight Browser Plugin
Group: Productivity/Multimedia/Other
Requires: libmoon0 == %{version}
%description plugin
Novell Moonlight Browser Plugin.
Moonlight is an open source implementation of Microsoft Silverlight for
Unix systems.
%files plugin
%defattr(-, root, root)
%dir %{_libdir}/moonlight/plugin
%{_libdir}/moonlight/plugin/libmoonloader.so
%{_libdir}/moonlight/plugin/libmoonplugin-*bridge.so
%{_libdir}/moonlight/plugin/libmoonplugin.so
%{_libdir}/moonlight/plugin/Microsoft.VisualBasic.dll*
%{_libdir}/moonlight/plugin/System.Core.dll*
%{_libdir}/moonlight/plugin/System.Net.dll*
%{_libdir}/moonlight/plugin/System.Runtime.Serialization.dll*
%{_libdir}/moonlight/plugin/System.ServiceModel.Web.dll*
%{_libdir}/moonlight/plugin/System.ServiceModel.dll*
%{_libdir}/moonlight/plugin/System.Windows.Browser.dll*
%{_libdir}/moonlight/plugin/System.Windows.dll*
%{_libdir}/moonlight/plugin/System.Xml.dll*
%{_libdir}/moonlight/plugin/System.dll*
%{_libdir}/moonlight/plugin/mscorlib.dll*
# Is there somewhere we could put this that would be universal?
%if 0%{?suse_version}
%{_libdir}/browser-plugins/libmoonloader.so
%endif
# Conditional packages
%if %{with_desktop} == yes
%package web-devel
License: MIT License (or similar) ; Ms-Pl
Summary: Development files for Moonlight Web
Group: Development/Languages/Other
Recommends: %{name}-plugin == %{version}
%description web-devel
Development files for creating Moonlight web applications.
Moonlight is an open source implementation of Microsoft Silverlight for
Unix systems.
%files web-devel
%defattr(-, root, root)
%{_bindir}/smcs
%dir %{_prefix}/lib/moonlight
%dir %{_prefix}/lib/moonlight/2.0-redist
%{_prefix}/lib/moonlight/2.0-redist/System.Windows.Controls.Data.dll*
%{_prefix}/lib/moonlight/2.0-redist/System.Windows.Controls.dll*
%{_prefix}/lib/moonlight/2.0-redist/System.Xml.Linq.dll*
%dir %{_prefix}/lib/moonlight/2.0
%{_prefix}/lib/moonlight/2.0/Microsoft.VisualBasic.dll*
%{_prefix}/lib/moonlight/2.0/Mono.CompilerServices.SymbolWriter.dll*
%{_prefix}/lib/moonlight/2.0/System.Core.dll*
%{_prefix}/lib/moonlight/2.0/System.Net.dll*
%{_prefix}/lib/moonlight/2.0/System.Runtime.Serialization.dll*
%{_prefix}/lib/moonlight/2.0/System.ServiceModel.Web.dll*
%{_prefix}/lib/moonlight/2.0/System.ServiceModel.dll*
%{_prefix}/lib/moonlight/2.0/System.Windows.Browser.dll*
%{_prefix}/lib/moonlight/2.0/System.Windows.dll*
%{_prefix}/lib/moonlight/2.0/System.Xml.dll*
%{_prefix}/lib/moonlight/2.0/System.dll*
%{_prefix}/lib/moonlight/2.0/mscorlib.dll*
%{_prefix}/lib/moonlight/2.0/respack.exe*
%{_prefix}/lib/moonlight/2.0/smcs
%{_prefix}/lib/moonlight/2.0/smcs.exe*
%{_prefix}/lib/moonlight/2.0/buildversion
%{_datadir}/pkgconfig/moonlight-web-2.0.pc
%package desktop
License: MIT License (or similar) ; Ms-Pl
Summary: Mono bindings for Moonlight Desktop
Group: Productivity/Multimedia/Other
Requires: libmoon0 == %{version}
%description desktop
Mono bindings for Novell Moonlight.
Moonlight is an open source implementation of Microsoft Silverlight for
Unix systems.
%files desktop
%defattr(-, root, root)
%{_prefix}/lib/mono/gac/Moon.Windows.Desktop
%{_prefix}/lib/mono/gac/Moonlight.Gtk
%{_prefix}/lib/mono/gac/System.Windows
%{_prefix}/lib/mono/gac/System.Windows.Browser
%{_prefix}/lib/mono/gac/System.Windows.Controls
%{_prefix}/lib/mono/gac/System.Windows.Controls.Data
%package desktop-devel
License: MIT License (or similar) ; Ms-Pl
Summary: Development files for Moonlight Desktop
Group: Development/Languages/Other
Requires: libmoon0 == %{version}
Requires: glib2-devel
Requires: gtk-sharp2
Requires: %{name}-desktop == %{version}
Recommends: %{name}-tools == %{version}
%description desktop-devel
Development files for Moonlight Desktop.
Moonlight is an open source implementation of Microsoft Silverlight for
Unix systems.
%files desktop-devel
%defattr(-, root, root)
%dir %{_prefix}/lib/mono/moonlight
%{_prefix}/lib/mono/moonlight/Moon.Windows.Desktop.dll*
%{_prefix}/lib/mono/moonlight/System.Windows.Browser.dll*
%{_prefix}/lib/mono/moonlight/System.Windows.Controls.Data.dll*
%{_prefix}/lib/mono/moonlight/System.Windows.Controls.dll*
%{_prefix}/lib/mono/moonlight/System.Windows.dll*
%{_datadir}/pkgconfig/moonlight-desktop-2.0.pc
# It may make sense in the future to have a moonlight-gtk package
%{_prefix}/lib/mono/moonlight/Moonlight.Gtk.dll*
%{_prefix}/lib/monodoc/sources/moonlight-gtk.source
%{_prefix}/lib/monodoc/sources/moonlight-gtk.tree
%{_prefix}/lib/monodoc/sources/moonlight-gtk.zip
%{_datadir}/pkgconfig/moonlight-gtk-2.0.pc
# End conditional packages
%endif
%package tools
License: MIT License (or similar)
Summary: Various tools for Novell Moonlight
Group: Development/Languages/Other
Requires: libmoon0 == %{version}
%if %{with_desktop} == yes
Requires: %{name}-desktop == %{version}
%endif
%description tools
Various tools for Novell Moonlight.
Moonlight is an open source implementation of Microsoft Silverlight for
Unix systems.
%files tools
%defattr(-, root, root)
%if %{with_desktop} == yes
%{_bindir}/mopen
%{_bindir}/munxap
%endif
%{_bindir}/mxap
%{_bindir}/respack
%{_bindir}/sockpol
%{_bindir}/unrespack
%{_bindir}/xaml2html
%if %{with_desktop} == yes
%{_bindir}/xamlg
%{_mandir}/man1/mopen.1%ext_man
%{_mandir}/man1/mxap.1%ext_man
%{_mandir}/man1/respack.1%ext_man
%{_mandir}/man1/sockpol.1%ext_man
%{_mandir}/man1/svg2xaml.1%ext_man
%{_mandir}/man1/xamlg.1%ext_man
%{_libdir}/moonlight/mopen.exe*
%{_libdir}/moonlight/munxap.exe*
%endif
%{_libdir}/moonlight/mxap.exe*
%{_libdir}/moonlight/respack.exe*
%{_libdir}/moonlight/sockpol.exe*
%{_libdir}/moonlight/xaml2html.exe*
%{_libdir}/moonlight/xamlg.exe*
%prep
%setup -q -n %{name}-%{version}
%setup -q -T -D -b 1 -n %{name}-%{version}
%setup -q -T -D -b 2 -n %{name}-%{version}
%patch0
%build
# The plugin requires a complete build of it's own mono
pushd ../mono-%{included_mono}
# We have not determined which --enable-minimal options might be safe
# so please do not use any of them
./configure --prefix=%{_builddir}/install \
--with-mcs-docs=no \
--with-ikvm-native=no
%{__make} EXTERNAL_MCS=false EXTERNAL_RUNTIME=false #%{?jobs:-j%jobs} # mono is not strictly -j safe
# This gets installed in the build dir so that it gets wiped away
# and not installed on the system
%{__make} install
# libtool is evil, if the .la is present things get jacked up
find %{_builddir}/install -name \*.la -delete
popd
# Configure against the junk install of mono
export PATH=%{_builddir}/install/bin:${PATH}
export LD_LIBRARY_PATH=%{_builddir}/install/lib:${LD_LIBRARY_PATH}
export PKG_CONFIG_PATH=%{_builddir}/install/lib/pkgconfig:${PKG_CONFIG_PATH}
# And then we build moonlight
# Only needed when there are Makefile.am or configure.ac patches
autoreconf -f -i -Wnone
%configure --without-testing --without-performance --without-examples \
--without-debug --without-sanity-checks \
%{desktop_support} \
--with-mcspath=%{_builddir}/mono-%{included_mono}/mcs \
--with-mono-basic-path=%{_builddir}/mono-basic-%{included_basic} \
--with-ffmpeg=%{with_ffmpeg} \
--with-cairo=%{with_cairo}
# We need the system gac for gtk-sharp
# Only if we're linking to the junk mono
export MONO_GAC_PREFIX=%{_builddir}/install:%{_prefix}
%{__make} # nope! %{?jobs:-j%jobs}
%install
export PATH=%{_builddir}/install/bin:${PATH}
export LD_LIBRARY_PATH=%{_builddir}/install/lib:${LD_LIBRARY_PATH}
export PKG_CONFIG_PATH=%{_builddir}/install/lib/pkgconfig:${PKG_CONFIG_PATH}
%{__make} install DESTDIR=%{buildroot}
# Copy the custom libmono.so.0 for the plugin to use
install -m 644 %{_builddir}/install/lib/libmono.so.0 %{buildroot}%{_libdir}/moonlight/
# Symlink the loader into browser-plugins for SUSE
# plugin package was nuked for now
%if 0%{?suse_version}
mkdir -p %{buildroot}%{_libdir}/browser-plugins
ln -s %{_libdir}/moonlight/plugin/libmoonloader.so %{buildroot}%{_libdir}/browser-plugins/libmoonloader.so
%endif
# We don't like nasty .la files
find %{buildroot} -name \*.la -delete
%if %{with_desktop} == no
rm -f %{buildroot}%{_bindir}/xamlg
rm -f %{buildroot}%{_bindir}/smcs
%endif
%clean
rm -rf %{buildroot}
%changelog