From patchwork Sat Nov 9 18:55:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsOpbXkgUk9TRU4=?= X-Patchwork-Id: 1192476 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dmarc=none (p=none dis=none) header.from=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="R9XjO6zw"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 479RDC16cNz9sNH for ; Sun, 10 Nov 2019 05:55:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CB8BC85F9A; Sat, 9 Nov 2019 18:55:35 +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 4UBfStcZxQkI; Sat, 9 Nov 2019 18:55:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 322A885FA7; Sat, 9 Nov 2019 18:55:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id D5B501BF59C for ; Sat, 9 Nov 2019 18:55:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C8B2087C76 for ; Sat, 9 Nov 2019 18:55:28 +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 GulQze8-uC4p for ; Sat, 9 Nov 2019 18:55:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by hemlock.osuosl.org (Postfix) with ESMTPS id D800787C89 for ; Sat, 9 Nov 2019 18:55:25 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id i12so3588386wro.5 for ; Sat, 09 Nov 2019 10:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gUfNfq00xnrRa8ctSqQnNEScohAAMtrPr0w/NvvxL+8=; b=R9XjO6zwIVNGUsKLH6QZbjuQZaLqUu+OhePZqoXUHm7tHvp8RO7QaU8cTNpoj6k11E TQdxmTUnaOMtsJ9yUAqMvkswau166UpJmvhuQZUIzdd4WVfVf0wZAkf5CQzalMIrUfCp Ki+ul4L9yPbcYDuHSzN3t/3qxQD33hvFGSfjNytUc1JXwGgx6VME6iIZNDooRUyN9NM/ YZmMFyb7x1j8z9PpunLhkzMZ1Tgc9t98g9S5J7d+2RDVX5cb9AdxirEek0EgydBgpUBn fRfMvkE5T7grLETQQDKKoYf66Bbe83M3a4oS9pv6qyF88FLR/2YnWtCCcUum3Q6S72y8 EJ6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gUfNfq00xnrRa8ctSqQnNEScohAAMtrPr0w/NvvxL+8=; b=KKOwK3sHE/gnxkJ8OflH4XkSVUfMDCww+H0WwlSKBFyjma3bgp6y9T/kEUuRbVXF0a 8hWrX0JibsLvPA2fnTc/3mNDo3BSXXpC3YRlg0hQ3izJb42Tq2hIjvWlD8z6XuyZuuEh ZJ4DPtuYm8GQg4Jbilfm5B17uDQcWLEuL7NpZfreCat3i6drW1++UHe7gLIUosYA/aHH +tURZ6CWrO0wlW7krCBHYGLQXb6blwRc4biNyvJmMaX409X3zr7V7WZhVR0HQLbQY7bv xNTF0FQsff1HJ4q0ETwe2f4ufW86pTYVXP/Dk3djEac8jeE2pIBXPnHRjNwGCnfWM2Bp vI2g== X-Gm-Message-State: APjAAAWm8vlQq19As84rMZ1Mqmf89GWTRIHLBmKh/U5/TtaMhuoDC+0d 2CtCo/ANjB3r2HNQlbJc/017WDUx8w== X-Google-Smtp-Source: APXvYqxrV+X+ft8qSRw9eWdx88E2yL4tGfA6N22Ofw77NPnADfuyyJP8X0JSjSq+owdj7FOxaPYYTA== X-Received: by 2002:a5d:6a8c:: with SMTP id s12mr2585196wru.353.1573325723919; Sat, 09 Nov 2019 10:55:23 -0800 (PST) Received: from localhost.localdomain (2a02-8428-0351-c201-4ead-12d2-d337-cdfb.rev.sfr.net. [2a02:8428:351:c201:4ead:12d2:d337:cdfb]) by smtp.googlemail.com with ESMTPSA id 65sm18456520wrs.9.2019.11.09.10.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2019 10:55:23 -0800 (PST) From: =?utf-8?b?SsOpcsOpbXkgUm9zZW4=?= To: buildroot@buildroot.org Date: Sat, 9 Nov 2019 19:55:12 +0100 Message-Id: <20191109185512.24139-3-jeremy.rosen@smile.fr> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191109185512.24139-1-jeremy.rosen@smile.fr> References: <20191109185512.24139-1-jeremy.rosen@smile.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 2/2] Include makefiles from GLOBAL_PATCH_DIR X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?SsOpcsOpbXkgUm9zZW4=?= Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Including a file named .mk from the GLOBAL_PATCH_DIR allows a user to tweak a package provided by buildroot to his own need. * add a function to pkg-utils.mk to include makefiles from GLOBAL_PATCH_DIR * modify all pkg-* to use it as their first action Signed-off-by: Jérémy Rosen --- package/pkg-autotools.mk | 1 + package/pkg-cmake.mk | 1 + package/pkg-generic.mk | 8 ++++++-- package/pkg-golang.mk | 1 + package/pkg-kconfig.mk | 1 + package/pkg-kernel-module.mk | 1 + package/pkg-luarocks.mk | 1 + package/pkg-meson.mk | 1 + package/pkg-perl.mk | 1 + package/pkg-python.mk | 1 + package/pkg-rebar.mk | 1 + package/pkg-utils.mk | 19 +++++++++++++++++++ package/pkg-virtual.mk | 1 + package/pkg-waf.mk | 1 + 14 files changed, 37 insertions(+), 2 deletions(-) diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk index daa688dab6..b18ee4edf5 100644 --- a/package/pkg-autotools.mk +++ b/package/pkg-autotools.mk @@ -119,6 +119,7 @@ endef ################################################################################ define inner-autotools-package +$(call global-patchdir-include,$(1),$(2)) ifndef $(2)_LIBTOOL_PATCH ifdef $(3)_LIBTOOL_PATCH diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index 57bfea9be5..beb4af0b67 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -50,6 +50,7 @@ endif ################################################################################ define inner-cmake-package +$(call global-patchdir-include,$(1),$(2)) $(2)_CONF_ENV ?= $(2)_CONF_OPTS ?= diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 7d6fa08418..3de939f087 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -414,6 +414,10 @@ endef # undesired behavior occurs with respect to these variables and functions. # ################################################################################ +define intermediate-generic-package +$(call global-patchdir-include,$(1),$(2)) +$(call inner-generic-package,$(1),$(2),$(3),$(4)) +endef define inner-generic-package @@ -1126,8 +1130,8 @@ endef # inner-generic-package ################################################################################ # In the case of target packages, keep the package name "pkg" -generic-package = $(call inner-generic-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) +generic-package = $(call intermediate-generic-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) # In the case of host packages, turn the package name "pkg" into "host-pkg" -host-generic-package = $(call inner-generic-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host) +host-generic-package = $(call intermediate-generic-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host) # :mode=makefile: diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk index e47de17aba..916645c52d 100644 --- a/package/pkg-golang.mk +++ b/package/pkg-golang.mk @@ -55,6 +55,7 @@ GO_HOST_ENV = \ ################################################################################ define inner-golang-package +$(call global-patchdir-include,$(1),$(2)) $(2)_WORKSPACE ?= _gopath diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk index 86d7c14fdb..5e06adaa0d 100644 --- a/package/pkg-kconfig.mk +++ b/package/pkg-kconfig.mk @@ -77,6 +77,7 @@ endef ################################################################################ define inner-kconfig-package +$(call global-patchdir-include,$(1),$(2)) # Register the kconfig dependencies as regular dependencies, so that # they are also accounted for in the generated graphs. diff --git a/package/pkg-kernel-module.mk b/package/pkg-kernel-module.mk index fcd6b8bc29..b9e211aac1 100644 --- a/package/pkg-kernel-module.mk +++ b/package/pkg-kernel-module.mk @@ -43,6 +43,7 @@ ################################################################################ define inner-kernel-module +$(call global-patchdir-include,$(1),$(2)) # If the package is enabled, ensure the kernel will support modules ifeq ($$(BR2_PACKAGE_$(2)),y) diff --git a/package/pkg-luarocks.mk b/package/pkg-luarocks.mk index 78d6c325f8..9a2b508532 100644 --- a/package/pkg-luarocks.mk +++ b/package/pkg-luarocks.mk @@ -32,6 +32,7 @@ ################################################################################ define inner-luarocks-package +$(call global-patchdir-include,$(1),$(2)) $(2)_BUILD_OPTS ?= $(2)_NAME_UPSTREAM ?= $(1) diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index e7eea2aa58..a6fe8ec71a 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -44,6 +44,7 @@ NINJA_OPTS = $(if $(VERBOSE),-v) -j$(PARALLEL_JOBS) ################################################################################ define inner-meson-package +$(call global-patchdir-include,$(1),$(2)) $(2)_CONF_ENV ?= $(2)_CONF_OPTS ?= diff --git a/package/pkg-perl.mk b/package/pkg-perl.mk index 1ecf31eff9..88cc00c5f6 100644 --- a/package/pkg-perl.mk +++ b/package/pkg-perl.mk @@ -38,6 +38,7 @@ PERL_RUN = PERL5LIB= PERL_USE_UNSAFE_INC=1 $(HOST_DIR)/bin/perl ################################################################################ define inner-perl-package +$(call global-patchdir-include,$(1),$(2)) # Target packages need both the perl interpreter on the target (for # runtime) and the perl interpreter on the host (for diff --git a/package/pkg-python.mk b/package/pkg-python.mk index be1ce071df..26391e09ba 100644 --- a/package/pkg-python.mk +++ b/package/pkg-python.mk @@ -104,6 +104,7 @@ HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \ ################################################################################ define inner-python-package +$(call global-patchdir-include,$(1),$(2)) $(2)_ENV ?= $(2)_BUILD_OPTS ?= diff --git a/package/pkg-rebar.mk b/package/pkg-rebar.mk index e4e3f3bb6c..282f7e600f 100644 --- a/package/pkg-rebar.mk +++ b/package/pkg-rebar.mk @@ -118,6 +118,7 @@ endef ################################################################################ define inner-rebar-package +$(call global-patchdir-include,$(1),$(2)) # Extract just the raw package name, lowercase without the leading # erlang- or host- prefix, as this is used by rebar to find the diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index ebab55a0fd..16128b40a9 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -175,3 +175,22 @@ legal-deps = \ $(filter-out $(if $(1:host-%=),host-%),\ $(call non-virtual-deps,\ $($(call UPPERCASE,$(1))_FINAL_RECURSIVE_DEPENDENCIES))),$(p) [$($(call UPPERCASE,$(p))_LICENSE)]) +# Include a makefile from GLOBAL_PATCH_DIR +# This follows the namind and directory layout of GLOBAL_PATCH_DIR +# argument 1 is the lowercase package name +# argument 2 is the uppercase package name, including a HOST_ prefix +# for host packages +define global-patchdir-include +$(if $($(patsubst host-%,%,$(1))_EXTRA_PATCH_INCLUDED),,\ +$(foreach dir,$(addsuffix /$(patsubst host-%,%,$(1)),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))),\ + $(if $(wildcard $(dir)/$($(2)_VERSION)/$(1).smk),\ + include $(dir)/$($(2)_VERSION)/$(1).smk \ + ,$(if $(wildcard $(dir)/$(1).smk),\ + $(info avant $(pkgdir)) + include $(dir)/$(1).smk \ + $(info apres $(pkgdir)) + ))\ +) +$(eval $(patsubst host-%,%,$(1))_EXTRA_PATCH_INCLUDED = true) \ +) +endef diff --git a/package/pkg-virtual.mk b/package/pkg-virtual.mk index 05bd63eb18..c34834c884 100644 --- a/package/pkg-virtual.mk +++ b/package/pkg-virtual.mk @@ -33,6 +33,7 @@ # so it is not evaluated now, but as part of the generated make code. define inner-virtual-package +$(call global-patchdir-include,$(1),$(2)) # Ensure the virtual package has an implementation defined. ifeq ($$(BR2_PACKAGE_HAS_$(2)),y) diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk index a32d5dab33..05bd90e463 100644 --- a/package/pkg-waf.mk +++ b/package/pkg-waf.mk @@ -35,6 +35,7 @@ ################################################################################ define inner-waf-package +$(call global-patchdir-include,$(1),$(2)) # We need host-python to run waf $(2)_DEPENDENCIES += host-python