build-jsc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/usr/bin/perl -w
  2. # Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
  3. # Copyright (C) 2007 Eric Seidel <eric@webkit.org>
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions
  7. # are met:
  8. #
  9. # 1. Redistributions of source code must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. # 2. Redistributions in binary form must reproduce the above copyright
  12. # notice, this list of conditions and the following disclaimer in the
  13. # documentation and/or other materials provided with the distribution.
  14. # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  15. # its contributors may be used to endorse or promote products derived
  16. # from this software without specific prior written permission.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  19. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  22. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. use strict;
  29. use FindBin;
  30. use Getopt::Long qw(:config pass_through);
  31. use lib $FindBin::Bin;
  32. use webkitdirs;
  33. use POSIX;
  34. use sony::playstation;
  35. my $coverageSupport = 0;
  36. my $showHelp = 0;
  37. my $programName = basename($0);
  38. my $usage = <<EOF;
  39. Usage: $programName [options] [options to pass to build system]
  40. --help Show this help message
  41. --[no-]coverage Toggle code coverage support (default: $coverageSupport)
  42. EOF
  43. GetOptions(
  44. 'coverage!' => \$coverageSupport,
  45. 'help' => \$showHelp
  46. );
  47. if ($showHelp) {
  48. print STDERR $usage;
  49. exit 1;
  50. }
  51. checkRequiredSystemConfig();
  52. setConfiguration();
  53. chdirWebKit();
  54. my @options = XcodeOptions();
  55. my @coverageSupportOptions = ($coverageSupport) ? XcodeCoverageSupportOptions() : ();
  56. if (isQt()) {
  57. checkForArgumentAndRemoveFromARGV("--qt");
  58. my @projects = ("WTF", "JavaScriptCore");
  59. # Pick up the --no-webkit2 option from BUILD_WEBKIT_ARGS if it is needed
  60. push @ARGV, split(/ /, $ENV{'BUILD_WEBKIT_ARGS'}) if ($ENV{'BUILD_WEBKIT_ARGS'});
  61. push @ARGV, "WEBKIT_CONFIG-=build_webkit2" if checkForArgumentAndRemoveFromARGV("--no-webkit2");
  62. my $result = buildQMakeProjects(\@projects, 0, @ARGV);
  63. exit exitStatus($result);
  64. } elsif (cmakeBasedPortName()) {
  65. buildCMakeProjectOrExit(0, cmakeBasedPortName(), undef, "jsc", cmakeBasedPortArguments()); # This call only returns if nothing wrong happened
  66. exit exitStatus(0);
  67. } elsif (isPS3()) {
  68. $result = buildPS3Project("JavaScriptCore", @ARGV);
  69. $result = buildPS3Project("jsc", @ARGV);
  70. } elsif (isPSVita()) {
  71. $result = buildPSVitaProject("JavaScriptCore", @ARGV);
  72. $result = buildPSVitaProject("WTF", @ARGV);
  73. }
  74. sub buildMyProject
  75. {
  76. my ($projectDirectory, $projectName) = @_;
  77. my $result;
  78. chdir $projectDirectory or die "Can't find $projectName directory to build from";
  79. if (isAppleMacWebKit()) {
  80. $result = system "sh", "-c", ('xcodebuild -project ' . $projectName . '.xcodeproj "$@" | grep -v setenv && exit ${PIPESTATUS[0]}'), "xcodebuild", @options, @ARGV, @coverageSupportOptions;
  81. } elsif (isAppleWinWebKit()) {
  82. $result = buildVisualStudioProject("$projectName.vcxproj/$projectName.submit.sln");
  83. } elsif (isGtk()) {
  84. checkForArgumentAndRemoveFromARGV("--gtk");
  85. $result = buildGtkProject($projectName, 0);
  86. } else {
  87. die "Building not defined for this platform!\n";
  88. }
  89. exit exitStatus($result) if exitStatus($result);
  90. chdirWebKit();
  91. }
  92. buildMyProject("Source/WTF", "WTF");
  93. buildMyProject("Source/JavaScriptCore", "JavaScriptCore");