generate-project-files-manx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use Getopt::Long qw(:config pass_through);
  4. use FindBin;
  5. use lib $FindBin::Bin;
  6. use webkitdirs;
  7. chdirWebKit();
  8. my $os;
  9. my $derivedSoucesSuffix;
  10. my $msvs_version;
  11. my $gyp_file;
  12. my $gyp_dir;
  13. my $enable_jit = -1;
  14. my $enable_llint = -1;
  15. my %project_file_suffixes = (
  16. 2008 => '.vcproj',
  17. 2010 => '.vcxproj',
  18. );
  19. my %options = (
  20. 'os=s' => \$os,
  21. 'msvs_version=s' => \$msvs_version,
  22. 'jit!' => \$enable_jit,
  23. 'llint!' => \$enable_llint,
  24. );
  25. GetOptions(%options);
  26. if ($os eq 'win') {
  27. $derivedSoucesSuffix = 'orbis';
  28. $msvs_version = '2010' unless $msvs_version;
  29. $gyp_dir = "Tools/manx/win";
  30. $enable_jit = 1 if $enable_jit == -1;
  31. $enable_llint = 1 if $enable_llint == -1;
  32. } elsif ($os eq 'psp2') {
  33. $derivedSoucesSuffix = 'psp2';
  34. $msvs_version = '2010' unless $msvs_version;
  35. $gyp_dir = "Tools/manx/psp2_10";
  36. $enable_jit = 0 if $enable_jit == -1;
  37. $enable_llint = 0 if $enable_llint == -1 and $enable_jit == 1;
  38. $enable_llint = 1 if $enable_llint == -1 and $enable_jit == 0;
  39. } elsif ($os eq 'orbis') {
  40. $derivedSoucesSuffix = 'orbis';
  41. $msvs_version = '2010' unless $msvs_version;
  42. $gyp_dir = "Tools/manx/orbis";
  43. $enable_jit = 1 if $enable_jit == -1;
  44. $enable_llint = 1 if $enable_llint == -1;
  45. } else {
  46. die "Unknown OS: ${os}";
  47. }
  48. chdir $gyp_dir;
  49. $gyp_file = 'manx.gyp';
  50. system("python", "../../../../tools/gyp/gyp", "--depth", ".", '-G', "msvs_version=${msvs_version}", "-DOS=${os}", "-DENABLE_JIT=${enable_jit}", "-DENABLE_LLINT=${enable_llint}", $gyp_file) == 0 or die "Failed to run gyp";
  51. chdirWebKit();
  52. my @project_names = qw(
  53. WTF
  54. JavaScriptCore
  55. JscLLIntOffsetExtractor
  56. WebCore
  57. WebCoreDerived
  58. WebCoreDom
  59. WebCoreHtml
  60. WebCoreSvg
  61. WebCoreTestSupport
  62. WebKit
  63. WebKit2
  64. WebKitTestRunner
  65. );
  66. if ($os eq 'orbis') {
  67. push(@project_names, qw(WTF_detached JSCConsole JscJitCompiler_proxy JscJitCompiler_detached));
  68. push(@project_names, qw(WTF_CoreIPC WebCore_CoreIPC CoreIPC));
  69. } elsif ($os eq 'psp2') {
  70. push(@project_names, qw(JSCConsole JscJitCompiler_proxy));
  71. } elsif ($os eq 'win') {
  72. push(@project_names, qw(JSCJITProxy JSCConsole));
  73. }
  74. foreach (@project_names) {
  75. my $project_name = $_;
  76. my $proj_file = "${gyp_dir}/${project_name}${project_file_suffixes{$msvs_version}}";
  77. my $tmp_proj_file = "${proj_file}.bak";
  78. print "Modifying $proj_file\n";
  79. rename $proj_file, $tmp_proj_file;
  80. if ($msvs_version eq '2008') {
  81. open(INPUT, "-|", "python", "Tools/Scripts/pretty-vcproj-manx.py", $tmp_proj_file) or die;
  82. } else {
  83. open(INPUT, "-|", "python", "Tools/Scripts/pretty-vcxproj-manx.py", $tmp_proj_file) or die;
  84. }
  85. open(OUTPUT, ">", $proj_file) or die;
  86. foreach (<INPUT>) {
  87. s/&quot;SN_TARGET_PSP2&quot;/SN_TARGET_PSP2/g if ($os eq 'psp2');
  88. s/\$\(OutDir\)\\?DerivedSources/..\\..\\..\\DerivedSources_${derivedSoucesSuffix}/g;
  89. print(OUTPUT $_);
  90. }
  91. close INPUT;
  92. close OUTPUT;
  93. #unlink($tmp_proj_file);
  94. if ($msvs_version eq '2010') {
  95. my $file = "${gyp_dir}/${project_name}${project_file_suffixes{$msvs_version}}.filters";
  96. my $tmp_file = "${file}.bak";
  97. print "Modifying $file\n";
  98. rename $file, $tmp_file;
  99. open(INPUT, "-|", "python", "Tools/Scripts/pretty-vcxproj-manx.py", $tmp_file) or die;
  100. open(OUTPUT, ">", $file) or die;
  101. while (<INPUT>) {
  102. s/\$\(OutDir\)\\?DerivedSources/..\\..\\..\\DerivedSources_${derivedSoucesSuffix}/g;
  103. print(OUTPUT $_);
  104. }
  105. close INPUT;
  106. close OUTPUT;
  107. #unlink($tmp_file);
  108. }
  109. }