var FileInfo = loadExtension("qbs.FileInfo");

function soname(product, outputFileName) {
    if (product.moduleProperty("qbs", "targetOS").contains("darwin")) {
        if (product.moduleProperty("bundle", "isBundle"))
            outputFileName = product.moduleProperty("bundle", "executablePath");
        var prefix = product.moduleProperty("cpp", "installNamePrefix");
        if (prefix)
            outputFileName = FileInfo.joinPaths(prefix, outputFileName);
        return outputFileName;
    }

    function majorVersion(version, defaultValue) {
        var n = parseInt(version, 10);
        return isNaN(n) ? defaultValue : n;
    }

    if (product.version) {
        var major = majorVersion(product.version);
        if (major) {
            return outputFileName.substr(0, outputFileName.length - product.version.length)
                    + major;
        }
    }
    return outputFileName;
}

var FileInfo = loadExtension("qbs.FileInfo");

function soname(product, outputFileName) {
    if (product.moduleProperty("qbs", "targetOS").contains("darwin")) {
        if (product.moduleProperty("bundle", "isBundle"))
            outputFileName = product.moduleProperty("bundle", "executablePath");
        var prefix = product.moduleProperty("cpp", "installNamePrefix");
        if (prefix)
            outputFileName = FileInfo.joinPaths(prefix, outputFileName);
        return outputFileName;
    }

    function majorVersion(version, defaultValue) {
        var n = parseInt(version, 10);
        return isNaN(n) ? defaultValue : n;
    }

    var version = product.moduleProperty("cpp", "internalVersion");
    if (version) {
        var major = majorVersion(version);
        if (major) {
            return outputFileName.substr(0, outputFileName.length - version.length)
                    + major;
        }
    }
    return outputFileName;
}

Fix soname generation on non-Darwin Unix platforms.
Fix soname generation on non-Darwin Unix platforms.

Change-Id: Ifc2d7edf883072067b76a51368ea3e89172cff94
Reviewed-by: Christian Kandeler <3aa99dcdd3f0cac61fb81c2a11771c0cc2497607@theqtcompany.com>
