recipe 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Build recipe for libdatrie.
  2. #
  3. # Copyright (C) 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=libdatrie
  19. version=0.2.13
  20. release=2
  21. # Define a category for the output of the package name
  22. pkgcategory=libs
  23. tarname=${program}-${version}.tar.xz
  24. # Remote source(s)
  25. fetch=https://github.com/tlwg/libdatrie/releases/download/v${version}/$tarname
  26. description="
  27. A double-Array Trie library.
  28. libdatrie is an implementation of double-array structure for
  29. representing trie, as proposed by Junichi Aoe. Trie is a
  30. kind of digital search tree, an efficient indexing method with
  31. O(1) time complexity for searching. Comparably as efficient as
  32. hashing, trie also provides flexibility on incremental matching
  33. and key spelling manipulation. This makes it ideal for
  34. lexical analyzers, as well as spelling dictionaries.
  35. See the details of the implementation at:
  36. https://linux.thai.net/~thep/datrie/datrie.html
  37. Historically, this was first implemented as C++ classes in a
  38. library called midatrie, but later simplified and rewritten
  39. from scratch in C.
  40. "
  41. homepage=https://linux.thai.net/projects/datrie
  42. license=LGPLv2.1
  43. # Copy documentation
  44. docs="AUTHORS COPYING ChangeLog NEWS README*"
  45. docsdir="${docdir}/${program}-${version}"
  46. build()
  47. {
  48. unpack "${tardir}/$tarname"
  49. cd "$srcdir"
  50. # Set sane permissions
  51. chmod -R u+w,go-w,a+rX-s .
  52. ./configure \
  53. CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  54. $configure_args \
  55. --libdir=/usr/lib${libSuffix} \
  56. --mandir=$mandir \
  57. --docdir=$docsdir \
  58. --enable-static=no \
  59. --enable-shared=yes \
  60. --build="$(gcc -dumpmachine)"
  61. make -j${jobs} V=1
  62. make -j${jobs} DESTDIR="$destdir" install-strip
  63. # Build and install the trietool utility
  64. ( cd tools/ && make install DESTDIR="$destdir" install-strip )
  65. # Copy the rest of the documentation
  66. mkdir -p "${destdir}/$docsdir"
  67. cp -p -f $docs "${destdir}/$docsdir"
  68. # Compress and link man pages (if needed)
  69. if test -d "${destdir}/$mandir"
  70. then
  71. (
  72. cd "${destdir}/$mandir"
  73. find . -type f -exec lzip -9 {} +
  74. find . -type l | while read -r file
  75. do
  76. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  77. rm -- "$file"
  78. done
  79. )
  80. fi
  81. }