Diff emacs-18.59-r15 with a emacs-25.3-r18

/usr/portage/app-editors/emacs/emacs-25.3-r18.ebuild 2023-10-09 14:52:28.276368319 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
inherit toolchain-funcs flag-o-matic multilib
6
inherit autotools elisp-common flag-o-matic readme.gentoo-r1
7 7

  
8
DESCRIPTION="The extensible self-documenting text editor"
8
DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
9 9
HOMEPAGE="https://www.gnu.org/software/emacs/"
10
SRC_URI="ftp://ftp.gnu.org/old-gnu/emacs/${P}.tar.gz
11
	https://dev.gentoo.org/~ulm/emacs/${P}-patches-15.tar.xz"
10
SRC_URI="mirror://gnu/emacs/${P}.tar.xz
11
	https://dev.gentoo.org/~ulm/emacs/${P}-patches-5.tar.xz"
12 12

  
13
LICENSE="GPL-1+ GPL-2+ BSD HPND"
14
SLOT="18"
15
KEYWORDS="amd64 x86"
16
IUSE="abi_x86_x32 gui"
17

  
18
RDEPEND="sys-libs/ncurses:0=
19
	amd64? (
20
		abi_x86_x32? ( >=sys-libs/ncurses-5.9-r3:0=[abi_x86_x32(-)?] )
21
		!abi_x86_x32? ( >=sys-libs/ncurses-5.9-r3:0=[abi_x86_32(-)] )
22
	)
23
	gui? ( x11-libs/libX11 )"
13
LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
14
SLOT="25"
15
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
16
IUSE="acl alsa aqua athena cairo dbus dynamic-loading games gfile gif gpm gsettings gtk gui gzip-el imagemagick +inotify jpeg kerberos libxml2 livecd m17n-lib motif png selinux sound source ssl svg tiff toolkit-scroll-bars valgrind wide-int Xaw3d xft +xpm zlib"
17

  
18
RDEPEND="acct-group/mail
19
	app-emacs/emacs-common[games?,gui(-)?]
20
	net-libs/liblockfile
21
	sys-libs/ncurses:0=
22
	acl? ( virtual/acl )
23
	alsa? ( media-libs/alsa-lib )
24
	dbus? ( sys-apps/dbus )
25
	games? ( acct-group/gamestat )
26
	gpm? ( sys-libs/gpm )
27
	!inotify? ( gfile? ( >=dev-libs/glib-2.28.6 ) )
28
	kerberos? ( virtual/krb5 )
29
	libxml2? ( >=dev-libs/libxml2-2.2.0 )
30
	selinux? ( sys-libs/libselinux )
31
	ssl? ( net-libs/gnutls:0= )
32
	valgrind? ( dev-util/valgrind )
33
	zlib? ( sys-libs/zlib )
34
	gui? ( !aqua? (
35
		x11-libs/libICE
36
		x11-libs/libSM
37
		x11-libs/libX11
38
		x11-libs/libXext
39
		x11-libs/libXfixes
40
		x11-libs/libXinerama
41
		x11-libs/libXrandr
42
		x11-libs/libxcb
43
		x11-misc/xbitmaps
44
		gsettings? ( >=dev-libs/glib-2.28.6 )
45
		gif? ( media-libs/giflib:0= )
46
		jpeg? ( media-libs/libjpeg-turbo:0= )
47
		png? ( >=media-libs/libpng-1.4:0= )
48
		svg? ( >=gnome-base/librsvg-2.0 )
49
		tiff? ( media-libs/tiff:= )
50
		xpm? ( x11-libs/libXpm )
51
		imagemagick? ( >=media-gfx/imagemagick-6.6.2:0= )
52
		xft? (
53
			media-libs/fontconfig
54
			media-libs/freetype
55
			x11-libs/libXft
56
			x11-libs/libXrender
57
			cairo? ( >=x11-libs/cairo-1.12.18[X] )
58
			m17n-lib? (
59
				>=dev-libs/libotf-0.9.4
60
				>=dev-libs/m17n-lib-1.5.1
61
			)
62
		)
63
		gtk? ( x11-libs/gtk+:3 )
64
		!gtk? (
65
			motif? (
66
				>=x11-libs/motif-2.3:0
67
				x11-libs/libXpm
68
				x11-libs/libXmu
69
				x11-libs/libXt
70
			)
71
			!motif? (
72
				Xaw3d? (
73
					x11-libs/libXaw3d
74
					x11-libs/libXmu
75
					x11-libs/libXt
76
				)
77
				!Xaw3d? ( athena? (
78
					x11-libs/libXaw
79
					x11-libs/libXmu
80
					x11-libs/libXt
81
				) )
82
			)
83
		)
84
	) )"
24 85

  
25 86
DEPEND="${RDEPEND}
26
	gui? (
27
		x11-base/xorg-proto
28
		x11-misc/xbitmaps
29
	)"
87
	gui? ( !aqua? ( x11-base/xorg-proto ) )"
88

  
89
BDEPEND="virtual/pkgconfig
90
	gzip-el? ( app-arch/gzip )"
30 91

  
31
BDEPEND="virtual/pkgconfig"
32 92
IDEPEND="app-eselect/eselect-emacs"
93

  
33 94
RDEPEND+=" ${IDEPEND}"
34 95

  
96
EMACS_SUFFIX="emacs-${SLOT}"
97
SITEFILE="20${EMACS_SUFFIX}-gentoo.el"
98
# FULL_VERSION keeps the full version number, which is needed in
99
# order to determine some path information correctly for copy/move
100
# operations later on
101
FULL_VERSION="${PV%%_*}"
102
S="${WORKDIR}/emacs-${FULL_VERSION}"
35 103
PATCHES=("${WORKDIR}/patch")
36 104

  
37 105
src_prepare() {
38 106
	default
39 107

  
40
	# Do not use the sandbox, or the dumped Emacs will be twice as large
41
	sed -i -e 's:\./temacs.*dump:SANDBOX_ON=0 LD_PRELOAD= env &:' \
42
		src/ymakefile || die
108
	# Fix filename reference in redirected man page
109
	sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 \
110
		|| die "unable to sed ctags.1"
111

  
112
	AT_M4DIR=m4 eautoreconf
113
	touch src/stamp-h.in || die
43 114
}
44 115

  
45 116
src_configure() {
46
	# autoconf? What's autoconf? We are living in 1992. ;-)
47
	local arch
48
	case ${ARCH} in
49
		amd64)
50
			if use abi_x86_x32; then
51
				arch=x86-x32
52
				multilib_toolchain_setup x32
53
			else
54
				arch=intel386
55
				multilib_toolchain_setup x86
56
			fi
57
			;;
58
		x86) arch=intel386 ;;
59
		*) die "Architecture ${ARCH} not yet supported" ;;
60
	esac
61
	local cmd="s/\"s-.*\.h\"/\"s-linux.h\"/;s/\"m-.*\.h\"/\"m-${arch}.h\"/"
62
	use gui && cmd="${cmd};s/.*\(#define HAVE_X_WINDOWS\).*/\1/"
63
	sed -e "${cmd}" src/config.h-dist >src/config.h || die
64

  
65
	cat <<-END >src/paths.h
66
		#define PATH_LOADSEARCH "/usr/share/emacs/${PV}/lisp"
67
		#define PATH_EXEC "/usr/share/emacs/${PV}/etc"
68
		#define PATH_LOCK "/var/lib/emacs/lock/"
69
		#define PATH_SUPERLOCK "/var/lib/emacs/lock/!!!SuperLock!!!"
70
	END
71

  
72
	sed -i -e "s:/usr/lib/\([^ ]*\).o:/usr/$(get_libdir)/\1.o:g" \
73
		-e "s:-lncurses:$("$(tc-getPKG_CONFIG)" --libs ncurses):" \
74
		src/s-linux.h || die
75

  
76
	# -O3 and -finline-functions cause segmentation faults at run time.
77
	# -Wno-implicit and -Wno-return-type will quieten newer versions of GCC;
78
	# feel free to submit a patch adding all those missing prototypes.
79 117
	strip-flags
80
	filter-flags -finline-functions -fpie
81
	append-flags -fno-strict-aliasing -Wno-implicit -Wno-return-type
82
	append-ldflags $(test-flags -no-pie)	#639562
83
	replace-flags -O[3-9] -O2
118
	filter-flags -pie					#526948
119

  
120
	if use ia64; then
121
		replace-flags "-O[2-9]" -O1		#325373
122
	else
123
		replace-flags "-O[3-9]" -O2
124
	fi
125

  
126
	# Don't trigger a floating point exception for NaNs on alpha
127
	use alpha && append-flags -mieee
128

  
129
	local myconf
130

  
131
	if use alsa; then
132
		use sound || ewarn \
133
			"USE flag \"alsa\" overrides \"-sound\"; enabling sound support."
134
		myconf+=" --with-sound=alsa"
135
	else
136
		myconf+=" --with-sound=$(usex sound oss)"
137
	fi
138

  
139
	if ! use gui; then
140
		einfo "Configuring to build without window system support"
141
		myconf+=" --without-x --without-ns"
142
	elif use aqua; then
143
		einfo "Configuring to build with Nextstep (Macintosh Cocoa) support"
144
		myconf+=" --with-ns --disable-ns-self-contained"
145
		myconf+=" --without-x"
146
	else
147
		myconf+=" --with-x --without-ns"
148
		myconf+=" --without-gconf"
149
		myconf+=" $(use_with gsettings)"
150
		myconf+=" $(use_with toolkit-scroll-bars)"
151
		myconf+=" $(use_with gif)"
152
		myconf+=" $(use_with jpeg)"
153
		myconf+=" $(use_with png)"
154
		myconf+=" $(use_with svg rsvg)"
155
		myconf+=" $(use_with tiff)"
156
		myconf+=" $(use_with xpm)"
157
		myconf+=" $(use_with imagemagick)"
158

  
159
		if use xft; then
160
			myconf+=" --with-xft"
161
			myconf+=" $(use_with cairo)"
162
			myconf+=" $(use_with m17n-lib libotf)"
163
			myconf+=" $(use_with m17n-lib m17n-flt)"
164
		else
165
			myconf+=" --without-xft"
166
			myconf+=" --without-cairo"
167
			myconf+=" --without-libotf --without-m17n-flt"
168
			use cairo && ewarn \
169
				"USE flag \"cairo\" has no effect if \"xft\" is not set."
170
			use m17n-lib && ewarn \
171
				"USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
172
		fi
173

  
174
		local f line
175
		if use gtk; then
176
			einfo "Configuring to build with GIMP Toolkit (GTK+)"
177
			while read line; do ewarn "${line}"; done <<-EOF
178
				Your version of GTK+ will have problems with closing open
179
				displays. This is no problem if you just use one display, but
180
				if you use more than one and close one of them Emacs may crash.
181
				See <https://gitlab.gnome.org/GNOME/gtk/-/issues/221> and
182
				<https://gitlab.gnome.org/GNOME/gtk/-/issues/2315>.
183
				If you intend to use more than one display, then it is strongly
184
				recommended that you compile Emacs with the Athena/Lucid or the
185
				Motif toolkit instead.
186
			EOF
187
			myconf+=" --with-x-toolkit=gtk3"
188
			myconf+=" --without-xwidgets"
189
			for f in motif Xaw3d athena; do
190
				use ${f} && ewarn \
191
					"USE flag \"${f}\" has no effect if \"gtk\" is set."
192
			done
193
		elif use motif; then
194
			einfo "Configuring to build with Motif toolkit"
195
			myconf+=" --with-x-toolkit=motif"
196
			for f in Xaw3d athena; do
197
				use ${f} && ewarn \
198
					"USE flag \"${f}\" has no effect if \"motif\" is set."
199
			done
200
		elif use athena || use Xaw3d; then
201
			einfo "Configuring to build with Athena/Lucid toolkit"
202
			myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
203
		else
204
			einfo "Configuring to build with no toolkit"
205
			myconf+=" --with-x-toolkit=no"
206
		fi
207
	fi
208

  
209
	econf \
210
		--program-suffix="-${EMACS_SUFFIX}" \
211
		--infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
212
		--localstatedir="${EPREFIX}"/var \
213
		--enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
214
		--with-gameuser=":gamestat" \
215
		--without-compress-install \
216
		--without-hesiod \
217
		--with-file-notification=$(usev inotify || usev gfile || echo no) \
218
		$(use_enable acl) \
219
		$(use_with dbus) \
220
		$(use_with dynamic-loading modules) \
221
		$(use_with gpm) \
222
		$(use_with kerberos) $(use_with kerberos kerberos5) \
223
		$(use_with libxml2 xml2) \
224
		$(use_with selinux) \
225
		$(use_with ssl gnutls) \
226
		$(use_with wide-int) \
227
		$(use_with zlib) \
228
		${myconf}
84 229
}
85 230

  
86 231
src_compile() {
87
	addpredict /var/lib/emacs/lock		#nowarn
88
	emake --jobs=1 \
89
		CC="$(tc-getCC)" CFLAGS="${CFLAGS} -Demacs" \
90
		LD="$(tc-getCC) -nostdlib" LDFLAGS="${LDFLAGS}"
232
	export ac_cv_header_valgrind_valgrind_h=$(usex valgrind)
233

  
234
	# Disable sandbox when dumping. For the unbelievers, see bug #131505
235
	emake RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
91 236
}
92 237

  
93 238
src_install() {
94
	local basedir="/usr/share/emacs/${PV}" i
239
	emake DESTDIR="${D}" NO_BIN_LINK=t BLESSMAIL_TARGET= install
95 240

  
96
	dodir ${basedir}
97
	dodir /usr/share/man/man1
98
	emake --jobs=1 \
99
		LIBDIR="${D}"${basedir} \
100
		BINDIR="${D}"/usr/bin \
101
		MANDIR="${D}"/usr/share/man/man1 \
102
		install
103

  
104
	rmdir "${D}"${basedir}/lock || die
105
	find "${D}"${basedir} -type f \( -name "*.c" -o -name ChangeLog \
106
		-o -name COPYING ! -path "*/etc/COPYING" \) -exec rm "{}" + || die
107
	fperms -R go-w ${basedir}
108

  
109
	# remove duplicate DOC file
110
	rm "${D}"${basedir}/etc/DOC || die
111

  
112
	# move executables to the correct place
113
	mv "${D}"/usr/bin/emacs{,-${SLOT}} || die
114
	mv "${D}"/usr/bin/emacsclient{,-emacs-${SLOT}} || die
115
	rm "${D}"${basedir}/etc/emacsclient || die
116

  
117
	dodir /usr/libexec/emacs/${PV}
118
	for i in wakeup digest-doc sorted-doc movemail cvtmail fakemail \
119
		yow env server
120
	do
121
		mv "${D}"${basedir}/etc/${i} "${D}"/usr/libexec/emacs/${PV}/${i} || die
122
		dosym -r /usr/libexec/emacs/${PV}/${i} ${basedir}/etc/${i}
123
	done
124
	for i in test-distrib make-docfile; do
125
		rm "${D}"${basedir}/etc/${i} || die
126
	done
127

  
128
	# move man page
129
	mv "${D}"/usr/share/man/man1/emacs{,-${SLOT}}.1 || die
130

  
131
	# move Info files
132
	dodir /usr/share/info
133
	mv "${D}"${basedir}/info "${D}"/usr/share/info/emacs-${SLOT} || die
134
	dosym -r /usr/share/info/emacs-${SLOT} ${basedir}/info
135
	docompress -x /usr/share/info
241
	mv "${ED}"/usr/bin/{emacs-${FULL_VERSION}-,}${EMACS_SUFFIX} \
242
		|| die "moving emacs executable failed"
243
	mv "${ED}"/usr/share/man/man1/{emacs-,}${EMACS_SUFFIX}.1 \
244
		|| die "moving emacs man page failed"
136 245

  
137 246
	# dissuade Portage from removing our dir file #257260
138
	touch "${D}"/usr/share/info/emacs-${SLOT}/.keepinfodir
139

  
140
	dodir /var/lib/emacs
141
	diropts -m0777
142
	keepdir /var/lib/emacs/lock
247
	touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
248
	docompress -x /usr/share/info/${EMACS_SUFFIX}/dir
143 249

  
144
	dodoc README PROBLEMS
250
	# movemail must be setgid mail
251
	fowners root:mail /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
252
	fperms 2751 /usr/libexec/emacs/${FULL_VERSION}/${CHOST}/movemail
253

  
254
	# avoid collision between slots, see bug #169033 e.g.
255
	rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el || die
256
	rm -rf "${ED}"/usr/share/{appdata,applications,icons} || die
257
	rm -rf "${ED}"/var || die
258

  
259
	# remove unused <version>/site-lisp dir
260
	rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp || die
261

  
262
	# remove COPYING file (except for etc/COPYING used by describe-copying)
263
	rm "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp/COPYING || die
264

  
265
	if use gzip-el; then
266
		# compress .el files when a corresponding .elc exists
267
		find "${ED}"/usr/share/emacs/${FULL_VERSION}/lisp -type f \
268
			-name "*.elc" -print | sed 's/\.elc$/.el/' | xargs gzip -9n
269
		assert "gzip .el failed"
270
	fi
271

  
272
	local cdir
273
	if use source; then
274
		cdir="/usr/share/emacs/${FULL_VERSION}/src"
275
		insinto "${cdir}"
276
		# This is not meant to install all the source -- just the
277
		# C source you might find via find-function
278
		doins src/*.{c,h,m}
279
	elif has installsources ${FEATURES}; then
280
		cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src"
281
	fi
282

  
283
	sed -e "${cdir:+#}/^Y/d" -e "s/^[XY]//" >"${T}/${SITEFILE}" <<-EOF || die
284
	X
285
	;;; ${EMACS_SUFFIX} site-lisp configuration
286
	X
287
	(when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
288
	Y  (setq find-function-C-source-directory
289
	Y	"${EPREFIX}${cdir}")
290
	X  (let ((path (getenv "INFOPATH"))
291
	X	(dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
292
	X	(re "\\\\\`${EPREFIX}/usr/share\\\\>"))
293
	X    (and path
294
	X	 ;; move Emacs Info dir before anything else in /usr/share
295
	X	 (let* ((p (cons nil (split-string path ":" t))) (q p))
296
	X	   (while (and (cdr q) (not (string-match re (cadr q))))
297
	X	     (setq q (cdr q)))
298
	X	   (setcdr q (cons dir (delete dir (cdr q))))
299
	X	   (setenv "INFOPATH" (mapconcat 'identity (cdr p) ":"))))))
300
	EOF
301
	elisp-site-file-install "${T}/${SITEFILE}" || die
302

  
303
	dodoc README BUGS CONTRIBUTE
304

  
305
	if use gui && use aqua; then
306
		dodir /Applications/Gentoo
307
		rm -rf "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
308
		mv nextstep/Emacs.app \
309
			"${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
310
	fi
311

  
312
	local DOC_CONTENTS="You can set the version to be started by
313
		/usr/bin/emacs through the Emacs eselect module, which also
314
		redirects man and info pages. Therefore, several Emacs versions can
315
		be installed at the same time. \"man emacs.eselect\" for details.
316
		\\n\\nIf you upgrade from a previous major version of Emacs, then
317
		it is strongly recommended that you use app-admin/emacs-updater
318
		to rebuild all byte-compiled elisp files of the installed Emacs
319
		packages."
320
	if use gui; then
321
		DOC_CONTENTS+="\\n\\nYou need to install some fonts for Emacs.
322
			Installing media-fonts/font-adobe-{75,100}dpi on the X server's
323
			machine would satisfy basic Emacs requirements under X11.
324
			See also https://wiki.gentoo.org/wiki/Xft_support_for_GNU_Emacs
325
			for how to enable anti-aliased fonts."
326
		use aqua && DOC_CONTENTS+="\\n\\n${EMACS_SUFFIX^}.app is in
327
			\"${EPREFIX}/Applications/Gentoo\". You may want to copy or
328
			symlink it into /Applications by yourself."
329
	fi
330
	readme.gentoo_create_doc
145 331
}
146 332

  
147 333
pkg_preinst() {
148 334
	# verify that the PM hasn't removed our Info directory index #257260
149
	local infodir="${ED}/usr/share/info/emacs-${SLOT}"
335
	local infodir="${ED}/usr/share/info/${EMACS_SUFFIX}"
150 336
	[[ -f ${infodir}/dir || ! -d ${infodir} ]] || die
151 337
}
152 338

  
153 339
pkg_postinst() {
154
	eselect emacs update ifunset
340
	elisp-site-regen
341
	readme.gentoo_print_elog
342

  
343
	if use livecd; then
344
		# force an update of the emacs symlink for the livecd/dvd,
345
		# because some microemacs packages set it with USE=livecd
346
		eselect emacs update
347
	else
348
		eselect emacs update ifunset
349
	fi
155 350
}
156 351

  
157 352
pkg_postrm() {
353
	elisp-site-regen
158 354
	eselect emacs update ifunset
159 355
}
Thank you!