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