recipe 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # Build recipe for glib (release 2, pass 1).
  2. #
  3. # Copyright (c) 2020-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=glib
  19. version=2.74.6
  20. release=1
  21. # Define a category for the output of the package name
  22. pkgcategory=libs
  23. # Set a custom name for this package
  24. pkgname=glib2-pass1
  25. tarname=${program}-${version}.tar.xz
  26. # Remote source(s)
  27. fetch="https://download.gnome.org/sources/glib/${version%.*}/$tarname"
  28. description="
  29. General purpose library of C routines.
  30. GLib is the low-level core library that forms the basis for projects
  31. such as GTK+ and GNOME. It provides data structure handling for C,
  32. portability wrappers, and interfaces for such runtime functionality
  33. as an event loop, threads, dynamic loading, and an object system.
  34. "
  35. homepage=https://wiki.gnome.org/Projects/GLib
  36. license=LGPLv2+
  37. # Source documentation
  38. docs="CODE_OF_CONDUCT.md CONTRIBUTING.md HACKING NEWS README.md SECURITY.md"
  39. docsdir="${docdir}/${pkgname}-${version}"
  40. build()
  41. {
  42. unpack "${tardir}/$tarname"
  43. cd "$srcdir"
  44. # Apply a fix from "Alpine Linux"
  45. patch -Np1 -i "${worktree}/patches/glib2/0001-gquark-fix-initialization-with-c-constructors.patch"
  46. # Apply patch from "Beyond Linux From Scratch" to support 'GLIB_LOG_LEVEL'
  47. # which enables several warnings levels (Thank you!)
  48. patch -Np1 -i "${worktree}/patches/glib2/glib-2.74.6-skip_warnings-1.patch"
  49. # Apply a fix from "Alpine Linux"
  50. patch -Np1 -i "${worktree}/patches/glib2/0001-gslice-remove-slice-allocator.patch"
  51. # Set sane permissions
  52. chmod -R u+w,go-w,a+rX-s .
  53. rm -rf BUILD
  54. mkdir BUILD
  55. cd BUILD
  56. CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  57. meson setup $configure_args \
  58. --libdir /usr/lib${libSuffix} \
  59. --buildtype=release \
  60. --strip \
  61. -Dxattr=true \
  62. -Dlibmount=enabled \
  63. -Dman=false \
  64. -Dgtk_doc=false \
  65. -Dselinux=disabled \
  66. -Dtests=false \
  67. -Dinstalled_tests=false \
  68. ..
  69. ninja -j${jobs}
  70. DESTDIR="$destdir" ninja -j${jobs} install
  71. cd ..
  72. # Delete generated charset.alias
  73. rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
  74. # Compress and link man pages (if needed)
  75. if test -d "${destdir}/$mandir"
  76. then
  77. (
  78. cd "${destdir}/$mandir"
  79. find . -type f -exec lzip -9 {} +
  80. find . -type l | while read -r file
  81. do
  82. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  83. rm -- "$file"
  84. done
  85. )
  86. fi
  87. # Copy documentation
  88. mkdir -p "${destdir}/$docsdir"
  89. cp -p $docs "${destdir}/$docsdir"
  90. }