2 # Copyright (C) 2006 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_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
16 PKG_FILE_DEPEND:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
18 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
22 include $(INCLUDE_DIR)/package.mk
25 TARGET:=-$(BOARD)-$(KERNEL)
26 LIBGCC_VERSION:=$(GCC_VERSION)
28 UCLIBC_VERSION:=<UCLIBC_VERSION>
29 LIBGCC_VERSION:=<LIBGCC_VERSION>
32 CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
34 define Package/base-files$(TARGET)
37 TITLE:=Base filesystem for OpenWrt
39 This package contains a base filesystem and system scripts for OpenWrt.
40 URL:=http://openwrt.org/
41 VERSION:=$(PKG_RELEASE)-$(REV)
42 $(call Config,network.lan.proto,string,static,LAN Protocol)
43 $(call Config,network.lan.ipaddr,ip,192.168.1.1,LAN IP Address)
44 $(call Config,network.lan.netmask,netmask,255.255.255.0,LAN Network Mask)
45 $(call Config,network.lan.gateway,ip,,LAN Gateway)
46 $(call Config,network.lan.dns,ip,,LAN DNS server)
49 define Package/base-files$(TARGET)/conffiles
59 $(call $(TARGET)/conffiles)
62 define Package/gcc/Default
65 DEPENDS:=@!NATIVE_TOOLCHAIN
66 URL:=http://gcc.gnu.org/
67 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
71 $(call Package/gcc/Default)
72 TITLE:=GCC support library
73 DEPENDS:=@!LINUX_2_6_AVR32||@!NATIVE_TOOLCHAIN
77 $(call Package/gcc/Default)
78 TITLE:=GCC support library
81 define Package/libstdcpp
82 $(call Package/gcc/Default)
84 TITLE:=GNU Standard C++ Library v3
85 DEPENDS:=@!NATIVE_TOOLCHAIN&&@INSTALL_LIBSTDCPP
88 define Package/uclibc/Default
91 DEPENDS:=@!NATIVE_TOOLCHAIN
92 URL:=http://uclibc.org/
93 VERSION:=$(UCLIBC_VERSION)$(UCLIBC_PATCHVER)-$(PKG_RELEASE)
96 define Package/libpthread
97 $(call Package/uclibc/Default)
98 TITLE:=POSIX thread library
101 define Package/uclibc
102 $(call Package/uclibc/Default)
103 TITLE:=C library embedded systems
107 mkdir -p $(PKG_BUILD_DIR)
110 define Build/Compile/Default
114 $(call Build/Compile/Default)
117 define Package/base-files$(TARGET)/install
118 $(CP) ./files/* $(1)/
119 if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
120 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
122 if [ -d $(PLATFORM_DIR)/base-files/default/. ]; then \
123 $(CP) $(PLATFORM_DIR)/base-files/default/* $(1)/; \
125 if [ "$(PROFILE)" != "Default" ]; then \
126 if [ -d $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/. ]; then \
127 $(CP) $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/* $(1)/; \
130 $(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner
131 $(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' -e 's,$$$$A,$(ARCH),g' $(1)/etc/ipkg.conf
133 mkdir -p $(1)/etc/crontabs
135 mkdir -p $(1)/lib/firmware
139 mkdir -p $(1)/usr/lib
140 mkdir -p $(1)/usr/bin
143 ln -sf /proc/mounts $(1)/etc/mtab
147 ln -sf /tmp/resolv.conf $(1)/etc/resolv.conf
148 $(call Package/base-files/install-target,$(1))
149 for conffile in $(1)/etc/config/*; do \
150 if [ -f "$$$$conffile" ]; then \
151 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
152 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
157 define Package/libgcc/install
158 $(INSTALL_DIR) $(1)/lib
159 $(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/
162 ifeq ($(word 1,$(subst ., ,$(LIBGCC_VERSION))),4)
163 define Package/libssp/install
164 $(INSTALL_DIR) $(1)/lib
165 $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
169 define Package/libstdcpp/install
170 $(INSTALL_DIR) $(1)/lib
171 $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/lib/
174 define Package/libpthread/install
175 $(INSTALL_DIR) $(1)/lib
176 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
177 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
180 define Package/uclibc/install
181 $(INSTALL_DIR) $(1)/lib
182 for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
183 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
184 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
188 define Package/ldd/install
189 $(INSTALL_DIR) $(1)/bin/
190 $(CP) $(TOOLCHAIN_DIR)/utils/ldd $(1)/bin/
193 define Package/ldconfig/install
194 $(INSTALL_DIR) $(1)/bin/
195 $(CP) $(TOOLCHAIN_DIR)/utils/ldconfig $(1)/bin/
199 -include $(PLATFORM_DIR)/base-files.mk
202 $(eval $(call BuildPackage,base-files$(TARGET)))
203 $(eval $(call BuildPackage,libgcc))
204 $(eval $(call BuildPackage,libssp))
205 $(eval $(call BuildPackage,libstdcpp))
206 $(eval $(call BuildPackage,libpthread))
207 $(eval $(call BuildPackage,uclibc))