7c0a4c9e1f4fe3d16ec7f932f0bf6cd4dee5d00d
[openwrt/svn-archive/archive.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:=8
14
15 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
16 PKG_FILE_DEPEND:=$(PLATFORM_DIR)
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 UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version 2>/dev/null}
27 UCLIBC_EXTRA_VERSION:=${shell cat $(STAGING_DIR)/uclibc_extra_version 2>/dev/null}
28 LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version 2>/dev/null}
29 else
30 UCLIBC_VERSION:=<UCLIBC_VERSION>
31 LIBGCC_VERSION:=<LIBGCC_VERSION>
32 endif
33
34 CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
35
36 define Package/base-files$(TARGET)
37 SECTION:=base
38 CATEGORY:=Base system
39 TITLE:=Base filesystem for OpenWrt
40 DESCRIPTION:=\
41 This package contains a base filesystem and system scripts for OpenWrt.
42 URL:=http://openwrt.org/
43 VERSION:=$(PKG_RELEASE)-$(REV)
44 $(call Config,network.lan.proto,string,static,LAN Protocol)
45 $(call Config,network.lan.ipaddr,ip,192.168.1.1,LAN IP Address)
46 $(call Config,network.lan.netmask,netmask,255.255.255.0,LAN Network Mask)
47 $(call Config,network.lan.gateway,ip,,LAN Gateway)
48 $(call Config,network.lan.dns,ip,,LAN DNS server)
49 endef
50
51 define Package/base-files$(TARGET)/conffiles
52 /etc/banner
53 /etc/hosts
54 /etc/inittab
55 /etc/group
56 /etc/passwd
57 /etc/profile
58 /etc/shells
59 /etc/ipkg.conf
60 /etc/sysctl.conf
61 $(call $(TARGET)/conffiles)
62 endef
63
64 define Package/gcc/Default
65 SECTION:=libs
66 CATEGORY:=Base system
67 DEPENDS:=@!NATIVE_TOOLCHAIN
68 URL:=http://gcc.gnu.org/
69 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
70 endef
71
72 define Package/libgcc
73 $(call Package/gcc/Default)
74 TITLE:=GCC support library
75 endef
76
77 define Package/libssp
78 $(call Package/gcc/Default)
79 TITLE:=GCC support library
80 endef
81
82 define Package/uclibc/Default
83 SECTION:=libs
84 CATEGORY:=Base system
85 DEPENDS:=@!NATIVE_TOOLCHAIN
86 URL:=http://uclibc.org/
87 VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
88 endef
89
90 define Package/libpthread
91 $(call Package/uclibc/Default)
92 TITLE:=POSIX thread library
93 endef
94
95 define Package/uclibc
96 $(call Package/uclibc/Default)
97 TITLE:=C library embedded systems
98 endef
99
100 define Package/ldd
101 $(call Package/uclibc/Default)
102 TITLE:=LDD trace utility
103 endef
104
105 define Package/ldconfig
106 $(call Package/uclibc/Default)
107 TITLE:=Shared library path configuration
108 endef
109
110 define Build/Prepare
111 mkdir -p $(PKG_BUILD_DIR)
112 endef
113
114 define Build/Compile/Default
115 endef
116
117 define Build/Compile
118 $(call Build/Compile/Default)
119 endef
120
121 define Package/base-files$(TARGET)/install
122 $(CP) ./files/* $(1)/
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' $(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
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) $(STAGING_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) $(STAGING_DIR)/lib/libssp.so.* $(1)/lib/
167 endef
168 endif
169
170 define Package/libpthread/install
171 $(INSTALL_DIR) $(1)/lib
172 $(CP) $(STAGING_DIR)/lib/libpthread.so.* $(1)/lib/
173 $(CP) $(STAGING_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
174 endef
175
176 define Package/uclibc/install
177 $(INSTALL_DIR) $(1)/lib
178 for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
179 $(CP) $(STAGING_DIR)/lib/$$$$file.so.* $(1)/lib/; \
180 $(CP) $(STAGING_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
181 done
182 endef
183
184 define Package/ldd/install
185 $(INSTALL_DIR) $(1)/bin/
186 $(CP) $(TOOLCHAIN_BUILD_DIR)/uClibc-$(UCLIBC_EXTRA_VERSION)/utils/ldd $(1)/bin/
187 endef
188
189 define Package/ldconfig/install
190 $(INSTALL_DIR) $(1)/bin/
191 $(CP) $(TOOLCHAIN_BUILD_DIR)/uClibc-$(UCLIBC_EXTRA_VERSION)/utils/ldconfig $(1)/bin/
192 endef
193
194 ifneq ($(DUMP),1)
195 -include $(PLATFORM_DIR)/base-files.mk
196 endif
197
198 $(eval $(call BuildPackage,base-files$(TARGET)))
199 $(eval $(call BuildPackage,libgcc))
200 $(eval $(call BuildPackage,libssp))
201 $(eval $(call BuildPackage,libpthread))
202 $(eval $(call BuildPackage,uclibc))
203 $(eval $(call BuildPackage,ldd))
204 $(eval $(call BuildPackage,ldconfig))
205