qt-5.9.9-macosx10.10-x86_64-arm64.bash 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/usr/bin/env bash
  2. # Run this script on a macOS x86_64 host to generate Qt universal binaries.
  3. #
  4. # This script requires the 'makeuniversal' tool from:
  5. #
  6. # https://github.com/fizzyade/makeuniversal
  7. #
  8. # Build it with an existing local Qt installation first.
  9. #
  10. # Set the PATH environment variable to contain the location of 'makeuniversal'.
  11. set -e
  12. set -x
  13. umask 022
  14. # Verify that 'makeuniversal' is available in the PATH.
  15. type -p makeuniversal >/dev/null
  16. # Download, verify, and extract sources.
  17. curl -OL https://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz
  18. shasum -a 256 qt-everywhere-opensource-src-5.9.9.tar.xz | grep -q 5ce285209290a157d7f42ec8eb22bf3f1d76f2e03a95fc0b99b553391be01642
  19. tar xjf qt-everywhere-opensource-src-5.9.9.tar.xz
  20. patch -p0 < "${BASH_SOURCE%/*}/qt-5.9.9.patch"
  21. # Build the x86_64 variant.
  22. mkdir qt-5.9.9-x86_64
  23. cd qt-5.9.9-x86_64
  24. ../qt-everywhere-opensource-src-5.9.9/configure \
  25. --prefix=/ \
  26. -platform macx-clang \
  27. -device-option QMAKE_APPLE_DEVICE_ARCHS=x86_64 \
  28. -device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10 \
  29. -release \
  30. -opensource -confirm-license \
  31. -gui \
  32. -widgets \
  33. -no-gif \
  34. -no-icu \
  35. -no-pch \
  36. -no-angle \
  37. -no-opengl \
  38. -no-dbus \
  39. -no-harfbuzz \
  40. -skip declarative \
  41. -skip multimedia \
  42. -skip qtcanvas3d \
  43. -skip qtcharts \
  44. -skip qtconnectivity \
  45. -skip qtdeclarative \
  46. -skip qtgamepad \
  47. -skip qtlocation \
  48. -skip qtmultimedia \
  49. -skip qtnetworkauth \
  50. -skip qtpurchasing \
  51. -skip qtremoteobjects \
  52. -skip qtscript \
  53. -skip qtsensors \
  54. -skip qtserialbus \
  55. -skip qtserialport \
  56. -skip qtsvg \
  57. -skip qtwebchannel \
  58. -skip qtwebengine \
  59. -skip qtwebsockets \
  60. -skip qtxmlpatterns \
  61. -nomake examples \
  62. -nomake tests \
  63. -nomake tools
  64. make -j 8
  65. cd ..
  66. # Build the arm64 variant.
  67. mkdir qt-5.9.9-arm64
  68. cd qt-5.9.9-arm64
  69. ../qt-everywhere-opensource-src-5.9.9/configure \
  70. --prefix=/ \
  71. -platform macx-clang \
  72. -device-option QMAKE_APPLE_DEVICE_ARCHS=arm64 \
  73. -device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10 \
  74. -release \
  75. -opensource -confirm-license \
  76. -gui \
  77. -widgets \
  78. -no-gif \
  79. -no-icu \
  80. -no-pch \
  81. -no-angle \
  82. -no-opengl \
  83. -no-dbus \
  84. -no-harfbuzz \
  85. -skip declarative \
  86. -skip multimedia \
  87. -skip qtcanvas3d \
  88. -skip qtcharts \
  89. -skip qtconnectivity \
  90. -skip qtdeclarative \
  91. -skip qtgamepad \
  92. -skip qtlocation \
  93. -skip qtmultimedia \
  94. -skip qtnetworkauth \
  95. -skip qtpurchasing \
  96. -skip qtremoteobjects \
  97. -skip qtscript \
  98. -skip qtsensors \
  99. -skip qtserialbus \
  100. -skip qtserialport \
  101. -skip qtsvg \
  102. -skip qtwebchannel \
  103. -skip qtwebengine \
  104. -skip qtwebsockets \
  105. -skip qtxmlpatterns \
  106. -nomake examples \
  107. -nomake tests \
  108. -nomake tools
  109. # Some executables fail to link due to architecture mismatch.
  110. # Build what we can first.
  111. make -j 8 -k || true
  112. # Provide needed executables using the x86_64 variants.
  113. cp ../qt-5.9.9-x86_64/qtbase/bin/uic qtbase/bin/uic
  114. install_name_tool -add_rpath @executable_path/../../../qt-5.9.9-x86_64/qtbase/lib qtbase/bin/uic
  115. cp ../qt-5.9.9-x86_64/qtbase/bin/qlalr qtbase/bin/qlalr
  116. install_name_tool -add_rpath @executable_path/../../../qt-5.9.9-x86_64/qtbase/lib qtbase/bin/qlalr
  117. # Some parts still fail to build, but the parts we need can finish.
  118. make -j 8 -k || true
  119. cd ..
  120. # Combine the two builds into universal binaries.
  121. makeuniversal qt-5.9.9-univ qt-5.9.9-x86_64 qt-5.9.9-arm64
  122. cd qt-5.9.9-univ
  123. make install -j 8 INSTALL_ROOT=/tmp/qt-5.9.9-macosx10.10-x86_64-arm64
  124. cd ..
  125. # Create the final tarball containing universal binaries.
  126. tar cjf qt-5.9.9-macosx10.10-x86_64-arm64.tar.xz -C /tmp qt-5.9.9-macosx10.10-x86_64-arm64