File nightingale.spec of Package nightingale

#
# spec file for package nightingale
#
# Copyright (c) 2016 SUSE LINUX 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/
#


%define srcname %{name}-hacking
%define srcdep  %{name}-deps-xul-192
%define gitdep  +git.20160618
%define depdir  linux-%{parch}
%define verxul  1.9.2
%define system_nspr 1
%define system_nss  1
%define system_sqlite 0
%define gst_pluginsdir %(pkg-config --variable=pluginsdir gstreamer-1.0)
%if 0%{?system_nspr}
%define nspr_include %(pkg-config --cflags-only-I nspr)
%endif
%ifarch %{ix86}
%define parch i686
%else
%define parch x86_64
%endif

%define _use_internal_dependency_generator 0
%define __find_provides %{nil}
%define __find_requires sh %{SOURCE99}

Name:           nightingale
Version:        1.13+git.20160111.78bd501
Release:        0
Summary:        Powerful Music Player
License:        GPL-2.0 and MPL-1.1
Group:          Productivity/Multimedia/Sound/Players
Url:            http://getnightingale.com
Source0:        https://github.com/nightingale-media-player/nightingale-hacking/archive/%{name}-%{version}.tar.gz#/%{srcname}-%{version}.tar.gz
# Use the dependencies only for building xulrunner and sqlite
Source1:        https://github.com/nightingale-media-player/nightingale-deps.git#/%{srcdep}%{gitdep}.tar.gz
# PATCH-FIX-UPSTREAM pointer-decl.patch avvissu@yandex.ru -- Program is using implicit definitions of special functions
Patch0:        	nightingale-xul192_implicit-fortify-decl.patch
Source99:       find_external_requires.sh
BuildRequires:  autoconf
BuildRequires:  autoconf213
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  libtool
BuildRequires:  python
BuildRequires:  libjpeg-devel
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(cairo)
BuildRequires:  pkgconfig(dbus-glib-1)
BuildRequires:  pkgconfig(gnome-vfs-2.0)
BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(hunspell)
BuildRequires:  pkgconfig(libIDL-2.0)
BuildRequires:  pkgconfig(libnotify)
BuildRequires:  pkgconfig(nspr)
BuildRequires:  pkgconfig(nss)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(taglib)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xt)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  unzip
BuildRequires:  zip
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
Recommends:     gstreamer-plugins-bad
Recommends:     gstreamer-plugins-ugly
Recommends:     gstreamer-plugins-good
Recommends:     gstreamer-plugins-libav
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %{ix86} x86_64
BuildRequires:  gcc-c++

%description
Nightingale is a desktop media player a digital jukebox and Web browser
mash-up. It supports extensions and skins feathers. Like Firefox/Iceweasel,
it is built from the Mozilla cross-platform and open source framework,
based on Songbird.

%prep
%setup -q -n %{srcname}-%{version} -b1
# Remove rpath $$ORIGIN (use LDFLAGS when building xulrunner)
sed -i '/Wl/s|[\]\?\$\$ORIGIN/\..|%{_libdir}/%{name}|' \
$(grep -rl '\$ORIGIN/\../xulrunner')
#
# use langpaks from other version
sed -i '/songbird\.url\.locales/s/\%VERSION\%/1\.12\.2a/' \
$(grep -rl 'pref..songbird.url.locales')
#
pushd %{_builddir}
# Remove all hidden files (only for git)
find . -type f -iname '.*' -exec rm -f {} \; || :
#
# Don't use -gstabs+ when building with debug information:
# .stabs description field is too big
# or add -m32/-m64 to build with STABS symbols
sed -i 's/-gstabs+\?/-g/g' $(grep -rlw '\-gstabs')
#
pushd %{srcdep}%{gitdep}
%patch0 -p1
# Don't compile in DATE and TIME
BUILDDATE=$(LC_ALL=C date -ur %{_sourcedir}/%{name}.changes +'%b %d %Y')
BUILDTIME=$(LC_ALL=C date -ur %{_sourcedir}/%{name}.changes +'%H:%M')
sed -e "s/__DATE__/\"$BUILDDATE\"/" \
    -e "s/__TIME__/\"$BUILDTIME\"/" \
    -i $(grep -rl '__DATE__\|__TIME__')
#
# Change path to symbolstore.py when building sqlite
sed -i '/symbolstore.py/s|$(SB_VENDOR_XR_TARGET)|%{srcdep}%{gitdep}/xulrunner-%{verxul}|' \
songbird-vendor-rules.mk
#
pushd xulrunner-%{verxul}/mozconfigs
# Use internal bz2 and pnd
# bz2: undefined reference to `BZ2_crc32Table'
# PNG: no APNG support
sed	-e '/with-system-png/d' \
    -e '/with-system-bz2/d' \
    -i $(grep -rl 'with-system-png\|with-system-bz2')
popd
popd
popd
#

%build
# Build dependencies xulrunner and sqlite
# see: nightingale-deps*/build.sh
export SB_VENDOR_BUILD_ROOT=%{_builddir}
export SB_VENDOR_BINARIES_CO_ROOT=%{_builddir}
mkdir %{_builddir}/%{depdir}
pushd %{_builddir}/%{srcdep}%{gitdep}
# sqlite
sed -i '/^SB_CFLAGS/i \SB_CFLAGS += %{optflags}' \
sqlite/Makefile.songbird
pushd sqlite
autoreconf -fiv
popd
make -C sqlite -f Makefile.songbird
#
# xulrunner
export CFLAGS="%{optflags} -Os -fno-strict-aliasing -fpermissive"
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="-Wl,-rpath -Wl,%{_libdir}/%{name}/xulrunner"
for c in $(find . -name *\.linux.release.%{parch}.*); do
cat << EOF >> $c
mk_add_options MOZ_MAKE_FLAGS=%{?jobs:-j%jobs}
ac_add_options --disable-optimize
ac_add_options --enable-system-hunspell
ac_add_options --enable-system-cairo
%if 0%{?system_sqlite}
ac_add_options --enable-system-sqlite
%endif
%if 0%{?system_nspr}
ac_add_options --with-system-nspr
%endif
%if 0%{?system_nss}
ac_add_options --with-system-nss
%endif
EOF
done
make -C xulrunner-%{verxul} -f Makefile.songbird xr-build-release xr-packaging-release
popd
#
rm -rf dependencies/%{depdir}
ln -s %{_builddir}/%{depdir} dependencies/%{depdir}
# Build nightingale 
# see: nightingale-hacking*/build.sh
export GST_PLUGIN_PATH="%{gst_pluginsdir}"
export CXXFLAGS="%{optflags} %{?nspr_include}"
cat << EOF > %{name}.config
ac_add_options --with-taglib-source=system
ac_add_options --enable-official
ac_add_options --enable-libnotify
ac_add_options --with-media-core=gstreamer-system
%if 0%{?system_nspr}
ac_add_options --enable-system-nspr
%endif
EOF
make V=1

%install
%make_install libdir=%{_libdir}
# Support gst-1.0
sed -i 's/0\.10/1\.0/g' %{buildroot}%{_libdir}/%{name}/%{name}
#
# Install addons
for p in $(find compiled/xpi-stage -type f -name \*.xpi); do
f=$(basename $p)
install -Dm0644 $p %{buildroot}%{_datadir}/%{name}/addons/$f
done
#
# zero-length
find %{buildroot} -type f -empty -exec rm {} \; || :
# Use path %%doc
rm -rf %{buildroot}%{_datadir}/doc/%{name}/{CONTRIBUTING*,LICENSE,README*}
#
%fdupes -s %{buildroot}%{_libdir}

%post
%icon_theme_cache_post
%desktop_database_post
# Notify user about changes
if [ $1 -eq 1 ] ; then
mkdir -p %{_localstatedir}/adm/update-messages
rm -f %{_localstatedir}/adm/update-messages/%{name}-%{version}
cat > %{_localstatedir}/adm/update-messages/%{name}-%{version} << EOF
INFO: Please remove the old profile from ~/.%{name}
INFO: You will find addon files in %{_datadir}/%{name}/addons
EOF
fi

%postun
%icon_theme_cache_postun
%desktop_database_postun

%files
%defattr(-,root,root)
%doc CONTRIBUTING* LICENSE README* TRADEMARK*
%{_bindir}/%{name}
%{_libdir}/%{name}/
%{_datadir}/%{name}/
%dir %{_datadir}/icons/hicolor/512x512
%dir %{_datadir}/icons/hicolor/512x512/apps
%{_datadir}/icons/hicolor/*/apps/%{name}.??g
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man1/%{name}.1%{ext_info}

%changelog
openSUSE Build Service is sponsored by