packages: clean up the package folder
[openwrt.git] / package / libs / 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 on EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
38
39         config LIBGCC_ROOT_DIR
40                 string
41                 prompt "libgcc shared library base directory"
42                 depends on 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 on 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 on EXTERNAL_TOOLCHAIN && PACKAGE_libssp
65
66         config LIBSSP_ROOT_DIR
67                 string
68                 prompt "libssp shared library base directory"
69                 depends on 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 on 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 endef
88
89 define Package/libstdcpp/config
90         menu "Configuration"
91         depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
92
93         config LIBSTDCPP_ROOT_DIR
94                 string
95                 prompt "libstdcpp shared library base directory"
96                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
97                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
98                 default "/"  if NATIVE_TOOLCHAIN
99
100         config LIBSTDCPP_FILE_SPEC
101                 string
102                 prompt "libstdc++ shared library files (use wildcards)"
103                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
104                 default "./lib/libstdc++.so.*"
105
106         endmenu
107 endef
108
109
110 define Package/libc/Default
111   SECTION:=libs
112   CATEGORY:=Base system
113   VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
114   DEPENDS:=+libgcc
115   URL:=$(LIBC_URL)
116   PKG_FLAGS:=hold essential
117 endef
118
119
120 define Package/libc
121 $(call Package/libc/Default)
122   TITLE:=C library
123 endef
124
125 define Package/libc/config
126         menu "Configuration"
127         depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
128
129         config LIBC_ROOT_DIR
130                 string
131                 prompt "libc shared library base directory"
132                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
133                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
134                 default "/"  if NATIVE_TOOLCHAIN
135
136         config LIBC_FILE_SPEC
137                 string
138                 prompt "libc shared library files (use wildcards)"
139                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc
140                 default "./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
141
142         endmenu
143 endef
144
145
146 define Package/libpthread
147 $(call Package/libc/Default)
148   TITLE:=POSIX thread library
149 endef
150
151 define Package/libpthread/config
152         menu "Configuration"
153         depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
154
155         config LIBPTHREAD_ROOT_DIR
156                 string
157                 prompt "libpthread shared library base directory"
158                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
159                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
160                 default "/"  if NATIVE_TOOLCHAIN
161
162         config LIBPTHREAD_FILE_SPEC
163                 string
164                 prompt "libpthread shared library files (use wildcards)"
165                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
166                 default "./lib/libpthread{-*.so,.so.*}"
167
168         endmenu
169 endef
170
171
172 define Package/libthread-db
173 $(call Package/libc/Default)
174   DEPENDS:=@!USE_MUSL
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 on EXTERNAL_TOOLCHAIN && PACKAGE_librt
187
188         config LIBRT_ROOT_DIR
189                 string
190                 prompt "librt shared library base directory"
191                 depends on 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 on 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 on EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
214
215         config LIBGFORTRAN_ROOT_DIR
216                 string
217                 prompt "libgfortran shared library base directory"
218                 depends on 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 on 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   DEPENDS:=@!USE_MUSL
234   SECTION:=utils
235   CATEGORY:=Utilities
236   TITLE:=LDD trace utility
237 endef
238
239 define Package/ldd/config
240         menu "Configuration"
241                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
242
243         config LDD_ROOT_DIR
244                 string
245                 prompt "ldd trace utility base directory"
246                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
247                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
248                 default "/"  if NATIVE_TOOLCHAIN
249
250         config LDD_FILE_SPEC
251                 string
252                 prompt "ldd trace utility file"
253                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldd
254                 default "./usr/bin/ldd"
255
256         endmenu
257 endef
258
259
260 define Package/ldconfig
261 $(call Package/libc/Default)
262   DEPENDS:=@!USE_MUSL
263   SECTION:=utils
264   CATEGORY:=Utilities
265   TITLE:=Shared library path configuration
266 endef
267
268 define Package/ldconfig/config
269         menu "Configuration"
270                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
271
272         config LDCONFIG_ROOT_DIR
273                 string
274                 prompt "ldconfig base directory"
275                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
276                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
277                 default "/"  if NATIVE_TOOLCHAIN
278
279         config LDCONFIG_FILE_SPEC
280                 string
281                 prompt "ldconfig file"
282                 depends on EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
283                 default "./sbin/ldconfig"
284
285         endmenu
286 endef
287
288 define Build/Prepare
289         mkdir -p $(PKG_BUILD_DIR)
290 endef
291
292 LIBGCC_A=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc_pic.a)
293 LIBGCC_MAP=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.map)
294 LIBGCC_SO=$(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so.*)
295 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
296   ifneq ($(if $(CONFIG_USE_UCLIBC),$(CONFIG_GCC_VERSION_LINARO)),)
297     BUILD_LIBGCC:=$(if $(CONFIG_avr32)$(CONFIG_m68k)$(CONFIG_powerpc),,$(PKG_BUILD_DIR)/libgcc_s.so.*)
298   endif
299 endif
300
301 ifneq ($(BUILD_LIBGCC),)
302   define Build/Compile/uClibc
303         $(SCRIPT_DIR)/relink-lib.sh \
304                 "$(TARGET_CROSS)" \
305                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
306                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
307                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libuClibc-*.so))" \
308                 -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 \
309                 $(BUILD_LIBGCC)
310         $(SCRIPT_DIR)/relink-lib.sh \
311                 "$(TARGET_CROSS)" \
312                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so)" \
313                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt_pic.a)" \
314                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so))" \
315                 $(BUILD_LIBGCC) \
316                 -Wl,-soname=libcrypt.so.0
317         $(SCRIPT_DIR)/relink-lib.sh \
318                 "$(TARGET_CROSS)" \
319                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so)" \
320                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libm_pic.a)" \
321                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so))" \
322                 $(BUILD_LIBGCC) \
323                 -Wl,-soname=libm.so.0
324         $(SCRIPT_DIR)/relink-lib.sh \
325                 "$(TARGET_CROSS)" \
326                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so)" \
327                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a)" \
328                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so))" \
329                 -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal \
330                 -ldl -lc $(BUILD_LIBGCC) \
331                 -Wl,-soname=libpthread.so.0
332   endef
333   define Build/Compile/libgcc
334         $(SCRIPT_DIR)/relink-lib.sh \
335                 "$(TARGET_CROSS)" \
336                 "$(LIBGCC_SO)" \
337                 "$(LIBGCC_A)" \
338                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(LIBGCC_SO))" \
339                 -Wl,--version-script=$(LIBGCC_MAP) -Wl,-soname=libgcc_s.so.1
340   endef
341 else
342   define Build/Compile/uClibc
343         $(CP) \
344                 $(TOOLCHAIN_DIR)/lib/libuClibc-*.so \
345                 $(TOOLCHAIN_DIR)/lib/libcrypt-*.so \
346                 $(TOOLCHAIN_DIR)/lib/libm-*.so \
347                 $(TOOLCHAIN_DIR)/lib/libpthread-*.so \
348                 $(PKG_BUILD_DIR)/
349   endef
350   ifneq ($(LIBGCC_SO),)
351     define Build/Compile/libgcc
352         $(CP) $(LIBGCC_SO) $(PKG_BUILD_DIR)/
353     endef
354   endif
355 endif
356
357 define Build/Compile/Default
358         $(call Build/Compile/libgcc)
359         $(call Build/Compile/$(LIBC))
360 endef
361 Build/Compile = $(Build/Compile/Default)
362
363 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
364
365   define Package/libgcc/install
366         $(INSTALL_DIR) $(1)/lib
367         $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/)
368   endef
369
370   define Package/libgfortran/install
371         $(INSTALL_DIR) $(1)/usr/lib
372         $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/)
373   endef
374
375   define Package/libssp/install
376         $(INSTALL_DIR) $(1)/lib
377         $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
378   endef
379
380   define Package/libstdcpp/install
381         $(INSTALL_DIR) $(1)/usr/lib
382         $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
383   endef
384
385   use_libutil=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
386   use_libnsl=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
387   use_nsswitch=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
388
389   define Package/eglibc/install
390         $(CP) ./eglibc-files/* $(1)/
391         rm -f $(1)/etc/localtime
392         ln -sf /tmp/localtime $(1)/etc/localtime
393         $(INSTALL_DIR) $(1)/lib
394         $(CP) \
395                 $(TOOLCHAIN_DIR)/lib/ld*.so.* \
396                 $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so \
397                 $(1)/lib/
398         for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
399                 for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so; do \
400                         if [ -e "$$$$file" ]; then \
401                                 $(CP) $$$$file $(1)/lib/; \
402                         fi; \
403                 done; \
404         done
405   endef
406
407   define Package/uClibc/install
408         $(INSTALL_DIR) $(1)/lib
409         $(CP) \
410                 $(TOOLCHAIN_DIR)/lib/ld*-uClibc.so.* \
411                 $(TOOLCHAIN_DIR)/lib/ld*-uClibc-$(LIBC_SO_VERSION).so \
412                 $(1)/lib/
413         $(CP) \
414                 $(TOOLCHAIN_DIR)/lib/libc.so.* \
415                 $(TOOLCHAIN_DIR)/lib/libuClibc-$(LIBC_SO_VERSION).so \
416                 $(1)/lib/
417         for file in libcrypt libdl libm libutil; do \
418                 $(CP) \
419                         $(TOOLCHAIN_DIR)/lib/$$$$file.so.* \
420                         $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so \
421                         $(1)/lib/; \
422         done
423
424         $(CP) \
425                 $(PKG_BUILD_DIR)/libuClibc-* \
426                 $(PKG_BUILD_DIR)/libm-* \
427                 $(PKG_BUILD_DIR)/libcrypt-* \
428                 $(1)/lib/
429   endef
430
431   define Package/musl/install
432         $(INSTALL_DIR) $(1)/lib
433         $(CP) \
434                 $(TOOLCHAIN_DIR)/lib/ld-musl-*.so* \
435                 $(1)/lib/
436         $(CP) \
437                 $(TOOLCHAIN_DIR)/lib/libc.so* \
438                 $(1)/lib/
439   endef
440
441   define Package/libc/install
442     $(call Package/$(LIBC)/install,$1)
443   endef
444
445   define Package/libc/install_lib
446         $(CP) $(filter-out %/libdl_pic.a %/libpthread_pic.a %/libresolv_pic.a,$(wildcard $(TOOLCHAIN_DIR)/lib/lib*.a)) $(1)/lib/
447         $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libc_so.a $(1)/lib/libc_pic.a)
448         $(if $(LIBGCC_MAP), \
449                 $(CP) $(LIBGCC_A) $(1)/lib/libgcc_s_pic.a; \
450                 $(CP) $(LIBGCC_MAP) $(1)/lib/libgcc_s_pic.map \
451         )
452   endef
453
454   define Package/libpthread/install
455         $(INSTALL_DIR) $(1)/lib
456   ifneq ($(CONFIG_USE_MUSL),y)
457         $(CP) \
458                 $(TOOLCHAIN_DIR)/lib/libpthread.so.* \
459                 $(if $(BUILD_LIBGCC),\
460                         $(PKG_BUILD_DIR)/libpthread-$(LIBC_SO_VERSION).so, \
461                         $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \
462                 ) \
463                 $(1)/lib/
464   endif
465   endef
466
467   define Package/libthread-db/install
468         $(INSTALL_DIR) $(1)/lib
469         $(CP) \
470                 $(TOOLCHAIN_DIR)/lib/libthread_db.so.* $(1)/lib
471   ifeq ($(USE_UCLIBC),y)
472         $(CP) \
473                 $(TOOLCHAIN_DIR)/lib/libthread_db-$(LIBC_SO_VERSION).so \
474                 $(1)/lib/
475   endif
476   endef
477
478   define Package/libpthread/install_lib
479         $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libpthread_so.a $(1)/lib/libpthread_pic.a)
480   endef
481
482   define Package/librt/install
483         $(INSTALL_DIR) $(1)/lib
484   ifneq ($(CONFIG_USE_MUSL),y)
485         $(CP) \
486                 $(TOOLCHAIN_DIR)/lib/librt.so.* \
487                 $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \
488                 $(1)/lib/
489   endif
490   endef
491
492   define Package/ldd/install
493         $(INSTALL_DIR) $(1)/usr/bin/
494         $(CP) $(TOOLCHAIN_DIR)/bin/ldd $(1)/usr/bin/
495   endef
496
497   define Package/ldconfig/install
498         $(INSTALL_DIR) $(1)/sbin/
499         $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
500   endef
501
502 else
503
504   define Package/libgcc/install
505         for file in $(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)); do \
506                 dir=`dirname $$$$file` ; \
507                 $(INSTALL_DIR) $(1)/$$$$dir ; \
508                 $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
509         done ; \
510         exit 0
511   endef
512
513   define Package/libgfortran/install
514         for file in $(call qstrip,$(CONFIG_LIBGFORTRAN_FILE_SPEC)); do \
515                 dir=`dirname $$$$file` ; \
516                 $(INSTALL_DIR) $(1)/$$$$dir ; \
517                 $(CP) $(call qstrip,$(CONFIG_LIBGFORTRAN_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
518         done
519   endef
520
521   define Package/libssp/install
522         for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
523                 dir=`dirname $$$$file` ; \
524                 $(INSTALL_DIR) $(1)/$$$$dir ; \
525                 $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
526         done ; \
527         exit 0
528   endef
529
530   define Package/libstdcpp/install
531         for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \
532                 dir=`dirname $$$$file` ; \
533                 $(INSTALL_DIR) $(1)/$$$$dir ; \
534                 $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
535         done ; \
536         exit 0
537   endef
538
539   define Package/libc/install
540         for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \
541                 dir=`dirname $$$$file` ; \
542                 $(INSTALL_DIR) $(1)/$$$$dir ; \
543                 $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
544         done ; \
545         exit 0
546   endef
547
548   define Package/libpthread/install
549         for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \
550                 dir=`dirname $$$$file` ; \
551                 $(INSTALL_DIR) $(1)/$$$$dir ; \
552                 $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
553         done ; \
554         exit 0
555   endef
556
557   define Package/librt/install
558         for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \
559                 dir=`dirname $$$$file` ; \
560                 $(INSTALL_DIR) $(1)/$$$$dir ; \
561                 $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
562         done ; \
563         exit 0
564   endef
565
566   define Package/ldd/install
567         for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
568                 dir=`dirname $$$$file` ; \
569                 $(INSTALL_DIR) $(1)/$$$$dir ; \
570                 $(CP) $(call qstrip,$(CONFIG_LDD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
571         done ; \
572         exit 0
573   endef
574
575   define Package/ldconfig/install
576         for file in $(call qstrip,$(CONFIG_LDCONFIG_FILE_SPEC)); do \
577                 dir=`dirname $$$$file` ; \
578                 $(INSTALL_DIR) $(1)/$$$$dir ; \
579                 $(CP) $(call qstrip,$(CONFIG_LDCONFIG_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
580         done ; \
581         exit 0
582   endef
583
584 endif
585
586 $(eval $(call BuildPackage,libc))
587 $(eval $(call BuildPackage,libgcc))
588 $(eval $(call BuildPackage,libssp))
589 $(eval $(call BuildPackage,libstdcpp))
590 $(eval $(call BuildPackage,libpthread))
591 $(eval $(call BuildPackage,libthread-db))
592 $(eval $(call BuildPackage,librt))
593 $(eval $(call BuildPackage,libgfortran))
594 $(eval $(call BuildPackage,ldd))
595 $(eval $(call BuildPackage,ldconfig))