mkspec 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/bin/sh
  2. #
  3. # Output a simple RPM spec file that uses no fancy features requiring
  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: %{_tmppath}/%{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. echo "%package headers"
  45. echo "Summary: Header files for the Linux kernel for use by glibc"
  46. echo "Group: Development/System"
  47. echo "Obsoletes: kernel-headers"
  48. echo "Provides: kernel-headers = %{version}"
  49. echo "%description headers"
  50. echo "Kernel-headers includes the C header files that specify the interface"
  51. echo "between the Linux kernel and userspace libraries and programs. The"
  52. echo "header files define structures and constants that are needed for"
  53. echo "building most standard programs and are also needed for rebuilding the"
  54. echo "glibc package."
  55. echo ""
  56. if ! $PREBUILT; then
  57. echo "%prep"
  58. echo "%setup -q"
  59. echo ""
  60. fi
  61. echo "%build"
  62. if ! $PREBUILT; then
  63. echo "make clean && make %{?_smp_mflags}"
  64. echo ""
  65. fi
  66. echo "%install"
  67. echo "%ifarch ia64"
  68. echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
  69. echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
  70. echo "%else"
  71. echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
  72. echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
  73. echo "%endif"
  74. echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install'
  75. echo "%ifarch ia64"
  76. echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
  77. echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
  78. echo "%else"
  79. echo "%ifarch ppc64"
  80. echo "cp vmlinux arch/powerpc/boot"
  81. echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
  82. echo "%else"
  83. echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
  84. echo "%endif"
  85. echo "%endif"
  86. echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install'
  87. echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
  88. echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
  89. echo "%ifnarch ppc64"
  90. echo 'cp vmlinux vmlinux.orig'
  91. echo 'bzip2 -9 vmlinux'
  92. echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
  93. echo 'mv vmlinux.orig vmlinux'
  94. echo "%endif"
  95. echo ""
  96. echo "%clean"
  97. echo 'rm -rf $RPM_BUILD_ROOT'
  98. echo ""
  99. echo "%files"
  100. echo '%defattr (-, root, root)'
  101. echo "%dir /lib/modules"
  102. echo "/lib/modules/$KERNELRELEASE"
  103. echo "/lib/firmware"
  104. echo "/boot/*"
  105. echo ""
  106. echo "%files headers"
  107. echo '%defattr (-, root, root)'
  108. echo "/usr/include"
  109. echo ""