Browse Source

xscreensaver-6.01-1

Tomohiro "Tomo-p" KATO 1 year ago
parent
commit
17bf17a19c
1 changed files with 305 additions and 105 deletions
  1. 305 105
      x/xscreensaver/xscreensaver-vl.spec

+ 305 - 105
x/xscreensaver/xscreensaver-vl.spec

@@ -1,105 +1,148 @@
+%bcond_with systemd
+
+%define source_date_epoch_from_changelog 1
 %define modular_conf  1
 
-%define default_text  %{_datadir}/doc/HTML/README-Accessibility
+%define default_URL   https://vinelinux.org/
+%define default_text  %{_sysconfdir}/vine-release
 
-%define pam_ver       1.1
-%define autoconf_ver  2.69
+%define pam_ver       1.5.1
+%define autoconf_ver  2.71
 
 %define update_po     1
 
-Buildroot:       %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
 Summary:         X screen saver and locker
 Summary(ja):     X ウィンドウシステム・スクリーンセーバ
 Name:            xscreensaver
-Version:         5.37
-Release:         1%{?_dist_release}
 Epoch:           1
-License:         BSD
-Group:           User Interface/X
-URL:             http://www.jwz.org/xscreensaver/
+Version:         6.01
+Release:         1%{?_dist_release}%{?with_systemd:.systemd}
+Group:           accessories
 
+License:         BSD
+URL:             https://www.jwz.org/xscreensaver/
 Source0:         http://www.jwz.org/xscreensaver/xscreensaver-%{version}%{?beta_ver}.tar.gz
 %if %{modular_conf}
 Source10:        update-xscreensaver-hacks
 %endif
-Patch1:          xscreensaver-5.00b5-sanitize-hacks.patch
-# Patch3:          xscreensaver-5.05-addopts-jwz.patch
-# Patch21:         xscreensaver-5.05-webcollage-default-nonet.patch
-# Patch22:         xscreensaver-5.05-penetrate-font.patch
-
-# Change webcollage not to access to net \
-# Also see bug 472061
-Patch31:         xscreensaver-5.35-webcollage-default-nonet.patch
-# driver/test-passwd tty segfaults
-Patch51:         xscreensaver-5.12-test-passwd-segv-tty.patch
-# patch to compile driver/test-xdpms
-Patch52:         xscreensaver-5.12-tests-miscfix.patch
-
-# Enable double buffer on cubestorm
-Patch3204:       xscreensaver-5.32-0004-cubestorm-enable-double-buffer-on-linux.patch
-# splodesic: avoid using "depth" name not to make X internal collision
-# reset_strip: kill gcc7 -Wint-in-bool-context
+Source11:        xscreensaver-autostart
+Source12:        xscreensaver-autostart.desktop
+# wrapper script for switching user (bug 1878730)
+Source13:        xscreensaver-newlogin-wrapper
+##
+## Patches
+##
+# bug 129335
+Patch1:          xscreensaver-5.45-0001-barcode-glsnake-sanitize-the-names-of-modes.patch
+## Patches already sent to the upsteam
+## Patches which must be discussed with upstream
+# See bug 472061
+Patch21:         xscreensaver-5.35-webcollage-default-nonet.patch
+# 
+# misc: kill gcc warn_unused_result warnings
 Patch3607:       xscreensaver-5.36-0007-misc-kill-gcc-warn_unused_result-warnings.patch
-# store_saver_id: fix stack-use-after-scope
-Patch3701:       xscreensaver-5.37-0001-store_saver_id-fix-stack-use-after-scope.patch
-# bsod: fix some stack-use-after-scope issues
-Patch3702:       xscreensaver-5.37-0002-bsod-fix-some-stack-use-after-scope-issues.patch
-# vigilance: fix which camera to pay attention on tick_camera
-Patch3703:       xscreensaver-5.37-0003-vigilance-fix-which-camera-to-pay-attention-on-tick_.patch
-# bsod: more stack-use-after-scope fix for utsname
-Patch3704:       xscreensaver-5.37-0004-bsod-more-stack-use-after-scope-fix-for-utsname.patch
+# xscreensaver-text use en_US locale for lscpu
+Patch5002:      xscreensaver-6.00-0002-xscreensaver-text-use-en_US-locale-for-lscpu.patch
+# fontglide.c: pick_font_1 exclude substitution rectagle glyph
+Patch5004:      xscreensaver-6.00-0004-fontglide.c-pick_font_1-exclude-substitution-rectagl.patch
+# fontglide.c: drain_input: terminate with null explicitly
+Patch5007:      xscreensaver-6.00-0007-fontglide.c-drain_input-terminate-with-null-explicit.patch
+# main_loop: consistently check init file after some activitity occurred
+Patch5101:      xscreensaver-6.01-0001-main_loop-consistently-check-init-file-after-some-ac.patch
+# main_loop: check init file saver_mode
+Patch5102:      xscreensaver-6.01-0002-main_loop-check-init-file-saver_mode.patch
+# window_init: check if asterisk font is available and provide fallback character
+Patch5103:      xscreensaver-6.01-0003-window_init-check-if-asterisk-font-is-available-and-.patch
+# destroy_window: check ws->xftdraw to avoid nullptr dereference
+Patch5104:      xscreensaver-6.01-0004-destroy_window-check-ws-xftdraw-to-avoid-nullptr-der.patch
+# Fedora specific
+# window_init: search parenthesis first for searching year
+Patch10001:     xscreensaver-6.00-0001-screensaver_id-search-parenthesis-first-for-searchin.patch
+# dialog.c: window_init: show more version string
+Patch10003:     xscreensaver-6.00-0003-dialog.c-window_init-show-more-version-string.patch
+# blurb: show 1/100 sec on linux
+Patch10005:     xscreensaver-6.00-0005-blurb-show-1-100-sec-on-linux.patch
+#
+# gcc warning cleanup
+# Some cppcheck cleanup
+#
+# Debugging patch
+# Not apply by default
+# XIO: print C backtrace on error
+Patch13501:      xscreensaver-5.35-0101-XIO-print-C-backtrace-on-error.patch
+#
+# Patches end
 
+BuildRoot:       %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires:        xscreensaver-base = %{epoch}:%{version}-%{release}
 Requires:        xscreensaver-extras = %{epoch}:%{version}-%{release}
 Requires:        xscreensaver-gl-extras = %{epoch}:%{version}-%{release}
 
 %package base
 Summary:         A minimal installation of xscreensaver
-Group:           User Interface/Desktops
+Group:           accessories
 BuildRequires:   autoconf
 BuildRequires:   bc
 BuildRequires:   desktop-file-utils
 BuildRequires:   gawk
 BuildRequires:   gettext
 BuildRequires:   libtool
-BuildRequires:   pam-devel > %{pam_ver}
+BuildRequires:   pam-devel >= %{pam_ver}
 BuildRequires:   sed
 BuildRequires:   xdg-utils
 BuildRequires:   xorg-x11-proto-devel
+BuildRequires:   mesa-libGL-devel
 BuildRequires:   libX11-devel
 BuildRequires:   libXScrnSaver-devel
+# xscreensaver 6.00
+#BuildRequires:   libXcomposite-devel
 BuildRequires:   libXext-devel
+# From xscreensaver 5.12, write explicitly
+BuildRequires:   libXi-devel
 BuildRequires:   libXinerama-devel
-BuildRequires:   libXmu-devel
+# Dropped from 6.00
+# BuildRequires:   libXmu-devel
+# xscreensaver 5.39: check if the following can be removed
 BuildRequires:   libXpm-devel
+# xscreensaver 5.39
+BuildRequires:   libpng-devel
+# Write explicitly
+BuildRequires:   libXrandr-devel
 BuildRequires:   libXt-devel
-BuildRequires:   libXxf86misc-devel
+# libXxf86misc removed from F-31
+#BuildRequires:   libXxf86misc-devel
 BuildRequires:   libXxf86vm-devel
+# XScreenSaver 5.31
+BuildRequires:   libXft-devel
 BuildRequires:   gtk2-devel
+BuildRequires:   pkgconfig(gdk-pixbuf-2.0)
+BuildRequires:   pkgconfig(gdk-pixbuf-xlib-2.0)
 BuildRequires:   libjpeg-devel
 BuildRequires:   libglade2-devel
+%if %{with systemd}
+BuildRequires:   pkgconfig(libsystemd)
+%endif
 Requires:        %{_sysconfdir}/pam.d/system-auth
-Requires:        pam > %{pam_ver}
+Requires:        pam >= %{pam_ver}
 Requires:        xdg-utils
 Requires:        xorg-x11-resutils
 Requires:        xorg-x11-fonts-ISO8859-1-100dpi
 
 %package extras
 Summary:         An enhanced set of screensavers
-Group:           User Interface/Desktops
+Group:           accessories
 # BuildRequires:   desktop-backgrounds
 BuildRequires:   mate-backgrounds
 Requires:        %{name}-base = %{epoch}:%{version}-%{release}
 
 %package gl-base
 Summary:         A base package for screensavers that require OpenGL
-Group:           User Interface/Desktops
+Group:           accessories
 Requires:        %{name}-base = %{epoch}:%{version}-%{release}
 
 %package gl-extras
 Summary:         An enhanced set of screensavers that require OpenGL
-Group:           User Interface/Desktops
+Group:           accessories
 Provides:        xscreensaver-gl = %{epoch}:%{version}-%{release}
 Obsoletes:       xscreensaver-gl <= 1:5.00
 BuildRequires:   libGL-devel
@@ -112,13 +155,13 @@ Requires:        %{name}-base = %{epoch}:%{version}-%{release}
 
 %package extras-gss
 Summary:         Desktop files of extras for gnome-screensaver
-Group:           User Interface/Desktops
+Group:           accessories
 Requires:        %{name}-extras = %{epoch}:%{version}-%{release}
 Requires:        mate-screensaver
 
 %package gl-extras-gss
 Summary:         Desktop files of gl-extras for gnome-screensaver
-Group:           User Interface/Desktops
+Group:           accessories
 Requires:        %{name}-gl-extras = %{epoch}:%{version}-%{release}
 Requires:        mate-screensaver
 
@@ -162,26 +205,28 @@ This package contains desktop files of gl-extras screensavers
 for gnome-screensaver compatibility.
 
 
+%debug_package
+
 
 %prep
 %setup -q -n %{name}-%{version}%{?beta_ver}
 
-%patch1 -p1 -b .sanitize-hacks
-## %patch3 -p1 -b .opts
-## %patch21 -p1 -b .nonet
-## %patch22 -p1 -b .font
-
-%patch31 -p1
-%patch51 -p1
-%patch52 -p1
+%patch1 -p1
+%patch21 -p1
 
-%patch3204 -p1
-%patch3607 -p1
-%patch3701 -p1
-%patch3702 -p1
-%patch3703 -p1
-%patch3704 -p1
+#patch3607 -p1
+%patch10001 -p1
+%patch5002 -p1
+%patch10003 -p1
+%patch5004 -p1
+%patch10005 -p1
+%patch5007 -p1
+%patch5101 -p1
+%patch5102 -p1
+%patch5103 -p1
+%patch5104 -p1
 
+#patch13501 -p1
 
 change_option(){
    set +x
@@ -221,7 +266,6 @@ silence_hack(){
 
 # change some files to UTF-8
 for f in \
-   driver/XScreenSaver.ad.in \
    hacks/glx/sproingies.man \
    ; do
    iconv -f ISO-8859-1 -t UTF-8 $f > $f.tmp || cp -p $f $f.tmp
@@ -237,28 +281,33 @@ change_option driver/XScreenSaver.ad.in \
    lock=True \
    splash=False \
    ignoreUninstalledPrograms=True \
-   textProgram=fortune\ -s
+   textProgram=fortune\ -s \
+   textURL=%{default_URL}
 
 # silence the following hacks by default
 silence_hack driver/XScreenSaver.ad.in \
-   bsod flag
+   bsod flag \
+   peepers \
+   headroom \
+   %{nil}
 
 # record time, version
 eval sed -i.ver \
    -e \'s\|version \[45\]\.\[0-9a-z\]\[0-9a-z\]\*\|version %{version}-`echo \
-      %{release} | sed -e 's|\.[a-z][a-z0-9].*$||'`\|\' \
+      %{release} | sed -e '/IGNORE THIS/s|\.[a-z][a-z0-9].*$||'`\|\' \
       driver/XScreenSaver.ad.in
 
 eval sed -i.date \
-   -e \'s\|\[0-9\].\*-.\*-20\[0-9\]\[0-9\]\|`LANG=C date -u +'%%d-%%b-%%Y'`\|g\' \
+   -e \'s\|\[0-9\].\*-.\*-20\[0-9\]\[0-9\]\|`LANG=C LC_ALL=C date -u +'%%d-%%b-%%Y'`\|g\' \
    driver/XScreenSaver.ad.in
 
 eval sed -i.ver \
-   -e \'s\|\(\[0-9\].\*-.\*-20\[0-9\]\[0-9\]\)\|\(`LANG=C \
+   -e \'s\|\(\[0-9\].\*-.\*-20\[0-9\]\[0-9\]\)\|\(`LANG=C LC_ALL=C \
       date -u +'%%d-%%b-%%Y'`\)\|g\' \
-   -e \'s\|\\\(5.\[0-9\]\[0-9\]\\\)[a-z]\[0-9\]\[0-9\]\*\|\\\1\|\' \
-   -e \'s\|5.\[0-9\]\[0-9\]\|%{version}-`echo %{release} | \
-      sed -e 's|\.[a-zA-Z][a-zA-Z0-9].*$||'`\|\' \
+   -e \'s\|\\\([56]\\\.\[0-9\]\[0-9\]\\\)[a-z]\[0-9\]\[0-9\]\*\|\\\1\|\' \
+   -e \'s\|[56]\\\.\[0-9\]\[0-9\]\|%{version}-`echo %{release} | \
+      sed -e '/IGNORE THIS/s|\.[a-zA-Z][a-zA-Z0-9].*$||'`\|\' \
+   -e \'s\|\\\(XSCREENSAVER_RELEASED\\\)\.\*\|\\\1 ${SOURCE_DATE_EPOCH}\|\' \
    utils/version.h
 
 # move man entry to 6x.
@@ -286,15 +335,46 @@ fi
 sed -i.icon -e 's|xscreensaver\.xpm|xscreensaver|' \
    driver/screensaver-properties.desktop.in
 
-%build
+# test-fade: give more time between fading
+sed -i.delay -e 's| delay = 2| delay = 3|' driver/test-fade.c
+
+# test-grab: testing time too long, setting time 15 min -> 20 sec
+sed -i.delay -e 's|60 \* 15|20|' driver/test-grab.c
+
+# Well, clang misinterpretates how gcc / autoconf uses -Wunknown-warning-option ....
+sed -i 's|-Wunknown-warning-option|-Wfoo-bar-baz|' ax_pthread.m4
+
+aclocal
 autoconf
+autoheader
+
 
-chmod 755 ./config.guess
-archdir=`./config.guess`
-mkdir $archdir
+%build
+archdir=`sh ./config.guess`
+[ -d $archdir ] || mkdir $archdir
 cd $archdir
 
-export CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}"
+# Create temporary path and symlink
+rm -rf ./TMPBINDIR
+
+# Make it sure that perl interpreter is recognized
+# as /usr/bin/perl, not /bin/perl so as not to make
+# /bin/perl added as rpm dependency
+export PATH=/usr/bin:$PATH
+
+mkdir TMPBINDIR
+pushd TMPBINDIR/
+export PATH=$(pwd):$PATH
+
+# xdg-open
+ln -sf /bin/true xdg-open
+popd
+
+# Set optflags first
+%set_build_flags
+
+export CFLAGS="$CFLAGS -Wno-long-long"
+export CFLAGS="$CFLAGS -Wno-variadic-macros"
 
 CONFIG_OPTS="--prefix=%{_prefix} --with-pam --without-shadow --without-kerberos"
 CONFIG_OPTS="$CONFIG_OPTS --without-setuid-hacks"
@@ -302,29 +382,95 @@ CONFIG_OPTS="$CONFIG_OPTS --with-text-file=%{default_text}"
 CONFIG_OPTS="$CONFIG_OPTS --with-x-app-defaults=%{_datadir}/X11/app-defaults"
 CONFIG_OPTS="$CONFIG_OPTS --disable-root-passwd"
 CONFIG_OPTS="$CONFIG_OPTS --with-browser=xdg-open"
+
+# From xscreensaver 5.12, login-manager option is on by default
+# For now, let's enable it on F-14 and above
+pushd TMPBINDIR
+# ln -sf /bin/true gdmflexiserver
+install -cpm 0755 %{SOURCE13} .
+CONFIG_OPTS="$CONFIG_OPTS --with-login-manager=xscreensaver-newlogin-wrapper"
+popd
+
+# Enable account type pam validation on F-18+,
+# debian bug 656766
+CONFIG_OPTS="$CONFIG_OPTS --enable-pam-check-account-type"
+
+# xscreensaver 5.30
 CONFIG_OPTS="$CONFIG_OPTS --with-record-animation"
 
+%if %{with systemd}
+CONFIG_OPTS="$CONFIG_OPTS --with-systemd"
+%endif
+
 # This is flaky:
 # CONFIG_OPTS="$CONFIG_OPTS --with-login-manager"
 
+unlink configure || :
 ln -s ../configure .
-%configure $CONFIG_OPTS
+%configure $CONFIG_OPTS || { cat config.log ; sleep 10 ; exit 1; }
 rm -f configure
 
+# Remove embedded build path
+sed -i driver/XScreenSaver.ad -e "s|$(pwd)/TMPBINDIR/||"
+
 %if %{update_po}
-( cd po ; make generate_potfiles_in ; cp -p POTFILES.in .. ; export srcdir=.. ; make update-po ; rm -f ../POTFILES_in )
+#( cd po ; make generate_potfiles_in update-po )
+# ???
+pushd po
+  make generate_potfiles_in
+  cp -p POTFILES.in ..
+  # Workaround for ui file
+  sed -i ../POTFILES.in POTFILES.in POTFILES \
+     -e '\@xscreensaver\.ui@s|^\([ \t]*\)\(.*\)$|\1[type: gettext/glade]\2|'
+  make xscreensaver.pot srcdir=..
+  ( export srcdir=.. ; make update-po )
+  rm -f ../POTFILES_in
+popd
+
 ( cp -p ../po/*.po po/)
+( ( cd ../po ; git add *.po ; git commit -m "po regenerated" ) || true )
+%endif
+
+# Update po
+#cp -p %{SOURCE100} po/
+
+# Workaround for 5.39
+mkdir -p hacks/images || true
+if [ ! -f hacks/images/Makefile ] ; then
+   cat > hacks/images/Makefile <<EOF
+default:
+install:
+EOF
+fi
+# Workaround end
+
+# From 5.45: temporary workaround for installation issue
+# From 6.00: temporary workaround for installation issue
+cp -p ../driver/xscreensaver.ui driver/
+cp -a ../hacks/fonts hacks
+
+%if 0%{?use_clang_analyze} < 1
+# Workaround for ppc64 build failure
+make -C ../hacks/images -j1
+for dir in \
+  utils driver ../hacks/images hacks/images hacks hacks/glx po
+do
+  %__make %{?_smp_mflags} -k \
+    -C $dir \
+	GMSGFMT="msgfmt --statistics"
+done
 %endif
 
-make %{?_smp_mflags}
+# Again
+%__make %{?_smp_mflags} -k
 
 %if %{modular_conf}
-# Make XScreenSavar.ad modular
+# Make XScreenSavar.ad modular (bug 200881)
 CONFD=xscreensaver
 rm -rf $CONFD
 mkdir $CONFD
 
-# preserve the original adfile
+# Preserve the original adfile
 cp -p driver/XScreenSaver.ad $CONFD
 
 # First split XScreenSaver.ad into 3 parts
@@ -341,8 +487,13 @@ cd ..
 
 %endif
 
+# test
+# for now, build tests anyway (even if they are not to be installed)
+make tests -C driver
+
+
 %install
-archdir=`./config.guess`
+archdir=`sh ./config.guess`
 cd $archdir
 
 rm -rf ${RPM_BUILD_ROOT}
@@ -356,15 +507,10 @@ make install_prefix=$RPM_BUILD_ROOT INSTALL="install -c -p" install
 
 desktop-file-install --vendor "" --delete-original       \
    --dir $RPM_BUILD_ROOT%{_datadir}/applications         \
-   --add-only-show-in GNOME                              \
    --add-category    DesktopSettings                     \
-%if 0
-   --add-category X-Red-Hat-Base                         \
-%else
    --remove-category Appearance                          \
    --remove-category AdvancedSettings                    \
    --remove-category Application                         \
-%endif
    $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop
 
 # This function prints a list of things that get installed.
@@ -389,30 +535,30 @@ dd=%{_builddir}/%{name}-%{version}%{?beta_ver}
 rm -f $dd/*.files
 
 (  cd hacks     ; list_files install ) >  $dd/extras.files
+(  cd hacks/fonts     ; list_files install ) >>  $dd/extras.files
 (  cd hacks/glx ; list_files install ) >  $dd/gl-extras.files
 (  cd driver    ; list_files install ) >  $dd/base.files
 
+# Own directory
+echo "%%dir %{_datadir}/fonts/xscreensaver" >> $dd/extras.files
+
 # Move %%{_bindir}/xscreensaver-gl-helper to gl-base
 # (bug 336331).
 %if %{modular_conf}
 echo "%%defattr(-,root,root,-)" >> $dd/gl-base.files
 
+grep xscreensaver-gl-visual $dd/gl-extras.files >> $dd/gl-base.files
 sed -i -e '/xscreensaver-gl-helper/d' $dd/gl-extras.files
-pushd $RPM_BUILD_ROOT
-for dir in `find . -name \*xscreensaver-gl-helper\*` ; do
-   echo "${dir#.}" >> $dd/gl-base.files
-done
-popd
 sed -i -e 's|^\(%{_mandir}.*\)$|\1*|' $dd/gl-base.files
 %endif
 
 %if %{modular_conf}
-# install update script
+# Install update script
 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
 install -cpm 755 %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}
 echo "%{_sbindir}/update-xscreensaver-hacks" >> $dd/base.files
 
-# make hack conf modular
+# Make hack conf modular
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xscreensaver
 mkdir -p $RPM_BUILD_ROOT%{_datadir}/xscreensaver/hacks.conf.d
 cp -p xscreensaver/XScreenSaver.ad* \
@@ -430,7 +576,7 @@ echo "%{_sysconfdir}/xscreensaver/XScreenSaver.ad" >> \
 echo "%{_datadir}/xscreensaver/hacks.conf.d/xscreensaver.conf" \
    >> $dd/base.files
 
-# check symlink
+# Check symlink
 rm -f $RPM_BUILD_ROOT%{_datadir}/X11/app-defaults/XScreenSaver
 
 pushd $RPM_BUILD_ROOT%{_datadir}/X11/app-defaults
@@ -447,14 +593,14 @@ ln -sf ../../../..%{_sysconfdir}/xscreensaver/XScreenSaver.ad \
 
 %endif
 
-# add documents
+# Add documents
 pushd $dd &> /dev/null
 for f in README* ; do
    echo "%%doc $f" >> $dd/base.files
 done
 popd
 
-# add directory
+# Add directory
 pushd $RPM_BUILD_ROOT
 for dir in `find . -type d | grep xscreensaver` ; do
    echo "%%dir ${dir#.}" >> $dd/base.files
@@ -464,7 +610,7 @@ popd
 %find_lang %{name}
 cat %{name}.lang | uniq >> $dd/base.files
 
-# suppress rpmlint booing
+# Suppress rpmlint warnings
 # sanitize path in script file
 for f in ${RPM_BUILD_ROOT}%{_bindir}/xscreensaver-getimage-* \
    ${RPM_BUILD_ROOT}%{_libexecdir}/xscreensaver/vidwhacker \
@@ -474,34 +620,64 @@ for f in ${RPM_BUILD_ROOT}%{_bindir}/xscreensaver-getimage-* \
    fi
 done
 
+# Install desktop application autostart stuff
+# Add OnlyShowIn=GNOME (bug 517391)
+# Leave autostart stuff installed (at least useful for LXDE),
+# but not show them by default for all DE
+# (bug 1266521) for F-27+
+mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/xdg/autostart
+install -cpm 0755 %{SOURCE11} ${RPM_BUILD_ROOT}%{_libexecdir}/
+desktop-file-install \
+   --vendor "" \
+   --dir ${RPM_BUILD_ROOT}%{_sysconfdir}/xdg/autostart \
+   --add-only-show-in=X-NODEFAULT \
+   %{SOURCE12}
+chmod 0644 ${RPM_BUILD_ROOT}%{_sysconfdir}/xdg/autostart/xscreensaver*.desktop
+
+echo "%{_libexecdir}/xscreensaver-autostart" >> $dd/base.files
+echo '%{_sysconfdir}/xdg/autostart/xscreensaver*.desktop' >> $dd/base.files
+
 # create desktop entry for mate-screensaver
 create_desktop(){
    COMMAND=`cat $1 | sed -n -e 's|^<screen.*name=\"\([^ ][^ ]*\)\".*$|\1|p'`
-   NAME=`cat $1 | sed -n -e 's|^<screen.*_label=\"\(.*\)\">.*$|\1|p'`
+# COMMAND must be full path (see bug 531151)
+# Check if the command actually exists
+   COMMAND=%{_libexecdir}/xscreensaver/$COMMAND
+   if [ ! -x $RPM_BUILD_ROOT/$COMMAND ] ; then
+      echo
+      echo "WARNING:"
+      echo "$COMMAND could not be found under $RPM_BUILD_ROOT"
+      #exit 1
+   fi
+# NAME entry fix (bug 953558)
+   NAME=`cat $1 | sed -n -e 's|^<screen.*_label=\"\([^\"][^\"]*\)\".*>.*$|\1|p'`
    ARG=`cat $1 | sed -n -e 's|^.*<command arg=\"\([^ ][^ ]*\)\".*$|\1|p'`
-   ARG=`echo $ARG`
+   ARG=$(echo "$ARG" | while read line ; do echo -n "$line " ; done)
    COMMENT="`cat $1 | sed -e '1,/_description/d' | \
      sed -e '/_description/q' | sed -e '/_description/d'`"
-   COMMENT=`echo $COMMENT`
+   COMMENT=$(echo "$COMMENT" | while read line ; do echo -n "$line " ; done)
 
 # webcollage treatment
+## changed to create wrapper script
+%if 0
    if [ "x$COMMAND" = "xwebcollage" ] ; then
       ARG="$ARG -directory %{_datadir}/backgrounds/images"
    fi
+%endif
 
    if [ "x$NAME" = "x" ] ; then NAME=$COMMAND ; fi
 
    rm -f $2
    echo "[Desktop Entry]" >> $2
-   echo "Encoding=UTF-8" >> $2
+#   echo "Encoding=UTF-8" >> $2
    echo "Name=$NAME" >> $2
    echo "Comment=$COMMENT" >> $2
    echo "TryExec=$COMMAND" >> $2
    echo "Exec=$COMMAND $ARG" >> $2
    echo "StartupNotify=false" >> $2
    echo "Type=Application" >> $2
-   echo "Categories=MATE;Screensaver;" >> $2
-   # Add OnlyShowIn (bug 953558)
+   echo "Categories=GNOME;Screensaver;" >> $2
+# Add OnlyShowIn (bug 953558)
    echo "OnlyShowIn=GNOME;MATE;" >> $2
 }
 
@@ -543,26 +719,45 @@ cat > webcollage <<EOF
 #!/bin/sh
 PATH=%{_libexecdir}/%{name}:\$PATH
 exec webcollage.original \\
-  -directory %{_datadir}/backgrounds/images \\
-  "\$@"
+	-directory %{_datadir}/backgrounds/images \\
+	"\$@"
 EOF
 chmod 0755 webcollage
 echo "%%{_libexecdir}/%%{name}/webcollage.original" >> \
-  $dd/extras.files
+	$dd/extras.files
+
+# install wrapper-script for switching user
+install -cpm 0755 %{SOURCE13} ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}
+echo "%{_libexecdir}/%{name}/xscreensaver-newlogin-wrapper" >> $dd/base.files
+
 
 # Make sure all files are readable by all, and writable only by owner.
 #
 chmod -R a+r,u+w,og-w ${RPM_BUILD_ROOT}
 
+
 %clean
 rm -rf ${RPM_BUILD_ROOT}
 
+
 %if %{modular_conf}
 %post base
 %{_sbindir}/update-xscreensaver-hacks
-exit 0
 %endif
 
+# In the case that pam setting is edited locally by sysadmin:
+if ! grep -q '^account' %{_sysconfdir}/pam.d/xscreensaver
+then
+    echo "Warning: %{_sysconfdir}/pam.d/xscreensaver saved as %{_sysconfdir}/pam.d/xscreensaver.rpmsave"
+    cp -p %{_sysconfdir}/pam.d/xscreensaver{,.rpmsave}
+    PAMFILE=%{_sysconfdir}/pam.d/xscreensaver
+    echo >> $PAMFILE
+    echo "# Account validation" >> $PAMFILE
+    echo "account include system-auth" >> $PAMFILE
+fi
+
+exit 0
+
 
 %files
 %defattr(-,root,root,-)
@@ -589,6 +784,11 @@ exit 0
 
 
 %changelog
+* Sat Jul 31 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 6.01-1
+- new upstream release.
+- dropped all patches.
+- imported patches from rawhide.
+
 * Sun Aug 26 2018 Toshiaki Ara <ara_t@384.jp> 5.37-1
 - update to 5.37
 - apply patches of fodora