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 CONFIG_PACKAGE_base-files
$(TARGET
):=$(CONFIG_PACKAGE_base-files
)
37 define Package
/base-files
$(TARGET
)
40 TITLE
:=Base filesystem for OpenWrt
41 URL
:=http
://openwrt.org
/
42 VERSION
:=$(PKG_RELEASE
)-$(REVISION
)
43 $(call Config
,network.lan.proto
,string
,static
,LAN Protocol
)
44 $(call Config
,network.lan.ipaddr
,ip
,192.168.1.1,LAN IP Address
)
45 $(call Config
,network.lan.netmask
,netmask
,255.255.255.0,LAN Network Mask
)
46 $(call Config
,network.lan.gateway
,ip
,,LAN Gateway
)
47 $(call Config
,network.lan.dns
,ip
,,LAN DNS server
)
50 define Package
/base-files
$(TARGET
)/conffiles
59 $(call
$(TARGET
)/conffiles
)
62 define Package
/base-files
$(TARGET
)/description
63 This package contains a base filesystem and system scripts for OpenWrt.
66 define Package
/gcc
/Default
69 DEPENDS
:=@
!NATIVE_TOOLCHAIN
70 URL
:=http
://gcc.gnu.org
/
71 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
75 $(call Package
/gcc
/Default
)
76 TITLE
:=GCC support library
77 DEPENDS
+=@
!(TARGET_avr32||TARGET_coldfire
)
81 $(call Package
/gcc
/Default
)
83 TITLE
:=GCC support library
86 define Package
/libstdcpp
87 $(call Package
/gcc
/Default
)
89 TITLE
:=GNU Standard C
++ Library v3
90 DEPENDS
+=@INSTALL_LIBSTDCPP
93 define Package
/libc
/Default
96 DEPENDS
:=@
!NATIVE_TOOLCHAIN
97 VERSION
:=$(LIBC_VERSION
)-$(PKG_RELEASE
)
102 $(call Package
/libc
/Default
)
106 define Package
/libpthread
107 $(call Package
/libc
/Default
)
108 TITLE
:=POSIX thread library
113 $(call Package
/libc
/Default
)
114 TITLE
:=POSIX
.1b RealTime extension library
118 $(call Package
/libc
/Default
)
121 TITLE
:=LDD trace utility
124 define Package
/ldconfig
125 $(call Package
/libc
/Default
)
128 TITLE
:=Shared library path configuration
133 mkdir
-p
$(PKG_BUILD_DIR
)
136 define Build
/Compile
/Default
140 $(call Build
/Compile
/Default
)
143 define Package
/base-files
$(TARGET
)/install
144 $(CP
) .
/files
/* $(1)/
145 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
146 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
148 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
149 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
151 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
152 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
154 if
[ -d
$(PLATFORM_DIR
)/$(PROFILE
)/base-files
/.
]; then \
155 $(CP
) $(PLATFORM_DIR
)/$(PROFILE
)/base-files
/* $(1)/; \
157 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
158 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
159 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
161 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
162 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
164 if
[ -d
$(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/.
]; then \
165 $(CP
) $(PLATFORM_SUBDIR
)/$(PROFILE
)/base-files
/* $(1)/; \
168 # Form valid /etc/shadow entries, by copying the user:pw pairs
169 # from /etc/passwd, and adding on pw change data
170 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
171 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
172 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
174 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
175 mkdir
-p
$(1)/CONTROL
177 mkdir
-p
$(1)/etc
/crontabs
178 mkdir
-p
$(1)/etc
/rc.d
180 mkdir
-p
$(1)/lib
/firmware
181 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/lib
$(LIB_SUFFIX
))
185 mkdir
-p
$(1)/usr
/lib
186 $(if
$(LIB_SUFFIX
),-ln
-s lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
187 mkdir
-p
$(1)/usr
/bin
191 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
195 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
196 $(call Package
/base-files
/install-target
,$(1))
197 for conffile in
$(1)/etc
/config
/*; do \
198 if
[ -f
"$$$$conffile" ]; then \
199 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
200 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
205 define Package
/libgcc
/install
206 $(INSTALL_DIR
) $(1)/lib
207 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
210 define Package
/libssp
/install
211 $(INSTALL_DIR
) $(1)/lib
212 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
215 define Package
/libstdcpp
/install
216 $(INSTALL_DIR
) $(1)/usr
/lib
217 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
220 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
221 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
222 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
224 define Package
/glibc
/install
225 $(INSTALL_DIR
) $(1)/lib
226 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
227 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
228 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
229 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
230 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
234 define Package
/eglibc
/install
235 $(call Package
/glibc
/install,$1)
238 define Package
/uClibc
/install
239 $(INSTALL_DIR
) $(1)/lib
240 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
241 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
242 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
246 define Package
/libc
/install
247 $(call Package
/$(LIBC
)/install,$1)
250 define Package
/libc
/install_lib
251 $(CP
) $(filter-out %/libdl_pic.a
,$(wildcard $(TOOLCHAIN_DIR
)/usr
/lib
/lib
*.a
)) $(1)/lib
/
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
$(TARGET
)))
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
))