exoni/packages/app-editors/emacs/emacs.exlib
2013-05-16 22:39:20 +02:00

172 lines
4.9 KiB
Bash

# Copyright 2008, 2009 Ingmar Vanhassel <ingmar@exherbo.org>
# Distributed under the terms of the GNU General Public License v2
# Based in part upon 'emacs-22.2-r2.ebuild' from Gentoo, which is:
# Copyright 1999-2008 Gentoo Foundation.
require game alternatives elisp-module
if [[ -z $(ever range 3) ]]; then
require gnu [ suffix=xz ]
else
require gnu [ alpha=true subdir=pretest suffix=xz ]
fi
if [[ $(ever range 3) == rc* ]]; then
MY_PV=$(ever range 1-2)
MY_PNV=${PN}-${MY_PV}
fi
export_exlib_phases src_prepare src_configure src_install pkg_postinst
SUMMARY="The extensible, customizable, self-documenting, real-time display editor"
LICENCES="GPL-3"
SLOT="0"
MYOPTIONS="
X alsa dbus freetype gif gpm gtk gtk3 otf svg tiff tiff xpm
( freetype gif gtk gtk3 otf svg tiff xpm ) [[ requires = X ]]
( gtk gtk3 ) [[ number-selected = at-most-one ]]
gconf [[
description = [ Allows emacs to determine the system font ]
requires = X
]]
otf [[
description = [ Support for OpenType fonts ]
requires = freetype
]]
"
DEPENDENCIES="
build:
X? ( dev-util/pkg-config )
alsa? ( dev-util/pkg-config )
dbus? ( dev-util/pkg-config )
gtk? ( dev-util/pkg-config )
gtk3? ( dev-util/pkg-config )
svg? ( dev-util/pkg-config )
build+run:
dev-libs/libxml2:2.0 [[ note = [ used for html rendering; could be made optional ] ]]
net-libs/liblockfile
sys-libs/ncurses
alsa? ( sys-sound/alsa-lib[>=1.0.0] )
X? (
media-libs/jpeg
media-libs/libpng
x11-data/xbitmaps
x11-libs/libICE
x11-libs/libSM
x11-libs/libX11
gif? ( media-libs/giflib )
gtk? (
dev-libs/glib:2[>=2.10]
x11-libs/gtk+:2[>=2.10]
)
gtk3? (
dev-libs/glib:2[>=2.28]
x11-libs/gtk+:3[>=3.0]
)
otf? ( dev-libs/libotf )
svg? ( gnome-desktop/librsvg:2[>=2.11.0] )
tiff? ( media-libs/tiff )
xpm? ( x11-libs/libXpm )
)
dbus? ( sys-apps/dbus[>=1.0.0] )
freetype? (
media-libs/fontconfig[>=2.2.0]
media-libs/freetype:2
x11-libs/libXft[>=0.13.0]
x11-libs/libXrender [[ note = [ because of libXft ] ]]
)
gconf? ( gnome-platform/GConf:2 )
gpm? ( sys-libs/gpm )
suggestion:
app-spell/aspell [[ description = [ For ispell and flyspell mode ] ]]
"
WORK=${WORKBASE}/${MY_PNV-${PNV}}
emacs_src_prepare() {
# Compressing *.el files saves 25MB diskspace, which is not worth it on modern systems
edo sed -i -e 's/@GZIP_PROG@//' {.,leim}/Makefile.in
default
# Create a copy of the clean source (it will be installed in src_install)
edo tar cf source.tar src/
}
emacs_src_configure() {
config_params=(
--infodir=/usr/share/info/emacs
--without-compress-info # applies to manpages as well
--without-gsettings
--without-hesiod
--without-imagemagick
--without-kerberos
--without-kerberos5
--without-m17n-flt
--without-selinux
--without-xim
)
config_withs=(
'X x' 'X jpeg' 'X png'
'alsa sound'
'freetype xft'
'otf libotf'
'svg rsvg'
'dbus' 'gconf' 'gif' 'gpm' 'tiff' 'xpm'
)
local toolkit=no
option gtk && toolkit=gtk;
option gtk3 && toolkit=gtk3;
econf \
"${config_params[@]}" \
$(for s in "${config_withs[@]}" ; do option_with ${s} ; done ) \
$(option gtk || option gtk3 || echo --without-toolkit-scroll-bars) \
--with-x-toolkit=${toolkit}
}
emacs_src_install() {
default
insinto ${ELISP_SITE_LISP}
hereins site-start.el <<EOF
(require 'site-exherbo)
EOF
keepdir /var/lib/games/emacs
dovarlibgames -R
# they lose group write permission anyway after being updated
edo chmod g-w "${IMAGE}"/var/lib/games/emacs/*
preserve_scores "${IMAGE}"/var/lib/games/emacs/*
edo chown wizard:games "${IMAGE}"/usr/libexec/emacs/${MY_PV-${PV}}/${CHOST}/update-game-score
edo chmod ug+s "${IMAGE}"/usr/libexec/emacs/${MY_PV-${PV}}/${CHOST}/update-game-score
elisp-install-site-file
# Install a copy of the clean source to `source-directory`. The builtin help system of emacs
# requires it in order to fully function.
local emacs_source_root=/usr/src/emacs
dodir ${emacs_source_root}
edo tar xf source.tar -C "${IMAGE}"${emacs_source_root}
cd "${IMAGE}"
edo mv usr/share/man/man1/ctags{,-emacs}.1
edo mv usr/bin/ctags{,-emacs}
alternatives_for ctags emacs 500 \
/usr/bin/ctags ctags-emacs \
/usr/share/man/man1/ctags.1 ctags-emacs.1
hereenvd 70${PN} <<EOF
INFOPATH="/usr/share/info/${PN}"
EOF
}
emacs_pkg_postinst() {
game_pkg_postinst
alternatives_pkg_postinst
elisp-generate-global-site-file
}