recipe 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Build recipe for kmod.
  2. #
  3. # Copyright (c) 2017-2018 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. program=kmod
  17. version=25
  18. release=3
  19. # Set 'outdir' for a nice and well-organized output directory
  20. outdir="${outdir}/${arch}/kernel"
  21. tarname=${program}-${version}.tar.gz
  22. # Remote source(s)
  23. fetch=http://www.kernel.org/pub/linux/utils/kernel/kmod/$tarname
  24. description="
  25. Linux kernel module handling.
  26. kmod is a set of tools to handle common tasks with Linux kernel modules
  27. like insert, remove, list, check properties, resolve dependencies and
  28. aliases.
  29. "
  30. homepage=http://git.kernel.org/?p=utils/kernel/kmod/kmod.git
  31. license=LGPLv2.1
  32. # Source documentation
  33. docs="COPYING NEWS README TODO"
  34. docsdir="${docdir}/${program}-${version}"
  35. build()
  36. {
  37. set -e
  38. unpack "${tardir}/$tarname"
  39. cd "$srcdir"
  40. # Set sane permissions
  41. chmod -R u+w,go-w,a+rX-s .
  42. # Add support for kernel modules compressed with LZIP
  43. patch -p1 < "${worktree}/patches/kmod/kmod-25_lzip-0.diff"
  44. autoreconf -vif
  45. # --enable-static is not supported by kmod
  46. ./configure CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
  47. lzlib_LIBS="-llz" lzlib_CFLAGS="-llz" \
  48. $configure_args \
  49. --libdir=/usr/lib${libSuffix} \
  50. --infodir=$infodir \
  51. --mandir=$mandir \
  52. --docdir=$docsdir \
  53. --disable-static \
  54. --enable-shared \
  55. --enable-tools \
  56. --with-rootlibdir=/usr/lib${libSuffix} \
  57. --with-zlib \
  58. --with-lzlib \
  59. --without-xz \
  60. --build="$(cc -dumpmachine)"
  61. make -j${jobs} V=1
  62. make -j${jobs} DESTDIR="$destdir" install-strip
  63. # Make symlinks for compatibility
  64. mkdir -p "${destdir}/usr/sbin"
  65. for target in depmod insmod lsmod modinfo modprobe rmmod
  66. do
  67. ( cd "${destdir}/usr/sbin" && ln -sf ../bin/kmod $target )
  68. done
  69. # For user invocation
  70. ( cd "${destdir}/usr/bin" && ln -sf ../bin/kmod lsmod )
  71. # Prepare directories / files for modprobe
  72. mkdir -p "${destdir}/lib/modprobe.d" "${destdir}/etc/modprobe.d"
  73. for file in "${worktree}"/archive/kmod/etc/modprobe.d/*
  74. do
  75. cp -p $file "${destdir}/etc/modprobe.d/"
  76. chmod 644 "${destdir}/etc/modprobe.d/${file##*/}"
  77. done
  78. # To manage (dot) new files
  79. touch "${destdir}/etc/modprobe.d/.graft-config"
  80. # Compress info documents deleting index file for the package
  81. if test -d "${destdir}/$infodir"
  82. then
  83. rm -f "${destdir}/${infodir}/dir"
  84. lzip -9 "${destdir}/${infodir}"/*
  85. fi
  86. # Compress and link man pages (if needed)
  87. if test -d "${destdir}/$mandir"
  88. then
  89. (
  90. cd "${destdir}/$mandir"
  91. find . -type f -exec lzip -9 '{}' +
  92. find . -type l | while read -r file
  93. do
  94. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  95. rm -- "$file"
  96. done
  97. )
  98. fi
  99. # Copy documentation
  100. mkdir -p "${destdir}${docsdir}"
  101. cp -p $docs "${destdir}${docsdir}"
  102. }