creates a passwd's shadow file if busybox supports the feature, fixes #2887
[openwrt/svn-archive/archive.git] / package / base-files / Makefile
1 #
2 # Copyright (C) 2007 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:=13
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 UCLIBC_VERSION:=<UCLIBC_VERSION>
30 LIBGCC_VERSION:=<LIBGCC_VERSION>
31 endif
32
33 CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
34
35 define Package/base-files$(TARGET)
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$(TARGET)/conffiles
49 /etc/banner
50 /etc/hosts
51 /etc/inittab
52 /etc/group
53 /etc/passwd
54 /etc/profile
55 /etc/shells
56 /etc/ipkg.conf
57 /etc/sysctl.conf
58 $(call $(TARGET)/conffiles)
59 endef
60
61 define Package/base-files$(TARGET)/description
62 This package contains a base filesystem and system scripts for OpenWrt.
63 endef
64
65 define Package/gcc/Default
66 SECTION:=libs
67 CATEGORY:=Base system
68 DEPENDS:=@!NATIVE_TOOLCHAIN
69 URL:=http://gcc.gnu.org/
70 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
71 endef
72
73 define Package/libgcc
74 $(call Package/gcc/Default)
75 TITLE:=GCC support library
76 DEPENDS:=@!TARGET_avr32 @!NATIVE_TOOLCHAIN
77 endef
78
79 define Package/libssp
80 $(call Package/gcc/Default)
81 DEPENDS:=@SSP_SUPPORT
82 TITLE:=GCC support library
83 endef
84
85 define Package/libstdcpp
86 $(call Package/gcc/Default)
87 NAME:=libstdc++
88 TITLE:=GNU Standard C++ Library v3
89 DEPENDS:=@!NATIVE_TOOLCHAIN&&@INSTALL_LIBSTDCPP
90 endef
91
92 define Package/uclibc/Default
93 SECTION:=libs
94 CATEGORY:=Base system
95 DEPENDS:=@!NATIVE_TOOLCHAIN
96 URL:=http://uclibc.org/
97 VERSION:=$(UCLIBC_VERSION)$(UCLIBC_PATCHVER)-$(PKG_RELEASE)
98 endef
99
100 define Package/libpthread
101 $(call Package/uclibc/Default)
102 TITLE:=POSIX thread library
103 endef
104
105 define Package/uclibc
106 $(call Package/uclibc/Default)
107 TITLE:=C library embedded systems
108 endef
109
110 define Package/ldd
111 $(call Package/uclibc/Default)
112 TITLE:=LDD trace utility
113 endef
114
115 define Package/ldconfig
116 $(call Package/uclibc/Default)
117 TITLE:=Shared library path configuration
118 endef
119
120 define Build/Prepare
121 mkdir -p $(PKG_BUILD_DIR)
122 endef
123
124 define Build/Compile/Default
125 endef
126
127 define Build/Compile
128 $(call Build/Compile/Default)
129 endef
130
131 define Package/base-files$(TARGET)/install
132 $(CP) ./files/* $(1)/
133 if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
134 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
135 fi
136 if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
137 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
138 fi
139 if [ -d $(PLATFORM_DIR)/base-files-$(PROFILE)/. ]; then \
140 $(CP) $(PLATFORM_DIR)/base-files-$(PROFILE)/* $(1)/; \
141 fi
142 $(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
143 if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
144 $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
145 fi; \
146 if [ -d $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/. ]; then \
147 $(CP) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/* $(1)/; \
148 fi \
149 )
150 $(if $(CONFIG_BUSYBOX_CONFIG_FEATURE_SHADOWPASSWDS),cp $(1)/etc/passwd $(1)/etc/shadow)
151 $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/banner
152 $(SED) 's,$$$$S,$(BOARD),g' -e 's,$$$$A,$(ARCH),g' $(1)/etc/ipkg.conf
153 mkdir -p $(1)/dev
154 mkdir -p $(1)/etc/crontabs
155 mkdir -p $(1)/jffs
156 mkdir -p $(1)/lib/firmware
157 mkdir -p $(1)/mnt
158 mkdir -p $(1)/proc
159 mkdir -p $(1)/tmp
160 mkdir -p $(1)/usr/lib
161 mkdir -p $(1)/usr/bin
162 mkdir -p $(1)/sys
163 mkdir -p $(1)/www
164 mkdir -p $(1)/root
165 ln -sf /proc/mounts $(1)/etc/mtab
166 rm -f $(1)/var
167 ln -sf /tmp $(1)/var
168 mkdir -p $(1)/etc
169 ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
170 $(call Package/base-files/install-target,$(1))
171 for conffile in $(1)/etc/config/*; do \
172 if [ -f "$$$$conffile" ]; then \
173 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
174 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
175 fi \
176 done
177 endef
178
179 define Package/libgcc/install
180 $(INSTALL_DIR) $(1)/lib
181 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libgcc_s.so.* $(1)/lib/
182 endef
183
184 ifeq ($(word 1,$(subst ., ,$(LIBGCC_VERSION))),4)
185 define Package/libssp/install
186 $(INSTALL_DIR) $(1)/lib
187 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libssp.so.* $(1)/lib/
188 endef
189 endif
190
191 define Package/libstdcpp/install
192 $(INSTALL_DIR) $(1)/lib
193 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libstdc++.so.* $(1)/lib/
194 endef
195
196 define Package/libpthread/install
197 $(INSTALL_DIR) $(1)/lib
198 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
199 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
200 endef
201
202 define Package/uclibc/install
203 $(INSTALL_DIR) $(1)/lib
204 for file in ld$(LIB_SUFFIX)-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
205 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
206 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
207 done
208 endef
209
210 define Package/ldd/install
211 $(INSTALL_DIR) $(1)/bin/
212 $(CP) $(TOOLCHAIN_DIR)/target-utils/ldd $(1)/bin/
213 endef
214
215 define Package/ldconfig/install
216 $(INSTALL_DIR) $(1)/bin/
217 $(CP) $(TOOLCHAIN_DIR)/target-utils/ldconfig $(1)/bin/
218 endef
219
220 ifneq ($(DUMP),1)
221 -include $(PLATFORM_DIR)/base-files.mk
222 endif
223
224 $(eval $(call BuildPackage,base-files$(TARGET)))
225 $(eval $(call BuildPackage,libgcc))
226 $(eval $(call BuildPackage,libssp))
227 $(eval $(call BuildPackage,libstdcpp))
228 $(eval $(call BuildPackage,libpthread))
229 $(eval $(call BuildPackage,uclibc))
230 $(eval $(call BuildPackage,ldd))
231 $(eval $(call BuildPackage,ldconfig))