]> Pileus Git - ~andy/sunrise/blob - x11-wm/dwm/dwm-2.2.ebuild
Revert to revision 1964
[~andy/sunrise] / x11-wm / dwm / dwm-2.2.ebuild
1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 inherit toolchain-funcs
6
7 DESCRIPTION="a dynamic window manager for X11"
8 HOMEPAGE="http://suckless.org/view/dynamic+window+manager"
9 SRC_URI="http://suckless.org/download/${P}.tar.gz"
10
11 LICENSE="MIT"
12 SLOT="0"
13 KEYWORDS="~x86"
14 IUSE="savedconfig"
15
16 DEPEND="x11-libs/libX11"
17 RDEPEND="${DEPEND}
18         sys-apps/coreutils"
19
20 src_unpack() {
21         unpack ${A}
22         cd "${S}"
23
24         sed -i \
25                 -e "s/.*strip.*//" \
26                 Makefile || die "sed failed"
27
28         sed -i \
29                 -e "s/CFLAGS = -Os/CFLAGS +=/" \
30                 -e "s/LDFLAGS =/LDFLAGS +=/" \
31                 config.mk || die "sed failed"
32
33         if use savedconfig; then
34                 local conf root
35                 [[ -r config.h ]] && rm config.h
36                 for conf in ${PF} ${P} ${PN}; do
37                         for root in "${PORTAGE_CONFIGROOT}" "${ROOT}" /; do
38                                 configfile=${root}etc/portage/savedconfig/${conf}.config.h
39                                 if [[ -r ${configfile} ]]; then
40                                         elog "Found your ${configfile} and using it."
41                                         cp ${configfile} "${S}"/config.h
42                                         return 0
43                                 fi
44                         done
45                 done
46                 ewarn "Could not locate user configfile, so we will save a default one."
47         fi
48 }
49
50 src_compile() {
51         local msg
52         use savedconfig && msg=", please check the configfile"
53         emake CC=$(tc-getCC) || die "emake failed${msg}"
54 }
55
56 src_install() {
57         emake DESTDIR="${D}" PREFIX="/usr" install || die "emake install failed"
58
59         insinto /usr/share/${PN}
60         newins config.h ${PF}.config.h
61
62         exeinto /etc/X11/Sessions
63         newexe "${FILESDIR}"/dwm-session dwm
64
65         dodoc README
66 }
67
68 pkg_preinst() {
69         mv "${D}"/usr/share/${PN}/${PF}.config.h "${T}"/
70 }
71
72 pkg_postinst() {
73         if use savedconfig; then
74                 local config_dir="${PORTAGE_CONFIGROOT:-${ROOT}}/etc/portage/savedconfig"
75                 elog "Saving this build config to ${config_dir}/${PF}.config.h"
76                 einfo "Read this ebuild for more info on how to take advantage of this option."
77                 mkdir -p "${config_dir}"
78                 cp "${T}"/${PF}.config.h "${config_dir}"/${PF}.config.h
79         fi
80         einfo "This ebuild has support for user defined configs"
81         einfo "Please read this ebuild for more details and re-emerge as needed"
82         einfo "if you want to add or remove functionality for ${PN}"
83         if ! has_version x11-misc/dmenu; then
84                 elog "Installing ${PN} without x11-misc/dmenu"
85                 einfo "To have a menu you can install x11-misc/dmenu"
86         fi
87         einfo "You can custom status bar with a script in HOME/.dwm/dwmrc"
88         einfo "the ouput is redirected to the standard input of dwm"
89 }