🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.9 KiB

  1. #!/bin/sh
  2. #
  3. # Build Universal binaries on Mac OS X, thanks Ryan!
  4. #
  5. # Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf ppc x86
  6. # PowerPC compiler flags (10.2 runtime compatibility)
  7. GCC_COMPILE_PPC="gcc-3.3 -arch ppc \
  8. -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
  9. -nostdinc \
  10. -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
  11. -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
  12. -isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include"
  13. GCC_LINK_PPC="\
  14. -L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
  15. -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
  16. -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
  17. # Intel compiler flags (10.4 runtime compatibility)
  18. GCC_COMPILE_X86="gcc-4.0 -arch i386 -mmacosx-version-min=10.4 \
  19. -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
  20. -nostdinc \
  21. -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
  22. -I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \
  23. -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"
  24. GCC_LINK_X86="\
  25. -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \
  26. -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
  27. # Output both PowerPC and Intel object files
  28. args="$*"
  29. compile=yes
  30. link=yes
  31. while test x$1 != x; do
  32. case $1 in
  33. --version) exec gcc $1;;
  34. -v) exec gcc $1;;
  35. -V) exec gcc $1;;
  36. -print-prog-name=*) exec gcc $1;;
  37. -print-search-dirs) exec gcc $1;;
  38. -E) GCC_COMPILE_PPC="$GCC_COMPILE_PPC -E"
  39. GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
  40. compile=no; link=no;;
  41. -c) link=no;;
  42. -o) output=$2;;
  43. *.c|*.cc|*.cpp|*.S) source=$1;;
  44. esac
  45. shift
  46. done
  47. if test x$link = xyes; then
  48. GCC_COMPILE_PPC="$GCC_COMPILE_PPC $GCC_LINK_PPC"
  49. GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
  50. fi
  51. if test x"$output" = x; then
  52. if test x$link = xyes; then
  53. output=a.out
  54. elif test x$compile = xyes; then
  55. output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
  56. fi
  57. fi
  58. if test x"$output" != x; then
  59. dir=ppc/`dirname $output`
  60. if test -d $dir; then
  61. :
  62. else
  63. mkdir -p $dir
  64. fi
  65. fi
  66. set -- $args
  67. while test x$1 != x; do
  68. if test -f "ppc/$1" && test "$1" != "$output"; then
  69. ppc_args="$ppc_args ppc/$1"
  70. else
  71. ppc_args="$ppc_args $1"
  72. fi
  73. shift
  74. done
  75. $GCC_COMPILE_PPC $ppc_args || exit $?
  76. if test x"$output" != x; then
  77. cp $output ppc/$output
  78. fi
  79. if test x"$output" != x; then
  80. dir=x86/`dirname $output`
  81. if test -d $dir; then
  82. :
  83. else
  84. mkdir -p $dir
  85. fi
  86. fi
  87. set -- $args
  88. while test x$1 != x; do
  89. if test -f "x86/$1" && test "$1" != "$output"; then
  90. x86_args="$x86_args x86/$1"
  91. else
  92. x86_args="$x86_args $1"
  93. fi
  94. shift
  95. done
  96. $GCC_COMPILE_X86 $x86_args || exit $?
  97. if test x"$output" != x; then
  98. cp $output x86/$output
  99. fi
  100. if test x"$output" != x; then
  101. lipo -create -o $output ppc/$output x86/$output
  102. fi