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