recipe 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # Build recipe for glib (release 2).
  2. #
  3. # Copyright (c) 2017-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
  25. # The installation of this package replaces to
  26. replace=glib2-pass1
  27. tarname=${program}-${version}.tar.xz
  28. # Remote source(s)
  29. fetch="https://download.gnome.org/sources/glib/${version%.*}/$tarname"
  30. description="
  31. General purpose library of C routines.
  32. GLib is the low-level core library that forms the basis for projects
  33. such as GTK+ and GNOME. It provides data structure handling for C,
  34. portability wrappers, and interfaces for such runtime functionality
  35. as an event loop, threads, dynamic loading, and an object system.
  36. "
  37. homepage=https://wiki.gnome.org/Projects/GLib
  38. license=LGPLv2+
  39. # Source documentation
  40. docs="CODE_OF_CONDUCT.md CONTRIBUTING.md HACKING NEWS README.md SECURITY.md"
  41. docsdir="${docdir}/${pkgname}-${version}"
  42. build()
  43. {
  44. unpack "${tardir}/$tarname"
  45. cd "$srcdir"
  46. # Apply a fix from "Alpine Linux"
  47. patch -Np1 -i "${worktree}/patches/glib2/0001-gquark-fix-initialization-with-c-constructors.patch"
  48. # Apply patch from "Beyond Linux From Scratch" to support 'GLIB_LOG_LEVEL'
  49. # which enables several warnings levels (Thank you!)
  50. patch -Np1 -i "${worktree}/patches/glib2/glib-2.74.6-skip_warnings-1.patch"
  51. # Apply a fix from "Alpine Linux"
  52. patch -Np1 -i "${worktree}/patches/glib2/0001-gslice-remove-slice-allocator.patch"
  53. # Set sane permissions
  54. chmod -R u+w,go-w,a+rX-s .
  55. rm -rf BUILD
  56. mkdir BUILD
  57. cd BUILD
  58. CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  59. meson setup $configure_args \
  60. --libdir /usr/lib${libSuffix} \
  61. --buildtype=release \
  62. --strip \
  63. -Dxattr=true \
  64. -Dlibmount=enabled \
  65. -Dman=true \
  66. -Dgtk_doc=false \
  67. -Dselinux=disabled \
  68. -Dtests=false \
  69. -Dinstalled_tests=false \
  70. ..
  71. ninja -j${jobs}
  72. DESTDIR="$destdir" ninja -j${jobs} install
  73. cd ..
  74. # Delete generated charset.alias
  75. rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
  76. # Include profile file
  77. mkdir -p "${destdir}/etc/profile.d"
  78. cp -p "${worktree}/archive/glib2/etc/profile.d/glib2.sh" \
  79. "${destdir}/etc/profile.d/"
  80. chmod 644 "${destdir}/etc/profile.d/glib2.sh"
  81. # To handle config file(s)
  82. touch "${destdir}/etc/profile.d/.graft-config"
  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. }