2 # Copyright (C) 2006-2009 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 ($(CONFIG_UCLIBC_VERSION_NPTL
),y
)
15 PKG_SOURCE_URL
:=http
://www.uclibc.org
/svn
/branches
/uClibc-nptl
17 PKG_SOURCE_VERSION
:=25804
18 PKG_SOURCE_SUBDIR
:=$(PKG_NAME
)-$(PKG_VERSION
)+nptl
19 PKG_SOURCE
:=$(PKG_NAME
)-nptl-r
$(PKG_SOURCE_VERSION
).
tar.gz
20 PKG_EXTRAVERSION
:=-svn
22 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
23 PKG_SOURCE_URL
:=http
://www.uclibc.org
/downloads
/snapshots
24 PKG_SOURCE
:=uClibc-snapshot.
tar.bz2
26 PKG_SOURCE_URL
:=http
://www.uclibc.org
/downloads
27 PKG_SOURCE
:=uClibc-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
).
tar.bz2
30 PATCH_DIR
:=$(firstword $(wildcard .
/patches-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
) .
/patches-
$(PKG_VERSION
)))
31 CONFIG_DIR
:=$(firstword $(wildcard .
/config-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
) .
/config-
$(PKG_VERSION
)))
32 PATCH_DIR
:=$(if
$(CONFIG_UCLIBC_VERSION_NPTL
),.
/patches-nptl
,$(PATCH_DIR
))
33 CONFIG_DIR
:=$(if
$(CONFIG_UCLIBC_VERSION_NPTL
),.
/config-nptl
,$(CONFIG_DIR
))
34 PATCH_DIR
:=$(if
$(PKG_VERSION_SNAPSHOT
),,$(PATCH_DIR
))
35 CONFIG_DIR
:=$(if
$(PKG_VERSION_SNAPSHOT
),.
/config-0.9
.30,$(CONFIG_DIR
))
37 PKG_MD5SUM_0.9
.28.2 = 959f25286e317f0d9e2103445c5a14c2
38 PKG_MD5SUM_0.9
.28.3 = 428405a36b4662980d9343b32089b5a6
39 PKG_MD5SUM_0.9
.29 = 61dc55f43b17a38a074f347e74095b20
40 PKG_MD5SUM_0.9
.30 = e5766e2566e0297adebebbcc0aba1f2d
41 PKG_MD5SUM
=$(PKG_MD5SUM_
$(PKG_VERSION
)$(PKG_EXTRAVERSION
))
44 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
45 UCLIBC_SUBDIR
:=uClibc-
$(PKG_EXTRAVERSION
)
47 UCLIBC_SUBDIR
:=uClibc-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
)$(if
$(CONFIG_UCLIBC_VERSION_NPTL
),+nptl
)
49 HOST_BUILD_DIR
:=$(BUILD_DIR_TOOLCHAIN
)/$(UCLIBC_SUBDIR
)
51 include $(INCLUDE_DIR
)/toolchain-build.mk
53 HOST_STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc_installed
54 HOST_STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc-utils_installed
56 UCLIBC_TARGET_ARCH
:=$(shell echo
$(ARCH
) | sed
-e s
'/-.*//' \
58 -e
's/sparc.*/sparc/' \
60 -e
's/avr32.*/avr32/g' \
62 -e
's/ppc/powerpc/g' \
63 -e
's/v850.*/v850/g' \
65 -e
's/sh[234].*/sh/' \
67 -e
's/mipsel.*/mips/' \
72 define Host
/SetToolchainInfo
73 $(SED
) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR
)/info.mk
74 $(SED
) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR
)/info.mk
75 $(SED
) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
76 $(SED
) 's,^\(LIBC_PATCHVER\)=.*,\1=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR
)/info.mk
79 define Host
/Prepare
/Snapshot
81 rm -Rf
$(HOST_BUILD_DIR
)
83 $(if
$(QUILT
),touch
$(HOST_BUILD_DIR
)/.quilt_used
)
86 define Host
/Prepare
/V_0_9_28
87 $(SED
) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(BUILD_DIR_TOOLCHAIN)/linux\",g' \
88 $(HOST_BUILD_DIR
)/.config
89 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
90 $(SED
) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(HOST_BUILD_DIR
)/.config
92 ifeq ($(CONFIG_C99_MATH
),y
)
93 $(SED
) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(HOST_BUILD_DIR
)/.config
97 GEN_CONFIG
=$(SCRIPT_DIR
)/kconfig.pl
-n
$(if
$(wildcard $(CONFIG_DIR
)/common
),'+' $(CONFIG_DIR
)/common
) .
/$(CONFIG_DIR
)/$(ARCH
)$(if
$(wildcard $(CONFIG_DIR
)/$(ARCH
).
$(BOARD
)),.
$(BOARD
))
100 $(call Host
/SetToolchainInfo
)
101 @echo prepare uClibc version
$(PKG_VERSION
)$(PKG_EXTRAVERSION
)
102 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
103 $(call Host
/Prepare
/Snapshot
)
105 $(call Host
/Prepare
/Default
)
107 ln
-snf
$(UCLIBC_SUBDIR
) $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
108 $(GEN_CONFIG
) > $(HOST_BUILD_DIR
)/.config
109 ifeq ($(PKG_VERSION
),0.9.28)
110 $(call Host
/Prepare
/V_0_9_28
)
112 $(SED
) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include\",g' \
113 -e
's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n,y),g' \
114 -e
's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=$(if $(CONFIG_SOFT_FLOAT),y,n),g' \
115 -e
's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
116 -e
's,^.*CONFIG_ARM_EABI.*,CONFIG_ARM_EABI=$(if $(CONFIG_EABI_SUPPORT),y,n),g' \
117 -e
's,^.*CONFIG_ARM_OABI.*,CONFIG_ARM_OABI=$(if $(CONFIG_EABI_SUPPORT),n,y),g' \
118 -e
's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
119 $(HOST_BUILD_DIR
)/.config
120 $(MAKE
) -C
$(HOST_BUILD_DIR
)/extra
/config conf KBUILD_HAVE_NLS
= HOSTCFLAGS
="-DKBUILD_NO_NLS"
121 PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(HOST_BUILD_DIR
) \
122 PREFIX
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
124 RUNTIME_PREFIX
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
127 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
129 $(if
$(CONFIG_UCLIBC_VERSION_0_9_28
),install_dev
,install_headers
)
132 define Host
/Configure
135 UCLIBC_MAKE
:= PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(HOST_BUILD_DIR
) \
136 $(TARGET_CONFIGURE_OPTS
) \
140 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
144 $(SED
) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR
)/Rules.mak
145 $(UCLIBC_MAKE
) PREFIX
= all
146 $(UCLIBC_MAKE
) PREFIX
="$(TOOLCHAIN_DIR)/" install_runtime install_dev
147 ln
-sf ..
/..
/lib
/libc.so
.0 $(TOOLCHAIN_DIR
)/usr
/lib
/libc.so
148 # ( cd $(TOOLCHAIN_DIR) ; \
149 # for d in lib usr/lib ; do \
150 # for f in libc.so libpthread.so libgcc_s.so ; do \
151 # if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
152 # $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
160 $(UCLIBC_MAKE
) PREFIX
= utils
161 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/usr
/bin
163 $(HOST_BUILD_DIR
)/utils
/ldd \
164 $(TOOLCHAIN_DIR
)/usr
/bin
/
165 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/sbin
167 $(HOST_BUILD_DIR
)/utils
/ldconfig \
168 $(TOOLCHAIN_DIR
)/sbin
/
174 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
) \
175 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
178 $(eval
$(call HostBuild
))