copy-webkitlibraries-to-product-directory 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/perl -w
  2. # Copyright (C) 2005, 2008, 2010, 2011, 2012 Apple Inc. All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. #
  8. # 1. Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. # 2. Redistributions in binary form must reproduce the above copyright
  11. # notice, this list of conditions and the following disclaimer in the
  12. # documentation and/or other materials provided with the distribution.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  15. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  18. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. use strict;
  25. use FindBin;
  26. use lib $FindBin::Bin;
  27. use webkitdirs;
  28. my $productDir = shift @ARGV;
  29. $productDir = $ENV{BUILT_PRODUCTS_DIR} if !$productDir;
  30. chdirWebKit();
  31. my @librariesToCopy = (
  32. "libWebKitSystemInterfaceLion.a",
  33. "libWebKitSystemInterfaceMountainLion.a",
  34. "libWebCoreSQLite3.a",
  35. );
  36. my $ranlib = `xcrun -find ranlib`;
  37. chomp $ranlib;
  38. foreach my $libName (@librariesToCopy) {
  39. my $srcLib = "WebKitLibraries/" . $libName;
  40. my $lib = "$productDir/" . $libName;
  41. if (!-e $lib || -M $lib > -M $srcLib) {
  42. print "Updating $lib\n";
  43. system "ditto", $srcLib, $lib;
  44. system $ranlib, $lib;
  45. }
  46. }
  47. # FIXME: This code should be abstracted to not be copy/paste.
  48. my $srcHeader = "WebKitLibraries/WebKitSystemInterface.h";
  49. my $header = "$productDir/usr/local/include/WebKitSystemInterface.h";
  50. if (!-e $header || -M $header > -M $srcHeader) {
  51. print "Updating $header\n";
  52. system "mkdir", "-p", "$productDir/usr/local/include";
  53. system "ditto", $srcHeader, $header;
  54. }
  55. my $srcHeaderDir = "WebKitLibraries/WebCoreSQLite3";
  56. my $headerDir = "$productDir/WebCoreSQLite3";
  57. if (!-e $headerDir || -M $headerDir > -M $srcHeaderDir) {
  58. print "Updating $headerDir\n";
  59. system "ditto", $srcHeaderDir, $headerDir;
  60. }