2021-04-23 06:53:32 +02:00
|
|
|
#!/bin/sh
|
2020-08-05 19:00:52 +02:00
|
|
|
|
2021-10-22 05:00:05 +02:00
|
|
|
. .github/configs $@
|
|
|
|
|
2021-09-29 11:30:59 +02:00
|
|
|
case "`./config.guess`" in
|
2021-01-08 04:26:32 +01:00
|
|
|
*-darwin*)
|
2021-01-12 09:22:47 +01:00
|
|
|
brew install automake
|
2021-01-08 04:26:32 +01:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-08-05 19:00:52 +02:00
|
|
|
TARGETS=$@
|
|
|
|
|
|
|
|
PACKAGES=""
|
|
|
|
INSTALL_FIDO_PPA="no"
|
2021-09-23 23:03:18 +02:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2020-08-05 19:00:52 +02:00
|
|
|
|
|
|
|
#echo "Setting up for '$TARGETS'"
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
lsb_release -a
|
|
|
|
|
2021-02-17 08:41:30 +01:00
|
|
|
if [ "${TARGETS}" = "kitchensink" ]; then
|
2021-10-22 14:27:41 +02:00
|
|
|
TARGETS="krb5 libedit pam sk selinux"
|
2021-02-17 08:41:30 +01:00
|
|
|
fi
|
|
|
|
|
2021-10-22 00:42:14 +02:00
|
|
|
for flag in $CONFIGFLAGS; do
|
|
|
|
case "$flag" in
|
|
|
|
--with-pam) PACKAGES="${PACKAGES} libpam0g-dev" ;;
|
|
|
|
--with-libedit) PACKAGES="${PACKAGES} libedit-dev" ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2020-08-05 19:00:52 +02:00
|
|
|
for TARGET in $TARGETS; do
|
|
|
|
case $TARGET in
|
2021-10-22 00:42:14 +02:00
|
|
|
default|without-openssl|without-zlib|c89|libedit|*pam)
|
2020-08-05 19:00:52 +02:00
|
|
|
# nothing to do
|
|
|
|
;;
|
2021-09-29 03:36:13 +02:00
|
|
|
clang-*|gcc-*)
|
2021-10-21 07:53:39 +02:00
|
|
|
compiler=$(echo $TARGET | sed 's/-Werror//')
|
2021-10-21 06:33:27 +02:00
|
|
|
PACKAGES="$PACKAGES $compiler"
|
2021-09-29 03:36:13 +02:00
|
|
|
;;
|
2021-10-22 13:54:33 +02:00
|
|
|
krb5)
|
|
|
|
PACKAGES="$PACKAGES libkrb5-dev"
|
|
|
|
;;
|
|
|
|
heimdal)
|
2020-08-05 19:00:52 +02:00
|
|
|
PACKAGES="$PACKAGES heimdal-dev"
|
|
|
|
;;
|
2021-02-17 08:41:30 +01:00
|
|
|
sk)
|
2020-08-05 19:00:52 +02:00
|
|
|
INSTALL_FIDO_PPA="yes"
|
2021-04-05 15:46:42 +02:00
|
|
|
PACKAGES="$PACKAGES libfido2-dev libu2f-host-dev libcbor-dev"
|
2020-08-05 19:00:52 +02:00
|
|
|
;;
|
2021-02-17 08:41:30 +01:00
|
|
|
selinux)
|
2020-08-05 19:00:52 +02:00
|
|
|
PACKAGES="$PACKAGES libselinux1-dev selinux-policy-dev"
|
|
|
|
;;
|
2021-02-17 08:41:30 +01:00
|
|
|
hardenedmalloc)
|
2021-01-08 14:36:05 +01:00
|
|
|
INSTALL_HARDENED_MALLOC=yes
|
2021-10-12 13:55:51 +02:00
|
|
|
;;
|
2022-02-18 02:12:21 +01:00
|
|
|
musl)
|
|
|
|
PACKAGES="$PACKAGES musl-tools"
|
|
|
|
;;
|
2021-10-12 13:55:51 +02:00
|
|
|
tcmalloc)
|
|
|
|
PACKAGES="$PACKAGES libgoogle-perftools-dev"
|
|
|
|
;;
|
2021-04-26 07:34:23 +02:00
|
|
|
openssl-noec)
|
|
|
|
INSTALL_OPENSSL=OpenSSL_1_1_1k
|
|
|
|
SSLCONFOPTS="no-ec"
|
|
|
|
;;
|
2021-04-26 06:02:03 +02:00
|
|
|
openssl-*)
|
|
|
|
INSTALL_OPENSSL=$(echo ${TARGET} | cut -f2 -d-)
|
|
|
|
case ${INSTALL_OPENSSL} in
|
2021-09-08 13:09:49 +02:00
|
|
|
1.1.1_stable) INSTALL_OPENSSL="OpenSSL_1_1_1-stable" ;;
|
2021-04-26 06:02:03 +02:00
|
|
|
1.*) INSTALL_OPENSSL="OpenSSL_$(echo ${INSTALL_OPENSSL} | tr . _)" ;;
|
|
|
|
3.*) INSTALL_OPENSSL="openssl-${INSTALL_OPENSSL}" ;;
|
|
|
|
esac
|
2021-04-26 06:29:03 +02:00
|
|
|
PACKAGES="${PACKAGES} putty-tools"
|
2021-01-28 04:31:01 +01:00
|
|
|
;;
|
2021-04-26 06:02:03 +02:00
|
|
|
libressl-*)
|
|
|
|
INSTALL_LIBRESSL=$(echo ${TARGET} | cut -f2 -d-)
|
|
|
|
case ${INSTALL_LIBRESSL} in
|
|
|
|
master) ;;
|
2022-03-26 12:01:31 +01:00
|
|
|
*) INSTALL_LIBRESSL="$(echo ${TARGET} | cut -f2 -d-)" ;;
|
2021-04-26 06:02:03 +02:00
|
|
|
esac
|
2021-04-26 06:29:03 +02:00
|
|
|
PACKAGES="${PACKAGES} putty-tools"
|
2021-01-28 04:31:01 +01:00
|
|
|
;;
|
2021-02-21 22:09:27 +01:00
|
|
|
valgrind*)
|
2021-02-19 00:16:56 +01:00
|
|
|
PACKAGES="$PACKAGES valgrind"
|
|
|
|
;;
|
2021-01-08 14:36:05 +01:00
|
|
|
*) echo "Invalid option '${TARGET}'"
|
2020-08-05 19:00:52 +02:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-04-23 11:49:46 +02:00
|
|
|
if [ "yes" = "$INSTALL_FIDO_PPA" ]; then
|
2020-08-05 19:00:52 +02:00
|
|
|
sudo apt update -qq
|
2021-09-23 23:03:18 +02:00
|
|
|
sudo apt install -qy software-properties-common
|
|
|
|
sudo apt-add-repository -y ppa:yubico/stable
|
2020-08-05 19:00:52 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "x" != "x$PACKAGES" ]; then
|
|
|
|
sudo apt update -qq
|
|
|
|
sudo apt install -qy $PACKAGES
|
|
|
|
fi
|
2021-01-08 14:36:05 +01:00
|
|
|
|
|
|
|
if [ "${INSTALL_HARDENED_MALLOC}" = "yes" ]; then
|
|
|
|
(cd ${HOME} &&
|
|
|
|
git clone https://github.com/GrapheneOS/hardened_malloc.git &&
|
|
|
|
cd ${HOME}/hardened_malloc &&
|
2022-01-11 10:56:01 +01:00
|
|
|
make -j2 && sudo cp out/libhardened_malloc.so /usr/lib/)
|
2021-01-08 14:36:05 +01:00
|
|
|
fi
|
2021-01-28 04:31:01 +01:00
|
|
|
|
2021-04-26 06:02:03 +02:00
|
|
|
if [ ! -z "${INSTALL_OPENSSL}" ]; then
|
2021-01-28 04:31:01 +01:00
|
|
|
(cd ${HOME} &&
|
|
|
|
git clone https://github.com/openssl/openssl.git &&
|
|
|
|
cd ${HOME}/openssl &&
|
2021-04-27 01:18:02 +02:00
|
|
|
git checkout ${INSTALL_OPENSSL} &&
|
2021-04-27 04:24:10 +02:00
|
|
|
./config no-threads shared ${SSLCONFOPTS} \
|
2021-04-27 01:18:02 +02:00
|
|
|
--prefix=/opt/openssl &&
|
|
|
|
make && sudo make install_sw)
|
2021-01-28 04:31:01 +01:00
|
|
|
fi
|
|
|
|
|
2021-04-26 06:02:03 +02:00
|
|
|
if [ ! -z "${INSTALL_LIBRESSL}" ]; then
|
2022-03-26 06:28:04 +01:00
|
|
|
if [ "${INSTALL_LIBRESSL}" = "master" ]; then
|
|
|
|
(mkdir -p ${HOME}/libressl && cd ${HOME}/libressl &&
|
|
|
|
git clone https://github.com/libressl-portable/portable.git &&
|
|
|
|
cd ${HOME}/libressl/portable &&
|
|
|
|
git checkout ${INSTALL_LIBRESSL} &&
|
|
|
|
sh update.sh && sh autogen.sh &&
|
|
|
|
./configure --prefix=/opt/libressl &&
|
|
|
|
make -j2 && sudo make install)
|
|
|
|
else
|
2022-03-26 12:01:31 +01:00
|
|
|
LIBRESSL_URLBASE=https://cdn.openbsd.org/pub/OpenBSD/LibreSSL
|
2022-03-26 06:28:04 +01:00
|
|
|
(cd ${HOME} &&
|
|
|
|
wget ${LIBRESSL_URLBASE}/libressl-${INSTALL_LIBRESSL}.tar.gz &&
|
|
|
|
tar xfz libressl-${INSTALL_LIBRESSL}.tar.gz &&
|
|
|
|
cd libressl-${INSTALL_LIBRESSL} &&
|
|
|
|
./configure --prefix=/opt/libressl && make -j2 && sudo make install)
|
|
|
|
fi
|
2021-01-28 04:31:01 +01:00
|
|
|
fi
|