1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools flag-o-matic font optfeature pam strip-linguas systemd xdg-utils
8 DESCRIPTION="Modular screen saver and locker for the X Window System"
9 HOMEPAGE="https://www.jwz.org/xscreensaver/"
11 https://www.jwz.org/xscreensaver/${P}.tar.gz
13 https://github.com/Flowdalic/xscreensaver/commit/59e7974c42dc08411c9af2a3a644a582c2116f46.patch ->
14 ${PN}-6.06-logind-idle-hint.patch
17 https://github.com/Flowdalic/xscreensaver/commit/376b07ec76cfe1070f498773aaec8fd7030593af.patch ->
18 ${PN}-6.07-xscreensaver.service-start-with-no-splash.patch
22 # Font license mapping for folder ./hacks/fonts/ as following:
24 # gallant12x22.ttf -- unclear, hence dropped
25 # luximr.ttf -- bh-luxi (package media-fonts/font-bh-ttf)
26 # OCRAStd.otf -- unclear, hence dropped
27 # SpecialElite.ttf -- Apache-2.0
28 LICENSE="BSD fonts? ( MIT Apache-2.0 ) systemd? ( ISC )"
30 KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x86-linux"
31 IUSE="elogind fonts gdm gles glx jpeg +locking logind-idle-hint new-login offensive pam +perl selinux suid systemd xinerama"
34 ?? ( elogind systemd )
36 logind-idle-hint? ( || ( elogind systemd ) )
40 >=dev-libs/libxml2-2.4.6
49 elogind? ( sys-auth/elogind )
50 x11-libs/gdk-pixbuf-xlib
51 >=x11-libs/gdk-pixbuf-2.42.0:2
52 >=x11-libs/gtk+-3.0.0:3
53 jpeg? ( media-libs/libjpeg-turbo:= )
54 locking? ( virtual/libcrypt:= )
56 gdm? ( gnome-base/gdm )
57 !gdm? ( || ( x11-misc/lightdm lxde-base/lxdm ) )
63 systemd? ( >=sys-apps/systemd-221 )
64 >=x11-libs/libXft-2.1.0
65 xinerama? ( x11-libs/libXinerama )
67 # For USE="perl" see output of `qlist xscreensaver | grep bin | xargs grep '::'`
74 virtual/perl-Digest-MD5
76 selinux? ( sec-policy/selinux-xscreensaver )
89 "${FILESDIR}"/${PN}-5.31-pragma.patch
90 "${FILESDIR}"/${PN}-6.01-gentoo.patch
91 "${FILESDIR}"/${PN}-6.07-gcc.patch
92 "${FILESDIR}"/${PN}-6.01-configure.ac-sandbox.patch
93 # "${FILESDIR}"/${PN}-6.01-without-gl-makefile.patch
94 # "${FILESDIR}"/${PN}-6.01-non-gtk-install.patch
95 "${FILESDIR}"/${PN}-6.01-configure-install_sh.patch
96 # "${FILESDIR}"/${PN}-6.03-without-gl-configure.patch
97 "${FILESDIR}"/${PN}-6.05-remove-update-icon-cache.patch
98 # "${FILESDIR}"/${PN}-6.05-r2-configure-exit-codes.patch
99 # "${FILESDIR}"/${PN}-6.05-get-dirs-from-gtk3.0-in-configure.patch
100 "${FILESDIR}"/${PN}-6.07-allow-no-pam.patch
101 "${FILESDIR}"/${PN}-6.07-fix-desktop-files.patch
104 DOCS=( README{,.hacking} )
106 # see https://bugs.gentoo.org/898328
107 QA_CONFIG_IMPL_DECL_SKIP=( getspnam_shadow )
113 mv po/ca.po po/ca.po.old || die
114 iconv -f ISO-8859-15 -t UTF-8 po/ca.po.old >po/ca.po || die
116 sed -i configure.ac -e '/^ALL_LINGUAS=/d' || die
119 # Causes "Failed to enable unit: Cannot alias xscreensaver.service as org.jwz.xscreensaver."
120 # after "systemctl --user enable xscreensaver".
121 sed -i -e '/^Alias=org.jwz.xscreensaver.service/d' \
122 driver/xscreensaver.service.in || die
124 eapply "${DISTDIR}/${PN}-6.07-xscreensaver.service-start-with-no-splash.patch"
128 export ALL_LINGUAS="${LINGUAS}"
130 if use new-login && ! use gdm; then #392967
132 -e "/default_l.*1/s:gdmflexiserver -ls:${EPREFIX}/usr/libexec/lightdm/&:" \
133 configure{,.ac} || die
136 # We are patching driver/XScreenSaver.ad.in, so let's delete the
137 # header generated from it so that it gets back in sync during build:
138 rm driver/XScreenSaver_ad.h || die
140 if ! use offensive; then
142 -e '/boobies/d;/boobs/d;/cock/d;/pussy/d;/viagra/d;/vibrator/d' \
143 hacks/barcode.c || die
145 -e 's|erect penis|shuffle board|g' \
146 -e 's|flaccid penis|flaccid anchor|g' \
147 -e 's|vagina|engagement ring|g' \
148 -e 's|Penis|Shuttle|g' \
149 hacks/glx/glsnake.c || die
151 's| Stay.*fucking mask\.$||' \
152 hacks/glx/covid19.man \
153 hacks/config/covid19.xml || die
154 eapply "${FILESDIR}/xscreensaver-6.05-teach-handsy-some-manners.patch"
157 if use logind-idle-hint; then
158 eapply "${DISTDIR}/${PN}-6.06-logind-idle-hint.patch"
161 config_rpath_update "${S}"/config.rpath
163 # Must be eauto*re*conf, to force the rebuild
168 if use ppc || use ppc64; then
169 filter-flags -maltivec -mabi=altivec
170 append-flags -U__VEC__
173 unset BC_ENV_ARGS #24568
175 # /proc/interrupts won't always have the keyboard bits needed
176 # Not clear this does anything in 6.03+(?) but let's keep it for now in case.
177 # (See also: configure argument)
178 export ac_cv_have_proc_interrupts=yes
180 # WARNING: This is NOT a normal autoconf script
181 # Some of the --with options are NOT standard, and expect "--with-X=no" rather than "--without-X"
183 $(use_enable locking)
189 $(use_with new-login login-manager)
191 $(use_with suid setuid-hacks)
193 $(use_with xinerama xinerama-ext)
194 --with-jpeg=$(usex jpeg yes no)
197 --with-app-defaults="${EPREFIX}"/usr/share/X11/app-defaults
198 --with-configdir="${EPREFIX}"/usr/share/${PN}/config
200 --with-hackdir="${EPREFIX}"/usr/$(get_libdir)/misc/${PN}
201 --with-proc-interrupts
203 --with-text-file="${EPREFIX}"/etc/gentoo-release
214 --x-includes="${EPREFIX}"/usr/include
215 --x-libraries="${EPREFIX}"/usr/$(get_libdir)
217 # WARNING: This is NOT a normal autoconf script
218 econf "${ECONF_OPTS[@]}"
222 # stock target is "default", which is broken in some releases.
227 use pam && dodir /etc/pam.d/
228 emake install_prefix="${D}" DESTDIR="${D}" GTK_SHAREDIR="${installprefix}"/usr/share/xscreensaver install
231 # Do not install fonts with unclear licensing
232 rm -v "${ED}${FONTDIR}"/gallant12x22.ttf || die
234 # Do not duplicate font Luxi Mono (of package media-fonts/font-bh-ttf)
235 rm -v "${ED}${FONTDIR}"/luximr.ttf || die
239 rm -rfv "${ED}${FONTDIR}" || die #812473
245 fperms 755 /usr/bin/${PN}
246 pamd_mimic_system ${PN} auth
250 systemd_douserunit "${ED}/usr/share/${PN}/xscreensaver.service"
252 # Makefile installs xscreensaver.service regardless of
253 # --without-systemd, and if USE=systemd, we will have installed the
255 rm "${ED}/usr/share/${PN}/xscreensaver.service" || die
258 fperms 4755 /usr/$(get_libdir)/misc/xscreensaver/xscreensaver-auth
262 use fonts && font_pkg_postinst
266 elog "Enable USE='glx' if OpenGL screensavers are crashing."
269 optfeature 'Bitmap fonts 75dpi' media-fonts/font-adobe-75dpi
270 optfeature 'Bitmap fonts 100dpi' media-fonts/font-adobe-100dpi
271 optfeature 'Truetype font Luxi Mono' media-fonts/font-bh-ttf
273 xdg_icon_cache_update
277 use fonts && font_pkg_postrm
278 xdg_icon_cache_update