From patchwork Thu Jul 27 09:45:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B6rg_Krause?= X-Patchwork-Id: 794285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=embedded.rocks header.i=@embedded.rocks header.b="Hm/V2lEW"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xJ6YG5jh7z9s78 for ; Thu, 27 Jul 2017 19:45:54 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id EC68888841; Thu, 27 Jul 2017 09:45:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WCIkLTIinG5A; Thu, 27 Jul 2017 09:45:51 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4B94888846; Thu, 27 Jul 2017 09:45:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 0B9A21C0F3B for ; Thu, 27 Jul 2017 09:45:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 048FE88846 for ; Thu, 27 Jul 2017 09:45:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5t90H_ERsuXe for ; Thu, 27 Jul 2017 09:45:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.142]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 8DDC988841 for ; Thu, 27 Jul 2017 09:45:42 +0000 (UTC) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3xJ6Xy4cjTz10Hx; Thu, 27 Jul 2017 11:45:38 +0200 (CEST) Authentication-Results: mail.embedded.rocks (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=embedded.rocks DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embedded.rocks; h=content-transfer-encoding:content-type:content-type :mime-version:references:in-reply-to:x-mailer:message-id:date :date:subject:subject:from:from:received:received; s=default; t= 1501148737; x=1501753538; bh=jEcg5yWw9UpfNYP9KUKQ4Kzl8e8gu0QE7xy 83Cjhbzs=; b=Hm/V2lEWiXN5InaIrGLALS1/UZLVoc/yRdUc+TLm/DIUQADGbE0 V7pUtQnqFwlvuq68hHJF1I/6eQdadSJ3yG1T3dkQpt9/VvFFVYLdbZC+w07TWeRL lL0uQ+9ysw1TSy9dulnVrlcFNiajAjQ9Jvb2aqMqRei7yQVDtpdpVnhnBwxD+BTN 4GHlZHjIC+h7ZT/DqJELeeKWJqpmOekY5Po3Wr1FDGJvR+bckv1ioIXHmGfzSnY2 f35NPb/rdsNGkqR7UJL61YmhHPtjQuY2r7PX2c/6gL0Zt6dGBd/TYhdSDGikx6Gp QXxXPvqL4vksglNUSjkUJ9C85qJ84dJXI0Q== Received: from mail.embedded.rocks ([127.0.0.1]) by localhost (mail.embedded.rocks [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id XhlJQbt1jnX5; Thu, 27 Jul 2017 11:45:37 +0200 (CEST) Received: from nzxt.fritz.box (port-92-195-2-6.dynamic.qsc.de [92.195.2.6]) (Authenticated sender: joerg.krause@embedded.rocks) by mail.embedded.rocks (Postfix) with ESMTPSA; Thu, 27 Jul 2017 11:45:37 +0200 (CEST) From: =?UTF-8?q?J=C3=B6rg=20Krause?= To: buildroot@buildroot.org Date: Thu, 27 Jul 2017 11:45:27 +0200 Message-Id: <20170727094528.10745-3-joerg.krause@embedded.rocks> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170727094528.10745-1-joerg.krause@embedded.rocks> References: <20170727094528.10745-1-joerg.krause@embedded.rocks> MIME-Version: 1.0 Cc: Eric Le Bihan , "Yann E . MORIN" Subject: [Buildroot] [PATCH v2 2/3] docs/manual: document meson-based packages X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Eric Le Bihan Add instructions for adding a package which uses the Meson build system. Signed-off-by: Eric Le Bihan [Jörg Krause: * use one-liner for buildtype] Signed-off-by: Jörg Krause --- docs/manual/adding-packages-meson.txt | 80 +++++++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 82 insertions(+) create mode 100644 docs/manual/adding-packages-meson.txt diff --git a/docs/manual/adding-packages-meson.txt b/docs/manual/adding-packages-meson.txt new file mode 100644 index 0000000000..697f2520c7 --- /dev/null +++ b/docs/manual/adding-packages-meson.txt @@ -0,0 +1,80 @@ +// -*- mode:doc; -*- +// vim: set syntax=asciidoc: + +=== Integration of Meson-based packages + +[[meson-package-tutorial]] + +==== +meson-package+ tutorial + +http://mesonbuild.com[Meson] is an open source build system meant to be both +extremely fast, and, even more importantly, as user friendly as possible. + +Buildroot does not (yet) provide a dedicated package infrastructure for +meson-based packages. So, we will explain how to write a +.mk+ file for such a +package. Let's start with an example: + +------------------------------ +01: ################################################################################ +02: # +03: # foo +04: # +05: ################################################################################ +06: +07: FOO_VERSION = 1.0 +08: FOO_SOURCE = foo-$(FOO_VERSION).tar.gz +09: FOO_SITE = http://www.foosoftware.org/download +10: FOO_LICENSE = GPLv3+ +11: FOO_LICENSE_FILES = COPYING +12: +13: FOO_DEPENDENCIES = host-meson host-pkgconf bar +14: +15: FOO_MESON_OPTS += \ +16: --prefix=/usr \ +17: --buildtype $(if $(BR2_ENABLE_DEBUG),debug,release) \ +18: --cross-file $(HOST_DIR)/etc/meson/cross-compilation.conf +19: +20: define FOO_CONFIGURE_CMDS +21: rm -rf $(@D)/build +22: mkdir -p $(@D)/build +23: $(TARGET_MAKE_ENV) meson.py $(FOO_MESON_OPTS) $(@D) $(@D)/build +24: endef +25: +26: define FOO_BUILD_CMDS +27: $(TARGET_MAKE_ENV) ninja -C $(@D)/build +28: endef +29: +30: define FOO_INSTALL_TARGET_CMDS +31: $(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) ninja -C $(@D)/build install +32: endef +33: +34: $(eval $(generic-package)) +-------------------------------- + +The Makefile starts with the definition of the standard variables for package +declaration (lines 7 to 11). + +As seen in line 34, it is based on the +xref:generic-package-tutorial[+generic-package+ infrastructure]. So, it defines +the variables required by this particular infrastructure, where Meson and its +companion tool, Ninja, are invoked: + +* +FOO_CONFIGURE_CMDS+: the build directory required by Meson is created, and + Meson is invoked to generate the Ninja build file. The options required to + configure the cross-compilation of the package are passed via + +FOO_MESON_OPTS+. + +* +FOO_BUILD_CMDS+: Ninja is invoked to perform the build. + +* +FOO_INSTALL_TARGET_CMDS+: Ninja is invoked to install the files generated + during the build step. + +In order to have Meson available for the build, +FOO_DEPENDENCIES+ needs to +contain +host-meson+. In the example, +host-pkgconf+ and +bar+ are also +declared as dependencies because the Meson build file of +foo+ uses `pkg-config` +to determine the compilation flags and libraries of package +bar+. + +To sum it up, to add a new meson-based package, the Makefile example can be +copied verbatim then edited to replace all occurences of +FOO+ with the +uppercase name of the new package and update the values of the standard +variables. diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt index d577ff030e..e542124cf9 100644 --- a/docs/manual/adding-packages.txt +++ b/docs/manual/adding-packages.txt @@ -34,6 +34,8 @@ include::adding-packages-rebar.txt[] include::adding-packages-waf.txt[] +include::adding-packages-meson.txt[] + include::adding-packages-kernel-module.txt[] include::adding-packages-asciidoc.txt[]