diff options
Diffstat (limited to 'qmake/generators/unix/unixmake.cpp')
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 80 |
1 files changed, 54 insertions, 26 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 948fd2b79c..adeb55af86 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -641,7 +641,7 @@ UnixMakefileGenerator::processPrlFiles() ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS"); if(!prl_libs.isEmpty()) { for(int prl = 0; prl < prl_libs.size(); ++prl) - l.insert(lit+prl+1, prl_libs.at(prl)); + l.insert(lit+prl+1, escapeFilePath(prl_libs.at(prl).toQString())); prl_libs.clear(); } } @@ -727,7 +727,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) if(t != "target" || project->first("TEMPLATE") == "subdirs") return QString(); - bool bundle = false; + enum { NoBundle, SolidBundle, SlicedBundle } bundle = NoBundle; const QString root = "$(INSTALL_ROOT)"; ProStringList &uninst = project->values(ProKey(t + ".uninstall")); QString ret, destdir = project->first("DESTDIR").toQString(); @@ -743,7 +743,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) const ProStringList &targets = project->values(ProKey(t + ".targets")); if(!project->isEmpty("QMAKE_BUNDLE")) { target = project->first("QMAKE_BUNDLE").toQString(); - bundle = true; + bundle = project->isActiveConfig("sliced_bundle") ? SlicedBundle : SolidBundle; } else if(project->first("TEMPLATE") == "app") { target = "$(QMAKE_TARGET)"; } else if(project->first("TEMPLATE") == "lib") { @@ -768,7 +768,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) uninst.append("-$(DEL_FILE) \"" + dst + "\""); } - if(!bundle && project->isActiveConfig("compile_libtool")) { + if (bundle == NoBundle && project->isActiveConfig("compile_libtool")) { QString src_targ = target; if(src_targ == "$(TARGET)") src_targ = "$(TARGETL)"; @@ -781,23 +781,36 @@ UnixMakefileGenerator::defaultInstall(const QString &t) QString src_targ = target; if(!destdir.isEmpty()) src_targ = Option::fixPathToTargetOS(destdir + target, false); - QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + target, FileFixifyAbsolute)); - if(bundle) { - if(!ret.isEmpty()) - ret += "\n\t"; - ret += "$(DEL_FILE) -r \"" + dst_targ + "\"\n\t"; + QString plain_targ = filePrefixRoot(root, fileFixify(targetdir + target, FileFixifyAbsolute)); + QString dst_targ = plain_targ; + if (bundle != NoBundle) { + QString suffix; + if (project->first("TEMPLATE") == "lib") + suffix = "/Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/$(TARGET)"; + else + suffix = "/" + project->first("QMAKE_BUNDLE_LOCATION") + "/$(QMAKE_TARGET)"; + dst_targ += suffix; + if (bundle == SolidBundle) { + if (!ret.isEmpty()) + ret += "\n\t"; + ret += "$(DEL_FILE) -r \"" + plain_targ + "\"\n\t"; + } else { + src_targ += suffix; + } } if(!ret.isEmpty()) ret += "\n\t"; QString copy_cmd("-"); - if (bundle) - copy_cmd += "$(INSTALL_DIR)"; - else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) - copy_cmd += "$(INSTALL_FILE)"; - else - copy_cmd += "$(INSTALL_PROGRAM)"; - copy_cmd += " \"" + src_targ + "\" \"" + dst_targ + "\""; + if (bundle == SolidBundle) { + copy_cmd += "$(INSTALL_DIR) \"" + src_targ + "\" \"" + plain_targ + "\""; + } else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) { + copy_cmd += "$(INSTALL_FILE) \"" + src_targ + "\" \"" + dst_targ + "\""; + } else { + if (bundle == SlicedBundle) + ret += mkdir_p_asstring("\"`dirname \"" + dst_targ + "\"`\"", false) + "\n\t"; + copy_cmd += "$(INSTALL_PROGRAM) \"" + src_targ + "\" \"" + dst_targ + "\""; + } if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && project->values(ProKey(t + ".CONFIG")).indexOf("fix_rpath") != -1) { if(!project->isEmpty("QMAKE_FIX_RPATH")) { @@ -819,21 +832,36 @@ UnixMakefileGenerator::defaultInstall(const QString &t) ret += QString("\n\t$(RANLIB) \"") + dst_targ + "\""; } else if(!project->isActiveConfig("debug") && !project->isActiveConfig("nostrip") && !project->isEmpty("QMAKE_STRIP")) { ret += "\n\t-$(STRIP)"; - if(project->first("TEMPLATE") == "lib" && !project->isEmpty("QMAKE_STRIPFLAGS_LIB")) - ret += " " + var("QMAKE_STRIPFLAGS_LIB"); - else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP")) - ret += " " + var("QMAKE_STRIPFLAGS_APP"); - if(bundle) - ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; - else - ret += " \"" + dst_targ + "\""; + if (project->first("TEMPLATE") == "lib") { + if (!project->isEmpty("QMAKE_STRIPFLAGS_LIB")) + ret += " " + var("QMAKE_STRIPFLAGS_LIB"); + } else if (project->first("TEMPLATE") == "app") { + if (!project->isEmpty("QMAKE_STRIPFLAGS_APP")) + ret += " " + var("QMAKE_STRIPFLAGS_APP"); + } + ret += " \"" + dst_targ + "\""; } if(!uninst.isEmpty()) uninst.append("\n\t"); - if(bundle) - uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); + if (bundle == SolidBundle) + uninst.append("-$(DEL_FILE) -r \"" + plain_targ + "\""); else uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); + if (bundle == SlicedBundle) { + int dstlen = project->first("DESTDIR").length(); + foreach (const ProString &src, project->values("QMAKE_BUNDLED_FILES")) { + QString file = unescapeFilePath(src.toQString()).mid(dstlen); + QString dst = filePrefixRoot(root, fileFixify(targetdir + file, FileFixifyAbsolute)); + if (!ret.isEmpty()) + ret += "\n\t"; + ret += mkdir_p_asstring("\"`dirname \"" + dst + "\"`\"", false) + "\n\t"; + ret += "-$(DEL_FILE) \"" + dst + "\"\n\t"; // Can't overwrite symlinks to directories + ret += "-$(INSTALL_DIR) " + src + " \"" + dst + "\""; // Use cp -R to copy symlinks + if (!uninst.isEmpty()) + uninst.append("\n\t"); + uninst.append("-$(DEL_FILE) \"" + dst + "\""); + } + } if(!links.isEmpty()) { for(int i = 0; i < links.size(); ++i) { if (target_mode == TARG_UNIX_MODE || target_mode == TARG_MAC_MODE) { |