summaryrefslogtreecommitdiff
path: root/core/mk/musl.mk
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2014-03-18 23:45:27 +0100
committerAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2014-03-18 23:45:27 +0100
commitef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35 (patch)
treee8e85268168e09221e23cdbb4639e47109988d04 /core/mk/musl.mk
parentfb516edcaeaa02e435316622b2bcc5314b42d529 (diff)
downloadembtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.gz
embtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.bz2
embtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.xz
Move mk/ to core/
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'core/mk/musl.mk')
-rw-r--r--core/mk/musl.mk78
1 files changed, 78 insertions, 0 deletions
diff --git a/core/mk/musl.mk b/core/mk/musl.mk
new file mode 100644
index 0000000..e2f1377
--- /dev/null
+++ b/core/mk/musl.mk
@@ -0,0 +1,78 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2012-2014 Abdoulaye Walsimou GAYE.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+################################################################################
+#
+# \file musl.mk
+# \brief musl.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date October 2012
+################################################################################
+
+MUSL_NAME := musl
+MUSL_VERSION := $(call embtk_get_pkgversion,musl)
+MUSL_SITE := http://www.musl-libc.org/releases
+MUSL_GIT_SITE := git://git.musl-libc.org/musl
+MUSL_PACKAGE := musl-$(MUSL_VERSION).tar.gz
+MUSL_SRC_DIR := $(embtk_toolsb)/musl-$(MUSL_VERSION)
+MUSL_BUILD_DIR := $(call __embtk_pkg_srcdir,musl)
+
+__embtk_musl_v := "$(MUSL_VERSION) From EmbToolkit v$(EMBTK_VERSION) -"
+__embtk_musl_v += "Compiled on $(embtk_host_uname)"
+
+define embtk_beforeinstall_musl
+ cd $(MUSL_SRC_DIR); \
+ CC=$(TARGETCC_CACHED) \
+ CROSS_COMPILE="$(CROSS_COMPILE)" \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ $(CONFIG_SHELL) $(MUSL_SRC_DIR)/configure \
+ --target=$(LINUX_ARCH) --host=$(LINUX_ARCH) \
+ --disable-gcc-wrapper --prefix=/ \
+ --syslibdir=/$(LIBDIR) --libdir=/$(LIBDIR) \
+ --includedir=/usr/include
+ echo "$(__embtk_musl_v)" > $(MUSL_SRC_DIR)/VERSION
+ $(call __embtk_setconfigured_pkg,musl)
+endef
+
+define __embtk_install_musl
+ $(call embtk_pinfo,"Build and install musl-$(MUSL_VERSION) ...")
+ $(call embtk_download_pkg,musl)
+ $(call embtk_decompress_pkg,musl)
+ $(Q)$(MAKE) -C $(MUSL_BUILD_DIR) distclean
+ $(embtk_beforeinstall_musl)
+ $(Q)$(MAKE) -C $(MUSL_BUILD_DIR) \
+ DESTDIR=$(embtk_sysroot) install-libs install-headers
+ cd $(embtk_sysroot)/$(LIBDIR); \
+ ln -sf libc.so $(embtk_musl_dlinker).so.1; \
+ ln -sf $(embtk_musl_dlinker).so.1 ld-musl.so.1
+ $(call __embtk_setinstalled_pkg,musl)
+ $(call __embtk_pkg_gen_dotkconfig_f,musl)
+ $(eval __embtk_musl_installed := y)
+endef
+
+define embtk_install_musl
+ $(if $(call __embtk_pkg_runrecipe-y,musl),$(__embtk_install_musl))
+endef
+
+define embtk_cleanup_musl
+ if [ -d $(MUSL_BUILD_DIR) ]; then \
+ $(MAKE) -C $(MUSL_BUILD_DIR) distclean; \
+ $(call __embtk_unsetconfigured_pkg,musl); \
+ $(call __embtk_unsetinstalled_pkg,musl); \
+ $(call __embtk_unsetkconfigured_pkg,musl); \
+ fi
+endef