/[gentoo-x86]/net-misc/openssh/openssh-6.6.1_p1.ebuild
Gentoo

Contents of /net-misc/openssh/openssh-6.6.1_p1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon Aug 4 19:35:53 2014 UTC (5 years, 2 months ago) by polynomial-c
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Fixed mistakenly replaced @ char (bug #519076)

(Portage version: 2.2.11-r1/cvs/Linux x86_64, signed Manifest commit with key 0x981CA6FC)

1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/openssh-6.6.1_p1.ebuild,v 1.1 2014/04/25 07:11:59 polynomial-c Exp $
4
5 EAPI="4"
6 inherit eutils user flag-o-matic multilib autotools pam systemd versionator
7
8 # Make it more portable between straight releases
9 # and _p? releases.
10 PARCH=${P/.1_}
11
12 #HPN_PATCH="${PN}-6.6p1-hpnssh14v4.diff.gz"
13 HPN_PATCH="${PN}-6.6.1p1-hpnssh14v4.diff.xz"
14 LDAP_PATCH="${PN}-lpk-6.5p1-0.3.14.patch.gz"
15 X509_VER="7.9" X509_PATCH="${PARCH}+x509-${X509_VER}.diff.gz"
16
17 DESCRIPTION="Port of OpenBSD's free SSH release"
18 HOMEPAGE="http://www.openssh.org/"
19 SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz
20 ${HPN_PATCH:+hpn? ( http://dev.gentoo.org/~polynomial-c/${HPN_PATCH} )}
21 ${LDAP_PATCH:+ldap? ( mirror://gentoo/${LDAP_PATCH} )}
22 ${X509_PATCH:+X509? ( http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH} )}
23 "
24 #${HPN_PATCH:+hpn? ( mirror://sourceforge/hpnssh/${HPN_PATCH} )}
25
26 LICENSE="BSD GPL-2"
27 SLOT="0"
28 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
29 IUSE="bindist ${HPN_PATCH:++}hpn kerberos ldap ldns libedit pam selinux skey static tcpd X X509"
30
31 LIB_DEPEND="selinux? ( >=sys-libs/libselinux-1.28[static-libs(+)] )
32 skey? ( >=sys-auth/skey-1.1.5-r1[static-libs(+)] )
33 libedit? ( dev-libs/libedit[static-libs(+)] )
34 >=dev-libs/openssl-0.9.6d:0[bindist=]
35 dev-libs/openssl[static-libs(+)]
36 >=sys-libs/zlib-1.2.3[static-libs(+)]
37 tcpd? ( >=sys-apps/tcp-wrappers-7.6[static-libs(+)] )"
38 RDEPEND="
39 !static? (
40 ${LIB_DEPEND//\[static-libs(+)]}
41 ldns? (
42 !bindist? ( net-libs/ldns[ecdsa,ssl] )
43 bindist? ( net-libs/ldns[-ecdsa,ssl] )
44 )
45 )
46 pam? ( virtual/pam )
47 kerberos? ( virtual/krb5 )
48 ldap? ( net-nds/openldap )"
49 DEPEND="${RDEPEND}
50 static? (
51 ${LIB_DEPEND}
52 ldns? (
53 !bindist? ( net-libs/ldns[ecdsa,ssl,static-libs(+)] )
54 bindist? ( net-libs/ldns[-ecdsa,ssl,static-libs(+)] )
55 )
56 )
57 virtual/pkgconfig
58 virtual/os-headers
59 sys-devel/autoconf"
60 RDEPEND="${RDEPEND}
61 pam? ( >=sys-auth/pambase-20081028 )
62 userland_GNU? ( virtual/shadow )
63 X? ( x11-apps/xauth )"
64
65 S=${WORKDIR}/${PARCH}
66
67 pkg_setup() {
68 # this sucks, but i'd rather have people unable to `emerge -u openssh`
69 # than not be able to log in to their server any more
70 maybe_fail() { [[ -z ${!2} ]] && echo "$1" ; }
71 local fail="
72 $(use X509 && maybe_fail X509 X509_PATCH)
73 $(use ldap && maybe_fail ldap LDAP_PATCH)
74 $(use hpn && maybe_fail hpn HPN_PATCH)
75 "
76 fail=$(echo ${fail})
77 if [[ -n ${fail} ]] ; then
78 eerror "Sorry, but this version does not yet support features"
79 eerror "that you requested: ${fail}"
80 eerror "Please mask ${PF} for now and check back later:"
81 eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
82 die "booooo"
83 fi
84 }
85
86 save_version() {
87 # version.h patch conflict avoidence
88 mv version.h version.h.$1
89 cp -f version.h.pristine version.h
90 }
91
92 src_prepare() {
93 sed -i \
94 -e "/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:${EPREFIX}/usr/bin/xauth:" \
95 pathnames.h || die
96 # keep this as we need it to avoid the conflict between LPK and HPN changing
97 # this file.
98 cp version.h version.h.pristine
99
100 # don't break .ssh/authorized_keys2 for fun
101 sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
102
103 epatch "${FILESDIR}"/${P}.patch #508604
104
105 epatch "${FILESDIR}"/${PN}-5.9_p1-sshd-gssapi-multihomed.patch #378361
106 if use X509 ; then
107 pushd .. >/dev/null
108 epatch "${FILESDIR}"/${PN}-6.6_p1-x509-glue.patch
109 use hpn && epatch "${FILESDIR}"/${PN}-6.6.1_p1-x509-hpn14v4-glue-p2.patch
110 popd >/dev/null
111 epatch "${WORKDIR}"/${X509_PATCH%.*}
112 epatch "${FILESDIR}"/${PN}-6.3_p1-x509-hpn14v2-glue.patch
113 save_version X509
114 fi
115 if ! use X509 ; then
116 if [[ -n ${LDAP_PATCH} ]] && use ldap ; then
117 epatch "${WORKDIR}"/${LDAP_PATCH%.*}
118 save_version LPK
119 fi
120 else
121 use ldap && ewarn "Sorry, X509 and LDAP conflict internally, disabling LDAP"
122 fi
123 epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
124 epatch "${FILESDIR}"/${PN}-6.6_p1-openssl-ignore-status.patch
125 if [[ -n ${HPN_PATCH} ]] && use hpn; then
126 epatch "${WORKDIR}"/${HPN_PATCH%.*}
127 epatch "${FILESDIR}"/${PN}-6.5_p1-hpn-cipher-align.patch #498632
128 save_version HPN
129 fi
130
131 tc-export PKG_CONFIG
132 local sed_args=(
133 -e "s:-lcrypto:$(${PKG_CONFIG} --libs openssl):"
134 # Disable PATH reset, trust what portage gives us #254615
135 -e 's:^PATH=/:#PATH=/:'
136 # Disable fortify flags ... our gcc does this for us
137 -e 's:-D_FORTIFY_SOURCE=2::'
138 )
139 # The -ftrapv flag ICEs on hppa #505182
140 use hppa && sed_args+=(
141 -e '/CFLAGS/s:-ftrapv:-fdisable-this-test:'
142 -e '/OSSH_CHECK_CFLAG_LINK.*-ftrapv/d'
143 )
144 sed -i "${sed_args[@]}" configure{.ac,} || die
145
146 epatch_user #473004
147
148 # Now we can build a sane merged version.h
149 (
150 sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
151 macros=()
152 for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
153 printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
154 ) > version.h
155
156 eautoreconf
157 }
158
159 static_use_with() {
160 local flag=$1
161 if use static && use ${flag} ; then
162 ewarn "Disabling '${flag}' support because of USE='static'"
163 # rebuild args so that we invert the first one (USE flag)
164 # but otherwise leave everything else working so we can
165 # just leverage use_with
166 shift
167 [[ -z $1 ]] && flag="${flag} ${flag}"
168 set -- !${flag} "$@"
169 fi
170 use_with "$@"
171 }
172
173 src_configure() {
174 local myconf
175 addwrite /dev/ptmx
176 addpredict /etc/skey/skeykeys #skey configure code triggers this
177
178 use static && append-ldflags -static
179
180 # Special settings for Gentoo/FreeBSD 9.0 or later (see bug #391011)
181 if use elibc_FreeBSD && version_is_at_least 9.0 "$(uname -r|sed 's/\(.\..\).*/\1/')" ; then
182 myconf="${myconf} --disable-utmp --disable-wtmp --disable-wtmpx"
183 append-ldflags -lutil
184 fi
185
186 econf \
187 --with-ldflags="${LDFLAGS}" \
188 --disable-strip \
189 --with-pid-dir="${EPREFIX}"/var/run \
190 --sysconfdir="${EPREFIX}"/etc/ssh \
191 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/misc \
192 --datadir="${EPREFIX}"/usr/share/openssh \
193 --with-privsep-path="${EPREFIX}"/var/empty \
194 --with-privsep-user=sshd \
195 --with-md5-passwords \
196 --with-ssl-engine \
197 $(static_use_with pam) \
198 $(static_use_with kerberos kerberos5 /usr) \
199 ${LDAP_PATCH:+$(use X509 || ( use ldap && use_with ldap ))} \
200 $(use_with ldns) \
201 $(use_with libedit) \
202 $(use_with selinux) \
203 $(use_with skey) \
204 $(use_with tcpd tcp-wrappers) \
205 ${myconf}
206 }
207
208 src_install() {
209 emake install-nokeys DESTDIR="${D}"
210 fperms 600 /etc/ssh/sshd_config
211 dobin contrib/ssh-copy-id
212 newinitd "${FILESDIR}"/sshd.rc6.4 sshd
213 newconfd "${FILESDIR}"/sshd.confd sshd
214 keepdir /var/empty
215
216 # not all openssl installs support ecc, or are functional #352645
217 if ! grep -q '#define OPENSSL_HAS_ECC 1' config.h ; then
218 elog "dev-libs/openssl was built with 'bindist' - disabling ecdsa support"
219 sed -i 's:&& gen_key ecdsa::' "${ED}"/etc/init.d/sshd || die
220 fi
221
222 newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
223 if use pam ; then
224 sed -i \
225 -e "/^#UsePAM /s:.*:UsePAM yes:" \
226 -e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
227 -e "/^#PrintMotd /s:.*:PrintMotd no:" \
228 -e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
229 "${ED}"/etc/ssh/sshd_config || die "sed of configuration file failed"
230 fi
231
232 # Gentoo tweaks to default config files
233 cat <<-EOF >> "${ED}"/etc/ssh/sshd_config
234
235 # Allow client to pass locale environment variables #367017
236 AcceptEnv LANG LC_*
237 EOF
238 cat <<-EOF >> "${ED}"/etc/ssh/ssh_config
239
240 # Send locale environment variables #367017
241 SendEnv LANG LC_*
242 EOF
243
244 # This instruction is from the HPN webpage,
245 # Used for the server logging functionality
246 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
247 keepdir /var/empty/dev
248 fi
249
250 if ! use X509 && [[ -n ${LDAP_PATCH} ]] && use ldap ; then
251 insinto /etc/openldap/schema/
252 newins openssh-lpk_openldap.schema openssh-lpk.schema
253 fi
254
255 doman contrib/ssh-copy-id.1
256 dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
257
258 diropts -m 0700
259 dodir /etc/skel/.ssh
260
261 systemd_dounit "${FILESDIR}"/sshd.{service,socket}
262 systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service'
263 }
264
265 src_test() {
266 local t tests skipped failed passed shell
267 tests="interop-tests compat-tests"
268 skipped=""
269 shell=$(egetshell ${UID})
270 if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
271 elog "Running the full OpenSSH testsuite"
272 elog "requires a usable shell for the 'portage'"
273 elog "user, so we will run a subset only."
274 skipped="${skipped} tests"
275 else
276 tests="${tests} tests"
277 fi
278 # It will also attempt to write to the homedir .ssh
279 local sshhome=${T}/homedir
280 mkdir -p "${sshhome}"/.ssh
281 for t in ${tests} ; do
282 # Some tests read from stdin ...
283 HOMEDIR="${sshhome}" \
284 emake -k -j1 ${t} </dev/null \
285 && passed="${passed}${t} " \
286 || failed="${failed}${t} "
287 done
288 einfo "Passed tests: ${passed}"
289 ewarn "Skipped tests: ${skipped}"
290 if [[ -n ${failed} ]] ; then
291 ewarn "Failed tests: ${failed}"
292 die "Some tests failed: ${failed}"
293 else
294 einfo "Failed tests: ${failed}"
295 return 0
296 fi
297 }
298
299 pkg_preinst() {
300 enewgroup sshd 22
301 enewuser sshd 22 -1 /var/empty sshd
302 }
303
304 pkg_postinst() {
305 if has_version "<${CATEGORY}/${PN}-5.8_p1" ; then
306 elog "Starting with openssh-5.8p1, the server will default to a newer key"
307 elog "algorithm (ECDSA). You are encouraged to manually update your stored"
308 elog "keys list as servers update theirs. See ssh-keyscan(1) for more info."
309 fi
310 ewarn "Remember to merge your config files in /etc/ssh/ and then"
311 ewarn "reload sshd: '/etc/init.d/sshd reload'."
312 # This instruction is from the HPN webpage,
313 # Used for the server logging functionality
314 if [[ -n ${HPN_PATCH} ]] && use hpn ; then
315 echo
316 einfo "For the HPN server logging patch, you must ensure that"
317 einfo "your syslog application also listens at /var/empty/dev/log."
318 fi
319 }

  ViewVC Help
Powered by ViewVC 1.1.20