Add dwm from git.
[rentiernetz-overlay.git] / x11-wm / dwm / dwm-9999.ebuild
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/x11-wm/dwm/dwm-6.0.ebuild,v 1.12 2013/02/06 15:19:31 jer Exp $
4
5 EAPI=5
6
7 inherit eutils git-r3 savedconfig toolchain-funcs
8
9 DESCRIPTION="a dynamic window manager for X11"
10 HOMEPAGE="http://dwm.suckless.org/"
11 EGIT_REPO_URI="https://github.com/Ferada/dwm.git"
12
13 LICENSE="MIT"
14 SLOT="0"
15 KEYWORDS=""
16 IUSE="xinerama"
17
18 RDEPEND="
19         x11-libs/libX11
20         x11-libs/libXft
21         media-libs/freetype:2
22         xinerama? ( x11-libs/libXinerama )
23 "
24 DEPEND="${RDEPEND}
25         xinerama? ( x11-proto/xineramaproto )
26         virtual/pkgconfig
27 "
28
29 src_prepare() {
30         sed -i \
31                 -e "s/CFLAGS = -std=c99 -pedantic -Wall -Os/CFLAGS += -std=c99 -pedantic -Wall/" \
32                 -e "/^LDFLAGS/{s|=|+=|g;s|-s ||g}" \
33                 -e "s/#XINERAMALIBS =/XINERAMALIBS ?=/" \
34                 -e "s/#XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \
35                 -e "s@-I/usr/include/freetype2@$( $(tc-getPKG_CONFIG) --cflags freetype2 xft 2>/dev/null )@" \
36                 -e "s@/usr/X11R6/include@${EPREFIX}/usr/include/X11@" \
37                 -e "s@/usr/X11R6/lib@${EPREFIX}/usr/lib/X11@" \
38                 -e "s@-lXft@$( $(tc-getPKG_CONFIG) --libs freetype2 xft 2>/dev/null )@" \
39                 -e "s@-L/usr/lib@@" \
40                 config.mk || die
41         sed -i \
42                 -e '/@echo CC/d' \
43                 -e 's|@${CC}|$(CC)|g' \
44                 Makefile || die
45
46         restore_config config.def.h
47         epatch_user
48 }
49
50 src_configure() {
51         tc-export PKG_CONFIG
52 }
53
54 src_compile() {
55         if use xinerama; then
56                 emake CC=$(tc-getCC) dwm
57         else
58                 emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS="" dwm
59         fi
60 }
61
62 src_install() {
63         emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install
64
65         exeinto /etc/X11/Sessions
66         newexe "${FILESDIR}"/dwm-session2 dwm
67
68         insinto /usr/share/xsessions
69         doins "${FILESDIR}"/dwm.desktop
70
71         dodoc README
72
73         save_config config.def.h
74 }
75
76 pkg_postinst() {
77         einfo "This ebuild has support for user defined configs"
78         einfo "Please read this ebuild for more details and re-emerge as needed"
79         einfo "if you want to add or remove functionality for ${PN}"
80         if ! has_version x11-misc/dmenu; then
81                 elog "Installing ${PN} without x11-misc/dmenu"
82                 einfo "To have a menu you can install x11-misc/dmenu"
83         fi
84         einfo "You can custom status bar with a script in HOME/.dwm/dwmrc"
85         einfo "the ouput is redirected to the standard input of dwm"
86         einfo "Since dwm-5.4, status info in the bar must be set like this:"
87         einfo "xsetroot -name \"\`date\` \`uptime | sed 's/.*,//'\`\""
88 }