chiark / gitweb /
[PATCH] remove udevtest on 'make clean'
[elogind.git] / klibc / klibc.spec.in
1 %define _rpmdir rpms
2 %define _builddir .
3
4 Summary: A minimal libc subset for use with initramfs.
5 Name: klibc
6 Version: 0.89
7 Release: 1
8 License: BSD/GPL
9 Group: Development/Libraries
10 URL: http://www.zytor.com/klibc
11 Source: /dev/null
12 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
13 Packager: Bryan O'Sullivan <bos@serpentine.com>
14 Prefix: /usr
15 Vendor: Starving Linux Artists
16
17 %description
18 %{name} is intended to be a minimalistic libc subset for use with
19 initramfs.  It is deliberately written for small size, minimal
20 entanglement, and portability, not speed.  It is definitely a work in
21 progress, and a lot of things are still missing.
22
23 %package kernheaders
24 Summary: Kernel headers used during the build of klibc.
25 Group: Development/Libraries
26
27 %description kernheaders
28 This package contains the set of kernel headers that were required to
29 build %{name} and the utilities that ship with it.  This may or may
30 not be a complete enough set to build other programs that link against
31 %{name}.  If in doubt, use real kernel headers instead.
32
33 %package utils
34 Summary: Small statically-linked utilities built with klibc.
35 Group: Utilities/System
36
37 %description utils
38
39 This package contains a collection of programs that are statically
40 linked against klibc.  These duplicate some of the functionality of a
41 regular Linux toolset, but are typically much smaller than their
42 full-function counterparts.  They are intended for inclusion in
43 initramfs images and embedded systems.
44
45 %prep
46 if [ ! -L linux ]; then
47     echo "*** You must have a symlink named linux to build klibc" 1>&2
48     exit 1
49 fi
50 if [ ! -f linux/include/asm/page.h ]; then
51     echo "*** You need to 'make prepare' in the linux tree before building klibc" 1>&2
52     exit 1
53 fi
54 mkdir -p %{buildroot} %{_rpmdir}
55
56 %build
57 make
58
59 %install
60 rm -rf %{buildroot}
61
62 dest=%{buildroot}/%{prefix}
63 lib=$dest/%{_lib}/klibc
64 inc=$dest/include/klibc
65 exe=$dest/libexec/klibc
66 doc=$dest/share/doc/%{name}-%{version}
67 udoc=$dest/share/doc/%{name}-utils-%{version}
68
69 # First, the library.
70
71 install -dD -m 755 $lib $inc/kernel $exe $doc $udoc
72 install -m 755 klibc/klibc.so $lib
73 install -m 644 klibc/libc.a $lib
74 install -m 644 klibc/crt0.o $lib
75 install -m 644 klibc/libc.so.hash $lib
76 ln $lib/klibc.so $lib/libc.so
77 ln $lib/klibc.so $lib/klibc-$(cat $lib/libc.so.hash).so
78
79 # Next, the generated binaries.
80
81 install -m 755 ash/sh $exe
82 install -m 755 gzip/gzip $exe
83 ln $exe/gzip $exe/gunzip
84 ln $exe/gzip $exe/zcat
85 install -m 755 ipconfig/ipconfig $exe
86 install -m 755 kinit/kinit $exe
87 install -m 755 nfsmount/nfsmount $exe
88 for i in chroot dd fstype mkdir mkfifo mount umount; do
89     install -m 755 utils/$i $exe
90 done
91
92 # The docs.
93
94 install -m 444 README $doc
95 install -m 444 klibc/README $doc/README.klibc
96 install -m 444 klibc/arch/README $doc/README.klibc.arch
97
98 install -m 444 gzip/COPYING $udoc/COPYING.gzip
99 install -m 444 gzip/README $udoc/README.gzip
100 install -m 444 ipconfig/README $udoc/README.ipconfig
101 install -m 444 kinit/README $udoc/README.kinit
102
103 # Finally, the include files.
104
105 bitsize=$(make --no-print-directory -C klibc bitsize)
106 cp --parents $(find klibc/include \( -name CVS -o -name SCCS \) -prune \
107     -o -name '*.h' -print) $inc
108 mv $inc/klibc $inc/klibc.$$
109 mv $inc/klibc.$$/include/* $inc
110 mv $inc/bits$bitsize/bitsize $inc
111 rm -rf $inc/klibc.$$ $inc/bits[0-9]*
112 pushd klibc/arch/%{_arch}/include
113 cp --parents -f $(find . \( -name CVS -o -name SCCS \) -prune \
114     -o -name '*.h' -print) $inc
115 popd
116
117 # Yeugh.  Find the transitive closure over all kernel headers included
118 # by klibc, and copy them into place.
119
120 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)
121
122 %clean
123 rm -rf $RPM_BUILD_ROOT
124
125 %files
126 %defattr(-,root,root,-)
127 %docdir %{prefix}/share/doc/%{name}-%{version}
128 %{prefix}/%{_lib}/klibc
129 %dir %{prefix}/include/klibc
130 %{prefix}/include/klibc/*.h
131 %{prefix}/include/klibc/arpa
132 %{prefix}/include/klibc/bitsize
133 %{prefix}/include/klibc/klibc
134 %{prefix}/include/klibc/net
135 %{prefix}/include/klibc/netinet
136 %{prefix}/include/klibc/sys
137 %{prefix}/share/doc/%{name}-%{version}
138
139 %files kernheaders
140 %defattr(-,root,root,-)
141 %{prefix}/include/klibc/kernel
142
143 %files utils
144 %defattr(-,root,root,-)
145 %{prefix}/libexec/klibc
146 %docdir %{prefix}/share/doc/%{name}-utils-%{version}
147 %{prefix}/share/doc/%{name}-utils-%{version}
148
149 %changelog
150 * Sat Nov 29 2003 Bryan O'Sullivan <bos@serpentine.com> - 
151 - Initial build.