使用 Lua 编写的轻量文本编辑器。
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.

59 lines
1.1 KiB

Cross compiling improvements + macOS universal binary (#1458) * chore(resources): rename macos_arm64.txt to macos-arm64.txt This matches the platform-arch convention like many other parts of the project. * chore(resources/cross): rename wasm.txt to unknown-wasm32.txt * refactor(scripts/common.sh): use parameter expansion instead of if else * feat(scripts/common.sh): support custom arch and platform for get_default_build_dir * feat(scripts/build.sh): add --cross-platform, --cross-arch and --cross-file * feat(scripts/package.sh): add --cross-platform and --cross-arch * feat(build-packages.sh): add support for new options in build.sh and packages.sh * ci(build): make arm64 binaries in CI * ci(build): do not install external libraries * ci(build): fix invalid artifact name * ci(build): fix INSTALL_NAME * ci(build): change name for macos artifacts * ci(build): add script to build universal dmgs from individual dmgs * ci(build): build universal dmgs * fix(make-universal-binaries): fix wrong path for hdiutil * ci(build): rename macos action * fix(make-universal-binaries.sh): fix wrong pathname for ditto * ci(release): build macos universal binaries * ci(release): remove useless variables * ci(release): fix wrong dependency * ci(build): fix old ubuntu version This version will be restored once I complete some container-specific fixes. * ci(build): make build_macos_universal depend on release * ci(build): fix wrong dmg dir * style(ci): capitalize 'universal' for CI name * fix(make-universal-binaries.sh): fix truncated dmg name when it contains dots * ci: styling changes * ci(release): install appdmg only
2 years ago
Cross compiling improvements + macOS universal binary (#1458) * chore(resources): rename macos_arm64.txt to macos-arm64.txt This matches the platform-arch convention like many other parts of the project. * chore(resources/cross): rename wasm.txt to unknown-wasm32.txt * refactor(scripts/common.sh): use parameter expansion instead of if else * feat(scripts/common.sh): support custom arch and platform for get_default_build_dir * feat(scripts/build.sh): add --cross-platform, --cross-arch and --cross-file * feat(scripts/package.sh): add --cross-platform and --cross-arch * feat(build-packages.sh): add support for new options in build.sh and packages.sh * ci(build): make arm64 binaries in CI * ci(build): do not install external libraries * ci(build): fix invalid artifact name * ci(build): fix INSTALL_NAME * ci(build): change name for macos artifacts * ci(build): add script to build universal dmgs from individual dmgs * ci(build): build universal dmgs * fix(make-universal-binaries): fix wrong path for hdiutil * ci(build): rename macos action * fix(make-universal-binaries.sh): fix wrong pathname for ditto * ci(release): build macos universal binaries * ci(release): remove useless variables * ci(release): fix wrong dependency * ci(build): fix old ubuntu version This version will be restored once I complete some container-specific fixes. * ci(build): make build_macos_universal depend on release * ci(build): fix wrong dmg dir * style(ci): capitalize 'universal' for CI name * fix(make-universal-binaries.sh): fix truncated dmg name when it contains dots * ci: styling changes * ci(release): install appdmg only
2 years ago
  1. #!/bin/bash
  2. set -e
  3. get_platform_name() {
  4. if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
  5. echo "windows"
  6. elif [[ "$OSTYPE" == "darwin"* ]]; then
  7. echo "darwin"
  8. elif [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* ]]; then
  9. echo "linux"
  10. else
  11. echo "UNSUPPORTED-OS"
  12. fi
  13. }
  14. get_executable_extension() {
  15. if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
  16. echo ".exe"
  17. else
  18. echo ""
  19. fi
  20. }
  21. get_platform_arch() {
  22. arch=${CROSS_ARCH:-$(uname -m)}
  23. if [[ $MSYSTEM != "" ]]; then
  24. case "$MSYSTEM" in
  25. MINGW64|UCRT64|CLANG64)
  26. arch=x86_64
  27. ;;
  28. MINGW32|CLANG32)
  29. arch=i686
  30. ;;
  31. CLANGARM64)
  32. arch=aarch64
  33. ;;
  34. esac
  35. fi
  36. [[ $arch == "arm64" ]] && arch="aarch64"
  37. echo "$arch"
  38. }
  39. get_platform_tuple() {
  40. platform="$(get_platform_name)"
  41. arch="$(get_platform_arch)"
  42. echo "$arch-$platform"
  43. }
  44. get_default_build_dir() {
  45. platform="${1:-$(get_platform_name)}"
  46. arch="${2:-$(get_platform_arch)}"
  47. echo "build-$arch-$platform"
  48. }
  49. if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then
  50. echo "Error: unknown OS type: \"$OSTYPE\""
  51. exit 1
  52. fi