diff options
author | Sam James <sam@gentoo.org> | 2022-04-05 03:30:56 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-05-13 19:20:08 +0000 |
commit | 1548b15c4b6874f83ec08325f48a576ea4ba425f (patch) | |
tree | c64917d29b2e670a5d0d038c02b2fdcbeb520fe2 /net-analyzer/sslscan | |
parent | net-misc/curl: version bump to 7.83.1 (diff) | |
download | gentoo-1548b15c4b6874f83ec08325f48a576ea4ba425f.tar.gz gentoo-1548b15c4b6874f83ec08325f48a576ea4ba425f.tar.bz2 gentoo-1548b15c4b6874f83ec08325f48a576ea4ba425f.zip |
net-analyzer/sslscan: respect toolchain environment
Copy the needed bits from dev-libs/openssl.
Closes: https://bugs.gentoo.org/835436
Signed-off-by: Sam James <sam@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/24912
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-analyzer/sslscan')
-rw-r--r-- | net-analyzer/sslscan/files/gentoo.config-1.0.2 | 171 | ||||
-rw-r--r-- | net-analyzer/sslscan/sslscan-2.0.13-r1.ebuild | 82 |
2 files changed, 253 insertions, 0 deletions
diff --git a/net-analyzer/sslscan/files/gentoo.config-1.0.2 b/net-analyzer/sslscan/files/gentoo.config-1.0.2 new file mode 100644 index 000000000000..68d7d0ac1fc1 --- /dev/null +++ b/net-analyzer/sslscan/files/gentoo.config-1.0.2 @@ -0,0 +1,171 @@ +#!/usr/bin/env bash +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# +# Openssl doesn't play along nicely with cross-compiling +# like autotools based projects, so let's teach it new tricks. +# +# Review the bundled 'config' script to see why kind of targets +# we can pass to the 'Configure' script. + + +# Testing routines +if [[ $1 == "test" ]] ; then + for c in \ + "arm-gentoo-linux-uclibc |linux-generic32 -DL_ENDIAN" \ + "armv5b-linux-gnu |linux-armv4 -DB_ENDIAN" \ + "x86_64-pc-linux-gnu |linux-x86_64" \ + "alpha-linux-gnu |linux-alpha-gcc" \ + "alphaev56-unknown-linux-gnu |linux-alpha+bwx-gcc" \ + "i686-pc-linux-gnu |linux-elf" \ + "whatever-gentoo-freebsdX.Y |BSD-generic32" \ + "i686-gentoo-freebsdX.Y |BSD-x86-elf" \ + "sparc64-alpha-freebsdX.Y |BSD-sparc64" \ + "ia64-gentoo-freebsd5.99234 |BSD-ia64" \ + "x86_64-gentoo-freebsdX.Y |BSD-x86_64" \ + "hppa64-aldsF-linux-gnu5.3 |linux-generic32 -DB_ENDIAN" \ + "powerpc-gentOO-linux-uclibc |linux-ppc" \ + "powerpc64-unk-linux-gnu |linux-ppc64" \ + "powerpc64le-linux-gnu |linux-ppc64le" \ + "x86_64-apple-darwinX |darwin64-x86_64-cc" \ + "powerpc64-apple-darwinX |darwin64-ppc-cc" \ + "i686-apple-darwinX |darwin-i386-cc" \ + "i386-apple-darwinX |darwin-i386-cc" \ + "powerpc-apple-darwinX |darwin-ppc-cc" \ + "i586-pc-winnt |winnt-parity" \ + "s390-ibm-linux-gnu |linux-generic32 -DB_ENDIAN" \ + "s390x-linux-gnu |linux64-s390x" \ + ;do + CHOST=${c/|*} + ret_want=${c/*|} + ret_got=$(CHOST=${CHOST} "$0") + + if [[ ${ret_want} == "${ret_got}" ]] ; then + echo "PASS: ${CHOST}" + else + echo "FAIL: ${CHOST}" + echo -e "\twanted: ${ret_want}" + echo -e "\twe got: ${ret_got}" + fi + done + exit 0 +fi +[[ -z ${CHOST} && -n $1 ]] && CHOST=$1 + + +# Detect the operating system +case ${CHOST} in + *-aix*) system="aix";; + *-darwin*) system="darwin";; + *-freebsd*) system="BSD";; + *-hpux*) system="hpux";; + *-linux*) system="linux";; + *-solaris*) system="solaris";; + *-winnt*) system="winnt";; + x86_64-*-mingw*) system="mingw64";; + *mingw*) system="mingw";; + *) exit 0;; +esac + + +# Compiler munging +compiler="gcc" +if [[ ${CC} == "ccc" ]] ; then + compiler=${CC} +fi + + +# Detect target arch +machine="" +chost_machine=${CHOST%%-*} +case ${system} in +linux) + case ${chost_machine}:${ABI} in + aarch64*be*) machine="aarch64 -DB_ENDIAN";; + aarch64*) machine="aarch64 -DL_ENDIAN";; + alphaev56*|\ + alphaev[678]*)machine=alpha+bwx-${compiler};; + alpha*) machine=alpha-${compiler};; + armv[4-9]*b*) machine="armv4 -DB_ENDIAN";; + armv[4-9]*) machine="armv4 -DL_ENDIAN";; + arm*b*) machine="generic32 -DB_ENDIAN";; + arm*) machine="generic32 -DL_ENDIAN";; + avr*) machine="generic32 -DL_ENDIAN";; + bfin*) machine="generic32 -DL_ENDIAN";; + # hppa64*) machine=parisc64;; + hppa*) machine="generic32 -DB_ENDIAN";; + i[0-9]86*|\ + x86_64*:x86) machine=elf;; + ia64*) machine=ia64;; + m68*) machine="generic32 -DB_ENDIAN";; + mips*el*) machine="generic32 -DL_ENDIAN";; + mips*) machine="generic32 -DB_ENDIAN";; + powerpc64*le*)machine=ppc64le;; + powerpc64*) machine=ppc64;; + powerpc*le*) machine="generic32 -DL_ENDIAN";; + powerpc*) machine=ppc;; + riscv32*) machine="generic32 -DL_ENDIAN";; + riscv64*) machine="generic64 -DL_ENDIAN";; + # sh64*) machine=elf;; + sh*b*) machine="generic32 -DB_ENDIAN";; + sh*) machine="generic32 -DL_ENDIAN";; + # TODO: Might want to do -mcpu probing like glibc to determine a + # better default for sparc-linux-gnu targets. This logic will + # break v7 and older systems when they use it. + sparc*v7*) machine="generic32 -DB_ENDIAN";; + sparc64*) machine=sparcv9 system=linux64;; + sparc*v9*) machine=sparcv9;; + sparc*v8*) machine=sparcv8;; + sparc*) machine=sparcv8;; + s390x*) machine=s390x system=linux64;; + s390*) machine="generic32 -DB_ENDIAN";; + x86_64*:x32) machine=x32;; + x86_64*) machine=x86_64;; + esac + ;; +BSD) + case ${chost_machine} in + alpha*) machine=generic64;; + i[6-9]86*) machine=x86-elf;; + ia64*) machine=ia64;; + sparc64*) machine=sparc64;; + x86_64*) machine=x86_64;; + *) machine=generic32;; + esac + ;; +aix) + machine=${compiler} + ;; +darwin) + case ${chost_machine} in + powerpc64) machine=ppc-cc; system=${system}64;; + powerpc) machine=ppc-cc;; + i?86*) machine=i386-cc;; + x86_64) machine=x86_64-cc; system=${system}64;; + esac + ;; +hpux) + case ${chost_machine} in + ia64) machine=ia64-${compiler} ;; + esac + ;; +solaris) + case ${chost_machine} in + i386) machine=x86-${compiler} ;; + x86_64*) machine=x86_64-${compiler}; system=${system}64;; + sparcv9*) machine=sparcv9-${compiler}; system=${system}64;; + sparc*) machine=sparcv8-${compiler};; + esac + ;; +winnt) + machine=parity + ;; +mingw*) + # special case ... no xxx-yyy style name + echo ${system} + ;; +esac + + +# If we have something, show it +[[ -n ${machine} ]] && echo ${system}-${machine} diff --git a/net-analyzer/sslscan/sslscan-2.0.13-r1.ebuild b/net-analyzer/sslscan/sslscan-2.0.13-r1.ebuild new file mode 100644 index 000000000000..956695f06f98 --- /dev/null +++ b/net-analyzer/sslscan/sslscan-2.0.13-r1.ebuild @@ -0,0 +1,82 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +# sslscan builds against a static openssl library to allow weak ciphers +# to be enabled so that they can be tested. +OPENSSL_RELEASE_TAG="OpenSSL_1_1_1n" + +DESCRIPTION="Fast SSL configuration scanner" +HOMEPAGE="https://github.com/rbsec/sslscan" +SRC_URI="https://github.com/rbsec/sslscan/archive/${PV}.tar.gz -> ${P}.tar.gz + https://github.com/openssl/openssl/archive/${OPENSSL_RELEASE_TAG}.tar.gz -> ${PN}-${OPENSSL_RELEASE_TAG}.tar.gz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +# Requires a docker environment +RESTRICT="test" + +# S="${WORKDIR}/${P}-${MY_FORK}" + +src_prepare() { + ln -s ../openssl-${OPENSSL_RELEASE_TAG} openssl || die + touch .openssl_is_fresh || die + sed -i -e '/openssl\/.git/,/fi/d' \ + -e '/openssl test/d' Makefile || die + + # Copied from dev-libs/openssl + # allow openssl to be cross-compiled + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die + chmod a+rx gentoo.config || die + + default +} + +src_configure() { + # Copied from dev-libs/openssl + unset APPS #197996 + unset SCRIPTS #312551 + unset CROSS_COMPILE #311473 + + tc-export CC AR RANLIB RC + + local sslout=$(./gentoo.config) + einfo "Use configuration ${sslout:-(openssl knows best)}" + local config="Configure" + [[ -z ${sslout} ]] && config="config" + + # Clean out hardcoded flags that openssl uses + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \ + -e 's:^CFLAGS=::' \ + -e 's:\(^\| \)-fomit-frame-pointer::g' \ + -e 's:\(^\| \)-O[^ ]*::g' \ + -e 's:\(^\| \)-march=[^ ]*::g' \ + -e 's:\(^\| \)-mcpu=[^ ]*::g' \ + -e 's:\(^\| \)-m[^ ]*::g' \ + -e 's:^ *::' \ + -e 's: *$::' \ + -e 's: \+: :g' \ + -e 's:\\:\\\\:g' + ) + + # Now insert clean default flags with user flags + sed -i \ + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \ + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \ + Makefile || die +} + +src_compile() { + emake static +} + +src_install() { + DESTDIR="${D}" emake install + + dodoc Changelog README.md +} |