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.
9 include $(TOPDIR
)/rules.mk
10 include $(INCLUDE_DIR
)/kernel.mk
15 PKG_FILE_DEPEND
:=$(PLATFORM_DIR
)/ $(GENERIC_PLATFORM_DIR
)/base-files
/
17 include $(INCLUDE_DIR
)/package.mk
21 ifneq ($(wildcard $(PLATFORM_DIR
)/base-files-
$(PROFILE
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)),)
22 TARGET
:=$(TARGET
)-$(PROFILE
)
24 LIBGCC_VERSION
:=$(GCC_VERSION
)
29 LIBC_VERSION
:=<LIBC_VERSION
>
30 LIBGCC_VERSION
:=<LIBGCC_VERSION
>
33 ifneq ($(LIBC_VERSION
),0.9.28)
34 LIBC_VERSION
:=$(LIBC_VERSION
)$(LIBC_PATCHVER
)
37 CONFIG_PACKAGE_base-files
$(TARGET
):=$(CONFIG_PACKAGE_base-files
)
39 define Package
/base-files
$(TARGET
)
42 TITLE
:=Base filesystem for OpenWrt
43 URL
:=http
://openwrt.org
/
44 VERSION
:=$(PKG_RELEASE
)-$(REVISION
)
45 $(call Config
,network.lan.proto
,string
,static
,LAN Protocol
)
46 $(call Config
,network.lan.ipaddr
,ip
,192.168.1.1,LAN IP Address
)
47 $(call Config
,network.lan.netmask
,netmask
,255.255.255.0,LAN Network Mask
)
48 $(call Config
,network.lan.gateway
,ip
,,LAN Gateway
)
49 $(call Config
,network.lan.dns
,ip
,,LAN DNS server
)
52 define Package
/base-files
$(TARGET
)/conffiles
61 $(call
$(TARGET
)/conffiles
)
64 define Package
/base-files
$(TARGET
)/description
65 This package contains a base filesystem and system scripts for OpenWrt.
68 define Package
/gcc
/Default
71 DEPENDS
:=@
!NATIVE_TOOLCHAIN
72 URL
:=http
://gcc.gnu.org
/
73 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
77 $(call Package
/gcc
/Default
)
78 TITLE
:=GCC support library
79 DEPENDS
+=@
!TARGET_avr32
83 $(call Package
/gcc
/Default
)
85 TITLE
:=GCC support library
88 define Package
/libstdcpp
89 $(call Package
/gcc
/Default
)
91 TITLE
:=GNU Standard C
++ Library v3
92 DEPENDS
+=@INSTALL_LIBSTDCPP
95 define Package
/libc
/Default
98 DEPENDS
:=@
!NATIVE_TOOLCHAIN
99 VERSION
:=$(LIBC_VERSION
)-$(PKG_RELEASE
)
104 $(call Package
/libc
/Default
)
108 define Package
/libpthread
109 $(call Package
/libc
/Default
)
110 TITLE
:=POSIX thread library
115 $(call Package
/libc
/Default
)
116 TITLE
:=POSIX
.1b RealTime extension library
120 $(call Package
/libc
/Default
)
123 TITLE
:=LDD trace utility
126 define Package
/ldconfig
127 $(call Package
/libc
/Default
)
130 TITLE
:=Shared library path configuration
135 mkdir
-p
$(PKG_BUILD_DIR
)
138 define Build
/Compile
/Default
142 $(call Build
/Compile
/Default
)
145 define Package
/base-files
$(TARGET
)/install
146 $(CP
) .
/files
/* $(1)/
147 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
148 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
150 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
151 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
153 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
154 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
156 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
157 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
158 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
160 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
161 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
164 # Form valid /etc/shadow entries, by copying the user:pw pairs
165 # from /etc/passwd, and adding on pw change data
166 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
167 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
168 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
170 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
171 mkdir
-p
$(1)/CONTROL
173 mkdir
-p
$(1)/etc
/crontabs
175 mkdir
-p
$(1)/lib
/firmware
179 mkdir
-p
$(1)/usr
/lib
180 mkdir
-p
$(1)/usr
/bin
184 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
188 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
189 $(call Package
/base-files
/install-target
,$(1))
190 for conffile in
$(1)/etc
/config
/*; do \
191 if
[ -f
"$$$$conffile" ]; then \
192 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
193 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
198 define Package
/libgcc
/install
199 $(INSTALL_DIR
) $(1)/lib
200 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
203 define Package
/libssp
/install
204 $(INSTALL_DIR
) $(1)/lib
205 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
208 define Package
/libstdcpp
/install
209 $(INSTALL_DIR
) $(1)/usr
/lib
210 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
213 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
214 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
215 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
217 define Package
/glibc
/install
218 $(INSTALL_DIR
) $(1)/lib
219 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
220 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_VERSION
).so
$(1)/lib
/
221 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
222 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
223 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_VERSION
).so
$(1)/lib
/; \
227 define Package
/eglibc
/install
228 $(call Package
/glibc
/install,$1)
231 define Package
/uClibc
/install
232 $(INSTALL_DIR
) $(1)/lib
233 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
234 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
235 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_VERSION
).so
$(1)/lib
/; \
239 define Package
/libc
/install
240 $(call Package
/$(LIBC
)/install,$1)
243 define Package
/libpthread
/install
244 $(INSTALL_DIR
) $(1)/lib
245 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
246 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_VERSION
).so
$(1)/lib
/
249 define Package
/librt
/install
250 $(INSTALL_DIR
) $(1)/lib
251 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
252 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_VERSION
).so
$(1)/lib
/
255 define Package
/ldd
/install
256 $(INSTALL_DIR
) $(1)/usr
/bin
/
257 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
260 define Package
/ldconfig
/install
261 $(INSTALL_DIR
) $(1)/sbin
/
262 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
266 -include $(PLATFORM_DIR
)/base-files.mk
269 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
270 $(eval
$(call BuildPackage
,libc
))
271 $(eval
$(call BuildPackage
,libgcc
))
272 $(eval
$(call BuildPackage
,libssp
))
273 $(eval
$(call BuildPackage
,libstdcpp
))
274 $(eval
$(call BuildPackage
,libpthread
))
275 $(eval
$(call BuildPackage
,librt
))
276 $(eval
$(call BuildPackage
,ldd
))
277 $(eval
$(call BuildPackage
,ldconfig
))