From patchwork Fri Aug 3 20:16:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 953376 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="priCa1WG"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41hyxv4p5Hz9s3x for ; Sat, 4 Aug 2018 06:17:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 151072E015; Fri, 3 Aug 2018 20:17:04 +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 Hu65kYYQVsCz; Fri, 3 Aug 2018 20:17:02 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1C0682E0AD; Fri, 3 Aug 2018 20:17:02 +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 4D8001C1694 for ; Fri, 3 Aug 2018 20:17:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 45D7D877EB for ; Fri, 3 Aug 2018 20:17:01 +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 QmTY_2_58lMd for ; Fri, 3 Aug 2018 20:17:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by fraxinus.osuosl.org (Postfix) with ESMTPS id D135887179 for ; Fri, 3 Aug 2018 20:16:59 +0000 (UTC) Received: by mail-wr1-f47.google.com with SMTP id r16-v6so6440347wrt.11 for ; Fri, 03 Aug 2018 13:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ad4Ljnxyc1qIKD2h3/5HzBk3ZmOcD9JbdV7BNNNZatA=; b=priCa1WGgidYKtwOed8fA13LdoLQZrl6YdSn27cXROgptJ6aQSklC5oVfI1TBhLNzO RHVpsIj31rKLUHwZiqF4BUyWBsy+W15Y9XuLTwbf5FojTdDkOoVc6lCismpya75oGId8 IaKQYkwsAmoc3cUMNR0xm7GAOIJu0BNjhl3TcEmSx8jwAUwP8a2QPp4+HfnNI3AmlK4e DG9rhDl84An9P+l4myKRRq2tdlreXG4t0V8jTDEuzwL3xSr+pqmKWOTurFOCMO7x23HB 0KyGG/WmUySWUTN1KagIGO/naDg0q42OOBXrdNSN/qMDcsxY/OSCbBRyOlegcvyIoWzd nV/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Ad4Ljnxyc1qIKD2h3/5HzBk3ZmOcD9JbdV7BNNNZatA=; b=Q+Yv3f/u3ffCXLx06BF8Hd0epcXDzZHkiq8GK29mCgOr+o4FozdaI33wQ32xsIeBM9 3PI23ymLJ84pc5mLCO8ry5YXjhoNMakFFzkmGMVtzoXQrZIQlzZrlVmGfFPvSCH5/hUe d+U4zgqkcSoV10mkPUuLafEbnFHsefSU6seDwbWYLxMvnylVf/AF0vEJIqtdzaUNDHUb lN/Kl8IKplVTmKoQb56KmUqqRmHRsE77o9Z0yCMpwSF0toinOiMfTP6FyjuFozejq3qE upaTRqgm/vMO6tDUVbTJnviwXNfwk+qN7/pPG2XomIoxQEa4HaNTkGPsKCthHY/DnZRF kURQ== X-Gm-Message-State: AOUpUlGLy8o4g/MU7kU6JopKLibR/PnZE+6X/+CvShElPHAPP75IxSgO J0OY6V64NMKRC5aE5BwQNQXC9KJl X-Google-Smtp-Source: AAOMgpcJuvcxlaYkM9bvg5+xM4P2SMnw+H+Uky0ZN2U+GwnP0tPrPPmqcRABjUO0sR+FsTF5r4O8Zg== X-Received: by 2002:a5d:4f82:: with SMTP id d2-v6mr3465386wru.261.1533327418111; Fri, 03 Aug 2018 13:16:58 -0700 (PDT) Received: from scaer.bzh.lan (2a01cb0886107300a556795e0851f8aa.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:a556:795e:851:f8aa]) by smtp.gmail.com with ESMTPSA id e133-v6sm465823wma.33.2018.08.03.13.16.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 13:16:57 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Fri, 3 Aug 2018 22:16:54 +0200 Message-Id: <15ce2a326c94d0609cc2fe1d92707b691fa4fa3e.1533327111.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: Subject: [Buildroot] [PATCH 1/3 v3] core/pkg-kconfig: allow dependencies before configurators X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Some users of kconfig need some packages to be built before their kconfig infra be used. For example, the linux kernel, starting with 4.16, needs flex and bison to generate the parser code. Furthermore, starting with 4.18, it will also need the cross-compiler before parsing the kconfig stuff, because that calls the compiler to check its features. Currently, this is broken, even the flex/bison ones, even though they are listed, because there is no way to define dependencie that are guaranteed before the (visual) configurators. For example: $ make distclean $ make menuconfig --> enable the linux kernel, choose a defconfig, save, exit $ make linux-menuconfig [...] HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c /bin/sh: bison: command not found LEX scripts/kconfig/zconf.lex.c scripts/Makefile.lib:196: recipe for target 'scripts/kconfig/zconf.tab.c' failed make[3]: *** [scripts/kconfig/zconf.tab.c] Error 127 make[3]: *** Waiting for unfinished jobs.... /bin/sh: flex: command not found scripts/Makefile.lib:188: recipe for target 'scripts/kconfig/zconf.lex.c' failed make[3]: *** [scripts/kconfig/zconf.lex.c] Error 127 Makefile:528: recipe for target 'rpc_defconfig' failed make[2]: *** [rpc_defconfig] Error 2 linux/linux.mk:511: recipe for target '/home/ymorin/dev/buildroot/buildroot/output/build/linux-4.17.11/.config' failed make[1]: *** [/home/ymorin/dev/buildroot/buildroot/output/build/linux-4.17.11/.config] Error 2 Makefile:79: recipe for target '_all' failed make: *** [_all] Error 2 So, we introduce a new type of dependencies for kconfig-based packages, that are guaranteed to be built and installed before the (visual) configurators are called. Since those dependencies are phony targets and therefore always out of date, a normal dependency would cause the .config target to be rebuilt on each invocation of make. So we use an order-only pre-requisite, like is done for the patch dependency. Signed-off-by: "Yann E. MORIN" Cc: Arnout Vandecappelle Cc: Thomas Petazzoni Tested-by: Jan Kundrát --- docs/manual/adding-packages-kconfig.txt | 4 ++++ package/pkg-kconfig.mk | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/docs/manual/adding-packages-kconfig.txt b/docs/manual/adding-packages-kconfig.txt index d4d8630a79..982c1229ea 100644 --- a/docs/manual/adding-packages-kconfig.txt +++ b/docs/manual/adding-packages-kconfig.txt @@ -81,3 +81,7 @@ be set to suit the needs of the package under consideration: be well suited for all packages that use the standard kconfig infrastructure as inherited from the Linux kernel; some packages use a derivative of kconfig that use a different location. + +* +FOO_KCONFIG_DEPENDENCIES+: the list of packages (most probably, host + packages) that need to be built before this package's kconfig is + interpreted. Seldom used. By default, empty. diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk index 81bba5220c..d6c95b897e 100644 --- a/package/pkg-kconfig.mk +++ b/package/pkg-kconfig.mk @@ -41,6 +41,10 @@ endef define inner-kconfig-package +# Register the kconfig dependencies as regular dependencies, so that +# they are also accounted for in the generated graphs. +$(2)_DEPENDENCIES += $$($(2)_KCONFIG_DEPENDENCIES) + # Call the generic package infrastructure to generate the necessary # make targets. # Note: this must be done _before_ attempting to use $$($(2)_DIR) in a @@ -121,6 +125,11 @@ $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_F # it explicitly. It doesn't hurt to always have it though. $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $(1)-patch +# Some packages may need additional tools to be present by the time their +# kconfig structure is parsed (e.g. the linux kernel may need to call to +# the compiler to test its features). +$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES) + # In order to get a usable, consistent configuration, some fixup may be needed. # The exact rules are specified by the package .mk file. define $(2)_FIXUP_DOT_CONFIG