[cmake-developers] [CPackDMG][Patch] Enable use of single license for multiple languages
Hi, since license texts are often not translated into other languages, this patch enables the CPack DragnDrop generator to use a single license file for all languages instead of having to keep a copy of the same file around under multiple different names. Kind regards, Simon LevermannFrom 65344478186a9e93bb70d8e6c2616e87cafe1c73 Mon Sep 17 00:00:00 2001 From: Simon LevermannDate: Tue, 24 Nov 2015 16:17:53 +0100 Subject: [PATCH] Allow single license for multiple languages When both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE are defined, CPack now uses the license file for all languages, instead of looking for a license file for each language. Also expands the documentation on the SLA variables. --- Modules/CPackDMG.cmake | 19 ++- Source/CPack/cmCPackDragNDropGenerator.cxx | 22 +++--- Source/CPack/cmCPackDragNDropGenerator.h | 1 + 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index 6b5af7e..12efcd9 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -49,11 +49,28 @@ # .. variable:: CPACK_DMG_SLA_DIR # # Directory where license and menu files for different languages are stored. +# Setting this causes CPack to look for a language.menu.txt and language.license.txt +# file for every language defined in CPACK_DMG_SLA_LANGUAGES. If both this variable +# and CPACK_RESOURCE_FILE_LICENSE are set, CPack will only look for the menu files +# and use the same license file for all languages. # # .. variable:: CPACK_DMG_SLA_LANGUAGES # # Languages for which a license agreement is provided when mounting the -# generated DMG. +# generated DMG. A menu file consists of 9 lines of text. The first line is +# is the name of the language itself, uppercase, in English (e.g. German). +# The other lines are translations of the following strings: +# - Agree +# - Disagree +# - Print +# - Save... +# - You agree to the terms of the License Agreement when you click the +# "Agree" button. +# - Software License Agreement +# - This text cannot be saved. The disk may be full or locked, or the file +# may be locked. +# - Unable to print. Make sure you have selected a printer. +# # # For every language in this list, CPack will try to find files # ``.menu.txt`` and ``.license.txt`` in the directory diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 7a93fc6..a686577 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -131,10 +131,11 @@ int cmCPackDragNDropGenerator::InitializeInternal() if(!license_file.empty() && (license_file.find("CPack.GenericLicense.txt") == std::string::npos)) { -cmCPackLogger(cmCPackLog::LOG_WARNING, +cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE specified, " - "defaulting to CPACK_DMG_SLA_DIR" + "using CPACK_RESOURCE_FILE_LICENSE as a license for all languages." << std::endl); +singleLicense = true; } } if(!this->IsSet("CPACK_DMG_LANGUAGES")) @@ -166,7 +167,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() for(size_t i = 0; i < languages.size(); ++i) { std::string license = slaDirectory + "/" + languages[i] + ".license.txt"; - if (!cmSystemTools::FileExists(license)) + if (!singleLicense && !cmSystemTools::FileExists(license)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing license file " << languages[i] << ".license.txt" @@ -366,7 +367,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // use sla_dir if both sla_dir and license_file are set if(!cpack_license_file.empty() && - !slaDirectory.empty()) + !slaDirectory.empty() && !singleLicense) { cpack_license_file = ""; } @@ -699,7 +700,14 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, { for(size_t i = 0; i < languages.size(); ++i) { -WriteLicense(ofs, i + 5000, languages[i]); +if(singleLicense) + { + WriteLicense(ofs, i + 5000, languages[i], cpack_license_file); + } +else + { + WriteLicense(ofs, i + 5000, languages[i]); + } } } @@ -850,7 +858,7 @@ void cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, std::string licenseLanguage, std::string licenseFile) { - if(!licenseFile.empty()) + if(!licenseFile.empty() && !singleLicense) { licenseNumber = 5002; licenseLanguage = "English"; @@ -887,7 +895,7 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, // End of License outputStream << "};\n\n"; -
[cmake-developers] [CPackDMG][PATCH] Use documented variable names in code
Hi, in my previous patch to add multiple language support for SLAs in the CPackDMG module, the documentation I added talks about using the variable "CPACK_DMG_SLA_LANGUAGES", but the code itself uses "CPACK_DMG_LANGUAGES". This patch fixes that discrepancy and uses the documented variable "CPACK_DMG_SLA_LANGUAGES" instead. Kind regards Simon LevermannFrom 949e0eb5dffda94f275d863699df3c616584dfc9 Mon Sep 17 00:00:00 2001 From: Simon Levermann <simon-git...@slevermann.de> Date: Mon, 23 Nov 2015 12:44:55 +0100 Subject: [PATCH] Use variable name in code that is used in documentation --- Source/CPack/cmCPackDragNDropGenerator.cxx | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 7a93fc6..4ef102d 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -137,11 +137,11 @@ int cmCPackDragNDropGenerator::InitializeInternal() << std::endl); } } -if(!this->IsSet("CPACK_DMG_LANGUAGES")) +if(!this->IsSet("CPACK_DMG_SLA_LANGUAGES")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_DMG_SLA_DIR set but no languages defined " -"(set CPACK_DMG_LANGUAGES)" +"(set CPACK_DMG_SLA_LANGUAGES)" << std::endl); return 0; } @@ -154,12 +154,12 @@ int cmCPackDragNDropGenerator::InitializeInternal() } std::vector languages; -cmSystemTools::ExpandListArgument(this->GetOption("CPACK_DMG_LANGUAGES"), +cmSystemTools::ExpandListArgument(this->GetOption("CPACK_DMG_SLA_LANGUAGES"), languages); if(languages.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, -"CPACK_DMG_LANGUAGES set but empty" +"CPACK_DMG_SLA_LANGUAGES set but empty" << std::endl); return 0; } @@ -350,8 +350,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, ? this->GetOption("CPACK_DMG_DS_STORE") : ""; const std::string cpack_dmg_languages = -this->GetOption("CPACK_DMG_LANGUAGES") - ? this->GetOption("CPACK_DMG_LANGUAGES") : ""; +this->GetOption("CPACK_DMG_SLA_LANGUAGES") + ? this->GetOption("CPACK_DMG_SLA_LANGUAGES") : ""; const std::string cpack_dmg_ds_store_setup_script = this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT") -- 2.5.0 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [PATCH 0/3] Support for multilingual SLAs for the CPack DMG generator
Hi Brad, the attached patch limits lines to 79 cols, and adds the necessary documentation to the variables and release notes. I added diagnostic pragmas to suppress the deprecation warnings as well as a comment explaining the need for them. I've looked for a replacement some more, but I still haven't been able to find anything. I could try to hard-code it by writing a simple program that iterates all possible language codes (it's "only" a 16-bit value, so 2^16 combinations). However, this feels even hackier to me than the current state. This patch is a single commit rebased on current master (60cbd9b9da2059481e2f29fbb5859a5b0643d3d7) Kind regards, Simon On Mi, 2015-11-04 at 10:46 -0500, Brad King wrote: > On 11/03/2015 06:09 AM, Levermann, Simon wrote: > > This adds support for multilingual SLAs which are displayed when > > the user is trying to mount the DMG. > > Thanks for working on this and for bringing the patch to this list. > > Patches 2 and 3 look like fixups. Please squash that all into one > commit. Also please keep C++ sources wrapped to 79 columns or less. > > > Multiple languages can be added via the new variables > > CPACK_DMG_SLA_DIR > > and CPACK_DMG_SLA_LANGUAGES. > > Please add Help/variable/*.rst files to document these. Also > please add a Help/release/dev/*.rst file to add a release note > for the feature. > > > For each language defined, CPack will search for a > > language.menu.txt > > and language.license.txt file in CPACK_SLA_DIR. > > Good. Please mention this in the above-requested documentation. > > > This patch adds a library to the deprecated Carbon Framework to > > CPackLib, since the functions/types required to acquire the region > > code for the internal LPic data structure are only available in > > this > > old API. Apple does not seem to be offering a replacement API for > > the > > old ScriptManager region codes. > > Hopefully an alternative can be found. Meanwhile I get warnings > during the build due to DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER > appearing on the declarations of these APIs. Please add pragmas > or whatever is needed to suppress them, at least with Clang. Call > out the purpose for the suppression with a comment explaining why > we need to use the deprecated APIs. > > > Additional thought: One could add the language.menu.txt files for > > some common languages to the repository. > > Let's defer that until the actual feature is working. > > Thanks, > -Brad > From 68bd81a62f7c4a11cb0bc46a64d6b0da0a8a6688 Mon Sep 17 00:00:00 2001 From: Simon Levermann <simon-git...@slevermann.de> Date: Mon, 19 Oct 2015 11:13:55 +0200 Subject: [PATCH] Add support for multilingual SLAs Multiple languages for SLAs and the SLA UI can be added via the CPack variables CPACK_DMG_SLA_DIR and CPACK_DMG_SLA_LANGUAGES. For each language defined in the languages variable, CPack will search for .menu.txt and .license.txt in CPACK_DMG_SLA_DIR. If the sla directory variable is not defined, the old behaviour using CPACK_RESOURCE_FILE_LICENSE is retained Pass string by const& instead of copying Remove superfluous assignment Add deprecation pragma and comment Break lines longer than 79 characters Add variable documentation for new CPACK_DMG_ variables Add release note for multilanguage-sla --- Help/release/dev/cpack-dmg-multilanguage-sla.txt | 6 + Help/variable/CPACK_DMG_SLA_DIR | 6 + Help/variable/CPACK_DMG_SLA_LANGUAGES| 6 + Source/CMakeLists.txt| 4 + Source/CPack/cmCPackDragNDropGenerator.cxx | 357 --- Source/CPack/cmCPackDragNDropGenerator.h | 10 + 6 files changed, 351 insertions(+), 38 deletions(-) create mode 100644 Help/release/dev/cpack-dmg-multilanguage-sla.txt create mode 100644 Help/variable/CPACK_DMG_SLA_DIR create mode 100644 Help/variable/CPACK_DMG_SLA_LANGUAGES diff --git a/Help/release/dev/cpack-dmg-multilanguage-sla.txt b/Help/release/dev/cpack-dmg-multilanguage-sla.txt new file mode 100644 index 000..cdf3162 --- /dev/null +++ b/Help/release/dev/cpack-dmg-multilanguage-sla.txt @@ -0,0 +1,6 @@ +cpack-dmg-multilanguage-sla +-- + +* This feature adds the capability to add multi-lingual SLAs to a DMG which + is presented to the user when they try to mount the DMG. See :variable:`CPACK_DMG_SLA_LANGUAGES` + and :variable:`CPACK_DMG_SLA_DIR` for usage information. diff --git a/Help/variable/CPACK_DMG_SLA_DIR b/Help/variable/CPACK_DMG_SLA_DIR new file mode 100644 index 000..7b38a23 --- /dev/null +++ b/Help/variable/CPACK_DMG_SLA_DIR @@ -0,0 +1,6 @@ +CPACK_DMG_SLA_DIR + + +Directory where license and menu files for different languages are stored + +See :variable:`CPACK_DMG_SLA_LANGUAGES` for m
Re: [cmake-developers] [PATCH 0/3] Support for multilingual SLAs for the CPack DMG generator
The documentation files had incorrect file extensions. This is fixed in the attached version. On Do, 2015-11-05 at 10:36 +, Levermann, Simon wrote: > Hi Brad, > > the attached patch limits lines to 79 cols, and adds the necessary > documentation to the variables and release notes. > > I added diagnostic pragmas to suppress the deprecation warnings as > well > as a comment explaining the need for them. I've looked for a > replacement some more, but I still haven't been able to find > anything. > I could try to hard-code it by writing a simple program that iterates > all possible language codes (it's "only" a 16-bit value, so 2^16 > combinations). However, this feels even hackier to me than the > current > state. > > This patch is a single commit rebased on current master > (60cbd9b9da2059481e2f29fbb5859a5b0643d3d7) > > Kind regards, > Simon > > On Mi, 2015-11-04 at 10:46 -0500, Brad King wrote: > > On 11/03/2015 06:09 AM, Levermann, Simon wrote: > > > This adds support for multilingual SLAs which are displayed when > > > the user is trying to mount the DMG. > > > > Thanks for working on this and for bringing the patch to this list. > > > > Patches 2 and 3 look like fixups. Please squash that all into one > > commit. Also please keep C++ sources wrapped to 79 columns or > > less. > > > > > Multiple languages can be added via the new variables > > > CPACK_DMG_SLA_DIR > > > and CPACK_DMG_SLA_LANGUAGES. > > > > Please add Help/variable/*.rst files to document these. Also > > please add a Help/release/dev/*.rst file to add a release note > > for the feature. > > > > > For each language defined, CPack will search for a > > > language.menu.txt > > > and language.license.txt file in CPACK_SLA_DIR. > > > > Good. Please mention this in the above-requested documentation. > > > > > This patch adds a library to the deprecated Carbon Framework to > > > CPackLib, since the functions/types required to acquire the > > > region > > > code for the internal LPic data structure are only available in > > > this > > > old API. Apple does not seem to be offering a replacement API for > > > the > > > old ScriptManager region codes. > > > > Hopefully an alternative can be found. Meanwhile I get warnings > > during the build due to > > DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER > > appearing on the declarations of these APIs. Please add pragmas > > or whatever is needed to suppress them, at least with Clang. Call > > out the purpose for the suppression with a comment explaining why > > we need to use the deprecated APIs. > > > > > Additional thought: One could add the language.menu.txt files for > > > some common languages to the repository. > > > > Let's defer that until the actual feature is working. > > > > Thanks, > > -Brad > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For > more information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake-developersFrom 8191397c2da9d0698b37b86ddc1c2ca69bc48c72 Mon Sep 17 00:00:00 2001 From: Simon Levermann <simon-git...@slevermann.de> Date: Mon, 19 Oct 2015 11:13:55 +0200 Subject: [PATCH] Add support for multilingual SLAs Multiple languages for SLAs and the SLA UI can be added via the CPack variables CPACK_DMG_SLA_DIR and CPACK_DMG_SLA_LANGUAGES. For each language defined in the languages variable, CPack will search for .menu.txt and .license.txt in CPACK_DMG_SLA_DIR. If the sla directory variable is not defined, the old behaviour using CPACK_RESOURCE_FILE_LICENSE is retained Pass string by const& instead of copying Remove superfluous assignment Add deprecation pragma and comment Break lines longer than 79 characters Add variable documentation for new CPACK_DMG_ variables Add release note for multilanguage-sla --- Help/release/dev/cpack-dmg-multilanguage-sla.rst | 6 + Help/variable/CPACK_DMG_SLA_DIR.rst | 6 + Help/variable/CPACK_DMG_SLA_LANGUAGES.rst| 6 + Source/CMakeLists.txt| 4 + Source
[cmake-developers] [PATCH 2/3] Pass string by const& instead of copying
From: Simon Levermann--- Source/CPack/cmCPackDragNDropGenerator.cxx | 2 +- Source/CPack/cmCPackDragNDropGenerator.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index cdcda64..ccda0d5 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -843,7 +843,7 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, int } void -cmCPackDragNDropGenerator::BreakLongLine(std::string line, std::vector& lines) +cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, std::vector& lines) { const size_t max_line_length = 512; for(size_t i = 0; i < line.size(); i += max_line_length) diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 9fb39a4..65b64ef 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -48,7 +48,7 @@ private: std::string slaDirectory; void WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, std::string licenseLanguage, std::string licenseFile = ""); - void BreakLongLine(std::string line, std::vector& lines); + void BreakLongLine(const std::string& line, std::vector& lines); void EscapeQuotes(std::string& line); }; -- 2.1.4 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [PATCH 1/3] Add support for multilingual SLAs
From: Simon LevermannMultiple languages for SLAs and the SLA UI can be added via the CPack variables CPACK_DMG_SLA_DIR and CPACK_DMG_SLA_LANGUAGES. For each language defined in the languages variable, CPack will search for .menu.txt and .license.txt in CPACK_DMG_SLA_DIR. If the sla directory variable is not defined, the old behaviour using CPACK_RESOURCE_FILE_LICENSE is retained --- Source/CMakeLists.txt | 4 + Source/CPack/cmCPackDragNDropGenerator.cxx | 334 + Source/CPack/cmCPackDragNDropGenerator.h | 8 + 3 files changed, 309 insertions(+), 37 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index fd71b0e..729f6ab 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -726,6 +726,10 @@ endif() # Build CPackLib add_library(CPackLib ${CPACK_SRCS}) target_link_libraries(CPackLib CMakeLib) +if(APPLE) + include_directories (${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/Carbon.framework/Headers/) + target_link_libraries(CPackLib "-framework Carbon") +endif() if(APPLE) add_executable(cmakexbuild cmakexbuild.cxx) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 4c400d9..cdcda64 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -18,6 +18,13 @@ #include #include +#include + +#include +#include +#include +#include + static const char* SLAHeader = "data 'LPic' (5000) {\n" "$\"0002 0011 0003 0001 0002 \"\n" @@ -103,6 +110,64 @@ int cmCPackDragNDropGenerator::InitializeInternal() } this->SetOptionIfNotSet("CPACK_COMMAND_REZ", rez_path.c_str()); + if(this->IsSet("CPACK_DMG_SLA_DIR")) + { +slaDirectory = this->GetOption("CPACK_DMG_SLA_DIR"); +if(!slaDirectory.empty() && this->IsSet("CPACK_RESOURCE_FILE_LICENSE")) +{ + std::string license_file = this->GetOption("CPACK_RESOURCE_FILE_LICENSE"); + if(!license_file.empty() && (license_file.find("CPack.GenericLicense.txt") == std::string::npos)) + { +cmCPackLogger(cmCPackLog::LOG_WARNING, + "Both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE specified, defaulting to CPACK_DMG_SLA_DIR" + << std::endl); + } +} +if(!this->IsSet("CPACK_DMG_LANGUAGES")) +{ + cmCPackLogger(cmCPackLog::LOG_ERROR, +"CPACK_DMG_SLA_DIR set but no languages defined (set CPACK_DMG_LANGUAGES)" +<< std::endl); + return 0; +} +if(!cmSystemTools::FileExists(slaDirectory, false)) +{ + cmCPackLogger(cmCPackLog::LOG_ERROR, +"CPACK_DMG_SLA_DIR does not exist" +<< std::endl); + return 0; +} + +std::vector languages; +cmSystemTools::ExpandListArgument(this->GetOption("CPACK_DMG_LANGUAGES"), languages); +if(languages.empty()) +{ +cmCPackLogger(cmCPackLog::LOG_ERROR, + "CPACK_DMG_LANGUAGES set but empty" + << std::endl); +return 0; +} +for(size_t i = 0; i < languages.size(); ++i) +{ + std::string license = slaDirectory + "/" + languages[i] + ".license.txt"; + if (!cmSystemTools::FileExists(license)) + { +cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing license file " << languages[i] << ".license.txt" + << std::endl); +return 0; + } + std::string menu = slaDirectory + "/" + languages[i] + ".menu.txt"; + if (!cmSystemTools::FileExists(menu)) + { +cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing menu file " << languages[i] << ".menu.txt" + << std::endl); +return 0; + } +} + } + return this->Superclass::InitializeInternal(); } @@ -246,6 +311,12 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, this->GetOption("CPACK_DMG_DS_STORE") ? this->GetOption("CPACK_DMG_DS_STORE") : ""; + slaDirectory = !slaDirectory.empty() ? slaDirectory : ""; + + const std::string cpack_dmg_languages = +this->GetOption("CPACK_DMG_LANGUAGES") + ? this->GetOption("CPACK_DMG_LANGUAGES") : ""; + // only put license on dmg if is user provided if(!cpack_license_file.empty() && cpack_license_file.find("CPack.GenericLicense.txt") != std::string::npos) @@ -253,6 +324,13 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cpack_license_file = ""; } + // use sla_dir if both sla_dir and license_file are set + if(!cpack_license_file.empty() && + !slaDirectory.empty()) + { +cpack_license_file = ""; + } + // The staging directory contains everything that will end-up inside the // final disk image ... std::ostringstream staging; @@ -418,55 +496,117 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, } } - if(!cpack_license_file.empty()) + if(!cpack_license_file.empty() || !slaDirectory.empty()) { +// Use
[cmake-developers] [PATCH 0/3] Support for multilingual SLAs for the CPack DMG generator
From: Simon Levermann <simon.leverm...@governikus.de> Hello, This adds support for multilingual SLAs which are displayed when the user is trying to mount the DMG. Multiple languages can be added via the new variables CPACK_DMG_SLA_DIR and CPACK_DMG_SLA_LANGUAGES. For each language defined, CPack will search for a language.menu.txt and language.license.txt file in CPACK_SLA_DIR. This patch adds a library to the deprecated Carbon Framework to CPackLib, since the functions/types required to acquire the region code for the internal LPic data structure are only available in this old API. Apple does not seem to be offering a replacement API for the old ScriptManager region codes. Additional thought: One could add the language.menu.txt files for some common languages to the repository. Currently, english is hard-coded as a string in the source code, and is still used if CPACK_RESOURCE_FILE_LICENSE is used, rather than the new CPACK_DMG_SLA_DIR and CPACK_DMG_SLA_LANGUAGES behaviour. Is this out of scope for CMake (everything else seems to be english-only)? Best regards, Simon Levermann Simon Levermann (3): Add support for multilingual SLAs Pass string by const& instead of copying Remove superfluous assignment Source/CMakeLists.txt | 4 + Source/CPack/cmCPackDragNDropGenerator.cxx | 332 + Source/CPack/cmCPackDragNDropGenerator.h | 8 + 3 files changed, 307 insertions(+), 37 deletions(-) -- 2.1.4 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [PATCH 3/3] Remove superfluous assignment
From: Simon Levermann--- Source/CPack/cmCPackDragNDropGenerator.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index ccda0d5..7eb9050 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -311,8 +311,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, this->GetOption("CPACK_DMG_DS_STORE") ? this->GetOption("CPACK_DMG_DS_STORE") : ""; - slaDirectory = !slaDirectory.empty() ? slaDirectory : ""; - const std::string cpack_dmg_languages = this->GetOption("CPACK_DMG_LANGUAGES") ? this->GetOption("CPACK_DMG_LANGUAGES") : ""; -- 2.1.4 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers