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