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
)
164 $(call Package
/libc
/Default
)
168 define Package
/libc
/config
170 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
174 prompt
"libc shared library base directory"
175 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
176 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
177 default
"/" if NATIVE_TOOLCHAIN
179 config LIBC_FILE_SPEC
181 prompt
"libc shared library files (use wildcards)"
182 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
183 default
"./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
189 define Package
/libpthread
190 $(call Package
/libc
/Default
)
191 TITLE
:=POSIX thread library
195 define Package
/libpthread
/config
197 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
199 config LIBPTHREAD_ROOT_DIR
201 prompt
"libpthread shared library base directory"
202 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
203 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
204 default
"/" if NATIVE_TOOLCHAIN
206 config LIBPTHREAD_FILE_SPEC
208 prompt
"libpthread shared library files (use wildcards)"
209 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
210 default
"./lib/libpthread{-*.so,.so.*}"
217 $(call Package
/libc
/Default
)
218 TITLE
:=POSIX
.1b RealTime extension library
221 define Package
/librt
/config
223 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
225 config LIBRT_ROOT_DIR
227 prompt
"librt shared library base directory"
228 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
229 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
230 default
"/" if NATIVE_TOOLCHAIN
232 config LIBRT_FILE_SPEC
234 prompt
"librt shared library files (use wildcards)"
235 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
236 default
"./lib/librt{-*.so,.so.*}"
243 $(call Package
/libc
/Default
)
246 TITLE
:=LDD trace utility
249 define Package
/ldd
/config
251 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
255 prompt
"ldd trace utility base directory"
256 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
257 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
258 default
"/" if NATIVE_TOOLCHAIN
262 prompt
"ldd trace utility file"
263 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
264 default
"./usr/bin/ldd"
270 define Package
/ldconfig
271 $(call Package
/libc
/Default
)
274 TITLE
:=Shared library path configuration
277 define Package
/ldconfig
/config
279 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
281 config LDCONFIG_ROOT_DIR
283 prompt
"ldconfig base directory"
284 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
285 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
286 default
"/" if NATIVE_TOOLCHAIN
288 config LDCONFIG_FILE_SPEC
290 prompt
"ldconfig file"
291 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
292 default
"./sbin/ldconfig"
299 mkdir
-p
$(PKG_BUILD_DIR
)
302 define Build
/Compile
/Default
306 $(call Build
/Compile
/Default
)
309 define Package
/base-files
/install
310 $(CP
) .
/files
/* $(1)/
311 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
312 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
314 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
315 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
317 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
318 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
320 if
[ -d
$(PLATFORM_DIR
)/$(PROFILE
)/base-files
/.
]; then \
321 $(CP
) $(PLATFORM_DIR
)/$(PROFILE
)/base-files
/* $(1)/; \
323 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
324 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
325 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
327 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
328 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
330 if
[ -d
$(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/.
]; then \
331 $(CP
) $(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/* $(1)/; \
334 # Form valid /etc/shadow entries, by copying the user:pw pairs
335 # from /etc/passwd, and adding on pw change data
336 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
337 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
338 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
340 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
341 mkdir
-p
$(1)/CONTROL
343 mkdir
-p
$(1)/etc
/crontabs
344 mkdir
-p
$(1)/etc
/rc.d
346 mkdir
-p
$(1)/lib
/firmware
347 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/lib
$(LIB_SUFFIX
))
351 mkdir
-p
$(1)/usr
/lib
352 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
353 mkdir
-p
$(1)/usr
/bin
357 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
361 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
362 $(call Package
/base-files
/install-target
,$(1))
363 for conffile in
$(1)/etc
/config
/*; do \
364 if
[ -f
"$$$$conffile" ]; then \
365 grep
"$$$${conffile##$(1)}" $(1)/CONTROL
/conffiles || \
366 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
371 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN
),)
373 define Package
/libgcc
/install
374 $(INSTALL_DIR
) $(1)/lib
375 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
378 define Package
/libssp
/install
379 $(INSTALL_DIR
) $(1)/lib
380 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
383 define Package
/libstdcpp
/install
384 $(INSTALL_DIR
) $(1)/usr
/lib
385 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
388 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
389 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
390 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
392 define Package
/glibc
/install
393 $(INSTALL_DIR
) $(1)/lib
394 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
395 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
396 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
397 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
398 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
402 define Package
/eglibc
/install
403 $(call Package
/glibc
/install,$1)
406 define Package
/uClibc
/install
407 $(INSTALL_DIR
) $(1)/lib
408 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
409 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
410 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
414 define Package
/libc
/install
415 $(call Package
/$(LIBC
)/install,$1)
418 define Package
/libc
/install_lib
419 $(CP
) $(filter-out %/libdl_pic.a
,$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/lib
*.a
)) $(1)/lib
/
420 $(if
$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
),$(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
$(1)/lib
/libc_pic.a
)
421 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/gcc
/*/*/libgcc.a
$(1)/lib
/libgcc_s_pic.a
424 define Package
/libpthread
/install
425 $(INSTALL_DIR
) $(1)/lib
426 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
427 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
430 define Package
/librt
/install
431 $(INSTALL_DIR
) $(1)/lib
432 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
433 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
436 define Package
/ldd
/install
437 $(INSTALL_DIR
) $(1)/usr
/bin
/
438 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
441 define Package
/ldconfig
/install
442 $(INSTALL_DIR
) $(1)/sbin
/
443 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
448 define Package
/libgcc
/install
449 for file in
$(call qstrip
,$(CONFIG_LIBGCC_FILE_SPEC
)); do \
450 dir=`dirname $$$$file` ; \
451 $(INSTALL_DIR
) $(1)/$$$$dir ; \
452 $(CP
) $(call qstrip
,$(CONFIG_LIBGCC_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
456 define Package
/libssp
/install
457 for file in
$(call qstrip
,$(CONFIG_LIBSSP_FILE_SPEC
)); do \
458 dir=`dirname $$$$file` ; \
459 $(INSTALL_DIR
) $(1)/$$$$dir ; \
460 $(CP
) $(call qstrip
,$(CONFIG_LIBSSP_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
464 define Package
/libstdcpp
/install
465 for file in
$(call qstrip
,$(CONFIG_LIBSTDCPP_FILE_SPEC
)); do \
466 dir=`dirname $$$$file` ; \
467 $(INSTALL_DIR
) $(1)/$$$$dir ; \
468 $(CP
) $(call qstrip
,$(CONFIG_LIBSTDCPP_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
472 define Package
/libc
/install
473 for file in
$(call qstrip
,$(CONFIG_LIBC_FILE_SPEC
)); do \
474 dir=`dirname $$$$file` ; \
475 $(INSTALL_DIR
) $(1)/$$$$dir ; \
476 $(CP
) $(call qstrip
,$(CONFIG_LIBC_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
480 define Package
/libpthread
/install
481 for file in
$(call qstrip
,$(CONFIG_LIBPTHREAD_FILE_SPEC
)); do \
482 dir=`dirname $$$$file` ; \
483 $(INSTALL_DIR
) $(1)/$$$$dir ; \
484 $(CP
) $(call qstrip
,$(CONFIG_LIBPTHREAD_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
488 define Package
/librt
/install
489 for file in
$(call qstrip
,$(CONFIG_LIBRT_FILE_SPEC
)); do \
490 dir=`dirname $$$$file` ; \
491 $(INSTALL_DIR
) $(1)/$$$$dir ; \
492 $(CP
) $(call qstrip
,$(CONFIG_LIBRT_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
496 define Package
/ldd
/install
497 for file in
$(call qstrip
,$(CONFIG_LDD_FILE_SPEC
)); do \
498 dir=`dirname $$$$file` ; \
499 $(INSTALL_DIR
) $(1)/$$$$dir ; \
500 $(CP
) $(call qstrip
,$(CONFIG_LDD_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
504 define Package
/ldconfig
/install
505 for file in
$(call qstrip
,$(CONFIG_LDCONFIG_FILE_SPEC
)); do \
506 dir=`dirname $$$$file` ; \
507 $(INSTALL_DIR
) $(1)/$$$$dir ; \
508 $(CP
) $(call qstrip
,$(CONFIG_LDCONFIG_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
515 -include $(PLATFORM_DIR
)/base-files.mk
518 $(eval
$(call BuildPackage
,base-files
))
519 $(eval
$(call BuildPackage
,libc
))
520 $(eval
$(call BuildPackage
,libgcc
))
521 $(eval
$(call BuildPackage
,libssp
))
522 $(eval
$(call BuildPackage
,libstdcpp
))
523 $(eval
$(call BuildPackage
,libpthread
))
524 $(eval
$(call BuildPackage
,librt
))
525 $(eval
$(call BuildPackage
,ldd
))
526 $(eval
$(call BuildPackage
,ldconfig
))