File flash-player.spec of Package flash-player

#
# spec file for package flash-player
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           flash-player
Version:        32.0.0.465
Release:        0
Summary:        Adobe Flash Plugin and Standalone Player
License:        NonFree
URL:            https://get.adobe.com/flashplayer
%ifarch %ix86
Source0:        https://fpdownload.macromedia.com/get/flashplayer/pdc/%{version}/flash_player_ppapi_linux.i386.tar.gz#/flash_player_ppapi_%{version}_linux.i386.tar.gz
Source1:        https://fpdownload.macromedia.com/get/flashplayer/pdc/%{version}/flash_player_npapi_linux.i386.tar.gz#/flash_player_npapi_%{version}_linux.i386.tar.gz
Source2:        flash_player_sa_11.2.202.644_linux.i386.tar.gz
%endif
%ifarch x86_64
Source0:        https://fpdownload.macromedia.com/get/flashplayer/pdc/%{version}/flash_player_ppapi_linux.x86_64.tar.gz#/flash_player_ppapi_%{version}_linux.x86_64.tar.gz
Source1:        https://fpdownload.macromedia.com/get/flashplayer/pdc/%{version}/flash_player_npapi_linux.x86_64.tar.gz#/flash_player_npapi_%{version}_linux.x86_64.tar.gz
Source2:        https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux64/flash_player_sa_linux.x86_64.tar.gz#/flash_player_sa_%{version}_linux.x86_64.tar.gz
%endif
Source3:        flashplayer.desktop
Source4:        flashplayer.png
Source5:        mms.cfg
# PATCH-FIX-OPENSUSE flash-player-desktop.patch -- Fix the desktop file to be MATE/GNOME compatible.
Patch0:         flash-player-desktop.patch
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
# Flash Player and the plugin dynamically opens that one and segfaults if not available (2008-11-12).
Requires:       libasound2%{?_isa}
Requires:       libcurl4%{?_isa}
Provides:       flash-plugin = %{version}
ExclusiveArch:  %ix86 x86_64

%description
This package contains Adobe's Flash Plugin for the supported Web
browsers in addition to a standalone flash player application.

%package ppapi
Summary:        Adobe Flash PPAPI Plugin
Provides:       flash-ppapi-plugin = %{version}
Requires:       flash-player = %{version}

%description ppapi
This package contains Adobe's Flash Plugin for the PPAPI supporting
Web browsers, like Chromium.

%package gnome
Summary:        Adobe Flash Plugin and Standalone Player Settings
Requires:       %{name} = %{version}
Supplements:    packageand(cinnamon-session:flash-player)
Supplements:    packageand(gnome-session:flash-player)
Supplements:    packageand(mate-session-manager:flash-player)
Provides:       %{name}-mate = %{version}

%description gnome
This package contains Adobe's Flash Plugin Settings for the MATE
and GNOME desktops.

%prep
%setup -q -c
%setup -D -T -a 1
%setup -D -T -a 2
%patch0 -p1
cp -f %{SOURCE3} flashplayer.desktop
cp -f %{SOURCE4} flashplayer.png
cp -f %{SOURCE5} mms.cfg

%build
# Nothing to build.

%install
install -Dpm 0644 libpepflashplayer.so \
  %{buildroot}%{_libdir}/chromium/PepperFlash/libpepflashplayer.so
install -Dpm 0644 manifest.json \
  %{buildroot}%{_libdir}/chromium/PepperFlash/manifest.json

install -Dpm 0644 libflashplayer.so \
  %{buildroot}%{_libdir}/mozilla/plugins/libflashplayer.so

mkdir -p %{buildroot}%{_libdir}/browser-plugins/
ln -s %{_libdir}/mozilla/plugins/libflashplayer.so \
  %{buildroot}%{_libdir}/browser-plugins/

mkdir -p %{buildroot}%{_datadir}/icons/
cp -a .%{_datadir}/icons/* %{buildroot}%{_datadir}/icons/

# MATE/GNOME front-end.
install -Dpm 0755 .%{_bindir}/flash-player-properties \
  %{buildroot}%{_bindir}/flash-player-properties
install -Dpm 0644 .%{_datadir}/applications/flash-player-properties.desktop \
  %{buildroot}%{_datadir}/applications/flash-player-properties.desktop

install -Dpm 0755 flashplayer %{buildroot}%{_bindir}/flashplayer
install -Dpm 0644 flashplayer.desktop \
  %{buildroot}%{_datadir}/applications/flashplayer.desktop
install -Dpm 0644 flashplayer.png %{buildroot}%{_datadir}/pixmaps/flashplayer.png

mkdir -p %{buildroot}%{_sysconfdir}/adobe/
install -Dpm 0644 mms.cfg %{buildroot}%{_sysconfdir}/adobe/mms.cfg

%suse_update_desktop_file flashplayer
%suse_update_desktop_file flash-player-properties

%post
%ifarch %ix86
# This is an ugly hack: flash-player hard-requires SSE2. Neither
# rpm nor zypper can limit installation to SSE2 equipped systems
# only. We have to choose one of two bad things: install and let it
# crash or install and deliberately break it. The second is done
# here (boo#856386).
if ( ! grep -q '^flags.*sse2' /proc/cpuinfo ); then
    rm -f %{_libdir}/browser-plugins/libflashplayer.so
    rm -f %{_bindir}/flashplayer
    echo "Flash Player requires a CPU with SSE2. It cannot work on your system." >&2
    echo "Please, uninstall it!" >&2
fi
%endif

%post ppapi
CHROMIUM_CONFIG='%{_sysconfdir}/default/chromium'
if [ -f "$CHROMIUM_CONFIG" ]; then
    # Add the PPAPI Flash Player path to the Chromium config file.
    if [[ $(cat "$CHROMIUM_CONFIG") != *ppapi*path* ]]; then
        sed -i '/CHROMIUM_FLAGS/s|"$| --ppapi-flash-path=%{_libdir}/chromium/PepperFlash/libpepflashplayer.so"|' "$CHROMIUM_CONFIG"
    fi
fi

%postun ppapi
CHROMIUM_CONFIG='%{_sysconfdir}/default/chromium'
# Remove the PPAPI Flash Player path from the Chromium config file.
if [ -f "$CHROMIUM_CONFIG" ]; then
    sed -i "s| --ppapi-flash-path=%{_libdir}/chromium/PepperFlash/libpepflashplayer.so||" "$CHROMIUM_CONFIG"
fi

%files
%license LGPL/ license.pdf
%doc readme.txt
%{_bindir}/flashplayer
%dir %{_libdir}/mozilla/
%dir %{_libdir}/mozilla/plugins/
%{_libdir}/mozilla/plugins/libflashplayer.so
%dir %{_libdir}/browser-plugins/
%{_libdir}/browser-plugins/libflashplayer.so
%{_datadir}/applications/flashplayer.desktop
%{_datadir}/pixmaps/flashplayer.png
%dir %{_sysconfdir}/adobe
%config(noreplace) %{_sysconfdir}/adobe/mms.cfg

%files ppapi
%license LGPL/ license.pdf
%doc readme.txt
%dir %{_libdir}/chromium/
%{_libdir}/chromium/PepperFlash/

%files gnome
%{_bindir}/flash-player-properties
%{_datadir}/applications/flash-player-properties.desktop
%{_datadir}/icons/hicolor/*/apps/flash-player-properties.png

%changelog
openSUSE Build Service is sponsored by