2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR
)/rules.mk
10 include $(INCLUDE_DIR
)/kernel.mk
15 PKG_BUILD_DIR
:=$(KERNEL_BUILD_DIR
)/$(PKG_NAME
)
16 PKG_FILE_DEPEND
:=$(PLATFORM_DIR
)/ $(GENERIC_PLATFORM_DIR
)/base-files
/
18 REV
:=$(shell LANG
=C svn
info | awk
'/^Revision:/ { print$$2 }' )
22 include $(INCLUDE_DIR
)/package.mk
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
}
30 UCLIBC_VERSION
:=<UCLIBC_VERSION
>
31 LIBGCC_VERSION
:=<LIBGCC_VERSION
>
34 CONFIG_PACKAGE_base-files
$(TARGET
):=$(CONFIG_PACKAGE_base-files
)
36 define Package
/base-files
$(TARGET
)
39 TITLE
:=Base filesystem for OpenWrt
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
)
51 define Package
/base-files
$(TARGET
)/conffiles
61 $(call
$(TARGET
)/conffiles
)
64 define Package
/gcc
/Default
67 DEPENDS
:=@
!NATIVE_TOOLCHAIN
68 URL
:=http
://gcc.gnu.org
/
69 VERSION
:=$(LIBGCC_VERSION
)-$(PKG_RELEASE
)
73 $(call Package
/gcc
/Default
)
74 TITLE
:=GCC support library
75 DEPENDS
:=@
!LINUX_2_6_AVR32||@
!NATIVE_TOOLCHAIN
79 $(call Package
/gcc
/Default
)
80 TITLE
:=GCC support library
83 define Package
/libstdcpp
84 $(call Package
/gcc
/Default
)
86 TITLE
:=GNU Standard C
++ Library v3
87 DEPENDS
:=@
!NATIVE_TOOLCHAIN
&&@INSTALL_LIBSTDCPP
90 define Package
/uclibc
/Default
93 DEPENDS
:=@
!NATIVE_TOOLCHAIN
94 URL
:=http
://uclibc.org
/
95 VERSION
:=$(UCLIBC_VERSION
)-$(PKG_RELEASE
)
98 define Package
/libpthread
99 $(call Package
/uclibc
/Default
)
100 TITLE
:=POSIX thread library
103 define Package
/uclibc
104 $(call Package
/uclibc
/Default
)
105 TITLE
:=C library embedded systems
109 mkdir
-p
$(PKG_BUILD_DIR
)
112 define Build
/Compile
/Default
116 $(call Build
/Compile
/Default
)
119 define Package
/base-files
$(TARGET
)/install
120 $(CP
) .
/files
/* $(1)/
121 if
[ -d
$(GENERIC_PLATFORM_DIR
)/base-files
/.
]; then \
122 $(CP
) $(GENERIC_PLATFORM_DIR
)/base-files
/* $(1)/; \
124 if
[ -d
$(PLATFORM_DIR
)/base-files
/default
/.
]; then \
125 $(CP
) $(PLATFORM_DIR
)/base-files
/default
/* $(1)/; \
127 if
[ "$(PROFILE)" != "Default" ]; then \
128 if
[ -d
$(PLATFORM_DIR
)/base-files
/profile-
$(PROFILE
)/.
]; then \
129 $(CP
) $(PLATFORM_DIR
)/base-files
/profile-
$(PROFILE
)/* $(1)/; \
132 $(SED
) 's,$$$$R,r$(REV),g' $(1)/etc
/banner
133 $(SED
) 's,$$$$S,$(BOARD)-$(KERNEL),g' -e
's,$$$$A,$(ARCH),g' $(1)/etc
/ipkg.conf
135 mkdir
-p
$(1)/etc
/crontabs
137 mkdir
-p
$(1)/lib
/firmware
141 mkdir
-p
$(1)/usr
/lib
142 mkdir
-p
$(1)/usr
/bin
145 ln
-sf
/proc
/mounts
$(1)/etc
/mtab
149 ln
-sf
/tmp
/resolv.conf
$(1)/etc
/resolv.conf
150 $(call Package
/base-files
/install-target
,$(1))
151 for conffile in
$(1)/etc
/config
/*; do \
152 if
[ -f
"$$$$conffile" ]; then \
153 grep
"$$$$conffile" $(1)/CONTROL
/conffiles || \
154 echo
"$$$${conffile##$(1)}" >> $(1)/CONTROL
/conffiles
; \
159 define Package
/libgcc
/install
160 $(INSTALL_DIR
) $(1)/lib
161 $(CP
) $(STAGING_DIR
)/lib
/libgcc_s.so.
* $(1)/lib
/
164 ifeq ($(word 1,$(subst .
, ,$(LIBGCC_VERSION
))),4)
165 define Package
/libssp
/install
166 $(INSTALL_DIR
) $(1)/lib
167 $(CP
) $(STAGING_DIR
)/lib
/libssp.so.
* $(1)/lib
/
171 define Package
/libstdcpp
/install
172 $(INSTALL_DIR
) $(1)/lib
173 $(CP
) $(STAGING_DIR
)/lib
/libstdc
++.so.
* $(1)/lib
/
176 define Package
/libpthread
/install
177 $(INSTALL_DIR
) $(1)/lib
178 $(CP
) $(STAGING_DIR
)/lib
/libpthread.so.
* $(1)/lib
/
179 $(CP
) $(STAGING_DIR
)/lib
/libpthread-
$(UCLIBC_VERSION
).so
$(1)/lib
/
182 define Package
/uclibc
/install
183 $(INSTALL_DIR
) $(1)/lib
184 for file in ld-uClibc libc libcrypt libdl libm libnsl libresolv librt libuClibc libutil
; do \
185 $(CP
) $(STAGING_DIR
)/lib
/$$$$file.so.
* $(1)/lib
/; \
186 $(CP
) $(STAGING_DIR
)/lib
/$$$$file-$(UCLIBC_VERSION
).so
$(1)/lib
/; \
190 define Package
/ldd
/install
191 $(INSTALL_DIR
) $(1)/bin
/
192 $(CP
) $(TOOLCHAIN_BUILD_DIR
)/uClibc-
$(UCLIBC_EXTRA_VERSION
)/utils
/ldd
$(1)/bin
/
195 define Package
/ldconfig
/install
196 $(INSTALL_DIR
) $(1)/bin
/
197 $(CP
) $(TOOLCHAIN_BUILD_DIR
)/uClibc-
$(UCLIBC_EXTRA_VERSION
)/utils
/ldconfig
$(1)/bin
/
201 -include $(PLATFORM_DIR
)/base-files.mk
204 $(eval
$(call BuildPackage
,base-files
$(TARGET
)))
205 $(eval
$(call BuildPackage
,libgcc
))
206 $(eval
$(call BuildPackage
,libssp
))
207 $(eval
$(call BuildPackage
,libstdcpp
))
208 $(eval
$(call BuildPackage
,libpthread
))
209 $(eval
$(call BuildPackage
,uclibc
))