recipe 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # Build recipe for socklog.
  2. #
  3. # Copyright (c) 2017 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. program=socklog
  17. version=2.1.0
  18. release=1
  19. # Set 'outdir' for a nice and well-organized output directory
  20. outdir="${outdir}/${arch}/daemons"
  21. tarname=${program}-${version}.tar.gz
  22. # Remote source(s)
  23. fetch=http://smarden.org/socklog/$tarname
  24. description="
  25. System and kernel logging services.
  26. Socklog is a small and secure replacement for syslogd. Socklog
  27. supports system logging through Unix domain sockets (/dev/log),
  28. UDP sockets (0.0.0.0:514), as well as TCP socket.
  29. Socklog provides a different network logging concept, and also
  30. does log event notification.
  31. Socklog is small, secure, and reliable.
  32. "
  33. homepage=http://smarden.org/socklog
  34. license=BSD
  35. # Source documentation
  36. docs="CHANGES COPYING README"
  37. docsdir="${docdir}/${program}-${version}"
  38. # Source directory used by this software
  39. srcdir=admin/${program}-${version}
  40. build()
  41. {
  42. set -e
  43. unpack "${tardir}/$tarname"
  44. cd "$srcdir"
  45. # Set sane permissions
  46. chmod -R u+w,go-w,a+rX-s .
  47. cd src
  48. patch -p1 < "${worktree}/patches/socklog/socklog-headers"
  49. patch -p1 < "${worktree}/patches/socklog/socklog-klogpath"
  50. cd -
  51. # Pick up our custom CFLAGS, LDFLAGS
  52. sed -i "s|gcc -O2|cc $QICFLAGS|" src/conf-cc
  53. sed -i "s|gcc -s|cc $QILDFLAGS -static|" src/conf-ld
  54. ./package/compile
  55. # Prepare the package, manually
  56. mkdir -p "${destdir}/usr/bin" "${destdir}/usr/sbin" \
  57. "${destdir}/${mandir}/man1" "${destdir}/${mandir}/man8"
  58. cp -p command/tryto command/uncat \
  59. "${destdir}/usr/bin"
  60. cp -p command/socklog-check command/socklog-conf command/socklog \
  61. "${destdir}/usr/sbin"
  62. cp -p man/*.1 "${destdir}/${mandir}/man1/"
  63. cp -p man/*.8 "${destdir}/${mandir}/man8/"
  64. # This is specific and related to the runit project
  65. rm -f "${destdir}/usr/sbin/socklog-conf" \
  66. "${destdir}/${mandir}/man8/socklog-conf.8"
  67. # Install socklog perp service(s)
  68. mkdir -p "${destdir}/etc/perp/socklog" "${destdir}/etc/perp/klog"
  69. cp -p "${worktree}/archive/socklog/rc.log" \
  70. "${worktree}/archive/socklog/rc.main" \
  71. "${destdir}/etc/perp/socklog/"
  72. cp -p "${worktree}/archive/socklog/klog/rc.log" \
  73. "${worktree}/archive/socklog/klog/rc.main" \
  74. "${destdir}/etc/perp/klog/"
  75. chmod 755 "${destdir}"/etc/perp/socklog/rc.* \
  76. "${destdir}"/etc/perp/klog/rc.*
  77. # Be an active service by default
  78. chmod +t "${destdir}/etc/perp/socklog" \
  79. "${destdir}/etc/perp/klog"
  80. # Include pre-configuration file for /var/log
  81. mkdir -p "${destdir}/var/log"
  82. (
  83. cd "${destdir}/var/log"
  84. umask 000
  85. tar xf "${worktree}/archive/socklog/socklog-config.tar.gz"
  86. )
  87. # To handle config file(s)
  88. touch "${destdir}/etc/perp/socklog/.graft-config" \
  89. "${destdir}/etc/perp/klog/.graft-config"
  90. (
  91. cd "${destdir}/var/log"
  92. find . -type f | while read -r file
  93. do
  94. touch "$(dirname -- "$file")/.graft-config"
  95. done
  96. )
  97. # Compress and copy documentation
  98. lzip -9 "${destdir}/${mandir}"/man?/*
  99. mkdir -p "${destdir}${docsdir}"
  100. for file in $docs
  101. do
  102. cp -p package/${file} "${destdir}${docsdir}"
  103. done
  104. }