1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 EGIT_REPO_URI
="git://git.sv.gnu.org/emacs.git"
10 WANT_AUTOMAKE
="latest"
12 inherit autotools git elisp-common eutils flag-o-matic
14 DESCRIPTION
="The extensible, customizable, self-documenting real-time display editor"
15 HOMEPAGE
="http://www.gnu.org/software/emacs/"
18 LICENSE
="GPL-3 FDL-1.2 BSD"
20 KEYWORDS
="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
22 IUSE
="alsa dbus gif gpm gtk gzip-el hesiod jpeg kerberos m17n-lib motif png spell sound source svg tiff toolkit-scroll-bars X Xaw3d xft xpm"
25 RDEPEND
="sys-libs/ncurses
26 >=app-admin/eselect-emacs-1.2
28 hesiod? ( net-dns/hesiod )
29 kerberos? ( virtual/krb5 )
30 spell? ( || ( app-text/ispell app-text/aspell ) )
31 alsa? ( media-libs/alsa-lib )
33 dbus? ( sys-apps/dbus )
38 x11-misc/emacs-desktop
39 gif? ( media-libs/giflib )
40 jpeg? ( media-libs/jpeg )
41 png? ( media-libs/libpng )
42 svg? ( gnome-base/librsvg:2 )
43 tiff? ( media-libs/tiff )
44 xpm? ( x11-libs/libXpm )
50 >=dev-libs/libotf-0.9.4
51 >=dev-libs/m17n-lib-1.5.1
54 gtk? ( x11-libs/gtk+:2 )
56 Xaw3d? ( x11-libs/Xaw3d )
58 motif? ( virtual/motif )
66 gzip-el? ( app-arch/gzip )"
68 S
="${WORKDIR}/${ECVS_LOCALNAME}"
70 EMACS_SUFFIX
="emacs-${SLOT}"
76 # FULL_VERSION keeps the full version number, which is needed in
77 # order to determine some path information correctly for copy/move
79 FULL_VERSION
=$
(grep 'defconst[ ]*emacs-version' lisp
/version.el \
80 |
sed -e 's/^[^"]*"\([^"]*\)".*$/\1/')
81 [[ -z "${FULL_VERSION}" ]] && die
"Cannot determine current Emacs version"
83 einfo
"Emacs CVS branch: ${ECVS_BRANCH}"
84 einfo
"Emacs version number: ${FULL_VERSION}"
85 [[ "${FULL_VERSION%.*}" == ${PV%.*} ]] \
86 || die
"Upstream version number changed to ${FULL_VERSION}"
89 epatch
"${FILESDIR}/${PN}-freebsd-sparc.patch"
91 sed -i -e "s:/usr/lib/crtbegin.o:$(`tc-getCC` -print-file-name=crtbegin.o):g" \
92 -e "s:/usr/lib/crtend.o:$(`tc-getCC` -print-file-name=crtend.o):g" \
93 "${S}"/src
/s
/freebsd.h || die
"unable to sed freebsd.h settings"
96 # ALSA is detected even if not requested by its USE flag.
97 # Suppress it by supplying pkg-config with a wrong library name.
98 sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.
in \
99 || die
"unable to sed configure.in"
101 if ! use gzip-el
; then
102 # Emacs' build system automatically detects the gzip binary and
103 # compresses el files. We don't want that so confuse it with a
105 sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.
in \
106 || die
"unable to sed configure.in"
113 export SANDBOX_ON
=0 # for the unbelievers, see Bug #131505
117 ALLOWED_FLAGS
="${ALLOWED_FLAGS} -DSYSTEM_PURESIZE_EXTRA -DSITELOAD_PURESIZE_EXTRA"
119 replace-flags
-O[3-9] -O2
120 replace-flags
-Os -O2
124 if use alsa
&& ! use sound
; then
126 einfo
"Although sound USE flag is disabled you chose to have alsa,"
127 einfo
"so sound is switched on anyway."
129 myconf
="${myconf} --with-sound"
131 myconf
="${myconf} $(use_with sound)"
135 myconf
="${myconf} --with-x"
136 myconf
="${myconf} $(use_with toolkit-scroll-bars)"
137 myconf
="${myconf} $(use_with gif) $(use_with jpeg)"
138 myconf
="${myconf} $(use_with png) $(use_with svg rsvg)"
139 myconf
="${myconf} $(use_with tiff) $(use_with xpm)"
141 myconf
="${myconf} $(use_enable xft font-backend)"
142 myconf
="${myconf} $(use_with xft freetype) $(use_with xft)"
145 myconf
="${myconf} $(use_with m17n-lib libotf)"
146 myconf
="${myconf} $(use_with m17n-lib m17n-flt)"
148 myconf
="${myconf} --without-libotf --without-m17n-flt"
149 use m17n-lib
&& einfo \
150 "USE flag \"m17n-lib\" has no effect because xft is not set."
153 # GTK+ is the default toolkit if USE=gtk is chosen with other
154 # possibilities. Emacs upstream thinks this should be standard
155 # policy on all distributions
157 einfo
"Configuring to build with GIMP Toolkit (GTK+)"
158 myconf
="${myconf} --with-x-toolkit=gtk"
160 einfo
"Configuring to build with Xaw3d (Athena) toolkit"
161 myconf
="${myconf} --with-x-toolkit=athena"
163 einfo
"Configuring to build with Motif toolkit"
164 myconf
="${myconf} --with-x-toolkit=motif"
166 einfo
"Configuring to build with no toolkit"
167 myconf
="${myconf} --with-x-toolkit=no"
170 myconf
="${myconf} --without-x"
173 myconf
="${myconf} $(use_with hesiod)"
174 myconf
="${myconf} $(use_with kerberos) $(use_with kerberos kerberos5)"
175 myconf
="${myconf} $(use_with gpm) $(use_with dbus)"
178 --program-suffix=-${EMACS_SUFFIX} \
179 --infodir=/usr
/share
/info
/${EMACS_SUFFIX} \
181 ${myconf} || die
"econf emacs failed"
183 emake CC
="$(tc-getCC)" bootstrap || die
"make bootstrap failed"
189 emake
install DESTDIR
="${D}" || die
"make install failed"
191 rm "${D}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
192 || die "removing duplicate emacs executable failed
"
193 mv "${D}"/usr/bin/emacs-${EMACS_SUFFIX} "${D}"/usr/bin/${EMACS_SUFFIX} \
194 || die
"moving Emacs executable failed"
196 # move info documentation to the correct place
197 einfo
"Fixing info documentation ..."
198 for i
in "${D}"/usr
/share
/info
/${EMACS_SUFFIX}/*; do
199 mv "${i}" "${i}.info" || die
"mv info failed"
202 # move man pages to the correct place
203 einfo
"Fixing manpages ..."
204 for m
in "${D}"/usr
/share
/man
/man
1/* ; do
205 mv "${m}" "${m%.1}-${EMACS_SUFFIX}.1" || die
"mv man failed"
208 # avoid collision between slots, see bug #169033 e.g.
209 rm "${D}"/usr
/share
/emacs
/site-lisp
/subdirs.el
210 rm -rf "${D}"/usr
/share
/{applications
,icons
}
211 rm "${D}"/var
/lib
/games
/emacs
/{snake
,tetris
}-scores
212 keepdir
/usr
/share
/emacs
/site-lisp
213 keepdir
/var
/lib
/games
/emacs
216 insinto
/usr
/share
/emacs
/${FULL_VERSION}/src
217 # This is not meant to install all the source -- just the
218 # C source you might find via find-function
220 sed 's/^X//' >10${PN}-${SLOT}-gentoo.el
<<-EOF
222 ;;; ${PN}-${SLOT} site-lisp configuration
224 (if (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
225 X (setq find-function-C-source-directory
226 X "/usr/share/emacs/${FULL_VERSION}/src"))
228 elisp-site-file-install
10${PN}-${SLOT}-gentoo.el
231 dodoc README BUGS || die
"dodoc failed"
234 emacs-infodir-rebuild
() {
235 # Depending on the Portage version, the Info dir file is compressed
236 # or removed. It is only rebuilt by Portage if our directory is in
237 # INFOPATH, which is not guaranteed. So we rebuild it ourselves.
239 local infodir
=/usr
/share
/info
/${EMACS_SUFFIX} f
240 einfo
"Regenerating Info directory index in ${infodir} ..."
241 rm -f "${ROOT}"${infodir}/dir{,.*}
242 for f in "${ROOT}"${infodir}/*.info*; do
243 [[ ${f##*/} == *[0-9].info* ]] \
244 || install-info --info-dir="${ROOT}"${infodir} "${f}" &>/dev/null
246 rmdir "${ROOT}"${infodir} 2>/dev/null # remove dir if it is empty
251 [[ -f "${ROOT}"/usr/share/emacs/site-lisp/subdirs.el ]] \
252 || cp "${ROOT}"/usr/share/emacs{/${FULL_VERSION},}/site-lisp
/subdirs.el
255 for f
in "${ROOT}"/var
/lib
/games
/emacs
/{snake
,tetris
}-scores; do
256 [[ -e "${f}" ]] ||
touch "${f}"
260 emacs-infodir-rebuild
261 eselect emacs update ifunset
264 elog
"You need to install some fonts for Emacs. Under monolithic"
265 elog
"XFree86/Xorg you typically had such fonts installed by default."
266 elog
"With modular Xorg, you will have to perform this step yourself."
267 elog
"Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
268 elog
"machine would satisfy basic Emacs requirements under X11."
272 elog
"You can set the version to be started by /usr/bin/emacs through"
273 elog
"the Emacs eselect module, which also redirects man and info pages."
274 elog
"You can therefore test emacs-cvs along with the stable release."
275 elog
"\"man emacs.eselect\" for details."
280 emacs-infodir-rebuild
281 eselect emacs update ifunset