Diff ncurses-6.4_p20240414 with a eog-47.0

/usr/portage/media-gfx/eog/eog-47.0.ebuild 2025-07-29 16:22:14.340455366 +0300
1
# Copyright 1999-2024 Gentoo Authors
1
# Copyright 1999-2025 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=8
5 5

  
6
# sys-libs/ncurses-compat can be bumped with sys-libs/ncurses as upstream
7
# provide a configure option for the ABI version.
6
inherit gnome.org gnome2-utils meson xdg
8 7

  
9
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/thomasdickey.asc
10
inherit flag-o-matic toolchain-funcs multilib multilib-minimal preserve-libs usr-ldscript verify-sig
8
DESCRIPTION="The Eye of GNOME image viewer"
9
HOMEPAGE="https://gitlab.gnome.org/GNOME/eog"
11 10

  
12
MY_PV="${PV:0:3}"
13
MY_P="${PN}-${MY_PV}"
14
DESCRIPTION="Console display library"
15
HOMEPAGE="https://www.gnu.org/software/ncurses/ https://invisible-island.net/ncurses/"
16
# Keep invisible-mirror.net here as some users reported 403 forbidden with invisible-island.net
17
SRC_URI="
18
	mirror://gnu/ncurses/${MY_P}.tar.gz
19
	https://invisible-island.net/archives/${PN}/${MY_P}.tar.gz
20
	https://invisible-mirror.net/archives/${PN}/${MY_P}.tar.gz
21
	verify-sig? ( mirror://gnu/ncurses/${MY_P}.tar.gz.sig )
22
"
23

  
24
GENTOO_PATCH_DEV=sam
25
GENTOO_PATCH_PV=6.4_p20240413
26
GENTOO_PATCH_NAME=${PN}-${GENTOO_PATCH_PV}-patches
27

  
28
# Populated below in a loop. Do not add patches manually here.
29
UPSTREAM_PATCHES=()
30

  
31
if [[ ${PV} == *_p* ]] ; then
32
	# Sometimes, after releases, there's no megapatch available yet.
33
	#
34
	# From upstream README at e.g. https://invisible-island.net/archives/ncurses/6.3/:
35
	#
36
	#	"At times (generally to mark a relatively stable point), I create a rollup
37
	#	patch, which consists of all changes from the release through the current date."
38
	#
39
	# Also, from https://lists.gnu.org/archive/html/bug-ncurses/2019-08/msg00039.html,
40
	# the patches are considered to be acceptable to use after some testing. They
41
	# are both for development but also bug fixes.
42
	#
43
	# This array should contain a list of all the snapshots since the last
44
	# release if there's no megapatch available yet.
45
	PATCH_DATES=(
46
		20230107
47
		20230114
48
		20230121
49
		20230128
50
		20230211
51
		20230218
52
		20230225
53
		20230311
54
		20230401
55
		20230408
56
		20230415
57
		20230418
58
		20230423
59
		20230424
60
		20230429
61
		20230506
62
		20230514
63
		20230520
64
		20230527
65
		20230603
66
		20230610
67
		20230615
68
		20230617
69
		20230624
70
		20230625
71
		20230701
72
		20230708
73
		20230715
74
		20230722
75
		20230729
76
		20230805
77
		20230812
78
		20230819
79
		20230826
80
		20230902
81
		20230909
82
		20230917
83
		20230918
84
		20230923
85
		20231001
86
		20231007
87
		20231014
88
		20231016
89
		20231021
90
		20231028
91
		20231104
92
		20231111
93
		20231118
94
		20231121
95
		20231125
96
		20231202
97
		20231209
98
		20231217
99
		20231223
100
		20231230
101
		20240106
102
		20240113
103
		20240120
104
		20240127
105
		20240203
106
		20240210
107
		20240217
108
		20240224
109
		20240302
110
		20240309
111
		20240323
112
		20240330
113
		20240413
11
LICENSE="GPL-2+"
12
SLOT="1"
114 13

  
115
		# Latest patch is just _pN = $(ver_cut 4)
116
		$(ver_cut 4)
117
	)
14
KEYWORDS="~alpha amd64 ~arm arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc x86"
118 15

  
119
	if [[ -z ${PATCH_DATES[@]} ]] ; then
120
		SRC_URI+=" https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P/_p/-}.patch.sh.gz"
121
		SRC_URI+=" verify-sig? ( https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P/_p/-}.patch.sh.gz.asc"
122

  
123
		# If we have a rollup patch, use that instead of the individual ones.
124
		UPSTREAM_PATCHES+=( patch.sh )
125
	else
126
		# We use a mirror as well because we've had reports of 403 forbidden for some users.
127
		upstream_url_base="https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P}-"
128
		upstream_m_url_base="https://invisible-mirror.net/archives/${PN}/${PV/_p*}/${MY_P}-"
129

  
130
		# Prefix each date with the upstream location (https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P})
131
		mangled_patches=( "${PATCH_DATES[@]/#/${upstream_url_base}}" )
132
		# Suffix each with .patch.gz
133
		mangled_patches=( "${mangled_patches[@]/%/.patch.gz}" )
134
		mangled_patches_sig=( "${mangled_patches[@]/%/.asc}" )
135
		# Repeat for .patch.gz.asc for verify-sig
136
		SRC_URI+=" ${mangled_patches[@]}"
137
		SRC_URI+=" verify-sig? ( ${mangled_patches_sig[@]} )"
138

  
139
		# For all of the URLs, chuck in invisible-island.net too:
140
		SRC_URI+=" ${mangled_patches[@]/${upstream_url_base}/${upstream_m_url_base}}"
141
		SRC_URI+=" verify-sig? ( ${mangled_patches_sig[@]/${upstream_url_base}/${upstream_m_url_base}} )"
142

  
143
		UPSTREAM_PATCHES=( "${PATCH_DATES[@]/%/.patch}" )
144

  
145
		unset upstream_url_base upstream_m_url_base mangled_patches mangled_patches_sig
146
	fi
147
fi
148

  
149
SRC_URI+=" https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${GENTOO_PATCH_NAME}.tar.xz"
150
S="${WORKDIR}/${MY_P}"
151

  
152
LICENSE="MIT"
153
# The subslot reflects the SONAME.
154
SLOT="0/6"
155
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
156
IUSE="ada +cxx debug doc gpm minimal profile split-usr +stack-realign static-libs test tinfo trace"
157
RESTRICT="!test? ( test )"
158

  
159
DEPEND="gpm? ( sys-libs/gpm[${MULTILIB_USEDEP}] )"
160
# Block the older ncurses that installed all files w/SLOT=5, bug #557472
161
RDEPEND="
162
	${DEPEND}
163
	!<=sys-libs/ncurses-5.9-r4:5
164
	!<sys-libs/slang-2.3.2_pre23
165
	!<x11-terms/rxvt-unicode-9.06-r3
166
	!<x11-terms/st-0.6-r1
16
IUSE="+exif gtk-doc +introspection +jpeg lcms +svg xmp tiff"
17
REQUIRED_USE="
18
	exif? ( jpeg )
19
	gtk-doc? ( introspection )
167 20
"
168
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-thomasdickey )"
169

  
170
PATCHES=(
171
	"${UPSTREAM_PATCHES[@]/#/${WORKDIR}/${MY_P}-}"
172

  
173
	# When rebasing Gentoo's patchset, please use git from a clean
174
	# src_prepare with upstream patches already applied. git am --reject
175
	# the existing patchset and rebase as required. This makes it easier
176
	# to manage future rebasing & adding new patches.
177
	#
178
	# For the same reasons, please include the original configure.in changes,
179
	# NOT just the generated results!
180
	"${WORKDIR}"/${GENTOO_PATCH_NAME}
181

  
182
	# Avoid breakage with CHOST ending in t64
183
	"${FILESDIR}"/ncurses-6.4-t64-1.patch
184
	"${FILESDIR}"/ncurses-6.4-t64-2.patch
185
)
186

  
187
src_unpack() {
188
	# Avoid trying to verify our own patchset tarball, there's no point
189
	if use verify-sig ; then
190
		local file
191
		for file in ${A} ; do
192
			if [[ ${file} == ${MY_P}.tar.gz ]] ; then
193
				verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.sig
194
			else
195
				[[ ${file} == @(*${GENTOO_PATCH_NAME}.tar.xz|*.asc|*.sig) ]] && continue
196

  
197
				verify-sig_verify_detached "${DISTDIR}"/${file} "${DISTDIR}"/${file}.asc
198
			fi
199
		done
200
	fi
201

  
202
	default
203
}
204 21

  
205
src_configure() {
206
	# bug #115036
207
	unset TERMINFO
208

  
209
	tc-export_build_env BUILD_{CC,CXX,CPP}
210

  
211
	# bug #214642
212
	BUILD_CPPFLAGS+=" -D_GNU_SOURCE"
213

  
214
	# Build the various variants of ncurses -- narrow, wide, and threaded. #510440
215
	# Order matters here -- we want unicode/thread versions to come last so that the
216
	# binaries in /usr/bin support both wide and narrow.
217
	# The naming is also important as we use these directly with filenames and when
218
	# checking configure flags.
219
	NCURSES_TARGETS=(
220
		ncurses
221
		ncursesw
222
		ncursest
223
		ncursestw
224
	)
225

  
226
	# When installing ncurses, we have to use a compatible version of tic.
227
	# This comes up when cross-compiling, doing multilib builds, upgrading,
228
	# or installing for the first time.  Build a local copy of tic whenever
229
	# the host version isn't available. bug #249363, bug #557598
230
	if ! has_version -b "~sys-libs/${P}:0" ; then
231
		local lbuildflags="-static"
232

  
233
		# some toolchains don't quite support static linking
234
		local dbuildflags="-Wl,-rpath,${WORKDIR}/lib"
235
		case ${CHOST} in
236
			*-darwin*)  dbuildflags=     ;;
237
			*-solaris*) dbuildflags="-Wl,-R,${WORKDIR}/lib" ;;
238
		esac
239
		echo "int main() {}" | \
240
			$(tc-getCC) -o x -x c - ${lbuildflags} -pipe >& /dev/null \
241
			|| lbuildflags="${dbuildflags}"
242

  
243
		# We can't re-use the multilib BUILD_DIR because we run outside of it.
244
		BUILD_DIR="${WORKDIR}" \
245
		CC=${BUILD_CC} \
246
		CXX=${BUILD_CXX} \
247
		CPP=${BUILD_CPP} \
248
		CHOST=${CBUILD} \
249
		CFLAGS=${BUILD_CFLAGS} \
250
		CXXFLAGS=${BUILD_CXXFLAGS} \
251
		CPPFLAGS=${BUILD_CPPFLAGS} \
252
		LDFLAGS="${BUILD_LDFLAGS} ${lbuildflags}" \
253
		do_configure cross --without-shared --with-normal --with-progs --without-ada
254
	fi
255
	multilib-minimal_src_configure
256
}
257

  
258
multilib_src_configure() {
259
	if [[ ${ABI} == x86 ]] ; then
260
		# For compatibility with older binaries at slight performance cost.
261
		# bug #616402
262
		use stack-realign && append-flags -mstackrealign
263
	fi
264

  
265
	local t
266
	for t in "${NCURSES_TARGETS[@]}" ; do
267
		do_configure "${t}"
268
	done
269
}
22
RDEPEND="
23
	>=dev-libs/glib-2.73.2:2
24
	>=dev-libs/libpeas-0.7.4:0[gtk]
25
	>=gnome-base/gnome-desktop-2.91.2:3=
26
	>=gnome-base/gsettings-desktop-schemas-42_beta
27
	>=x11-misc/shared-mime-info-0.20
28
	>=x11-libs/gdk-pixbuf-2.36.5:2[jpeg?,tiff?]
29
	>=x11-libs/gtk+-3.24.15:3[introspection,X]
30
	>=gui-libs/libhandy-1.5.0:1
31
	sys-libs/zlib
32

  
33
	exif? ( >=media-libs/libexif-0.6.14 )
34
	lcms? ( media-libs/lcms:2 )
35
	xmp? ( media-libs/exempi:2= )
36
	jpeg? ( media-libs/libjpeg-turbo:= )
37
	introspection? ( >=dev-libs/gobject-introspection-1.54:= )
38
	svg? ( >=gnome-base/librsvg-2.44.0:2 )
270 39

  
271
do_configure() {
272
	local target=$1
273
	shift
274

  
275
	mkdir "${BUILD_DIR}/${target}" || die
276
	cd "${BUILD_DIR}/${target}" || die
277

  
278
	local conf=(
279
		# We need the basic terminfo files in /etc, bug #37026.  We will
280
		# add '--with-terminfo-dirs' and then populate /etc/terminfo in
281
		# src_install() ...
282
		--with-terminfo-dirs="${EPREFIX}/etc/terminfo:${EPREFIX}/usr/share/terminfo"
283

  
284
		# Enable installation of .pc files.
285
		--enable-pc-files
286
		# This path is used to control where the .pc files are installed.
287
		--with-pkg-config-libdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
288

  
289
		# Now the rest of the various standard flags.
290
		--with-shared
291
		# (Originally disabled until bug #245417 is sorted out, but now
292
		# just keeping it off for good, given nobody needed it until now
293
		# (2022) and we're trying to phase out bdb.)
294
		--without-hashed-db
295
		$(use_with ada)
296
		$(use_with cxx)
297
		$(use_with cxx cxx-binding)
298
		--with-cxx-shared
299
		$(use_with debug)
300
		$(use_with profile)
301
		# The configure script uses ldd to parse the linked output which
302
		# is flaky for cross-compiling/multilib/ldd versions/etc...
303
		$(use_with gpm gpm libgpm.so.1)
304
		--disable-term-driver
305
		--disable-termcap
306
		--enable-symlinks
307
		--with-manpage-format=normal
308
		--enable-const
309
		--enable-colorfgbg
310
		--enable-hard-tabs
311
		--enable-echo
312
		$(use_enable !ada warnings)
313
		$(use_with debug assertions)
314
		$(use_enable !debug leaks)
315
		$(use_with debug expanded)
316
		$(use_with !debug macros)
317
		$(multilib_native_with progs)
318
		$(use_with test tests)
319
		$(use_with trace)
320
		$(use_with tinfo termlib)
321
		--disable-stripping
322
		--disable-pkg-ldflags
40
	x11-libs/libX11
41
"
42
DEPEND="${RDEPEND}"
43
BDEPEND="
44
	gtk-doc? (
45
		dev-util/gi-docgen
46
		app-text/docbook-xml-dtd:4.1.2
323 47
	)
48
	dev-util/glib-utils
49
	dev-util/itstool
50
	>=sys-devel/gettext-0.19.8
51
	virtual/pkgconfig
52
"
324 53

  
325
	if [[ ${target} == ncurses*w ]] ; then
326
		conf+=( --enable-widec )
327
	else
328
		conf+=( --disable-widec )
329
	fi
330
	if [[ ${target} == ncursest* ]] ; then
331
		conf+=( --with-{pthread,reentrant} )
332
	else
333
		conf+=(
334
			--without-{pthread,reentrant}
335

  
336
			# XXX: Revisit on next ABI break (>6) (bug #928873)
337
			--disable-opaque-curses
338
			--disable-opaque-form
339
			--disable-opaque-menu
340
			--disable-opaque-panel
341
		)
342
	fi
343

  
344
	# Make sure each variant goes in a unique location.
345
	if [[ ${target} == "ncurses" ]] ; then
346
		# "ncurses" variant goes into "${EPREFIX}"/usr/include
347
		# It is needed on Prefix because the configure script appends
348
		# "ncurses" to "${prefix}/include" if "${prefix}" is not /usr.
349
		conf+=( --enable-overwrite )
350
	else
351
		conf+=( --includedir="${EPREFIX}"/usr/include/${target} )
352
	fi
353
	# See comments in src_configure.
354
	if [[ ${target} != "cross" ]] ; then
355
		local cross_path="${WORKDIR}/cross"
356
		[[ -d ${cross_path} ]] && export TIC_PATH="${cross_path}/progs/tic"
357
	fi
358

  
359
	ECONF_SOURCE="${S}" econf "${conf[@]}" "$@"
360
}
361

  
362
src_compile() {
363
	# See comments in src_configure.
364
	if ! has_version -b "~sys-libs/${P}:0" ; then
365
		BUILD_DIR="${WORKDIR}" do_compile cross -C progs tic$(get_exeext)
366
	fi
367

  
368
	multilib-minimal_src_compile
369
}
370

  
371
multilib_src_compile() {
372
	local t
373
	for t in "${NCURSES_TARGETS[@]}" ; do
374
		do_compile "${t}"
375
	done
376
}
377

  
378
do_compile() {
379
	local target=$1
380
	shift
381

  
382
	cd "${BUILD_DIR}/${target}" || die
383

  
384
	# A little hack to fix parallel builds ... they break when
385
	# generating sources so if we generate the sources first (in
386
	# non-parallel), we can then build the rest of the package
387
	# in parallel.  This is not really a perf hit since the source
388
	# generation is quite small.
389
	emake -j1 sources
390

  
391
	# For some reason, sources depends on pc-files which depends on
392
	# compiled libraries which depends on sources which ...
393
	# Manually delete the pc-files file so the install step will
394
	# create the .pc files we want.
395
	rm -f misc/pc-files || die
396
	emake "$@"
397
}
398

  
399
multilib_src_install() {
400
	local target
401
	for target in "${NCURSES_TARGETS[@]}" ; do
402
		emake -C "${BUILD_DIR}/${target}" DESTDIR="${D}" install
403
	done
404

  
405
	# Move main libraries into /.
406
	if multilib_is_native_abi ; then
407
		gen_usr_ldscript -a \
408
			"${NCURSES_TARGETS[@]}" \
409
			$(usex tinfo 'tinfow tinfo' '')
410
	fi
411

  
412
	# Don't delete '*.dll.a', needed for linking, bug #631468
413
	if ! use static-libs; then
414
		find "${ED}"/usr/ -name '*.a' ! -name '*.dll.a' -delete || die
415
	fi
416

  
417
	# Build fails to create this ...
418
	# -FIXME-
419
	# Ugly hackaround for riscv having two parts libdir (bug #689240)
420
	# Replace this hack with an official solution once we have one...
421
	# -FIXME-
422
	dosym $(sed 's@[^/]\+@..@g' <<< $(get_libdir))/share/terminfo \
423
		/usr/$(get_libdir)/terminfo
424

  
425
	# Remove obsolete libcurses symlink that is created by the build
426
	# system. Technically, this could be also achieved
427
	# via --disable-overwrite but it also moves headers implicitly,
428
	# and we do not want to do this yet.
429
	# bug #836696
430
	rm "${ED}"/usr/$(get_libdir)/libcurses* || die
431
}
432

  
433
multilib_src_install_all() {
434
	local terms=(
435
		# Dumb/simple values that show up when using the in-kernel VT.
436
		ansi console dumb linux
437
		vt{52,100,102,200,220}
438
		# [u]rxvt users used to be pretty common.  Probably should drop this
439
		# since upstream is dead and people are moving away from it.
440
		rxvt{,-unicode}{,-256color}
441
		# xterm users are common, as is terminals re-using/spoofing it.
442
		xterm xterm-{,256}color
443
		# screen is common (and reused by tmux).
444
		screen{,-256color}
445
		screen.xterm-256color
54
src_configure() {
55
	local emesonargs=(
56
		$(meson_use exif libexif)
57
		$(meson_use lcms cms)
58
		$(meson_use xmp)
59
		$(meson_use jpeg libjpeg)
60
		$(meson_use svg librsvg)
61
		$(meson_use gtk-doc gtk_doc)
62
		$(meson_use introspection)
63
		-Dinstalled_tests=false
64
		-Dlibportal=false # As of 40.3, all libportal usages are flatpak-specific
446 65
	)
447
	if use split-usr ; then
448
		local x
449
		# We need the basic terminfo files in /etc for embedded/recovery, bug #37026
450
		einfo "Installing basic terminfo files in /etc..."
451
		for x in "${terms[@]}"; do
452
			local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 2>/dev/null)
453
			local basedir=$(basename "$(dirname "${termfile}")")
454

  
455
			if [[ -n ${termfile} ]] ; then
456
				dodir "/etc/terminfo/${basedir}"
457
				mv "${termfile}" "${ED}/etc/terminfo/${basedir}/" || die
458
				dosym "../../../../etc/terminfo/${basedir}/${x}" \
459
					"/usr/share/terminfo/${basedir}/${x}"
460
			fi
461
		done
462

  
463
		echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 50ncurses
464

  
465
		use minimal && rm -r "${ED}"/usr/share/terminfo*
466
		# Because ncurses5-config --terminfo returns the directory we keep it
467
		# bug #245374
468
		keepdir /usr/share/terminfo
469
	elif use minimal ; then
470
		# Keep only the basic terminfo files
471
		find "${ED}"/usr/share/terminfo/ \
472
			\( -type f -o -type l \) ${terms[*]/#/! -name } -delete , \
473
			-type d -empty -delete || die
474
	fi
475

  
476
	cd "${S}" || die
477
	dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc
478
	if use doc ; then
479
		docinto html
480
		dodoc -r doc/html/
481
	fi
66
	meson_src_configure
482 67
}
483 68

  
484
pkg_preinst() {
485
	preserve_old_lib /$(get_libdir)/libncurses.so.5
486
	preserve_old_lib /$(get_libdir)/libncursesw.so.5
69
pkg_postinst() {
70
	xdg_pkg_postinst
71
	gnome2_schemas_update
487 72
}
488 73

  
489
pkg_postinst() {
490
	preserve_old_lib_notify /$(get_libdir)/libncurses.so.5
491
	preserve_old_lib_notify /$(get_libdir)/libncursesw.so.5
74
pkg_postrm() {
75
	xdg_pkg_postrm
76
	gnome2_schemas_update
492 77
}
Thank you!