10085282bSDag-Erling Smørgrav#!/bin/sh 20085282bSDag-Erling Smørgrav# 30085282bSDag-Erling Smørgrav 40085282bSDag-Erling Smørgravconfigure_args=" 50085282bSDag-Erling Smørgrav --prefix=/usr 60085282bSDag-Erling Smørgrav --sysconfdir=/etc/ssh 70085282bSDag-Erling Smørgrav --with-pam 8ca04c57cSDag-Erling Smørgrav --with-ssl-dir=/usr 936cd1e5eSEd Maste --without-tcp-wrappers 100085282bSDag-Erling Smørgrav --with-libedit 110085282bSDag-Erling Smørgrav --with-ssl-engine 120085282bSDag-Erling Smørgrav --without-xauth 130085282bSDag-Erling Smørgrav" 140085282bSDag-Erling Smørgrav 150085282bSDag-Erling Smørgravset -e 160085282bSDag-Erling Smørgrav 17b319ead8SDag-Erling Smørgravopenssh=$(dirname $(realpath $0)) 18b319ead8SDag-Erling Smørgravcd $openssh 19b319ead8SDag-Erling Smørgrav 20b319ead8SDag-Erling Smørgrav# Run autotools before we drop LOCALBASE out of PATH 21b319ead8SDag-Erling Smørgrav(cd $openssh && libtoolize --copy && autoheader && autoconf) 22b319ead8SDag-Erling Smørgrav 23b319ead8SDag-Erling Smørgrav# Ensure we use the correct toolchain and clean our environment 24a0ee8cc6SDag-Erling Smørgravexport CC=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCC) 25a0ee8cc6SDag-Erling Smørgravexport CPP=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCPP) 26b319ead8SDag-Erling Smørgravunset CFLAGS CPPFLAGS LDFLAGS LD_LIBRARY_PATH LIBS 27ca04c57cSDag-Erling Smørgravexport PATH=/bin:/sbin:/usr/bin:/usr/sbin 28ca04c57cSDag-Erling Smørgrav 29b319ead8SDag-Erling Smørgrav# Generate config.h with krb5 and stash it 304fcbf74fSDag-Erling Smørgravsh configure $configure_args --with-kerberos5=/usr 315e4dd21fSEd Mastemv config.log config.log.kerberos5 325e4dd21fSEd Mastemv config.h config.h.kerberos5 330085282bSDag-Erling Smørgrav 3473104d58SEd Maste# Generate config.h with built-in security key support 3573104d58SEd Maste# 3673104d58SEd Maste# We install libcbor and libfido2 as PRIVATELIB, so the headers are not 3773104d58SEd Maste# available for configure - add their paths via CFLAGS as a slight hack. 3873104d58SEd Maste# configure.ac is also patched to specify -lprivatecbor and -lprivatefido2 3973104d58SEd Maste# rather than -lcbor and -lfido2. 4073104d58SEd Masteexport CFLAGS="-I$openssh/../../contrib/libcbor/src -I$openssh/../../contrib/libfido2/src" 4173104d58SEd Mastesh configure $configure_args --with-security-key-builtin 4273104d58SEd Masteunset CFLAGS 4373104d58SEd Mastemv config.log config.log.sk-builtin 4473104d58SEd Mastemv config.h config.h.sk-builtin 4573104d58SEd Maste 4673104d58SEd Maste# Generate config.h without krb5 or SK support 4773104d58SEd Mastesh configure $configure_args --without-kerberos5 --without-security-key-builtin 480085282bSDag-Erling Smørgrav 49b319ead8SDag-Erling Smørgrav# Extract the difference 505e4dd21fSEd Mastediff -u config.h.kerberos5 config.h | 510085282bSDag-Erling Smørgrav sed -n '/^-#define/s/^-//p' | 52*835ee05fSEd Maste grep -Ff /dev/stdin config.h.kerberos5 > krb5_config.h 5373104d58SEd Maste 5473104d58SEd Maste# Extract the difference - SK 5573104d58SEd Mastediff -u config.h.sk-builtin config.h | 5673104d58SEd Maste sed -n '/^-#define/s/^-//p' | 5773104d58SEd Maste grep -Ff /dev/stdin config.h.sk-builtin > sk_config.h 58