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. #!/usr/bin/env bash
  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/openbsd.git
  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. libc_inc=$dir/openbsd/src/include
  19. libc_src=$dir/openbsd/src/lib/libc
  20. libcrypto_src=$dir/openbsd/src/lib/libcrypto
  21. libutil_src=$dir/openbsd/src/lib/libutil
  22. ntpd_src=$dir/openbsd/src/usr.sbin/ntpd
  23. CP='cp -p'
  24. PATCH='patch -p0 -s'
  25. cp $libc_inc/md5.h include/md5_openbsd.h
  26. cp $libc_inc/sha2.h include/sha2_openbsd.h
  27. cp $libutil_src/imsg.h include/
  28. cp $libutil_src/imsg.c compat/
  29. cp $libutil_src/imsg-buffer.c compat/
  30. (cd compat; $PATCH < imsg.patch)
  31. for i in explicit_bzero.c strlcpy.c strlcat.c strndup.c strnlen.c; do
  32. $CP $libc_src/string/$i compat
  33. done
  34. $CP $libc_src/stdlib/reallocarray.c compat
  35. $CP $libc_src/stdlib/strtonum.c compat
  36. $CP $libc_src/crypt/arc4random.c compat
  37. $CP $libc_src/crypt/arc4random_uniform.c compat
  38. $CP $libc_src/crypt/chacha_private.h compat
  39. $CP $libc_src/hash/md5.c compat
  40. $CP $libc_src/hash/sha2.c compat
  41. for i in $libcrypto_src/crypto/getentropy_*.c; do
  42. sed -e 's/openssl\/sha.h/sha2.h/' < $i > compat/`basename $i`
  43. done
  44. $CP $libcrypto_src/crypto/arc4random_*.h compat
  45. for i in client.c config.c control.c log.c ntp.c ntp.h ntp_dns.c ntp_msg.c \
  46. ntpd.c ntpd.h parse.y sensors.c server.c util.c \
  47. ntpctl.8 ntpd.8 ntpd.conf.5 ; do
  48. echo Copying `basename $i`
  49. $CP $ntpd_src/$i .
  50. done
  51. $PATCH < client.patch
  52. $PATCH < config.patch
  53. $PATCH < ntp.patch
  54. $PATCH < ntpd.patch
  55. $PATCH < parse.patch
  56. $PATCH < server.patch
  57. $PATCH < util.patch