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