1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 inherit toolchain-funcs
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"
16 DEPEND="x11-libs/libX11"
26 Makefile || die "sed failed"
29 -e "s/CFLAGS = -Os/CFLAGS +=/" \
30 -e "s/LDFLAGS =/LDFLAGS +=/" \
31 config.mk || die "sed failed"
33 if use savedconfig; then
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
46 ewarn "Could not locate user configfile, so we will save a default one."
52 use savedconfig && msg=", please check the configfile"
53 emake CC=$(tc-getCC) || die "emake failed${msg}"
57 emake DESTDIR="${D}" PREFIX="/usr" install || die "emake install failed"
59 insinto /usr/share/${PN}
60 newins config.h ${PF}.config.h
62 exeinto /etc/X11/Sessions
63 newexe "${FILESDIR}"/dwm-session dwm
69 mv "${D}"/usr/share/${PN}/${PF}.config.h "${T}"/
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
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"
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"