2 # Copyright (C) 2006-2008 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/target.mk
11 PKG_VERSION
:=$(call qstrip
,$(CONFIG_UCLIBC_VERSION
))
12 PKG_EXTRAVERSION
:=$(call qstrip
,$(CONFIG_UCLIBC_EXTRA_VERSION
))
13 PKG_VERSION_SNAPSHOT
:=$(call qstrip
,$(CONFIG_UCLIBC_VERSION_SNAPSHOT
))
14 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
15 PKG_SOURCE_URL
:=http
://www.uclibc.org
/downloads
/snapshots
16 PKG_SOURCE
:=uClibc-snapshot.
tar.bz2
18 PKG_SOURCE_URL
:=http
://www.uclibc.org
/downloads
19 PKG_SOURCE
:=uClibc-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
).
tar.bz2
21 PATCH_DIR
:=.
/patches
/$(PKG_VERSION
)$(PKG_EXTRAVERSION
)
22 CONFIG_DIR
:=.
/config
/$(PKG_VERSION
)$(PKG_EXTRAVERSION
)
24 ifeq ($(PKG_VERSION
),0.9.28)
25 ifeq ($(PKG_EXTRAVERSION
),.2)
26 PKG_MD5SUM
:=959f25286e317f0d9e2103445c5a14c2
28 ifeq ($(PKG_EXTRAVERSION
),.3)
29 PKG_MD5SUM
:=428405a36b4662980d9343b32089b5a6
33 ifeq ($(PKG_VERSION
),0.9.29)
34 ifeq ($(PKG_EXTRAVERSION
),)
35 # currently the default version, no special sub-directory needed
38 PKG_MD5SUM
:=61dc55f43b17a38a074f347e74095b20
42 ifeq ($(PKG_VERSION
),0.9.30)
43 ifeq ($(PKG_EXTRAVERSION
),)
44 PKG_MD5SUM
:=e5766e2566e0297adebebbcc0aba1f2d
48 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
56 STAGING_DIR_HOST
:=$(TOOLCHAIN_DIR
)
57 BUILD_DIR_HOST
:=$(BUILD_DIR_TOOLCHAIN
)
58 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
59 PKG_BUILD_DIR
:=$(BUILD_DIR_HOST
)/uClibc-
$(PKG_EXTRAVERSION
)
61 PKG_BUILD_DIR
:=$(BUILD_DIR_HOST
)/uClibc-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
)
64 override CONFIG_AUTOREBUILD
=
66 include $(INCLUDE_DIR
)/host-build.mk
68 STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc_installed
69 STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc-utils_installed
71 UCLIBC_TARGET_ARCH
:=$(shell echo
$(ARCH
) | sed
-e s
'/-.*//' \
73 -e
's/sparc.*/sparc/' \
75 -e
's/avr32.*/avr32/g' \
77 -e
's/ppc/powerpc/g' \
78 -e
's/v850.*/v850/g' \
80 -e
's/sh[234].*/sh/' \
82 -e
's/mipsel.*/mips/' \
87 define Build
/SetToolchainInfo
88 $(SED
) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR
)/info.mk
89 $(SED
) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR
)/info.mk
90 $(SED
) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
91 $(SED
) 's,^\(LIBC_PATCHVER\)=.*,\1=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR
)/info.mk
94 define Build
/Prepare
/Snapshot
96 rm -Rf
$(PKG_BUILD_DIR
)
97 ln
-snf
$(BUILD_DIR_TOOLCHAIN
)/uClibc
$(PKG_BUILD_DIR
)
99 $(if
$(QUILT
),touch
$(PKG_BUILD_DIR
)/.quilt_used
)
102 define Build
/Prepare
/V_0_9_28
103 $(SED
) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(BUILD_DIR_TOOLCHAIN)/linux\",g' \
104 $(PKG_BUILD_DIR
)/.config
105 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
106 $(SED
) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(PKG_BUILD_DIR
)/.config
108 ifeq ($(CONFIG_C99_MATH
),y
)
109 $(SED
) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(PKG_BUILD_DIR
)/.config
114 $(call Build
/SetToolchainInfo
)
115 @echo prepare uClibc version
$(PKG_VERSION
)$(PKG_EXTRAVERSION
)
116 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
117 $(call Build
/Prepare
/Snapshot
)
119 $(call Build
/Prepare
/Default
)
120 ln
-snf
$(PKG_NAME
)-$(PKG_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
122 $(CP
) .
/$(CONFIG_DIR
)/$(ARCH
)$(if
$(wildcard $(CONFIG_DIR
)/$(ARCH
).
$(BOARD
)),.
$(BOARD
)) $(PKG_BUILD_DIR
)/.config
123 ifeq ($(PKG_VERSION
),0.9.28)
124 $(call Build
/Prepare
/V_0_9_28
)
126 $(SED
) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include\",g' \
127 -e
's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,y),g' \
128 -e
's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
129 -e
's,^.*CONFIG_ARM_EABI.*,CONFIG_ARM_EABI=$(if $(CONFIG_EABI_SUPPORT),y,n),g' \
130 -e
's,^.*CONFIG_ARM_OABI.*,CONFIG_ARM_OABI=$(if $(CONFIG_EABI_SUPPORT),n,y),g' \
131 -e
's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
132 $(PKG_BUILD_DIR
)/.config
133 $(MAKE
) -C
$(PKG_BUILD_DIR
)/extra
/config conf KBUILD_HAVE_NLS
= HOSTCFLAGS
="-DKBUILD_NO_NLS"
134 PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(PKG_BUILD_DIR
) \
135 PREFIX
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
137 RUNTIME_PREFIX
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
140 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
142 $(if
$(CONFIG_UCLIBC_VERSION_0_9_28
),install_dev
,install_headers
)
145 define Build
/Configure
148 UCLIBC_MAKE
:= PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(PKG_BUILD_DIR
) \
149 $(TARGET_CONFIGURE_OPTS
) \
153 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
157 $(SED
) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR
)/Rules.mak
158 $(UCLIBC_MAKE
) PREFIX
= all
159 $(UCLIBC_MAKE
) PREFIX
="$(TOOLCHAIN_DIR)/" install_runtime install_dev
160 ln
-sf ..
/..
/lib
/libc.so
.0 $(TOOLCHAIN_DIR
)/usr
/lib
/libc.so
161 # ( cd $(TOOLCHAIN_DIR) ; \
162 # for d in lib usr/lib ; do \
163 # for f in libc.so libpthread.so libgcc_s.so ; do \
164 # if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
165 # $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
173 $(UCLIBC_MAKE
) PREFIX
= utils
174 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/usr
/bin
176 $(PKG_BUILD_DIR
)/utils
/ldd \
177 $(TOOLCHAIN_DIR
)/usr
/bin
/
178 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/sbin
180 $(PKG_BUILD_DIR
)/utils
/ldconfig \
181 $(TOOLCHAIN_DIR
)/sbin
/
187 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
) \
188 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
191 $(eval
$(call HostBuild
))