strip the kernel version suffix from target directories, except for brcm-2.4 (the...
[openwrt.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_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   DESCRIPTION:=\
38         This package contains a base filesystem and system scripts for OpenWrt.
39   URL:=http://openwrt.org/
40   VERSION:=$(PKG_RELEASE)-$(REV)
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/gcc/Default
62   SECTION:=libs
63   CATEGORY:=Base system
64   DEPENDS:=@!NATIVE_TOOLCHAIN
65   URL:=http://gcc.gnu.org/
66   VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
67 endef
68
69 define Package/libgcc
70   $(call Package/gcc/Default)
71   TITLE:=GCC support library
72   DEPENDS:=@!TARGET_AVR32 @!NATIVE_TOOLCHAIN
73 endef
74
75 define Package/libssp
76   $(call Package/gcc/Default)
77   TITLE:=GCC support library
78 endef
79
80 define Package/libstdcpp
81   $(call Package/gcc/Default)
82   NAME:=libstdc++
83   TITLE:=GNU Standard C++ Library v3
84   DEPENDS:=@!NATIVE_TOOLCHAIN&&@INSTALL_LIBSTDCPP
85 endef
86
87 define Package/uclibc/Default
88   SECTION:=libs
89   CATEGORY:=Base system
90   DEPENDS:=@!NATIVE_TOOLCHAIN
91   URL:=http://uclibc.org/
92   VERSION:=$(UCLIBC_VERSION)$(UCLIBC_PATCHVER)-$(PKG_RELEASE)
93 endef
94
95 define Package/libpthread
96   $(call Package/uclibc/Default)
97   TITLE:=POSIX thread library
98 endef
99
100 define Package/uclibc
101   $(call Package/uclibc/Default)
102   TITLE:=C library embedded systems
103 endef
104
105 define Build/Prepare
106         mkdir -p $(PKG_BUILD_DIR)
107 endef
108
109 define Build/Compile/Default
110 endef
111
112 define Build/Compile
113         $(call Build/Compile/Default)
114 endef
115
116 define Package/base-files$(TARGET)/install
117         $(CP) ./files/* $(1)/
118         if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
119                 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
120         fi
121         if [ -d $(PLATFORM_DIR)/base-files/default/. ]; then \
122                 $(CP) $(PLATFORM_DIR)/base-files/default/* $(1)/; \
123         fi
124         if [ "$(PROFILE)" != "Default" ]; then \
125                 if [ -d $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/. ]; then \
126                         $(CP) $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/* $(1)/; \
127                 fi; \
128         fi
129         $(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner
130         $(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' -e 's,$$$$A,$(ARCH),g' $(1)/etc/ipkg.conf
131         mkdir -p $(1)/dev
132         mkdir -p $(1)/etc/crontabs
133         mkdir -p $(1)/jffs
134         mkdir -p $(1)/lib/firmware
135         mkdir -p $(1)/mnt
136         mkdir -p $(1)/proc
137         mkdir -p $(1)/tmp
138         mkdir -p $(1)/usr/lib
139         mkdir -p $(1)/usr/bin
140         mkdir -p $(1)/sys
141         mkdir -p $(1)/www
142         ln -sf /proc/mounts $(1)/etc/mtab
143         rm -f $(1)/var
144         ln -sf /tmp $(1)/var
145         mkdir -p $(1)/etc
146         ln -sf /tmp/resolv.conf $(1)/etc/resolv.conf
147         $(call Package/base-files/install-target,$(1))
148         for conffile in $(1)/etc/config/*; do \
149                 if [ -f "$$$$conffile" ]; then \
150                         grep "$$$$conffile" $(1)/CONTROL/conffiles || \
151                                 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
152                 fi \
153         done
154 endef
155
156 define Package/libgcc/install
157         $(INSTALL_DIR) $(1)/lib
158         $(CP) $(TOOLCHAIN_DIR)/lib/libgcc_s.so.* $(1)/lib/
159 endef
160
161 ifeq ($(word 1,$(subst ., ,$(LIBGCC_VERSION))),4)
162   define Package/libssp/install
163         $(INSTALL_DIR) $(1)/lib
164         $(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
165   endef
166 endif
167
168 define Package/libstdcpp/install
169         $(INSTALL_DIR) $(1)/lib
170         $(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/lib/
171 endef
172
173 define Package/libpthread/install
174         $(INSTALL_DIR) $(1)/lib
175         $(CP) $(TOOLCHAIN_DIR)/lib/libpthread.so.* $(1)/lib/
176         $(CP) $(TOOLCHAIN_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
177 endef
178
179 define Package/uclibc/install
180         $(INSTALL_DIR) $(1)/lib
181         for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
182                 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file.so.* $(1)/lib/; \
183                 $(CP) $(TOOLCHAIN_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
184         done
185 endef
186
187 define Package/ldd/install
188         $(INSTALL_DIR) $(1)/bin/
189         $(CP) $(TOOLCHAIN_DIR)/utils/ldd $(1)/bin/
190 endef
191
192 define Package/ldconfig/install
193         $(INSTALL_DIR) $(1)/bin/
194         $(CP) $(TOOLCHAIN_DIR)/utils/ldconfig $(1)/bin/
195 endef
196
197 ifneq ($(DUMP),1)
198   -include $(PLATFORM_DIR)/base-files.mk
199 endif
200
201 $(eval $(call BuildPackage,base-files$(TARGET)))
202 $(eval $(call BuildPackage,libgcc))
203 $(eval $(call BuildPackage,libssp))
204 $(eval $(call BuildPackage,libstdcpp))
205 $(eval $(call BuildPackage,libpthread))
206 $(eval $(call BuildPackage,uclibc))