2 Name: linux-glibc-devel
3 # this confusing version number has no meaning, it's the version
4 # of the Linux kernel where these headers come from
8 Summary: Linux headers for userspace development
9 # A "-" is not allowed in version
10 %define upstream_version 3.4
11 Url: http://www.kernel.org/
12 Group: Development/Libraries/C and C++
13 Source: %{name}-%{upstream_version}.tar.bz2
14 Source1: install_all.sh
15 Source1001: linux-glibc-devel.manifest
16 Requires(pre): coreutils
17 Provides: kernel-headers
18 Provides: linux-kernel-headers = %{version}
19 Obsoletes: linux-kernel-headers < %{version}
24 This package provides Linux kernel headers, the kernel API description
25 required for compilation of almost all programs. This is the userspace
26 interface; compiling external kernel modules requires
27 kernel-(flavor)-devel, or kernel-syms to pull in all kernel-*-devel,
31 %setup -q -n linux-glibc-devel-%{upstream_version}
35 cat > version.h <<-BOGUS
37 #error "======================================================="
38 #error "You should not include /usr/include/{linux,asm}/ header"
39 #error "files directly for the compilation of kernel modules."
41 #error "glibc now uses kernel header files from a well-defined"
42 #error "working kernel version (as recommended by Linus Torvalds)"
43 #error "These files are glibc internal and may not match the"
44 #error "currently running kernel. They should only be"
45 #error "included via other system header files - user space"
46 #error "programs should not directly include <linux/*.h> or"
47 #error "<asm/*.h> as well."
49 #error "Since Linux 2.6, the kernel module build process has been"
50 #error "updated such that users building modules should not typically"
51 #error "need to specify additional include directories at all."
53 #error "To build kernel modules, ensure you have the build environment "
54 #error "available either via the kernel-devel and kernel-<flavor>-devel "
55 #error "packages or a properly configured kernel source tree."
57 #error "Then, modules can be built using:"
58 #error "make -C <path> M=$PWD"
60 #error "For the currently running kernel there will be a symbolic "
61 #error "link pointing to the build environment located at "
62 #error "/lib/modules/$(uname -r)/build for use as <path>."
64 #error "If you are seeing this message, your environment is "
65 #error "not configured properly. "
67 #error "Please adjust the Makefile accordingly."
68 #error "======================================================="
71 # Get LINUX_VERSION_CODE and KERNEL_VERSION directly from kernel
72 cat usr/include/linux/version.h >> version.h
73 cat >> version.h <<-BOGUS
79 cp -a usr %{buildroot}
80 cp -a version.h %{buildroot}/usr/include/linux/
81 # Temporarily exclude i2c header files, which are provided by i2c-tools instead
82 rm -fv %{buildroot}/usr/include/linux/i2c-dev.h
83 # resolve file conflict with glibc for now
84 rm -fv %{buildroot}//usr/include/scsi/scsi*
85 # Replace the directory /usr/include/asm with a symlink.
86 # libc contained a symlink /usr/include/asm into kernel-source up to 7.0 (2.1.3)
87 # glibc-devel contained a symlink /usr/include/asm into kernel-source in 7.1 (2.2)
88 # glibc-devel contained a directory /usr/include/asm from 7.2 (2.2.2) up to 10.1/SLES10 (2.4)
89 # The directory moved from glibc-devel to linux-kernel-headers in 10.2 (2.6.18.2)
90 # The directory turned into a symlink in 10.3 (2.6.22)
91 # rpm will remove obsolete files after the post install scripts
92 # A trigger will run after the /usr/include/asm was removed
93 # Create a dummy symlink now for rpmlint happiness, we %%ghost this and create
94 # a proper symlink during %%post:
95 ln -sfn asm-dummy %{buildroot}/usr/include/asm
96 %fdupes %{buildroot}/usr/include
101 rm -f usr/include/asm
107 case "$(uname -m)" in
108 alpha*) asm_link=alpha ;;
109 ppc*) asm_link=powerpc ;;
110 s390*) asm_link=s390 ;;
111 ia64) asm_link=ia64 ;;
112 *arm*) asm_link=arm ;;
113 parisc) asm_link=parisc ;;
114 *mips*) asm_link=mips ;;
115 sparc*) asm_link=sparc ;;
118 if test -L usr/include/asm
120 case "$(readlink usr/include/asm)" in
121 *../src/linux/include*)
122 echo "/usr/include/asm points to kernel-source, waiting for triggerpostun to symlink to asm-$asm_link"
123 rm -fv usr/include/asm
127 : symlink is ok, update it below in case of an arch change
128 elif test -d usr/include/asm
130 echo "/usr/include/asm is a directory, waiting for triggerpostun to symlink to asm-$asm_link"
133 ln -sfn asm-$asm_link usr/include/asm
136 %triggerpostun -- linux-kernel-headers, glibc-devel < 2.5, libc < 2.2
138 case "$(uname -m)" in
139 alpha*) asm_link=alpha ;;
140 ppc*) asm_link=powerpc ;;
141 s390*) asm_link=s390 ;;
142 ia64) asm_link=ia64 ;;
143 *arm*) asm_link=arm ;;
144 parisc) asm_link=parisc ;;
145 *mips*) asm_link=mips ;;
146 sparc*) asm_link=sparc ;;
149 ln -sfn asm-$asm_link usr/include/asm
153 %manifest %{name}.manifest
154 %defattr(-,root,root)
156 %ghost %{_includedir}/asm