f4ef55d110e9f49b7e626be4c24f5e77a77a60d6
[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 $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/banner
151 $(SED) 's,$$$$S,$(BOARD),g' -e 's,$$$$A,$(ARCH),g' $(1)/etc/ipkg.conf
152 mkdir -p $(1)/dev
153 mkdir -p $(1)/etc/crontabs
154 mkdir -p $(1)/jffs
155 mkdir -p $(1)/lib/firmware
156 mkdir -p $(1)/mnt
157 mkdir -p $(1)/proc
158 mkdir -p $(1)/tmp
159 mkdir -p $(1)/usr/lib
160 mkdir -p $(1)/usr/bin
161 mkdir -p $(1)/sys
162 mkdir -p $(1)/www
163 mkdir -p $(1)/root
164 ln -sf /proc/mounts $(1)/etc/mtab
165 rm -f $(1)/var
166 ln -sf /tmp $(1)/var
167 mkdir -p $(1)/etc
168 ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
169 $(call Package/base-files/install-target,$(1))
170 for conffile in $(1)/etc/config/*; do \
171 if [ -f "$$$$conffile" ]; then \
172 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
173 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
174 fi \
175 done
176 endef
177
178 define Package/libgcc/install
179 $(INSTALL_DIR) $(1)/lib
180 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libgcc_s.so.* $(1)/lib/
181 endef
182
183 ifeq ($(word 1,$(subst ., ,$(LIBGCC_VERSION))),4)
184 define Package/libssp/install
185 $(INSTALL_DIR) $(1)/lib
186 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libssp.so.* $(1)/lib/
187 endef
188 endif
189
190 define Package/libstdcpp/install
191 $(INSTALL_DIR) $(1)/lib
192 $(CP) $(TOOLCHAIN_DIR)/lib$(LIB_SUFFIX)/libstdc++.so.* $(1)/lib/
193 endef
194
195 define Package/libpthread/install
196 $(INSTALL_DIR) $(1)/lib
197 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
198 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
199 endef
200
201 define Package/uclibc/install
202 $(INSTALL_DIR) $(1)/lib
203 for file in ld$(LIB_SUFFIX)-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
204 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
205 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
206 done
207 endef
208
209 define Package/ldd/install
210 $(INSTALL_DIR) $(1)/bin/
211 $(CP) $(TOOLCHAIN_DIR)/target-utils/ldd $(1)/bin/
212 endef
213
214 define Package/ldconfig/install
215 $(INSTALL_DIR) $(1)/bin/
216 $(CP) $(TOOLCHAIN_DIR)/target-utils/ldconfig $(1)/bin/
217 endef
218
219 ifneq ($(DUMP),1)
220 -include $(PLATFORM_DIR)/base-files.mk
221 endif
222
223 $(eval $(call BuildPackage,base-files$(TARGET)))
224 $(eval $(call BuildPackage,libgcc))
225 $(eval $(call BuildPackage,libssp))
226 $(eval $(call BuildPackage,libstdcpp))
227 $(eval $(call BuildPackage,libpthread))
228 $(eval $(call BuildPackage,uclibc))
229 $(eval $(call BuildPackage,ldd))
230 $(eval $(call BuildPackage,ldconfig))