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