From 286d10a763f9db3d240277b45ccb7020223e98b0 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 25 Feb 2010 16:02:27 -0500 Subject: Fix for GNU configure arguments --- .../maven/plugin/nar/NarGnuConfigureMojo.java | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java index 571698d..f2f8f20 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java @@ -21,6 +21,7 @@ package org.apache.maven.plugin.nar; import java.io.File; import java.io.IOException; +import java.util.Arrays; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -99,10 +100,31 @@ public class NarGnuConfigureMojo if ( !gnuConfigureSkip && configure.exists() ) { getLog().info( "Running GNU " + CONFIGURE ); + NarUtil.makeExecutable( configure, getLog() ); - int result = - NarUtil.runCommand( "./" + configure.getName(), new String[] { - "--prefix=" + getGnuAOLTargetDirectory().getAbsolutePath() }, targetDir, null, getLog() ); + String[] args = null; + + // create the array to hold constant and additional args + if ( gnuConfigureArgs != null ) + { + String[] a = gnuConfigureArgs.split( " " ); + args = new String[a.length + 2]; + for ( int i = 0; i < a.length; i++ ) + { + args[i+2] = a[i]; + } + } + else + { + args = new String[2]; + } + + //first 2 args are constant + args[0] = "./" + configure.getName(); + args[1] = "--prefix=" + getGnuAOLTargetDirectory().getAbsolutePath(); + + getLog().info( "args: " + Arrays.toString(args) ); + int result = NarUtil.runCommand( "sh", args, targetDir, null, getLog() ); if ( result != 0 ) { throw new MojoExecutionException( "'" + CONFIGURE + "' errorcode: " + result ); -- cgit v1.2.3