cleanup MTD option handling
[openwrt.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:=18
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 else
28 LIBC_VERSION:=<LIBC_VERSION>
29 LIBGCC_VERSION:=<LIBGCC_VERSION>
30 endif
31
32 CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
33
34 define Package/base-files$(TARGET)
35 SECTION:=base
36 CATEGORY:=Base system
37 TITLE:=Base filesystem for OpenWrt
38 URL:=http://openwrt.org/
39 VERSION:=$(PKG_RELEASE)-$(REVISION)
40 $(call Config,network.lan.proto,string,static,LAN Protocol)
41 $(call Config,network.lan.ipaddr,ip,192.168.1.1,LAN IP Address)
42 $(call Config,network.lan.netmask,netmask,255.255.255.0,LAN Network Mask)
43 $(call Config,network.lan.gateway,ip,,LAN Gateway)
44 $(call Config,network.lan.dns,ip,,LAN DNS server)
45 endef
46
47 define Package/base-files$(TARGET)/conffiles
48 /etc/banner
49 /etc/hosts
50 /etc/inittab
51 /etc/group
52 /etc/passwd
53 /etc/profile
54 /etc/shells
55 /etc/sysctl.conf
56 $(call $(TARGET)/conffiles)
57 endef
58
59 define Package/base-files$(TARGET)/description
60 This package contains a base filesystem and system scripts for OpenWrt.
61 endef
62
63 define Package/gcc/Default
64 SECTION:=libs
65 CATEGORY:=Base system
66 DEPENDS:=@!NATIVE_TOOLCHAIN
67 URL:=http://gcc.gnu.org/
68 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
69 endef
70
71 define Package/libgcc
72 $(call Package/gcc/Default)
73 TITLE:=GCC support library
74 DEPENDS+=@!TARGET_avr32
75 endef
76
77 define Package/libssp
78 $(call Package/gcc/Default)
79 DEPENDS+=@SSP_SUPPORT
80 TITLE:=GCC support library
81 endef
82
83 define Package/libstdcpp
84 $(call Package/gcc/Default)
85 NAME:=libstdc++
86 TITLE:=GNU Standard C++ Library v3
87 DEPENDS+=@INSTALL_LIBSTDCPP
88 endef
89
90 define Package/libc/Default
91 SECTION:=libs
92 CATEGORY:=Base system
93 DEPENDS:=@!NATIVE_TOOLCHAIN
94 VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
95 URL:=$(LIBC_URL)
96 endef
97
98 define Package/libc
99 $(call Package/libc/Default)
100 TITLE:=C library
101 endef
102
103 define Package/libpthread
104 $(call Package/libc/Default)
105 TITLE:=POSIX thread library
106 DEPENDS:= +librt
107 endef
108
109 define Package/librt
110 $(call Package/libc/Default)
111 TITLE:=POSIX.1b RealTime extension library
112 endef
113
114 define Package/ldd
115 $(call Package/libc/Default)
116 SECTION:=utils
117 CATEGORY:=Utilities
118 TITLE:=LDD trace utility
119 endef
120
121 define Package/ldconfig
122 $(call Package/libc/Default)
123 SECTION:=utils
124 CATEGORY:=Utilities
125 TITLE:=Shared library path configuration
126 endef
127
128
129 define Build/Prepare
130 mkdir -p $(PKG_BUILD_DIR)
131 endef
132
133 define Build/Compile/Default
134 endef
135
136 define Build/Compile
137 $(call Build/Compile/Default)
138 endef
139
140 define Package/base-files$(TARGET)/install
141 $(CP) ./files/* $(1)/
142 if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
143 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
144 fi
145 if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
146 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
147 fi
148 if [ -d $(PLATFORM_DIR)/base-files-$(PROFILE)/. ]; then \
149 $(CP) $(PLATFORM_DIR)/base-files-$(PROFILE)/* $(1)/; \
150 fi
151 if [ -d $(PLATFORM_DIR)/$(PROFILE)/base-files/. ]; then \
152 $(CP) $(PLATFORM_DIR)/$(PROFILE)/base-files/* $(1)/; \
153 fi
154 $(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
155 if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
156 $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
157 fi; \
158 if [ -d $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/. ]; then \
159 $(CP) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/* $(1)/; \
160 fi; \
161 if [ -d $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/. ]; then \
162 $(CP) $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/* $(1)/; \
163 fi \
164 )
165 # Form valid /etc/shadow entries, by copying the user:pw pairs
166 # from /etc/passwd, and adding on pw change data
167 $(if $(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS), \
168 cut -d ':' -f 1-2 $(1)/etc/passwd > $(1)/etc/shadow; \
169 $(SED) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc/shadow \
170 )
171 $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/banner
172 mkdir -p $(1)/CONTROL
173 mkdir -p $(1)/dev
174 mkdir -p $(1)/etc/crontabs
175 mkdir -p $(1)/jffs
176 mkdir -p $(1)/lib/firmware
177 mkdir -p $(1)/mnt
178 mkdir -p $(1)/proc
179 mkdir -p $(1)/tmp
180 mkdir -p $(1)/usr/lib
181 mkdir -p $(1)/usr/bin
182 mkdir -p $(1)/sys
183 mkdir -p $(1)/www
184 mkdir -p $(1)/root
185 ln -sf /proc/mounts $(1)/etc/mtab
186 rm -f $(1)/var
187 ln -sf /tmp $(1)/var
188 mkdir -p $(1)/etc
189 ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
190 $(call Package/base-files/install-target,$(1))
191 for conffile in $(1)/etc/config/*; do \
192 if [ -f "$$$$conffile" ]; then \
193 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
194 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
195 fi \
196 done
197 endef
198
199 define Package/libgcc/install
200 $(INSTALL_DIR) $(1)/lib
201 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libgcc_s.so.* $(1)/lib/
202 endef
203
204 define Package/libssp/install
205 $(INSTALL_DIR) $(1)/lib
206 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libssp.so.* $(1)/lib/
207 endef
208
209 define Package/libstdcpp/install
210 $(INSTALL_DIR) $(1)/usr/lib
211 $(CP) $(TOOLCHAIN_DIR)/usr/lib$(LIB_SUFFIX)/libstdc++.so.* $(1)/usr/lib/
212 endef
213
214 use_libutil=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
215 use_libnsl=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
216 use_nsswitch=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
217
218 define Package/glibc/install
219 $(INSTALL_DIR) $(1)/lib
220 $(CP) $(TOOLCHAIN_DIR)/lib/ld*.so.* $(1)/lib/
221 $(CP) $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so $(1)/lib/
222 for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
223 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
224 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so $(1)/lib/; \
225 done
226 endef
227
228 define Package/eglibc/install
229 $(call Package/glibc/install,$1)
230 endef
231
232 define Package/uClibc/install
233 $(INSTALL_DIR) $(1)/lib
234 for file in ld$(LIB_SUFFIX)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil; do \
235 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
236 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so $(1)/lib/; \
237 done
238 endef
239
240 define Package/libc/install
241 $(call Package/$(LIBC)/install,$1)
242 endef
243
244 define Package/libpthread/install
245 $(INSTALL_DIR) $(1)/lib
246 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
247 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so $(1)/lib/
248 endef
249
250 define Package/librt/install
251 $(INSTALL_DIR) $(1)/lib
252 $(CP) $(TOOLCHAIN_DIR)/lib/librt.so.* $(1)/lib/
253 $(CP) $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so $(1)/lib/
254 endef
255
256 define Package/ldd/install
257 $(INSTALL_DIR) $(1)/usr/bin/
258 $(CP) $(TOOLCHAIN_DIR)/usr/bin/ldd $(1)/usr/bin/
259 endef
260
261 define Package/ldconfig/install
262 $(INSTALL_DIR) $(1)/sbin/
263 $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
264 endef
265
266 ifneq ($(DUMP),1)
267 -include $(PLATFORM_DIR)/base-files.mk
268 endif
269
270 $(eval $(call BuildPackage,base-files$(TARGET)))
271 $(eval $(call BuildPackage,libc))
272 $(eval $(call BuildPackage,libgcc))
273 $(eval $(call BuildPackage,libssp))
274 $(eval $(call BuildPackage,libstdcpp))
275 $(eval $(call BuildPackage,libpthread))
276 $(eval $(call BuildPackage,librt))
277 $(eval $(call BuildPackage,ldd))
278 $(eval $(call BuildPackage,ldconfig))
This page took 0.080179 seconds and 5 git commands to generate.