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

/usr/portage/app-editors/emacs/emacs-23.4-r18.ebuild 2019-10-11 18:40: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 multilib readme.gentoo-r1
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=">=app-eselect/eselect-emacs-1.16
20
	sys-libs/ncurses:0=
21
	amd64? (
22
		abi_x86_x32? ( >=sys-libs/ncurses-5.9-r3:0=[abi_x86_x32(-)?] )
23
		!abi_x86_x32? ( >=sys-libs/ncurses-5.9-r3:0=[abi_x86_32(-)] )
24
	)
25
	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"
26 13

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

  
34
PATCHES="../${P}-linux22x-elf-glibc21.diff ../patch"
77
DEPEND="${RDEPEND}
78
	X? ( x11-base/xorg-proto )"
79

  
80
BDEPEND="alsa? ( virtual/pkgconfig )
81
	dbus? ( virtual/pkgconfig )
82
	X? ( virtual/pkgconfig )
83
	gzip-el? ( app-arch/gzip )"
84

  
85
RDEPEND="${RDEPEND}
86
	!<app-editors/emacs-vcs-${PV}"
87

  
88
EMACS_SUFFIX="${PN/emacs/emacs-${SLOT}}"
89
SITEFILE="20${PN}-${SLOT}-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}"
35 95

  
36 96
src_prepare() {
37
	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
38 116

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

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

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

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

  
75
	# -O3 and -finline-functions cause segmentation faults at run time.
76
	# -Wno-implicit will quieten GCC 5; feel free to submit a patch
77
	# adding all those missing prototypes.
78 123
	strip-flags
79
	filter-flags -finline-functions -fpie
80
	append-flags -Wno-implicit
81
	append-ldflags $(test-flags -no-pie)	#639562
82
	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 sh; then
129
		replace-flags "-O[1-9]" -O0		#262359
130
	elif use ia64; then
131
		replace-flags "-O[2-9]" -O1		#325373
132
	else
133
		replace-flags "-O[3-9]" -O2
134
	fi
135

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

  
139
	local myconf
140

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

  
149
	if use X; then
150
		myconf+=" --with-x --without-ns"
151
		myconf+=" $(use_with gconf)"
152
		myconf+=" $(use_with toolkit-scroll-bars)"
153
		myconf+=" $(use_with gif)"
154
		myconf+=" $(use_with jpeg)"
155
		myconf+=" $(use_with png)"
156
		myconf+=" $(use_with svg rsvg)"
157
		myconf+=" $(use_with tiff)"
158
		myconf+=" $(use_with xpm)"
159

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

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

  
204
	# According to configure, this option is only used for GNU/Linux
205
	# (x86_64 and s390). For Gentoo Prefix we have to explicitly spell
206
	# out the location because $(get_libdir) does not necessarily return
207
	# something that matches the host OS's libdir naming (e.g. RHEL).
208
	local crtdir=$($(tc-getCC) -print-file-name=crt1.o)
209
	crtdir=${crtdir%/*}
210

  
211
	econf \
212
		--program-suffix="-${EMACS_SUFFIX}" \
213
		--infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
214
		--localstatedir="${EPREFIX}"/var \
215
		--enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
216
		--with-crt-dir="${crtdir}" \
217
		--with-gameuser=":gamestat" \
218
		--without-hesiod \
219
		$(use_with kerberos) $(use_with kerberos kerberos5) \
220
		$(use_with gpm) \
221
		$(use_with dbus) \
222
		${myconf}
83 223
}
84 224

  
85 225
src_compile() {
86
	addpredict /var/lib/emacs/lock		#nowarn
87
	emake --jobs=1 \
88
		CC="$(tc-getCC)" CFLAGS="${CFLAGS} -Demacs" \
89
		LD="$(tc-getCC) -nostdlib" LDFLAGS="${LDFLAGS}"
90
}
91

  
92
src_install() {
93
	local basedir="/usr/share/emacs/${PV}" i
94

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

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

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

  
111
	# move executables to the correct place
112
	mv "${D}"/usr/bin/emacs{,-${SLOT}} || die
113
	for i in etags ctags emacsclient; do
114
		mv "${D}"/usr/bin/${i}{,-emacs-${SLOT}} || die
115
		rm "${D}"${basedir}/etc/${i} || die
116
	done
226
	# Disable sandbox when dumping. For the unbelievers, see bug #131505
227
	emake CC="$(tc-getCC)" \
228
		AR="$(tc-getAR) cq" \
229
		RANLIB="$(tc-getRANLIB)" \
230
		RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
231
}
117 232

  
118
	dodir /usr/libexec/emacs/${PV}
119
	for i in wakeup digest-doc sorted-doc movemail cvtmail fakemail \
120
		yow env server
121
	do
122
		mv "${D}"${basedir}/etc/${i} "${D}"/usr/libexec/emacs/${PV}/${i} || die
123
		dosym ../../../../libexec/emacs/${PV}/${i} ${basedir}/etc/${i}
124
	done
125
	for i in test-distrib make-docfile; do
126
		rm "${D}"${basedir}/etc/${i} || die
233
src_install () {
234
	emake DESTDIR="${D}" install
235

  
236
	rm "${ED}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
237
		|| die "removing duplicate emacs executable failed"
238
	mv "${ED}"/usr/bin/emacs-${EMACS_SUFFIX} "${ED}"/usr/bin/${EMACS_SUFFIX} \
239
		|| die "moving emacs executable failed"
240

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

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

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

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

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

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

  
132
	# move Info files
133
	dodir /usr/share/info
134
	mv "${D}"${basedir}/info "${D}"/usr/share/info/emacs-${SLOT} || die
135
	dosym ../../info/emacs-${SLOT} "${basedir}"/info
136
	docompress -x /usr/share/info
137

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

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

  
301
	dodoc README BUGS
302

  
303
	if use aqua; then
304
		dodir /Applications/Gentoo
305
		rm -rf "${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app
306
		mv nextstep/Emacs.app \
307
			"${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app || die
308
	fi
145 309

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

  
149 329
pkg_preinst() {
150 330
	# move Info dir file to correct name
151
	if [[ -d "${D}"/usr/share/info ]]; then
152
		mv "${D}"/usr/share/info/emacs-${SLOT}/dir{.orig,} || die
331
	local infodir=/usr/share/info/${EMACS_SUFFIX} f
332
	if [[ -f ${ED}${infodir}/dir.orig ]]; then
333
		mv "${ED}"${infodir}/dir{.orig,} || die "moving info dir failed"
334
	elif [[ -d "${ED}"${infodir} ]]; then
335
		# this should not happen in EAPI 4
336
		ewarn "Regenerating Info directory index in ${infodir} ..."
337
		rm -f "${ED}"${infodir}/dir{,.*}
338
		for f in "${ED}"${infodir}/*; do
339
			if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
340
				install-info --info-dir="${ED}"${infodir} "${f}" \
341
					|| die "install-info failed"
342
			fi
343
		done
153 344
	fi
154 345
}
155 346

  
156 347
pkg_postinst() {
157
	eselect emacs update ifunset
348
	elisp-site-regen
349
	readme.gentoo_print_elog
350

  
351
	if use livecd; then
352
		# force an update of the emacs symlink for the livecd/dvd,
353
		# because some microemacs packages set it with USE=livecd
354
		eselect emacs update
355
	elif [[ $(readlink "${EROOT}"/usr/bin/emacs) = ${EMACS_SUFFIX} ]]; then
356
		# refresh symlinks in case any installed files have changed
357
		eselect emacs set ${EMACS_SUFFIX}
358
	else
359
		eselect emacs update ifunset
360
	fi
158 361
}
159 362

  
160 363
pkg_postrm() {
364
	elisp-site-regen
161 365
	eselect emacs update ifunset
162 366
}
Thank you!