toolchain/uClibc: add preliminary support for 0.9.31 (needs testing)
[openwrt.git] / toolchain / uClibc / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/target.mk
9
10 PKG_NAME:=uClibc
11 PKG_VERSION:=$(call qstrip,$(CONFIG_UCLIBC_VERSION))
12 ifeq ($(CONFIG_UCLIBC_VERSION_NPTL),y)
13 PKG_SOURCE_URL:=git://git.busybox.net/uClibc
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_VERSION:=ef18cfe8ebab25f5ef92e81956f50e2dc57df602
16 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
18 LIBC_SO_VERSION:=0.9.30-git
19 else
20 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
21 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
22 LIBC_SO_VERSION:=$(PKG_VERSION)
23 endif
24 PATCH_DIR:=./patches-$(PKG_VERSION)
25 CONFIG_DIR:=./config-$(PKG_VERSION)
26
27 PKG_MD5SUM_0.9.30.1 = 1a4b84e5536ad8170563ffa88c34679c
28 PKG_MD5SUM_0.9.30.2 = e759ec855500082ac3e671dd6cacfdb0
29 PKG_MD5SUM_0.9.30.3 = 73a4bf4a0fa508b01a7a3143574e3d21
30 PKG_MD5SUM_0.9.31 = 52fb8a494758630c8d3ddd7f1e0daafd
31 PKG_MD5SUM=$(PKG_MD5SUM_$(PKG_VERSION))
32
33 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
34
35 include $(INCLUDE_DIR)/toolchain-build.mk
36
37 HOST_STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.uclibc_installed
38 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc-utils_installed
39
40 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
41 -e 's/i.86/i386/' \
42 -e 's/sparc.*/sparc/' \
43 -e 's/arm.*/arm/g' \
44 -e 's/avr32.*/avr32/g' \
45 -e 's/m68k.*/m68k/' \
46 -e 's/ppc/powerpc/g' \
47 -e 's/v850.*/v850/g' \
48 -e 's/sh64/sh/' \
49 -e 's/sh[234].*/sh/' \
50 -e 's/mips.*/mips/' \
51 -e 's/mipsel.*/mips/' \
52 -e 's/cris.*/cris/' \
53 )
54
55
56 define Host/SetToolchainInfo
57 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
58 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR)/info.mk
59 $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
60 $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(LIBC_SO_VERSION),' $(TOOLCHAIN_DIR)/info.mk
61 endef
62
63 GEN_CONFIG=$(SCRIPT_DIR)/kconfig.pl -n \
64 $(if $(wildcard $(CONFIG_DIR)/common),'+' $(CONFIG_DIR)/common) \
65 $(if $(CONFIG_UCLIBC_ENABLE_DEBUG),$(if $(wildcard $(CONFIG_DIR)/debug),'+' $(CONFIG_DIR)/debug)) \
66 $(CONFIG_DIR)/$(ARCH)$(if $(wildcard $(CONFIG_DIR)/$(ARCH).$(BOARD)),.$(BOARD))
67
68 define Host/Prepare
69 $(call Host/SetToolchainInfo)
70 $(call Host/Prepare/Default)
71 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
72 $(GEN_CONFIG) > $(HOST_BUILD_DIR)/.config
73 $(SED) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include\",g' \
74 -e 's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n,y),g' \
75 -e 's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=$(if $(CONFIG_SOFT_FLOAT),y,n),g' \
76 -e 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
77 -e 's,^.*CONFIG_ARM_EABI.*,CONFIG_ARM_EABI=$(if $(CONFIG_EABI_SUPPORT),y,n),g' \
78 -e 's,^.*CONFIG_ARM_OABI.*,CONFIG_ARM_OABI=$(if $(CONFIG_EABI_SUPPORT),n,y),g' \
79 -e 's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
80 $(HOST_BUILD_DIR)/.config
81 $(MAKE) -C $(HOST_BUILD_DIR) oldconfig KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS"
82 $(MAKE) -C $(HOST_BUILD_DIR)/extra/config conf KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS"
83 PATH='$(TARGET_PATH)' $(MAKE) -C $(HOST_BUILD_DIR) \
84 PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
85 DEVEL_PREFIX=/usr/ \
86 RUNTIME_PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
87 HOSTCC="$(HOSTCC)" \
88 CC="$(TARGET_CC)" \
89 CPU_CFLAGS="$(TARGET_CFLAGS)" \
90 ARCH="$(CONFIG_ARCH)" \
91 pregen \
92 install_headers
93 endef
94
95 define Host/Configure
96 endef
97
98 UCLIBC_MAKE = PATH='$(TARGET_PATH)' $(MAKE) -C $(HOST_BUILD_DIR) \
99 $(TARGET_CONFIGURE_OPTS) \
100 DEVEL_PREFIX=/usr/ \
101 RUNTIME_PREFIX=/ \
102 HOSTCC="$(HOSTCC)" \
103 CPU_CFLAGS="$(TARGET_CFLAGS)" \
104 ARCH="$(CONFIG_ARCH)" \
105 LIBGCC="$(subst libgcc.a,libgcc_initial.a,$(shell $(TARGET_CC) -print-libgcc-file-name))" \
106 DOSTRIP=""
107
108 define Host/Compile
109 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR)/Rules.mak
110 $(UCLIBC_MAKE) PREFIX= all
111 $(UCLIBC_MAKE) PREFIX="$(TOOLCHAIN_DIR)/" install_runtime install_dev
112 ln -sf ../../lib/libc.so.0 $(TOOLCHAIN_DIR)/usr/lib/libc.so
113 $(CP) $(HOST_BUILD_DIR)/libc/libc_so.a $(TOOLCHAIN_DIR)/usr/lib/
114 $(CP) $(HOST_BUILD_DIR)/libpthread/*/libpthread_so.a $(TOOLCHAIN_DIR)/usr/lib/
115 ( cd $(TOOLCHAIN_DIR) ; \
116 for d in lib usr/lib ; do \
117 for f in libc.so libpthread.so libgcc_s.so ; do \
118 if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
119 $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
120 fi \
121 done \
122 done \
123 )
124 endef
125
126 define Host/Install
127 $(UCLIBC_MAKE) PREFIX= utils
128 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/bin
129 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/usr/bin
130 $(INSTALL_BIN) \
131 $(HOST_BUILD_DIR)/utils/ldd \
132 $(TOOLCHAIN_DIR)/usr/bin/
133 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/sbin
134 $(INSTALL_BIN) \
135 $(HOST_BUILD_DIR)/utils/ldconfig \
136 $(TOOLCHAIN_DIR)/sbin/
137 endef
138
139 define Host/Clean
140 rm -rf \
141 $(HOST_BUILD_DIR) \
142 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
143 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
144 endef
145
146 $(eval $(call HostBuild))
This page took 0.046815 seconds and 5 git commands to generate.