Diff emacs-18.59-r12 with a emacs-23.4-r18

/usr/portage/app-editors/emacs/emacs-23.4-r18.ebuild 2020-05-02 12:39:00.000000000 +0300
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=7
5
WANT_AUTOMAKE="none"
5 6

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

  
8
DESCRIPTION="The extensible self-documenting text editor"
9
DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
9 10
HOMEPAGE="https://www.gnu.org/software/emacs/"
10
SRC_URI="ftp://ftp.gnu.org/old-gnu/emacs/${P}.tar.gz
11
	ftp://ftp.splode.com/pub/users/friedman/emacs/${P}-linux22x-elf-glibc21.diff.gz
12
	https://dev.gentoo.org/~ulm/emacs/${P}-patches-12.tar.xz"
13

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

  
19
RDEPEND="sys-libs/ncurses:0=
20
	amd64? (
21
		abi_x86_x32? ( >=sys-libs/ncurses-5.9-r3:0=[abi_x86_x32(-)?] )
22
		!abi_x86_x32? ( >=sys-libs/ncurses-5.9-r3:0=[abi_x86_32(-)] )
23
	)
24
	X? ( x11-libs/libX11 )"
11
SRC_URI="mirror://gnu/emacs/${P}.tar.bz2
12
	https://dev.gentoo.org/~ulm/emacs/${P}-patches-23.tar.xz"
25 13

  
26
DEPEND="${RDEPEND}
14
LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
15
SLOT="23"
16
KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~mips ppc ppc64 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
17
IUSE="alsa aqua athena dbus games gconf gif gpm gtk gzip-el jpeg kerberos livecd m17n-lib motif png sound source svg tiff toolkit-scroll-bars X Xaw3d xft +xpm"
18
REQUIRED_USE="?? ( aqua X )"
19

  
20
RDEPEND=">=app-emacs/emacs-common-gentoo-1.5[games?,X?]
21
	net-libs/liblockfile
22
	sys-libs/ncurses:0=
23
	kerberos? ( virtual/krb5 )
24
	alsa? ( media-libs/alsa-lib )
25
	games? ( acct-group/gamestat )
26
	gpm? ( sys-libs/gpm )
27
	dbus? ( sys-apps/dbus )
27 28
	X? (
28
		x11-base/xorg-proto
29
		x11-libs/libICE
30
		x11-libs/libSM
31
		x11-libs/libX11
29 32
		x11-misc/xbitmaps
33
		gconf? ( >=gnome-base/gconf-2.26.2 )
34
		gif? ( media-libs/giflib:0= )
35
		jpeg? ( virtual/jpeg:0= )
36
		png? ( >=media-libs/libpng-1.4:0= )
37
		svg? ( >=gnome-base/librsvg-2.0 )
38
		tiff? ( media-libs/tiff:0 )
39
		xpm? ( x11-libs/libXpm )
40
		xft? (
41
			media-libs/fontconfig
42
			media-libs/freetype
43
			x11-libs/libXft
44
			x11-libs/libXrender
45
			m17n-lib? (
46
				>=dev-libs/libotf-0.9.4
47
				>=dev-libs/m17n-lib-1.5.1
48
			)
49
		)
50
		gtk? ( x11-libs/gtk+:2 )
51
		!gtk? (
52
			motif? (
53
				>=x11-libs/motif-2.3:0
54
				x11-libs/libXpm
55
				x11-libs/libXext
56
				x11-libs/libXmu
57
				x11-libs/libXt
58
			)
59
			!motif? (
60
				Xaw3d? (
61
					x11-libs/libXaw3d
62
					x11-libs/libXext
63
					x11-libs/libXmu
64
					x11-libs/libXt
65
				)
66
				!Xaw3d? ( athena? (
67
					x11-libs/libXaw
68
					x11-libs/libXext
69
					x11-libs/libXmu
70
					x11-libs/libXt
71
				) )
72
			)
73
		)
30 74
	)"
31 75

  
76
DEPEND="${RDEPEND}
77
	X? ( x11-base/xorg-proto )"
78

  
32 79
BDEPEND="app-eselect/eselect-emacs
33
	virtual/pkgconfig"
80
	alsa? ( virtual/pkgconfig )
81
	dbus? ( virtual/pkgconfig )
82
	X? ( virtual/pkgconfig )
83
	gzip-el? ( app-arch/gzip )"
34 84

  
35 85
RDEPEND="${RDEPEND}
36 86
	app-eselect/eselect-emacs"
37 87

  
38
PATCHES="../${P}-linux22x-elf-glibc21.diff ../patch"
88
EMACS_SUFFIX="emacs-${SLOT}"
89
SITEFILE="20${EMACS_SUFFIX}-gentoo.el"
90
# FULL_VERSION keeps the full version number, which is needed in
91
# order to determine some path information correctly for copy/move
92
# operations later on
93
FULL_VERSION="${PV%%_*}"
94
S="${WORKDIR}/emacs-${FULL_VERSION}"
39 95

  
40 96
src_prepare() {
41
	default
97
	eapply ../patch
98
	eapply_user
99

  
100
	sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 \
101
		|| die "unable to sed ctags.1"
102

  
103
	if ! use alsa; then
104
		# ALSA is detected even if not requested by its USE flag.
105
		# Suppress it by supplying pkg-config with a wrong library name.
106
		sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.in \
107
			|| die "unable to sed configure.in"
108
	fi
109
	if ! use gzip-el; then
110
		# Emacs' build system automatically detects the gzip binary and
111
		# compresses el files. We don't want that so confuse it with a
112
		# wrong binary name
113
		sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.in \
114
			|| die "unable to sed configure.in"
115
	fi
42 116

  
43
	# Do not use the sandbox, or the dumped Emacs will be twice as large
44
	sed -i -e 's:\./temacs.*dump:SANDBOX_ON=0 LD_PRELOAD= env &:' \
45
		src/ymakefile || die
117
	mv configure.in configure.ac || die
118
	eautoreconf
119
	touch src/stamp-h.in || die
46 120
}
47 121

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

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

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

  
79
	# -O3 and -finline-functions cause segmentation faults at run time.
80
	# -Wno-implicit will quieten GCC 5; feel free to submit a patch
81
	# adding all those missing prototypes.
82 123
	strip-flags
83
	filter-flags -finline-functions -fpie
84
	append-flags -Wno-implicit
85
	append-ldflags $(test-flags -no-pie)	#639562
86
	replace-flags -O[3-9] -O2
124
	filter-flags -fstrict-aliasing -pie
125
	append-flags $(test-flags -fno-strict-aliasing)
126
	append-ldflags $(test-flags -no-pie)	#639568
127

  
128
	if use ia64; then
129
		replace-flags "-O[2-9]" -O1		#325373
130
	else
131
		replace-flags "-O[3-9]" -O2
132
	fi
133

  
134
	# Don't trigger a floating point exception for NaNs on alpha
135
	use alpha && append-flags -mieee
136

  
137
	local myconf
138

  
139
	if use alsa && ! use sound; then
140
		einfo "Although sound USE flag is disabled you chose to have alsa,"
141
		einfo "so sound is switched on anyway."
142
		myconf+=" --with-sound"
143
	else
144
		myconf+=" $(use_with sound)"
145
	fi
146

  
147
	if use X; then
148
		myconf+=" --with-x --without-ns"
149
		myconf+=" $(use_with gconf)"
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

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

  
169
		# GTK+ is the default toolkit if USE=gtk is chosen with other
170
		# possibilities. Emacs upstream thinks this should be standard
171
		# policy on all distributions
172
		local f
173
		if use gtk; then
174
			einfo "Configuring to build with GIMP Toolkit (GTK+)"
175
			myconf+=" --with-x-toolkit=gtk"
176
			for f in motif Xaw3d athena; do
177
				use ${f} && ewarn \
178
					"USE flag \"${f}\" has no effect if \"gtk\" is set."
179
			done
180
		elif use motif; then
181
			einfo "Configuring to build with Motif toolkit"
182
			myconf+=" --with-x-toolkit=motif"
183
			for f in Xaw3d athena; do
184
				use ${f} && ewarn \
185
					"USE flag \"${f}\" has no effect if \"motif\" is set."
186
			done
187
		elif use athena || use Xaw3d; then
188
			einfo "Configuring to build with Athena/Lucid toolkit"
189
			myconf+=" --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
190
		else
191
			einfo "Configuring to build with no toolkit"
192
			myconf+=" --with-x-toolkit=no"
193
		fi
194
	elif use aqua; then
195
		einfo "Configuring to build with Nextstep (Cocoa) support"
196
		myconf+=" --with-ns --disable-ns-self-contained"
197
		myconf+=" --without-x"
198
	else
199
		myconf+=" --without-x --without-ns"
200
	fi
201

  
202
	# According to configure, this option is only used for GNU/Linux
203
	# (x86_64 and s390). For Gentoo Prefix we have to explicitly spell
204
	# out the location because $(get_libdir) does not necessarily return
205
	# something that matches the host OS's libdir naming (e.g. RHEL).
206
	local crtdir=$($(tc-getCC) -print-file-name=crt1.o)
207
	crtdir=${crtdir%/*}
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-crt-dir="${crtdir}" \
215
		--with-gameuser=":gamestat" \
216
		--without-hesiod \
217
		$(use_with kerberos) $(use_with kerberos kerberos5) \
218
		$(use_with gpm) \
219
		$(use_with dbus) \
220
		${myconf}
87 221
}
88 222

  
89 223
src_compile() {
90
	addpredict /var/lib/emacs/lock		#nowarn
91
	emake --jobs=1 \
92
		CC="$(tc-getCC)" CFLAGS="${CFLAGS} -Demacs" \
93
		LD="$(tc-getCC) -nostdlib" LDFLAGS="${LDFLAGS}"
224
	# Disable sandbox when dumping. For the unbelievers, see bug #131505
225
	emake CC="$(tc-getCC)" \
226
		AR="$(tc-getAR) cq" \
227
		RANLIB="$(tc-getRANLIB)" \
228
		RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
94 229
}
95 230

  
96 231
src_install() {
97
	local basedir="/usr/share/emacs/${PV}" i
232
	emake DESTDIR="${D}" install
98 233

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

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

  
112
	# remove duplicate DOC file
113
	rm "${D}"${basedir}/etc/DOC || die
114

  
115
	# move executables to the correct place
116
	mv "${D}"/usr/bin/emacs{,-${SLOT}} || die
117
	for i in etags ctags emacsclient; do
118
		mv "${D}"/usr/bin/${i}{,-emacs-${SLOT}} || die
119
		rm "${D}"${basedir}/etc/${i} || die
120
	done
121

  
122
	dodir /usr/libexec/emacs/${PV}
123
	for i in wakeup digest-doc sorted-doc movemail cvtmail fakemail \
124
		yow env server
125
	do
126
		mv "${D}"${basedir}/etc/${i} "${D}"/usr/libexec/emacs/${PV}/${i} || die
127
		dosym ../../../../libexec/emacs/${PV}/${i} ${basedir}/etc/${i}
128
	done
129
	for i in test-distrib make-docfile; do
130
		rm "${D}"${basedir}/etc/${i} || die
234
	rm "${ED}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
235
		|| die "removing duplicate emacs executable failed"
236
	mv "${ED}"/usr/bin/emacs-${EMACS_SUFFIX} "${ED}"/usr/bin/${EMACS_SUFFIX} \
237
		|| die "moving emacs executable failed"
238

  
239
	# move man pages to the correct place
240
	local m
241
	mv "${ED}"/usr/share/man/man1/{emacs,${EMACS_SUFFIX}}.1 \
242
		|| die "moving emacs man page failed"
243
	for m in b2m ctags ebrowse emacsclient etags grep-changelog rcs-checkin; do
244
		mv "${ED}"/usr/share/man/man1/${m}{,-${EMACS_SUFFIX}}.1 \
245
			|| die "moving ${m} man page failed"
131 246
	done
132 247

  
133
	# move man page
134
	mv "${D}"/usr/share/man/man1/emacs{,-${SLOT}}.1 || die
248
	# move info dir to avoid collisions with the dir file generated by portage
249
	mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
250
		|| die "moving info dir failed"
251
	touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
252
	docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
253

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

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

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

  
265
	local cdir
266
	if use source; then
267
		cdir="/usr/share/emacs/${FULL_VERSION}/src"
268
		insinto "${cdir}"
269
		# This is not meant to install all the source -- just the
270
		# C source you might find via find-function
271
		doins src/*.{c,h,m}
272
		doins -r src/{m,s}
273
		rm "${ED}"/usr/share/emacs/${FULL_VERSION}/src/Makefile.c
274
		rm "${ED}"/usr/share/emacs/${FULL_VERSION}/src/{m,s}/README
275
	elif has installsources ${FEATURES}; then
276
		cdir="/usr/src/debug/${CATEGORY}/${PF}/${S#"${WORKDIR}/"}/src"
277
	fi
135 278

  
136
	# move Info files
137
	dodir /usr/share/info
138
	mv "${D}"${basedir}/info "${D}"/usr/share/info/emacs-${SLOT} || die
139
	dosym ../../info/emacs-${SLOT} "${basedir}"/info
140
	docompress -x /usr/share/info
141

  
142
	# move Info dir to avoid collisions with the dir file generated by portage
143
	mv "${D}"/usr/share/info/emacs-${SLOT}/dir{,.orig} || die
144
	touch "${D}"/usr/share/info/emacs-${SLOT}/.keepinfodir
145

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

  
299
	dodoc README BUGS
300

  
301
	if use aqua; then
302
		dodir /Applications/Gentoo
303
		rm -rf "${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app
304
		mv nextstep/Emacs.app \
305
			"${ED}"/Applications/Gentoo/${EMACS_SUFFIX^}.app || die
306
	fi
149 307

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

  
153 327
pkg_preinst() {
154 328
	# move Info dir file to correct name
155
	if [[ -d "${D}"/usr/share/info ]]; then
156
		mv "${D}"/usr/share/info/emacs-${SLOT}/dir{.orig,} || die
329
	if [[ -d ${ED}/usr/share/info ]]; then
330
		mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
157 331
	fi
158 332
}
159 333

  
160 334
pkg_postinst() {
161
	eselect emacs update ifunset
335
	elisp-site-regen
336
	readme.gentoo_print_elog
337

  
338
	if use livecd; then
339
		# force an update of the emacs symlink for the livecd/dvd,
340
		# because some microemacs packages set it with USE=livecd
341
		eselect emacs update
342
	elif [[ $(readlink "${EROOT}"/usr/bin/emacs) = ${EMACS_SUFFIX} ]]; then
343
		# refresh symlinks in case any installed files have changed
344
		eselect emacs set ${EMACS_SUFFIX}
345
	else
346
		eselect emacs update ifunset
347
	fi
162 348
}
163 349

  
164 350
pkg_postrm() {
351
	elisp-site-regen
165 352
	eselect emacs update ifunset
166 353
}
Thank you!