recipe 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # Build recipe for mesa.
  2. #
  3. # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
  4. # Copyright (c) 2017-2023 Matias Fonzo <selk@dragora.org>.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # Exit immediately on any error
  18. set -e
  19. program=mesa
  20. version=22.3.7
  21. release=2
  22. # Define a category for the output of the package name
  23. pkgcategory=xorg_mesa
  24. tarname=${program}-${version}.tar.xz
  25. # Remote source(s)
  26. fetch=https://archive.mesa3d.org/$tarname
  27. description="
  28. Mesa is an OpenGL compatible 3-D graphics library.
  29. The Mesa project began as an open-source implementation of the OpenGL
  30. specification - a system for rendering interactive 3D graphics.
  31. "
  32. homepage=https://www.mesa3d.org/
  33. license=MIT
  34. # Source documentation
  35. docs="CODEOWNERS README.rst VERSION"
  36. docsdir="${docdir}/${program}-${version}"
  37. build()
  38. {
  39. unpack "${tardir}/$tarname"
  40. cd "$srcdir"
  41. # To provide a few xdemos (Thanks to BLFS!)
  42. patch -p1 < "${worktree}/patches/mesa/mesa-22.2.4-add_xdemos-1.patch"
  43. # Apply patches to increment compatibility with Musl
  44. patch -Np1 -i "${worktree}/patches/mesa/musl-endian.patch"
  45. patch -Np1 -i "${worktree}/patches/mesa/musl.patch"
  46. patch -Np1 -i "${worktree}/patches/mesa/musl-stacksize.patch"
  47. patch -Np1 -i "${worktree}/patches/mesa/megadriver-symlinks.patch"
  48. # Set sane permissions
  49. chmod -R u+w,go-w,a+rX-s .
  50. rm -rf BUILD
  51. mkdir BUILD
  52. cd BUILD
  53. CPPFLAGS="$QICPPFLAGS" \
  54. CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
  55. meson setup $configure_args \
  56. --libdir /usr/lib${libSuffix} \
  57. --buildtype=release \
  58. --strip \
  59. -Ddri-drivers-path=/usr/lib${libSuffix}/dri \
  60. -Dglx=dri \
  61. -Dplatforms=x11 \
  62. -Dgallium-drivers=auto \
  63. -Dvulkan-drivers="" \
  64. -Dgallium-xa=enabled \
  65. -Dlmsensors=enabled \
  66. -Degl=enabled \
  67. -Dgles1=enabled \
  68. -Dgles2=enabled \
  69. -Ddri3=enabled \
  70. -Dosmesa=true \
  71. -Dopengl=true \
  72. -Dgallium-nine=true \
  73. -Dllvm=enabled \
  74. -Dshared-llvm=enabled \
  75. -Dshared-glapi=enabled \
  76. -Dvalgrind=disabled \
  77. -Db_lto=false \
  78. -Dcpp_std=gnu++14 \
  79. ..
  80. ninja -j${jobs}
  81. DESTDIR="$destdir" ninja -j${jobs} install
  82. unset -v MESA_GIT_SHA1_OVERRIDE
  83. cd ../
  84. # Handle .new files via graft(1), if any
  85. if test -d "${destdir}/etc"
  86. then
  87. touch "${destdir}/etc/.graft-config"
  88. fi
  89. touch "${destdir}/usr/share/drirc.d/.graft-config"
  90. # Compress and link man pages (if needed)
  91. if test -d "${destdir}/$mandir"
  92. then
  93. (
  94. cd "${destdir}/$mandir"
  95. find . -type f -exec lzip -9 {} +
  96. find . -type l | while read -r file
  97. do
  98. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  99. rm -- "$file"
  100. done
  101. )
  102. fi
  103. # Copy documentation
  104. mkdir -p "${destdir}/$docsdir"
  105. cp -p $docs "${destdir}/$docsdir"
  106. }