Ei kuvausta

build_mac.sh 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright 2018 Google Inc. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. #!/bin/bash -x
  15. # This is a script that generates the test MacOS executables in this directory.
  16. # It should be needed very rarely to run this script. It is mostly provided
  17. # as a future reference on how the original binary set was created.
  18. set -o errexit
  19. cat <<EOF >/tmp/hello.cc
  20. #include <stdio.h>
  21. int main() {
  22. printf("Hello, world!\n");
  23. return 0;
  24. }
  25. EOF
  26. cat <<EOF >/tmp/lib.c
  27. int foo() {
  28. return 1;
  29. }
  30. int bar() {
  31. return 2;
  32. }
  33. EOF
  34. cd $(dirname $0)
  35. rm -rf exe_mac_64* lib_mac_64*
  36. clang -g -o exe_mac_64 /tmp/hello.c
  37. clang -g -o lib_mac_64 -dynamiclib /tmp/lib.c