From patchwork Sat Jul 9 13:49:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 646686 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rmt553CVkz9sCp for ; Sat, 9 Jul 2016 23:49:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 485B69326F; Sat, 9 Jul 2016 13:49:26 +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 81+pmbFg+VqH; Sat, 9 Jul 2016 13:49:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 44AE693292; Sat, 9 Jul 2016 13:49:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id A5EF51C213F for ; Sat, 9 Jul 2016 13:49:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A423189718 for ; Sat, 9 Jul 2016 13:49:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kVH6OptSMY9y for ; Sat, 9 Jul 2016 13:49:19 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by whitealder.osuosl.org (Postfix) with ESMTPS id CB93E88FB1 for ; Sat, 9 Jul 2016 13:49:18 +0000 (UTC) Received: from itchy.localdomain (unknown [82.227.241.205]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 099365FF77 for ; Sat, 9 Jul 2016 15:55:28 +0200 (CEST) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sat, 9 Jul 2016 15:49:07 +0200 Message-Id: <1468072147-17509-3-git-send-email-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1468072147-17509-1-git-send-email-eric.le.bihan.dev@free.fr> References: <1468072147-17509-1-git-send-email-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH 2/2] 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add instructions for adding a package which uses the Meson build system. Signed-off-by: Eric Le Bihan --- docs/manual/adding-packages-meson.txt | 84 +++++++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 86 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 0000000..85457b7 --- /dev/null +++ b/docs/manual/adding-packages-meson.txt @@ -0,0 +1,84 @@ +// -*- 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: ifeq ($(BR2_ENABLE_DEBUG),y) +16: FOO_MESON_MODE = debug +17: else +18: FOO_MESON_MODE = release +19: endif +20: +21: FOO_MESON_OPTS += \ +22: --prefix=/usr \ +23: --buildtype $(FOO_MESON_MODE) \ +24: --cross-file $(HOST_DIR)/etc/meson/cross-compilation.conf +25: +26: define FOO_CONFIGURE_CMDS +27: rm -rf $(@D)/build +28: mkdir -p $(@D)/build +29: $(TARGET_MAKE_ENV) meson.py $(FOO_MESON_OPTS) $(@D) $(@D)/build +30: endef +31: +32: define FOO_BUILD_CMDS +33: $(TARGET_MAKE_ENV) ninja -C $(@D)/build +34: endef +35: +36: define FOO_INSTALL_TARGET_CMDS +37: $(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) ninja -C $(@D)/build install +38: endef +39: +40: $(eval $(generic-package)) +-------------------------------- + +The Makefile starts with the definition of the standard variables for package +declaration (lines 7 to 11). + +As seen in line 40, 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 76f90c9..8b80a63 100644 --- a/docs/manual/adding-packages.txt +++ b/docs/manual/adding-packages.txt @@ -29,6 +29,8 @@ include::adding-packages-kconfig.txt[] include::adding-packages-rebar.txt[] +include::adding-packages-meson.txt[] + include::adding-packages-kernel-module.txt[] include::adding-packages-asciidoc.txt[]