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
)
165 $(call Package
/libc
/Default
)
169 define Package
/libc
/config
171 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
175 prompt
"libc shared library base directory"
176 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
177 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
178 default
"/" if NATIVE_TOOLCHAIN
180 config LIBC_FILE_SPEC
182 prompt
"libc shared library files (use wildcards)"
183 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libc
184 default
"./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
190 define Package
/libpthread
191 $(call Package
/libc
/Default
)
192 TITLE
:=POSIX thread library
196 define Package
/libpthread
/config
198 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
200 config LIBPTHREAD_ROOT_DIR
202 prompt
"libpthread shared library base directory"
203 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
204 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
205 default
"/" if NATIVE_TOOLCHAIN
207 config LIBPTHREAD_FILE_SPEC
209 prompt
"libpthread shared library files (use wildcards)"
210 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_libpthread
211 default
"./lib/libpthread{-*.so,.so.*}"
218 $(call Package
/libc
/Default
)
219 TITLE
:=POSIX
.1b RealTime extension library
222 define Package
/librt
/config
224 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
226 config LIBRT_ROOT_DIR
228 prompt
"librt shared library base directory"
229 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
230 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
231 default
"/" if NATIVE_TOOLCHAIN
233 config LIBRT_FILE_SPEC
235 prompt
"librt shared library files (use wildcards)"
236 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_librt
237 default
"./lib/librt{-*.so,.so.*}"
244 $(call Package
/libc
/Default
)
247 TITLE
:=LDD trace utility
250 define Package
/ldd
/config
252 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
256 prompt
"ldd trace utility base directory"
257 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
258 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
259 default
"/" if NATIVE_TOOLCHAIN
263 prompt
"ldd trace utility file"
264 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldd
265 default
"./usr/bin/ldd"
271 define Package
/ldconfig
272 $(call Package
/libc
/Default
)
275 TITLE
:=Shared library path configuration
278 define Package
/ldconfig
/config
280 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
282 config LDCONFIG_ROOT_DIR
284 prompt
"ldconfig base directory"
285 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
286 default TOOLCHAIN_ROOT if
!NATIVE_TOOLCHAIN
287 default
"/" if NATIVE_TOOLCHAIN
289 config LDCONFIG_FILE_SPEC
291 prompt
"ldconfig file"
292 depends EXTERNAL_TOOLCHAIN
&& PACKAGE_ldconfig
293 default
"./sbin/ldconfig"
300 mkdir
-p
$(PKG_BUILD_DIR
)
303 define Build
/Compile
/Default
307 $(call Build
/Compile
/Default
)
310 define Package
/base-files
/install
311 $(CP
) .
/files
/* $(1)/
312 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
313 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
315 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
316 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
318 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
319 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
321 if
[ -d
$(PLATFORM_DIR
)/$(PROFILE
)/base-files
/.
]; then \
322 $(CP
) $(PLATFORM_DIR
)/$(PROFILE
)/base-files
/* $(1)/; \
324 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
325 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
326 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
328 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
329 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
331 if
[ -d
$(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/.
]; then \
332 $(CP
) $(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/* $(1)/; \
335 # Form valid /etc/shadow entries, by copying the user:pw pairs
336 # from /etc/passwd, and adding on pw change data
337 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
338 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
339 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
341 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
342 mkdir
-p
$(1)/CONTROL
344 mkdir
-p
$(1)/etc
/crontabs
345 mkdir
-p
$(1)/etc
/rc.d
347 mkdir
-p
$(1)/lib
/firmware
348 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/lib
$(LIB_SUFFIX
))
352 mkdir
-p
$(1)/usr
/lib
353 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
354 mkdir
-p
$(1)/usr
/bin
358 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
362 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
363 $(call Package
/base-files
/install-target
,$(1))
364 for conffile in
$(1)/etc
/config
/*; do \
365 if
[ -f
"$$$$conffile" ]; then \
366 grep
"$$$${conffile##$(1)}" $(1)/CONTROL
/conffiles || \
367 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
372 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN
),)
374 define Package
/libgcc
/install
375 $(INSTALL_DIR
) $(1)/lib
376 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
379 define Package
/libssp
/install
380 $(INSTALL_DIR
) $(1)/lib
381 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
384 define Package
/libstdcpp
/install
385 $(INSTALL_DIR
) $(1)/usr
/lib
386 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
389 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
390 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
391 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
393 define Package
/glibc
/install
394 $(INSTALL_DIR
) $(1)/lib
395 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
396 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
397 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
398 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
399 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
403 define Package
/eglibc
/install
404 $(call Package
/glibc
/install,$1)
407 define Package
/uClibc
/install
408 $(INSTALL_DIR
) $(1)/lib
409 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
410 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
411 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
415 define Package
/libc
/install
416 $(call Package
/$(LIBC
)/install,$1)
419 define Package
/libc
/install_lib
420 $(CP
) $(filter-out %/libdl_pic.a
,$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/lib
*.a
)) $(1)/lib
/
421 $(if
$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
),$(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
$(1)/lib
/libc_pic.a
)
422 $(if
$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/gcc
/*/*/libgcc.map
), \
423 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/gcc
/*/*/libgcc_pic.a
$(1)/lib
/libgcc_s_pic.a
; \
424 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/gcc
/*/*/libgcc.map
$(1)/lib
/libgcc_s_pic.map \
428 define Package
/libpthread
/install
429 $(INSTALL_DIR
) $(1)/lib
430 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
431 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
434 define Package
/librt
/install
435 $(INSTALL_DIR
) $(1)/lib
436 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
437 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
440 define Package
/ldd
/install
441 $(INSTALL_DIR
) $(1)/usr
/bin
/
442 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
445 define Package
/ldconfig
/install
446 $(INSTALL_DIR
) $(1)/sbin
/
447 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
452 define Package
/libgcc
/install
453 for file in
$(call qstrip
,$(CONFIG_LIBGCC_FILE_SPEC
)); do \
454 dir=`dirname $$$$file` ; \
455 $(INSTALL_DIR
) $(1)/$$$$dir ; \
456 $(CP
) $(call qstrip
,$(CONFIG_LIBGCC_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
460 define Package
/libssp
/install
461 for file in
$(call qstrip
,$(CONFIG_LIBSSP_FILE_SPEC
)); do \
462 dir=`dirname $$$$file` ; \
463 $(INSTALL_DIR
) $(1)/$$$$dir ; \
464 $(CP
) $(call qstrip
,$(CONFIG_LIBSSP_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
468 define Package
/libstdcpp
/install
469 for file in
$(call qstrip
,$(CONFIG_LIBSTDCPP_FILE_SPEC
)); do \
470 dir=`dirname $$$$file` ; \
471 $(INSTALL_DIR
) $(1)/$$$$dir ; \
472 $(CP
) $(call qstrip
,$(CONFIG_LIBSTDCPP_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
476 define Package
/libc
/install
477 for file in
$(call qstrip
,$(CONFIG_LIBC_FILE_SPEC
)); do \
478 dir=`dirname $$$$file` ; \
479 $(INSTALL_DIR
) $(1)/$$$$dir ; \
480 $(CP
) $(call qstrip
,$(CONFIG_LIBC_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
484 define Package
/libpthread
/install
485 for file in
$(call qstrip
,$(CONFIG_LIBPTHREAD_FILE_SPEC
)); do \
486 dir=`dirname $$$$file` ; \
487 $(INSTALL_DIR
) $(1)/$$$$dir ; \
488 $(CP
) $(call qstrip
,$(CONFIG_LIBPTHREAD_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
492 define Package
/librt
/install
493 for file in
$(call qstrip
,$(CONFIG_LIBRT_FILE_SPEC
)); do \
494 dir=`dirname $$$$file` ; \
495 $(INSTALL_DIR
) $(1)/$$$$dir ; \
496 $(CP
) $(call qstrip
,$(CONFIG_LIBRT_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
500 define Package
/ldd
/install
501 for file in
$(call qstrip
,$(CONFIG_LDD_FILE_SPEC
)); do \
502 dir=`dirname $$$$file` ; \
503 $(INSTALL_DIR
) $(1)/$$$$dir ; \
504 $(CP
) $(call qstrip
,$(CONFIG_LDD_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
508 define Package
/ldconfig
/install
509 for file in
$(call qstrip
,$(CONFIG_LDCONFIG_FILE_SPEC
)); do \
510 dir=`dirname $$$$file` ; \
511 $(INSTALL_DIR
) $(1)/$$$$dir ; \
512 $(CP
) $(call qstrip
,$(CONFIG_LDCONFIG_ROOT_DIR
))/$$$$file $(1)/$$$$dir/ ; \
519 -include $(PLATFORM_DIR
)/base-files.mk
522 $(eval
$(call BuildPackage
,base-files
))
523 $(eval
$(call BuildPackage
,libc
))
524 $(eval
$(call BuildPackage
,libgcc
))
525 $(eval
$(call BuildPackage
,libssp
))
526 $(eval
$(call BuildPackage
,libstdcpp
))
527 $(eval
$(call BuildPackage
,libpthread
))
528 $(eval
$(call BuildPackage
,librt
))
529 $(eval
$(call BuildPackage
,ldd
))
530 $(eval
$(call BuildPackage
,ldconfig
))