aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain/musl/common.mk
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-11-23 20:02:29 +0000
committerFlorian Fainelli <florian@openwrt.org>2012-11-23 20:02:29 +0000
commit6b63716262b89bec53402817876116898936d5f4 (patch)
tree1d792a9083d34dc6e40620b3c5802e9168a461e0 /toolchain/musl/common.mk
parent14ed3f0f22f34b337bb58b2a5fd09e887df3331f (diff)
downloadupstream-6b63716262b89bec53402817876116898936d5f4.tar.gz
upstream-6b63716262b89bec53402817876116898936d5f4.tar.bz2
upstream-6b63716262b89bec53402817876116898936d5f4.zip
add preliminary support for musl
Musl is an alternative C-library, see http://www.musl-libc.org for more infos. Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 34314
Diffstat (limited to 'toolchain/musl/common.mk')
-rw-r--r--toolchain/musl/common.mk65
1 files changed, 65 insertions, 0 deletions
diff --git a/toolchain/musl/common.mk b/toolchain/musl/common.mk
new file mode 100644
index 0000000000..68cb2396fa
--- /dev/null
+++ b/toolchain/musl/common.mk
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/target.mk
+
+PKG_NAME:=musl
+PKG_VERSION:=$(call qstrip,$(CONFIG_MUSL_VERSION))
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://git.musl-libc.org/musl
+PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=2df4f6f17b1f14684cb991c53c9ef0ddaa8c7bad
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+LIBC_SO_VERSION:=$(PKG_VERSION)
+PATCH_DIR:=$(PATH_PREFIX)/patches-$(PKG_VERSION)
+CONFIG_DIR:=$(PATH_PREFIX)/config-$(PKG_VERSION)
+
+HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/toolchain-build.mk
+
+MUSL_CONFIGURE:= \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ CROSS_COMPILE="$(TARGET_CROSS)" \
+ $(HOST_BUILD_DIR)/configure \
+ --prefix=/ \
+ --host=$(GNU_HOST_NAME) \
+ --target=$(REAL_GNU_TARGET_NAME) \
+ --disable-gcc-wrapper
+
+ifeq ($(CONFIG_MUSL_ENABLE_DEBUG),y)
+MUSL_CONFIGURE+= \
+ --enable-debug
+endif
+
+define Host/Prepare
+ $(call Host/Prepare/Default)
+ $(if $(strip $(QUILT)), \
+ cd $(HOST_BUILD_DIR); \
+ if $(QUILT_CMD) next >/dev/null 2>&1; then \
+ $(QUILT_CMD) push -a; \
+ fi
+ )
+ ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
+endef
+
+define Host/Configure
+ ( cd $(HOST_BUILD_DIR); rm -f config.cache; \
+ $(MUSL_CONFIGURE) \
+ );
+endef
+
+
+define Host/Clean
+ rm -rf \
+ $(HOST_BUILD_DIR) \
+ $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
+ $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
+endef