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