2020-08-05 17:00:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-01-08 03:26:32 +00:00
|
|
|
case $(./config.guess) in
|
|
|
|
*-darwin*)
|
2021-01-12 08:22:47 +00:00
|
|
|
brew install automake
|
2021-01-08 03:26:32 +00:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-08-05 17:00:52 +00:00
|
|
|
TARGETS=$@
|
|
|
|
|
|
|
|
PACKAGES=""
|
|
|
|
INSTALL_FIDO_PPA="no"
|
|
|
|
|
|
|
|
#echo "Setting up for '$TARGETS'"
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
lsb_release -a
|
|
|
|
|
|
|
|
for TARGET in $TARGETS; do
|
|
|
|
case $TARGET in
|
2021-01-28 03:31:01 +00:00
|
|
|
""|--without-openssl|--without-zlib|--with-Werror|--with-rpath*)
|
2020-08-05 17:00:52 +00:00
|
|
|
# nothing to do
|
|
|
|
;;
|
|
|
|
"--with-kerberos5")
|
|
|
|
PACKAGES="$PACKAGES heimdal-dev"
|
|
|
|
#PACKAGES="$PACKAGES libkrb5-dev"
|
|
|
|
;;
|
|
|
|
"--with-libedit")
|
|
|
|
PACKAGES="$PACKAGES libedit-dev"
|
|
|
|
;;
|
|
|
|
"--with-pam")
|
|
|
|
PACKAGES="$PACKAGES libpam0g-dev"
|
|
|
|
;;
|
|
|
|
"--with-security-key-builtin")
|
|
|
|
INSTALL_FIDO_PPA="yes"
|
|
|
|
PACKAGES="$PACKAGES libfido2-dev libu2f-host-dev"
|
|
|
|
;;
|
|
|
|
"--with-selinux")
|
|
|
|
PACKAGES="$PACKAGES libselinux1-dev selinux-policy-dev"
|
|
|
|
;;
|
2021-01-08 13:36:05 +00:00
|
|
|
"--with-ldflags=-lhardened_malloc")
|
|
|
|
INSTALL_HARDENED_MALLOC=yes
|
|
|
|
;;
|
2021-01-28 03:31:01 +00:00
|
|
|
"--with-ssl-dir=/opt/openssl/head")
|
|
|
|
INSTALL_OPENSSL_HEAD=yes
|
|
|
|
;;
|
|
|
|
"--with-ssl-dir=/opt/libressl/head")
|
|
|
|
INSTALL_LIBRESSL_HEAD=yes
|
|
|
|
;;
|
2021-01-08 13:36:05 +00:00
|
|
|
*) echo "Invalid option '${TARGET}'"
|
2020-08-05 17:00:52 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "yes" == "$INSTALL_FIDO_PPA" ]; then
|
|
|
|
sudo apt update -qq
|
|
|
|
sudo apt install software-properties-common
|
|
|
|
sudo apt-add-repository ppa:yubico/stable
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "x" != "x$PACKAGES" ]; then
|
|
|
|
sudo apt update -qq
|
|
|
|
sudo apt install -qy $PACKAGES
|
|
|
|
fi
|
2021-01-08 13:36:05 +00:00
|
|
|
|
|
|
|
if [ "${INSTALL_HARDENED_MALLOC}" = "yes" ]; then
|
|
|
|
(cd ${HOME} &&
|
|
|
|
git clone https://github.com/GrapheneOS/hardened_malloc.git &&
|
|
|
|
cd ${HOME}/hardened_malloc &&
|
2021-01-28 09:55:16 +00:00
|
|
|
make -j2 && sudo cp libhardened_malloc.so /usr/lib/)
|
2021-01-08 13:36:05 +00:00
|
|
|
fi
|
2021-01-28 03:31:01 +00:00
|
|
|
|
|
|
|
if [ "${INSTALL_OPENSSL_HEAD}" = "yes" ];then
|
|
|
|
(cd ${HOME} &&
|
|
|
|
git clone https://github.com/openssl/openssl.git &&
|
|
|
|
cd ${HOME}/openssl &&
|
|
|
|
./config no-threads no-engine no-fips no-shared --prefix=/opt/openssl/head &&
|
2021-01-28 09:55:16 +00:00
|
|
|
make -j2 && sudo make install_sw)
|
2021-01-28 03:31:01 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${INSTALL_LIBRESSL_HEAD}" = "yes" ];then
|
|
|
|
(mkdir -p ${HOME}/libressl && cd ${HOME}/libressl &&
|
|
|
|
git clone https://github.com/libressl-portable/portable.git &&
|
|
|
|
cd ${HOME}/libressl/portable && sh update.sh && sh autogen.sh &&
|
|
|
|
./configure --prefix=/opt/libressl/head &&
|
2021-01-28 09:55:16 +00:00
|
|
|
make -j2 && sudo make install_sw)
|
2021-01-28 03:31:01 +00:00
|
|
|
fi
|