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

101 lines
2.4 KiB

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