File acroread.spec of Package acroread

# spec file for package acroread
# Copyright (c) 2013 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

Name:           acroread
BuildRequires:  ed
BuildRequires:  openldap2-client
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel
%if %suse_version < 1030
BuildRequires:  libicu
%if %suse_version > 1020
BuildRequires:  fdupes
BuildRequires:  libcurl4
Provides:       linux-ar
%if %suse_version < 1030
%elseif %suse_version >= 1030
Requires:       xdpyinfo
Requires:       libudev1-32bit
# deinstall it by default now (bnc#843835)
Obsoletes:      acroread-browser-plugin
Summary:        Adobe Reader for PDF Files
License:        NON-OSI-COMPLIANT(royalties)
Group:          Productivity/Publishing/PDF
Source10:       acroread.desktop
Source20:       acroread.png
Source30:       suse-do-not-grab-server.tar.bz2
Source40:       acroread.patch
Source50:       acroread-rpmlintrc
Patch0:         install.patch
# this Version is reported when calling "acroread -version"
Version:        9.5.5
Release:        0
Source1:        libxcb.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       coreutils
Requires:       openldap2-client
NoSource:       0
ExclusiveArch:  %ix86
# fix for Leap 15
%if %suse_version >= 1500
AutoProv: no

Acroread is a well known PDF viewer.

Adobe Reader is often the only program able to process complicated PDF
files, such as PDF forms. However, there are many bugs where we cannot
do anything about because it is proprietary binary-only software.

Please consider whether it is possible to use free PDF readers like
okular, evince, xpdf, ghostview, ... instead.

    Adobe Systems Incorporated

%define my_provides /tmp/my-provides
%define my_requires /tmp/my-requires
%define INSTALL_DIR /usr/lib
%define _use_internal_dependency_generator 0

# unpack the Source into a suitable directory
# there is the top-level directory "AdobeReader" in the source archive
%setup -n AdobeReader
# apply Patch0 to skip the "OutputLicense" dialog in the INSTALL script
# retrieve the gif for desktop
tar -xvf COMMON.TAR Adobe/Reader9/Resource/Icons/128x128/AdobeReader9.png
tar -xvf COMMON.TAR Adobe/Reader9/Resource/Shell/acroread.1.gz

# there is nothing to build as this package is a binary-only package
# but we build a preload library to work around bug #375551:
tar xf %{S:30}
make -C suse-do-not-grab-server

# skip the automated stripping because this damages some functionality
# for example a stripped AcroForm.api can no longer fill in forms
# see bug 28717 for details
export NO_BRP_STRIP_DEBUG="true"
# stuff to be done before the installation
# do the installation
# stuff to be done after the installation
rm -rf %{buildroot}%INSTALL_DIR/Adobe/Reader9/bin/UNINSTALL
# set the correct install_dir in the "acroread" start script
# to be safe to note changes in new versions do a test before
grep -q '^install_dir=' %{buildroot}%INSTALL_DIR/Adobe/Reader9/bin/acroread || exit 1
sed -i -e 's:^install_dir=.*$:install_dir="/usr/lib/Adobe/Reader9/Reader":' %{buildroot}%INSTALL_DIR/Adobe/Reader9/bin/acroread
# Apply workaround for & 147966 & 275088:
pushd %{buildroot}%INSTALL_DIR/Adobe/Reader9/bin
    patch -p0 -i %{S:40}
# symlink the executable to a directory which is in the PATH
mkdir -p %{buildroot}/usr/bin
pushd %{buildroot}/usr/bin
   ln -sf ../../%INSTALL_DIR/Adobe/Reader9/bin/acroread acroread
# add a link for the browser plugin so that it can be found automatically
# disable to avoid default exploitation
#mkdir -p %{buildroot}/usr/lib/browser-plugins
#ln -sf %INSTALL_DIR/Adobe/Reader9/Browser/intellinux/ %{buildroot}/usr/lib/browser-plugins/
rm %{buildroot}%INSTALL_DIR/Adobe/Reader9/Browser/HowTo/ENU/Browser_Plugin_HowTo.txt
rm %{buildroot}%INSTALL_DIR/Adobe/Reader9/Browser/install_browser_plugin
rm %{buildroot}%INSTALL_DIR/Adobe/Reader9/Browser/intellinux/

# Add links to openldap2 libraries needed to avoid bug: 261555
# FIX leap:15
%if %suse_version > 1400
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
%if %suse_version > 1030
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
for i in Adobe/Reader9/Reader/GlobalPrefs/.config \
    sed -i -e 's:%{buildroot}::' %{buildroot}%INSTALL_DIR/$i
# make the Adobe Reader available in the SUSE menues
%suse_update_desktop_file -i %name Office Viewer
echo "InitialPreference=7" >> %{buildroot}/usr/share/applications/%name.desktop
# install preload library to work around bug #375551:
install -m 755 suse-do-not-grab-server/ \
# remove duplicated system libraries and massage provides and requires lists:
# When a compatible version of a library which comes with the acroread
# binary tarball is already available in the system, it should be deleted.
# See bnc#353251.
# Libraries which come with the acroread tarball where no compatible
# version is available in the system cannot be deleted but they
# should neither be provided nor required by acroread.
# Providing them might cause problems for other packages which
# might require these libraries and requiring them is not necessary
# because they are already within the acroread package).
%if %suse_version < 1030
rm -f %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib/lib{crypto,ssl,curl,gcc_s,stdc++,icudata,icui18n,icuuc}.so*
# bnc#373590:
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
cat << EOF > %{my_provides}
%{__find_provides} | grep -vE "liblber|libldap" ; exit 0
chmod 755 %{my_provides}
%define __find_provides %{my_provides}
cat << EOF > %{my_requires}
%{__find_requires} | grep -vE "liblber|libldap" ; exit 0
chmod 755 %{my_requires}
%define __find_requires %{my_requires}
%elseif %suse_version >= 1030
rm -f %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib/lib{crypto,ssl,gcc_s,stdc++}.so*
# apparently and are *not* compatible, see bnc#382777.
# # and are supposedly compatible, see bnc#353251 comment #29:
# (cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
# (cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && ln -sf ../../../../../../../usr/lib/
cat << EOF > %{my_provides}
%{__find_provides} | grep -vE "libicudata|libicui18n|libicuuc|liblber|libldap|" ; exit 0
chmod 755 %{my_provides}
%define __find_provides %{my_provides}
cat << EOF > %{my_requires}
%{__find_requires} | grep -vE "libicudata|libicui18n|libicuuc|liblber|libldap|" ; exit 0
chmod 755 %{my_requires}
%define __find_requires %{my_requires}
# install the acroread icon for desktop
install -d %{buildroot}/usr/share/pixmaps
install -m644 Adobe/Reader9/Resource/Icons/128x128/AdobeReader9.png %{buildroot}/usr/share/pixmaps/acroread.png
# install the manunal, bnc#631267,
install -d %{buildroot}/usr/share/man/man1
install -m644 Adobe/Reader9/Resource/Shell/acroread.1.gz %{buildroot}/usr/share/man/man1/
# and have RPATH=. which is not good.
# But we cannot change this in a binary only package, we can only
# disable the check:
export NO_BRP_CHECK_RPATH=true
%if %suse_version > 1020
%fdupes %{buildroot}%INSTALL_DIR
# add old libs from 42.3 where libxcb worked
%if %suse_version > 1400
(cd %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib && tar -xf %{S:1})
chmod 755 %{buildroot}%INSTALL_DIR/Adobe/Reader9/Reader/intellinux/lib/*

/usr/bin/touch -c %_libdir/browser-plugins/

/usr/bin/touch -c %_libdir/browser-plugins/

rm -f %{my_provides}
rm -f %{my_requires}

%doc ReadMe.htm
%dir %INSTALL_DIR/Adobe/
%dir %INSTALL_DIR/Adobe/Reader9
%dir %INSTALL_DIR/Adobe/Reader9/Reader/
%dir %INSTALL_DIR/Adobe/Reader9/bin/
%dir %INSTALL_DIR/Adobe/Reader9/Resource/
%dir %INSTALL_DIR/Adobe/Reader9/Resource/CMap/
%dir %INSTALL_DIR/Adobe/Reader9/Resource/Font/
%dir %INSTALL_DIR/Adobe/Reader9/Resource/Icons/
%dir %INSTALL_DIR/Adobe/Reader9/Resource/Linguistics/
%dir %INSTALL_DIR/Adobe/Reader9/Resource/Support/
%dir %INSTALL_DIR/Adobe/Reader9/Resource/TypeSupport/
%dir %INSTALL_DIR/Adobe/Reader9/Resource/TypeSupport/Unicode
%dir %INSTALL_DIR/Adobe/Reader9/Resource/Shell

#files browser-plugin
#dir %INSTALL_DIR/Adobe/Reader9/Browser/

openSUSE Build Service is sponsored by