fix errors in unresolved weak symbols on arm
[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:=32
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
65 define Package/gcc/Default
66 SECTION:=libs
67 CATEGORY:=Base system
68 URL:=http://gcc.gnu.org/
69 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
70 endef
71
72
73 define Package/libgcc
74 $(call Package/gcc/Default)
75 TITLE:=GCC support library
76 DEPENDS+=@!(TARGET_avr32||TARGET_coldfire)
77 endef
78
79 define Package/libgcc/config
80 menu "Configuration"
81 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
82
83 config LIBGCC_ROOT_DIR
84 string
85 prompt "libgcc shared library base directory"
86 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
87 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
88 default "/" if NATIVE_TOOLCHAIN
89
90 config LIBGCC_FILE_SPEC
91 string
92 prompt "libgcc shared library files (use wildcards)"
93 depends EXTERNAL_TOOLCHAIN && PACKAGE_libgcc
94 default "./lib/libgcc_s.so.*"
95
96 endmenu
97 endef
98
99
100 define Package/libssp
101 $(call Package/gcc/Default)
102 DEPENDS+=@SSP_SUPPORT
103 TITLE:=GCC support library
104 endef
105
106 define Package/libssp/config
107 menu "Configuration"
108 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
109
110 config LIBSPP_ROOT_DIR
111 string
112 prompt "libssp shared library base directory"
113 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
114 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
115 default "/" if NATIVE_TOOLCHAIN
116
117 config LIBSSP_FILE_SPEC
118 string
119 prompt "libssp shared library files (use wildcards)"
120 depends EXTERNAL_TOOLCHAIN && PACKAGE_libssp
121 default "./lib/libssp.so.*"
122
123 endmenu
124 endef
125
126
127 define Package/libstdcpp
128 $(call Package/gcc/Default)
129 NAME:=libstdc++
130 TITLE:=GNU Standard C++ Library v3
131 DEPENDS+=@INSTALL_LIBSTDCPP
132 endef
133
134 define Package/libstdcpp/config
135 menu "Configuration"
136 depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
137
138 config LIBSTDCPP_ROOT_DIR
139 string
140 prompt "libstdcpp shared library base directory"
141 depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
142 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
143 default "/" if NATIVE_TOOLCHAIN
144
145 config LIBSTDCPP_FILE_SPEC
146 string
147 prompt "libstdc++ shared library files (use wildcards)"
148 depends EXTERNAL_TOOLCHAIN && PACKAGE_libstdcpp
149 default "./lib/libstdc++.so.*"
150
151 endmenu
152 endef
153
154
155 define Package/libc/Default
156 SECTION:=libs
157 CATEGORY:=Base system
158 VERSION:=$(LIBC_VERSION)-$(PKG_RELEASE)
159 DEPENDS:=+libgcc
160 URL:=$(LIBC_URL)
161 endef
162
163
164 define Package/libc
165 $(call Package/libc/Default)
166 TITLE:=C library
167 endef
168
169 define Package/libc/config
170 menu "Configuration"
171 depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
172
173 config LIBC_ROOT_DIR
174 string
175 prompt "libc shared library base directory"
176 depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
177 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
178 default "/" if NATIVE_TOOLCHAIN
179
180 config LIBC_FILE_SPEC
181 string
182 prompt "libc shared library files (use wildcards)"
183 depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
184 default "./lib/ld{-*.so,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
185
186 endmenu
187 endef
188
189
190 define Package/libpthread
191 $(call Package/libc/Default)
192 TITLE:=POSIX thread library
193 DEPENDS:= +librt
194 endef
195
196 define Package/libpthread/config
197 menu "Configuration"
198 depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
199
200 config LIBPTHREAD_ROOT_DIR
201 string
202 prompt "libpthread shared library base directory"
203 depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
204 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
205 default "/" if NATIVE_TOOLCHAIN
206
207 config LIBPTHREAD_FILE_SPEC
208 string
209 prompt "libpthread shared library files (use wildcards)"
210 depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
211 default "./lib/libpthread{-*.so,.so.*}"
212
213 endmenu
214 endef
215
216
217 define Package/librt
218 $(call Package/libc/Default)
219 TITLE:=POSIX.1b RealTime extension library
220 endef
221
222 define Package/librt/config
223 menu "Configuration"
224 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
225
226 config LIBRT_ROOT_DIR
227 string
228 prompt "librt shared library base directory"
229 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
230 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
231 default "/" if NATIVE_TOOLCHAIN
232
233 config LIBRT_FILE_SPEC
234 string
235 prompt "librt shared library files (use wildcards)"
236 depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
237 default "./lib/librt{-*.so,.so.*}"
238
239 endmenu
240 endef
241
242
243 define Package/ldd
244 $(call Package/libc/Default)
245 SECTION:=utils
246 CATEGORY:=Utilities
247 TITLE:=LDD trace utility
248 endef
249
250 define Package/ldd/config
251 menu "Configuration"
252 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
253
254 config LDD_ROOT_DIR
255 string
256 prompt "ldd trace utility base directory"
257 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
258 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
259 default "/" if NATIVE_TOOLCHAIN
260
261 config LDD_FILE_SPEC
262 string
263 prompt "ldd trace utility file"
264 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldd
265 default "./usr/bin/ldd"
266
267 endmenu
268 endef
269
270
271 define Package/ldconfig
272 $(call Package/libc/Default)
273 SECTION:=utils
274 CATEGORY:=Utilities
275 TITLE:=Shared library path configuration
276 endef
277
278 define Package/ldconfig/config
279 menu "Configuration"
280 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
281
282 config LDCONFIG_ROOT_DIR
283 string
284 prompt "ldconfig base directory"
285 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
286 default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN
287 default "/" if NATIVE_TOOLCHAIN
288
289 config LDCONFIG_FILE_SPEC
290 string
291 prompt "ldconfig file"
292 depends EXTERNAL_TOOLCHAIN && PACKAGE_ldconfig
293 default "./sbin/ldconfig"
294
295 endmenu
296 endef
297
298
299 define Build/Prepare
300 mkdir -p $(PKG_BUILD_DIR)
301 endef
302
303 define Build/Compile/Default
304 endef
305
306 define Build/Compile
307 $(call Build/Compile/Default)
308 endef
309
310 define Package/base-files/install
311 $(CP) ./files/* $(1)/
312 if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
313 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
314 fi
315 if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
316 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
317 fi
318 if [ -d $(PLATFORM_DIR)/base-files-$(PROFILE)/. ]; then \
319 $(CP) $(PLATFORM_DIR)/base-files-$(PROFILE)/* $(1)/; \
320 fi
321 if [ -d $(PLATFORM_DIR)/$(PROFILE)/base-files/. ]; then \
322 $(CP) $(PLATFORM_DIR)/$(PROFILE)/base-files/* $(1)/; \
323 fi
324 $(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
325 if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
326 $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
327 fi; \
328 if [ -d $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/. ]; then \
329 $(CP) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/* $(1)/; \
330 fi; \
331 if [ -d $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/. ]; then \
332 $(CP) $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/* $(1)/; \
333 fi \
334 )
335 # Form valid /etc/shadow entries, by copying the user:pw pairs
336 # from /etc/passwd, and adding on pw change data
337 $(if $(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS), \
338 cut -d ':' -f 1-2 $(1)/etc/passwd > $(1)/etc/shadow; \
339 $(SED) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc/shadow \
340 )
341 $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/banner
342 mkdir -p $(1)/CONTROL
343 mkdir -p $(1)/dev
344 mkdir -p $(1)/etc/crontabs
345 mkdir -p $(1)/etc/rc.d
346 mkdir -p $(1)/jffs
347 mkdir -p $(1)/lib/firmware
348 $(if $(LIB_SUFFIX),-ln -s lib $(1)/lib$(LIB_SUFFIX))
349 mkdir -p $(1)/mnt
350 mkdir -p $(1)/proc
351 mkdir -p $(1)/tmp
352 mkdir -p $(1)/usr/lib
353 $(if $(LIB_SUFFIX),-ln -s lib $(1)/usr/lib$(LIB_SUFFIX))
354 mkdir -p $(1)/usr/bin
355 mkdir -p $(1)/sys
356 mkdir -p $(1)/www
357 mkdir -p $(1)/root
358 ln -sf /proc/mounts $(1)/etc/mtab
359 rm -f $(1)/var
360 ln -sf /tmp $(1)/var
361 mkdir -p $(1)/etc
362 ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
363 $(call Package/base-files/install-target,$(1))
364 for conffile in $(1)/etc/config/*; do \
365 if [ -f "$$$$conffile" ]; then \
366 grep "$$$${conffile##$(1)}" $(1)/CONTROL/conffiles || \
367 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
368 fi \
369 done
370 endef
371
372 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
373
374 define Package/libgcc/install
375 $(INSTALL_DIR) $(1)/lib
376 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libgcc_s.so.* $(1)/lib/
377 endef
378
379 define Package/libssp/install
380 $(INSTALL_DIR) $(1)/lib
381 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libssp.so.* $(1)/lib/
382 endef
383
384 define Package/libstdcpp/install
385 $(INSTALL_DIR) $(1)/usr/lib
386 $(CP) $(TOOLCHAIN_DIR)/usr/lib$(LIB_SUFFIX)/libstdc++.so.* $(1)/usr/lib/
387 endef
388
389 use_libutil=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
390 use_libnsl=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
391 use_nsswitch=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
392
393 define Package/glibc/install
394 $(INSTALL_DIR) $(1)/lib
395 $(CP) $(TOOLCHAIN_DIR)/lib/ld*.so.* $(1)/lib/
396 $(CP) $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_SO_VERSION).so $(1)/lib/
397 for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
398 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
399 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so $(1)/lib/; \
400 done
401 endef
402
403 define Package/eglibc/install
404 $(call Package/glibc/install,$1)
405 endef
406
407 define Package/uClibc/install
408 $(INSTALL_DIR) $(1)/lib
409 for file in ld$(LIB_SUFFIX)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil; do \
410 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
411 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_SO_VERSION).so $(1)/lib/; \
412 done
413 endef
414
415 define Package/libc/install
416 $(call Package/$(LIBC)/install,$1)
417 endef
418
419 define Package/libc/install_lib
420 $(CP) $(filter-out %/libdl_pic.a,$(wildcard $(TOOLCHAIN_DIR)/usr/lib/lib*.a)) $(1)/lib/
421 $(if $(wildcard $(TOOLCHAIN_DIR)/usr/lib/libc_so.a),$(CP) $(TOOLCHAIN_DIR)/usr/lib/libc_so.a $(1)/lib/libc_pic.a)
422 $(CP) $(TOOLCHAIN_DIR)/usr/lib/gcc/*/*/libgcc.a $(1)/lib/libgcc_s_pic.a
423 endef
424
425 define Package/libpthread/install
426 $(INSTALL_DIR) $(1)/lib
427 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
428 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_SO_VERSION).so $(1)/lib/
429 endef
430
431 define Package/librt/install
432 $(INSTALL_DIR) $(1)/lib
433 $(CP) $(TOOLCHAIN_DIR)/lib/librt.so.* $(1)/lib/
434 $(CP) $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so $(1)/lib/
435 endef
436
437 define Package/ldd/install
438 $(INSTALL_DIR) $(1)/usr/bin/
439 $(CP) $(TOOLCHAIN_DIR)/usr/bin/ldd $(1)/usr/bin/
440 endef
441
442 define Package/ldconfig/install
443 $(INSTALL_DIR) $(1)/sbin/
444 $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
445 endef
446
447 else
448
449 define Package/libgcc/install
450 for file in $(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC)); do \
451 dir=`dirname $$$$file` ; \
452 $(INSTALL_DIR) $(1)/$$$$dir ; \
453 $(CP) $(call qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
454 done
455 endef
456
457 define Package/libssp/install
458 for file in $(call qstrip,$(CONFIG_LIBSSP_FILE_SPEC)); do \
459 dir=`dirname $$$$file` ; \
460 $(INSTALL_DIR) $(1)/$$$$dir ; \
461 $(CP) $(call qstrip,$(CONFIG_LIBSSP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
462 done
463 endef
464
465 define Package/libstdcpp/install
466 for file in $(call qstrip,$(CONFIG_LIBSTDCPP_FILE_SPEC)); do \
467 dir=`dirname $$$$file` ; \
468 $(INSTALL_DIR) $(1)/$$$$dir ; \
469 $(CP) $(call qstrip,$(CONFIG_LIBSTDCPP_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
470 done
471 endef
472
473 define Package/libc/install
474 for file in $(call qstrip,$(CONFIG_LIBC_FILE_SPEC)); do \
475 dir=`dirname $$$$file` ; \
476 $(INSTALL_DIR) $(1)/$$$$dir ; \
477 $(CP) $(call qstrip,$(CONFIG_LIBC_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
478 done
479 endef
480
481 define Package/libpthread/install
482 for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \
483 dir=`dirname $$$$file` ; \
484 $(INSTALL_DIR) $(1)/$$$$dir ; \
485 $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
486 done
487 endef
488
489 define Package/librt/install
490 for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \
491 dir=`dirname $$$$file` ; \
492 $(INSTALL_DIR) $(1)/$$$$dir ; \
493 $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
494 done
495 endef
496
497 define Package/ldd/install
498 for file in $(call qstrip,$(CONFIG_LDD_FILE_SPEC)); do \
499 dir=`dirname $$$$file` ; \
500 $(INSTALL_DIR) $(1)/$$$$dir ; \
501 $(CP) $(call qstrip,$(CONFIG_LDD_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
502 done
503 endef
504
505 define Package/ldconfig/install
506 for file in $(call qstrip,$(CONFIG_LDCONFIG_FILE_SPEC)); do \
507 dir=`dirname $$$$file` ; \
508 $(INSTALL_DIR) $(1)/$$$$dir ; \
509 $(CP) $(call qstrip,$(CONFIG_LDCONFIG_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
510 done
511 endef
512
513 endif
514
515 ifneq ($(DUMP),1)
516 -include $(PLATFORM_DIR)/base-files.mk
517 endif
518
519 $(eval $(call BuildPackage,base-files))
520 $(eval $(call BuildPackage,libc))
521 $(eval $(call BuildPackage,libgcc))
522 $(eval $(call BuildPackage,libssp))
523 $(eval $(call BuildPackage,libstdcpp))
524 $(eval $(call BuildPackage,libpthread))
525 $(eval $(call BuildPackage,librt))
526 $(eval $(call BuildPackage,ldd))
527 $(eval $(call BuildPackage,ldconfig))
This page took 0.055144 seconds and 5 git commands to generate.