234709103c7c0e422e53750f5b084c94fc175696
[openwrt/openwrt.git] / toolchain / musl / common.mk
1 #
2 # Copyright (C) 2012-2013 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:=musl
11 PKG_VERSION:=1.1.20
12 PKG_RELEASE:=2
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE_VERSION:=0fa1e638e87cf257e9f96b4019b2076afd674a19
17 PKG_MIRROR_HASH:=0a49559e845f51aaf006539176a36d6527957affd2838e71fd43275b737e90fe
18 PKG_SOURCE_URL:=git://git.musl-libc.org/musl
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
20
21 LIBC_SO_VERSION:=$(PKG_VERSION)
22 PATCH_DIR:=$(PATH_PREFIX)/patches
23
24 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
25 HOST_BUILD_PREFIX:=$(TOOLCHAIN_DIR)
26 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
27
28 include $(INCLUDE_DIR)/host-build.mk
29 include $(INCLUDE_DIR)/hardening.mk
30
31 TARGET_CFLAGS:= $(filter-out -O%,$(TARGET_CFLAGS))
32
33 MUSL_CONFIGURE:= \
34 $(TARGET_CONFIGURE_OPTS) \
35 CFLAGS="$(TARGET_CFLAGS)" \
36 CROSS_COMPILE="$(TARGET_CROSS)" \
37 $(HOST_BUILD_DIR)/configure \
38 --prefix=/ \
39 --host=$(GNU_HOST_NAME) \
40 --target=$(REAL_GNU_TARGET_NAME) \
41 --disable-gcc-wrapper \
42 --enable-debug \
43 --enable-optimize
44
45 define Host/Configure
46 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
47 ( cd $(HOST_BUILD_DIR); rm -f config.cache; \
48 $(MUSL_CONFIGURE) \
49 );
50 endef
51
52 define Host/Clean
53 rm -rf \
54 $(HOST_BUILD_DIR) \
55 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
56 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
57 endef