[package] base-files: move ipv6 module loading from setup_interface() to addif()...
[openwrt/svn-archive/archive.git] / package / base-files / Makefile
1 #
2 # Copyright (C) 2007-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=base-files
12 PKG_RELEASE:=26
13
14 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
15
16 include $(INCLUDE_DIR)/package.mk
17
18 ifneq ($(DUMP),1)
19 TARGET:=-$(BOARD)
20 ifneq ($(wildcard $(PLATFORM_DIR)/base-files-$(PROFILE) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)),)
21 TARGET:=$(TARGET)-$(PROFILE)
22 endif
23 LIBGCC_VERSION:=$(GCC_VERSION)
24 ifeq ($(ARCH),x86_64)
25 LIB_SUFFIX:=64
26 endif
27 ifneq ($(findstring mips64,$(ARCH)),)
28 LIB_SUFFIX:=64
29 endif
30 else
31 LIBC_VERSION:=<LIBC_VERSION>
32 LIBGCC_VERSION:=<LIBGCC_VERSION>
33 endif
34
35 CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
36
37 define Package/base-files$(TARGET)
38 SECTION:=base
39 CATEGORY:=Base system
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)
48 endef
49
50 define Package/base-files$(TARGET)/conffiles
51 /etc/banner
52 /etc/hosts
53 /etc/inittab
54 /etc/group
55 /etc/passwd
56 /etc/profile
57 /etc/shells
58 /etc/sysctl.conf
59 $(call $(TARGET)/conffiles)
60 endef
61
62 define Package/base-files$(TARGET)/description
63 This package contains a base filesystem and system scripts for OpenWrt.
64 endef
65
66 define Package/gcc/Default
67 SECTION:=libs
68 CATEGORY:=Base system
69 DEPENDS:=@!NATIVE_TOOLCHAIN
70 URL:=http://gcc.gnu.org/
71 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
72 endef
73
74 define Package/libgcc
75 $(call Package/gcc/Default)
76 TITLE:=GCC support library
77 DEPENDS+=@!(TARGET_avr32||TARGET_coldfire)
78 endef
79
80 define Package/libssp
81 $(call Package/gcc/Default)
82 DEPENDS+=@SSP_SUPPORT
83 TITLE:=GCC support library
84 endef
85
86 define Package/libstdcpp
87 $(call Package/gcc/Default)
88 NAME:=libstdc++
89 TITLE:=GNU Standard C++ Library v3
90 DEPENDS+=@INSTALL_LIBSTDCPP
91 endef
92
93 define Package/libc/Default
94 SECTION:=libs
95 CATEGORY:=Base system
96 DEPENDS:=@!NATIVE_TOOLCHAIN
97 VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
98 URL:=$(LIBC_URL)
99 endef
100
101 define Package/libc
102 $(call Package/libc/Default)
103 TITLE:=C library
104 endef
105
106 define Package/libpthread
107 $(call Package/libc/Default)
108 TITLE:=POSIX thread library
109 DEPENDS:= +librt
110 endef
111
112 define Package/librt
113 $(call Package/libc/Default)
114 TITLE:=POSIX.1b RealTime extension library
115 endef
116
117 define Package/ldd
118 $(call Package/libc/Default)
119 SECTION:=utils
120 CATEGORY:=Utilities
121 TITLE:=LDD trace utility
122 endef
123
124 define Package/ldconfig
125 $(call Package/libc/Default)
126 SECTION:=utils
127 CATEGORY:=Utilities
128 TITLE:=Shared library path configuration
129 endef
130
131
132 define Build/Prepare
133 mkdir -p $(PKG_BUILD_DIR)
134 endef
135
136 define Build/Compile/Default
137 endef
138
139 define Build/Compile
140 $(call Build/Compile/Default)
141 endef
142
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)/; \
147 fi
148 if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
149 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
150 fi
151 if [ -d $(PLATFORM_DIR)/base-files-$(PROFILE)/. ]; then \
152 $(CP) $(PLATFORM_DIR)/base-files-$(PROFILE)/* $(1)/; \
153 fi
154 if [ -d $(PLATFORM_DIR)/$(PROFILE)/base-files/. ]; then \
155 $(CP) $(PLATFORM_DIR)/$(PROFILE)/base-files/* $(1)/; \
156 fi
157 $(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
158 if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
159 $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
160 fi; \
161 if [ -d $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/. ]; then \
162 $(CP) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/* $(1)/; \
163 fi; \
164 if [ -d $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/. ]; then \
165 $(CP) $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/* $(1)/; \
166 fi \
167 )
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 \
173 )
174 $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/banner
175 mkdir -p $(1)/CONTROL
176 mkdir -p $(1)/dev
177 mkdir -p $(1)/etc/crontabs
178 mkdir -p $(1)/etc/rc.d
179 mkdir -p $(1)/jffs
180 mkdir -p $(1)/lib/firmware
181 $(if $(LIB_SUFFIX),-ln -s lib $(1)/lib$(LIB_SUFFIX))
182 mkdir -p $(1)/mnt
183 mkdir -p $(1)/proc
184 mkdir -p $(1)/tmp
185 mkdir -p $(1)/usr/lib
186 $(if $(LIB_SUFFIX),-ln -s lib $(1)/usr/lib$(LIB_SUFFIX))
187 mkdir -p $(1)/usr/bin
188 mkdir -p $(1)/sys
189 mkdir -p $(1)/www
190 mkdir -p $(1)/root
191 ln -sf /proc/mounts $(1)/etc/mtab
192 rm -f $(1)/var
193 ln -sf /tmp $(1)/var
194 mkdir -p $(1)/etc
195 ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
196 $(call Package/base-files/install-target,$(1))
197 for conffile in $(1)/etc/config/*; do \
198 if [ -f "$$$$conffile" ]; then \
199 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
200 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
201 fi \
202 done
203 endef
204
205 define Package/libgcc/install
206 $(INSTALL_DIR) $(1)/lib
207 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libgcc_s.so.* $(1)/lib/
208 endef
209
210 define Package/libssp/install
211 $(INSTALL_DIR) $(1)/lib
212 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libssp.so.* $(1)/lib/
213 endef
214
215 define Package/libstdcpp/install
216 $(INSTALL_DIR) $(1)/usr/lib
217 $(CP) $(TOOLCHAIN_DIR)/usr/lib$(LIB_SUFFIX)/libstdc++.so.* $(1)/usr/lib/
218 endef
219
220 use_libutil=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
221 use_libnsl=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
222 use_nsswitch=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
223
224 define Package/glibc/install
225 $(INSTALL_DIR) $(1)/lib
226 $(CP) $(TOOLCHAIN_DIR)/lib/ld*.so.* $(1)/lib/
227 $(CP) $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so $(1)/lib/
228 for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
229 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
230 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so $(1)/lib/; \
231 done
232 endef
233
234 define Package/eglibc/install
235 $(call Package/glibc/install,$1)
236 endef
237
238 define Package/uClibc/install
239 $(INSTALL_DIR) $(1)/lib
240 for file in ld$(LIB_SUFFIX)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil; do \
241 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
242 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so $(1)/lib/; \
243 done
244 endef
245
246 define Package/libc/install
247 $(call Package/$(LIBC)/install,$1)
248 endef
249
250 define Package/libc/install_lib
251 $(CP) $(filter-out %/libdl_pic.a,$(wildcard $(TOOLCHAIN_DIR)/usr/lib/lib*.a)) $(1)/lib/
252 endef
253
254 define Package/libpthread/install
255 $(INSTALL_DIR) $(1)/lib
256 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
257 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so $(1)/lib/
258 endef
259
260 define Package/librt/install
261 $(INSTALL_DIR) $(1)/lib
262 $(CP) $(TOOLCHAIN_DIR)/lib/librt.so.* $(1)/lib/
263 $(CP) $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so $(1)/lib/
264 endef
265
266 define Package/ldd/install
267 $(INSTALL_DIR) $(1)/usr/bin/
268 $(CP) $(TOOLCHAIN_DIR)/usr/bin/ldd $(1)/usr/bin/
269 endef
270
271 define Package/ldconfig/install
272 $(INSTALL_DIR) $(1)/sbin/
273 $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
274 endef
275
276 ifneq ($(DUMP),1)
277 -include $(PLATFORM_DIR)/base-files.mk
278 endif
279
280 $(eval $(call BuildPackage,base-files$(TARGET)))
281 $(eval $(call BuildPackage,libc))
282 $(eval $(call BuildPackage,libgcc))
283 $(eval $(call BuildPackage,libssp))
284 $(eval $(call BuildPackage,libstdcpp))
285 $(eval $(call BuildPackage,libpthread))
286 $(eval $(call BuildPackage,librt))
287 $(eval $(call BuildPackage,ldd))
288 $(eval $(call BuildPackage,ldconfig))