diff --git a/package.xs b/package.xs
index 6c60d7d637ec8b0c69ce9fe6beaaf9b82c8486b7..9978fe30693147bce710bb14e4903a7a45f05278 100644 (file)
--- a/package.xs
+++ b/package.xs
function getLibs(prog)
{
- var suffix;
+ var suffix = prog.build.target.suffix;
- /* find a compatible suffix */
- if ("findSuffix" in prog.build.target) {
- suffix = prog.build.target.findSuffix(this);
+ var name = this.$name + ".a" + suffix;
+
+ /* Read LIBDIR variable */
+ var lib = java.lang.System.getenv("LIBDIR");
+
+ /* If NULL, default to "lib" folder */
+ if (lib == null)
+ {
+ lib = "./lib";
+ } else {
+ print ("\tSystem environment LIBDIR variable defined : " + lib);
+ }
+
+ /* Device types supported */
+ var deviceTypes = [
+ 'k2g',
+ 'omapl138',
+ 'c6657'
+ ];
+
+ /* Search for the supported devices (defined in config.bld) */
+ for each(var device in deviceTypes)
+ {
+ if (this.Settings.deviceType.equals(device))
+ {
+ lib = lib + "/" + device;
+ break;
+ }
}
- else {
- suffix = prog.build.target.suffix;
+
+ /* Get target folder, if applicable */
+ if ( java.lang.String(suffix).contains('66') )
+ lib = lib + "/c66";
+ else if ( java.lang.String(suffix).contains('674') )
+ lib = lib + "/c674";
+
+ var libProfiles = ["debug", "release"];
+ for each(var profile in libProfiles)
+ {
+ if (this.Settings.libProfile.equals(profile))
+ {
+ lib = lib + "/" + profile;
+ break;
+ }
}
- var name = this.$name + ".a" + suffix;
- var lib = "";
- lib = "lib/" + name;
+ /* Get library name with path */
+ lib = lib + "/" + name;
if (java.io.File(this.packageBase + lib).exists()) {
- return lib;
+ print ("\tLinking with library " + this.$name + ":" + lib);
+ return lib;
}
- /* could not find any library, throw exception */
- throw Error("Library not found: " + name);
+ /* Could not find any library, throw exception */
+ throw new Error("\tLibrary not found: " + this.packageBase + lib);
}
/*