Commit Graph

39 Commits

Author SHA1 Message Date
Brad King 86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Gregor Jasny 60dcaaea13 tidy: Fix readability-redundant-string-cstr issues 2016-09-04 16:55:05 +02:00
Daniel Pfeifer eb79fa7260 Access std::ios_base with std::ios
Just because it is shorter.
2016-06-14 22:23:08 +02:00
Harry Mallon 3acc29fca9 CPack/DragNDrop: Optionally disable `/Applications` symlink 2016-05-25 09:51:04 -04:00
Brad King 40bee43a58 cmCPackDragNDropGenerator: Replace std::{ostringstream => string} 2016-05-17 13:47:21 -04:00
Kitware Robot d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King 0ac18d40c8 Remove `//------...` horizontal separator comments
Modern editors provide plenty of ways to visually separate functions.
Drop the explicit comments that previously served this purpose.
Use the following command to automate the change:

    $ git ls-files -z -- \
        "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" |
      egrep -z -v "^Source/cmCommandArgumentLexer\." |
      egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmDependsJavaLexer\." |
      egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmExprLexer\." |
      egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmFortranLexer\." |
      egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmListFileLexer\." |
      egrep -z -v "^Source/cm_sha2" |
      egrep -z -v "^Source/(kwsys|CursesDialog/form)/" |
      egrep -z -v "^Utilities/(KW|cm).*/" |
      xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}'

This avoids modifying third-party sources and generated sources.
2016-05-09 09:41:43 -04:00
Brad King e1c7747253 Format include directive blocks and ordering with clang-format
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first).  First
run `clang-format` with the config file:

    ---
    SortIncludes: false
    ...

Commit the result temporarily.  Then run `clang-format` again with:

    ---
    SortIncludes: true
    IncludeCategories:
      - Regex:    'sys/types.h'
        Priority: -1
    ...

Commit the result temporarily.  Start a new branch and cherry-pick the
second commit.  Manually resolve conflicts to preserve indentation of
re-ordered includes.  This cleans up the include ordering without
changing any other style.

Use the following command to run `clang-format`:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
      egrep -z -v '^Source/cm_sha2' |
      egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
      egrep -z -v '^Utilities/(KW|cm).*/' |
      egrep -z -v '^Tests/Module/GenerateExportHeader' |
      egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
      xargs -0 clang-format -i

This selects source files that do not come from a third-party.

Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
2016-04-29 13:58:54 -04:00
Brad King 180538c706 Source: Stabilize include order
Each source file has a logical first include file.  Include it in an
isolated block so that tools that sort includes do not move them.
2016-04-29 13:58:31 -04:00
Brad King d84ba668d7 CPack: Avoid using OS X CoreServices if compiler fails on header (#16021)
Some compilers on OS X report errors in the CoreServices framework headers.
Check for support of the header ahead of time and compile the relevant code
only when the header is available.
2016-03-18 11:12:51 -04:00
Sean McBride c718070c08 CPack: Avoid requiring Carbon framework on OS X (#16021)
In commit v3.5.0-rc1~232^2 (CPackDMG: Add support for multilingual SLAs,
2015-10-19) we added use of the Carbon framework in order to get access
to its APIs to convert Script Manager RegionCode values.  This is not
necessary.  Instead we can use CoreServices.

While at it, replace individual CoreFoundation includes with including
the entire framework, which is the correct way.
2016-03-17 13:53:51 -04:00
Andrey Mishchenko bbb3c4ffc1 CPack/DragNDrop: Fix handling of certain license file content (#15899)
There were issues in the special-character-escaping and line-wrapping
code which caused DragNDrop packaging to fail mysteriously at a later
step with parsing errors in the `sla.r` file generated by the following
code.
2016-01-07 15:24:42 -05:00
Simon Levermann ae434ee2dd CPack/DragNDrop: Allow single license for multiple languages
When both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE are defined,
use the license file for all languages instead of looking for a license
file for each language.  Also expand the documentation on the SLA
variables.
2015-12-02 08:26:01 -05:00
Simon Levermann 0c5b96bf7c CPack/DragNDrop: Use documented CPACK_DMG_SLA_LANGUAGES variable
The change in commit f88533cc (CPackDMG: Add support for multilingual
SLAs, 2015-10-19) accidentally used CPACK_DMG_LANGUAGES in its
implementation instead of the intended CPACK_DMG_SLA_LANGUAGES added to
the documentation.
2015-11-23 10:22:15 -05:00
Robert Maynard 167a465565 CPack/DragNDrop: Optionally run an AppleScript when making a package
While the DragNDropGenerator supports custom DS_Store and backgrounds,
it is still very hard to automatically setup nice looking packages. The
primary issue is that the DS_Store embeds the name of the volume in the
path to backgrounds, which means that if a package embeds the version in
its volume name a new DS_Store must generated for each release.

Instead one now can use applescript to setup the DS_Store.

This change also ensures that temporary RW image has enough space for
these changes, creating 1 MB dummy padding file, that is later removed
from the image.

Co-Author: Adam Strzelecki <adam.strzelecki@java.pl>
2015-11-13 08:44:15 -05:00
Robert Maynard 9c1dfbfd60 CPack/DragNDrop: Place the background image file in a hidden folder
By using a hidden folder we avoid the need to mark the file as hidden
from finder, and it makes it easier for future work to refer to the
background image file.
2015-11-13 08:43:50 -05:00
Robert Maynard 47302038c1 CPack/DragNDrop: Use source file extension for background image
Instead of blindly copying the `CPACK_DMG_BACKGROUND_IMAGE` file to
`background.png`, we instead use the same file extension as the source
image.  This is needed for proper support of multi resolution `tif`
backgrounds.
2015-11-13 08:42:49 -05:00
Simon Levermann f88533cc06 CPackDMG: 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
<language>.menu.txt and <language>.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.
2015-11-06 11:14:49 -05:00
Brad King 356c26ebdf cmSystemTools: Teach RunSingleCommand to separate stdout and stderr
Extend the RunSingleCommand signature to capture stdout and stderr
separately.  Allow both to be captured to the same std::string
to preserve existing behavior.  Update all call sites to do this
so that this refactoring does not introduce functional changes.
2015-04-20 15:47:50 -04:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Clinton Stimpson 53d6ebb360 cpack: For DragNDrop generator, add sysroot option when calling Rez. 2013-11-01 05:31:07 -06:00
Clinton Stimpson 193029c4aa cpack: For DragNDrop generator, add sysroot option when calling Rez.
Also adding overwrite option (-ov) in case multiple temporary
dmg files are being created.

Fixes bug #14536.
2013-10-31 20:25:12 -06:00
Clinton Stimpson 14561e3d35 Fix for possible Rez errors when creating dmg.
Rez appears to have a limit on the length of lines it processes.
Break up long lines from a license file to avoid the error.
2012-10-22 23:06:16 -06:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
David Cole 4693cf8492 Xcode: Detect new default locations of Xcode 4.3 bits and pieces (#12621)
Xcode 4.3 installs into "/Applications" by default, from the Mac App Store.

Also, the paths to the available SDKs changed: they are now within the
Xcode.app bundle.

PackageMaker is installed as a separate program, and may be installed
anywhere. It is not installed with Xcode 4.3 by default anymore.
Download the "Auxiliary Tools for Xcode" to get PackageMaker.
Put PackageMaker inside the Xcode.app bundle, in its nested Applications
folder, or put it alongside Xcode in "/Applications" and CMake will find
it.

Update references to "find" paths: add new possible locations for finding
Xcode.app and PackageMaker.app. Prefer the most recent version's locations
first, but keep the old locations as fallback search paths, too.

Thanks to all the contributors who provided and tested out various patches
for fixing this issue. Especially, but by no means limited to:
Francisco Requena Espí, Jamie Kirkpatrick and drfrogsplat.
2012-03-08 22:43:19 -05:00
Clinton Stimpson 5663e436ab DragNDrop: Fix problem with relocated files in Xcode 4.3
Remove dependency on /Developer/Headers/FlatCarbon when creating SLAs for DMG images.
Instead, of adding those .r files on the command line, include the necessary .r files
from the generated .r file.
2012-02-29 08:29:46 -07:00
Eric NOULARD dd04608132 Fix KWStyle warnings 2011-04-01 19:27:34 +02:00
Clinton Stimpson 2973c1fbeb Add component support to DragNDrop generator. 2011-03-31 13:33:10 -04:00
Brad King 31a313d470 CPack: Avoid member shadowing after API refactor
After converting method arguments to members we need to avoid use of the
same names as local variables and other method arguments.
2010-08-11 16:17:09 -04:00
Eric NOULARD cd7b8a03f5 CPack: Refactor API in order to handle multi-file packages
The multi-argument CompressFiles(...) method has been replace by the
no-argument PackageFiles() method and 3 more member variables.  This
will enable implemention of multi-package generators.  Now each specific
generator (which overloads PackageFiles()) may decide to change the name
and/or the number of generated package files.
2010-08-11 14:09:52 -04:00
David Cole a091e99cb9 Fix issue #8818 - escape quotes in the license file when using the DragNDrop cpack generator. Thanks to Clinton Stimpson for the patch. 2009-09-28 17:14:53 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
David Cole 42c033ccd6 BUG: Fix issue #8759 - add support for setting dmg volume name and compression type by CPack variables. Also add custom .DS_Store and background image support. Thanks to Mike Arthur for the patches. 2009-04-03 13:12:53 -04:00
David Cole 60a46ca76e STYLE: Fix line length violation. 2009-02-24 09:34:03 -05:00
David Cole c148714b82 ENH: Add license file presentation to the Drag-N-Drop dmg file CPack generator. Fixes issue #8442. Thanks to Clinton Stimpson for the patch. 2009-02-23 13:25:18 -05:00
David Cole c6051d7ad0 STYLE: Fix style line-too-long violations. 2009-02-20 10:14:40 -05:00
David Cole 1bf669207b BUG: A little bit more refactoring from BundleGenerator to DragNDropGenerator. See issue #8556. Thanks for Clinton Stimpson for the patch. 2009-02-19 10:39:08 -05:00
David Cole 3a4f76949a BUG: Fix issue #8402. Add a drag and drop bundle generator to the Mac build of CPack. Add a test of it in the CPackComponents test. Thanks to Clinton Stimpson for the patch. 2009-01-22 12:12:44 -05:00