Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/sslscan/files/, net-analyzer/sslscan/
Date: Fri, 13 May 2022 19:48:12
Message-Id: 1652469608.1548b15c4b6874f83ec08325f48a576ea4ba425f.sam@gentoo
1 commit: 1548b15c4b6874f83ec08325f48a576ea4ba425f
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Tue Apr 5 02:30:56 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri May 13 19:20:08 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1548b15c
7
8 net-analyzer/sslscan: respect toolchain environment
9
10 Copy the needed bits from dev-libs/openssl.
11
12 Closes: https://bugs.gentoo.org/835436
13 Signed-off-by: Sam James <sam <AT> gentoo.org>
14 Closes: https://github.com/gentoo/gentoo/pull/24912
15 Signed-off-by: Sam James <sam <AT> gentoo.org>
16
17 net-analyzer/sslscan/files/gentoo.config-1.0.2 | 171 +++++++++++++++++++++++++
18 net-analyzer/sslscan/sslscan-2.0.13-r1.ebuild | 82 ++++++++++++
19 2 files changed, 253 insertions(+)
20
21 diff --git a/net-analyzer/sslscan/files/gentoo.config-1.0.2 b/net-analyzer/sslscan/files/gentoo.config-1.0.2
22 new file mode 100644
23 index 000000000000..68d7d0ac1fc1
24 --- /dev/null
25 +++ b/net-analyzer/sslscan/files/gentoo.config-1.0.2
26 @@ -0,0 +1,171 @@
27 +#!/usr/bin/env bash
28 +# Copyright 1999-2020 Gentoo Authors
29 +# Distributed under the terms of the GNU General Public License v2
30 +#
31 +# Openssl doesn't play along nicely with cross-compiling
32 +# like autotools based projects, so let's teach it new tricks.
33 +#
34 +# Review the bundled 'config' script to see why kind of targets
35 +# we can pass to the 'Configure' script.
36 +
37 +
38 +# Testing routines
39 +if [[ $1 == "test" ]] ; then
40 + for c in \
41 + "arm-gentoo-linux-uclibc |linux-generic32 -DL_ENDIAN" \
42 + "armv5b-linux-gnu |linux-armv4 -DB_ENDIAN" \
43 + "x86_64-pc-linux-gnu |linux-x86_64" \
44 + "alpha-linux-gnu |linux-alpha-gcc" \
45 + "alphaev56-unknown-linux-gnu |linux-alpha+bwx-gcc" \
46 + "i686-pc-linux-gnu |linux-elf" \
47 + "whatever-gentoo-freebsdX.Y |BSD-generic32" \
48 + "i686-gentoo-freebsdX.Y |BSD-x86-elf" \
49 + "sparc64-alpha-freebsdX.Y |BSD-sparc64" \
50 + "ia64-gentoo-freebsd5.99234 |BSD-ia64" \
51 + "x86_64-gentoo-freebsdX.Y |BSD-x86_64" \
52 + "hppa64-aldsF-linux-gnu5.3 |linux-generic32 -DB_ENDIAN" \
53 + "powerpc-gentOO-linux-uclibc |linux-ppc" \
54 + "powerpc64-unk-linux-gnu |linux-ppc64" \
55 + "powerpc64le-linux-gnu |linux-ppc64le" \
56 + "x86_64-apple-darwinX |darwin64-x86_64-cc" \
57 + "powerpc64-apple-darwinX |darwin64-ppc-cc" \
58 + "i686-apple-darwinX |darwin-i386-cc" \
59 + "i386-apple-darwinX |darwin-i386-cc" \
60 + "powerpc-apple-darwinX |darwin-ppc-cc" \
61 + "i586-pc-winnt |winnt-parity" \
62 + "s390-ibm-linux-gnu |linux-generic32 -DB_ENDIAN" \
63 + "s390x-linux-gnu |linux64-s390x" \
64 + ;do
65 + CHOST=${c/|*}
66 + ret_want=${c/*|}
67 + ret_got=$(CHOST=${CHOST} "$0")
68 +
69 + if [[ ${ret_want} == "${ret_got}" ]] ; then
70 + echo "PASS: ${CHOST}"
71 + else
72 + echo "FAIL: ${CHOST}"
73 + echo -e "\twanted: ${ret_want}"
74 + echo -e "\twe got: ${ret_got}"
75 + fi
76 + done
77 + exit 0
78 +fi
79 +[[ -z ${CHOST} && -n $1 ]] && CHOST=$1
80 +
81 +
82 +# Detect the operating system
83 +case ${CHOST} in
84 + *-aix*) system="aix";;
85 + *-darwin*) system="darwin";;
86 + *-freebsd*) system="BSD";;
87 + *-hpux*) system="hpux";;
88 + *-linux*) system="linux";;
89 + *-solaris*) system="solaris";;
90 + *-winnt*) system="winnt";;
91 + x86_64-*-mingw*) system="mingw64";;
92 + *mingw*) system="mingw";;
93 + *) exit 0;;
94 +esac
95 +
96 +
97 +# Compiler munging
98 +compiler="gcc"
99 +if [[ ${CC} == "ccc" ]] ; then
100 + compiler=${CC}
101 +fi
102 +
103 +
104 +# Detect target arch
105 +machine=""
106 +chost_machine=${CHOST%%-*}
107 +case ${system} in
108 +linux)
109 + case ${chost_machine}:${ABI} in
110 + aarch64*be*) machine="aarch64 -DB_ENDIAN";;
111 + aarch64*) machine="aarch64 -DL_ENDIAN";;
112 + alphaev56*|\
113 + alphaev[678]*)machine=alpha+bwx-${compiler};;
114 + alpha*) machine=alpha-${compiler};;
115 + armv[4-9]*b*) machine="armv4 -DB_ENDIAN";;
116 + armv[4-9]*) machine="armv4 -DL_ENDIAN";;
117 + arm*b*) machine="generic32 -DB_ENDIAN";;
118 + arm*) machine="generic32 -DL_ENDIAN";;
119 + avr*) machine="generic32 -DL_ENDIAN";;
120 + bfin*) machine="generic32 -DL_ENDIAN";;
121 + # hppa64*) machine=parisc64;;
122 + hppa*) machine="generic32 -DB_ENDIAN";;
123 + i[0-9]86*|\
124 + x86_64*:x86) machine=elf;;
125 + ia64*) machine=ia64;;
126 + m68*) machine="generic32 -DB_ENDIAN";;
127 + mips*el*) machine="generic32 -DL_ENDIAN";;
128 + mips*) machine="generic32 -DB_ENDIAN";;
129 + powerpc64*le*)machine=ppc64le;;
130 + powerpc64*) machine=ppc64;;
131 + powerpc*le*) machine="generic32 -DL_ENDIAN";;
132 + powerpc*) machine=ppc;;
133 + riscv32*) machine="generic32 -DL_ENDIAN";;
134 + riscv64*) machine="generic64 -DL_ENDIAN";;
135 + # sh64*) machine=elf;;
136 + sh*b*) machine="generic32 -DB_ENDIAN";;
137 + sh*) machine="generic32 -DL_ENDIAN";;
138 + # TODO: Might want to do -mcpu probing like glibc to determine a
139 + # better default for sparc-linux-gnu targets. This logic will
140 + # break v7 and older systems when they use it.
141 + sparc*v7*) machine="generic32 -DB_ENDIAN";;
142 + sparc64*) machine=sparcv9 system=linux64;;
143 + sparc*v9*) machine=sparcv9;;
144 + sparc*v8*) machine=sparcv8;;
145 + sparc*) machine=sparcv8;;
146 + s390x*) machine=s390x system=linux64;;
147 + s390*) machine="generic32 -DB_ENDIAN";;
148 + x86_64*:x32) machine=x32;;
149 + x86_64*) machine=x86_64;;
150 + esac
151 + ;;
152 +BSD)
153 + case ${chost_machine} in
154 + alpha*) machine=generic64;;
155 + i[6-9]86*) machine=x86-elf;;
156 + ia64*) machine=ia64;;
157 + sparc64*) machine=sparc64;;
158 + x86_64*) machine=x86_64;;
159 + *) machine=generic32;;
160 + esac
161 + ;;
162 +aix)
163 + machine=${compiler}
164 + ;;
165 +darwin)
166 + case ${chost_machine} in
167 + powerpc64) machine=ppc-cc; system=${system}64;;
168 + powerpc) machine=ppc-cc;;
169 + i?86*) machine=i386-cc;;
170 + x86_64) machine=x86_64-cc; system=${system}64;;
171 + esac
172 + ;;
173 +hpux)
174 + case ${chost_machine} in
175 + ia64) machine=ia64-${compiler} ;;
176 + esac
177 + ;;
178 +solaris)
179 + case ${chost_machine} in
180 + i386) machine=x86-${compiler} ;;
181 + x86_64*) machine=x86_64-${compiler}; system=${system}64;;
182 + sparcv9*) machine=sparcv9-${compiler}; system=${system}64;;
183 + sparc*) machine=sparcv8-${compiler};;
184 + esac
185 + ;;
186 +winnt)
187 + machine=parity
188 + ;;
189 +mingw*)
190 + # special case ... no xxx-yyy style name
191 + echo ${system}
192 + ;;
193 +esac
194 +
195 +
196 +# If we have something, show it
197 +[[ -n ${machine} ]] && echo ${system}-${machine}
198
199 diff --git a/net-analyzer/sslscan/sslscan-2.0.13-r1.ebuild b/net-analyzer/sslscan/sslscan-2.0.13-r1.ebuild
200 new file mode 100644
201 index 000000000000..956695f06f98
202 --- /dev/null
203 +++ b/net-analyzer/sslscan/sslscan-2.0.13-r1.ebuild
204 @@ -0,0 +1,82 @@
205 +# Copyright 1999-2022 Gentoo Authors
206 +# Distributed under the terms of the GNU General Public License v2
207 +
208 +EAPI=8
209 +
210 +inherit toolchain-funcs
211 +
212 +# sslscan builds against a static openssl library to allow weak ciphers
213 +# to be enabled so that they can be tested.
214 +OPENSSL_RELEASE_TAG="OpenSSL_1_1_1n"
215 +
216 +DESCRIPTION="Fast SSL configuration scanner"
217 +HOMEPAGE="https://github.com/rbsec/sslscan"
218 +SRC_URI="https://github.com/rbsec/sslscan/archive/${PV}.tar.gz -> ${P}.tar.gz
219 + https://github.com/openssl/openssl/archive/${OPENSSL_RELEASE_TAG}.tar.gz -> ${PN}-${OPENSSL_RELEASE_TAG}.tar.gz"
220 +
221 +LICENSE="GPL-3"
222 +SLOT="0"
223 +KEYWORDS="~amd64 ~x86"
224 +
225 +# Requires a docker environment
226 +RESTRICT="test"
227 +
228 +# S="${WORKDIR}/${P}-${MY_FORK}"
229 +
230 +src_prepare() {
231 + ln -s ../openssl-${OPENSSL_RELEASE_TAG} openssl || die
232 + touch .openssl_is_fresh || die
233 + sed -i -e '/openssl\/.git/,/fi/d' \
234 + -e '/openssl test/d' Makefile || die
235 +
236 + # Copied from dev-libs/openssl
237 + # allow openssl to be cross-compiled
238 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
239 + chmod a+rx gentoo.config || die
240 +
241 + default
242 +}
243 +
244 +src_configure() {
245 + # Copied from dev-libs/openssl
246 + unset APPS #197996
247 + unset SCRIPTS #312551
248 + unset CROSS_COMPILE #311473
249 +
250 + tc-export CC AR RANLIB RC
251 +
252 + local sslout=$(./gentoo.config)
253 + einfo "Use configuration ${sslout:-(openssl knows best)}"
254 + local config="Configure"
255 + [[ -z ${sslout} ]] && config="config"
256 +
257 + # Clean out hardcoded flags that openssl uses
258 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
259 + -e 's:^CFLAGS=::' \
260 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
261 + -e 's:\(^\| \)-O[^ ]*::g' \
262 + -e 's:\(^\| \)-march=[^ ]*::g' \
263 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
264 + -e 's:\(^\| \)-m[^ ]*::g' \
265 + -e 's:^ *::' \
266 + -e 's: *$::' \
267 + -e 's: \+: :g' \
268 + -e 's:\\:\\\\:g'
269 + )
270 +
271 + # Now insert clean default flags with user flags
272 + sed -i \
273 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
274 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
275 + Makefile || die
276 +}
277 +
278 +src_compile() {
279 + emake static
280 +}
281 +
282 +src_install() {
283 + DESTDIR="${D}" emake install
284 +
285 + dodoc Changelog README.md
286 +}