Copy from Berkano Overlay
[otih-overlay.git] / app-misc / screen / screen-9999-r1.ebuild
blob01441336c17830e451494d689cb4d21e745da2be
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
5 WANT_AUTOCONF="2.5"
7 inherit eutils flag-o-matic toolchain-funcs pam autotools git
9 EGIT_REPO_URI="git://git.savannah.gnu.org/screen.git"
10 DESCRIPTION="A full-screen window manager that multiplexes a physical terminal between several processes"
11 HOMEPAGE="http://www.gnu.org/software/screen/"
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS=""
16 IUSE="debug doc nethack pam selinux multiuser"
18 RDEPEND=">=sys-libs/ncurses-5.2
19 pam? ( virtual/pam )
20 selinux? (
21 sec-policy/selinux-screen
22 >=sec-policy/selinux-base-policy-20050821
24 DEPEND="${RDEPEND}
25 doc? ( sys-apps/texinfo )"
27 S="${WORKDIR}/${PN}"
29 pkg_setup() {
30 # Make sure utmp group exists, as it's used later on.
31 enewgroup utmp 406
34 src_unpack() {
35 git_src_unpack ${A}
36 cd "${S}"/src
38 # Bug 31070: configure problem which affects alpha
39 # (13 Jan 2004 agriffis)
40 epatch "${FILESDIR}"/screen-4.0.1-vsprintf.patch
42 # uclibc doesnt have sys/stropts.h
43 if ! (echo '#include <sys/stropts.h>' | $(tc-getCC) -E - &>/dev/null) ; then
44 epatch "${FILESDIR}"/4.0.2-no-pty.patch
47 # Don't use utempter even if it is found on the system
48 epatch "${FILESDIR}"/4.0.2-no-utempter.patch
50 # Don't link against libelf even if it is found on the system
51 #epatch "${FILESDIR}"/9999-no-libelf.patch
53 # Fix manpage.
54 sed -i \
55 -e "s:/usr/local/etc/screenrc:/etc/screenrc:g" \
56 -e "s:/usr/local/screens:/var/run/screen:g" \
57 -e "s:/local/etc/screenrc:/etc/screenrc:g" \
58 -e "s:/etc/utmp:/var/run/utmp:g" \
59 -e "s:/local/screens/S-:/var/run/screen/S-:g" \
60 doc/screen.1 \
61 || die "sed doc/screen.1 failed"
63 eautoreconf
66 src_compile() {
67 cd "${S}"/src
69 append-flags "-DMAXWIN=${MAX_SCREEN_WINDOWS:-100}"
70 use nethack || append-flags "-DNONETHACK"
71 use debug && append-flags "-DDEBUG"
73 econf \
74 --with-socket-dir=/var/run/screen \
75 --with-sys-screenrc=/etc/screenrc \
76 --with-pty-mode=0620 \
77 --with-pty-group=5 \
78 --enable-rxvt_osc \
79 --enable-telnet \
80 --enable-colors256 \
81 $(use_enable pam) \
82 || die "econf failed"
84 # Second try to fix bug 12683, this time without changing term.h
85 # The last try seemed to break screen at run-time.
86 # (16 Jan 2003 agriffis)
87 LC_ALL=POSIX make term.h || die "Failed making term.h"
89 emake || die "emake failed"
91 if use doc
92 then
93 cd "${S}"/src/doc/
94 make info || die "make info failed"
98 src_install() {
99 cd "${S}"/src
100 dobin screen || die "dobin failed"
101 keepdir /var/run/screen || die "keepdir failed"
103 if use multiuser
104 then
105 fperms 4755 /usr/bin/screen || die "fperms failed"
106 else
107 fowners root:utmp /{usr/bin,var/run}/screen || die "fowners failed"
108 fperms 2755 /usr/bin/screen || die "fperms failed"
111 insinto /usr/share/screen
112 doins terminfo/{screencap,screeninfo.src} || die "doins failed"
113 insinto /usr/share/screen/utf8encodings
114 doins utf8encodings/?? || die "doins failed"
115 insinto /etc
116 doins "${FILESDIR}"/screenrc || die "doins failed"
118 pamd_mimic_system screen auth || die "pamd_mimic_system failed"
120 dodoc \
121 README ChangeLog INSTALL TODO NEWS* patchlevel.h \
122 doc/{FAQ,README.DOTSCREEN,fdpat.ps,window_to_display.ps} \
123 || die "dodoc failed"
125 doman doc/screen.1 || die "doman failed"
127 if use doc
128 then
129 doinfo doc/screen.info || die "doinfo failed"
133 pkg_postinst() {
134 if use multiuser
135 then
136 chown root:0 "${ROOT}"/var/run/screen
137 chmod 0755 "${ROOT}"/var/run/screen
138 else
139 chown root:utmp "${ROOT}"/var/run/screen
140 chmod 0775 "${ROOT}"/var/run/screen
143 elog "Some dangerous key bindings have been removed or changed to more safe values."
144 elog "We enable some xterm hacks in our default screenrc, which might break some"
145 elog "applications. Please check /etc/screenrc for information on these changes."