All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Martincoski <ricardo.martincoski@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 5/8] package/usb_modeswitch: avoid overriding variables
Date: Sun, 27 Jan 2019 16:59:40 -0200	[thread overview]
Message-ID: <20190127185943.1136-6-ricardo.martincoski@gmail.com> (raw)
In-Reply-To: <20190127185943.1136-1-ricardo.martincoski@gmail.com>

Overriding variables in packages recipes is an error-prone practice.

Current behavior of installing either only as a script or only as a
binary is intended, as describe in the commit log of "d3e4db4e34
usb_modeswitch: bump to version 1.2.6" from 2013.

Rewrite the code to keep the same behavior while replacing variable
override [1] by conditional assignments [2].

[1]
VAR = ...
if ...
VAR = ...

[2]
if ...
VAR = ...
else
VAR = ...

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
---
The output for below commands is the same in current master (f6843a75fe)
and after this patch:
$ make -s BR2_HAVE_DOT_CONFIG=y BR2_PACKAGE_TCL_SHLIB_ONLY=y printvars \
  VARS='USB_MODESWITCH_BUILD_TARGETS USB_MODESWITCH_INSTALL_TARGETS'
USB_MODESWITCH_BUILD_TARGETS=script
USB_MODESWITCH_INSTALL_TARGETS=install-script
$ make -s BR2_HAVE_DOT_CONFIG=y printvars \
  VARS='USB_MODESWITCH_BUILD_TARGETS USB_MODESWITCH_INSTALL_TARGETS'
USB_MODESWITCH_BUILD_TARGETS=static
USB_MODESWITCH_INSTALL_TARGETS=install-static
---
 package/usb_modeswitch/usb_modeswitch.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/usb_modeswitch/usb_modeswitch.mk b/package/usb_modeswitch/usb_modeswitch.mk
index 8b93e086e3..9832d3c808 100644
--- a/package/usb_modeswitch/usb_modeswitch.mk
+++ b/package/usb_modeswitch/usb_modeswitch.mk
@@ -1,38 +1,38 @@
 ################################################################################
 #
 # usb_modeswitch
 #
 ################################################################################
 
 USB_MODESWITCH_VERSION = 2.5.2
 USB_MODESWITCH_SOURCE = usb-modeswitch-$(USB_MODESWITCH_VERSION).tar.bz2
 USB_MODESWITCH_SITE = http://www.draisberghof.de/usb_modeswitch
 USB_MODESWITCH_DEPENDENCIES = libusb
 USB_MODESWITCH_LICENSE = GPL-2.0+
 USB_MODESWITCH_LICENSE_FILES = COPYING
 # Package does not build in parallel due to improper make rules
 USB_MODESWITCH_MAKE = $(MAKE1)
 
-USB_MODESWITCH_BUILD_TARGETS = static
-USB_MODESWITCH_INSTALL_TARGETS = install-static
-
 ifeq ($(BR2_PACKAGE_TCL)$(BR2_PACKAGE_TCL_SHLIB_ONLY),y)
 USB_MODESWITCH_DEPENDENCIES += tcl
 USB_MODESWITCH_BUILD_TARGETS = script
 USB_MODESWITCH_INSTALL_TARGETS = install-script
+else
+USB_MODESWITCH_BUILD_TARGETS = static
+USB_MODESWITCH_INSTALL_TARGETS = install-static
 endif
 
 # build system of embedded jimtcl doesn't use autotools, but does use
 # an old version of gnuconfig which doesn't know all the architectures
 # supported by Buildroot, so update config.guess / config.sub like we
 # do in pkg-autotools.mk
 USB_MODESWITCH_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
 
 define USB_MODESWITCH_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
 		$(if $(BR2_INSTALL_LIBSTDCPP),,CXX=false) \
 		CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE -Wall -I." \
 		JIM_CONFIGURE_OPTS="--host=$(GNU_TARGET_NAME) --build=$(GNU_HOST_NAME)" \
 		-C $(@D) $(USB_MODESWITCH_BUILD_TARGETS)
 endef
 
-- 
2.17.1

  parent reply	other threads:[~2019-01-27 18:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-27 18:59 [Buildroot] [PATCH 0/8] Detect and fix overridden variables in .mk files Ricardo Martincoski
2019-01-27 18:59 ` [Buildroot] [PATCH 1/8] package/s6-networking: fix dependency when libressl is enabled Ricardo Martincoski
2019-01-27 19:52   ` Thomas Petazzoni
2019-01-28  2:26     ` Ricardo Martincoski
2019-01-27 21:15   ` Peter Korsgaard
2019-01-29 21:56   ` Peter Korsgaard
2019-01-27 18:59 ` [Buildroot] [PATCH 2/8] package/sdl_sound: actually use the optional CONF_OPTS Ricardo Martincoski
2019-01-27 21:16   ` Peter Korsgaard
2019-01-29 21:57   ` Peter Korsgaard
2019-01-27 18:59 ` [Buildroot] [PATCH 3/8] Revert "avrdude: add license information" Ricardo Martincoski
2019-01-27 21:17   ` Peter Korsgaard
2019-01-29 21:59   ` Peter Korsgaard
2019-01-27 18:59 ` [Buildroot] [PATCH 4/8] package/usb_modeswitch: drop unicode space in comment Ricardo Martincoski
2019-01-27 21:19   ` Peter Korsgaard
2019-01-29 22:00   ` Peter Korsgaard
2019-01-27 18:59 ` Ricardo Martincoski [this message]
2019-01-27 21:28   ` [Buildroot] [PATCH 5/8] package/usb_modeswitch: avoid overriding variables Peter Korsgaard
2019-01-29 22:01   ` Peter Korsgaard
2019-01-27 18:59 ` [Buildroot] [PATCH 6/8] utils/check-package: allow to disable warning for a line Ricardo Martincoski
2019-01-28 17:16   ` Arnout Vandecappelle
2019-01-29 15:38   ` Peter Korsgaard
2019-01-27 18:59 ` [Buildroot] [PATCH 7/8] utils/check-package: handle ifdef/ifndef in .mk files Ricardo Martincoski
2019-01-28 17:07   ` Arnout Vandecappelle
2019-01-29 15:39   ` Peter Korsgaard
2019-01-27 18:59 ` [Buildroot] [PATCH 8/8] utils/check-package: warn about overridden variables Ricardo Martincoski
2019-02-04 15:15   ` Titouan Christophe
2019-02-05 19:25   ` Peter Korsgaard
2019-05-26  9:20   ` Yann E. MORIN
2019-05-26 11:05     ` Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190127185943.1136-6-ricardo.martincoski@gmail.com \
    --to=ricardo.martincoski@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.