don't install mac bundles atomically
... as that causes debug+release installs to overwrite each other's postprocessed files. introduces CONFIG+=sliced_bundle, which instructs qmake to create file-by-file install commands. we don't know whether people are not putting files outside qmake's knowledge into the bundle build dir, so this mode is not necessarily backwards-compatible, and thus off by default. Task-number: QTBUG-28336 Change-Id: I23e90985ccd3311f0237ed61aadca6d7ed8325b7 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
9e4dcbac05
commit
c9568da969
@ -90,7 +90,7 @@ else: \
|
||||
# OS X and iOS frameworks
|
||||
mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
|
||||
#QMAKE_FRAMEWORK_VERSION = 4.0
|
||||
CONFIG += lib_bundle qt_framework
|
||||
CONFIG += lib_bundle sliced_bundle qt_framework
|
||||
!debug_and_release|if(build_all:CONFIG(release, debug|release)) {
|
||||
FRAMEWORK_HEADERS.version = Versions
|
||||
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
|
||||
|
@ -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")) {
|
||||
@ -818,27 +831,37 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
|
||||
if(!project->isEmpty("QMAKE_RANLIB"))
|
||||
ret += QString("\n\t$(RANLIB) \"") + dst_targ + "\"";
|
||||
} else if(!project->isActiveConfig("debug") && !project->isActiveConfig("nostrip") && !project->isEmpty("QMAKE_STRIP")) {
|
||||
QString suffix;
|
||||
ret += "\n\t-$(STRIP)";
|
||||
if (project->first("TEMPLATE") == "lib") {
|
||||
if (!project->isEmpty("QMAKE_STRIPFLAGS_LIB"))
|
||||
ret += " " + var("QMAKE_STRIPFLAGS_LIB");
|
||||
if (bundle)
|
||||
suffix = "/Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/$(TARGET)";
|
||||
} else if (project->first("TEMPLATE") == "app") {
|
||||
if (!project->isEmpty("QMAKE_STRIPFLAGS_APP"))
|
||||
ret += " " + var("QMAKE_STRIPFLAGS_APP");
|
||||
if (bundle)
|
||||
suffix = "/" + project->first("QMAKE_BUNDLE_LOCATION") + "/$(QMAKE_TARGET)";
|
||||
}
|
||||
ret += " \"" + dst_targ + suffix + "\"";
|
||||
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) {
|
||||
|
@ -118,6 +118,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
(!project->isActiveConfig("staticlib")))),
|
||||
src_incremental=false;
|
||||
|
||||
ProStringList &bundledFiles = project->values("QMAKE_BUNDLED_FILES");
|
||||
|
||||
t << "####### Compiler, tools and options\n\n";
|
||||
t << "CC = " << var("QMAKE_CC") << endl;
|
||||
t << "CXX = " << var("QMAKE_CXX") << endl;
|
||||
@ -555,6 +557,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << "\n\t" << var("QMAKE_POST_LINK");
|
||||
t << endl << endl;
|
||||
} else if(!project->isEmpty("QMAKE_BUNDLE")) {
|
||||
QString currentLink = destdir + "Versions/Current";
|
||||
bundledFiles << currentLink << destdir + "$(TARGET)";
|
||||
t << "\n\t"
|
||||
<< "-$(DEL_FILE) $(TARGET) $(TARGET0) $(DESTDIR)$(TARGET0)\n\t"
|
||||
<< var("QMAKE_LINK_SHLIB_CMD") << "\n\t"
|
||||
@ -563,9 +567,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
<< mkdir_p_asstring("\"`dirname $(DESTDIR)$(TARGET0)`\"", false) << "\n\t"
|
||||
<< varGlue("QMAKE_LN_SHLIB", "-", " ",
|
||||
" Versions/Current/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t"
|
||||
<< "-$(DEL_FILE) " << destdir << "Versions/Current\n\t"
|
||||
<< "-$(DEL_FILE) " << currentLink << "\n\t"
|
||||
<< varGlue("QMAKE_LN_SHLIB","-"," ", " " + project->first("QMAKE_FRAMEWORK_VERSION") +
|
||||
" " + destdir + "Versions/Current") << "\n\t";
|
||||
" " + currentLink) << "\n\t";
|
||||
if(!project->isEmpty("QMAKE_POST_LINK"))
|
||||
t << "\n\t" << var("QMAKE_POST_LINK");
|
||||
t << endl << endl;
|
||||
@ -703,6 +707,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
}
|
||||
if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) {
|
||||
ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE"));
|
||||
bundledFiles << resources;
|
||||
QString destdir = escapeFilePath(project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources");
|
||||
t << resources << ": \n\t";
|
||||
t << mkdir_p_asstring(destdir) << "\n\t";
|
||||
@ -712,6 +717,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
//copy the plist
|
||||
QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())),
|
||||
info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString());
|
||||
bundledFiles << info_plist_out;
|
||||
QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
|
||||
t << info_plist_out << ": \n\t";
|
||||
if(!destdir.isEmpty())
|
||||
@ -736,6 +742,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
if(!project->isEmpty("ICON")) {
|
||||
QString dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources/";
|
||||
const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1));
|
||||
bundledFiles << icon_path;
|
||||
t << icon_path << ": " << icon << "\n\t"
|
||||
<< mkdir_p_asstring(dir) << "\n\t"
|
||||
<< "@$(DEL_FILE) " << icon_path << "\n\t"
|
||||
@ -764,7 +771,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
if (!project->isEmpty(vkey)) {
|
||||
QString version = project->first(vkey) + "/" +
|
||||
project->first("QMAKE_FRAMEWORK_VERSION") + "/";
|
||||
t << Option::fixPathToLocalOS(path + project->first(pkey)) << ": \n\t"
|
||||
QString link = Option::fixPathToLocalOS(path + project->first(pkey));
|
||||
bundledFiles << link;
|
||||
t << link << ": \n\t"
|
||||
<< mkdir_p_asstring(path) << "\n\t"
|
||||
<< "@$(SYMLINK) " << version << project->first(pkey) << " " << path << endl;
|
||||
path += version;
|
||||
@ -778,6 +787,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
src = fn;
|
||||
src = escapeFilePath(src);
|
||||
const QString dst = escapeFilePath(path + Option::dir_sep + fileInfo(fn).fileName());
|
||||
bundledFiles << dst;
|
||||
t << dst << ": " << src << "\n\t"
|
||||
<< mkdir_p_asstring(path) << "\n\t";
|
||||
QFileInfo fi(fileInfo(fn));
|
||||
|
Loading…
Reference in New Issue
Block a user