0901b81513ab30ac5bf2c923e306d1fb8b3983e5
[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.16
12 PKG_RELEASE=1
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE_VERSION:=1698fe6cdcdeaad03aa19a85433d5396ecfc51ef
17 PKG_MIRROR_HASH:=f07d14a8a647cf0b2a59cadea013abfc5e2e9eb527891d60b7f8370371ee4a71
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 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
25
26 include $(INCLUDE_DIR)/toolchain-build.mk
27 include $(INCLUDE_DIR)/hardening.mk
28
29 MUSL_CONFIGURE:= \
30 $(TARGET_CONFIGURE_OPTS) \
31 CFLAGS="$(TARGET_CFLAGS)" \
32 CROSS_COMPILE="$(TARGET_CROSS)" \
33 $(HOST_BUILD_DIR)/configure \
34 --prefix=/ \
35 --host=$(GNU_HOST_NAME) \
36 --target=$(REAL_GNU_TARGET_NAME) \
37 --disable-gcc-wrapper \
38 --enable-debug
39
40 define Host/Prepare
41 $(call Host/Prepare/Default)
42 $(if $(strip $(QUILT)), \
43 cd $(HOST_BUILD_DIR); \
44 if $(QUILT_CMD) next >/dev/null 2>&1; then \
45 $(QUILT_CMD) push -a; \
46 fi
47 )
48 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
49 endef
50
51 define Host/Configure
52 ( cd $(HOST_BUILD_DIR); rm -f config.cache; \
53 $(MUSL_CONFIGURE) \
54 );
55 endef
56
57 define Host/Clean
58 rm -rf \
59 $(HOST_BUILD_DIR) \
60 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
61 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
62 endef