recipe 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # Build recipe for openssh.
  2. #
  3. # Copyright (c) 2018-2019, 2021-2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # Exit immediately on any error
  17. set -e
  18. program=openssh
  19. version=8.8p1
  20. release=1
  21. # Define a category for the output of the package name
  22. pkgcategory=networking
  23. tarname=${program}-${version}.tar.gz
  24. # Remote source(s)
  25. fetch=https://ftp3.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/$tarname
  26. description="
  27. The OpenSSH suite.
  28. OpenSSH is the premier connectivity tool for remote login with the
  29. SSH protocol. It encrypts all traffic to eliminate eavesdropping,
  30. connection hijacking, and other attacks. In addition, OpenSSH provides
  31. a large suite of secure tunneling capabilities, several authentication
  32. methods, and sophisticated configuration options.
  33. "
  34. homepage=https://www.openssh.com
  35. license=Custom
  36. # Source documentation
  37. docs="CREDITS ChangeLog LICENCE OVERVIEW PROTOCOL* README* TODO"
  38. docsdir="${docdir}/${program}-${version}"
  39. build()
  40. {
  41. unpack "${tardir}/$tarname"
  42. cd "$srcdir"
  43. # Set sane permissions
  44. chmod -R u+w,go-w,a+rX-s .
  45. # A patch from Dragora to include a missing header at md5crypt.c file
  46. patch -p1 < "${worktree}/patches/openssh/openssh-include-stdio.h.patch"
  47. ./configure CPPFLAGS="$QICPPFLAGS" \
  48. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" LIBS="-ledit" \
  49. $configure_args \
  50. --libdir=/usr/lib${libSuffix} \
  51. --sysconfdir=/etc/ssh \
  52. --mandir=$mandir \
  53. --docdir=$docsdir \
  54. --enable-strip \
  55. --with-default-path='/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin' \
  56. --with-privsep-path=/var/lib/sshd \
  57. --with-privsep-user=sshd \
  58. --with-pid-dir=/var/run/sshd \
  59. --with-md5-passwords \
  60. --with-pie \
  61. --without-zlib-version-check \
  62. --build="$(gcc -dumpmachine)"
  63. make -j${jobs} V=1
  64. make -j${jobs} DESTDIR="$destdir" install
  65. # Make empty directories for the package
  66. mkdir -p "${destdir}/var/run/sshd" "${destdir}/var/lib/sshd"
  67. # Copy additional utilities
  68. cp -p contrib/ssh-copy-id "${destdir}/usr/bin"
  69. chmod 755 "${destdir}/usr/bin/ssh-copy-id"
  70. mkdir -p "${destdir}/${mandir}/man1"
  71. cp -p contrib/ssh-copy-id.1 "${destdir}/${mandir}/man1"
  72. # Install sshd perp service(s)
  73. mkdir -p "${destdir}/etc/perp/sshd"
  74. cp -p "${worktree}/archive/openssh/rc.log" \
  75. "${worktree}/archive/openssh/rc.main" \
  76. "${destdir}/etc/perp/sshd/"
  77. chmod 755 "${destdir}"/etc/perp/sshd/rc.*
  78. # THIS SERVICE IS DISABLED BY DEFAULT
  79. chmod -t "${destdir}/etc/perp/sshd"
  80. # Manage (dot) new files via graft(1)
  81. touch "${destdir}/etc/ssh/.graft-config" \
  82. "${destdir}/etc/perp/sshd/.graft-config"
  83. # Compress and link man pages (if needed)
  84. if test -d "${destdir}/$mandir"
  85. then
  86. (
  87. cd "${destdir}/$mandir"
  88. find . -type f -exec lzip -9 {} +
  89. find . -type l | while read -r file
  90. do
  91. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  92. rm -- "$file"
  93. done
  94. )
  95. fi
  96. # Copy documentation
  97. mkdir -p "${destdir}/$docsdir"
  98. cp -p $docs "${destdir}/$docsdir"
  99. }