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:5
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:1.2 )
42 svg? ( gnome-base/librsvg:2 )
43 tiff? ( media-libs/tiff )
44 xpm? ( x11-libs/libXpm )
46 media-libs/fontconfig:1.0
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 )
57 !Xaw3d? ( motif? ( virtual/motif ) )
64 gzip-el? ( app-arch/gzip )"
66 S
="${WORKDIR}/${ECVS_LOCALNAME}"
68 EMACS_SUFFIX
="emacs-${SLOT}"
74 # FULL_VERSION keeps the full version number, which is needed in
75 # order to determine some path information correctly for copy/move
77 FULL_VERSION
=$
(grep 'defconst[ ]*emacs-version' lisp
/version.el \
78 |
sed -e 's/^[^"]*"\([^"]*\)".*$/\1/')
79 [[ -z "${FULL_VERSION}" ]] && die
"Cannot determine current Emacs version"
81 einfo
"Emacs CVS branch: ${ECVS_BRANCH}"
82 einfo
"Emacs version number: ${FULL_VERSION}"
83 [[ "${FULL_VERSION%.*}" == ${PV%.*} ]] \
84 || die
"Upstream version number changed to ${FULL_VERSION}"
87 epatch
"${FILESDIR}/${PN}-freebsd-sparc.patch"
89 sed -i -e "s:/usr/lib/crtbegin.o:$(`tc-getCC` -print-file-name=crtbegin.o):g" \
90 -e "s:/usr/lib/crtend.o:$(`tc-getCC` -print-file-name=crtend.o):g" \
91 "${S}"/src
/s
/freebsd.h || die
"unable to sed freebsd.h settings"
94 # ALSA is detected even if not requested by its USE flag.
95 # Suppress it by supplying pkg-config with a wrong library name.
96 sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.
in \
97 || die
"unable to sed configure.in"
99 if ! use gzip-el
; then
100 # Emacs' build system automatically detects the gzip binary and
101 # compresses el files. We don't want that so confuse it with a
103 sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.
in \
104 || die
"unable to sed configure.in"
111 export SANDBOX_ON
=0 # for the unbelievers, see Bug #131505
115 ALLOWED_FLAGS
="${ALLOWED_FLAGS} -DSYSTEM_PURESIZE_EXTRA -DSITELOAD_PURESIZE_EXTRA"
117 replace-flags
-O[3-9] -O2
118 replace-flags
-Os -O2
122 if use alsa
&& ! use sound
; then
124 einfo
"Although sound USE flag is disabled you chose to have alsa,"
125 einfo
"so sound is switched on anyway."
127 myconf
="${myconf} --with-sound"
129 myconf
="${myconf} $(use_with sound)"
133 myconf
="${myconf} --with-x"
134 myconf
="${myconf} $(use_with toolkit-scroll-bars)"
135 myconf
="${myconf} $(use_with gif) $(use_with jpeg)"
136 myconf
="${myconf} $(use_with png) $(use_with svg rsvg)"
137 myconf
="${myconf} $(use_with tiff) $(use_with xpm)"
139 myconf
="${myconf} $(use_enable xft font-backend)"
140 myconf
="${myconf} $(use_with xft freetype) $(use_with xft)"
143 myconf
="${myconf} $(use_with m17n-lib libotf)"
144 myconf
="${myconf} $(use_with m17n-lib m17n-flt)"
146 myconf
="${myconf} --without-libotf --without-m17n-flt"
147 use m17n-lib
&& einfo \
148 "USE flag \"m17n-lib\" has no effect because xft is not set."
151 # GTK+ is the default toolkit if USE=gtk is chosen with other
152 # possibilities. Emacs upstream thinks this should be standard
153 # policy on all distributions
155 einfo
"Configuring to build with GIMP Toolkit (GTK+)"
156 myconf
="${myconf} --with-x-toolkit=gtk"
158 einfo
"Configuring to build with Xaw3d (Athena) toolkit"
159 myconf
="${myconf} --with-x-toolkit=athena"
161 einfo
"Configuring to build with Motif toolkit"
162 myconf
="${myconf} --with-x-toolkit=motif"
164 einfo
"Configuring to build with no toolkit"
165 myconf
="${myconf} --with-x-toolkit=no"
168 myconf
="${myconf} --without-x"
171 myconf
="${myconf} $(use_with hesiod)"
172 myconf
="${myconf} $(use_with kerberos) $(use_with kerberos kerberos5)"
173 myconf
="${myconf} $(use_with gpm) $(use_with dbus)"
176 --program-suffix=-${EMACS_SUFFIX} \
177 --infodir=/usr
/share
/info
/${EMACS_SUFFIX} \
179 ${myconf} || die
"econf emacs failed"
181 emake CC
="$(tc-getCC)" bootstrap || die
"make bootstrap failed"
187 emake
install DESTDIR
="${D}" || die
"make install failed"
189 rm "${D}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
190 || die "removing duplicate emacs executable failed
"
191 mv "${D}"/usr/bin/emacs-${EMACS_SUFFIX} "${D}"/usr/bin/${EMACS_SUFFIX} \
192 || die
"moving Emacs executable failed"
194 # move info documentation to the correct place
195 einfo
"Fixing info documentation ..."
196 for i
in "${D}"/usr
/share
/info
/${EMACS_SUFFIX}/*; do
197 mv "${i}" "${i}.info" || die
"mv info failed"
200 # move man pages to the correct place
201 einfo
"Fixing manpages ..."
202 for m
in "${D}"/usr
/share
/man
/man
1/* ; do
203 mv "${m}" "${m%.1}-${EMACS_SUFFIX}.1" || die
"mv man failed"
206 # avoid collision between slots, see bug #169033 e.g.
207 rm "${D}"/usr
/share
/emacs
/site-lisp
/subdirs.el
208 rm -rf "${D}"/usr
/share
/{applications
,icons
}
209 rm "${D}"/var
/lib
/games
/emacs
/{snake
,tetris
}-scores
210 keepdir
/usr
/share
/emacs
/site-lisp
211 keepdir
/var
/lib
/games
/emacs
214 insinto
/usr
/share
/emacs
/${FULL_VERSION}/src
215 # This is not meant to install all the source -- just the
216 # C source you might find via find-function
218 sed 's/^X//' >10${PN}-${SLOT}-gentoo.el
<<-EOF
220 ;;; ${PN}-${SLOT} site-lisp configuration
222 (if (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
223 X (setq find-function-C-source-directory
224 X "/usr/share/emacs/${FULL_VERSION}/src"))
226 elisp-site-file-install
10${PN}-${SLOT}-gentoo.el
229 dodoc README BUGS || die
"dodoc failed"
232 emacs-infodir-rebuild
() {
233 # Depending on the Portage version, the Info dir file is compressed
234 # or removed. It is only rebuilt by Portage if our directory is in
235 # INFOPATH, which is not guaranteed. So we rebuild it ourselves.
237 local infodir
=/usr
/share
/info
/${EMACS_SUFFIX} f
238 einfo
"Regenerating Info directory index in ${infodir} ..."
239 rm -f "${ROOT}"${infodir}/dir{,.*}
240 for f in "${ROOT}"${infodir}/*.info*; do
241 [[ ${f##*/} == *[0-9].info* ]] \
242 || install-info --info-dir="${ROOT}"${infodir} "${f}" &>/dev/null
244 rmdir "${ROOT}"${infodir} 2>/dev/null # remove dir if it is empty
249 [[ -f "${ROOT}"/usr/share/emacs/site-lisp/subdirs.el ]] \
250 || cp "${ROOT}"/usr/share/emacs{/${FULL_VERSION},}/site-lisp
/subdirs.el
253 for f
in "${ROOT}"/var
/lib
/games
/emacs
/{snake
,tetris
}-scores; do
254 [[ -e "${f}" ]] ||
touch "${f}"
258 emacs-infodir-rebuild
259 eselect emacs update ifunset
262 elog
"You need to install some fonts for Emacs. Under monolithic"
263 elog
"XFree86/Xorg you typically had such fonts installed by default."
264 elog
"With modular Xorg, you will have to perform this step yourself."
265 elog
"Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
266 elog
"machine would satisfy basic Emacs requirements under X11."
270 elog
"You can set the version to be started by /usr/bin/emacs through"
271 elog
"the Emacs eselect module, which also redirects man and info pages."
272 elog
"You can therefore test emacs-git along with the stable release."
273 elog
"\"man emacs.eselect\" for details."
278 emacs-infodir-rebuild
279 eselect emacs update ifunset