From 35594e3142afccc286f4218be2f06c7eeca50c44 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Sat, 6 Jan 2024 19:03:58 -0500 Subject: [PATCH] use prebuilt lua; ensure no homebrew deps (#10) --- .github/workflows/ci.yml | 30 +++++++----------------------- check-validity.sh | 12 ++++++++++++ scripts/lua.sh | 2 ++ scripts/rime.sh | 2 +- 4 files changed, 22 insertions(+), 24 deletions(-) create mode 100755 check-validity.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 268389a..0430c89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,45 +13,25 @@ jobs: fail-fast: false matrix: arch: [x86_64, arm64] - include: - - { arch: x86_64, homebrew_prefix: /usr/local } - - { arch: arm64, homebrew_prefix: /opt/homebrew } steps: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install dependencies (x86) - if: ${{ matrix.arch == 'x86_64' }} - run: | - brew install \ - extra-cmake-modules \ - lua \ - ninja - - - name: Setup arm homebrew - if: ${{ matrix.arch == 'arm64' }} - uses: fcitx-contrib/macos-cross@master - - - name: Install dependencies (arm) - if: ${{ matrix.arch == 'arm64' }} + - name: Install dependencies run: | brew install \ extra-cmake-modules \ ninja - arm-brew-install \ - gettext \ - lua - cp -f /usr/local/bin/msgfmt /opt/homebrew/bin + wget https://github.com/fcitx-contrib/fcitx5-macos-prebuilder/releases/download/latest/marisa-x86_64.tar.bz2 + tar xjvf marisa-x86_64.tar.bz2 -C /usr/local bin/marisa-build - name: Download and install Fcitx5.app run: | wget https://github.com/fcitx-contrib/fcitx5-macos/releases/download/latest/Fcitx5-${{ matrix.arch }}.dmg hdiutil attach Fcitx5-${{ matrix.arch }}.dmg sudo cp -r /Volumes/Fcitx5/{Fcitx5.app,"Input Methods"} - wget https://github.com/fcitx-contrib/fcitx5-macos-prebuilder/releases/download/latest/marisa-x86_64.tar.bz2 - tar xjvf marisa-x86_64.tar.bz2 -C /usr/local bin/marisa-build - name: Build all run: ./all.sh ${{ matrix.arch }} @@ -63,6 +43,10 @@ jobs: path: | build/*.tar.bz2 + - name: Check validity + if: ${{ matrix.arch == 'x86_64' }} + run: ./check-validity.sh + release: needs: build if: ${{ github.ref == 'refs/heads/master' }} diff --git a/check-validity.sh b/check-validity.sh new file mode 100755 index 0000000..71be8aa --- /dev/null +++ b/check-validity.sh @@ -0,0 +1,12 @@ +set -e + +has_homebrew_deps=0 + +for lib in $(find build -name '*.so'); do + if otool -L $lib | grep /usr/local; then + otool -L $lib + has_homebrew_deps=1 + fi +done + +exit $has_homebrew_deps diff --git a/scripts/lua.sh b/scripts/lua.sh index 6dd7cee..165aa40 100755 --- a/scripts/lua.sh +++ b/scripts/lua.sh @@ -1,6 +1,8 @@ set -e . ./common.sh lua $1 +install_deps lua + # Turning on dlopen produces wrong config.h, # and even fixed it will hard-code lua dylib path in code. f5m_configure -DENABLE_TEST=OFF -DUSE_DLOPEN=OFF diff --git a/scripts/rime.sh b/scripts/rime.sh index 9e85ee1..04167a4 100755 --- a/scripts/rime.sh +++ b/scripts/rime.sh @@ -6,7 +6,7 @@ rime_data_dir=$INSTALL_PREFIX/share/rime-data git reset --hard git apply ../patches/rime.patch -install_deps yaml-cpp leveldb marisa opencc glog librime +install_deps yaml-cpp leveldb marisa opencc glog librime lua # This value is only used to install fcitx5.yaml # and not used in rimeengine.cpp after patching