2 # Copyright (C) 2007-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
9 include $(INCLUDE_DIR
)/kernel.mk
14 PKG_FILE_DEPENDS
:=$(PLATFORM_DIR
)/ $(GENERIC_PLATFORM_DIR
)/base-files
/
16 include $(INCLUDE_DIR
)/package.mk
20 ifneq ($(wildcard $(PLATFORM_DIR
)/base-files-
$(PROFILE
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)),)
21 TARGET
:=$(TARGET
)-$(PROFILE
)
23 LIBGCC_VERSION
:=$(GCC_VERSION
)
27 ifneq ($(findstring mips64
,$(ARCH
)),)
31 LIBC_VERSION
:=<LIBC_VERSION
>
32 LIBGCC_VERSION
:=<LIBGCC_VERSION
>
35 define Package
/base-files
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
)
48 define Package
/base-files
/conffiles
57 $(call
$(TARGET
)/conffiles
)
60 define Package
/base-files
/description
61 This package contains a base filesystem and system scripts for OpenWrt.
65 define Package
/gcc
/Default
68 URL
:=http
://gcc.gnu.org
/
69 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
74 $(call Package
/gcc
/Default
)
75 TITLE
:=GCC support library
76 DEPENDS
+=@
!(TARGET_avr32||TARGET_coldfire
)
79 define Package
/libgcc
/config
81 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libgcc
83 config LIBGCC_ROOT_DIR
85 prompt
"libgcc shared library base directory"
86 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libgcc
87 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
88 default
"/" if NATIVE_TOOLCHAIN
90 config LIBGCC_FILE_SPEC
92 prompt
"libgcc shared library files (use wildcards)"
93 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libgcc
94 default
"./lib/libgcc_s.so.*"
100 define Package
/libssp
101 $(call Package
/gcc
/Default
)
102 DEPENDS
+=@SSP_SUPPORT
103 TITLE
:=GCC support library
106 define Package
/libssp
/config
108 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libssp
110 config LIBSPP_ROOT_DIR
112 prompt
"libssp shared library base directory"
113 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libssp
114 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
115 default
"/" if NATIVE_TOOLCHAIN
117 config LIBSSP_FILE_SPEC
119 prompt
"libssp shared library files (use wildcards)"
120 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libssp
121 default
"./lib/libssp.so.*"
127 define Package
/libstdcpp
128 $(call Package
/gcc
/Default
)
130 TITLE
:=GNU Standard C
++ Library v3
131 DEPENDS
+=@INSTALL_LIBSTDCPP
134 define Package
/libstdcpp
/config
136 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libstdcpp
138 config LIBSTDCPP_ROOT_DIR
140 prompt
"libstdcpp shared library base directory"
141 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libstdcpp
142 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
143 default
"/" if NATIVE_TOOLCHAIN
145 config LIBSTDCPP_FILE_SPEC
147 prompt
"libstdc++ shared library files (use wildcards)"
148 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libstdcpp
149 default
"./lib/libstdc++.so.*"
155 define Package
/libc
/Default
157 CATEGORY
:=Base system
158 VERSION
:=$(LIBC_VERSION
)-$(PKG_RELEASE
)
159 ifneq ($(TARGET_avr32
)$(TARGET_coldfire
),)
167 $(call Package
/libc
/Default
)
171 define Package
/libc
/config
173 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
177 prompt
"libc shared library base directory"
178 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
179 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
180 default
"/" if NATIVE_TOOLCHAIN
182 config LIBC_FILE_SPEC
184 prompt
"libc shared library files (use wildcards)"
185 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
186 default
"./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
192 define Package
/libpthread
193 $(call Package
/libc
/Default
)
194 TITLE
:=POSIX thread library
198 define Package
/libpthread
/config
200 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
202 config LIBPTHREAD_ROOT_DIR
204 prompt
"libpthread shared library base directory"
205 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
206 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
207 default
"/" if NATIVE_TOOLCHAIN
209 config LIBPTHREAD_FILE_SPEC
211 prompt
"libpthread shared library files (use wildcards)"
212 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
213 default
"./lib/libpthread{-*.so,.so.*}"
220 $(call Package
/libc
/Default
)
221 TITLE
:=POSIX
.1b RealTime extension library
224 define Package
/librt
/config
226 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
228 config LIBRT_ROOT_DIR
230 prompt
"librt shared library base directory"
231 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
232 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
233 default
"/" if NATIVE_TOOLCHAIN
235 config LIBRT_FILE_SPEC
237 prompt
"librt shared library files (use wildcards)"
238 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
239 default
"./lib/librt{-*.so,.so.*}"
246 $(call Package
/libc
/Default
)
249 TITLE
:=LDD trace utility
252 define Package
/ldd
/config
254 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
258 prompt
"ldd trace utility base directory"
259 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
260 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
261 default
"/" if NATIVE_TOOLCHAIN
265 prompt
"ldd trace utility file"
266 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
267 default
"./usr/bin/ldd"
273 define Package
/ldconfig
274 $(call Package
/libc
/Default
)
277 TITLE
:=Shared library path configuration
280 define Package
/ldconfig
/config
282 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
284 config LDCONFIG_ROOT_DIR
286 prompt
"ldconfig base directory"
287 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
288 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
289 default
"/" if NATIVE_TOOLCHAIN
291 config LDCONFIG_FILE_SPEC
293 prompt
"ldconfig file"
294 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
295 default
"./sbin/ldconfig"
302 mkdir
-p
$(PKG_BUILD_DIR
)
305 define Build
/Compile
/Default
309 $(call Build
/Compile
/Default
)
312 define Package
/base-files
/install
313 $(CP
) .
/files
/* $(1)/
314 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
315 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
317 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
318 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
320 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
321 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
323 if
[ -d
$(PLATFORM_DIR
)/$(PROFILE
)/base-files
/.
]; then \
324 $(CP
) $(PLATFORM_DIR
)/$(PROFILE
)/base-files
/* $(1)/; \
326 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
327 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
328 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
330 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
331 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
333 if
[ -d
$(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/.
]; then \
334 $(CP
) $(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/* $(1)/; \
337 # Form valid /etc/shadow entries, by copying the user:pw pairs
338 # from /etc/passwd, and adding on pw change data
339 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
340 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
341 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
343 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
344 mkdir
-p
$(1)/CONTROL
346 mkdir
-p
$(1)/etc
/crontabs
347 mkdir
-p
$(1)/etc
/rc.d
349 mkdir
-p
$(1)/lib
/firmware
350 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/lib
$(LIB_SUFFIX
))
354 mkdir
-p
$(1)/usr
/lib
355 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
356 mkdir
-p
$(1)/usr
/bin
360 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
364 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
365 $(call Package
/base-files
/install-target
,$(1))
366 for conffile in
$(1)/etc
/config
/*; do \
367 if
[ -f
"$$$$conffile" ]; then \
368 grep
"$$$${conffile##$(1)}" $(1)/CONTROL
/conffiles || \
369 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
374 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN
),)
376 define Package
/libgcc
/install
377 $(INSTALL_DIR
) $(1)/lib
378 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
381 define Package
/libssp
/install
382 $(INSTALL_DIR
) $(1)/lib
383 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
386 define Package
/libstdcpp
/install
387 $(INSTALL_DIR
) $(1)/usr
/lib
388 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
391 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
392 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
393 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
395 define Package
/glibc
/install
396 $(INSTALL_DIR
) $(1)/lib
397 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
398 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
399 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
400 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
401 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
405 define Package
/eglibc
/install
406 $(call Package
/glibc
/install,$1)
409 define Package
/uClibc
/install
410 $(INSTALL_DIR
) $(1)/lib
411 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
412 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
413 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
417 define Package
/libc
/install
418 $(call Package
/$(LIBC
)/install,$1)
421 define Package
/libc
/install_lib
422 $(CP
) $(filter-out %/libdl_pic.a
%/libpthread_pic.a
%/libresolv_pic.a
,$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/lib
*.a
)) $(1)/lib
/
423 $(if
$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
),$(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
$(1)/lib
/libc_pic.a
)
424 $(if
$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/gcc
/*/*/libgcc.map
), \
425 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/gcc
/*/*/libgcc_pic.a
$(1)/lib
/libgcc_s_pic.a
; \
426 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/gcc
/*/*/libgcc.map
$(1)/lib
/libgcc_s_pic.map \
430 define Package
/libpthread
/install
431 $(INSTALL_DIR
) $(1)/lib
432 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
433 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
436 define Package
/libpthread
/install_lib
437 $(if
$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
),$(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/libpthread_so.a
$(1)/lib
/libpthread_pic.a
)
440 define Package
/librt
/install
441 $(INSTALL_DIR
) $(1)/lib
442 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
443 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
446 define Package
/ldd
/install
447 $(INSTALL_DIR
) $(1)/usr
/bin
/
448 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
451 define Package
/ldconfig
/install
452 $(INSTALL_DIR
) $(1)/sbin
/
453 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
458 define Package
/libgcc
/install
459 for file in
$(call qstrip
,$(CONFIG_LIBGCC_FILE_SPEC
)); do \
460 dir=`dirname $$$$file` ; \
461 $(INSTALL_DIR
) $(1)/$$$$dir ; \
462 $(CP
) $(call qstrip
,$(CONFIG_LIBGCC_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
466 define Package
/libssp
/install
467 for file in
$(call qstrip
,$(CONFIG_LIBSSP_FILE_SPEC
)); do \
468 dir=`dirname $$$$file` ; \
469 $(INSTALL_DIR
) $(1)/$$$$dir ; \
470 $(CP
) $(call qstrip
,$(CONFIG_LIBSSP_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
474 define Package
/libstdcpp
/install
475 for file in
$(call qstrip
,$(CONFIG_LIBSTDCPP_FILE_SPEC
)); do \
476 dir=`dirname $$$$file` ; \
477 $(INSTALL_DIR
) $(1)/$$$$dir ; \
478 $(CP
) $(call qstrip
,$(CONFIG_LIBSTDCPP_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
482 define Package
/libc
/install
483 for file in
$(call qstrip
,$(CONFIG_LIBC_FILE_SPEC
)); do \
484 dir=`dirname $$$$file` ; \
485 $(INSTALL_DIR
) $(1)/$$$$dir ; \
486 $(CP
) $(call qstrip
,$(CONFIG_LIBC_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
490 define Package
/libpthread
/install
491 for file in
$(call qstrip
,$(CONFIG_LIBPTHREAD_FILE_SPEC
)); do \
492 dir=`dirname $$$$file` ; \
493 $(INSTALL_DIR
) $(1)/$$$$dir ; \
494 $(CP
) $(call qstrip
,$(CONFIG_LIBPTHREAD_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
498 define Package
/librt
/install
499 for file in
$(call qstrip
,$(CONFIG_LIBRT_FILE_SPEC
)); do \
500 dir=`dirname $$$$file` ; \
501 $(INSTALL_DIR
) $(1)/$$$$dir ; \
502 $(CP
) $(call qstrip
,$(CONFIG_LIBRT_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
506 define Package
/ldd
/install
507 for file in
$(call qstrip
,$(CONFIG_LDD_FILE_SPEC
)); do \
508 dir=`dirname $$$$file` ; \
509 $(INSTALL_DIR
) $(1)/$$$$dir ; \
510 $(CP
) $(call qstrip
,$(CONFIG_LDD_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
514 define Package
/ldconfig
/install
515 for file in
$(call qstrip
,$(CONFIG_LDCONFIG_FILE_SPEC
)); do \
516 dir=`dirname $$$$file` ; \
517 $(INSTALL_DIR
) $(1)/$$$$dir ; \
518 $(CP
) $(call qstrip
,$(CONFIG_LDCONFIG_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
525 -include $(PLATFORM_DIR
)/base-files.mk
528 $(eval
$(call BuildPackage
,base-files
))
529 $(eval
$(call BuildPackage
,libc
))
530 $(eval
$(call BuildPackage
,libgcc
))
531 $(eval
$(call BuildPackage
,libssp
))
532 $(eval
$(call BuildPackage
,libstdcpp
))
533 $(eval
$(call BuildPackage
,libpthread
))
534 $(eval
$(call BuildPackage
,librt
))
535 $(eval
$(call BuildPackage
,ldd
))
536 $(eval
$(call BuildPackage
,ldconfig
))