summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-12-01 14:42:17 +0100
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-12-01 14:42:17 +0100
commitf724731d74a36e5324d2ef24ab1b10520256ddf4 (patch)
tree9a3b1e1627a916d464f3261669f13763c4a62ca4 /src/main
parent3d36be1293200ddf6d6eb266e2c468c0b750601b (diff)
downloadmaven-nar-plugin-f724731d74a36e5324d2ef24ab1b10520256ddf4.tar.gz
maven-nar-plugin-f724731d74a36e5324d2ef24ab1b10520256ddf4.tar.bz2
maven-nar-plugin-f724731d74a36e5324d2ef24ab1b10520256ddf4.tar.xz
maven-nar-plugin-f724731d74a36e5324d2ef24ab1b10520256ddf4.zip
Fixed NAR-16
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarManager.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUtil.java47
-rw-r--r--src/main/resources/org/apache/maven/plugin/nar/aol.properties20
3 files changed, 54 insertions, 15 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarManager.java b/src/main/java/org/apache/maven/plugin/nar/NarManager.java
index e5414b6..17ed990 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarManager.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarManager.java
@@ -412,6 +412,8 @@ public class NarManager
NarUtil.makeExecutable( new File( narLocation, "bin/"
+ NarUtil.replace( gpp, gcc, defaultAOL.toString() ) ), log );
}
+ // add link to versioned so files
+ NarUtil.makeLink(new File(narLocation, "lib/"+defaultAOL), log);
}
if ( linkerName.equals( gcc ) || linkerName.equals( gpp ) )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
index 654883a..93f938e 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
@@ -45,10 +45,11 @@ import org.codehaus.plexus.util.cli.Commandline;
public final class NarUtil
{
- private NarUtil() {
+ private NarUtil()
+ {
// never instantiate
}
-
+
private static Properties defaults;
public static Properties getDefaults()
@@ -207,6 +208,40 @@ public final class NarUtil
}
}
+ public static void makeLink( File file, final Log log )
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( !file.exists() )
+ {
+ return;
+ }
+
+ if ( file.isDirectory() )
+ {
+ File[] files = file.listFiles();
+ for ( int i = 0; i < files.length; i++ )
+ {
+ makeLink( files[i], log );
+ }
+ }
+ if ( file.isFile() && file.canRead() && file.canWrite() && !file.isHidden()
+ && file.getName().matches( ".*\\.so(\\.\\d+)+$" ) )
+ {
+ File sofile =
+ new File( file.getParent(), file.getName().substring( 0, file.getName().indexOf( ".so" ) + 3 ) );
+ if ( !sofile.exists() )
+ {
+ // ln -s lib.so.xx lib.so
+ int result = runCommand( "ln", new String[] { "-s", file.getName(), sofile.getPath() }, null, null, log );
+ if ( result != 0 )
+ {
+ throw new MojoExecutionException( "Failed to execute 'ln -s " + file.getName() + " "
+ + sofile.getPath() + "'" + " return code: \'" + result + "\'." );
+ }
+ }
+ }
+ }
+
/**
* Returns the Bcel Class corresponding to the given class filename
*
@@ -262,7 +297,7 @@ public final class NarUtil
{
final String escQ = "\\Q";
final String escE = "\\E";
-
+
int slashEIndex = s.indexOf( escE );
if ( slashEIndex == -1 )
{
@@ -520,6 +555,7 @@ public final class NarUtil
extends Thread
{
private InputStream is;
+
private TextStream ts;
private StreamGobbler( InputStream is, TextStream ts )
@@ -544,8 +580,9 @@ public final class NarUtil
{
// e.printStackTrace()
StackTraceElement[] stackTrace = e.getStackTrace();
- for (int i=0; i<stackTrace.length; i++) {
- ts.println( stackTrace[i].toString());
+ for ( int i = 0; i < stackTrace.length; i++ )
+ {
+ ts.println( stackTrace[i].toString() );
}
}
}
diff --git a/src/main/resources/org/apache/maven/plugin/nar/aol.properties b/src/main/resources/org/apache/maven/plugin/nar/aol.properties
index 68a1f08..3205107 100644
--- a/src/main/resources/org/apache/maven/plugin/nar/aol.properties
+++ b/src/main/resources/org/apache/maven/plugin/nar/aol.properties
@@ -162,14 +162,14 @@ i386.Linux.g++.java.runtimeDirectory=jre/lib/i386/client
i386.Linux.g++.lib.prefix=lib
i386.Linux.g++.shared.prefix=lib
i386.Linux.g++.static.extension=a
-i386.Linux.g++.shared.extension=so
+i386.Linux.g++.shared.extension=so*
i386.Linux.g++.plugin.extension=so
i386.Linux.g++.jni.extension=so
i386.Linux.g++.executable.extension=
# FIXME to be removed when NAR-6
i386.Linux.gcc.static.extension=a
-i386.Linux.gcc.shared.extension=so
+i386.Linux.gcc.shared.extension=so*
i386.Linux.gcc.plugin.extension=so
i386.Linux.gcc.jni.extension=so
@@ -202,7 +202,7 @@ i386.Linux.icc.java.runtimeDirectory=jre/lib/i386/client
i386.Linux.icc.lib.prefix=lib
i386.Linux.icc.shared.prefix=lib
i386.Linux.icc.static.extension=a
-i386.Linux.icc.shared.extension=so
+i386.Linux.icc.shared.extension=so*
i386.Linux.icc.plugin.extension=so
i386.Linux.icc.jni.extension=so
i386.Linux.icc.executable.extension=
@@ -235,7 +235,7 @@ i386.Linux.icpc.java.runtimeDirectory=jre/lib/i386/client
i386.Linux.icpc.lib.prefix=lib
i386.Linux.icpc.shared.prefix=lib
i386.Linux.icpc.static.extension=a
-i386.Linux.icpc.shared.extension=so
+i386.Linux.icpc.shared.extension=so*
i386.Linux.icpc.plugin.extension=so
i386.Linux.icpc.jni.extension=so
i386.Linux.icpc.executable.extension=
@@ -268,7 +268,7 @@ i386.Linux.ecc.java.runtimeDirectory=jre/lib/i386/client
i386.Linux.ecc.lib.prefix=lib
i386.Linux.ecc.shared.prefix=lib
i386.Linux.ecc.static.extension=a
-i386.Linux.ecc.shared.extension=so
+i386.Linux.ecc.shared.extension=so*
i386.Linux.ecc.plugin.extension=so
i386.Linux.ecc.jni.extension=so
i386.Linux.ecc.executable.extension=
@@ -301,7 +301,7 @@ i386.Linux.ecpc.java.runtimeDirectory=jre/lib/i386/client
i386.Linux.ecpc.lib.prefix=lib
i386.Linux.ecpc.shared.prefix=lib
i386.Linux.ecpc.static.extension=a
-i386.Linux.ecpc.shared.extension=so
+i386.Linux.ecpc.shared.extension=so*
i386.Linux.ecpc.plugin.extension=so
i386.Linux.ecpc.jni.extension=so
i386.Linux.ecpc.executable.extension=
@@ -335,14 +335,14 @@ amd64.Linux.g++.java.runtimeDirectory=jre/lib/amd64/server
amd64.Linux.g++.lib.prefix=lib
amd64.Linux.g++.shared.prefix=lib
amd64.Linux.g++.static.extension=a
-amd64.Linux.g++.shared.extension=so
+amd64.Linux.g++.shared.extension=so*
amd64.Linux.g++.plugin.extension=so
amd64.Linux.g++.jni.extension=so
amd64.Linux.g++.executable.extension=
# FIXME to be removed when NAR-6
amd64.Linux.gcc.static.extension=a
-amd64.Linux.gcc.shared.extension=so
+amd64.Linux.gcc.shared.extension=so*
amd64.Linux.gcc.plugin.extension=so
amd64.Linux.gcc.jni.extension=so
@@ -505,14 +505,14 @@ sparc.SunOS.CC.linker.systemLibs=pthread:shared
sparc.SunOS.CC.lib.prefix=lib
sparc.SunOS.CC.shared.prefix=lib
sparc.SunOS.CC.static.extension=a
-sparc.SunOS.CC.shared.extension=so
+sparc.SunOS.CC.shared.extension=so*
sparc.SunOS.CC.plugin.extension=so
sparc.SunOS.CC.jni.extension=so
sparc.SunOS.CC.executable.extension=
# FIXME to be removed when NAR-6
sparc.SunOS.cc.static.extension=a
-sparc.SunOS.cc.shared.extension=so
+sparc.SunOS.cc.shared.extension=so*
sparc.SunOS.cc.plugin.extension=so
sparc.SunOS.cc.jni.extension=so