recipe 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # Build recipe for cups.
  2. #
  3. # Copyright (c) 2022 Matias Fonzo, <selk@dragora.rog>.
  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=cups
  19. version=2.4.2
  20. release=1
  21. # Define a category for the output of the package name
  22. pkgcategory=printing
  23. tarname=${program}-${version}-source.tar.gz
  24. # Remote source(s)
  25. fetch=https://github.com/OpenPrinting/cups/releases/download/v${version}/$tarname
  26. homepage=https://www.cups.org
  27. description="
  28. Common UNIX printing system.
  29. The Common UNIX Printing System (or CUPS) is a printing system and
  30. general replacement for lpd and the like. It supports the Internet
  31. Printing Protocol (IPP), and has its own filtering driver model for
  32. handling various document types.
  33. Visit the web site of CUPS at $homepage
  34. "
  35. license="Apache License version 2.0"
  36. # Source documentation
  37. docs="CHANGES.md CONTRIBUTING.md CREDITS.md DEVELOPING.md LICENSE NOTICE README.md SECURITY.md"
  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. # To look for passed 'libdir' below
  46. sed -e 's|$exec_prefix/lib/cups|$libdir/cups|g' -i configure
  47. ./configure CPPFLAGS="$QICPPFLAGS" \
  48. CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
  49. $configure_args \
  50. --libdir=/usr/lib${libSuffix} \
  51. --mandir=$mandir \
  52. --docdir=$docsdir \
  53. --enable-static=no \
  54. --enable-shared=yes \
  55. --enable-libpaper \
  56. --enable-tcp-wrappers \
  57. --enable-acl \
  58. --enable-relro \
  59. --disable-pam \
  60. --with-docdir=$docsdir \
  61. --with-pkgconfpath=/usr/lib${libSuffix}/pkgconfig \
  62. --with-dbusdir=/usr/share/dbus-1 \
  63. --with-logdir=/var/log/cups \
  64. --with-rcdir=/etc/cupsinit \
  65. --with-tls=gnutls \
  66. --with-ipp-port=631 \
  67. --build="$(gcc -dumpmachine)"
  68. make -j${jobs} V=1
  69. make -j${jobs} DESTDIR="$destdir" install
  70. # This "sysv stuff" is not suitable for us
  71. rm -rf "${destdir}/etc/cupsinit"
  72. # To handle (dot) .new files via graft(1)
  73. find "${destdir}/etc" -type d -print | while read -r directory
  74. do
  75. ( cd -- "$directory" && touch .graft-config )
  76. done
  77. # Install CUPS perp service
  78. mkdir -p "${destdir}/etc/perp/cupsd"
  79. cp -p "${worktree}/archive/cups/rc.log" \
  80. "${worktree}/archive/cups/rc.main" \
  81. "${destdir}/etc/perp/cupsd/"
  82. chmod 755 "${destdir}"/etc/perp/cupsd/rc.*
  83. # Do not enable cupsd by default
  84. chmod -t "${destdir}/etc/perp/cupsd"
  85. # To handle config file(s)
  86. touch "${destdir}/etc/perp/cupsd/.graft-config"
  87. # Compress and link man pages (if needed)
  88. if test -d "${destdir}/$mandir"
  89. then
  90. (
  91. cd "${destdir}/$mandir"
  92. find . -type f -exec lzip -9 {} +
  93. find . -type l | while read -r file
  94. do
  95. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  96. rm -- "$file"
  97. done
  98. )
  99. fi
  100. # Copy documentation
  101. mkdir -p "${destdir}/$docsdir"
  102. cp -p $docs "${destdir}/$docsdir"
  103. }