diff options
-rw-r--r-- | src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java | 44 |
1 files changed, 29 insertions, 15 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 924bda3..571698d 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java @@ -38,7 +38,7 @@ public class NarGnuConfigureMojo extends AbstractGnuMojo { /** - * Skip running of autogen.sh. + * Skip running of autogen.sh (aka buildconf). * * @parameter expression="${nar.gnu.autogen.skip}" default-value="false" */ @@ -53,6 +53,8 @@ public class NarGnuConfigureMojo private static final String AUTOGEN = "autogen.sh"; + private static final String BUILDCONF = "buildconf"; + private static final String CONFIGURE = "configure"; public final void narExecute() @@ -79,22 +81,17 @@ public class NarGnuConfigureMojo throw new MojoExecutionException( "Failed to copy GNU sources", e ); } - File autogen = new File( targetDir, AUTOGEN ); - if ( !gnuConfigureSkip && !gnuAutogenSkip && autogen.exists() ) + if ( !gnuConfigureSkip && !gnuAutogenSkip ) { - getLog().info( "Running GNU " + AUTOGEN ); - - // fix missing config directory - File configDir = new File(targetDir, "config"); - if (!configDir.exists()) { - configDir.mkdirs(); - } - - NarUtil.makeExecutable( autogen, getLog() ); - int result = NarUtil.runCommand( "./" + autogen.getName(), null, targetDir, null, getLog() ); - if ( result != 0 ) + File autogen = new File( targetDir, AUTOGEN ); + File buildconf = new File( targetDir, BUILDCONF ); + if ( autogen.exists() ) { - throw new MojoExecutionException( "'" + AUTOGEN + "' errorcode: " + result ); + getLog().info( "Running GNU " + AUTOGEN ); + runAutogen(autogen, targetDir); + } else if ( buildconf.exists() ) { + getLog().info( "Running GNU " + BUILDCONF ); + runAutogen(buildconf, targetDir); } } @@ -113,4 +110,21 @@ public class NarGnuConfigureMojo } } } + + private void runAutogen(File autogen, File targetDir) + throws MojoExecutionException, MojoFailureException + { + // fix missing config directory + File configDir = new File(targetDir, "config"); + if (!configDir.exists()) { + configDir.mkdirs(); + } + + NarUtil.makeExecutable( autogen, getLog() ); + int result = NarUtil.runCommand( "./" + autogen.getName(), null, targetDir, null, getLog() ); + if ( result != 0 ) + { + throw new MojoExecutionException( "'" + autogen.getName() + "' errorcode: " + result ); + } + } } |