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