recipe 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Build recipe for libucontext.
  2. #
  3. # Copyright (c) 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=libucontext
  19. version=1.2
  20. release=1
  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://distfiles.dereferenced.org/libucontext/$tarname
  26. description="
  27. Ucontext function implementations.
  28. libucontext is a library which provides the ucontext.h C API. Unlike other
  29. implementations, it faithfully follows the kernel process ABI when doing
  30. context swaps. Notably, when combined with gcompat, it provides a fully
  31. compatible implementation of the ucontext functions that are ABI compatible
  32. with Glibc.
  33. "
  34. homepage=https://github.com/kaniini/libucontext
  35. license=ISC
  36. # Source documentation
  37. docs="LICENSE NEWS README.md VERSION"
  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. # Set build architecture
  46. case $arch in
  47. arm*)
  48. libucontext_arch=arm
  49. ;;
  50. ppc64le*)
  51. libucontext_arch=ppc64
  52. ;;
  53. *)
  54. libucontext_arch="$(uname -m)"
  55. ;;
  56. esac
  57. make -j${jobs} \
  58. ARCH=$libucontext_arch \
  59. CFLAGS="$QICFLAGS -ggdb3 -O2 -Wall" \
  60. LDFLAGS="$(echo "$QILDFLAGS" | sed 's/-s//')" \
  61. LIBDIR=/usr/lib${libSuffix} \
  62. PKGCONFIGDIR=/usr/lib${libSuffix}/pkgconfig \
  63. all
  64. make -j${jobs} \
  65. ARCH=$libucontext_arch \
  66. CFLAGS="$QICFLAGS -ggdb3 -O2 -Wall" \
  67. LDFLAGS="$(echo "$QILDFLAGS" | sed 's/-s//')" \
  68. LIBDIR=/usr/lib${libSuffix} \
  69. PKGCONFIGDIR=/usr/lib${libSuffix}/pkgconfig \
  70. DESTDIR="$destdir" \
  71. install
  72. unset -v libucontext_arch
  73. # Compress and link man pages (if needed)
  74. if test -d "${destdir}/$mandir"
  75. then
  76. (
  77. cd "${destdir}/$mandir"
  78. find . -type f -exec lzip -9 {} +
  79. find . -type l | while read -r file
  80. do
  81. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  82. rm -- "$file"
  83. done
  84. )
  85. fi
  86. # Copy documentation
  87. mkdir -p "${destdir}/$docsdir"
  88. cp -p $docs "${destdir}/$docsdir"
  89. }