rename default/ to files/
[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
17 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
18 ifeq ($(REV),)
19 REV:=0
20 endif
21
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 LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version 2>/dev/null}
28 else
29 UCLIBC_VERSION:=<UCLIBC_VERSION>
30 LIBGCC_VERSION:=<LIBGCC_VERSION>
31 endif
32
33 CONFIG_PACKAGE_base-files$(TARGET):=$(CONFIG_PACKAGE_base-files)
34
35 define Package/base-files$(TARGET)
36 SECTION:=base
37 CATEGORY:=Base system
38 TITLE:=Base filesystem for OpenWrt
39 DESCRIPTION:=\
40 This package contains a base filesystem and system scripts for OpenWrt.
41 URL:=http://openwrt.org/
42 VERSION:=$(PKG_RELEASE)-$(REV)
43 endef
44
45 define Package/base-files$(TARGET)/conffiles
46 /etc/banner
47 /etc/hosts
48 /etc/inittab
49 /etc/group
50 /etc/passwd
51 /etc/profile
52 /etc/shells
53 /etc/ipkg.conf
54 /etc/sysctl.conf
55 $(call $(TARGET)/conffiles)
56 endef
57
58 define Package/libgcc
59 SECTION:=libs
60 CATEGORY:=Base system
61 DEPENDS:=@!NATIVE_TOOLCHAIN
62 TITLE:=GCC support library
63 URL:=http://gcc.gnu.org/
64 VERSION:=$(LIBGCC_VERSION)-$(PKG_RELEASE)
65 endef
66
67 define Package/libpthread
68 SECTION:=libs
69 CATEGORY:=Libraries
70 DEPENDS:=@!NATIVE_TOOLCHAIN
71 TITLE:=POSIX thread library
72 URL:=http://uclibc.org/
73 VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
74 endef
75
76 define Package/uclibc
77 SECTION:=libs
78 CATEGORY:=Base system
79 DEPENDS:=@!NATIVE_TOOLCHAIN
80 TITLE:=C library embedded systems
81 URL:=http://uclibc.org/
82 VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE)
83 endef
84
85 define Build/Prepare
86 mkdir -p $(PKG_BUILD_DIR)
87 endef
88
89 define Build/Compile/Default
90 endef
91
92 define Build/Compile
93 $(call Build/Compile/Default)
94 endef
95
96 define Package/base-files$(TARGET)/install
97 $(CP) ./files/* $(1)/
98 if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
99 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
100 fi
101 $(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner
102 $(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' $(1)/etc/ipkg.conf
103 mkdir -p $(1)/dev
104 mkdir -p $(1)/etc/crontabs
105 mkdir -p $(1)/jffs
106 mkdir -p $(1)/lib
107 mkdir -p $(1)/mnt
108 mkdir -p $(1)/proc
109 mkdir -p $(1)/tmp
110 mkdir -p $(1)/usr/lib
111 mkdir -p $(1)/usr/bin
112 mkdir -p $(1)/sys
113 mkdir -p $(1)/www
114 ln -sf /proc/mounts $(1)/etc/mtab
115 rm -f $(1)/var
116 ln -sf /tmp $(1)/var
117 mkdir -p $(1)/etc
118 $(call Package/base-files/install-target,$(1))
119 for conffile in $(1)/etc/config/*; do \
120 if [ -f "$$$$conffile" ]; then \
121 grep "$$$$conffile" $(1)/CONTROL/conffiles || \
122 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
123 fi \
124 done
125 endef
126
127 define Package/libgcc/install
128 install -m0755 -d $(1)/lib
129 $(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(1)/lib/
130 endef
131
132 define Package/libpthread/install
133 install -m0755 -d $(1)/lib
134 $(CP) $(STAGING_DIR)/lib/libpthread.so.* $(1)/lib/
135 $(CP) $(STAGING_DIR)/lib/libpthread-$(UCLIBC_VERSION).so $(1)/lib/
136 endef
137
138 define Package/uclibc/install
139 install -m0755 -d $(1)/lib
140 for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil; do \
141 $(CP) $(STAGING_DIR)/lib/$$$$file.so.* $(1)/lib/; \
142 $(CP) $(STAGING_DIR)/lib/$$$$file-$(UCLIBC_VERSION).so $(1)/lib/; \
143 done
144 endef
145
146 ifneq ($(DUMP),1)
147 -include $(PLATFORM_DIR)/base-files.mk
148 endif
149
150 $(eval $(call BuildPackage,base-files$(TARGET)))
151 $(eval $(call BuildPackage,libgcc))
152 $(eval $(call BuildPackage,libpthread))
153 $(eval $(call BuildPackage,uclibc))