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.
64 define Package
/gcc
/Default
67 DEPENDS
:=@
!NATIVE_TOOLCHAIN
68 URL
:=http
://gcc.gnu.org
/
69 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
73 $(call Package
/gcc
/Default
)
74 TITLE
:=GCC support library
75 DEPENDS
+=@
!(TARGET_avr32||TARGET_coldfire
)
79 $(call Package
/gcc
/Default
)
81 TITLE
:=GCC support library
84 define Package
/libstdcpp
85 $(call Package
/gcc
/Default
)
87 TITLE
:=GNU Standard C
++ Library v3
88 DEPENDS
+=@INSTALL_LIBSTDCPP
91 define Package
/libc
/Default
94 DEPENDS
:=@
!NATIVE_TOOLCHAIN
95 VERSION
:=$(LIBC_VERSION
)-$(PKG_RELEASE
)
100 $(call Package
/libc
/Default
)
104 define Package
/libpthread
105 $(call Package
/libc
/Default
)
106 TITLE
:=POSIX thread library
111 $(call Package
/libc
/Default
)
112 TITLE
:=POSIX
.1b RealTime extension library
116 $(call Package
/libc
/Default
)
119 TITLE
:=LDD trace utility
122 define Package
/ldconfig
123 $(call Package
/libc
/Default
)
126 TITLE
:=Shared library path configuration
131 mkdir
-p
$(PKG_BUILD_DIR
)
134 define Build
/Compile
/Default
138 $(call Build
/Compile
/Default
)
141 define Package
/base-files
/install
142 $(CP
) .
/files
/* $(1)/
143 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
144 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
146 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
147 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
149 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
150 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
152 if
[ -d
$(PLATFORM_DIR
)/$(PROFILE
)/base-files
/.
]; then \
153 $(CP
) $(PLATFORM_DIR
)/$(PROFILE
)/base-files
/* $(1)/; \
155 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
156 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
157 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
159 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
160 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
162 if
[ -d
$(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/.
]; then \
163 $(CP
) $(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/* $(1)/; \
166 # Form valid /etc/shadow entries, by copying the user:pw pairs
167 # from /etc/passwd, and adding on pw change data
168 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
169 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
170 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
172 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
173 mkdir
-p
$(1)/CONTROL
175 mkdir
-p
$(1)/etc
/crontabs
176 mkdir
-p
$(1)/etc
/rc.d
178 mkdir
-p
$(1)/lib
/firmware
179 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/lib
$(LIB_SUFFIX
))
183 mkdir
-p
$(1)/usr
/lib
184 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
185 mkdir
-p
$(1)/usr
/bin
189 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
193 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
194 $(call Package
/base-files
/install-target
,$(1))
195 for conffile in
$(1)/etc
/config
/*; do \
196 if
[ -f
"$$$$conffile" ]; then \
197 grep
"$$$${conffile##$(1)}" $(1)/CONTROL
/conffiles || \
198 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
203 define Package
/libgcc
/install
204 $(INSTALL_DIR
) $(1)/lib
205 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
208 define Package
/libssp
/install
209 $(INSTALL_DIR
) $(1)/lib
210 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
213 define Package
/libstdcpp
/install
214 $(INSTALL_DIR
) $(1)/usr
/lib
215 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
218 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
219 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
220 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
222 define Package
/glibc
/install
223 $(INSTALL_DIR
) $(1)/lib
224 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
225 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
226 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
227 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
228 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
232 define Package
/eglibc
/install
233 $(call Package
/glibc
/install,$1)
236 define Package
/uClibc
/install
237 $(INSTALL_DIR
) $(1)/lib
238 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
239 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
240 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
244 define Package
/libc
/install
245 $(call Package
/$(LIBC
)/install,$1)
248 define Package
/libc
/install_lib
249 $(CP
) $(filter-out %/libdl_pic.a
,$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/lib
*.a
)) $(1)/lib
/
250 $(if
$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
),$(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/libc_so.a
$(1)/lib
/libc_pic.a
)
251 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
/gcc
/*/*/libgcc.a
$(1)/lib
/libgcc_s_pic.a
254 define Package
/libpthread
/install
255 $(INSTALL_DIR
) $(1)/lib
256 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
257 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
260 define Package
/librt
/install
261 $(INSTALL_DIR
) $(1)/lib
262 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
263 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
266 define Package
/ldd
/install
267 $(INSTALL_DIR
) $(1)/usr
/bin
/
268 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
271 define Package
/ldconfig
/install
272 $(INSTALL_DIR
) $(1)/sbin
/
273 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
277 -include $(PLATFORM_DIR
)/base-files.mk
280 $(eval
$(call BuildPackage
,base-files
))
281 $(eval
$(call BuildPackage
,libc
))
282 $(eval
$(call BuildPackage
,libgcc
))
283 $(eval
$(call BuildPackage
,libssp
))
284 $(eval
$(call BuildPackage
,libstdcpp
))
285 $(eval
$(call BuildPackage
,libpthread
))
286 $(eval
$(call BuildPackage
,librt
))
287 $(eval
$(call BuildPackage
,ldd
))
288 $(eval
$(call BuildPackage
,ldconfig
))