Fix the annoying base-files autorebuild bug.
[openwrt-10.03/.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
23 include $(INCLUDE_DIR)/package.mk
24
25 ifneq ($(DUMP),1)
26   TARGET:=-$(BOARD)-$(KERNEL)
27   UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_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 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/libgcc
60   SECTION:=libs
61   CATEGORY:=Base system
62   DEPENDS:=@!NATIVE_TOOLCHAIN
63   TITLE:=GCC support library
64   URL:=http://gcc.gnu.org/
65   VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
66 endef
67
68 define Package/libpthread
69   SECTION:=libs
70   CATEGORY:=Libraries
71   DEPENDS:=@!NATIVE_TOOLCHAIN
72   TITLE:=POSIX thread library
73   URL:=http://uclibc.org/
74   VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
75 endef
76
77 define Package/uclibc
78   SECTION:=libs
79   CATEGORY:=Base system
80   DEPENDS:=@!NATIVE_TOOLCHAIN
81   TITLE:=C library embedded systems
82   URL:=http://uclibc.org/
83   VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
84 endef
85
86 define Build/Prepare
87         mkdir -p $(PKG_BUILD_DIR)
88 endef
89
90 define Build/Compile/Default
91 endef
92
93 define Build/Compile
94         $(call Build/Compile/Default)
95 endef
96
97 define Package/base-files$(TARGET)/install
98         $(CP) ./files/* $(1)/
99         if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
100                 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
101         fi
102         $(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner
103         $(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' $(1)/etc/ipkg.conf
104         mkdir -p $(1)/dev
105         mkdir -p $(1)/etc/crontabs
106         mkdir -p $(1)/jffs
107         mkdir -p $(1)/lib
108         mkdir -p $(1)/mnt
109         mkdir -p $(1)/proc
110         mkdir -p $(1)/tmp
111         mkdir -p $(1)/usr/lib
112         mkdir -p $(1)/usr/bin
113         mkdir -p $(1)/sys
114         mkdir -p $(1)/www
115         ln -sf /proc/mounts $(1)/etc/mtab
116         rm -f $(1)/var
117         ln -sf /tmp $(1)/var
118         mkdir -p $(1)/etc
119         ln -sf /tmp/resolv.conf $(1)/etc/resolv.conf
120         $(call Package/base-files/install-target,$(1))
121         for conffile in $(1)/etc/config/*; do \
122                 if [ -f "$$$$conffile" ]; then \
123                         grep "$$$$conffile" $(1)/CONTROL/conffiles || \
124                                 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
125                 fi \
126         done
127 endef
128
129 define Package/libgcc/install
130         $(INSTALL_DIR) $(1)/lib
131         $(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(1)/lib/
132 endef
133
134 define Package/libpthread/install
135         $(INSTALL_DIR) $(1)/lib
136         $(CP) $(STAGING_DIR)/lib/libpthread.so.* $(1)/lib/
137         $(CP) $(STAGING_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
138 endef
139
140 define Package/uclibc/install
141         $(INSTALL_DIR) $(1)/lib
142         for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
143                 $(CP) $(STAGING_DIR)/lib/$$$$file.so.* $(1)/lib/; \
144                 $(CP) $(STAGING_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
145         done
146 endef
147
148 ifneq ($(DUMP),1)
149   -include $(PLATFORM_DIR)/base-files.mk
150 endif
151
152 $(eval $(call BuildPackage,base-files$(TARGET)))
153 $(eval $(call BuildPackage,libgcc))
154 $(eval $(call BuildPackage,libpthread))
155 $(eval $(call BuildPackage,uclibc))