resetting manifest requested domain to floor
[platform/upstream/linux-glibc-devel.git] / packaging / linux-glibc-devel.spec
1
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
5 Version:        3.4.0
6 Release:        0
7 License:        GPL-2.0
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}
20 BuildArch:      noarch
21 BuildRequires:  fdupes
22
23 %description
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,
28 packages, instead.
29
30 %prep
31 %setup -q -n linux-glibc-devel-%{upstream_version}
32 cp %{SOURCE1001} .
33
34 %build
35 cat > version.h <<-BOGUS
36 #ifdef __KERNEL__
37 #error "======================================================="
38 #error "You should not include /usr/include/{linux,asm}/ header"
39 #error "files directly for the compilation of kernel modules."
40 #error ""
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."
48 #error ""
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."
52 #error ""
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."
56 #error ""
57 #error "Then, modules can be built using:"
58 #error "make -C <path> M=$PWD"
59 #error ""
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>."
63 #error ""
64 #error "If you are seeing this message, your environment is "
65 #error "not configured properly. "
66 #error ""
67 #error "Please adjust the Makefile accordingly."
68 #error "======================================================="
69 #else
70 BOGUS
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
74 #endif
75 BOGUS
76 cat version.h
77
78 %install
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
97
98 %postun
99 if test "$1" = 0
100 then
101         rm -f usr/include/asm
102 fi
103 exit 0
104
105 %post
106 asm_link=
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      ;;
116         *)       asm_link=x86  ;;
117 esac
118 if test -L usr/include/asm
119 then
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
124                 exit 0
125                 ;;
126         esac
127         : symlink is ok, update it below in case of an arch change
128 elif test -d usr/include/asm
129 then
130         echo "/usr/include/asm is a directory, waiting for triggerpostun to symlink to asm-$asm_link"
131         exit 0
132 fi
133 ln -sfn asm-$asm_link usr/include/asm
134 exit 0
135
136 %triggerpostun -- linux-kernel-headers, glibc-devel < 2.5, libc < 2.2
137 asm_link=
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      ;;
147         *)       asm_link=x86  ;;
148 esac
149 ln -sfn asm-$asm_link usr/include/asm
150 exit 0
151
152 %files
153 %manifest %{name}.manifest
154 %defattr(-,root,root)
155 %{_includedir}/*
156 %ghost %{_includedir}/asm
157
158 %changelog