mkspec 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/bin/sh
  2. #
  3. # Output a simple RPM spec file that uses no fancy features requring
  4. # RPM v4. This is intended to work with any RPM distro.
  5. #
  6. # The only gothic bit here is redefining install_post to avoid
  7. # stripping the symbols from files in the kernel which we want
  8. #
  9. # Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
  10. #
  11. # how we were called determines which rpms we build and how we build them
  12. if [ "$1" = "prebuilt" ]; then
  13. PREBUILT=true
  14. else
  15. PREBUILT=false
  16. fi
  17. # starting to output the spec
  18. if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
  19. PROVIDES=kernel-drm
  20. fi
  21. PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
  22. __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-//g"`
  23. echo "Name: kernel"
  24. echo "Summary: The Linux Kernel"
  25. echo "Version: $__KERNELRELEASE"
  26. # we need to determine the NEXT version number so that uname and
  27. # rpm -q will agree
  28. echo "Release: `. $srctree/scripts/mkversion`"
  29. echo "License: GPL"
  30. echo "Group: System Environment/Kernel"
  31. echo "Vendor: The Linux Community"
  32. echo "URL: http://www.kernel.org"
  33. if ! $PREBUILT; then
  34. echo "Source: kernel-$__KERNELRELEASE.tar.gz"
  35. fi
  36. echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root"
  37. echo "Provides: $PROVIDES"
  38. echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
  39. echo "%define debug_package %{nil}"
  40. echo ""
  41. echo "%description"
  42. echo "The Linux Kernel, the operating system core itself"
  43. echo ""
  44. if ! $PREBUILT; then
  45. echo "%prep"
  46. echo "%setup -q"
  47. echo ""
  48. fi
  49. echo "%build"
  50. if ! $PREBUILT; then
  51. echo "make clean && make %{?_smp_mflags}"
  52. echo ""
  53. fi
  54. echo "%install"
  55. echo "%ifarch ia64"
  56. echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
  57. echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
  58. echo "%else"
  59. echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
  60. echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
  61. echo "%endif"
  62. echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
  63. echo "%ifarch ia64"
  64. echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
  65. echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
  66. echo "%else"
  67. echo "%ifarch ppc64"
  68. echo "cp vmlinux arch/powerpc/boot"
  69. echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
  70. echo "%else"
  71. echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
  72. echo "%endif"
  73. echo "%endif"
  74. echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
  75. echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
  76. echo "%ifnarch ppc64"
  77. echo 'cp vmlinux vmlinux.orig'
  78. echo 'bzip2 -9 vmlinux'
  79. echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
  80. echo 'mv vmlinux.orig vmlinux'
  81. echo "%endif"
  82. echo ""
  83. echo "%clean"
  84. echo 'rm -rf $RPM_BUILD_ROOT'
  85. echo ""
  86. echo "%files"
  87. echo '%defattr (-, root, root)'
  88. echo "%dir /lib/modules"
  89. echo "/lib/modules/$KERNELRELEASE"
  90. echo "/lib/firmware"
  91. echo "/boot/*"
  92. echo ""