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
179 mkdir
-p
$(1)/lib
/firmware
180 $(if
$(LIB_SUFFIX
),ln
-s lib
$(1)/lib
$(LIB_SUFFIX
))
184 mkdir
-p
$(1)/usr
/lib
185 $(if
$(LIB_SUFFIX
),ln
-s lib
$(1)/usr
/lib
$(LIB_SUFFIX
))
186 mkdir
-p
$(1)/usr
/bin
190 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
194 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
195 $(call Package
/base-files
/install-target
,$(1))
196 for conffile in
$(1)/etc
/config
/*; do \
197 if
[ -f
"$$$$conffile" ]; then \
198 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
199 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
204 define Package
/libgcc
/install
205 $(INSTALL_DIR
) $(1)/lib
206 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
209 define Package
/libssp
/install
210 $(INSTALL_DIR
) $(1)/lib
211 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
214 define Package
/libstdcpp
/install
215 $(INSTALL_DIR
) $(1)/usr
/lib
216 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
219 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
220 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
221 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
223 define Package
/glibc
/install
224 $(INSTALL_DIR
) $(1)/lib
225 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
226 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
227 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
228 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
229 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
233 define Package
/eglibc
/install
234 $(call Package
/glibc
/install,$1)
237 define Package
/uClibc
/install
238 $(INSTALL_DIR
) $(1)/lib
239 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
240 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
241 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_SO_VERSION
).so
$(1)/lib
/; \
245 define Package
/libc
/install
246 $(call Package
/$(LIBC
)/install,$1)
249 define Package
/libpthread
/install
250 $(INSTALL_DIR
) $(1)/lib
251 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
252 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
255 define Package
/librt
/install
256 $(INSTALL_DIR
) $(1)/lib
257 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
258 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_SO_VERSION
).so
$(1)/lib
/
261 define Package
/ldd
/install
262 $(INSTALL_DIR
) $(1)/usr
/bin
/
263 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
266 define Package
/ldconfig
/install
267 $(INSTALL_DIR
) $(1)/sbin
/
268 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
272 -include $(PLATFORM_DIR
)/base-files.mk
275 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
276 $(eval
$(call BuildPackage
,libc
))
277 $(eval
$(call BuildPackage
,libgcc
))
278 $(eval
$(call BuildPackage
,libssp
))
279 $(eval
$(call BuildPackage
,libstdcpp
))
280 $(eval
$(call BuildPackage
,libpthread
))
281 $(eval
$(call BuildPackage
,librt
))
282 $(eval
$(call BuildPackage
,ldd
))
283 $(eval
$(call BuildPackage
,ldconfig
))