Patchwork [meta-browser,2/4] Add variable to contain extra command-line arguments

login
register
mail settings
Submitter dv
Date April 27, 2014, 11:21 a.m.
Message ID <1398597711-17825-3-git-send-email-dv@pseudoterminal.org>
Download mbox | patch
Permalink /patch/71099/
State New, archived
Headers show

Comments

dv - April 27, 2014, 11:21 a.m.
With this patch it becomes possible to add extra command line options to
the "chrome" call in /usr/bin/google-chrome script .

Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
---
 recipes-browser/chromium/chromium/google-chrome  | 9 +++++----
 recipes-browser/chromium/chromium_35.0.1883.0.bb | 7 +++++++
 2 files changed, 12 insertions(+), 4 deletions(-)
Otavio Salvador - April 28, 2014, 3:17 p.m.
Hello Carlos,

On Sun, Apr 27, 2014 at 8:21 AM, Carlos Rafael Giani
<dv@pseudoterminal.org> wrote:
> With this patch it becomes possible to add extra command line options to
> the "chrome" call in /usr/bin/google-chrome script .
>
> Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
...
> diff --git a/recipes-browser/chromium/chromium_35.0.1883.0.bb b/recipes-browser/chromium/chromium_35.0.1883.0.bb
> index 203474d..080282b 100644
> --- a/recipes-browser/chromium/chromium_35.0.1883.0.bb
> +++ b/recipes-browser/chromium/chromium_35.0.1883.0.bb
> @@ -33,6 +33,9 @@ EXTRA_OEGYP = " \
>  "
>  ARMFPABI_armv7a = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'arm_float_abi=hard', 'arm_float_abi=softfp', d)}"
>
> +CHROMIUM_EXTRA_ARGS = " \
> +"

CHROMIUM_EXTRA_ARGS ?= ""

>  export GYP_DEFINES="${ARMFPABI} release_extra_cflags='-Wno-error=unused-local-typedefs' sysroot=''"
>  do_configure() {
>         cd ${S}
> @@ -54,6 +57,10 @@ do_install() {
>         install -d ${D}${bindir}
>         install -m 0755 ${WORKDIR}/google-chrome ${D}${bindir}/
>
> +       # Add extra command line arguments to google-chrome script by modifying
> +       # the dummy "CHROME_EXTRA_ARGS" line
> +       sed -i "s/^CHROME_EXTRA_ARGS=\"\"/CHROME_EXTRA_ARGS=\"${CHROMIUM_EXTRA_ARGS}\"/" ${D}${bindir}/google-chrome

Nice!

Patch

diff --git a/recipes-browser/chromium/chromium/google-chrome b/recipes-browser/chromium/chromium/google-chrome
index 8ce400b..78f4a29 100644
--- a/recipes-browser/chromium/chromium/google-chrome
+++ b/recipes-browser/chromium/chromium/google-chrome
@@ -3,8 +3,9 @@ 
 export CHROME_DEVEL_SANDBOX=/usr/sbin/chrome-devel-sandbox
 export LD_LIBRARY_PATH=/usr/lib/chrome
 
-if [ "${USER}" = "root" ] ; then 
-	/usr/bin/chrome/chrome --user-data-dir=${HOME}/.chromium/ $@
-else
-	/usr/bin/chrome/chrome $@
+CHROME_EXTRA_ARGS=""
+if [ "${USER}" = "root" ] ; then
+	CHROME_EXTRA_ARGS="${CHROME_EXTRA_ARGS} --user-data-dir=${HOME}/.chromium/"
 fi
+
+/usr/bin/chrome/chrome ${CHROME_EXTRA_ARGS} $@
diff --git a/recipes-browser/chromium/chromium_35.0.1883.0.bb b/recipes-browser/chromium/chromium_35.0.1883.0.bb
index 203474d..080282b 100644
--- a/recipes-browser/chromium/chromium_35.0.1883.0.bb
+++ b/recipes-browser/chromium/chromium_35.0.1883.0.bb
@@ -33,6 +33,9 @@  EXTRA_OEGYP =	" \
 "
 ARMFPABI_armv7a = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'arm_float_abi=hard', 'arm_float_abi=softfp', d)}"
 
+CHROMIUM_EXTRA_ARGS = " \
+"
+
 export GYP_DEFINES="${ARMFPABI} release_extra_cflags='-Wno-error=unused-local-typedefs' sysroot=''"
 do_configure() {
 	cd ${S}
@@ -54,6 +57,10 @@  do_install() {
 	install -d ${D}${bindir}
 	install -m 0755 ${WORKDIR}/google-chrome ${D}${bindir}/
 
+	# Add extra command line arguments to google-chrome script by modifying
+	# the dummy "CHROME_EXTRA_ARGS" line
+	sed -i "s/^CHROME_EXTRA_ARGS=\"\"/CHROME_EXTRA_ARGS=\"${CHROMIUM_EXTRA_ARGS}\"/" ${D}${bindir}/google-chrome
+
 	install -d ${D}${datadir}/applications
 	install -m 0644 ${WORKDIR}/google-chrome.desktop ${D}${datadir}/applications/