c5dd05e40477cddd0e8f92f02bbac01ee5f28133
[openwrt/staging/chunkeey.git] / package / base-files / Makefile
1 #
2 # Copyright (C) 2006 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:=9
14
15 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
16 PKG_FILE_DEPEND:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
17
18 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
19 ifeq ($(REV),)
20 REV:=0
21 endif
22 include $(INCLUDE_DIR)/package.mk
23
24 ifneq ($(DUMP),1)
25 TARGET:=-$(BOARD)-$(KERNEL)
26 LIBGCC_VERSION:=$(GCC_VERSION)
27 else
28 UCLIBC_VERSION:=<UCLIBC_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 DESCRIPTION:=\
39 This package contains a base filesystem and system scripts for OpenWrt.
40 URL:=http://openwrt.org/
41 VERSION:=$(PKG_RELEASE)-$(REV)
42 $(call Config,network.lan.proto,string,static,LAN Protocol)
43 $(call Config,network.lan.ipaddr,ip,192.168.1.1,LAN IP Address)
44 $(call Config,network.lan.netmask,netmask,255.255.255.0,LAN Network Mask)
45 $(call Config,network.lan.gateway,ip,,LAN Gateway)
46 $(call Config,network.lan.dns,ip,,LAN DNS server)
47 endef
48
49 define Package/base-files$(TARGET)/conffiles
50 /etc/banner
51 /etc/hosts
52 /etc/inittab
53 /etc/group
54 /etc/passwd
55 /etc/profile
56 /etc/shells
57 /etc/ipkg.conf
58 /etc/sysctl.conf
59 $(call $(TARGET)/conffiles)
60 endef
61
62 define Package/gcc/Default
63 SECTION:=libs
64 CATEGORY:=Base system
65 DEPENDS:=@!NATIVE_TOOLCHAIN
66 URL:=http://gcc.gnu.org/
67 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
68 endef
69
70 define Package/libgcc
71 $(call Package/gcc/Default)
72 TITLE:=GCC support library
73 DEPENDS:=@!LINUX_2_6_AVR32||@!NATIVE_TOOLCHAIN
74 endef
75
76 define Package/libssp
77 $(call Package/gcc/Default)
78 TITLE:=GCC support library
79 endef
80
81 define Package/libstdcpp
82 $(call Package/gcc/Default)
83 NAME:=libstdc++
84 TITLE:=GNU Standard C++ Library v3
85 DEPENDS:=@!NATIVE_TOOLCHAIN&&@INSTALL_LIBSTDCPP
86 endef
87
88 define Package/uclibc/Default
89 SECTION:=libs
90 CATEGORY:=Base system
91 DEPENDS:=@!NATIVE_TOOLCHAIN
92 URL:=http://uclibc.org/
93 VERSION:=$(UCLIBC_VERSION)$(UCLIBC_PATCHVER)-$(PKG_RELEASE)
94 endef
95
96 define Package/libpthread
97 $(call Package/uclibc/Default)
98 TITLE:=POSIX thread library
99 endef
100
101 define Package/uclibc
102 $(call Package/uclibc/Default)
103 TITLE:=C library embedded systems
104 endef
105
106 define Build/Prepare
107 mkdir -p $(PKG_BUILD_DIR)
108 endef
109
110 define Build/Compile/Default
111 endef
112
113 define Build/Compile
114 $(call Build/Compile/Default)
115 endef
116
117 define Package/base-files$(TARGET)/install
118 $(CP) ./files/* $(1)/
119 if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
120 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
121 fi
122 if [ -d $(PLATFORM_DIR)/base-files/default/. ]; then \
123 $(CP) $(PLATFORM_DIR)/base-files/default/* $(1)/; \
124 fi
125 if [ "$(PROFILE)" != "Default" ]; then \
126 if [ -d $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/. ]; then \
127 $(CP) $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/* $(1)/; \
128 fi; \
129 fi
130 $(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner
131 $(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' -e 's,$$$$A,$(ARCH),g' $(1)/etc/ipkg.conf
132 mkdir -p $(1)/dev
133 mkdir -p $(1)/etc/crontabs
134 mkdir -p $(1)/jffs
135 mkdir -p $(1)/lib/firmware
136 mkdir -p $(1)/mnt
137 mkdir -p $(1)/proc
138 mkdir -p $(1)/tmp
139 mkdir -p $(1)/usr/lib
140 mkdir -p $(1)/usr/bin
141 mkdir -p $(1)/sys
142 mkdir -p $(1)/www
143 ln -sf /proc/mounts $(1)/etc/mtab
144 rm -f $(1)/var
145 ln -sf /tmp $(1)/var
146 mkdir -p $(1)/etc
147 ln -sf /tmp/resolv.conf $(1)/etc/resolv.conf
148 $(call Package/base-files/install-target,$(1))
149 for conffile in $(1)/etc/config/*; do \
150 if [ -f "$$$$conffile" ]; then \
151 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
152 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
153 fi \
154 done
155 endef
156
157 define Package/libgcc/install
158 $(INSTALL_DIR) $(1)/lib
159 $(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/
160 endef
161
162 ifeq ($(word 1,$(subst ., ,$(LIBGCC_VERSION))),4)
163 define Package/libssp/install
164 $(INSTALL_DIR) $(1)/lib
165 $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
166 endef
167 endif
168
169 define Package/libstdcpp/install
170 $(INSTALL_DIR) $(1)/lib
171 $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/lib/
172 endef
173
174 define Package/libpthread/install
175 $(INSTALL_DIR) $(1)/lib
176 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
177 $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
178 endef
179
180 define Package/uclibc/install
181 $(INSTALL_DIR) $(1)/lib
182 for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
183 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
184 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
185 done
186 endef
187
188 define Package/ldd/install
189 $(INSTALL_DIR) $(1)/bin/
190 $(CP) $(TOOLCHAIN_DIR)/utils/ldd $(1)/bin/
191 endef
192
193 define Package/ldconfig/install
194 $(INSTALL_DIR) $(1)/bin/
195 $(CP) $(TOOLCHAIN_DIR)/utils/ldconfig $(1)/bin/
196 endef
197
198 ifneq ($(DUMP),1)
199 -include $(PLATFORM_DIR)/base-files.mk
200 endif
201
202 $(eval $(call BuildPackage,base-files$(TARGET)))
203 $(eval $(call BuildPackage,libgcc))
204 $(eval $(call BuildPackage,libssp))
205 $(eval $(call BuildPackage,libstdcpp))
206 $(eval $(call BuildPackage,libpthread))
207 $(eval $(call BuildPackage,uclibc))