recipe 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # Build recipe for libunwind.
  2. #
  3. # Copyright (c) 2022-2023 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=libunwind
  19. version=20230323_5010beb0
  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="
  26. https://dragora.mirror.garr.it/current/sources/$tarname
  27. rsync://rsync.dragora.org/current/sources/$tarname
  28. "
  29. description="
  30. A C interface to determine the call-chain of a program.
  31. The primary goal of this project is to define a portable and efficient
  32. C programming interface (API) to determine the call-chain of a program.
  33. The API additionally provides the means to manipulate the preserved
  34. (callee-saved) state of each call-frame and to resume execution at any
  35. point in the call-chain (non-local goto). The API supports both local
  36. (same-process) and remote (across-process) operation. As such, the
  37. API is useful in a number of applications.
  38. "
  39. homepage=https://www.nongnu.org/libunwind/
  40. license=MIT
  41. # Source documentation
  42. docs="AUTHORS ChangeLog LICENSE NEWS README* TODO"
  43. docsdir="${docdir}/${program}-${version}"
  44. build()
  45. {
  46. unpack "${tardir}/$tarname"
  47. cd "$srcdir"
  48. # Apply some patches from "Alpine Linux"
  49. for patch in "${worktree}"/patches/libunwind/*.patch
  50. do
  51. if test -f "$patch"
  52. then
  53. echo " Applying patch file $patch ..."
  54. patch -Np1 -i "$patch"
  55. fi
  56. done
  57. unset -v patch
  58. # Update for hosts based on musl
  59. cp -f "${worktree}/archive/common/config.guess" config.guess
  60. cp -f "${worktree}/archive/common/config.sub" config.sub
  61. # Set sane permissions
  62. chmod -R u+w,go-w,a+rX-s .
  63. autoreconf -vif
  64. ./configure CPPFLAGS="$QICPPFLAGS" \
  65. CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" \
  66. LDFLAGS="$(echo "$QILDFLAGS" | sed 's/-s//')" \
  67. LDFLAGS="$QILDFLAGS -lucontext" \
  68. $configure_args \
  69. --libdir=/usr/lib${libSuffix} \
  70. --infodir=$infodir \
  71. --mandir=$mandir \
  72. --docdir=$docsdir \
  73. --enable-cxx-exceptions \
  74. --build="$(gcc -dumpmachine)"
  75. make -j${jobs} V=1
  76. make -j${jobs} DESTDIR="$destdir" install
  77. # Compress info documents deleting index file for the package
  78. if test -d "${destdir}/$infodir"
  79. then
  80. rm -f "${destdir}/${infodir}/dir"
  81. lzip -9 "${destdir}/${infodir}"/*
  82. fi
  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. }