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