Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

64 lines
1.7 KiB

#!/bin/sh
set -e
openntpd_version=`cat VERSION`
# pull in latest upstream code
echo "pulling upstream openbsd source"
if [ ! -d openbsd ]; then
if [ -z "$OPENNTPD_GIT" ]; then
git clone https://github.com/openntpd-portable/openntpd-openbsd.git openbsd
else
git clone $OPENNTPD_GIT/openbsd
fi
fi
(cd openbsd
git checkout master
git pull --rebase)
# setup source paths
dir=`pwd`
patches=$dir/patches
libc_inc=$dir/openbsd/src/include
libc_src=$dir/openbsd/src/lib/libc
libcrypto_src=$dir/openbsd/src/lib/libcrypto
libutil_src=$dir/openbsd/src/lib/libutil
ntpd_src=$dir/openbsd/src/usr.sbin/ntpd
CP='cp -p'
PATCH='patch -p0 -s'
cp $libc_inc/md5.h include/md5_openbsd.h
cp $libc_inc/sha2.h include/sha2_openbsd.h
cp $libutil_src/imsg.h include/
cp $libutil_src/imsg.c compat/
cp $libutil_src/imsg-buffer.c compat/
(cd compat; $PATCH < $patches/patch-imsg.c)
for i in explicit_bzero.c strlcpy.c strlcat.c; do
$CP $libc_src/string/$i compat
done
$CP $libc_src/stdlib/reallocarray.c compat
$CP $libc_src/stdlib/strtonum.c compat
$CP $libc_src/crypt/arc4random.c compat
$CP $libc_src/crypt/arc4random_uniform.c compat
$CP $libc_src/crypt/chacha_private.h compat
$CP $libc_src/hash/md5.c compat
$CP $libc_src/hash/sha2.c compat
for i in $libcrypto_src/crypto/getentropy_*.c; do
sed -e 's/openssl\/sha.h/sha2.h/' < $i > compat/`basename $i`
done
$CP $libcrypto_src/crypto/arc4random_*.h compat
for i in client.c config.c control.c log.c log.h ntp.c ntp.h ntp_dns.c ntp_msg.c \
ntpd.c ntpd.h parse.y sensors.c server.c util.c \
ntpctl.8 ntpd.8 ntpd.conf.5 ; do
file=`basename $i`
echo Copying $file
$CP $ntpd_src/$i .
done
for i in patches/*.patch; do
echo Patching $i
$PATCH -p4 < $i
done