diff options
53 files changed, 764 insertions, 210 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e613224..472c6ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -509,12 +509,6 @@ int main(void) { return 0; } elseif(CMAKE_SYSTEM_NAME STREQUAL "HP-UX") # Disable until it can be ported. set(CMAKE_USE_LIBUV 0) - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") - # Disable until it can be ported. - set(CMAKE_USE_LIBUV 0) - elseif(CMAKE_SYSTEM STREQUAL "SunOS-5.10") - # Disable until it can be ported. - set(CMAKE_USE_LIBUV 0) endif() endif() if(CMAKE_USE_LIBUV) diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index a3b6e6b..f31b0f8 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -45,6 +45,7 @@ Properties of Global Scope /prop_gbl/TARGET_SUPPORTS_SHARED_LIBS /prop_gbl/USE_FOLDERS /prop_gbl/XCODE_EMIT_EFFECTIVE_PLATFORM_NAME + /prop_gbl/XCODE_GENERATE_SCHEME .. _`Directory Properties`: diff --git a/Help/prop_gbl/XCODE_GENERATE_SCHEME.rst b/Help/prop_gbl/XCODE_GENERATE_SCHEME.rst new file mode 100644 index 0000000..be8b5b0 --- /dev/null +++ b/Help/prop_gbl/XCODE_GENERATE_SCHEME.rst @@ -0,0 +1,11 @@ +XCODE_GENERATE_SCHEME +--------------------- + +If enabled, the Xcode generator will generate schema files. Those are +are useful to invoke analyze, archive, build-for-testing and test +actions from the command line. + +.. note:: + + The Xcode Schema Generator is still experimental and subject to + change. diff --git a/Help/release/dev/cmake-xcode-schemes.rst b/Help/release/dev/cmake-xcode-schemes.rst new file mode 100644 index 0000000..27c19d7 --- /dev/null +++ b/Help/release/dev/cmake-xcode-schemes.rst @@ -0,0 +1,6 @@ +cmake-xcode-schemes +------------------- + +* The :generator:`Xcode` generator got the ability to create schema files. + This is still an experimental feature and can be activated by setting the + :prop_gbl:`XCODE_GENERATE_SCHEME` global property to a ``TRUE`` value. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 00781d6..97438e6 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1987,11 +1987,10 @@ function(_ep_add_download_command name) set(comment "Performing download step (${steps}) for '${name}'") _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}") endif() - list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake - COMMAND) + list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake) if (NOT no_extract) _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}") - list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake) + list(APPEND cmd COMMAND ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake) else () set_property(TARGET ${name} PROPERTY _EP_DOWNLOADED_FILE ${file}) endif () diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 3b49f72..76b98fc 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -639,6 +639,7 @@ if(APPLE) set(SRCS ${SRCS} cmXCodeObject.cxx cmXCode21Object.cxx + cmXCodeScheme.cxx cmGlobalXCodeGenerator.cxx cmGlobalXCodeGenerator.h cmLocalXCodeGenerator.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 13bd07b..f85bd64 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 8) -set(CMake_VERSION_PATCH 20170227) +set(CMake_VERSION_PATCH 20170301) #set(CMake_VERSION_RC 1) diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index eded883..e41850a 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -308,7 +308,8 @@ public: this->DataSymbols.insert(symbol); } else { if ( pSymbolTable->Type || - !(SectChar & IMAGE_SCN_MEM_READ)) { + !(SectChar & IMAGE_SCN_MEM_READ) || + (SectChar & IMAGE_SCN_MEM_EXECUTE)) { this->Symbols.insert(symbol); } else { // printf(" strange symbol: %s \n",symbol.c_str()); diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 2feedf3..c86f9c1 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -84,36 +84,68 @@ void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix) } } +static bool cmLibDirsLinked(std::string const& l, std::string const& r) +{ + // Compare the real paths of the two directories. + // Since our caller only changed the trailing component of each + // directory, the real paths can be the same only if at least one of + // the trailing components is a symlink. Use this as an optimization + // to avoid excessive realpath calls. + return (cmSystemTools::FileIsSymlink(l) || + cmSystemTools::FileIsSymlink(r)) && + cmSystemTools::GetRealPath(l) == cmSystemTools::GetRealPath(r); +} + void cmFindLibraryCommand::AddArchitecturePath( std::string const& dir, std::string::size_type start_pos, const char* suffix, bool fresh) { std::string::size_type pos = dir.find("lib/", start_pos); + if (pos != std::string::npos) { - std::string cur_dir = dir.substr(0, pos + 3); - - // Follow "lib<suffix>". - std::string next_dir = cur_dir + suffix; - if (cmSystemTools::FileIsDirectory(next_dir)) { - next_dir += dir.substr(pos + 3); - std::string::size_type next_pos = pos + 3 + strlen(suffix) + 1; - this->AddArchitecturePath(next_dir, next_pos, suffix); + // Check for "lib". + std::string lib = dir.substr(0, pos + 3); + bool use_lib = cmSystemTools::FileIsDirectory(lib); + + // Check for "lib<suffix>" and use it first. + std::string libX = lib + suffix; + bool use_libX = cmSystemTools::FileIsDirectory(libX); + + // Avoid copies of the same directory due to symlinks. + if (use_libX && use_lib && cmLibDirsLinked(libX, lib)) { + use_libX = false; } - // Follow "lib". - if (cmSystemTools::FileIsDirectory(cur_dir)) { + if (use_libX) { + libX += dir.substr(pos + 3); + std::string::size_type libX_pos = pos + 3 + strlen(suffix) + 1; + this->AddArchitecturePath(libX, libX_pos, suffix); + } + + if (use_lib) { this->AddArchitecturePath(dir, pos + 3 + 1, suffix, false); } } + if (fresh) { - // Check for <dir><suffix>/. - std::string cur_dir = dir + suffix + "/"; - if (cmSystemTools::FileIsDirectory(cur_dir)) { - this->SearchPaths.push_back(cur_dir); + // Check for the original unchanged path. + bool use_dir = cmSystemTools::FileIsDirectory(dir); + + // Check for <dir><suffix>/ and use it first. + std::string dirX = dir + suffix; + bool use_dirX = cmSystemTools::FileIsDirectory(dirX); + + // Avoid copies of the same directory due to symlinks. + if (use_dirX && use_dir && cmLibDirsLinked(dirX, dir)) { + use_dirX = false; + } + + if (use_dirX) { + dirX += "/"; + this->SearchPaths.push_back(dirX); } - // Now add the original unchanged path - if (cmSystemTools::FileIsDirectory(dir)) { + if (use_dir) { this->SearchPaths.push_back(dir); } } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 5815210..47d685d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -711,12 +711,18 @@ void cmGeneratorTarget::GetExternalObjects( IMPLEMENT_VISIT(ExternalObjects); } -void cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs, +void cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& headers, const std::string& config) const { - ResxData data; - IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData) - srcs = data.ExpectedResxHeaders; + HeadersCacheType::const_iterator it = this->ResxHeadersCache.find(config); + if (it == this->ResxHeadersCache.end()) { + ResxData data; + IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData) + it = this->ResxHeadersCache + .insert(std::make_pair(config, data.ExpectedResxHeaders)) + .first; + } + headers = it->second; } void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile const*>& srcs, @@ -748,9 +754,15 @@ void cmGeneratorTarget::GetCertificates(std::vector<cmSourceFile const*>& data, void cmGeneratorTarget::GetExpectedXamlHeaders(std::set<std::string>& headers, const std::string& config) const { - XamlData data; - IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) - headers = data.ExpectedXamlHeaders; + HeadersCacheType::const_iterator it = this->XamlHeadersCache.find(config); + if (it == this->XamlHeadersCache.end()) { + XamlData data; + IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) + it = this->XamlHeadersCache + .insert(std::make_pair(config, data.ExpectedXamlHeaders)) + .first; + } + headers = it->second; } void cmGeneratorTarget::GetExpectedXamlSources(std::set<std::string>& srcs, diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 689fbda..e72e0a6 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -739,6 +739,10 @@ private: bool ComputePDBOutputDir(const std::string& kind, const std::string& config, std::string& out) const; + typedef std::map<std::string, std::set<std::string> > HeadersCacheType; + mutable HeadersCacheType ResxHeadersCache; + mutable HeadersCacheType XamlHeadersCache; + public: const std::vector<const cmGeneratorTarget*>& GetLinkImplementationClosure( const std::string& config) const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5167205..d1b6130 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -28,6 +28,7 @@ #include "cmTarget.h" #include "cmXCode21Object.h" #include "cmXCodeObject.h" +#include "cmXCodeScheme.h" #include "cm_auto_ptr.hxx" #include "cmake.h" @@ -3337,6 +3338,15 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( return; } this->WriteXCodePBXProj(fout, root, generators); + + // Since the lowest available Xcode version for testing was 7.0, + // I'm setting this as a limit then + if (this->GetCMakeInstance()->GetState()->GetGlobalPropertyAsBool( + "XCODE_GENERATE_SCHEME") && + this->XcodeVersion >= 70) { + this->OutputXCodeSharedSchemes(xcodeDir, root); + } + this->ClearXCodeObjects(); // Since this call may have created new cache entries, save the cache: @@ -3345,6 +3355,24 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( root->GetBinaryDirectory()); } +void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes( + const std::string& xcProjDir, cmLocalGenerator* root) +{ + for (std::vector<cmXCodeObject*>::const_iterator i = + this->XCodeObjects.begin(); + i != this->XCodeObjects.end(); ++i) { + cmXCodeObject* obj = *i; + if (obj->GetType() == cmXCodeObject::OBJECT && + (obj->GetIsA() == cmXCodeObject::PBXNativeTarget || + obj->GetIsA() == cmXCodeObject::PBXAggregateTarget)) { + cmXCodeScheme schm(obj, this->CurrentConfigurationTypes, + this->XcodeVersion); + schm.WriteXCodeSharedScheme(xcProjDir, + root->GetCurrentSourceDirectory()); + } + } +} + void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator*, std::vector<cmLocalGenerator*>&) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 1aaf9c7..c9157b0 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -165,6 +165,9 @@ private: std::vector<cmLocalGenerator*>& generators); void OutputXCodeProject(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); + // Write shared scheme files for all the native targets + void OutputXCodeSharedSchemes(const std::string& xcProjDir, + cmLocalGenerator* root); void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string& fullpath, diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index b1cd889..23b666e 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -80,6 +80,13 @@ bool cmListFileParser::ParseFile() return false; } + if (bom == cmListFileLexer_BOM_Broken) { + cmListFileLexer_SetFileName(this->Lexer, CM_NULLPTR, CM_NULLPTR); + this->IssueFileOpenError("Error while reading Byte-Order-Mark. " + "File not seekable?"); + return false; + } + // Verify the Byte-Order-Mark, if any. if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) { cmListFileLexer_SetFileName(this->Lexer, CM_NULLPTR, CM_NULLPTR); diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c index 56559f6..44d0894 100644 --- a/Source/cmListFileLexer.c +++ b/Source/cmListFileLexer.c @@ -2559,11 +2559,15 @@ static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f) if (fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0) { return cmListFileLexer_BOM_UTF32LE; } - fsetpos(f, &p); + if (fsetpos(f, &p) != 0) { + return cmListFileLexer_BOM_Broken; + } return cmListFileLexer_BOM_UTF16LE; } } - rewind(f); + if (fseek(f, 0, SEEK_SET) != 0) { + return cmListFileLexer_BOM_Broken; + } return cmListFileLexer_BOM_None; } diff --git a/Source/cmListFileLexer.h b/Source/cmListFileLexer.h index c9fb6da..f243010a 100644 --- a/Source/cmListFileLexer.h +++ b/Source/cmListFileLexer.h @@ -32,6 +32,7 @@ struct cmListFileLexer_Token_s enum cmListFileLexer_BOM_e { cmListFileLexer_BOM_None, + cmListFileLexer_BOM_Broken, cmListFileLexer_BOM_UTF8, cmListFileLexer_BOM_UTF16BE, cmListFileLexer_BOM_UTF16LE, diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 80e494b..d2c9d73 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -308,7 +308,7 @@ void cmStateSnapshot::SetDefaultDefinitions() this->SetDefinition("CMAKE_HOST_UNIX", "1"); struct utsname uts_name; - if (uname(&uts_name) == 0) { + if (uname(&uts_name) >= 0) { this->SetDefinition("CMAKE_HOST_SYSTEM_NAME", uts_name.sysname); } #endif diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx new file mode 100644 index 0000000..3c8c0b7 --- /dev/null +++ b/Source/cmXCodeScheme.cxx @@ -0,0 +1,206 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmXCodeScheme.h" + +#include <iomanip> +#include <sstream> + +#include "cmGeneratedFileStream.h" +#include "cmGeneratorTarget.h" +#include "cmXMLSafe.h" + +cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, + const std::vector<std::string>& configList, + unsigned int xcVersion) + : TargetName(xcObj->GetTarget()->GetName()) + , TargetId(xcObj->GetId()) + , ConfigList(configList) + , XcodeVersion(xcVersion) +{ +} + +void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir, + const std::string sourceRoot) +{ + // Create shared scheme sub-directory tree + // + std::string xcodeSchemeDir = xcProjDir; + xcodeSchemeDir += "/xcshareddata/xcschemes"; + cmSystemTools::MakeDirectory(xcodeSchemeDir.c_str()); + + std::string xcodeSchemeFile = xcodeSchemeDir; + xcodeSchemeFile += "/"; + xcodeSchemeFile += this->TargetName; + xcodeSchemeFile += ".xcscheme"; + + cmGeneratedFileStream fout(xcodeSchemeFile.c_str()); + fout.SetCopyIfDifferent(true); + if (!fout) { + return; + } + + std::string xcProjRelDir = xcProjDir.substr(sourceRoot.size() + 1); + WriteXCodeXCScheme(fout, xcProjRelDir); +} + +void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout, + const std::string& xcProjDir) +{ + cmXMLWriter xout(fout); + xout.StartDocument(); + + xout.StartElement("Scheme"); + xout.BreakAttributes(); + xout.Attribute("LastUpgradeVersion", WriteVersionString()); + xout.Attribute("version", "1.3"); + + WriteBuildAction(xout, xcProjDir); + WriteTestAction(xout, FindConfiguration("Debug")); + WriteLaunchAction(xout, FindConfiguration("Debug"), xcProjDir); + WriteProfileAction(xout, FindConfiguration("Release")); + WriteAnalyzeAction(xout, FindConfiguration("Debug")); + WriteArchiveAction(xout, FindConfiguration("Release")); + + xout.EndElement(); +} + +void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout, + const std::string& xcProjDir) +{ + xout.StartElement("BuildAction"); + xout.BreakAttributes(); + xout.Attribute("parallelizeBuildables", "YES"); + xout.Attribute("buildImplicitDependencies", "YES"); + + xout.StartElement("BuildActionEntries"); + xout.StartElement("BuildActionEntry"); + xout.BreakAttributes(); + xout.Attribute("buildForTesting", "YES"); + xout.Attribute("buildForRunning", "YES"); + xout.Attribute("buildForProfiling", "YES"); + xout.Attribute("buildForArchiving", "YES"); + xout.Attribute("buildForAnalyzing", "YES"); + + xout.StartElement("BuildableReference"); + xout.BreakAttributes(); + xout.Attribute("BuildableIdentifier", "primary"); + xout.Attribute("BlueprintIdentifier", this->TargetId); + xout.Attribute("BuildableName", this->TargetName); + xout.Attribute("BlueprintName", this->TargetName); + xout.Attribute("ReferencedContainer", "container:" + xcProjDir); + xout.EndElement(); + + xout.EndElement(); // BuildActionEntry + xout.EndElement(); // BuildActionEntries + xout.EndElement(); // BuildAction +} + +void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout, + std::string configuration) +{ + xout.StartElement("TestAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.Attribute("selectedDebuggerIdentifier", + "Xcode.DebuggerFoundation.Debugger.LLDB"); + xout.Attribute("selectedLauncherIdentifier", + "Xcode.DebuggerFoundation.Launcher.LLDB"); + xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES"); + + xout.StartElement("Testables"); + xout.EndElement(); + + xout.StartElement("AdditionalOptions"); + xout.EndElement(); + + xout.EndElement(); // TestAction +} + +void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, + std::string configuration, + const std::string& xcProjDir) +{ + xout.StartElement("LaunchAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.Attribute("selectedDebuggerIdentifier", + "Xcode.DebuggerFoundation.Debugger.LLDB"); + xout.Attribute("selectedLauncherIdentifier", + "Xcode.DebuggerFoundation.Launcher.LLDB"); + xout.Attribute("launchStyle", "0"); + xout.Attribute("useCustomWorkingDirectory", "NO"); + xout.Attribute("ignoresPersistentStateOnLaunch", "NO"); + xout.Attribute("debugDocumentVersioning", "YES"); + xout.Attribute("debugServiceExtension", "internal"); + xout.Attribute("allowLocationSimulation", "YES"); + + xout.StartElement("MacroExpansion"); + + xout.StartElement("BuildableReference"); + xout.BreakAttributes(); + xout.Attribute("BuildableIdentifier", "primary"); + xout.Attribute("BlueprintIdentifier", this->TargetId); + xout.Attribute("BuildableName", this->TargetName); + xout.Attribute("BlueprintName", this->TargetName); + xout.Attribute("ReferencedContainer", "container:" + xcProjDir); + xout.EndElement(); + + xout.EndElement(); // MacroExpansion + + xout.StartElement("AdditionalOptions"); + xout.EndElement(); + + xout.EndElement(); // LaunchAction +} + +void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout, + std::string configuration) +{ + xout.StartElement("ProfileAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES"); + xout.Attribute("savedToolIdentifier", ""); + xout.Attribute("useCustomWorkingDirectory", "NO"); + xout.Attribute("debugDocumentVersioning", "YES"); + xout.EndElement(); +} + +void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout, + std::string configuration) +{ + xout.StartElement("AnalyzeAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.EndElement(); +} + +void cmXCodeScheme::WriteArchiveAction(cmXMLWriter& xout, + std::string configuration) +{ + xout.StartElement("ArchiveAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.Attribute("revealArchiveInOrganizer", "YES"); + xout.EndElement(); +} + +std::string cmXCodeScheme::WriteVersionString() +{ + std::ostringstream v; + v << std::setfill('0') << std::setw(4) << this->XcodeVersion * 10; + return v.str(); +} + +std::string cmXCodeScheme::FindConfiguration(const std::string& name) +{ + // Try to find the desired configuration by name, + // and if it's not found return first from the list + // + if (std::find(this->ConfigList.begin(), this->ConfigList.end(), name) == + this->ConfigList.end() && + this->ConfigList.size() > 0) + return this->ConfigList[0]; + + return name; +} diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h new file mode 100644 index 0000000..b174c51 --- /dev/null +++ b/Source/cmXCodeScheme.h @@ -0,0 +1,46 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmXCodeScheme_h +#define cmXCodeScheme_h + +#include <cmConfigure.h> // IWYU pragma: keep + +#include "cmGlobalXCodeGenerator.h" +#include "cmSystemTools.h" +#include "cmXCodeObject.h" +#include "cmXMLWriter.h" + +/** \class cmXCodeScheme + * \brief Write shared schemes for native targets in Xcode project. + */ +class cmXCodeScheme +{ +public: + cmXCodeScheme(cmXCodeObject* xcObj, + const std::vector<std::string>& configList, + unsigned int xcVersion); + + void WriteXCodeSharedScheme(const std::string& xcProjDir, + const std::string sourceRoot); + +private: + const std::string& TargetName; + const std::string& TargetId; + const std::vector<std::string>& ConfigList; + const unsigned int XcodeVersion; + + void WriteXCodeXCScheme(std::ostream& fout, const std::string& xcProjDir); + + void WriteBuildAction(cmXMLWriter& xout, const std::string& xcProjDir); + void WriteTestAction(cmXMLWriter& xout, std::string configuration); + void WriteLaunchAction(cmXMLWriter& xout, std::string configuration, + const std::string& xcProjDir); + void WriteProfileAction(cmXMLWriter& xout, std::string configuration); + void WriteAnalyzeAction(cmXMLWriter& xout, std::string configuration); + void WriteArchiveAction(cmXMLWriter& xout, std::string configuration); + + std::string WriteVersionString(); + std::string FindConfiguration(const std::string& name); +}; + +#endif diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 72c20eb..6b73563 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -90,6 +90,16 @@ ExternalProject_Add(${proj} ) set_property(TARGET ${proj} PROPERTY FOLDER "") +set(proj NoExtractLogDownload) +ExternalProject_Add(${proj} + URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo.tgz + DOWNLOAD_NO_EXTRACT 1 + LOG_DOWNLOAD 1 + BUILD_COMMAND "" + CONFIGURE_COMMAND "" + INSTALL_COMMAND "" +) + # CVS-based tests: # diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 257c187..dc631c6 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -232,55 +232,56 @@ if (NOT QT_TEST_VERSION STREQUAL 4) endif() set(timeformat "%Y%j%H%M%S") - set(mocPluginBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin") - find_library(style_a_file "PluginStyleA" "${mocPluginBinDir}") - find_library(style_b_file "PluginStyleB" "${mocPluginBinDir}") - find_library(style_c_file "PluginStyleC" "${mocPluginBinDir}") - find_library(style_d_file "PluginStyleD" "${mocPluginBinDir}") - - file(TIMESTAMP "${style_a_file}" style_a_before "${timeformat}") - file(TIMESTAMP "${style_b_file}" style_b_before "${timeformat}") - file(TIMESTAMP "${style_c_file}" style_c_before "${timeformat}") - file(TIMESTAMP "${style_d_file}" style_d_before "${timeformat}") - - # Ensure that the timestamp will change and touch the json files + set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin") + set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin") + find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH) + find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH) + find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH) + find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH) + + file(TIMESTAMP "${plAFile}" plABefore "${timeformat}") + file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}") + file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}") + file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}") + + # Ensure that the timestamp will change and change the json files execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) - execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/StyleC.json") - execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/sub/StyleD.json") - execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPluginBinDir}") + configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json") + configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json") + execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}") - file(TIMESTAMP "${style_a_file}" style_a_after "${timeformat}") - file(TIMESTAMP "${style_b_file}" style_b_after "${timeformat}") - file(TIMESTAMP "${style_c_file}" style_c_after "${timeformat}") - file(TIMESTAMP "${style_d_file}" style_d_after "${timeformat}") + file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}") + file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}") + file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}") + file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}") - if (style_a_after GREATER style_a_before) - message(SEND_ERROR "file (${style_a_file}) should not have changed!") + if (plAAfter GREATER plABefore) + message(SEND_ERROR "file (${plAFile}) should not have changed!") endif() - if (style_b_after GREATER style_b_before) - message(SEND_ERROR "file (${style_b_file}) should not have changed!") + if (plBAfter GREATER plBBefore) + message(SEND_ERROR "file (${plBFile}) should not have changed!") endif() - if (NOT style_c_after GREATER style_c_before) - message(SEND_ERROR "file (${style_c_file}) should have changed!") + if (NOT plCAfter GREATER plCBefore) + message(SEND_ERROR "file (${plCFile}) should have changed!") endif() - if (NOT style_d_after GREATER style_d_before) - message(SEND_ERROR "file (${style_d_file}) should have changed!") + if (NOT plDAfter GREATER plDBefore) + message(SEND_ERROR "file (${plDFile}) should have changed!") endif() # Test custom macro - file(TIMESTAMP "${style_c_file}" style_c_before "${timeformat}") - file(TIMESTAMP "${style_d_file}" style_d_before "${timeformat}") + file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}") + file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}") execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) - execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/StyleC_Custom.json") - execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/sub/StyleD_Custom.json") - execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPluginBinDir}") - file(TIMESTAMP "${style_c_file}" style_c_after "${timeformat}") - file(TIMESTAMP "${style_d_file}" style_d_after "${timeformat}") - if (NOT style_c_after GREATER style_c_before) - message(SEND_ERROR "file (${style_c_file}) should have changed!") + configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json") + configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json") + execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}") + file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}") + file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}") + if (NOT plCAfter GREATER plCBefore) + message(SEND_ERROR "file (${plCFile}) should have changed!") endif() - if (NOT style_d_after GREATER style_d_before) - message(SEND_ERROR "file (${style_d_file}) should have changed!") + if (NOT plDAfter GREATER plDBefore) + message(SEND_ERROR "file (${plDFile}) should have changed!") endif() endif() diff --git a/Tests/QtAutogen/mocPlugin/CMakeLists.txt b/Tests/QtAutogen/mocPlugin/CMakeLists.txt index b72b05d..4843c21 100644 --- a/Tests/QtAutogen/mocPlugin/CMakeLists.txt +++ b/Tests/QtAutogen/mocPlugin/CMakeLists.txt @@ -25,8 +25,8 @@ set(CMAKE_AUTOMOC TRUE) include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles") link_libraries(Qt5::Widgets) -add_library(PluginStyleA MODULE StyleA.cpp) -add_library(PluginStyleB MODULE StyleB.cpp) -add_library(PluginStyleC MODULE StyleC.cpp) -add_library(PluginStyleD MODULE StyleD.cpp) -add_library(PluginStyleE MODULE StyleE.cpp) +add_library(PlugA STATIC StyleA.cpp) +add_library(PlugB STATIC StyleB.cpp) +add_library(PlugC STATIC StyleC.cpp) +add_library(PlugD STATIC StyleD.cpp) +add_library(PlugE STATIC StyleE.cpp) diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json index bf17580..119aaa4 100644 --- a/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json +++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json @@ -1 +1 @@ -{ "Keys": [ "Rocket", "StarbusterC" ] } +{ "Keys": [ "Boat", "Ship" ] } diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json index f7fcc19..732c547 100644 --- a/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json +++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json @@ -1 +1 @@ -{ "Keys": [ "Rocket", "StarbusterD" ] } +{ "Keys": [ "Bike", "Car" ] } diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake index d37e896..a550005 100644 --- a/Tests/RunCMake/AutoExportDll/AutoExport.cmake +++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake @@ -11,5 +11,11 @@ if(MSVC) set_target_properties(say PROPERTIES ENABLE_EXPORTS ON) add_library(autoexport_for_exec SHARED hello2.c) target_link_libraries(autoexport_for_exec say) + if(NOT MSVC_VERSION VERSION_LESS 1600) + enable_language(ASM_MASM) + target_sources(autoexport PRIVATE nop.asm) + set_property(SOURCE nop.asm PROPERTY COMPILE_FLAGS /safeseh) + target_compile_definitions(say PRIVATE HAS_JUSTNOP) + endif() endif() target_link_libraries(say autoexport autoexport2) diff --git a/Tests/RunCMake/AutoExportDll/nop.asm b/Tests/RunCMake/AutoExportDll/nop.asm new file mode 100644 index 0000000..fd6892f --- /dev/null +++ b/Tests/RunCMake/AutoExportDll/nop.asm @@ -0,0 +1,12 @@ +IFDEF RAX +ELSE +.MODEL FLAT,C +ENDIF + +SOME SEGMENT EXECUTE READ + +public justnop +justnop: + ret + +END diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx index e966b1f..51060e8 100644 --- a/Tests/RunCMake/AutoExportDll/say.cxx +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -12,6 +12,7 @@ int WINAPI foo(); // test regular C int bar(); int objlib(); +void justnop(); } // test c++ functions @@ -42,5 +43,8 @@ int main() bar(); objlib(); printf("\n"); +#ifdef HAS_JUSTNOP + justnop(); +#endif return 0; } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index bd92013..6423bfd 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -290,7 +290,7 @@ add_RunCMake_test(target_link_libraries) add_RunCMake_test(target_compile_features) add_RunCMake_test(CheckModules) -add_RunCMake_test(CommandLine) +add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(CommandLineTar) add_RunCMake_test(install) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 0c4f71c..b213ee2 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -1,3 +1,5 @@ +cmake_minimum_required(VERSION 3.1) + include(RunCMake) run_cmake_command(NoArgs ${CMAKE_COMMAND}) @@ -301,3 +303,14 @@ set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\") ) endfunction() run_cmake_depends() + +function(reject_fifo) + find_program(BASH_EXECUTABLE bash) + if(BASH_EXECUTABLE) + set(BASH_COMMAND_ARGUMENT "'${CMAKE_COMMAND}' -P <(echo 'return()')") + run_cmake_command(reject_fifo ${BASH_EXECUTABLE} -c ${BASH_COMMAND_ARGUMENT}) + endif() +endfunction() +if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") + reject_fifo() +endif() diff --git a/Tests/RunCMake/CommandLine/reject_fifo-result.txt b/Tests/RunCMake/CommandLine/reject_fifo-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/reject_fifo-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/reject_fifo-stderr.txt b/Tests/RunCMake/CommandLine/reject_fifo-stderr.txt new file mode 100644 index 0000000..7a335c3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/reject_fifo-stderr.txt @@ -0,0 +1,2 @@ +CMake Error in .* + Error while reading Byte-Order-Mark\. File not seekable\? diff --git a/Tests/RunCMake/find_library/LibArchLink-stderr.txt b/Tests/RunCMake/find_library/LibArchLink-stderr.txt new file mode 100644 index 0000000..139e077 --- /dev/null +++ b/Tests/RunCMake/find_library/LibArchLink-stderr.txt @@ -0,0 +1,2 @@ +TOP_LIBRARY='[^']*/Tests/RunCMake/find_library/LibArchLink-build/lib/libtop.a' +SUB_LIBRARY='[^']*/Tests/RunCMake/find_library/LibArchLink-build/lib/sub/libsub.a' diff --git a/Tests/RunCMake/find_library/LibArchLink.cmake b/Tests/RunCMake/find_library/LibArchLink.cmake new file mode 100644 index 0000000..c91381d --- /dev/null +++ b/Tests/RunCMake/find_library/LibArchLink.cmake @@ -0,0 +1,24 @@ +set(CMAKE_SIZEOF_VOID_P 4) +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON) +list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib) +list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lib ${CMAKE_CURRENT_BINARY_DIR}/lib32) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libtop.a" "top") +find_library(TOP_LIBRARY + NAMES top + PATHS ${CMAKE_CURRENT_BINARY_DIR}/lib + NO_DEFAULT_PATH + ) +message("TOP_LIBRARY='${TOP_LIBRARY}'") + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/sub) +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink . ${CMAKE_CURRENT_BINARY_DIR}/lib/sub/32) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/sub/libsub.a" "sub") +find_library(SUB_LIBRARY + NAMES sub + PATHS ${CMAKE_CURRENT_BINARY_DIR}/lib/sub + NO_DEFAULT_PATH + ) +message("SUB_LIBRARY='${SUB_LIBRARY}'") diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index 5733965..e7e8db3 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -1,6 +1,9 @@ include(RunCMake) run_cmake(Created) +if(CMAKE_HOST_UNIX) + run_cmake(LibArchLink) +endif() if(WIN32 OR CYGWIN) run_cmake(PrefixInPATH) endif() diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt index 4f6f37b..1bf93bb 100644 --- a/Utilities/KWIML/test/CMakeLists.txt +++ b/Utilities/KWIML/test/CMakeLists.txt @@ -10,7 +10,7 @@ endif() # Suppress printf/scanf format warnings; we test if the sizes match. foreach(lang C CXX) if(KWIML_LANGUAGE_${lang} AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") - set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format") + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format -Wno-format-security") endif() endforeach() diff --git a/Utilities/Scripts/update-libarchive.bash b/Utilities/Scripts/update-libarchive.bash index 6c4eeb0..41c6a66 100755 --- a/Utilities/Scripts/update-libarchive.bash +++ b/Utilities/Scripts/update-libarchive.bash @@ -8,7 +8,7 @@ readonly name="LibArchive" readonly ownership="LibArchive Upstream <libarchive-discuss@googlegroups.com>" readonly subtree="Utilities/cmlibarchive" readonly repo="https://github.com/libarchive/libarchive.git" -readonly tag="v3.3.0" +readonly tag="v3.3.1" readonly shortlog=false readonly paths=" CMakeLists.txt diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index 56811b6..bfe6b13 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -17,13 +17,13 @@ SET(CMAKE_MACOSX_RPATH ON) # FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version) STRING(REGEX REPLACE - "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]?$" "\\1" _major ${_version}) + "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]*$" "\\1" _major ${_version}) STRING(REGEX REPLACE - "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]?$" "\\1" _minor ${_version}) + "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]*$" "\\1" _minor ${_version}) STRING(REGEX REPLACE - "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]?$" "\\1" _revision ${_version}) + "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]*$" "\\1" _revision ${_version}) STRING(REGEX REPLACE - "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]?)$" "\\1" _quality ${_version}) + "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]*)$" "\\1" _quality ${_version}) SET(_version_number ${_major}${_minor}${_revision}) STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_minor ${_minor}) STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision}) @@ -415,6 +415,11 @@ LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H) LA_CHECK_INCLUDE_FILE("linux/types.h" HAVE_LINUX_TYPES_H) LA_CHECK_INCLUDE_FILE("linux/fiemap.h" HAVE_LINUX_FIEMAP_H) LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H) + +CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h> +#include <linux/fs.h> +int main(void) { return FS_IOC_GETFLAGS; }" HAVE_WORKING_FS_IOC_GETFLAGS) + LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H) LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H) LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) diff --git a/Utilities/cmlibarchive/build/cmake/config.h.in b/Utilities/cmlibarchive/build/cmake/config.h.in index fc248b3..55e04b9 100644 --- a/Utilities/cmlibarchive/build/cmake/config.h.in +++ b/Utilities/cmlibarchive/build/cmake/config.h.in @@ -1105,6 +1105,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have a working EXT2_IOC_GETFLAGS */ #cmakedefine HAVE_WORKING_EXT2_IOC_GETFLAGS 1 +/* Define to 1 if you have a working FS_IOC_GETFLAGS */ +#cmakedefine HAVE_WORKING_FS_IOC_GETFLAGS 1 + /* Define to 1 if you have the <zlib.h> header file. */ #cmakedefine HAVE_ZLIB_H 1 diff --git a/Utilities/cmlibarchive/build/version b/Utilities/cmlibarchive/build/version index a000b30..ef83457 100644 --- a/Utilities/cmlibarchive/build/version +++ b/Utilities/cmlibarchive/build/version @@ -1 +1 @@ -3003000 +3003001 diff --git a/Utilities/cmlibarchive/libarchive/archive.h b/Utilities/cmlibarchive/libarchive/archive.h index 040f151..cfb5c48 100644 --- a/Utilities/cmlibarchive/libarchive/archive.h +++ b/Utilities/cmlibarchive/libarchive/archive.h @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3003000 +#define ARCHIVE_VERSION_NUMBER 3003001 #include <sys/stat.h> #include <stddef.h> /* for wchar_t */ @@ -152,7 +152,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.3.0" +#define ARCHIVE_VERSION_ONLY_STRING "3.3.1" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); @@ -998,6 +998,10 @@ __LA_DECL int archive_read_disk_set_atime_restored(struct archive *); #define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008) /* Default: Xattrs are read from disk. */ #define ARCHIVE_READDISK_NO_XATTR (0x0010) +/* Default: ACLs are read from disk. */ +#define ARCHIVE_READDISK_NO_ACL (0x0020) +/* Default: File flags are read from disk. */ +#define ARCHIVE_READDISK_NO_FFLAGS (0x0040) __LA_DECL int archive_read_disk_set_behavior(struct archive *, int flags); diff --git a/Utilities/cmlibarchive/libarchive/archive_digest_private.h b/Utilities/cmlibarchive/libarchive/archive_digest_private.h index b58ffb3..b4fd6ca 100644 --- a/Utilities/cmlibarchive/libarchive/archive_digest_private.h +++ b/Utilities/cmlibarchive/libarchive/archive_digest_private.h @@ -143,6 +143,7 @@ defined(ARCHIVE_CRYPTO_SHA256_WIN) ||\ defined(ARCHIVE_CRYPTO_SHA384_WIN) ||\ defined(ARCHIVE_CRYPTO_SHA512_WIN) +#include <windows.h> #include <wincrypt.h> typedef struct { int valid; diff --git a/Utilities/cmlibarchive/libarchive/archive_entry.c b/Utilities/cmlibarchive/libarchive/archive_entry.c index d4f061b..10eff11 100644 --- a/Utilities/cmlibarchive/libarchive/archive_entry.c +++ b/Utilities/cmlibarchive/libarchive/archive_entry.c @@ -1649,7 +1649,10 @@ static struct flag { { "nosappnd", L"nosappnd", SF_APPEND, 0 }, { "nosappend", L"nosappend", SF_APPEND, 0 }, #endif -#ifdef EXT2_APPEND_FL /* 'a' */ +#if defined(FS_APPEND_FL) /* 'a' */ + { "nosappnd", L"nosappnd", FS_APPEND_FL, 0 }, + { "nosappend", L"nosappend", FS_APPEND_FL, 0 }, +#elif defined(EXT2_APPEND_FL) /* 'a' */ { "nosappnd", L"nosappnd", EXT2_APPEND_FL, 0 }, { "nosappend", L"nosappend", EXT2_APPEND_FL, 0 }, #endif @@ -1662,7 +1665,11 @@ static struct flag { { "noschange", L"noschange", SF_IMMUTABLE, 0 }, { "nosimmutable", L"nosimmutable", SF_IMMUTABLE, 0 }, #endif -#ifdef EXT2_IMMUTABLE_FL /* 'i' */ +#if defined(FS_IMMUTABLE_FL) /* 'i' */ + { "noschg", L"noschg", FS_IMMUTABLE_FL, 0 }, + { "noschange", L"noschange", FS_IMMUTABLE_FL, 0 }, + { "nosimmutable", L"nosimmutable", FS_IMMUTABLE_FL, 0 }, +#elif defined(EXT2_IMMUTABLE_FL) /* 'i' */ { "noschg", L"noschg", EXT2_IMMUTABLE_FL, 0 }, { "noschange", L"noschange", EXT2_IMMUTABLE_FL, 0 }, { "nosimmutable", L"nosimmutable", EXT2_IMMUTABLE_FL, 0 }, @@ -1686,7 +1693,9 @@ static struct flag { #ifdef UF_NODUMP { "nodump", L"nodump", 0, UF_NODUMP}, #endif -#ifdef EXT2_NODUMP_FL /* 'd' */ +#if defined(FS_NODUMP_FL) /* 'd' */ + { "nodump", L"nodump", 0, FS_NODUMP_FL}, +#elif defined(EXT2_NODUMP_FL) /* 'd' */ { "nodump", L"nodump", 0, EXT2_NODUMP_FL}, #endif #ifdef UF_OPAQUE @@ -1699,65 +1708,124 @@ static struct flag { #ifdef UF_COMPRESSED { "nocompressed",L"nocompressed", UF_COMPRESSED, 0 }, #endif -#ifdef EXT2_UNRM_FL +#if defined(FS_UNRM_FL) + { "nouunlink", L"nouunlink", FS_UNRM_FL, 0}, +#elif defined(EXT2_UNRM_FL) { "nouunlink", L"nouunlink", EXT2_UNRM_FL, 0}, #endif -#ifdef EXT2_BTREE_FL +#if defined(FS_BTREE_FL) + { "nobtree", L"nobtree", FS_BTREE_FL, 0 }, +#elif defined(EXT2_BTREE_FL) { "nobtree", L"nobtree", EXT2_BTREE_FL, 0 }, #endif -#ifdef EXT2_ECOMPR_FL +#if defined(FS_ECOMPR_FL) + { "nocomperr", L"nocomperr", FS_ECOMPR_FL, 0 }, +#elif defined(EXT2_ECOMPR_FL) { "nocomperr", L"nocomperr", EXT2_ECOMPR_FL, 0 }, #endif -#ifdef EXT2_COMPR_FL /* 'c' */ +#if defined(FS_COMPR_FL) /* 'c' */ + { "nocompress", L"nocompress", FS_COMPR_FL, 0 }, +#elif defined(EXT2_COMPR_FL) /* 'c' */ { "nocompress", L"nocompress", EXT2_COMPR_FL, 0 }, #endif -#ifdef EXT2_NOATIME_FL /* 'A' */ +#if defined(FS_NOATIME_FL) /* 'A' */ + { "noatime", L"noatime", 0, FS_NOATIME_FL}, +#elif defined(EXT2_NOATIME_FL) /* 'A' */ { "noatime", L"noatime", 0, EXT2_NOATIME_FL}, #endif -#ifdef EXT2_DIRTY_FL +#if defined(FS_DIRTY_FL) + { "nocompdirty",L"nocompdirty", FS_DIRTY_FL, 0}, +#elif defined(EXT2_DIRTY_FL) { "nocompdirty",L"nocompdirty", EXT2_DIRTY_FL, 0}, #endif -#ifdef EXT2_COMPRBLK_FL -#ifdef EXT2_NOCOMPR_FL +#if defined(FS_COMPRBLK_FL) +#if defined(FS_NOCOMPR_FL) + { "nocomprblk", L"nocomprblk", FS_COMPRBLK_FL, FS_NOCOMPR_FL}, +#else + { "nocomprblk", L"nocomprblk", FS_COMPRBLK_FL, 0}, +#endif +#elif defined(EXT2_COMPRBLK_FL) +#if defined(EXT2_NOCOMPR_FL) { "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, EXT2_NOCOMPR_FL}, #else { "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, 0}, #endif #endif -#ifdef EXT2_DIRSYNC_FL +#if defined(FS_DIRSYNC_FL) + { "nodirsync", L"nodirsync", FS_DIRSYNC_FL, 0}, +#elif defined(EXT2_DIRSYNC_FL) { "nodirsync", L"nodirsync", EXT2_DIRSYNC_FL, 0}, #endif -#ifdef EXT2_INDEX_FL +#if defined(FS_INDEX_FL) + { "nohashidx", L"nohashidx", FS_INDEX_FL, 0}, +#elif defined(EXT2_INDEX_FL) { "nohashidx", L"nohashidx", EXT2_INDEX_FL, 0}, #endif -#ifdef EXT2_IMAGIC_FL +#if defined(FS_IMAGIC_FL) + { "noimagic", L"noimagic", FS_IMAGIC_FL, 0}, +#elif defined(EXT2_IMAGIC_FL) { "noimagic", L"noimagic", EXT2_IMAGIC_FL, 0}, #endif -#ifdef EXT3_JOURNAL_DATA_FL +#if defined(FS_JOURNAL_DATA_FL) + { "nojournal", L"nojournal", FS_JOURNAL_DATA_FL, 0}, +#elif defined(EXT3_JOURNAL_DATA_FL) { "nojournal", L"nojournal", EXT3_JOURNAL_DATA_FL, 0}, #endif -#ifdef EXT2_SECRM_FL +#if defined(FS_SECRM_FL) + { "nosecuredeletion",L"nosecuredeletion",FS_SECRM_FL, 0}, +#elif defined(EXT2_SECRM_FL) { "nosecuredeletion",L"nosecuredeletion",EXT2_SECRM_FL, 0}, #endif -#ifdef EXT2_SYNC_FL +#if defined(FS_SYNC_FL) + { "nosync", L"nosync", FS_SYNC_FL, 0}, +#elif defined(EXT2_SYNC_FL) { "nosync", L"nosync", EXT2_SYNC_FL, 0}, #endif -#ifdef EXT2_NOTAIL_FL +#if defined(FS_NOTAIL_FL) + { "notail", L"notail", 0, FS_NOTAIL_FL}, +#elif defined(EXT2_NOTAIL_FL) { "notail", L"notail", 0, EXT2_NOTAIL_FL}, #endif -#ifdef EXT2_TOPDIR_FL +#if defined(FS_TOPDIR_FL) + { "notopdir", L"notopdir", FS_TOPDIR_FL, 0}, +#elif defined(EXT2_TOPDIR_FL) { "notopdir", L"notopdir", EXT2_TOPDIR_FL, 0}, #endif -#ifdef EXT2_RESERVED_FL +#ifdef FS_ENCRYPT_FL + { "noencrypt", L"noencrypt", FS_ENCRYPT_FL, 0}, +#endif +#ifdef FS_HUGE_FILE_FL + { "nohugefile", L"nohugefile", FS_HUGE_FILE_FL, 0}, +#endif +#ifdef FS_EXTENT_FL + { "noextent", L"noextent", FS_EXTENT_FL, 0}, +#endif +#ifdef FS_EA_INODE_FL + { "noeainode", L"noeainode", FS_EA_INODE_FL, 0}, +#endif +#ifdef FS_EOFBLOCKS_FL + { "noeofblocks",L"noeofblocks", FS_EOFBLOCKS_FL, 0}, +#endif +#ifdef FS_NOCOW_FL + { "nocow", L"nocow", FS_NOCOW_FL, 0}, +#endif +#ifdef FS_INLINE_DATA_FL + { "noinlinedata",L"noinlinedata", FS_INLINE_DATA_FL, 0}, +#endif +#ifdef FS_PROJINHERIT_FL + { "noprojinherit",L"noprojinherit", FS_PROJINHERIT_FL, 0}, +#endif +#if defined(FS_RESERVED_FL) + { "noreserved", L"noreserved", FS_RESERVED_FL, 0}, +#elif defined(EXT2_RESERVED_FL) { "noreserved", L"noreserved", EXT2_RESERVED_FL, 0}, #endif - { NULL, NULL, 0, 0 } }; diff --git a/Utilities/cmlibarchive/libarchive/archive_entry.h b/Utilities/cmlibarchive/libarchive/archive_entry.h index c331117..6e0225b 100644 --- a/Utilities/cmlibarchive/libarchive/archive_entry.h +++ b/Utilities/cmlibarchive/libarchive/archive_entry.h @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3003000 +#define ARCHIVE_VERSION_NUMBER 3003001 /* * Note: archive_entry.h is for use outside of libarchive; the diff --git a/Utilities/cmlibarchive/libarchive/archive_hmac.c b/Utilities/cmlibarchive/libarchive/archive_hmac.c index 1e0ae28..f299655 100644 --- a/Utilities/cmlibarchive/libarchive/archive_hmac.c +++ b/Utilities/cmlibarchive/libarchive/archive_hmac.c @@ -76,6 +76,10 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#ifndef BCRYPT_HASH_REUSABLE_FLAG +# define BCRYPT_HASH_REUSABLE_FLAG 0x00000020 +#endif + static int __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) { diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_entry_from_file.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_entry_from_file.c index 591a212..b2f1d17 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_disk_entry_from_file.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_entry_from_file.c @@ -203,15 +203,17 @@ archive_read_disk_entry_from_file(struct archive *_a, #ifdef HAVE_STRUCT_STAT_ST_FLAGS /* On FreeBSD, we get flags for free with the stat. */ /* TODO: Does this belong in copy_stat()? */ - if (st->st_flags != 0) + if ((a->flags & ARCHIVE_READDISK_NO_FFLAGS) == 0 && st->st_flags != 0) archive_entry_set_fflags(entry, st->st_flags, 0); #endif -#if defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS) +#if (defined(FS_IOC_GETFLAGS) && defined(HAVE_WORKING_FS_IOC_GETFLAGS)) || \ + (defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)) /* Linux requires an extra ioctl to pull the flags. Although * this is an extra step, it has a nice side-effect: We get an * open file descriptor which we can use in the subsequent lookups. */ - if ((S_ISREG(st->st_mode) || S_ISDIR(st->st_mode))) { + if ((a->flags & ARCHIVE_READDISK_NO_FFLAGS) == 0 && + (S_ISREG(st->st_mode) || S_ISDIR(st->st_mode))) { if (fd < 0) { if (a->tree != NULL) fd = a->open_on_current_dir(a->tree, path, @@ -223,7 +225,13 @@ archive_read_disk_entry_from_file(struct archive *_a, } if (fd >= 0) { int stflags; - r = ioctl(fd, EXT2_IOC_GETFLAGS, &stflags); + r = ioctl(fd, +#if defined(FS_IOC_GETFLAGS) + FS_IOC_GETFLAGS, +#else + EXT2_IOC_GETFLAGS, +#endif + &stflags); if (r == 0 && stflags != 0) archive_entry_set_fflags(entry, stflags, 0); } @@ -269,13 +277,15 @@ archive_read_disk_entry_from_file(struct archive *_a, } #endif /* HAVE_READLINK || HAVE_READLINKAT */ - r = setup_acls(a, entry, &fd); - if (!a->suppress_xattr) { + r = 0; + if ((a->flags & ARCHIVE_READDISK_NO_ACL) == 0) + r = setup_acls(a, entry, &fd); + if ((a->flags & ARCHIVE_READDISK_NO_XATTR) == 0) { r1 = setup_xattrs(a, entry, &fd); if (r1 < r) r = r1; } - if (a->enable_copyfile) { + if (a->flags & ARCHIVE_READDISK_MAC_COPYFILE) { r1 = setup_mac_metadata(a, entry, &fd); if (r1 < r) r = r1; diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c index b893704..6961ae6 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_posix.c @@ -465,8 +465,7 @@ archive_read_disk_new(void) a->entry = archive_entry_new2(&a->archive); a->lookup_uname = trivial_lookup_uname; a->lookup_gname = trivial_lookup_gname; - a->enable_copyfile = 1; - a->traverse_mount_points = 1; + a->flags = ARCHIVE_READDISK_MAC_COPYFILE; a->open_on_current_dir = open_on_current_dir; a->tree_current_dir_fd = tree_current_dir_fd; a->tree_enter_working_dir = tree_enter_working_dir; @@ -563,25 +562,19 @@ archive_read_disk_set_symlink_hybrid(struct archive *_a) int archive_read_disk_set_atime_restored(struct archive *_a) { -#ifndef HAVE_UTIMES - static int warning_done = 0; -#endif struct archive_read_disk *a = (struct archive_read_disk *)_a; archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_ANY, "archive_read_disk_restore_atime"); #ifdef HAVE_UTIMES - a->restore_time = 1; + a->flags |= ARCHIVE_READDISK_RESTORE_ATIME; if (a->tree != NULL) a->tree->flags |= needsRestoreTimes; return (ARCHIVE_OK); #else - if (warning_done) - /* Warning was already emitted; suppress further warnings. */ - return (ARCHIVE_OK); - + /* Display warning and unset flag */ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Cannot restore access time on this system"); - warning_done = 1; + a->flags &= ~ARCHIVE_READDISK_RESTORE_ATIME; return (ARCHIVE_WARN); #endif } @@ -595,29 +588,14 @@ archive_read_disk_set_behavior(struct archive *_a, int flags) archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_ANY, "archive_read_disk_honor_nodump"); + a->flags = flags; + if (flags & ARCHIVE_READDISK_RESTORE_ATIME) r = archive_read_disk_set_atime_restored(_a); else { - a->restore_time = 0; if (a->tree != NULL) a->tree->flags &= ~needsRestoreTimes; } - if (flags & ARCHIVE_READDISK_HONOR_NODUMP) - a->honor_nodump = 1; - else - a->honor_nodump = 0; - if (flags & ARCHIVE_READDISK_MAC_COPYFILE) - a->enable_copyfile = 1; - else - a->enable_copyfile = 0; - if (flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) - a->traverse_mount_points = 0; - else - a->traverse_mount_points = 1; - if (flags & ARCHIVE_READDISK_NO_XATTR) - a->suppress_xattr = 1; - else - a->suppress_xattr = 0; return (r); } @@ -918,7 +896,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, } while (lst == NULL); #ifdef __APPLE__ - if (a->enable_copyfile) { + if (a->flags & ARCHIVE_READDISK_MAC_COPYFILE) { /* If we're using copyfile(), ignore "._XXX" files. */ const char *bname = strrchr(tree_current_path(t), '/'); if (bname == NULL) @@ -989,7 +967,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, } if (t->initial_filesystem_id == -1) t->initial_filesystem_id = t->current_filesystem_id; - if (!a->traverse_mount_points) { + if (a->flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) { if (t->initial_filesystem_id != t->current_filesystem_id) descend = 0; } @@ -999,12 +977,14 @@ next_entry(struct archive_read_disk *a, struct tree *t, * Honor nodump flag. * If the file is marked with nodump flag, do not return this entry. */ - if (a->honor_nodump) { + if (a->flags & ARCHIVE_READDISK_HONOR_NODUMP) { #if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP) if (st->st_flags & UF_NODUMP) return (ARCHIVE_RETRY); -#elif defined(EXT2_IOC_GETFLAGS) && defined(EXT2_NODUMP_FL) &&\ - defined(HAVE_WORKING_EXT2_IOC_GETFLAGS) +#elif (defined(FS_IOC_GETFLAGS) && defined(FS_NODUMP_FL) && \ + defined(HAVE_WORKING_FS_IOC_GETFLAGS)) || \ + (defined(EXT2_IOC_GETFLAGS) && defined(EXT2_NODUMP_FL) && \ + defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)) if (S_ISREG(st->st_mode) || S_ISDIR(st->st_mode)) { int stflags; @@ -1013,9 +993,18 @@ next_entry(struct archive_read_disk *a, struct tree *t, O_RDONLY | O_NONBLOCK | O_CLOEXEC); __archive_ensure_cloexec_flag(t->entry_fd); if (t->entry_fd >= 0) { - r = ioctl(t->entry_fd, EXT2_IOC_GETFLAGS, + r = ioctl(t->entry_fd, +#ifdef FS_IOC_GETFLAGS + FS_IOC_GETFLAGS, +#else + EXT2_IOC_GETFLAGS, +#endif &stflags); +#ifdef FS_NODUMP_FL + if (r == 0 && (stflags & FS_NODUMP_FL) != 0) +#else if (r == 0 && (stflags & EXT2_NODUMP_FL) != 0) +#endif return (ARCHIVE_RETRY); } } @@ -1340,10 +1329,11 @@ _archive_read_disk_open(struct archive *_a, const char *pathname) struct archive_read_disk *a = (struct archive_read_disk *)_a; if (a->tree != NULL) - a->tree = tree_reopen(a->tree, pathname, a->restore_time); + a->tree = tree_reopen(a->tree, pathname, + a->flags & ARCHIVE_READDISK_RESTORE_ATIME); else a->tree = tree_open(pathname, a->symlink_mode, - a->restore_time); + a->flags & ARCHIVE_READDISK_RESTORE_ATIME); if (a->tree == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate tar data"); @@ -2132,7 +2122,7 @@ tree_open(const char *path, int symlink_mode, int restore_time) static struct tree * tree_reopen(struct tree *t, const char *path, int restore_time) { - t->flags = (restore_time)?needsRestoreTimes:0; + t->flags = (restore_time != 0)?needsRestoreTimes:0; t->flags |= onInitialDir; t->visit_type = 0; t->tree_errno = 0; diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_private.h b/Utilities/cmlibarchive/libarchive/archive_read_disk_private.h index 2569321..b5a8328 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_disk_private.h +++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_private.h @@ -63,16 +63,8 @@ struct archive_read_disk { int (*tree_current_dir_fd)(struct tree*); int (*tree_enter_working_dir)(struct tree*); - /* Set 1 if users request to restore atime . */ - int restore_time; - /* Set 1 if users request to honor nodump flag . */ - int honor_nodump; - /* Set 1 if users request to enable mac copyfile. */ - int enable_copyfile; - /* Set 1 if users request to traverse mount points. */ - int traverse_mount_points; - /* Set 1 if users want to suppress xattr information. */ - int suppress_xattr; + /* Bitfield with ARCHIVE_READDISK_* tunables */ + int flags; const char * (*lookup_gname)(void *private, int64_t gid); void (*cleanup_gname)(void *private); diff --git a/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c b/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c index 27b75e3..3b90330 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_disk_windows.c @@ -398,8 +398,7 @@ archive_read_disk_new(void) a->entry = archive_entry_new2(&a->archive); a->lookup_uname = trivial_lookup_uname; a->lookup_gname = trivial_lookup_gname; - a->enable_copyfile = 1; - a->traverse_mount_points = 1; + a->flags = ARCHIVE_READDISK_MAC_COPYFILE; return (&a->archive); } @@ -495,7 +494,7 @@ archive_read_disk_set_atime_restored(struct archive *_a) struct archive_read_disk *a = (struct archive_read_disk *)_a; archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_ANY, "archive_read_disk_restore_atime"); - a->restore_time = 1; + a->flags |= ARCHIVE_READDISK_RESTORE_ATIME; if (a->tree != NULL) a->tree->flags |= needsRestoreTimes; return (ARCHIVE_OK); @@ -510,25 +509,14 @@ archive_read_disk_set_behavior(struct archive *_a, int flags) archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_ANY, "archive_read_disk_honor_nodump"); + a->flags = flags; + if (flags & ARCHIVE_READDISK_RESTORE_ATIME) r = archive_read_disk_set_atime_restored(_a); else { - a->restore_time = 0; if (a->tree != NULL) a->tree->flags &= ~needsRestoreTimes; } - if (flags & ARCHIVE_READDISK_HONOR_NODUMP) - a->honor_nodump = 1; - else - a->honor_nodump = 0; - if (flags & ARCHIVE_READDISK_MAC_COPYFILE) - a->enable_copyfile = 1; - else - a->enable_copyfile = 0; - if (flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) - a->traverse_mount_points = 0; - else - a->traverse_mount_points = 1; return (r); } @@ -852,7 +840,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, } if (t->initial_filesystem_id == -1) t->initial_filesystem_id = t->current_filesystem_id; - if (!a->traverse_mount_points) { + if (a->flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) { if (t->initial_filesystem_id != t->current_filesystem_id) return (ARCHIVE_RETRY); } @@ -1219,9 +1207,11 @@ _archive_read_disk_open_w(struct archive *_a, const wchar_t *pathname) struct archive_read_disk *a = (struct archive_read_disk *)_a; if (a->tree != NULL) - a->tree = tree_reopen(a->tree, pathname, a->restore_time); + a->tree = tree_reopen(a->tree, pathname, + a->flags & ARCHIVE_READDISK_RESTORE_ATIME); else - a->tree = tree_open(pathname, a->symlink_mode, a->restore_time); + a->tree = tree_open(pathname, a->symlink_mode, + a->flags & ARCHIVE_READDISK_RESTORE_ATIME); if (a->tree == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate directory traversal data"); @@ -1519,7 +1509,7 @@ tree_reopen(struct tree *t, const wchar_t *path, int restore_time) struct archive_wstring ws; wchar_t *pathname, *p, *base; - t->flags = (restore_time)?needsRestoreTimes:0; + t->flags = (restore_time != 0)?needsRestoreTimes:0; t->visit_type = 0; t->tree_errno = 0; t->full_path_dir_length = 0; diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c index c3e86c0..b162465 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_warc.c @@ -531,10 +531,6 @@ time_from_tm(struct tm *t) #endif } -static int la_isblank(int c) { - return c == ' ' || c == '\t'; -} - static time_t xstrpisotime(const char *s, char **endptr) { @@ -547,7 +543,7 @@ xstrpisotime(const char *s, char **endptr) /* as a courtesy to our callers, and since this is a non-standard * routine, we skip leading whitespace */ - while (la_isblank((unsigned char)*s)) + while (*s == ' ' || *s == '\t') ++s; /* read year */ @@ -593,6 +589,7 @@ static unsigned int _warc_rdver(const char *buf, size_t bsz) { static const char magic[] = "WARC/"; + const char *c; unsigned int ver = 0U; unsigned int end = 0U; @@ -619,11 +616,12 @@ _warc_rdver(const char *buf, size_t bsz) * WARC below version 0.12 has a space-separated header * WARC 0.12 and above terminates the version with a CRLF */ + c = buf + 3U + end; if (ver >= 1200U) { - if (memcmp(buf + 3U + end, "\r\n", 2U) != 0) + if (memcmp(c, "\r\n", 2U) != 0) ver = 0U; } else if (ver < 1200U) { - if (!la_isblank(*(buf + 3U + end))) + if (*c != ' ' && *c != '\t') ver = 0U; } } @@ -647,7 +645,7 @@ _warc_rdtyp(const char *buf, size_t bsz) } /* overread whitespace */ - while (val < eol && la_isblank((unsigned char)*val)) + while (val < eol && (*val == ' ' || *val == '\t')) ++val; if (val + 8U == eol) { @@ -677,7 +675,7 @@ _warc_rduri(const char *buf, size_t bsz) return res; } - while (val < eol && la_isblank((unsigned char)*val)) + while (val < eol && (*val == ' ' || *val == '\t')) ++val; /* overread URL designators */ @@ -735,7 +733,7 @@ _warc_rdlen(const char *buf, size_t bsz) } /* skip leading whitespace */ - while (val < eol && la_isblank(*val)) + while (val < eol && (*val == ' ' || *val == '\t')) val++; /* there must be at least one digit */ if (!isdigit(*val)) diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c index 53629ac..a5f3067 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c @@ -1712,7 +1712,8 @@ _archive_write_disk_finish_entry(struct archive *_a) const void *metadata; size_t metadata_size; metadata = archive_entry_mac_metadata(a->entry, &metadata_size); - if (metadata == NULL || metadata_size == 0) { + if ((a->todo & TODO_MAC_METADATA) == 0 || + metadata == NULL || metadata_size == 0) { #endif r2 = archive_write_disk_set_acls(&a->archive, a->fd, archive_entry_pathname(a->entry), @@ -2293,7 +2294,8 @@ _archive_write_disk_close(struct archive *_a) chmod(p->name, p->mode); if (p->fixup & TODO_ACLS) #ifdef HAVE_DARWIN_ACL - if (p->mac_metadata == NULL || + if ((p->fixup & TODO_MAC_METADATA) == 0 || + p->mac_metadata == NULL || p->mac_metadata_size == 0) #endif archive_write_disk_set_acls(&a->archive, @@ -3465,12 +3467,19 @@ set_fflags(struct archive_write_disk *a) #ifdef UF_APPEND critical_flags |= UF_APPEND; #endif -#ifdef EXT2_APPEND_FL +#if defined(FS_APPEND_FL) + critical_flags |= FS_APPEND_FL; +#elif defined(EXT2_APPEND_FL) critical_flags |= EXT2_APPEND_FL; #endif -#ifdef EXT2_IMMUTABLE_FL +#if defined(FS_IMMUTABLE_FL) + critical_flags |= FS_IMMUTABLE_FL; +#elif defined(EXT2_IMMUTABLE_FL) critical_flags |= EXT2_IMMUTABLE_FL; #endif +#ifdef FS_JOURNAL_DATA_FL + critical_flags |= FS_JOURNAL_DATA_FL; +#endif if (a->todo & TODO_FFLAGS) { archive_entry_fflags(a->entry, &set, &clear); @@ -3582,7 +3591,10 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name, return (ARCHIVE_WARN); } -#elif defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS) +#elif (defined(FS_IOC_GETFLAGS) && defined(FS_IOC_SETFLAGS) && \ + defined(HAVE_WORKING_FS_IOC_GETFLAGS)) || \ + (defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS) && \ + defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)) /* * Linux uses ioctl() to read and write file flags. */ @@ -3595,7 +3607,7 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name, int newflags, oldflags; int sf_mask = 0; - if (set == 0 && clear == 0) + if (set == 0 && clear == 0) return (ARCHIVE_OK); /* Only regular files and dirs can have flags. */ if (!S_ISREG(mode) && !S_ISDIR(mode)) @@ -3616,12 +3628,19 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name, * defines. (?) The code below degrades reasonably gracefully * if sf_mask is incomplete. */ -#ifdef EXT2_IMMUTABLE_FL +#if defined(FS_IMMUTABLE_FL) + sf_mask |= FS_IMMUTABLE_FL; +#elif defined(EXT2_IMMUTABLE_FL) sf_mask |= EXT2_IMMUTABLE_FL; #endif -#ifdef EXT2_APPEND_FL +#if defined(FS_APPEND_FL) + sf_mask |= FS_APPEND_FL; +#elif defined(EXT2_APPEND_FL) sf_mask |= EXT2_APPEND_FL; #endif +#if defined(FS_JOURNAL_DATA_FL) + sf_mask |= FS_JOURNAL_DATA_FL; +#endif /* * XXX As above, this would be way simpler if we didn't have * to read the current flags from disk. XXX @@ -3629,12 +3648,24 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name, ret = ARCHIVE_OK; /* Read the current file flags. */ - if (ioctl(myfd, EXT2_IOC_GETFLAGS, &oldflags) < 0) + if (ioctl(myfd, +#ifdef FS_IOC_GETFLAGS + FS_IOC_GETFLAGS, +#else + EXT2_IOC_GETFLAGS, +#endif + &oldflags) < 0) goto fail; /* Try setting the flags as given. */ newflags = (oldflags & ~clear) | set; - if (ioctl(myfd, EXT2_IOC_SETFLAGS, &newflags) >= 0) + if (ioctl(myfd, +#ifdef FS_IOC_SETFLAGS + FS_IOC_SETFLAGS, +#else + EXT2_IOC_SETFLAGS, +#endif + &newflags) >= 0) goto cleanup; if (errno != EPERM) goto fail; @@ -3643,7 +3674,13 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name, newflags &= ~sf_mask; oldflags &= sf_mask; newflags |= oldflags; - if (ioctl(myfd, EXT2_IOC_SETFLAGS, &newflags) >= 0) + if (ioctl(myfd, +#ifdef FS_IOC_SETFLAGS + FS_IOC_SETFLAGS, +#else + EXT2_IOC_SETFLAGS, +#endif + &newflags) >= 0) goto cleanup; /* We couldn't set the flags, so report the failure. */ diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt index a8e25ba..6632a1e 100644 --- a/Utilities/cmlibuv/CMakeLists.txt +++ b/Utilities/cmlibuv/CMakeLists.txt @@ -212,6 +212,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") nsl sendfile socket + rt ) list(APPEND uv_headers include/uv-sunos.h @@ -223,6 +224,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") list(APPEND uv_defines _XOPEN_SOURCE=500 ) + if(CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 90) + endif() else() list(APPEND uv_defines _XOPEN_SOURCE=600 diff --git a/Utilities/cmlibuv/src/unix/fs.c b/Utilities/cmlibuv/src/unix/fs.c index f9513ea..8a4ba7a 100644 --- a/Utilities/cmlibuv/src/unix/fs.c +++ b/Utilities/cmlibuv/src/unix/fs.c @@ -244,9 +244,19 @@ skip: #endif } +#if defined(__sun) && _XOPEN_SOURCE < 600 +static char* uv__mkdtemp(char *template) +{ + if (!mktemp(template) || mkdir(template, 0700)) + return NULL; + return template; +} +#else +#define uv__mkdtemp mkdtemp +#endif static ssize_t uv__fs_mkdtemp(uv_fs_t* req) { - return mkdtemp((char*) req->path) ? 0 : -1; + return uv__mkdtemp((char*) req->path) ? 0 : -1; } diff --git a/Utilities/cmlibuv/src/unix/sunos.c b/Utilities/cmlibuv/src/unix/sunos.c index a43f7f1..14c58af 100644 --- a/Utilities/cmlibuv/src/unix/sunos.c +++ b/Utilities/cmlibuv/src/unix/sunos.c @@ -28,6 +28,10 @@ #include <assert.h> #include <errno.h> +#if !defined(SUNOS_NO_IFADDRS) && _XOPEN_SOURCE < 600 +#define SUNOS_NO_IFADDRS +#endif + #ifndef SUNOS_NO_IFADDRS # include <ifaddrs.h> #endif |