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 Url: http://www.kernel.org/
11 Group: Development/Libraries
12 Source: %{name}-%{version}.tar.bz2
13 Source1: install_all.sh
14 Source1001: linux-glibc-devel.manifest
15 Requires(pre): coreutils
16 Provides: kernel-headers
17 Provides: linux-kernel-headers = %{version}
18 Obsoletes: linux-kernel-headers < %{version}
22 This package provides Linux kernel headers, the kernel API description
23 required for compilation of almost all programs. This is the userspace
24 interface; compiling external kernel modules requires
25 kernel-(flavor)-devel, or kernel-syms to pull in all kernel-*-devel,
29 %setup -q -n linux-glibc-devel-%{version}
33 cat > version.h <<-BOGUS
35 #error "======================================================="
36 #error "You should not include /usr/include/{linux,asm}/ header"
37 #error "files directly for the compilation of kernel modules."
39 #error "glibc now uses kernel header files from a well-defined"
40 #error "working kernel version (as recommended by Linus Torvalds)"
41 #error "These files are glibc internal and may not match the"
42 #error "currently running kernel. They should only be"
43 #error "included via other system header files - user space"
44 #error "programs should not directly include <linux/*.h> or"
45 #error "<asm/*.h> as well."
47 #error "Since Linux 2.6, the kernel module build process has been"
48 #error "updated such that users building modules should not typically"
49 #error "need to specify additional include directories at all."
51 #error "To build kernel modules, ensure you have the build environment "
52 #error "available either via the kernel-devel and kernel-<flavor>-devel "
53 #error "packages or a properly configured kernel source tree."
55 #error "Then, modules can be built using:"
56 #error "make -C <path> M=$PWD"
58 #error "For the currently running kernel there will be a symbolic "
59 #error "link pointing to the build environment located at "
60 #error "/lib/modules/$(uname -r)/build for use as <path>."
62 #error "If you are seeing this message, your environment is "
63 #error "not configured properly. "
65 #error "Please adjust the Makefile accordingly."
66 #error "======================================================="
69 # Get LINUX_VERSION_CODE and KERNEL_VERSION directly from kernel
70 cat usr/include/linux/version.h >> version.h
71 cat >> version.h <<-BOGUS
77 cp -a usr %{buildroot}
78 cp -a version.h %{buildroot}/usr/include/linux/
79 # Temporarily exclude i2c header files, which are provided by i2c-tools instead
80 rm -fv %{buildroot}/usr/include/linux/i2c-dev.h
81 # resolve file conflict with glibc for now
82 rm -fv %{buildroot}//usr/include/scsi/scsi*
83 # Replace the directory /usr/include/asm with a symlink.
84 # libc contained a symlink /usr/include/asm into kernel-source up to 7.0 (2.1.3)
85 # glibc-devel contained a symlink /usr/include/asm into kernel-source in 7.1 (2.2)
86 # glibc-devel contained a directory /usr/include/asm from 7.2 (2.2.2) up to 10.1/SLES10 (2.4)
87 # The directory moved from glibc-devel to linux-kernel-headers in 10.2 (2.6.18.2)
88 # The directory turned into a symlink in 10.3 (2.6.22)
89 # rpm will remove obsolete files after the post install scripts
90 # A trigger will run after the /usr/include/asm was removed
91 # Create a dummy symlink now for rpmlint happiness, we %%ghost this and create
92 # a proper symlink during %%post:
93 ln -sfn asm-dummy %{buildroot}/usr/include/asm
94 %fdupes %{buildroot}/usr/include
105 # Note that you must use the %{_arch} macro instead of "uname -m"
106 # to handle a software platform environment that consists of arm64-based Linux kernel
107 # and arm32-based Platform packages.
109 *arm*) asm_link=arm ;;
110 *aarch64*) asm_link=arm64 ;;
111 *parisc*) asm_link=parisc ;;
112 *riscv* ) asm_link=riscv ;;
115 if test -L usr/include/asm
117 case "$(readlink usr/include/asm)" in
118 *../src/linux/include*)
119 echo "/usr/include/asm points to kernel-source, waiting for triggerpostun to symlink to asm-$asm_link"
120 rm -fv usr/include/asm
124 : symlink is ok, update it below in case of an arch change
125 elif test -d usr/include/asm
127 echo "/usr/include/asm is a directory, waiting for triggerpostun to symlink to asm-$asm_link"
130 ln -sfn asm-$asm_link usr/include/asm
133 %triggerpostun -- linux-kernel-headers, glibc-devel < 2.5, libc < 2.2
135 # Note that you must use the %{_arch} macro instead of "uname -m"
136 # to handle a software platform environment that consists of arm64-based Linux kernel
137 # and arm32-based Platform packages.
139 *arm*) asm_link=arm ;;
140 *aarch64*) asm_link=arm64 ;;
141 *riscv* ) asm_link=riscv ;;
144 ln -sfn asm-$asm_link usr/include/asm
148 %manifest %{name}.manifest
149 %defattr(-,root,root)
151 %ghost %{_includedir}/asm
155 * Mon Mar 09 2020 Geunsik Lim <geunsik.lim@samsung.com>
156 - Replaced "uname -m" with "_arch" macro to build platform packages.