]>
Commit | Line | Data |
---|---|---|
a0622777 GKH |
1 | Summary: A minimal libc subset for use with initramfs. |
2 | Name: klibc | |
3 | Version: 0.181 | |
4 | Release: 1 | |
5 | License: BSD/GPL | |
6 | Group: Development/Libraries | |
7 | URL: http://www.zytor.com/mailman/listinfo/klibc | |
8 | Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.gz | |
9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot | |
10 | BuildRequires: kernel-source >= 2.6.0 | |
11 | Packager: H. Peter Anvin <hpa@zytor.com> | |
12 | Prefix: /usr | |
13 | Vendor: Starving Linux Artists | |
14 | ||
15 | %description | |
16 | %{name} is intended to be a minimalistic libc subset for use with | |
17 | initramfs. It is deliberately written for small size, minimal | |
18 | entanglement, and portability, not speed. It is definitely a work in | |
19 | progress, and a lot of things are still missing. | |
20 | ||
21 | %package kernheaders | |
22 | Summary: Kernel headers used during the build of klibc. | |
23 | Group: Development/Libraries | |
24 | ||
25 | %description kernheaders | |
26 | This package contains the set of kernel headers that were required to | |
27 | build %{name} and the utilities that ship with it. This may or may | |
28 | not be a complete enough set to build other programs that link against | |
29 | %{name}. If in doubt, use real kernel headers instead. | |
30 | ||
31 | %package utils | |
32 | Summary: Small statically-linked utilities built with klibc. | |
33 | Group: Utilities/System | |
34 | ||
35 | %description utils | |
36 | ||
37 | This package contains a collection of programs that are statically | |
38 | linked against klibc. These duplicate some of the functionality of a | |
39 | regular Linux toolset, but are typically much smaller than their | |
40 | full-function counterparts. They are intended for inclusion in | |
41 | initramfs images and embedded systems. | |
42 | ||
43 | %prep | |
44 | %setup -q | |
45 | cp -as /usr/src/linux-`rpm -q kernel-source | tail -1 | cut -d- -f3-` ./linux | |
46 | make -C linux defconfig ARCH=%{_target_cpu} | |
47 | make -C linux prepare ARCH=%{_target_cpu} | |
48 | # Deal with braindamage in RedHat's kernel-source RPM | |
49 | rm -f linux/include/linux/config.h | |
50 | cat <<EOF > linux/include/linux/config.h | |
51 | #ifndef _LINUX_CONFIG_H | |
52 | #define _LINUX_CONFIG_H | |
53 | ||
54 | #include <linux/autoconf.h> | |
55 | ||
56 | #endif | |
57 | EOF | |
58 | mkdir -p %{buildroot} | |
59 | ||
60 | %build | |
61 | make ARCH=%{_target_cpu} | |
62 | ||
63 | %install | |
64 | rm -rf %{buildroot} | |
65 | ||
66 | dest=%{buildroot}/%{prefix} | |
67 | lib=$dest/%{_lib}/klibc | |
68 | inc=$dest/include/klibc | |
69 | exe=$dest/libexec/klibc | |
70 | doc=$dest/share/doc/%{name}-%{version} | |
71 | udoc=$dest/share/doc/%{name}-utils-%{version} | |
72 | ||
73 | # First, the library. | |
74 | ||
75 | install -dD -m 755 $lib $inc/kernel $exe $doc $udoc | |
76 | install -m 755 klibc/klibc.so $lib | |
77 | install -m 644 klibc/libc.a $lib | |
78 | install -m 644 klibc/crt0.o $lib | |
79 | install -m 644 klibc/libc.so.hash $lib | |
80 | ln $lib/klibc.so $lib/libc.so | |
81 | ln $lib/klibc.so $lib/klibc-$(cat $lib/libc.so.hash).so | |
82 | ||
83 | # Next, the generated binaries. | |
84 | # These are currently static binaries, should we go for shared? | |
85 | ||
86 | install -m 755 ash/sh $exe | |
87 | install -m 755 gzip/gzip $exe | |
88 | ln $exe/gzip $exe/gunzip | |
89 | ln $exe/gzip $exe/zcat | |
90 | install -m 755 ipconfig/ipconfig $exe | |
91 | install -m 755 kinit/kinit $exe | |
92 | install -m 755 nfsmount/nfsmount $exe | |
93 | install -m 755 utils/static/* $exe | |
94 | ||
95 | # The docs. | |
96 | ||
97 | install -m 444 README $doc | |
98 | install -m 444 klibc/README $doc/README.klibc | |
99 | install -m 444 klibc/arch/README $doc/README.klibc.arch | |
100 | ||
101 | install -m 444 gzip/COPYING $udoc/COPYING.gzip | |
102 | install -m 444 gzip/README $udoc/README.gzip | |
103 | install -m 444 ipconfig/README $udoc/README.ipconfig | |
104 | install -m 444 kinit/README $udoc/README.kinit | |
105 | ||
106 | # Finally, the include files. | |
107 | ||
108 | bitsize=$(make --no-print-directory -C klibc bitsize ARCH=%{_target_cpu}) | |
109 | cp --parents $(find klibc/include \( -name CVS -o -name SCCS \) -prune \ | |
110 | -o -name '*.h' -print) $inc | |
111 | mv $inc/klibc $inc/klibc.$$ | |
112 | mv $inc/klibc.$$/include/* $inc | |
113 | mv $inc/bits$bitsize/bitsize $inc | |
114 | rm -rf $inc/klibc.$$ $inc/bits[0-9]* | |
115 | pushd klibc/arch/%{_arch}/include | |
116 | cp --parents -f $(find . \( -name CVS -o -name SCCS \) -prune \ | |
117 | -o -name '*.h' -print) $inc | |
118 | popd | |
119 | ||
120 | # Yeugh. Find the transitive closure over all kernel headers included | |
121 | # by klibc, and copy them into place. | |
122 | ||
123 | find . -name '.*.d' | xargs -r sed -e 's,[ \t][ \t]*,\n,g' | sed -n -e 's,^\.\./linux/include/,,p' | sort | uniq | (cd linux/include && xargs -ri cp --parents '{}' $inc/kernel) | |
124 | ||
125 | %clean | |
126 | rm -rf $RPM_BUILD_ROOT | |
127 | ||
128 | %files | |
129 | %defattr(-,root,root,-) | |
130 | %docdir %{prefix}/share/doc/%{name}-%{version} | |
131 | %{prefix}/%{_lib}/klibc | |
132 | %dir %{prefix}/include/klibc | |
133 | %{prefix}/include/klibc/*.h | |
134 | %{prefix}/include/klibc/arpa | |
135 | %{prefix}/include/klibc/bitsize | |
136 | %{prefix}/include/klibc/klibc | |
137 | %{prefix}/include/klibc/net | |
138 | %{prefix}/include/klibc/netinet | |
139 | %{prefix}/include/klibc/sys | |
140 | %{prefix}/share/doc/%{name}-%{version} | |
141 | ||
142 | %files kernheaders | |
143 | %defattr(-,root,root,-) | |
144 | %{prefix}/include/klibc/kernel | |
145 | ||
146 | %files utils | |
147 | %defattr(-,root,root,-) | |
148 | %{prefix}/libexec/klibc | |
149 | %docdir %{prefix}/share/doc/%{name}-utils-%{version} | |
150 | %{prefix}/share/doc/%{name}-utils-%{version} | |
151 | ||
152 | %changelog | |
153 | * Tue Jul 6 2004 H. Peter Anvin <hpa@zytor.com> | |
154 | - Update to use kernel-source RPM for the kernel symlink. | |
155 | ||
156 | * Sat Nov 29 2003 Bryan O'Sullivan <bos@serpentine.com> - | |
157 | - Initial build. |