toolchain: mark unavailable packages for musl libc
[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   DEPENDS:=@!USE_MUSL
176   TITLE:=POSIX thread library debugging support
177 endef
178
179 define Package/librt
180 $(call Package/libc/Default)
181   TITLE:=POSIX.1b RealTime extension library
182   DEPENDS:=+libpthread
183 endef
184
185 define Package/librt/config
186         menu "Configuration"
187         depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
188
189         config LIBRT_ROOT_DIR
190                 string
191                 prompt "librt shared library base directory"
192                 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
193                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
194                 default "/"  if NATIVE_TOOLCHAIN
195
196         config LIBRT_FILE_SPEC
197                 string
198                 prompt "librt shared library files (use wildcards)"
199                 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
200                 default "./lib/librt{-*.so,.so.*}"
201
202         endmenu
203 endef
204
205
206 define Package/libgfortran
207 $(call Package/gcc/Default)
208   TITLE:=GFortran support library
209   DEPENDS+=@INSTALL_GFORTRAN
210 endef
211
212 define Package/libgfortran/config
213         menu "Configuration"
214                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
215
216         config LIBGFORTRAN_ROOT_DIR
217                 string
218                 prompt "libgfortran shared library base directory"
219                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
220                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
221                 default "/"  if NATIVE_TOOLCHAIN
222
223         config LIBGFORTRAN_FILE_SPEC
224                 string
225                 prompt "libgfortran shared library files (use wildcards)"
226                 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
227                 default "./usr/lib/libgfortran.so.*"
228
229         endmenu
230 endef
231
232 define Package/ldd
233 $(call Package/libc/Default)
234   DEPENDS:=@!USE_MUSL
235   SECTION:=utils
236   CATEGORY:=Utilities
237   TITLE:=LDD trace utility
238 endef
239
240 define Package/ldd/config
241         menu "Configuration"
242                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
243
244         config LDD_ROOT_DIR
245                 string
246                 prompt "ldd trace utility base directory"
247                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
248                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
249                 default "/"  if NATIVE_TOOLCHAIN
250
251         config LDD_FILE_SPEC
252                 string
253                 prompt "ldd trace utility file"
254                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
255                 default "./usr/bin/ldd"
256
257         endmenu
258 endef
259
260
261 define Package/ldconfig
262 $(call Package/libc/Default)
263   DEPENDS:=@!USE_MUSL
264   SECTION:=utils
265   CATEGORY:=Utilities
266   TITLE:=Shared library path configuration
267 endef
268
269 define Package/ldconfig/config
270         menu "Configuration"
271                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
272
273         config LDCONFIG_ROOT_DIR
274                 string
275                 prompt "ldconfig base directory"
276                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
277                 default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
278                 default "/"  if NATIVE_TOOLCHAIN
279
280         config LDCONFIG_FILE_SPEC
281                 string
282                 prompt "ldconfig file"
283                 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
284                 default "./sbin/ldconfig"
285
286         endmenu
287 endef
288
289 define Build/Prepare
290         mkdir -p $(PKG_BUILD_DIR)
291 endef
292
293 LIBGCC_A=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc_pic.a)
294 LIBGCC_MAP=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.map)
295 LIBGCC_SO=$(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so.*)
296 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
297   ifneq ($(if $(CONFIG_USE_UCLIBC),$(CONFIG_GCC_VERSION_LINARO)),)
298     BUILD_LIBGCC:=$(if $(CONFIG_avr32)$(CONFIG_m68k)$(CONFIG_powerpc),,$(PKG_BUILD_DIR)/libgcc_s.so.*)
299   endif
300 endif
301
302 ifneq ($(BUILD_LIBGCC),)
303   define Build/Compile/uClibc
304         $(SCRIPT_DIR)/relink-lib.sh \
305                 "$(TARGET_CROSS)" \
306                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
307                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
308                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libuClibc-*.so))" \
309                 -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 \
310                 $(BUILD_LIBGCC)
311         $(SCRIPT_DIR)/relink-lib.sh \
312                 "$(TARGET_CROSS)" \
313                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so)" \
314                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt_pic.a)" \
315                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so))" \
316                 $(BUILD_LIBGCC) \
317                 -Wl,-soname=libcrypt.so.0
318         $(SCRIPT_DIR)/relink-lib.sh \
319                 "$(TARGET_CROSS)" \
320                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so)" \
321                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libm_pic.a)" \
322                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so))" \
323                 $(BUILD_LIBGCC) \
324                 -Wl,-soname=libm.so.0
325         $(SCRIPT_DIR)/relink-lib.sh \
326                 "$(TARGET_CROSS)" \
327                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so)" \
328                 "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a)" \
329                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so))" \
330                 -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal \
331                 -ldl -lc $(BUILD_LIBGCC) \
332                 -Wl,-soname=libpthread.so.0
333   endef
334   define Build/Compile/libgcc
335         $(SCRIPT_DIR)/relink-lib.sh \
336                 "$(TARGET_CROSS)" \
337                 "$(LIBGCC_SO)" \
338                 "$(LIBGCC_A)" \
339                 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(LIBGCC_SO))" \
340                 -Wl,--version-script=$(LIBGCC_MAP) -Wl,-soname=libgcc_s.so.1
341   endef
342 else
343   define Build/Compile/uClibc
344         $(CP) \
345                 $(TOOLCHAIN_DIR)/lib/libuClibc-*.so \
346                 $(TOOLCHAIN_DIR)/lib/libcrypt-*.so \
347                 $(TOOLCHAIN_DIR)/lib/libm-*.so \
348                 $(TOOLCHAIN_DIR)/lib/libpthread-*.so \
349                 $(PKG_BUILD_DIR)/
350   endef
351   ifneq ($(LIBGCC_SO),)
352     define Build/Compile/libgcc
353         $(CP) $(LIBGCC_SO) $(PKG_BUILD_DIR)/
354     endef
355   endif
356 endif
357
358 define Build/Compile/Default
359         $(call Build/Compile/libgcc)
360         $(call Build/Compile/$(LIBC))
361 endef
362 Build/Compile = $(Build/Compile/Default)
363
364 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
365
366   define Package/libgcc/install
367         $(INSTALL_DIR) $(1)/lib
368         $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/)
369   endef
370
371   define Package/libgfortran/install
372         $(INSTALL_DIR) $(1)/usr/lib
373         $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/)
374   endef
375
376   define Package/libssp/install
377         $(INSTALL_DIR) $(1)/lib
378         $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
379   endef
380
381   define Package/libstdcpp/install
382         $(INSTALL_DIR) $(1)/usr/lib
383         $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
384   endef
385
386   use_libutil=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
387   use_libnsl=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
388   use_nsswitch=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
389
390   define Package/eglibc/install
391         $(CP) ./eglibc-files/* $(1)/
392         rm -f $(1)/etc/localtime
393         ln -sf /tmp/localtime $(1)/etc/localtime
394         $(INSTALL_DIR) $(1)/lib
395         $(CP) \
396                 $(TOOLCHAIN_DIR)/lib/ld*.so.* \
397                 $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so \
398                 $(1)/lib/
399         for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
400                 for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so; do \
401                         if [ -e "$$$$file" ]; then \
402                                 $(CP) $$$$file $(1)/lib/; \
403                         fi; \
404                 done; \
405         done
406   endef
407
408   define Package/uClibc/install
409         $(INSTALL_DIR) $(1)/lib
410         $(CP) \
411                 $(TOOLCHAIN_DIR)/lib/ld*-uClibc.so.* \
412                 $(TOOLCHAIN_DIR)/lib/ld*-uClibc-$(LIBC_SO_VERSION).so \
413                 $(1)/lib/
414         $(CP) \
415                 $(TOOLCHAIN_DIR)/lib/libc.so.* \
416                 $(TOOLCHAIN_DIR)/lib/libuClibc-$(LIBC_SO_VERSION).so \
417                 $(1)/lib/
418         for file in libcrypt libdl libm libutil; do \
419                 $(CP) \
420                         $(TOOLCHAIN_DIR)/lib/$$$$file.so.* \
421                         $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so \
422                         $(1)/lib/; \
423         done
424
425         $(CP) \
426                 $(PKG_BUILD_DIR)/libuClibc-* \
427                 $(PKG_BUILD_DIR)/libm-* \
428                 $(PKG_BUILD_DIR)/libcrypt-* \
429                 $(1)/lib/
430   endef
431
432   define Package/musl/install
433         $(INSTALL_DIR) $(1)/lib
434         $(CP) \
435                 $(TOOLCHAIN_DIR)/lib/ld-musl-*.so* \
436                 $(1)/lib/
437         $(CP) \
438                 $(TOOLCHAIN_DIR)/lib/libc.so* \
439                 $(1)/lib/
440   endef
441
442   define Package/libc/install
443     $(call Package/$(LIBC)/install,$1)
444   endef
445
446   define Package/libc/install_lib
447         $(CP) $(filter-out %/libdl_pic.a %/libpthread_pic.a %/libresolv_pic.a,$(wildcard $(TOOLCHAIN_DIR)/lib/lib*.a)) $(1)/lib/
448         $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libc_so.a $(1)/lib/libc_pic.a)
449         $(if $(LIBGCC_MAP), \
450                 $(CP) $(LIBGCC_A) $(1)/lib/libgcc_s_pic.a; \
451                 $(CP) $(LIBGCC_MAP) $(1)/lib/libgcc_s_pic.map \
452         )
453   endef
454
455   define Package/libpthread/install
456         $(INSTALL_DIR) $(1)/lib
457   ifneq ($(CONFIG_USE_MUSL),y)
458         $(CP) \
459                 $(TOOLCHAIN_DIR)/lib/libpthread.so.* \
460                 $(if $(BUILD_LIBGCC),\
461                         $(PKG_BUILD_DIR)/libpthread-$(LIBC_SO_VERSION).so, \
462                         $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \
463                 ) \
464                 $(1)/lib/
465   endif
466   endef
467
468   define Package/libthread-db/install
469         $(INSTALL_DIR) $(1)/lib
470         $(CP) \
471                 $(TOOLCHAIN_DIR)/lib/libthread_db.so.* $(1)/lib
472   ifeq ($(USE_UCLIBC),y)
473         $(CP) \
474                 $(TOOLCHAIN_DIR)/lib/libthread_db-$(LIBC_SO_VERSION).so \
475                 $(1)/lib/
476   endif
477   endef
478
479   define Package/libpthread/install_lib
480         $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libpthread_so.a $(1)/lib/libpthread_pic.a)
481   endef
482
483   define Package/librt/install
484         $(INSTALL_DIR) $(1)/lib
485   ifneq ($(CONFIG_USE_MUSL),y)
486         $(CP) \
487                 $(TOOLCHAIN_DIR)/lib/librt.so.* \
488                 $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \
489                 $(1)/lib/
490   endif
491   endef
492
493   define Package/ldd/install
494         $(INSTALL_DIR) $(1)/usr/bin/
495         $(CP) $(TOOLCHAIN_DIR)/bin/ldd $(1)/usr/bin/
496   endef
497
498   define Package/ldconfig/install
499         $(INSTALL_DIR) $(1)/sbin/
500         $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
501   endef
502
503 else
504
505   define Package/libgcc/install
506         for file in $(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)); do \
507                 dir=`dirname $$$$file` ; \
508                 $(INSTALL_DIR) $(1)/$$$$dir ; \
509                 $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
510         done ; \
511         exit 0
512   endef
513
514   define Package/libgfortran/install
515         for file in $(call qstrip,$(CONFIG_LIBGFORTRAN_FILE_SPEC)); do \
516                 dir=`dirname $$$$file` ; \
517                 $(INSTALL_DIR) $(1)/$$$$dir ; \
518                 $(CP) $(call qstrip,$(CONFIG_LIBGFORTRAN_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
519         done
520   endef
521
522   define Package/libssp/install
523         for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
524                 dir=`dirname $$$$file` ; \
525                 $(INSTALL_DIR) $(1)/$$$$dir ; \
526                 $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
527         done ; \
528         exit 0
529   endef
530
531   define Package/libstdcpp/install
532         for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \
533                 dir=`dirname $$$$file` ; \
534                 $(INSTALL_DIR) $(1)/$$$$dir ; \
535                 $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
536         done ; \
537         exit 0
538   endef
539
540   define Package/libc/install
541         for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \
542                 dir=`dirname $$$$file` ; \
543                 $(INSTALL_DIR) $(1)/$$$$dir ; \
544                 $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
545         done ; \
546         exit 0
547   endef
548
549   define Package/libpthread/install
550         for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \
551                 dir=`dirname $$$$file` ; \
552                 $(INSTALL_DIR) $(1)/$$$$dir ; \
553                 $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
554         done ; \
555         exit 0
556   endef
557
558   define Package/librt/install
559         for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \
560                 dir=`dirname $$$$file` ; \
561                 $(INSTALL_DIR) $(1)/$$$$dir ; \
562                 $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
563         done ; \
564         exit 0
565   endef
566
567   define Package/ldd/install
568         for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
569                 dir=`dirname $$$$file` ; \
570                 $(INSTALL_DIR) $(1)/$$$$dir ; \
571                 $(CP) $(call qstrip,$(CONFIG_LDD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
572         done ; \
573         exit 0
574   endef
575
576   define Package/ldconfig/install
577         for file in $(call qstrip,$(CONFIG_LDCONFIG_FILE_SPEC)); do \
578                 dir=`dirname $$$$file` ; \
579                 $(INSTALL_DIR) $(1)/$$$$dir ; \
580                 $(CP) $(call qstrip,$(CONFIG_LDCONFIG_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
581         done ; \
582         exit 0
583   endef
584
585 endif
586
587 $(eval $(call BuildPackage,libc))
588 $(eval $(call BuildPackage,libgcc))
589 $(eval $(call BuildPackage,libssp))
590 $(eval $(call BuildPackage,libstdcpp))
591 $(eval $(call BuildPackage,libpthread))
592 $(eval $(call BuildPackage,libthread-db))
593 $(eval $(call BuildPackage,librt))
594 $(eval $(call BuildPackage,libgfortran))
595 $(eval $(call BuildPackage,ldd))
596 $(eval $(call BuildPackage,ldconfig))