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