]> git.pld-linux.org Git - packages/uClibc.git/blob - uClibc.spec
19712347390d92a22fb79c58bf5e4e68b4f6acfb
[packages/uClibc.git] / uClibc.spec
1 #
2 # Conditional build:
3 %bcond_without  shared          # don't build shared lib support
4 %bcond_with     verbose         # verbose mode
5 #
6 %ifarch alpha
7 %undefine       with_shared
8 %endif
9 #
10 Summary:        C library optimized for size
11 Summary(pl.UTF-8):      Biblioteka C zoptymalizowana na rozmiar
12 Name:           uClibc
13 Version:        0.9.30.3
14 Release:        7
15 Epoch:          4
16 License:        LGPL v2.1
17 Group:          Libraries
18 Source0:        http://uclibc.org/downloads/%{name}-%{version}.tar.bz2
19 # Source0-md5:  73a4bf4a0fa508b01a7a3143574e3d21
20 Patch0:         %{name}-newsoname.patch
21 Patch1:         %{name}-toolchain-wrapper.patch
22 Patch2:         %{name}-targetcpu.patch
23 Patch3:         %{name}-debug.patch
24 Patch4:         %{name}-stdio-unhide.patch
25 Patch5:         %{name}-inotify_init1.patch
26 Patch6:         %{name}-sockflags.patch
27 Patch7:         %{name}-nosize.patch
28 Patch8:         %{name}-warn-once.patch
29 URL:            http://uclibc.org/
30 BuildRequires:  binutils-gasp
31 BuildRequires:  cpp
32 BuildRequires:  gcc >= 5:3.0
33 BuildRequires:  linux-libc-headers >= 7:2.6.24
34 BuildRequires:  ncurses-devel
35 BuildRequires:  rpmbuild(macros) >= 1.453
36 BuildRequires:  sed >= 4.0
37 BuildRequires:  which
38 ExclusiveArch:  alpha %{ix86} ppc sparc sparcv9 %{x8664}
39 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
40
41 %if "%{cc_version}" >= "4.2"
42 %define         specflags       -fgnu89-inline
43 %endif
44
45 %define         uclibc_root     /usr/%{_target_cpu}-linux-uclibc
46
47 %description
48 Small libc for building embedded applications.
49
50 %description -l pl.UTF-8
51 Mała libc do budowania aplikacji wbudowanych.
52
53 %package devel
54 Summary:        Development files for uClibc
55 Summary(pl.UTF-8):      Pliki dla programistów uClibc
56 Group:          Development/Libraries
57 Requires:       %{name} = %{epoch}:%{version}-%{release}
58 Requires:       binutils-gasp
59 Requires:       linux-libc-headers >= 7:2.6.24
60 %requires_eq    gcc
61
62 %description devel
63 Small libc for building embedded applications.
64
65 %description devel -l pl.UTF-8
66 Mała libc do budowania aplikacji wbudowanych.
67
68 %package static
69 Summary:        Static uClibc libraries
70 Summary(pl.UTF-8):      Biblioteki statyczne uClibc
71 Group:          Development/Libraries
72 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
73 Provides:       libc-static
74
75 %description static
76 Static uClibc libraries.
77
78 %description static -l pl.UTF-8
79 Biblioteki statyczne uClibc.
80
81 %prep
82 %setup -q
83 %patch0 -p1
84 %patch1 -p1
85 %patch2 -p1
86 %patch3 -p1
87 %patch4 -p1
88 %patch5 -p1
89 %patch6 -p1
90 %patch7 -p1
91 %patch8 -p1
92
93 # ARCH is already determined by uname -m
94 %ifarch %{ix86}
95 defconfig=extra/Configs/defconfigs/i386
96 %ifarch i386
97 echo 'CONFIG_386=y' >> $defconfig
98 %endif
99 %ifarch i486
100 echo 'CONFIG_486=y' >> $defconfig
101 %endif
102 %ifarch i586
103 echo 'CONFIG_586=y' >> $defconfig
104 %endif
105 %ifarch i686
106 echo 'CONFIG_686=y' >> $defconfig
107 %endif
108 %ifarch pentium3
109 echo 'CONFIG_PENTIUMIII=y' >> $defconfig
110 %endif
111 %ifarch pentium4
112 echo 'CONFIG_PENTIUM4=y' >> $defconfig
113 %endif
114 %ifarch athlon
115 echo 'CONFIG_K7=y' >> $defconfig
116 %endif
117 %endif
118 %ifarch %{x8664}
119 defconfig=extra/Configs/defconfigs/x86_64
120 %endif
121 %ifarch alpha
122 defconfig=extra/Configs/defconfigs/alpha
123 %endif
124 %ifarch sparc sparcv9
125 defconfig=extra/Configs/defconfigs/sparc
126 %endif
127 %ifarch ppc
128 defconfig=extra/Configs/defconfigs/powerpc
129 %endif
130 %ifarch ia64
131 defconfig=extra/Configs/defconfigs/ia64
132 %endif
133
134 cat <<'EOF' >> $defconfig
135 UCLIBC_HAS_IPV6=y
136 DO_C99_MATH=y
137 UCLIBC_HAS_RPC=y
138 # UCLIBC_HAS_FULL_RPC is not set
139 # UCLIBC_HAS_REENTRANT_RPC is not set
140 UCLIBC_HAS_SYS_SIGLIST=y
141 SHARED_LIB_LOADER_PREFIX="$(RUNTIME_PREFIX)/lib"
142 LDSO_GNU_HASH_SUPPORT=y
143 %if %{without shared}
144 HAVE_NO_SHARED=y
145 # HAVE_SHARED is not set
146 %endif
147 UCLIBC_HAS_PRINTF_M_SPEC=y
148 UCLIBC_SUSV3_LEGACY=y
149 UCLIBC_SUSV3_LEGACY_MACROS=y
150 # DOSTRIP is not set
151 %{?debug:DODEBUG=y}
152 %{?debug:SUPPORT_LD_DEBUG=y}
153 %{?debug:SUPPORT_LD_DEBUG_EARLY=y}
154 EOF
155
156 %build
157
158 # NOTE: 'defconfig' and 'all' must be run in separate make process because of macros
159 %{__make} -j1 defconfig \
160         %{?with_verbose:VERBOSE=1} \
161         TARGET_CPU="%{_target_cpu}" \
162         GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
163         HOSTCC="%{__cc}" \
164         CC="%{__cc}" \
165         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
166         OPTIMIZATION="%{rpmcflags} -Os"
167
168 # The Makefile includes .config and later tries to assign same variable,
169 # eventually it gets lost and sets wrong value for TARGET_ARCH and bad value
170 # for UCLIBC_LDSO in extra/gcc-uClibc.
171 # So we pass it as make arg to be sure it's proper!
172 target_arch=$(grep -s '^TARGET_ARCH' .config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
173
174 %{__make} -j1 \
175         %{?with_verbose:VERBOSE=1} \
176         TARGET_CPU="%{_target_cpu}" \
177         TARGET_ARCH=$target_arch \
178         GCC_BIN=%{_host_cpu}-%{_vendor}-%{_os}-gcc \
179         HOSTCC="%{__cc}" \
180         CC="%{__cc}" \
181         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
182         OPTIMIZATION="%{rpmcflags} -Os"
183
184 %install
185 rm -rf $RPM_BUILD_ROOT
186 install -d $RPM_BUILD_ROOT%{_bindir}
187
188 %{__make} -j1 install \
189         %{?with_verbose:VERBOSE=1} \
190         TARGET_CPU="%{_target_cpu}" \
191         HOSTCC="%{__cc}" \
192         HOSTCFLAGS="%{rpmcflags} %{rpmldflags}" \
193         CC="%{__cc}" \
194         OPTIMIZATION="%{rpmcflags} -Os" \
195         DESTDIR=$RPM_BUILD_ROOT
196
197 %if %{with shared}
198 mv -f $RPM_BUILD_ROOT%{uclibc_root}/usr/lib/{libpthread-uclibc,libpthread}.so
199 ln -sf libpthread-%{version}.so $RPM_BUILD_ROOT%{uclibc_root}/lib/libpthread.so.0
200 chmod a+rx $RPM_BUILD_ROOT%{uclibc_root}/lib/*.so
201 %endif
202
203 # these links are *needed* (by stuff in bin/)
204 for f in $RPM_BUILD_ROOT%{uclibc_root}/bin/*; do
205         if [ -L $f ]; then
206                 l=$(readlink $f)
207                 a=${l##*/}
208                 d=${l%/*}
209                 case "$d" in
210                 %{_bindir})
211                         ln -sf ${l#%{_bindir}/} $RPM_BUILD_ROOT%{_bindir}/${f##*/}
212                         rm -f $f
213                         ;;
214                 $a)
215                         mv -f $f $RPM_BUILD_ROOT%{_bindir}
216                         ;;
217                 *)
218                         exit 1
219                         ;;
220                 esac
221         else
222                 a=${f#*/%{_target_cpu}-uclibc-}
223                 ln -sf %{_bindir}/$(basename $f) $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/$a
224                 mv -f $f $RPM_BUILD_ROOT%{_bindir}
225         fi
226 done
227
228 for f in $RPM_BUILD_ROOT%{uclibc_root}/usr/bin/*; do
229         if [ -L $f ]; then
230                 l=$(readlink $f)
231                 case "${l%/*}" in
232                 %{uclibc_root}/bin)
233                         a=${l#*/%{_target_cpu}-uclibc-}
234                         ln -sf %{_bindir}/$a $f
235                         ;;
236                 %{_bindir})
237                         :
238                         ;;
239                 *)
240                         exit 2
241                         ;;
242                 esac
243         fi
244 done
245
246 rm -rf $RPM_BUILD_ROOT%{uclibc_root}/usr/include/{linux,asm*}
247 # rpm -ql linux-libc-headers | awk -F/ ' /^\/usr\/include\// { print "/usr/include/" $4 } ' | sort -u
248 for dir in asm asm-generic linux mtd rdma sound video xen; do
249         ln -sf /usr/include/${dir} $RPM_BUILD_ROOT%{uclibc_root}/usr/include/${dir}
250 done
251 # for future use
252 %ifarch sparc64
253 ln -sf /usr/include/asm-sparc $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc
254 ln -sf /usr/include/asm-sparc64 $RPM_BUILD_ROOT%{uclibc_root}/usr/include/asm-sparc64
255 %endif
256
257 %clean
258 rm -rf $RPM_BUILD_ROOT
259
260 %files
261 %defattr(644,root,root,755)
262 %doc Changelog* DEDICATION.mjn3 MAINTAINERS README TODO
263 %dir %{uclibc_root}
264 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
265 %if %{with shared}
266 %dir %{uclibc_root}/lib
267 %attr(755,root,root) %{uclibc_root}/lib/*.so*
268 %endif
269 %endif
270
271 %files devel
272 %defattr(644,root,root,755)
273 %doc docs/*.txt
274 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-addr2line
275 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ar
276 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-as
277 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-c++
278 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cc
279 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-cpp
280 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-g++
281 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gasp
282 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-gcc
283 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ld
284 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-nm
285 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objcopy
286 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-objdump
287 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-ranlib
288 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-size
289 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strings
290 %attr(755,root,root) %{_bindir}/%{_target_cpu}-uclibc-strip
291 %{uclibc_root}/usr/lib/*.o
292 %dir %{uclibc_root}/usr
293 %dir %{uclibc_root}/usr/bin
294 %attr(755,root,root) %{uclibc_root}/usr/bin/addr2line
295 %attr(755,root,root) %{uclibc_root}/usr/bin/ar
296 %attr(755,root,root) %{uclibc_root}/usr/bin/as
297 %attr(755,root,root) %{uclibc_root}/usr/bin/c++
298 %attr(755,root,root) %{uclibc_root}/usr/bin/cc
299 %attr(755,root,root) %{uclibc_root}/usr/bin/cpp
300 %attr(755,root,root) %{uclibc_root}/usr/bin/g++
301 %attr(755,root,root) %{uclibc_root}/usr/bin/gasp
302 %attr(755,root,root) %{uclibc_root}/usr/bin/gcc
303 %attr(755,root,root) %{uclibc_root}/usr/bin/ld
304 %attr(755,root,root) %{uclibc_root}/usr/bin/nm
305 %attr(755,root,root) %{uclibc_root}/usr/bin/objcopy
306 %attr(755,root,root) %{uclibc_root}/usr/bin/objdump
307 %attr(755,root,root) %{uclibc_root}/usr/bin/ranlib
308 %attr(755,root,root) %{uclibc_root}/usr/bin/size
309 %attr(755,root,root) %{uclibc_root}/usr/bin/strings
310 %attr(755,root,root) %{uclibc_root}/usr/bin/strip
311 %dir %{uclibc_root}/usr/lib
312 %if %{with shared}
313 %{uclibc_root}/usr/lib/uclibc_nonshared.a
314 %ifarch %{ix86} %{x8664} ppc sparc sparcv9
315 %attr(755,root,root) %{uclibc_root}/usr/lib/*.so
316 %endif
317 %endif
318 %{uclibc_root}/usr/include
319
320 %files static
321 %defattr(644,root,root,755)
322 %{uclibc_root}/usr/lib/lib*.a
This page took 0.104885 seconds and 2 git commands to generate.