summaryrefslogtreecommitdiffstats
path: root/packages/app-editors/emacs/emacs.exlib
blob: 5e2903462372dbeb3bcc22d0e08a595e969a35d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# 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
}