From patchwork Mon May 5 21:17:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 345918 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 0C354140B04 for ; Tue, 6 May 2014 07:17:20 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 29D378A499; Mon, 5 May 2014 21:17:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yeKGL4fFmr4q; Mon, 5 May 2014 21:17:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 6B3C9898A3; Mon, 5 May 2014 21:17:17 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 7DBA31C2E8D for ; Mon, 5 May 2014 21:17:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7759A31ADA for ; Mon, 5 May 2014 21:17:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yFppc9o63f9n for ; Mon, 5 May 2014 21:17:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (top.free-electrons.com [176.31.233.9]) by silver.osuosl.org (Postfix) with ESMTP id 0EB0C304D2 for ; Mon, 5 May 2014 21:17:13 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id F03F2823; Mon, 5 May 2014 23:17:11 +0200 (CEST) Received: from localhost (AToulouse-651-1-90-105.w90-16.abo.wanadoo.fr [90.16.209.105]) by mail.free-electrons.com (Postfix) with ESMTPSA id AA5BC798 for ; Mon, 5 May 2014 23:17:11 +0200 (CEST) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Mon, 5 May 2014 23:17:01 +0200 Message-Id: <1399324630-3830-2-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1399324630-3830-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1399324630-3830-1-git-send-email-thomas.petazzoni@free-electrons.com> Subject: [Buildroot] [PATCHv2 01/10] musl: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Signed-off-by: Thomas Petazzoni --- package/musl/musl.mk | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 package/musl/musl.mk diff --git a/package/musl/musl.mk b/package/musl/musl.mk new file mode 100644 index 0000000..c3e868d --- /dev/null +++ b/package/musl/musl.mk @@ -0,0 +1,73 @@ +################################################################################ +# +# musl +# +################################################################################ + +MUSL_VERSION = 1.1.0 +MUSL_SITE = http://www.musl-libc.org/releases/ +MUSL_LICENSE = MIT +MUSL_LICENSE_FILES = COPYRIGHT + +# Before musl is configured, we must have the first stage +# cross-compiler and the kernel headers +MUSL_DEPENDENCIES = host-gcc-initial linux-headers + +# musl is part of the toolchain so disable the toolchain dependency +MUSL_ADD_TOOLCHAIN_DEPENDENCY = NO + +MUSL_INSTALL_STAGING = YES + +# We need to run the musl configure script prior to building the +# gcc-intermediate, so that we can call the install-headers step and +# get the crt.o built. However, we need to call it again after +# gcc-intermediate has been built, otherwise the configure script +# doesn't realize that libgcc has been built, and doesn't link the C +# library properly with libgcc, which causes build failure down the +# road. We will have the opportunity to simplify this once we switch +# to a 2-steps gcc build. +define MUSL_CONFIGURE_CALL + (cd $(@D); \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(filter-out -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \ + CPPFLAGS="$(filter-out -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --prefix=/usr \ + --disable-gcc-wrapper) +endef + +define MUSL_CONFIGURE_CMDS + $(MUSL_CONFIGURE_CALL) + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + DESTDIR=$(STAGING_DIR) install-headers + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + crt/crt1.o crt/crti.o crt/crtn.o + cp $(@D)/crt/crt*.o $(STAGING_DIR)/usr/lib + $(TARGET_CROSS)gcc -nostdlib \ + -nostartfiles -shared -x c /dev/null -o $(STAGING_DIR)/usr/lib/libc.so +endef + +define MUSL_BUILD_CMDS + $(MUSL_CONFIGURE_CALL) + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) +endef + +define MUSL_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + DESTDIR=$(STAGING_DIR) install-libs install-tools +endef + +# prefix is set to an empty value to get the C library installed in +# /lib and not /usr/lib +define MUSL_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + DESTDIR=$(TARGET_DIR) prefix= install-libs + $(RM) $(addprefix $(TARGET_DIR)/lib/,crt1.o crtn.o crti.o Scrt1.o) +endef + +$(eval $(generic-package)) + +# Before musl is built, we must have the second stage cross-compiler +$(MUSL_TARGET_BUILD): | host-gcc-intermediate