[buildroot] add preliminary support for musl
[openwrt.git] / package / toolchain / Makefile
1 #
2 # Copyright (C) 2007-2012 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 PKG_NAME:=toolchain
10 PKG_RELEASE:=1
11
12 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
13
14 include $(INCLUDE_DIR)/package.mk
15
16 ifneq ($(DUMP),1)
17   LIBGCC_VERSION:=$(GCC_VERSION)
18 else
19   LIBC_VERSION:=<LIBC_VERSION>
20   LIBGCC_VERSION:=<LIBGCC_VERSION>
21 endif
22
23 define Package/gcc/Default
24   SECTION:=libs
25   CATEGORY:=Base system
26   URL:=http://gcc.gnu.org/
27   VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
28 endef
29
30 define Package/libgcc
31 $(call Package/gcc/Default)
32   TITLE:=GCC support library
33 endef
34
35 define Package/libgcc/config
36         menu "Configuration"
37                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
38
39         config LIBGCC_ROOT_DIR
40                 string
41                 prompt "libgcc shared library base directory"
42                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
43                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
44                 default "/"  if NATIVE_TOOLCHAIN
45
46         config LIBGCC_FILE_SPEC
47                 string
48                 prompt "libgcc shared library files (use wildcards)"
49                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
50                 default "./lib/libgcc_s.so.*"
51
52         endmenu
53 endef
54
55
56 define Package/libssp
57 $(call Package/gcc/Default)
58   DEPENDS+=@SSP_SUPPORT
59   TITLE:=GCC support library
60 endef
61
62 define Package/libssp/config
63         menu "Configuration"
64                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
65
66         config LIBSSP_ROOT_DIR
67                 string
68                 prompt "libssp shared library base directory"
69                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
70                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
71                 default "/"  if NATIVE_TOOLCHAIN
72
73         config LIBSSP_FILE_SPEC
74                 string
75                 prompt "libssp shared library files (use wildcards)"
76                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
77                 default "./lib/libssp.so.*"
78
79         endmenu
80 endef
81
82
83 define Package/libstdcpp
84 $(call Package/gcc/Default)
85   NAME:=libstdc++
86   TITLE:=GNU Standard C++ Library v3
87   DEPENDS+=@INSTALL_LIBSTDCPP
88 endef
89
90 define Package/libstdcpp/config
91         menu "Configuration"
92         depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
93
94         config LIBSTDCPP_ROOT_DIR
95                 string
96                 prompt "libstdcpp shared library base directory"
97                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
98                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
99                 default "/"  if NATIVE_TOOLCHAIN
100
101         config LIBSTDCPP_FILE_SPEC
102                 string
103                 prompt "libstdc++ shared library files (use wildcards)"
104                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
105                 default "./lib/libstdc++.so.*"
106
107         endmenu
108 endef
109
110
111 define Package/libc/Default
112   SECTION:=libs
113   CATEGORY:=Base system
114   VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
115   DEPENDS:=+libgcc
116   URL:=$(LIBC_URL)
117   PKG_FLAGS:=hold essential
118 endef
119
120
121 define Package/libc
122 $(call Package/libc/Default)
123   TITLE:=C library
124 endef
125
126 define Package/libc/config
127         menu "Configuration"
128         depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
129
130         config LIBC_ROOT_DIR
131                 string
132                 prompt "libc shared library base directory"
133                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
134                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
135                 default "/"  if NATIVE_TOOLCHAIN
136
137         config LIBC_FILE_SPEC
138                 string
139                 prompt "libc shared library files (use wildcards)"
140                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
141                 default "./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
142
143         endmenu
144 endef
145
146
147 define Package/libpthread
148 $(call Package/libc/Default)
149   TITLE:=POSIX thread library
150 endef
151
152 define Package/libpthread/config
153         menu "Configuration"
154         depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
155
156         config LIBPTHREAD_ROOT_DIR
157                 string
158                 prompt "libpthread shared library base directory"
159                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
160                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
161                 default "/"  if NATIVE_TOOLCHAIN
162
163         config LIBPTHREAD_FILE_SPEC
164                 string
165                 prompt "libpthread shared library files (use wildcards)"
166                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
167                 default "./lib/libpthread{-*.so,.so.*}"
168
169         endmenu
170 endef
171
172
173 define Package/libthread-db
174 $(call Package/libc/Default)
175   TITLE:=POSIX thread library debugging support
176 endef
177
178 define Package/librt
179 $(call Package/libc/Default)
180   TITLE:=POSIX.1b RealTime extension library
181   DEPENDS:=+libpthread
182 endef
183
184 define Package/librt/config
185         menu "Configuration"
186         depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
187
188         config LIBRT_ROOT_DIR
189                 string
190                 prompt "librt shared library base directory"
191                 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
192                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
193                 default "/"  if NATIVE_TOOLCHAIN
194
195         config LIBRT_FILE_SPEC
196                 string
197                 prompt "librt shared library files (use wildcards)"
198                 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
199                 default "./lib/librt{-*.so,.so.*}"
200
201         endmenu
202 endef
203
204
205 define Package/libgfortran
206 $(call Package/gcc/Default)
207   TITLE:=GFortran support library
208   DEPENDS+=@INSTALL_GFORTRAN
209 endef
210
211 define Package/libgfortran/config
212         menu "Configuration"
213                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
214
215         config LIBGFORTRAN_ROOT_DIR
216                 string
217                 prompt "libgfortran shared library base directory"
218                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
219                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
220                 default "/"  if NATIVE_TOOLCHAIN
221
222         config LIBGFORTRAN_FILE_SPEC
223                 string
224                 prompt "libgfortran shared library files (use wildcards)"
225                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
226                 default "./usr/lib/libgfortran.so.*"
227
228         endmenu
229 endef
230
231 define Package/ldd
232 $(call Package/libc/Default)
233   SECTION:=utils
234   CATEGORY:=Utilities
235   TITLE:=LDD trace utility
236 endef
237
238 define Package/ldd/config
239         menu "Configuration"
240                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
241
242         config LDD_ROOT_DIR
243                 string
244                 prompt "ldd trace utility base directory"
245                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
246                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
247                 default "/"  if NATIVE_TOOLCHAIN
248
249         config LDD_FILE_SPEC
250                 string
251                 prompt "ldd trace utility file"
252                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
253                 default "./usr/bin/ldd"
254
255         endmenu
256 endef
257
258
259 define Package/ldconfig
260 $(call Package/libc/Default)
261   SECTION:=utils
262   CATEGORY:=Utilities
263   TITLE:=Shared library path configuration
264 endef
265
266 define Package/ldconfig/config
267         menu "Configuration"
268                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
269
270         config LDCONFIG_ROOT_DIR
271                 string
272                 prompt "ldconfig base directory"
273                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
274                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
275                 default "/"  if NATIVE_TOOLCHAIN
276
277         config LDCONFIG_FILE_SPEC
278                 string
279                 prompt "ldconfig file"
280                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
281                 default "./sbin/ldconfig"
282
283         endmenu
284 endef
285
286 define Build/Prepare
287         mkdir -p $(PKG_BUILD_DIR)
288 endef
289
290 LIBGCC_A=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc_pic.a)
291 LIBGCC_MAP=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.map)
292 LIBGCC_SO=$(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so.*)
293 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
294   ifneq ($(if $(CONFIG_USE_UCLIBC),$(CONFIG_GCC_VERSION_LINARO)),)
295     BUILD_LIBGCC:=$(if $(CONFIG_avr32)$(CONFIG_m68k)$(CONFIG_powerpc),,$(PKG_BUILD_DIR)/libgcc_s.so.*)
296   endif
297 endif
298
299 ifneq ($(BUILD_LIBGCC),)
300   define Build/Compile/uClibc
301         $(SCRIPT_DIR)/relink-lib.sh \
302                 "$(TARGET_CROSS)" \
303                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
304                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
305                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libuClibc-*.so))" \
306                 -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 \
307                 $(BUILD_LIBGCC)
308         $(SCRIPT_DIR)/relink-lib.sh \
309                 "$(TARGET_CROSS)" \
310                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so)" \
311                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt_pic.a)" \
312                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so))" \
313                 $(BUILD_LIBGCC) \
314                 -Wl,-soname=libcrypt.so.0
315         $(SCRIPT_DIR)/relink-lib.sh \
316                 "$(TARGET_CROSS)" \
317                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so)" \
318                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libm_pic.a)" \
319                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so))" \
320                 $(BUILD_LIBGCC) \
321                 -Wl,-soname=libm.so.0
322         $(SCRIPT_DIR)/relink-lib.sh \
323                 "$(TARGET_CROSS)" \
324                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so)" \
325                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a)" \
326                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so))" \
327                 -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal \
328                 -ldl -lc $(BUILD_LIBGCC) \
329                 -Wl,-soname=libpthread.so.0
330   endef
331   define Build/Compile/libgcc
332         $(SCRIPT_DIR)/relink-lib.sh \
333                 "$(TARGET_CROSS)" \
334                 "$(LIBGCC_SO)" \
335                 "$(LIBGCC_A)" \
336                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(LIBGCC_SO))" \
337                 -Wl,--version-script=$(LIBGCC_MAP) -Wl,-soname=libgcc_s.so.1
338   endef
339 else
340   define Build/Compile/uClibc
341         $(CP) \
342                 $(TOOLCHAIN_DIR)/lib/libuClibc-*.so \
343                 $(TOOLCHAIN_DIR)/lib/libcrypt-*.so \
344                 $(TOOLCHAIN_DIR)/lib/libm-*.so \
345                 $(TOOLCHAIN_DIR)/lib/libpthread-*.so \
346                 $(PKG_BUILD_DIR)/
347   endef
348   ifneq ($(LIBGCC_SO),)
349     define Build/Compile/libgcc
350         $(CP) $(LIBGCC_SO) $(PKG_BUILD_DIR)/
351     endef
352   endif
353 endif
354
355 define Build/Compile/Default
356         $(call Build/Compile/libgcc)
357         $(call Build/Compile/$(LIBC))
358 endef
359 Build/Compile = $(Build/Compile/Default)
360
361 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
362
363   define Package/libgcc/install
364         $(INSTALL_DIR) $(1)/lib
365         $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/)
366   endef
367
368   define Package/libgfortran/install
369         $(INSTALL_DIR) $(1)/usr/lib
370         $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/)
371   endef
372
373   define Package/libssp/install
374         $(INSTALL_DIR) $(1)/lib
375         $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
376   endef
377
378   define Package/libstdcpp/install
379         $(INSTALL_DIR) $(1)/usr/lib
380         $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
381   endef
382
383   use_libutil=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
384   use_libnsl=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
385   use_nsswitch=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
386
387   define Package/eglibc/install
388         $(CP) ./eglibc-files/* $(1)/
389         rm -f $(1)/etc/localtime
390         ln -sf /tmp/localtime $(1)/etc/localtime
391         $(INSTALL_DIR) $(1)/lib
392         $(CP) \
393                 $(TOOLCHAIN_DIR)/lib/ld*.so.* \
394                 $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so \
395                 $(1)/lib/
396         for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
397                 for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so; do \
398                         if [ -e "$$$$file" ]; then \
399                                 $(CP) $$$$file $(1)/lib/; \
400                         fi; \
401                 done; \
402         done
403   endef
404
405   define Package/uClibc/install
406         $(INSTALL_DIR) $(1)/lib
407         $(CP) \
408                 $(TOOLCHAIN_DIR)/lib/ld*-uClibc.so.* \
409                 $(TOOLCHAIN_DIR)/lib/ld*-uClibc-$(LIBC_SO_VERSION).so \
410                 $(1)/lib/
411         $(CP) \
412                 $(TOOLCHAIN_DIR)/lib/libc.so.* \
413                 $(TOOLCHAIN_DIR)/lib/libuClibc-$(LIBC_SO_VERSION).so \
414                 $(1)/lib/
415         for file in libcrypt libdl libm libutil; do \
416                 $(CP) \
417                         $(TOOLCHAIN_DIR)/lib/$$$$file.so.* \
418                         $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so \
419                         $(1)/lib/; \
420         done
421
422         $(CP) \
423                 $(PKG_BUILD_DIR)/libuClibc-* \
424                 $(PKG_BUILD_DIR)/libm-* \
425                 $(PKG_BUILD_DIR)/libcrypt-* \
426                 $(1)/lib/
427   endef
428
429   define Package/musl/install
430         $(INSTALL_DIR) $(1)/lib
431         $(CP) \
432                 $(TOOLCHAIN_DIR)/lib/ld-musl-*.so* \
433                 $(1)/lib/
434         $(CP) \
435                 $(TOOLCHAIN_DIR)/lib/libc.so* \
436                 $(1)/lib/
437   endef
438
439   define Package/libc/install
440     $(call Package/$(LIBC)/install,$1)
441   endef
442
443   define Package/libc/install_lib
444         $(CP) $(filter-out %/libdl_pic.a %/libpthread_pic.a %/libresolv_pic.a,$(wildcard $(TOOLCHAIN_DIR)/lib/lib*.a)) $(1)/lib/
445         $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libc_so.a $(1)/lib/libc_pic.a)
446         $(if $(LIBGCC_MAP), \
447                 $(CP) $(LIBGCC_A) $(1)/lib/libgcc_s_pic.a; \
448                 $(CP) $(LIBGCC_MAP) $(1)/lib/libgcc_s_pic.map \
449         )
450   endef
451
452   define Package/libpthread/install
453         $(INSTALL_DIR) $(1)/lib
454         $(CP) \
455                 $(TOOLCHAIN_DIR)/lib/libpthread.so.* \
456                 $(if $(BUILD_LIBGCC),\
457                         $(PKG_BUILD_DIR)/libpthread-$(LIBC_SO_VERSION).so, \
458                         $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \
459                 ) \
460                 $(1)/lib/
461   endef
462
463   define Package/libthread-db/install
464         $(INSTALL_DIR) $(1)/lib
465         $(CP) \
466                 $(TOOLCHAIN_DIR)/lib/libthread_db.so.* $(1)/lib
467   ifeq ($(USE_UCLIBC),y)
468         $(CP) \
469                 $(TOOLCHAIN_DIR)/lib/libthread_db-$(LIBC_SO_VERSION).so \
470                 $(1)/lib/
471   endif
472   endef
473
474   define Package/libpthread/install_lib
475         $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libpthread_so.a $(1)/lib/libpthread_pic.a)
476   endef
477
478   define Package/librt/install
479         $(INSTALL_DIR) $(1)/lib
480         $(CP) \
481                 $(TOOLCHAIN_DIR)/lib/librt.so.* \
482                 $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \
483                 $(1)/lib/
484   endef
485
486   define Package/ldd/install
487         $(INSTALL_DIR) $(1)/usr/bin/
488         $(CP) $(TOOLCHAIN_DIR)/bin/ldd $(1)/usr/bin/
489   endef
490
491   define Package/ldconfig/install
492         $(INSTALL_DIR) $(1)/sbin/
493         $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
494   endef
495
496 else
497
498   define Package/libgcc/install
499         for file in $(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)); do \
500                 dir=`dirname $$$$file` ; \
501                 $(INSTALL_DIR) $(1)/$$$$dir ; \
502                 $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
503         done ; \
504         exit 0
505   endef
506
507   define Package/libgfortran/install
508         for file in $(call qstrip,$(CONFIG_LIBGFORTRAN_FILE_SPEC)); do \
509                 dir=`dirname $$$$file` ; \
510                 $(INSTALL_DIR) $(1)/$$$$dir ; \
511                 $(CP) $(call qstrip,$(CONFIG_LIBGFORTRAN_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
512         done
513   endef
514
515   define Package/libssp/install
516         for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
517                 dir=`dirname $$$$file` ; \
518                 $(INSTALL_DIR) $(1)/$$$$dir ; \
519                 $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
520         done ; \
521         exit 0
522   endef
523
524   define Package/libstdcpp/install
525         for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \
526                 dir=`dirname $$$$file` ; \
527                 $(INSTALL_DIR) $(1)/$$$$dir ; \
528                 $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
529         done ; \
530         exit 0
531   endef
532
533   define Package/libc/install
534         for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \
535                 dir=`dirname $$$$file` ; \
536                 $(INSTALL_DIR) $(1)/$$$$dir ; \
537                 $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
538         done ; \
539         exit 0
540   endef
541
542   define Package/libpthread/install
543         for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \
544                 dir=`dirname $$$$file` ; \
545                 $(INSTALL_DIR) $(1)/$$$$dir ; \
546                 $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
547         done ; \
548         exit 0
549   endef
550
551   define Package/librt/install
552         for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \
553                 dir=`dirname $$$$file` ; \
554                 $(INSTALL_DIR) $(1)/$$$$dir ; \
555                 $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
556         done ; \
557         exit 0
558   endef
559
560   define Package/ldd/install
561         for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
562                 dir=`dirname $$$$file` ; \
563                 $(INSTALL_DIR) $(1)/$$$$dir ; \
564                 $(CP) $(call qstrip,$(CONFIG_LDD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
565         done ; \
566         exit 0
567   endef
568
569   define Package/ldconfig/install
570         for file in $(call qstrip,$(CONFIG_LDCONFIG_FILE_SPEC)); do \
571                 dir=`dirname $$$$file` ; \
572                 $(INSTALL_DIR) $(1)/$$$$dir ; \
573                 $(CP) $(call qstrip,$(CONFIG_LDCONFIG_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
574         done ; \
575         exit 0
576   endef
577
578 endif
579
580 $(eval $(call BuildPackage,libc))
581 $(eval $(call BuildPackage,libgcc))
582 $(eval $(call BuildPackage,libssp))
583 $(eval $(call BuildPackage,libstdcpp))
584 $(eval $(call BuildPackage,libpthread))
585 $(eval $(call BuildPackage,libthread-db))
586 $(eval $(call BuildPackage,librt))
587 $(eval $(call BuildPackage,libgfortran))
588 $(eval $(call BuildPackage,ldd))
589 $(eval $(call BuildPackage,ldconfig))