import java.util.TreeSet;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DynamicAttribute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
import org.apache.tools.ant.types.resources.FileProvider;
import org.apache.tools.ant.types.selectors.SelectorUtils;
-public class CopyLibsTask extends Task
+public class CopyLibsTask extends Task implements DynamicAttribute
{
private static final HashMap<String,String> blacklist;
static {
- HashMap bl = new HashMap<String,String>();
- bl.put("libpcre.so", "libercp.so");
- blacklist = bl;
+ HashMap<String,String> bl = new HashMap<String,String>();
+ bl.put("libpcre.so", "libercp.so");
+ blacklist = bl;
}
private static BuildException buildException(Exception e)
String bl = blacklist.get(s);
if (bl != null)
- s = bl;
+ s = bl;
return s;
}
offs + name.length()));
}
if (!fix.equals(name.substring(0, fix.length()))) {
- fixups.add(new Range(offs, offs + fix.length(), fix.getBytes("US-ASCII")));
+ fixups.add(new Range(offs, offs + fix.length(), fix.getBytes("US-ASCII")));
}
}
return name;
protected File getDestName(File dest)
{
- File d = new File(dest, subdir);
+ File d = (subdir == null? dest : new File(dest, subdir));
File f = new File(d, destname);
return f;
}
break outer;
if (r > 0) {
if (rg.replacement == null)
- Arrays.fill(buf, 0, r, (byte)0);
+ Arrays.fill(buf, 0, r, (byte)0);
else
- System.arraycopy(rg.replacement, (int)(offs-rg.start), buf, 0, r);
+ System.arraycopy(rg.replacement, (int)(offs-rg.start), buf, 0, r);
os.write(buf, 0, r);
chunk -= r;
}
};
- protected File destDir = null; // The destination directory.
+ protected File destDir = null; // The destination directory.
protected Vector<ResourceCollection> rcs = new Vector<ResourceCollection>();
protected PatternSet patterns = new PatternSet();
protected String property = null;
+ protected Vector<String> rpath = new Vector<String>();
public void setTodir(File destDir)
{
this.destDir = destDir;
}
+ public void setDynamicAttribute(String name, String value)
+ {
+ if ("rpath-link".equals(name))
+ this.rpath.add(value);
+ else
+ throw new BuildException("copylibs doesn't support the \"" + name + "\" attribute");
+ }
+
public void addFileset(FileSet set)
{
add(set);
}
Integer m = new Integer(l.elf.header.e_machine);
Worker w = workers.get(m);
- if (w == null)
+ if (w == null) {
workers.put(m, (w = new Worker(m.intValue())));
+ w.addRpath(rpath);
+ }
w.addWork(l);
}
}