093bf5b984d46372227de4a58d17d7a556866e9f
[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:=18
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/libc/Default)
121 SECTION:=utils
122 CATEGORY:=Utilities
123 TITLE:=LDD trace utility
124 endef
125
126 define Package/ldconfig
127 $(call Package/libc/Default)
128 SECTION:=utils
129 CATEGORY:=Utilities
130 TITLE:=Shared library path configuration
131 endef
132
133
134 define Build/Prepare
135 mkdir -p $(PKG_BUILD_DIR)
136 endef
137
138 define Build/Compile/Default
139 endef
140
141 define Build/Compile
142 $(call Build/Compile/Default)
143 endef
144
145 define Package/base-files$(TARGET)/install
146 $(CP) ./files/* $(1)/
147 if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
148 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
149 fi
150 if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
151 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
152 fi
153 if [ -d $(PLATFORM_DIR)/base-files-$(PROFILE)/. ]; then \
154 $(CP) $(PLATFORM_DIR)/base-files-$(PROFILE)/* $(1)/; \
155 fi
156 $(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
157 if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
158 $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
159 fi; \
160 if [ -d $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/. ]; then \
161 $(CP) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/* $(1)/; \
162 fi \
163 )
164 # Form valid /etc/shadow entries, by copying the user:pw pairs
165 # from /etc/passwd, and adding on pw change data
166 $(if $(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS), \
167 cut -d ':' -f 1-2 $(1)/etc/passwd > $(1)/etc/shadow; \
168 $(SED) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc/shadow \
169 )
170 $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/banner
171 mkdir -p $(1)/CONTROL
172 mkdir -p $(1)/dev
173 mkdir -p $(1)/etc/crontabs
174 mkdir -p $(1)/jffs
175 mkdir -p $(1)/lib/firmware
176 mkdir -p $(1)/mnt
177 mkdir -p $(1)/proc
178 mkdir -p $(1)/tmp
179 mkdir -p $(1)/usr/lib
180 mkdir -p $(1)/usr/bin
181 mkdir -p $(1)/sys
182 mkdir -p $(1)/www
183 mkdir -p $(1)/root
184 ln -sf /proc/mounts $(1)/etc/mtab
185 rm -f $(1)/var
186 ln -sf /tmp $(1)/var
187 mkdir -p $(1)/etc
188 ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
189 $(call Package/base-files/install-target,$(1))
190 for conffile in $(1)/etc/config/*; do \
191 if [ -f "$$$$conffile" ]; then \
192 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
193 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
194 fi \
195 done
196 endef
197
198 define Package/libgcc/install
199 $(INSTALL_DIR) $(1)/lib
200 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libgcc_s.so.* $(1)/lib/
201 endef
202
203 define Package/libssp/install
204 $(INSTALL_DIR) $(1)/lib
205 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libssp.so.* $(1)/lib/
206 endef
207
208 define Package/libstdcpp/install
209 $(INSTALL_DIR) $(1)/usr/lib
210 $(CP) $(TOOLCHAIN_DIR)/usr/lib$(LIB_SUFFIX)/libstdc++.so.* $(1)/usr/lib/
211 endef
212
213 use_libutil=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
214 use_libnsl=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
215 use_nsswitch=$(if $(CONFIG_USE_GLIBC)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
216
217 define Package/glibc/install
218 $(INSTALL_DIR) $(1)/lib
219 $(CP) $(TOOLCHAIN_DIR)/lib/ld*.so.* $(1)/lib/
220 $(CP) $(TOOLCHAIN_DIR)/lib/ld-$(LIBC_VERSION).so $(1)/lib/
221 for file in libanl libc libcidn libcrypt libdl libm $(use_libnsl) $(use_nsswitch) libresolv $(use_libutil); do \
222 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
223 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_VERSION).so $(1)/lib/; \
224 done
225 endef
226
227 define Package/eglibc/install
228 $(call Package/glibc/install,$1)
229 endef
230
231 define Package/uClibc/install
232 $(INSTALL_DIR) $(1)/lib
233 for file in ld$(LIB_SUFFIX)-uClibc libc libcrypt libdl libm libnsl libresolv libuClibc libutil; do \
234 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
235 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(LIBC_VERSION).so $(1)/lib/; \
236 done
237 endef
238
239 define Package/libc/install
240 $(call Package/$(LIBC)/install,$1)
241 endef
242
243 define Package/libpthread/install
244 $(INSTALL_DIR) $(1)/lib
245 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
246 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(LIBC_VERSION).so $(1)/lib/
247 endef
248
249 define Package/librt/install
250 $(INSTALL_DIR) $(1)/lib
251 $(CP) $(TOOLCHAIN_DIR)/lib/librt.so.* $(1)/lib/
252 $(CP) $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_VERSION).so $(1)/lib/
253 endef
254
255 define Package/ldd/install
256 $(INSTALL_DIR) $(1)/usr/bin/
257 $(CP) $(TOOLCHAIN_DIR)/usr/bin/ldd $(1)/usr/bin/
258 endef
259
260 define Package/ldconfig/install
261 $(INSTALL_DIR) $(1)/sbin/
262 $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/
263 endef
264
265 ifneq ($(DUMP),1)
266 -include $(PLATFORM_DIR)/base-files.mk
267 endif
268
269 $(eval $(call BuildPackage,base-files$(TARGET)))
270 $(eval $(call BuildPackage,libc))
271 $(eval $(call BuildPackage,libgcc))
272 $(eval $(call BuildPackage,libssp))
273 $(eval $(call BuildPackage,libstdcpp))
274 $(eval $(call BuildPackage,libpthread))
275 $(eval $(call BuildPackage,librt))
276 $(eval $(call BuildPackage,ldd))
277 $(eval $(call BuildPackage,ldconfig))
This page took 0.055288 seconds and 3 git commands to generate.