From c24fbdf515053cede0d4d4272552496503efc3e7 Mon Sep 17 00:00:00 2001 From: Raza Saqlain Date: Fri, 6 Oct 2017 06:43:57 -0700 Subject: [PATCH 1/2] * Allow gnuConfigureArgs to accept configure arguments with spaces. Currently, the arguments are split using space as a delimiter. With this change arguments containing spaces but specified within quotes are treated as a single argument. --- .../com/github/maven_nar/NarGnuConfigureMojo.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/maven_nar/NarGnuConfigureMojo.java b/src/main/java/com/github/maven_nar/NarGnuConfigureMojo.java index c4f09dd03..ef15f1331 100644 --- a/src/main/java/com/github/maven_nar/NarGnuConfigureMojo.java +++ b/src/main/java/com/github/maven_nar/NarGnuConfigureMojo.java @@ -21,6 +21,9 @@ import java.io.File; import java.io.IOException; +import java.util.List; +import java.util.ArrayList; +import java.util.regex.*; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -154,7 +157,14 @@ public final void narExecute() throws MojoExecutionException, MojoFailureExcepti // create the array to hold constant and additional args if (this.gnuConfigureArgs != null) { - final String[] a = this.gnuConfigureArgs.split(" "); + List list = new ArrayList(); + Matcher m = Pattern.compile("([^\"]\\S*|\".+?\")\\s*").matcher(this.gnuConfigureArgs); + // strip double quotes + while (m.find()) { + list.add(m.group(1).replace("\"", "")); + } + String[] a = new String[list.size()]; + a = list.toArray(a); args = new String[a.length + 2]; System.arraycopy(a, 0, args, 2, a.length); From b91fe1ea94dbcc5a4299f7d14cce3b54c4e2a385 Mon Sep 17 00:00:00 2001 From: Raza Saqlain Date: Wed, 7 Mar 2018 01:08:48 -0800 Subject: [PATCH 2/2] Test for configure arguments containing spaces. --- src/it/it0013-gnu-executable/pom.xml | 3 +++ src/it/it0013-gnu-executable/src/gnu/configure.ac | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/it/it0013-gnu-executable/pom.xml b/src/it/it0013-gnu-executable/pom.xml index 7573a8f70..15fa81b9e 100644 --- a/src/it/it0013-gnu-executable/pom.xml +++ b/src/it/it0013-gnu-executable/pom.xml @@ -57,6 +57,9 @@ true + + "--with-pkginfo=GNU Executable Integration Test" + diff --git a/src/it/it0013-gnu-executable/src/gnu/configure.ac b/src/it/it0013-gnu-executable/src/gnu/configure.ac index 97fc6b9ad..69ba0b51d 100644 --- a/src/it/it0013-gnu-executable/src/gnu/configure.ac +++ b/src/it/it0013-gnu-executable/src/gnu/configure.ac @@ -8,5 +8,14 @@ AM_INIT_AUTOMAKE AC_PROG_CC +AC_ARG_WITH(pkginfo, + AC_HELP_STRING([--with-pkginfo=PKG], + [Package information string]), + [case "$withval" in + (yes) AC_MSG_ERROR([package information not specified]) ;; + (*) PKG_INFO="$withval" ;; + esac]) +AC_SUBST(PKG_INFO) + AC_OUTPUT(Makefile src/Makefile)