78ece51d21c636741d6a69783a6ad7d2649a1c3c
[openwrt/svn-archive/archive.git] / package / base-files / Makefile
1 #
2 # Copyright (C) 2007-2012 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11 include $(INCLUDE_DIR)/version.mk
12
13 PKG_NAME:=base-files
14 PKG_RELEASE:=107
15
16 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
17 PKG_BUILD_DEPENDS:=opkg/host
18
19 include $(INCLUDE_DIR)/package.mk
20
21 ifneq ($(DUMP),1)
22 TARGET:=-$(BOARD)
23 ifneq ($(wildcard $(PLATFORM_DIR)/base-files-$(PROFILE) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)),)
24 TARGET:=$(TARGET)-$(PROFILE)
25 endif
26 LIBGCC_VERSION:=$(GCC_VERSION)
27 ifneq ($(findstring $(ARCH) , mips64 x86_64 ),)
28 LIB_SUFFIX:=64
29 endif
30 else
31 LIBC_VERSION:=<LIBC_VERSION>
32 LIBGCC_VERSION:=<LIBGCC_VERSION>
33 endif
34
35 define Package/base-files
36 SECTION:=base
37 CATEGORY:=Base system
38 DEPENDS:=+!USE_NETIFD:base-files-network +USE_NETIFD:netifd
39 TITLE:=Base filesystem for OpenWrt
40 URL:=http://openwrt.org/
41 VERSION:=$(PKG_RELEASE)-$(REVISION)
42 endef
43
44 define Package/base-files/conffiles
45 /etc/hosts
46 /etc/inittab
47 /etc/group
48 /etc/passwd
49 /etc/shadow
50 /etc/profile
51 /etc/shells
52 /etc/sysctl.conf
53 /etc/rc.local
54 /etc/sysupgrade.conf
55 /etc/config/
56 /etc/dropbear/
57 /etc/crontabs/
58 $(call $(TARGET)/conffiles)
59 endef
60
61 define Package/base-files/description
62 This package contains a base filesystem and system scripts for OpenWrt.
63 endef
64
65 define Package/base-files/config
66 config USE_NETIFD
67 bool "Use netifd instead of the old network init scripts (experimental!)"
68 default n
69 endef
70
71 define Package/gcc/Default
72 SECTION:=libs
73 CATEGORY:=Base system
74 URL:=http://gcc.gnu.org/
75 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
76 endef
77
78
79 define Package/libgcc
80 $(call Package/gcc/Default)
81 TITLE:=GCC support library
82 DEPENDS+=@!(TARGET_avr32||TARGET_coldfire)
83 endef
84
85 define Package/libgcc/config
86 menu "Configuration"
87 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
88
89 config LIBGCC_ROOT_DIR
90 string
91 prompt "libgcc shared library base directory"
92 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
93 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
94 default "/" if NATIVE_TOOLCHAIN
95
96 config LIBGCC_FILE_SPEC
97 string
98 prompt "libgcc shared library files (use wildcards)"
99 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
100 default "./lib/libgcc_s.so.*"
101
102 endmenu
103 endef
104
105
106 define Package/libssp
107 $(call Package/gcc/Default)
108 DEPENDS+=@SSP_SUPPORT
109 TITLE:=GCC support library
110 endef
111
112 define Package/libssp/config
113 menu "Configuration"
114 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
115
116 config LIBSPP_ROOT_DIR
117 string
118 prompt "libssp shared library base directory"
119 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
120 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
121 default "/" if NATIVE_TOOLCHAIN
122
123 config LIBSSP_FILE_SPEC
124 string
125 prompt "libssp shared library files (use wildcards)"
126 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
127 default "./lib/libssp.so.*"
128
129 endmenu
130 endef
131
132
133 define Package/libstdcpp
134 $(call Package/gcc/Default)
135 NAME:=libstdc++
136 TITLE:=GNU Standard C++ Library v3
137 DEPENDS+=@INSTALL_LIBSTDCPP
138 endef
139
140 define Package/libstdcpp/config
141 menu "Configuration"
142 depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
143
144 config LIBSTDCPP_ROOT_DIR
145 string
146 prompt "libstdcpp shared library base directory"
147 depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
148 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
149 default "/" if NATIVE_TOOLCHAIN
150
151 config LIBSTDCPP_FILE_SPEC
152 string
153 prompt "libstdc++ shared library files (use wildcards)"
154 depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
155 default "./lib/libstdc++.so.*"
156
157 endmenu
158 endef
159
160
161 define Package/libc/Default
162 SECTION:=libs
163 CATEGORY:=Base system
164 VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
165 ifneq ($(TARGET_avr32)$(TARGET_coldfire),)
166 DEPENDS:=+libgcc
167 endif
168 URL:=$(LIBC_URL)
169 PKG_FLAGS:=hold essential
170 endef
171
172
173 define Package/libc
174 $(call Package/libc/Default)
175 TITLE:=C library
176 endef
177
178 define Package/libc/config
179 menu "Configuration"
180 depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
181
182 config LIBC_ROOT_DIR
183 string
184 prompt "libc shared library base directory"
185 depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
186 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
187 default "/" if NATIVE_TOOLCHAIN
188
189 config LIBC_FILE_SPEC
190 string
191 prompt "libc shared library files (use wildcards)"
192 depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
193 default "./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
194
195 endmenu
196 endef
197
198
199 define Package/libpthread
200 $(call Package/libc/Default)
201 TITLE:=POSIX thread library
202 endef
203
204 define Package/libpthread/config
205 menu "Configuration"
206 depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
207
208 config LIBPTHREAD_ROOT_DIR
209 string
210 prompt "libpthread shared library base directory"
211 depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
212 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
213 default "/" if NATIVE_TOOLCHAIN
214
215 config LIBPTHREAD_FILE_SPEC
216 string
217 prompt "libpthread shared library files (use wildcards)"
218 depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
219 default "./lib/libpthread{-*.so,.so.*}"
220
221 endmenu
222 endef
223
224
225 define Package/librt
226 $(call Package/libc/Default)
227 TITLE:=POSIX.1b RealTime extension library
228 DEPENDS:=+libpthread
229 endef
230
231 define Package/librt/config
232 menu "Configuration"
233 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
234
235 config LIBRT_ROOT_DIR
236 string
237 prompt "librt shared library base directory"
238 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
239 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
240 default "/" if NATIVE_TOOLCHAIN
241
242 config LIBRT_FILE_SPEC
243 string
244 prompt "librt shared library files (use wildcards)"
245 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
246 default "./lib/librt{-*.so,.so.*}"
247
248 endmenu
249 endef
250
251
252 define Package/libgfortran
253 $(call Package/gcc/Default)
254 TITLE:=GFortran support library
255 DEPENDS+=@!(TARGET_avr32||TARGET_coldfire) @INSTALL_GFORTRAN
256 endef
257
258 define Package/libgfortran/config
259 menu "Configuration"
260 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
261
262 config LIBGFORTRAN_ROOT_DIR
263 string
264 prompt "libgfortran shared library base directory"
265 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
266 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
267 default "/" if NATIVE_TOOLCHAIN
268
269 config LIBGFORTRAN_FILE_SPEC
270 string
271 prompt "libgfortran shared library files (use wildcards)"
272 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgfortran
273 default "./usr/lib/libgfortran.so.*"
274
275 endmenu
276 endef
277
278 define Package/ldd
279 $(call Package/libc/Default)
280 SECTION:=utils
281 CATEGORY:=Utilities
282 TITLE:=LDD trace utility
283 endef
284
285 define Package/ldd/config
286 menu "Configuration"
287 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
288
289 config LDD_ROOT_DIR
290 string
291 prompt "ldd trace utility base directory"
292 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
293 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
294 default "/" if NATIVE_TOOLCHAIN
295
296 config LDD_FILE_SPEC
297 string
298 prompt "ldd trace utility file"
299 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
300 default "./usr/bin/ldd"
301
302 endmenu
303 endef
304
305
306 define Package/ldconfig
307 $(call Package/libc/Default)
308 SECTION:=utils
309 CATEGORY:=Utilities
310 TITLE:=Shared library path configuration
311 endef
312
313 define Package/ldconfig/config
314 menu "Configuration"
315 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
316
317 config LDCONFIG_ROOT_DIR
318 string
319 prompt "ldconfig base directory"
320 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
321 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
322 default "/" if NATIVE_TOOLCHAIN
323
324 config LDCONFIG_FILE_SPEC
325 string
326 prompt "ldconfig file"
327 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
328 default "./sbin/ldconfig"
329
330 endmenu
331 endef
332
333
334 ifneq ($(CONFIG_PREINITOPT),)
335 define ImageConfigOptions
336 mkdir -p $(1)/lib/preinit
337 echo 'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib/preinit/00_preinit.conf
338 echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib/preinit/00_preinit.conf
339 echo 'pi_init_path=$(if $(CONFIG_TARGET_INIT_PATH),$(CONFIG_TARGET_INIT_PATH),"/bin:/sbin:/usr/bin:/usr/sbin")' >>$(1)/lib/preinit/00_preinit.conf
340 echo 'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib/preinit/00_preinit.conf
341 echo 'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib/preinit/00_preinit.conf
342 echo 'pi_init_suppress_stderr="$(CONFIG_TARGET_INIT_SUPPRESS_STDERR)"' >>$(1)/lib/preinit/00_preinit.conf
343 echo 'pi_ifname=$(if $(CONFIG_TARGET_PREINIT_IFNAME),$(CONFIG_TARGET_PREINIT_IFNAME),"")' >>$(1)/lib/preinit/00_preinit.conf
344 echo 'pi_ip=$(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/lib/preinit/00_preinit.conf
345 echo 'pi_netmask=$(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/lib/preinit/00_preinit.conf
346 echo 'pi_broadcast=$(if $(CONFIG_TARGET_PREINIT_BROADCAST),$(CONFIG_TARGET_PREINIT_BROADCAST),"192.168.1.255")' >>$(1)/lib/preinit/00_preinit.conf
347 echo 'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
348 echo 'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
349 endef
350 endif
351
352 define Build/Prepare
353 mkdir -p $(PKG_BUILD_DIR)
354 endef
355
356 LIBGCC_A=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc_pic.a)
357 LIBGCC_MAP=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.map)
358 LIBGCC_SO=$(wildcard $(TOOLCHAIN_DIR)/lib/libgcc_s.so.*)
359 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
360 ifneq ($(if $(CONFIG_USE_UCLIBC),$(CONFIG_GCC_VERSION_LINARO)),)
361 BUILD_LIBGCC:=$(if $(CONFIG_avr32)$(CONFIG_m68k)$(CONFIG_powerpc),,$(PKG_BUILD_DIR)/libgcc_s.so.*)
362 endif
363 endif
364
365 ifneq ($(BUILD_LIBGCC),)
366 define Build/Compile/uClibc
367 $(SCRIPT_DIR)/relink-lib.sh \
368 "$(TARGET_CROSS)" \
369 "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
370 "$(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a)" \
371 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libuClibc-*.so))" \
372 -Wl,-init,__uClibc_init -Wl,-soname=libc.so.0 \
373 $(BUILD_LIBGCC)
374 $(SCRIPT_DIR)/relink-lib.sh \
375 "$(TARGET_CROSS)" \
376 "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so)" \
377 "$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt_pic.a)" \
378 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libcrypt-*.so))" \
379 $(BUILD_LIBGCC) \
380 -Wl,-soname=libcrypt.so.0
381 $(SCRIPT_DIR)/relink-lib.sh \
382 "$(TARGET_CROSS)" \
383 "$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so)" \
384 "$(wildcard $(TOOLCHAIN_DIR)/lib/libm_pic.a)" \
385 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libm-*.so))" \
386 $(BUILD_LIBGCC) \
387 -Wl,-soname=libm.so.0
388 $(SCRIPT_DIR)/relink-lib.sh \
389 "$(TARGET_CROSS)" \
390 "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so)" \
391 "$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a)" \
392 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(wildcard $(TOOLCHAIN_DIR)/lib/libpthread-*.so))" \
393 -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal \
394 -ldl -lc $(BUILD_LIBGCC) \
395 -Wl,-soname=libpthread.so.0
396 endef
397 define Build/Compile/libgcc
398 $(SCRIPT_DIR)/relink-lib.sh \
399 "$(TARGET_CROSS)" \
400 "$(LIBGCC_SO)" \
401 "$(LIBGCC_A)" \
402 "$(patsubst $(TOOLCHAIN_DIR)/lib/%,$(PKG_BUILD_DIR)/%,$(LIBGCC_SO))" \
403 -Wl,--version-script=$(LIBGCC_MAP) -Wl,-soname=libgcc_s.so.1
404 endef
405 else
406 define Build/Compile/uClibc
407 $(CP) \
408 $(TOOLCHAIN_DIR)/lib/libuClibc-*.so \
409 $(TOOLCHAIN_DIR)/lib/libcrypt-*.so \
410 $(TOOLCHAIN_DIR)/lib/libm-*.so \
411 $(TOOLCHAIN_DIR)/lib/libpthread-*.so \
412 $(PKG_BUILD_DIR)/
413 endef
414 ifneq ($(LIBGCC_SO),)
415 define Build/Compile/libgcc
416 $(CP) $(LIBGCC_SO) $(PKG_BUILD_DIR)/
417 endef
418 endif
419 endif
420
421 define Build/Compile/Default
422 $(call Build/Compile/libgcc)
423 $(call Build/Compile/$(LIBC))
424 endef
425 Build/Compile = $(Build/Compile/Default)
426
427 define Package/base-files/install
428 $(CP) ./files/* $(1)/
429 if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
430 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
431 fi
432 if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
433 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
434 fi
435 if [ -d $(PLATFORM_DIR)/base-files-$(PROFILE)/. ]; then \
436 $(CP) $(PLATFORM_DIR)/base-files-$(PROFILE)/* $(1)/; \
437 fi
438 if [ -d $(PLATFORM_DIR)/$(PROFILE)/base-files/. ]; then \
439 $(CP) $(PLATFORM_DIR)/$(PROFILE)/base-files/* $(1)/; \
440 fi
441 $(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
442 if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
443 $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
444 fi; \
445 if [ -d $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/. ]; then \
446 $(CP) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/* $(1)/; \
447 fi; \
448 if [ -d $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/. ]; then \
449 $(CP) $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/* $(1)/; \
450 fi \
451 )
452 # Form valid /etc/shadow entries, by copying the user:pw pairs
453 # from /etc/passwd, and adding on pw change data
454 cut -d ':' -f 1-2 $(1)/etc/passwd > $(1)/etc/shadow; \
455 $(SED) 's/$$$$/:0:0:99999:7:::/' $(1)/etc/shadow
456
457 $(VERSION_SED) \
458 $(1)/etc/banner \
459 $(1)/etc/openwrt_version \
460 $(1)/etc/openwrt_release
461
462 mkdir -p $(1)/CONTROL
463 mkdir -p $(1)/dev
464 mkdir -p $(1)/etc/crontabs
465 mkdir -p $(1)/etc/rc.d
466 mkdir -p $(1)/overlay
467 mkdir -p $(1)/lib/firmware
468 $(if $(LIB_SUFFIX),-ln -s lib $(1)/lib$(LIB_SUFFIX))
469 mkdir -p $(1)/mnt
470 mkdir -p $(1)/proc
471 mkdir -p $(1)/tmp
472 mkdir -p $(1)/usr/lib
473 $(if $(LIB_SUFFIX),-ln -s lib $(1)/usr/lib$(LIB_SUFFIX))
474 mkdir -p $(1)/usr/bin
475 mkdir -p $(1)/sys
476 mkdir -p $(1)/www
477 mkdir -p $(1)/root
478 ln -sf /proc/mounts $(1)/etc/mtab
479 rm -f $(1)/var
480 ln -sf /tmp $(1)/var
481 mkdir -p $(1)/etc
482 ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
483 $(call ImageConfigOptions,$(1))
484 $(call Package/base-files/install-target,$(1))
485 for conffile in $(1)/etc/config/*; do \
486 if [ -f "$$$$conffile" ]; then \
487 grep "$$$${conffile##$(1)}" $(1)/CONTROL/conffiles || \
488 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
489 fi \
490 done
491 endef
492
493 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
494
495 define Package/libgcc/install
496 $(INSTALL_DIR) $(1)/lib
497 $(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/
498 endef
499
500 define Package/libgfortran/install
501 $(INSTALL_DIR) $(1)/usr/lib
502 $(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/
503 endef
504
505 define Package/libssp/install
506 $(INSTALL_DIR) $(1)/lib
507 $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
508 endef
509
510 define Package/libstdcpp/install
511 $(INSTALL_DIR) $(1)/usr/lib
512 $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
513 endef
514
515 use_libutil=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
516 use_libnsl=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
517 use_nsswitch=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
518
519 define Package/eglibc/install
520 $(CP) ./eglibc-files/* $(1)/
521 rm -f $(1)/etc/localtime
522 ln -sf /tmp/localtime $(1)/etc/localtime
523 $(INSTALL_DIR) $(1)/lib
524 $(CP) \
525 $(TOOLCHAIN_DIR)/lib/ld*.so.* \
526 $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so \
527 $(1)/lib/
528 for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
529 for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so; do \
530 if [ -e "$$$$file" ]; then \
531 $(CP) $$$$file $(1)/lib/; \
532 fi; \
533 done; \
534 done
535 endef
536
537 define Package/uClibc/install
538 $(INSTALL_DIR) $(1)/lib
539 $(CP) \
540 $(TOOLCHAIN_DIR)/lib/ld*-uClibc.so.* \
541 $(TOOLCHAIN_DIR)/lib/ld*-uClibc-$(LIBC_SO_VERSION).so \
542 $(1)/lib/
543 $(CP) \
544 $(TOOLCHAIN_DIR)/lib/libc.so.* \
545 $(TOOLCHAIN_DIR)/lib/libuClibc-$(LIBC_SO_VERSION).so \
546 $(1)/lib/
547 for file in libcrypt libdl libm libutil; do \
548 $(CP) \
549 $(TOOLCHAIN_DIR)/lib/$$$$file.so.* \
550 $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so \
551 $(1)/lib/; \
552 done
553
554 $(CP) \
555 $(PKG_BUILD_DIR)/libuClibc-* \
556 $(PKG_BUILD_DIR)/libm-* \
557 $(PKG_BUILD_DIR)/libcrypt-* \
558 $(1)/lib/
559 endef
560
561 define Package/libc/install
562 $(call Package/$(LIBC)/install,$1)
563 endef
564
565 define Package/libc/install_lib
566 $(CP) $(filter-out %/libdl_pic.a %/libpthread_pic.a %/libresolv_pic.a,$(wildcard $(TOOLCHAIN_DIR)/lib/lib*.a)) $(1)/lib/
567 $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libc_so.a $(1)/lib/libc_pic.a)
568 $(if $(LIBGCC_MAP), \
569 $(CP) $(LIBGCC_A) $(1)/lib/libgcc_s_pic.a; \
570 $(CP) $(LIBGCC_MAP) $(1)/lib/libgcc_s_pic.map \
571 )
572 endef
573
574 define Package/libpthread/install
575 $(INSTALL_DIR) $(1)/lib
576 $(CP) \
577 $(TOOLCHAIN_DIR)/lib/libpthread.so.* \
578 $(if $(BUILD_LIBGCC),\
579 $(PKG_BUILD_DIR)/libpthread-$(LIBC_SO_VERSION).so, \
580 $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so \
581 ) \
582 $(1)/lib/
583 endef
584
585 define Package/libpthread/install_lib
586 $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libpthread_so.a $(1)/lib/libpthread_pic.a)
587 endef
588
589 define Package/librt/install
590 $(INSTALL_DIR) $(1)/lib
591 $(CP) \
592 $(TOOLCHAIN_DIR)/lib/librt.so.* \
593 $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \
594 $(1)/lib/
595 endef
596
597 define Package/ldd/install
598 $(INSTALL_DIR) $(1)/usr/bin/
599 $(CP) $(TOOLCHAIN_DIR)/bin/ldd $(1)/usr/bin/
600 endef
601
602 define Package/ldconfig/install
603 $(INSTALL_DIR) $(1)/sbin/
604 $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
605 endef
606
607 else
608
609 define Package/libgcc/install
610 for file in $(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)); do \
611 dir=`dirname $$$$file` ; \
612 $(INSTALL_DIR) $(1)/$$$$dir ; \
613 $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
614 done ; \
615 exit 0
616 endef
617
618 define Package/libgfortran/install
619 for file in $(call qstrip,$(CONFIG_LIBGFORTRAN_FILE_SPEC)); do \
620 dir=`dirname $$$$file` ; \
621 $(INSTALL_DIR) $(1)/$$$$dir ; \
622 $(CP) $(call qstrip,$(CONFIG_LIBGFORTRAN_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
623 done
624 endef
625
626 define Package/libssp/install
627 for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
628 dir=`dirname $$$$file` ; \
629 $(INSTALL_DIR) $(1)/$$$$dir ; \
630 $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
631 done ; \
632 exit 0
633 endef
634
635 define Package/libstdcpp/install
636 for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \
637 dir=`dirname $$$$file` ; \
638 $(INSTALL_DIR) $(1)/$$$$dir ; \
639 $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
640 done ; \
641 exit 0
642 endef
643
644 define Package/libc/install
645 for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \
646 dir=`dirname $$$$file` ; \
647 $(INSTALL_DIR) $(1)/$$$$dir ; \
648 $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
649 done ; \
650 exit 0
651 endef
652
653 define Package/libpthread/install
654 for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \
655 dir=`dirname $$$$file` ; \
656 $(INSTALL_DIR) $(1)/$$$$dir ; \
657 $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
658 done ; \
659 exit 0
660 endef
661
662 define Package/librt/install
663 for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \
664 dir=`dirname $$$$file` ; \
665 $(INSTALL_DIR) $(1)/$$$$dir ; \
666 $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
667 done ; \
668 exit 0
669 endef
670
671 define Package/ldd/install
672 for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
673 dir=`dirname $$$$file` ; \
674 $(INSTALL_DIR) $(1)/$$$$dir ; \
675 $(CP) $(call qstrip,$(CONFIG_LDD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
676 done ; \
677 exit 0
678 endef
679
680 define Package/ldconfig/install
681 for file in $(call qstrip,$(CONFIG_LDCONFIG_FILE_SPEC)); do \
682 dir=`dirname $$$$file` ; \
683 $(INSTALL_DIR) $(1)/$$$$dir ; \
684 $(CP) $(call qstrip,$(CONFIG_LDCONFIG_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
685 done ; \
686 exit 0
687 endef
688
689 endif
690
691 ifneq ($(DUMP),1)
692 -include $(PLATFORM_DIR)/base-files.mk
693 endif
694
695 $(eval $(call BuildPackage,base-files))
696 $(eval $(call BuildPackage,libc))
697 $(eval $(call BuildPackage,libgcc))
698 $(eval $(call BuildPackage,libssp))
699 $(eval $(call BuildPackage,libstdcpp))
700 $(eval $(call BuildPackage,libpthread))
701 $(eval $(call BuildPackage,librt))
702 $(eval $(call BuildPackage,libgfortran))
703 $(eval $(call BuildPackage,ldd))
704 $(eval $(call BuildPackage,ldconfig))