2 # Copyright (C) 2007 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 UCLIBC_VERSION
:=<UCLIBC_VERSION
>
30 LIBGCC_VERSION
:=<LIBGCC_VERSION
>
33 CONFIG_PACKAGE_base-files
$(TARGET
):=$(CONFIG_PACKAGE_base-files
)
35 define Package
/base-files
$(TARGET
)
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
$(TARGET
)/conffiles
58 $(call
$(TARGET
)/conffiles
)
61 define Package
/base-files
$(TARGET
)/description
62 This package contains a base filesystem and system scripts for OpenWrt.
65 define Package
/gcc
/Default
68 DEPENDS
:=@
!NATIVE_TOOLCHAIN
69 URL
:=http
://gcc.gnu.org
/
70 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
74 $(call Package
/gcc
/Default
)
75 TITLE
:=GCC support library
76 DEPENDS
:=@
!TARGET_avr32 @
!NATIVE_TOOLCHAIN
80 $(call Package
/gcc
/Default
)
82 TITLE
:=GCC support library
85 define Package
/libstdcpp
86 $(call Package
/gcc
/Default
)
88 TITLE
:=GNU Standard C
++ Library v3
89 DEPENDS
:=@
!NATIVE_TOOLCHAIN
&&@INSTALL_LIBSTDCPP
92 define Package
/uclibc
/Default
95 DEPENDS
:=@
!NATIVE_TOOLCHAIN
96 URL
:=http
://uclibc.org
/
97 VERSION
:=$(UCLIBC_VERSION
)$(UCLIBC_PATCHVER
)-$(PKG_RELEASE
)
100 define Package
/libpthread
101 $(call Package
/uclibc
/Default
)
102 TITLE
:=POSIX thread library
105 define Package
/uclibc
106 $(call Package
/uclibc
/Default
)
107 TITLE
:=C library embedded systems
111 $(call Package
/uclibc
/Default
)
112 TITLE
:=LDD trace utility
115 define Package
/ldconfig
116 $(call Package
/uclibc
/Default
)
117 TITLE
:=Shared library path configuration
121 mkdir
-p
$(PKG_BUILD_DIR
)
124 define Build
/Compile
/Default
128 $(call Build
/Compile
/Default
)
131 define Package
/base-files
$(TARGET
)/install
132 $(CP
) .
/files
/* $(1)/
133 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
134 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
136 if
[ -d
$(PLATFORM_DIR
)/base-files
/.
]; then \
137 $(CP
) $(PLATFORM_DIR
)/base-files
/* $(1)/; \
139 if
[ -d
$(PLATFORM_DIR
)/base-files-
$(PROFILE
)/.
]; then \
140 $(CP
) $(PLATFORM_DIR
)/base-files-
$(PROFILE
)/* $(1)/; \
142 $(if
$(filter-out $(PLATFORM_DIR
),$(PLATFORM_SUBDIR
)), \
143 if
[ -d
$(PLATFORM_SUBDIR
)/base-files
/.
]; then \
144 $(CP
) $(PLATFORM_SUBDIR
)/base-files
/* $(1)/; \
146 if
[ -d
$(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/.
]; then \
147 $(CP
) $(PLATFORM_SUBDIR
)/base-files-
$(PROFILE
)/* $(1)/; \
150 $(SED
) 's,$$$$R,$(REVISION),g' $(1)/etc
/banner
151 $(SED
) 's,$$$$S,$(BOARD),g' -e
's,$$$$A,$(ARCH),g' $(1)/etc
/ipkg.conf
153 mkdir
-p
$(1)/etc
/crontabs
155 mkdir
-p
$(1)/lib
/firmware
159 mkdir
-p
$(1)/usr
/lib
160 mkdir
-p
$(1)/usr
/bin
164 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
168 ln
-sf
/tmp
/resolv.conf
/tmp
/fstab
/tmp
/TZ
$(1)/etc
/
169 $(call Package
/base-files
/install-target
,$(1))
170 for conffile in
$(1)/etc
/config
/*; do \
171 if
[ -f
"$$$$conffile" ]; then \
172 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
173 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
178 define Package
/libgcc
/install
179 $(INSTALL_DIR
) $(1)/lib
180 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libgcc_s.so.
* $(1)/lib
/
183 ifeq ($(word 1,$(subst .
, ,$(LIBGCC_VERSION
))),4)
184 define Package
/libssp
/install
185 $(INSTALL_DIR
) $(1)/lib
186 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libssp.so.
* $(1)/lib
/
190 define Package
/libstdcpp
/install
191 $(INSTALL_DIR
) $(1)/lib
192 $(CP
) $(TOOLCHAIN_DIR
)/lib
$(LIB_SUFFIX
)/libstdc
++.so.
* $(1)/lib
/
195 define Package
/libpthread
/install
196 $(INSTALL_DIR
) $(1)/lib
197 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
198 $(CP
) $(TOOLCHAIN_DIR
)/lib
/libpthread-
$(UCLIBC_VERSION
).so
$(1)/lib
/
201 define Package
/uclibc
/install
202 $(INSTALL_DIR
) $(1)/lib
203 for file in
ld$(LIB_SUFFIX
)-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil
; do \
204 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
205 $(CP
) $(TOOLCHAIN_DIR
)/lib
/$$$$file-$(UCLIBC_VERSION
).so
$(1)/lib
/; \
209 define Package
/ldd
/install
210 $(INSTALL_DIR
) $(1)/bin
/
211 $(CP
) $(TOOLCHAIN_DIR
)/target-utils
/ldd
$(1)/bin
/
214 define Package
/ldconfig
/install
215 $(INSTALL_DIR
) $(1)/bin
/
216 $(CP
) $(TOOLCHAIN_DIR
)/target-utils
/ldconfig
$(1)/bin
/
220 -include $(PLATFORM_DIR
)/base-files.mk
223 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
224 $(eval
$(call BuildPackage
,libgcc
))
225 $(eval
$(call BuildPackage
,libssp
))
226 $(eval
$(call BuildPackage
,libstdcpp
))
227 $(eval
$(call BuildPackage
,libpthread
))
228 $(eval
$(call BuildPackage
,uclibc
))
229 $(eval
$(call BuildPackage
,ldd
))
230 $(eval
$(call BuildPackage
,ldconfig
))