recipe 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # Build recipe for libpsl.
  2. #
  3. # Copyright (c) 2021 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=libpsl
  19. version=0.21.1
  20. release=1
  21. # Define a category for the output of the package name
  22. pkgcategory=libs
  23. tarname=${program}-${version}.tar.lz
  24. # Remote source(s)
  25. fetch=https://github.com/rockdaboot/libpsl/releases/download/${version}/$tarname
  26. description="
  27. A C library to handle the Public Suffix List.
  28. A Public Suffix List is a collection of Top Level Domains (TLDs) suffixes.
  29. TLDs include Global Top Level Domains (gTLDs) like .com and .net; Country
  30. Top Level Domains (ccTLDs) like .de and .cn; and Brand Top Level Domains
  31. like .apple and .google. Brand TLDs allows users to register their own top
  32. level domain that exist at the same level as ICANN's gTLDs.
  33. Brand TLDs are sometimes referred to as Vanity Domains.
  34. "
  35. homepage=https://github.com/rockdaboot/libpsl
  36. license=MIT
  37. # Source documentation
  38. docs="AUTHORS COPYING LICENSE NEWS"
  39. docsdir="${docdir}/${program}-${version}"
  40. build()
  41. {
  42. unpack "${tardir}/$tarname"
  43. cd "$srcdir"
  44. # Set sane permissions
  45. chmod -R u+w,go-w,a+rX-s .
  46. # https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat
  47. #
  48. # Follow the example of Slackware, by installing the public list instead of
  49. # creating a separate package so that the build can proceed, which after all
  50. # will be overwritten. We also follow the Fedora example for the
  51. # configuration of this package. Thank you. :-)
  52. if test ! -r /usr/share/publicsuffix/public_suffix_list.dat
  53. then
  54. mkdir -p /usr/share/publicsuffix
  55. install -p -m 644 -o root -g root \
  56. "${worktree}"/archive/libpsl/public_suffix_list.dat \
  57. /usr/share/publicsuffix/
  58. (
  59. cd /usr/share/publicsuffix && \
  60. ln -sf public_suffix_list.dat effective_tld_names.dat
  61. )
  62. install -p -m 644 -o root -g root \
  63. list/tests/tests.txt /usr/share/publicsuffix/test_psl.txt
  64. fi
  65. # Force to make use of Python v3
  66. # (Thanks to "Beyond Linux From Scratch")
  67. sed -i 's/env python/&3/' src/psl-make-dafsa
  68. ./configure CPPFLAGS="$QICPPFLAGS" \
  69. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  70. $configure_args \
  71. --libdir=/usr/lib${libSuffix} \
  72. --mandir=$mandir \
  73. --docdir=$docsdir \
  74. --enable-static=no \
  75. --enable-shared=yes \
  76. --disable-doc \
  77. --enable-man \
  78. --enable-builtin=libicu \
  79. --enable-runtime=libidn2 \
  80. --with-psl-distfile=/usr/share/publicsuffix/public_suffix_list.dafsa \
  81. --with-psl-file=/usr/share/publicsuffix/effective_tld_names.dat \
  82. --with-psl-testfile=/usr/share/publicsuffix/test_psl.txt \
  83. --build="$(gcc -dumpmachine)"
  84. make -j${jobs} V=1
  85. make -j${jobs} DESTDIR="$destdir" install-strip
  86. # Delete generated charset.alias
  87. rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
  88. rmdir "${destdir}/usr/lib${libSuffix}/" 2> /dev/null || true
  89. # Compress and link man pages (if needed)
  90. if test -d "${destdir}/$mandir"
  91. then
  92. (
  93. cd "${destdir}/$mandir"
  94. find . -type f -exec lzip -9 {} +
  95. find . -type l | while read -r file
  96. do
  97. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  98. rm -- "$file"
  99. done
  100. )
  101. fi
  102. # Copy documentation
  103. mkdir -p "${destdir}/$docsdir"
  104. cp -p $docs "${destdir}/$docsdir"
  105. }