🛠️🐜 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.

102 lines
2.4 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 x86 x64
  6. DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
  7. # Intel 32-bit compiler flags (10.6 runtime compatibility)
  8. GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \
  9. -I/usr/local/include"
  10. GCC_LINK_X86="-mmacosx-version-min=10.6"
  11. # Intel 64-bit compiler flags (10.6 runtime compatibility)
  12. GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
  13. -DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \
  14. -I/usr/local/include"
  15. GCC_LINK_X64="-mmacosx-version-min=10.6"
  16. # Output both PowerPC and Intel object files
  17. args="$*"
  18. compile=yes
  19. link=yes
  20. while test x$1 != x; do
  21. case $1 in
  22. --version) exec gcc $1;;
  23. -v) exec gcc $1;;
  24. -V) exec gcc $1;;
  25. -print-prog-name=*) exec gcc $1;;
  26. -print-search-dirs) exec gcc $1;;
  27. -E) GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
  28. GCC_COMPILE_X64="$GCC_COMPILE_X64 -E"
  29. compile=no; link=no;;
  30. -c) link=no;;
  31. -o) output=$2;;
  32. *.c|*.cc|*.cpp|*.S|*.m|*.mm) source=$1;;
  33. esac
  34. shift
  35. done
  36. if test x$link = xyes; then
  37. GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
  38. GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_LINK_X64"
  39. fi
  40. if test x"$output" = x; then
  41. if test x$link = xyes; then
  42. output=a.out
  43. elif test x$compile = xyes; then
  44. output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
  45. fi
  46. fi
  47. # Compile X86 32-bit
  48. if test x"$output" != x; then
  49. dir=x86/`dirname $output`
  50. if test -d $dir; then
  51. :
  52. else
  53. mkdir -p $dir
  54. fi
  55. fi
  56. set -- $args
  57. while test x$1 != x; do
  58. if test -f "x86/$1" && test "$1" != "$output"; then
  59. x86_args="$x86_args x86/$1"
  60. else
  61. x86_args="$x86_args $1"
  62. fi
  63. shift
  64. done
  65. $GCC_COMPILE_X86 $x86_args || exit $?
  66. if test x"$output" != x; then
  67. cp $output x86/$output
  68. fi
  69. # Compile X86 32-bit
  70. if test x"$output" != x; then
  71. dir=x64/`dirname $output`
  72. if test -d $dir; then
  73. :
  74. else
  75. mkdir -p $dir
  76. fi
  77. fi
  78. set -- $args
  79. while test x$1 != x; do
  80. if test -f "x64/$1" && test "$1" != "$output"; then
  81. x64_args="$x64_args x64/$1"
  82. else
  83. x64_args="$x64_args $1"
  84. fi
  85. shift
  86. done
  87. $GCC_COMPILE_X64 $x64_args || exit $?
  88. if test x"$output" != x; then
  89. cp $output x64/$output
  90. fi
  91. if test x"$output" != x; then
  92. lipo -create -o $output x86/$output x64/$output
  93. fi