app-editors/emacs-git: minor feedback changes, tune dep blocks a
[gentoo-soor-overlay.git] / app-editors / emacs-git / emacs-git-23.0.9999.ebuild
blobbe3268a5ebfe2e59509161dccdebd3b5cfa6dbff
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
5 EAPI="1"
7 EGIT_REPO_URI="git://git.sv.gnu.org/emacs.git"
9 WANT_AUTOCONF="latest"
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/"
16 SRC_URI=""
18 LICENSE="GPL-3 FDL-1.2 BSD"
19 SLOT="23"
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"
23 RESTRICT="strip"
25 RDEPEND="sys-libs/ncurses:5
26 >=app-admin/eselect-emacs-1.2
27 net-libs/liblockfile
28 hesiod? ( net-dns/hesiod )
29 kerberos? ( virtual/krb5 )
30 spell? ( || ( app-text/ispell app-text/aspell ) )
31 alsa? ( media-libs/alsa-lib )
32 gpm? ( sys-libs/gpm )
33 dbus? ( sys-apps/dbus )
34 X? (
35 x11-libs/libXmu
36 x11-libs/libXt
37 x11-misc/xbitmaps
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 )
45 xft? (
46 media-libs/fontconfig:1.0
47 media-libs/freetype:2
48 virtual/xft
49 m17n-lib? (
50 >=dev-libs/libotf-0.9.4
51 >=dev-libs/m17n-lib-1.5.1
54 gtk? ( x11-libs/gtk+:2 )
55 !gtk? (
56 Xaw3d? ( x11-libs/Xaw3d )
57 !Xaw3d? ( motif? ( virtual/motif ) )
61 DEPEND="${RDEPEND}
62 dev-util/git
63 dev-util/pkgconfig
64 gzip-el? ( app-arch/gzip )"
66 S="${WORKDIR}/${ECVS_LOCALNAME}"
68 EMACS_SUFFIX="emacs-${SLOT}"
70 src_unpack() {
71 git_src_unpack
73 cd "${S}"
74 # FULL_VERSION keeps the full version number, which is needed in
75 # order to determine some path information correctly for copy/move
76 # operations later on
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"
80 echo
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}"
85 echo
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"
93 if ! use alsa; then
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
102 # wrong binary name
103 sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.in \
104 || die "unable to sed configure.in"
107 eautoreconf
110 src_compile() {
111 export SANDBOX_ON=0 # for the unbelievers, see Bug #131505
113 unset ALLOWED_FLAGS
114 setup-allowed-flags
115 ALLOWED_FLAGS="${ALLOWED_FLAGS} -DSYSTEM_PURESIZE_EXTRA -DSITELOAD_PURESIZE_EXTRA"
116 strip-flags
117 replace-flags -O[3-9] -O2
118 replace-flags -Os -O2
120 local myconf
122 if use alsa && ! use sound; then
123 echo
124 einfo "Although sound USE flag is disabled you chose to have alsa,"
125 einfo "so sound is switched on anyway."
126 echo
127 myconf="${myconf} --with-sound"
128 else
129 myconf="${myconf} $(use_with sound)"
132 if use X; then
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)"
142 if use xft; then
143 myconf="${myconf} $(use_with m17n-lib libotf)"
144 myconf="${myconf} $(use_with m17n-lib m17n-flt)"
145 else
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
154 if use gtk; then
155 einfo "Configuring to build with GIMP Toolkit (GTK+)"
156 myconf="${myconf} --with-x-toolkit=gtk"
157 elif use Xaw3d; then
158 einfo "Configuring to build with Xaw3d (Athena) toolkit"
159 myconf="${myconf} --with-x-toolkit=athena"
160 elif use motif; then
161 einfo "Configuring to build with Motif toolkit"
162 myconf="${myconf} --with-x-toolkit=motif"
163 else
164 einfo "Configuring to build with no toolkit"
165 myconf="${myconf} --with-x-toolkit=no"
167 else
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)"
175 econf \
176 --program-suffix=-${EMACS_SUFFIX} \
177 --infodir=/usr/share/info/${EMACS_SUFFIX} \
178 --without-carbon \
179 ${myconf} || die "econf emacs failed"
181 emake CC="$(tc-getCC)" bootstrap || die "make bootstrap failed"
184 src_install () {
185 local i m
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"
198 done
200 # move man pages to the correct place
201 einfo "Fixing manpages ..."
202 for m in "${D}"/usr/share/man/man1/* ; do
203 mv "${m}" "${m%.1}-${EMACS_SUFFIX}.1" || die "mv man failed"
204 done
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
213 if use source; then
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
217 doins src/*.[ch]
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
243 done
244 rmdir "${ROOT}"${infodir} 2>/dev/null # remove dir if it is empty
245 echo
248 pkg_postinst() {
249 [[ -f "${ROOT}"/usr/share/emacs/site-lisp/subdirs.el ]] \
250 || cp "${ROOT}"/usr/share/emacs{/${FULL_VERSION},}/site-lisp/subdirs.el
252 local f
253 for f in "${ROOT}"/var/lib/games/emacs/{snake,tetris}-scores; do
254 [[ -e "${f}" ]] || touch "${f}"
255 done
257 elisp-site-regen
258 emacs-infodir-rebuild
259 eselect emacs update ifunset
261 if use X; then
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."
269 echo
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."
276 pkg_postrm() {
277 elisp-site-regen
278 emacs-infodir-rebuild
279 eselect emacs update ifunset