| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs-vcs/emacs-vcs-24.0.97.ebuild,v 1.4 2012/05/24 21:12:55 ulm Exp $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
inherit autotools elisp-common eutils flag-o-matic multilib
|
| 8 |
|
| 9 |
if [[ ${PV##*.} = 9999 ]]; then
|
| 10 |
EBZR_PROJECT="emacs"
|
| 11 |
EBZR_BRANCH="emacs-24"
|
| 12 |
EBZR_REPO_URI="bzr://bzr.savannah.gnu.org/emacs/${EBZR_BRANCH}/"
|
| 13 |
# "Nosmart" is much faster for initial branching.
|
| 14 |
EBZR_INITIAL_URI="nosmart+${EBZR_REPO_URI}"
|
| 15 |
inherit bzr
|
| 16 |
SRC_URI=""
|
| 17 |
else
|
| 18 |
SRC_URI="mirror://gentoo/emacs-${PV}.tar.gz
|
| 19 |
mirror://gnu-alpha/emacs/pretest/emacs-${PV}.tar.gz"
|
| 20 |
# FULL_VERSION keeps the full version number, which is needed in
|
| 21 |
# order to determine some path information correctly for copy/move
|
| 22 |
# operations later on
|
| 23 |
FULL_VERSION="${PV%%_*}"
|
| 24 |
S="${WORKDIR}/emacs-${FULL_VERSION}"
|
| 25 |
fi
|
| 26 |
|
| 27 |
DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
|
| 28 |
HOMEPAGE="http://www.gnu.org/software/emacs/"
|
| 29 |
|
| 30 |
LICENSE="GPL-3 FDL-1.3 BSD as-is MIT W3C unicode PSF-2"
|
| 31 |
SLOT="24"
|
| 32 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
|
| 33 |
IUSE="alsa aqua athena dbus gconf gif gnutls gpm gsettings gtk gtk3 gzip-el hesiod imagemagick jpeg kerberos libxml2 m17n-lib motif png selinux sound source svg tiff toolkit-scroll-bars wide-int X Xaw3d xft +xpm"
|
| 34 |
REQUIRED_USE="aqua? ( !X )"
|
| 35 |
|
| 36 |
RDEPEND="sys-libs/ncurses
|
| 37 |
>=app-admin/eselect-emacs-1.2
|
| 38 |
net-libs/liblockfile
|
| 39 |
hesiod? ( net-dns/hesiod )
|
| 40 |
kerberos? ( virtual/krb5 )
|
| 41 |
alsa? ( media-libs/alsa-lib )
|
| 42 |
gpm? ( sys-libs/gpm )
|
| 43 |
dbus? ( sys-apps/dbus )
|
| 44 |
gnutls? ( net-libs/gnutls )
|
| 45 |
libxml2? ( >=dev-libs/libxml2-2.2.0 )
|
| 46 |
selinux? ( sys-libs/libselinux )
|
| 47 |
X? (
|
| 48 |
x11-libs/libXmu
|
| 49 |
x11-libs/libXt
|
| 50 |
x11-misc/xbitmaps
|
| 51 |
gconf? ( >=gnome-base/gconf-2.26.2 )
|
| 52 |
gsettings? ( >=dev-libs/glib-2.28.6 )
|
| 53 |
gif? ( media-libs/giflib )
|
| 54 |
jpeg? ( virtual/jpeg )
|
| 55 |
png? ( >=media-libs/libpng-1.4:0 )
|
| 56 |
svg? ( >=gnome-base/librsvg-2.0 )
|
| 57 |
tiff? ( media-libs/tiff )
|
| 58 |
xpm? ( x11-libs/libXpm )
|
| 59 |
imagemagick? ( >=media-gfx/imagemagick-6.6.2 )
|
| 60 |
xft? (
|
| 61 |
media-libs/fontconfig
|
| 62 |
media-libs/freetype
|
| 63 |
x11-libs/libXft
|
| 64 |
m17n-lib? (
|
| 65 |
>=dev-libs/libotf-0.9.4
|
| 66 |
>=dev-libs/m17n-lib-1.5.1
|
| 67 |
)
|
| 68 |
)
|
| 69 |
gtk? (
|
| 70 |
gtk3? ( x11-libs/gtk+:3 )
|
| 71 |
!gtk3? ( x11-libs/gtk+:2 )
|
| 72 |
)
|
| 73 |
!gtk? (
|
| 74 |
Xaw3d? ( x11-libs/libXaw3d )
|
| 75 |
!Xaw3d? (
|
| 76 |
athena? ( x11-libs/libXaw )
|
| 77 |
!athena? ( motif? ( >=x11-libs/openmotif-2.3:0 ) )
|
| 78 |
)
|
| 79 |
)
|
| 80 |
)"
|
| 81 |
|
| 82 |
DEPEND="${RDEPEND}
|
| 83 |
alsa? ( virtual/pkgconfig )
|
| 84 |
dbus? ( virtual/pkgconfig )
|
| 85 |
gnutls? ( virtual/pkgconfig )
|
| 86 |
libxml2? ( virtual/pkgconfig )
|
| 87 |
X? ( virtual/pkgconfig )
|
| 88 |
gzip-el? ( app-arch/gzip )"
|
| 89 |
|
| 90 |
RDEPEND="${RDEPEND}
|
| 91 |
>=app-emacs/emacs-common-gentoo-1.3[X?]"
|
| 92 |
|
| 93 |
EMACS_SUFFIX="emacs-${SLOT}"
|
| 94 |
SITEFILE="20${PN}-${SLOT}-gentoo.el"
|
| 95 |
|
| 96 |
src_prepare() {
|
| 97 |
if [[ ${PV##*.} = 9999 ]]; then
|
| 98 |
FULL_VERSION=$(sed -n 's/^AC_INIT(emacs,[ \t]*\([^ \t,)]*\).*/\1/p' \
|
| 99 |
configure.in)
|
| 100 |
[[ ${FULL_VERSION} ]] || die "Cannot determine current Emacs version"
|
| 101 |
einfo "Emacs branch: ${EBZR_BRANCH}"
|
| 102 |
einfo "Revision: ${EBZR_REVISION:-${EBZR_REVNO}}"
|
| 103 |
einfo "Emacs version number: ${FULL_VERSION}"
|
| 104 |
[[ ${FULL_VERSION} =~ ^${PV%.*}(\..*)?$ ]] \
|
| 105 |
|| die "Upstream version number changed to ${FULL_VERSION}"
|
| 106 |
fi
|
| 107 |
|
| 108 |
epatch "${FILESDIR}"/emacs-24.0.92-ns-appdirs.patch
|
| 109 |
epatch_user
|
| 110 |
|
| 111 |
if ! use alsa; then
|
| 112 |
# ALSA is detected even if not requested by its USE flag.
|
| 113 |
# Suppress it by supplying pkg-config with a wrong library name.
|
| 114 |
sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.in \
|
| 115 |
|| die "unable to sed configure.in"
|
| 116 |
fi
|
| 117 |
if ! use gzip-el; then
|
| 118 |
# Emacs' build system automatically detects the gzip binary and
|
| 119 |
# compresses el files. We don't want that so confuse it with a
|
| 120 |
# wrong binary name
|
| 121 |
sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.in \
|
| 122 |
|| die "unable to sed configure.in"
|
| 123 |
fi
|
| 124 |
|
| 125 |
AT_M4DIR=m4 eautoreconf
|
| 126 |
}
|
| 127 |
|
| 128 |
src_configure() {
|
| 129 |
strip-flags
|
| 130 |
|
| 131 |
if use sh; then
|
| 132 |
replace-flags "-O[1-9]" -O0 #262359
|
| 133 |
elif use ia64; then
|
| 134 |
replace-flags "-O[2-9]" -O1 #325373
|
| 135 |
else
|
| 136 |
replace-flags "-O[3-9]" -O2
|
| 137 |
fi
|
| 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="${myconf} --with-sound"
|
| 145 |
else
|
| 146 |
myconf="${myconf} $(use_with sound)"
|
| 147 |
fi
|
| 148 |
|
| 149 |
if use X; then
|
| 150 |
myconf="${myconf} --with-x --without-ns"
|
| 151 |
myconf="${myconf} $(use_with gconf)"
|
| 152 |
myconf="${myconf} $(use_with gsettings)"
|
| 153 |
myconf="${myconf} $(use_with toolkit-scroll-bars)"
|
| 154 |
myconf="${myconf} $(use_with wide-int)"
|
| 155 |
myconf="${myconf} $(use_with gif) $(use_with jpeg)"
|
| 156 |
myconf="${myconf} $(use_with png) $(use_with svg rsvg)"
|
| 157 |
myconf="${myconf} $(use_with tiff) $(use_with xpm)"
|
| 158 |
myconf="${myconf} $(use_with imagemagick)"
|
| 159 |
|
| 160 |
if use xft; then
|
| 161 |
myconf="${myconf} --with-xft"
|
| 162 |
myconf="${myconf} $(use_with m17n-lib libotf)"
|
| 163 |
myconf="${myconf} $(use_with m17n-lib m17n-flt)"
|
| 164 |
else
|
| 165 |
myconf="${myconf} --without-xft"
|
| 166 |
myconf="${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 |
if use gtk; then
|
| 172 |
einfo "Configuring to build with GIMP Toolkit (GTK+)"
|
| 173 |
myconf="${myconf} --with-x-toolkit=$(usev gtk3 || echo gtk)"
|
| 174 |
local f
|
| 175 |
for f in athena Xaw3d motif; do
|
| 176 |
use ${f} && ewarn "USE flag \"${f}\" ignored" \
|
| 177 |
"(superseded by \"gtk\")"
|
| 178 |
done
|
| 179 |
elif use athena || use Xaw3d; then
|
| 180 |
einfo "Configuring to build with Athena/Lucid toolkit"
|
| 181 |
myconf="${myconf} --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
|
| 182 |
use motif && ewarn "USE flag \"motif\" ignored" \
|
| 183 |
"(superseded by \"athena\" or \"Xaw3d\")"
|
| 184 |
elif use motif; then
|
| 185 |
einfo "Configuring to build with Motif toolkit"
|
| 186 |
myconf="${myconf} --with-x-toolkit=motif"
|
| 187 |
else
|
| 188 |
einfo "Configuring to build with no toolkit"
|
| 189 |
myconf="${myconf} --with-x-toolkit=no"
|
| 190 |
fi
|
| 191 |
|
| 192 |
! use gtk && use gtk3 \
|
| 193 |
&& ewarn "USE flag \"gtk3\" has no effect if \"gtk\" is not set."
|
| 194 |
elif use aqua; then
|
| 195 |
einfo "Configuring to build with Cocoa support"
|
| 196 |
myconf="${myconf} --with-ns --disable-ns-self-contained"
|
| 197 |
myconf="${myconf} --without-x"
|
| 198 |
else
|
| 199 |
myconf="${myconf} --without-x --without-ns"
|
| 200 |
fi
|
| 201 |
|
| 202 |
if [[ ${PV##*.} = 9999 ]]; then
|
| 203 |
# These variables are not needed for building. We add them to
|
| 204 |
# configure options because they are stored in the Emacs binary
|
| 205 |
# and available in variable "system-configuration-options".
|
| 206 |
myconf="${myconf} EBZR_BRANCH=${EBZR_BRANCH} EBZR_REVNO=${EBZR_REVNO}"
|
| 207 |
fi
|
| 208 |
|
| 209 |
# According to configure, this option is only used for GNU/Linux
|
| 210 |
# (x86_64 and s390). For Gentoo Prefix we have to explicitly spell
|
| 211 |
# out the location because $(get_libdir) does not necessarily return
|
| 212 |
# something that matches the host OS's libdir naming (e.g. RHEL).
|
| 213 |
local crtdir=$($(tc-getCC) -print-file-name=crt1.o)
|
| 214 |
crtdir=${crtdir%/*}
|
| 215 |
|
| 216 |
econf \
|
| 217 |
--program-suffix=-${EMACS_SUFFIX} \
|
| 218 |
--infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
|
| 219 |
--enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
|
| 220 |
--with-crt-dir="${crtdir}" \
|
| 221 |
--with-gameuser="${GAMES_USER_DED:-games}" \
|
| 222 |
--without-compress-info \
|
| 223 |
--disable-maintainer-mode \
|
| 224 |
$(use_with hesiod) \
|
| 225 |
$(use_with kerberos) $(use_with kerberos kerberos5) \
|
| 226 |
$(use_with gpm) \
|
| 227 |
$(use_with dbus) \
|
| 228 |
$(use_with gnutls) \
|
| 229 |
$(use_with libxml2 xml2) \
|
| 230 |
$(use_with selinux) \
|
| 231 |
${myconf}
|
| 232 |
}
|
| 233 |
|
| 234 |
src_compile() {
|
| 235 |
export SANDBOX_ON=0 # for the unbelievers, see Bug #131505
|
| 236 |
if [[ ${PV##*.} = 9999 ]]; then
|
| 237 |
emake CC="$(tc-getCC)" bootstrap
|
| 238 |
# cleanup, otherwise emacs will be dumped again in src_install
|
| 239 |
(cd src; emake versionclean)
|
| 240 |
fi
|
| 241 |
# set last component of emacs-version to (package revision + 1)
|
| 242 |
touch src/emacs-${FULL_VERSION}.${PR#r}
|
| 243 |
emake CC="$(tc-getCC)"
|
| 244 |
}
|
| 245 |
|
| 246 |
src_install () {
|
| 247 |
emake install DESTDIR="${D}"
|
| 248 |
|
| 249 |
rm "${ED}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
|
| 250 |
|| die "removing duplicate emacs executable failed"
|
| 251 |
mv "${ED}"/usr/bin/emacs-${EMACS_SUFFIX} "${ED}"/usr/bin/${EMACS_SUFFIX} \
|
| 252 |
|| die "moving Emacs executable failed"
|
| 253 |
|
| 254 |
# move man pages to the correct place
|
| 255 |
local m
|
| 256 |
for m in "${ED}"/usr/share/man/man1/* ; do
|
| 257 |
mv "${m}" "${m%.1}-${EMACS_SUFFIX}.1" || die "mv man failed"
|
| 258 |
done
|
| 259 |
|
| 260 |
# move info dir to avoid collisions with the dir file generated by portage
|
| 261 |
mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
|
| 262 |
|| die "moving info dir failed"
|
| 263 |
touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
|
| 264 |
docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
|
| 265 |
|
| 266 |
# avoid collision between slots, see bug #169033 e.g.
|
| 267 |
rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el
|
| 268 |
rm -rf "${ED}"/usr/share/{applications,icons}
|
| 269 |
rm "${ED}"/var/lib/games/emacs/{snake,tetris}-scores
|
| 270 |
keepdir /var/lib/games/emacs
|
| 271 |
|
| 272 |
# remove unused <version>/site-lisp dir
|
| 273 |
rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp
|
| 274 |
|
| 275 |
local c=";;"
|
| 276 |
if use source; then
|
| 277 |
insinto /usr/share/emacs/${FULL_VERSION}/src
|
| 278 |
# This is not meant to install all the source -- just the
|
| 279 |
# C source you might find via find-function
|
| 280 |
doins src/*.{c,h,m}
|
| 281 |
doins -r src/{m,s}
|
| 282 |
rm "${ED}"/usr/share/emacs/${FULL_VERSION}/src/{m,s}/README
|
| 283 |
c=""
|
| 284 |
fi
|
| 285 |
|
| 286 |
sed 's/^X//' >"${T}/${SITEFILE}" <<-EOF
|
| 287 |
X
|
| 288 |
;;; ${PN}-${SLOT} site-lisp configuration
|
| 289 |
X
|
| 290 |
(when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
|
| 291 |
X ${c}(setq find-function-C-source-directory
|
| 292 |
X ${c} "${EPREFIX}/usr/share/emacs/${FULL_VERSION}/src")
|
| 293 |
X (let ((path (getenv "INFOPATH"))
|
| 294 |
X (dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
|
| 295 |
X (re "\\\\\`${EPREFIX}/usr/share/info\\\\>"))
|
| 296 |
X (and path
|
| 297 |
X ;; move Emacs Info dir before anything else in /usr/share/info
|
| 298 |
X (let* ((p (cons nil (split-string path ":" t))) (q p))
|
| 299 |
X (while (and (cdr q) (not (string-match re (cadr q))))
|
| 300 |
X (setq q (cdr q)))
|
| 301 |
X (setcdr q (cons dir (delete dir (cdr q))))
|
| 302 |
X (setq Info-directory-list (prune-directory-list (cdr p)))))))
|
| 303 |
EOF
|
| 304 |
elisp-site-file-install "${T}/${SITEFILE}" || die
|
| 305 |
|
| 306 |
dodoc README BUGS
|
| 307 |
|
| 308 |
if use aqua; then
|
| 309 |
dodir /Applications/Gentoo
|
| 310 |
rm -rf "${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app
|
| 311 |
mv nextstep/Emacs.app \
|
| 312 |
"${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app || die
|
| 313 |
elog "Emacs${EMACS_SUFFIX#emacs}.app is in ${EPREFIX}/Applications/Gentoo."
|
| 314 |
elog "You may want to copy or symlink it into /Applications by yourself."
|
| 315 |
fi
|
| 316 |
}
|
| 317 |
|
| 318 |
pkg_preinst() {
|
| 319 |
# move Info dir file to correct name
|
| 320 |
local infodir=/usr/share/info/${EMACS_SUFFIX} f
|
| 321 |
if [[ -f ${ED}${infodir}/dir.orig ]]; then
|
| 322 |
mv "${ED}"${infodir}/dir{.orig,} || die "moving info dir failed"
|
| 323 |
elif [[ -d "${ED}"${infodir} ]]; then
|
| 324 |
# this should not happen in EAPI 4
|
| 325 |
ewarn "Regenerating Info directory index in ${infodir} ..."
|
| 326 |
rm -f "${ED}"${infodir}/dir{,.*}
|
| 327 |
for f in "${ED}"${infodir}/*; do
|
| 328 |
if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
|
| 329 |
install-info --info-dir="${ED}"${infodir} "${f}" \
|
| 330 |
|| die "install-info failed"
|
| 331 |
fi
|
| 332 |
done
|
| 333 |
fi
|
| 334 |
}
|
| 335 |
|
| 336 |
pkg_postinst() {
|
| 337 |
local f
|
| 338 |
for f in "${EROOT}"/var/lib/games/emacs/{snake,tetris}-scores; do
|
| 339 |
[[ -e ${f} ]] || touch "${f}"
|
| 340 |
done
|
| 341 |
chown "${GAMES_USER_DED:-games}" "${EROOT}"/var/lib/games/emacs
|
| 342 |
|
| 343 |
elisp-site-regen
|
| 344 |
eselect emacs update ifunset
|
| 345 |
|
| 346 |
if use X; then
|
| 347 |
elog "You need to install some fonts for Emacs."
|
| 348 |
elog "Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
|
| 349 |
elog "machine would satisfy basic Emacs requirements under X11."
|
| 350 |
elog "See also http://www.gentoo.org/proj/en/lisp/emacs/xft.xml"
|
| 351 |
elog "for how to enable anti-aliased fonts."
|
| 352 |
elog
|
| 353 |
fi
|
| 354 |
|
| 355 |
elog "You can set the version to be started by /usr/bin/emacs through"
|
| 356 |
elog "the Emacs eselect module, which also redirects man and info pages."
|
| 357 |
elog "Therefore, several Emacs versions can be installed at the same time."
|
| 358 |
elog "\"man emacs.eselect\" for details."
|
| 359 |
elog
|
| 360 |
elog "If you upgrade from a previous major version of Emacs, then it is"
|
| 361 |
elog "strongly recommended that you use app-admin/emacs-updater to rebuild"
|
| 362 |
elog "all byte-compiled elisp files of the installed Emacs packages."
|
| 363 |
}
|
| 364 |
|
| 365 |
pkg_postrm() {
|
| 366 |
elisp-site-regen
|
| 367 |
eselect emacs update ifunset
|
| 368 |
}
|