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
/uclibc
/Default
)
121 TITLE
:=LDD trace utility
124 define Package
/ldconfig
125 $(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
$(TARGET
)/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
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
153 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
154 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
156 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
157 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
160 # Form valid /etc/shadow entries, by copying the user:pw pairs
161 # from /etc/passwd, and adding on pw change data
162 $(if
$(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS
), \
163 cut
-d
':' -f
1-2 $(1)/etc
/passwd
> $(1)/etc
/shadow
; \
164 $(SED
) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc
/shadow \
166 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
167 mkdir
-p
$(1)/CONTROL
169 mkdir
-p
$(1)/etc
/crontabs
171 mkdir
-p
$(1)/lib
/firmware
175 mkdir
-p
$(1)/usr
/lib
176 mkdir
-p
$(1)/usr
/bin
180 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
184 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
185 $(call Package
/base-files
/install-target
,$(1))
186 for conffile in
$(1)/etc
/config
/*; do \
187 if
[ -f
"$$$$conffile" ]; then \
188 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
189 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
194 define Package
/libgcc
/install
195 $(INSTALL_DIR
) $(1)/lib
196 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
199 define Package
/libssp
/install
200 $(INSTALL_DIR
) $(1)/lib
201 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
204 define Package
/libstdcpp
/install
205 $(INSTALL_DIR
) $(1)/usr
/lib
206 $(CP
) $(TOOLCHAIN_DIR
)/usr
/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/usr
/lib
/
209 use_libutil
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP
),libutil
)
210 use_libnsl
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS
),libnsl
)
211 use_nsswitch
=$(if
$(CONFIG_USE_GLIBC
)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH
),libnss_dns libnss_files
)
213 define Package
/glibc
/install
214 $(INSTALL_DIR
) $(1)/lib
215 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld*.so.
* $(1)/lib
/
216 $(CP
) $(TOOLCHAIN_DIR
)/lib
/ld-
$(LIBC_VERSION
).so
$(1)/lib
/
217 for file in libanl libc libcidn libcrypt libdl libm
$(use_libnsl
) $(use_nsswitch
) libresolv
$(use_libutil
); do \
218 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
219 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_VERSION
).so
$(1)/lib
/; \
223 define Package
/eglibc
/install
224 $(call Package
/glibc
/install,$1)
227 define Package
/uClibc
/install
228 $(INSTALL_DIR
) $(1)/lib
229 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil
; do \
230 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
231 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(LIBC_VERSION
).so
$(1)/lib
/; \
235 define Package
/libc
/install
236 $(call Package
/$(LIBC
)/install,$1)
239 define Package
/libpthread
/install
240 $(INSTALL_DIR
) $(1)/lib
241 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
242 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(LIBC_VERSION
).so
$(1)/lib
/
245 define Package
/librt
/install
246 $(INSTALL_DIR
) $(1)/lib
247 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt.so.
* $(1)/lib
/
248 $(CP
) $(TOOLCHAIN_DIR
)/lib
/librt-
$(LIBC_VERSION
).so
$(1)/lib
/
251 define Package
/ldd
/install
252 $(INSTALL_DIR
) $(1)/usr
/bin
/
253 $(CP
) $(TOOLCHAIN_DIR
)/usr
/bin
/ldd
$(1)/usr
/bin
/
256 define Package
/ldconfig
/install
257 $(INSTALL_DIR
) $(1)/sbin
/
258 $(CP
) $(TOOLCHAIN_DIR
)/sbin
/ldconfig
$(1)/sbin
/
262 -include $(PLATFORM_DIR
)/base-files.mk
265 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
266 $(eval
$(call BuildPackage
,libc
))
267 $(eval
$(call BuildPackage
,libgcc
))
268 $(eval
$(call BuildPackage
,libssp
))
269 $(eval
$(call BuildPackage
,libstdcpp
))
270 $(eval
$(call BuildPackage
,libpthread
))
271 $(eval
$(call BuildPackage
,librt
))
272 $(eval
$(call BuildPackage
,ldd
))
273 $(eval
$(call BuildPackage
,ldconfig
))