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

  1. #!/bin/sh
  2. set -e
  3. openntpd_version=`cat VERSION`
  4. # pull in latest upstream code
  5. echo "pulling upstream openbsd source"
  6. if [ ! -d openbsd ]; then
  7. if [ -z "$OPENNTPD_GIT" ]; then
  8. git clone https://github.com/openntpd-portable/openntpd-openbsd.git openbsd
  9. else
  10. git clone $OPENNTPD_GIT/openbsd
  11. fi
  12. fi
  13. (cd openbsd
  14. git checkout master
  15. git pull --rebase)
  16. # setup source paths
  17. dir=`pwd`
  18. patches=$dir/patches
  19. libc_inc=$dir/openbsd/src/include
  20. libc_src=$dir/openbsd/src/lib/libc
  21. libcrypto_src=$dir/openbsd/src/lib/libcrypto
  22. libutil_src=$dir/openbsd/src/lib/libutil
  23. ntpd_src=$dir/openbsd/src/usr.sbin/ntpd
  24. CP='cp -p'
  25. PATCH='patch -p0 -s'
  26. cp $libc_inc/md5.h include/md5_openbsd.h
  27. cp $libc_inc/sha2.h include/sha2_openbsd.h
  28. cp $libutil_src/imsg.h include/
  29. cp $libutil_src/imsg.c compat/
  30. cp $libutil_src/imsg-buffer.c compat/
  31. (cd compat; $PATCH < $patches/patch-imsg.c)
  32. for i in explicit_bzero.c strlcpy.c strlcat.c; do
  33. $CP $libc_src/string/$i compat
  34. done
  35. $CP $libc_src/stdlib/reallocarray.c compat
  36. $CP $libc_src/stdlib/strtonum.c compat
  37. $CP $libc_src/crypt/arc4random.c compat
  38. $CP $libc_src/crypt/arc4random_uniform.c compat
  39. $CP $libc_src/crypt/chacha_private.h compat
  40. $CP $libc_src/hash/md5.c compat
  41. $CP $libc_src/hash/sha2.c compat
  42. for i in $libcrypto_src/crypto/getentropy_*.c; do
  43. sed -e 's/openssl\/sha.h/sha2.h/' < $i > compat/`basename $i`
  44. done
  45. $CP $libcrypto_src/crypto/arc4random_*.h compat
  46. for i in client.c config.c control.c log.c log.h ntp.c ntp.h ntp_dns.c ntp_msg.c \
  47. ntpd.c ntpd.h parse.y sensors.c server.c util.c \
  48. ntpctl.8 ntpd.8 ntpd.conf.5 ; do
  49. file=`basename $i`
  50. echo Copying $file
  51. $CP $ntpd_src/$i .
  52. done
  53. for i in patches/*.patch; do
  54. echo Patching $i
  55. $PATCH -p4 < $i
  56. done