recipe 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Build recipe for GNU Linux-libre headers.
  2. #
  3. # Copyright (c) 2015-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=linux-libre
  19. # Set 'version' and 'release' for supported architectures
  20. case "$(uname -m)" in
  21. i?86)
  22. version=4.14.281
  23. release=1
  24. _gnu_suffix="gnu1"
  25. ;;
  26. *)
  27. version=5.16.20
  28. release=2
  29. _gnu_suffix="gnu"
  30. ;;
  31. esac
  32. # Define a category for the output of the package name
  33. pkgcategory=kernel
  34. # Use a custom package name
  35. pkgname=linux-libre-headers
  36. tarname=${program}-${version}-${_gnu_suffix}.tar.lz
  37. # Remote source(s)
  38. fetch=https://linux-libre.fsfla.org/pub/linux-libre/releases/${version}-${_gnu_suffix}/$tarname
  39. description="
  40. The GNU Linux-libre headers (${arch}).
  41. This package contains the Linux headers provided by the GNU Linux-libre
  42. project to expose the kernel's API.
  43. "
  44. homepage=https://www.gnu.org/software/linux-libre
  45. license="GPLv2 only"
  46. # Limit parallel jobs for the compiler
  47. jobs=1
  48. # To match 'srcdir'
  49. srcdir=linux-${version}
  50. build()
  51. {
  52. unpack "${tardir}/$tarname"
  53. unset -v _gnu_suffix
  54. cd "$srcdir"
  55. patch -p1 < "${worktree}/patches/linux-headers/revert-broken-uapi.patch"
  56. patch -p1 < "${worktree}/patches/linux-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch"
  57. # Set sane permissions
  58. chmod -R u+w,go-w,a+rX-s .
  59. make -j${jobs} mrproper
  60. make -j${jobs} headers || make -j${jobs} headers_check
  61. # Holy molly... the 'headers_install' target cannot be used
  62. # because it requires rsync(1), which is not available early.
  63. mkdir -p "${destdir}/usr/include"
  64. cp -Rp usr/include/* "${destdir}/usr/include/"
  65. # Remove cruft
  66. find "${destdir}/usr/include" -name '.*' -exec rm -rf {} +
  67. rm -f "${destdir}/usr/include/Makefile"
  68. }