From c2d37283983a99f8a0603457e1f7490fef8e7fc2 Mon Sep 17 00:00:00 2001 From: Hintay Date: Tue, 5 Jul 2022 17:28:09 +0800 Subject: [PATCH 1/2] Added Github Action supports for ARMv5 and ARMv7. --- .github/build/build_info.json | 13 ++++++++++++ .github/build/compiler_arch.json | 5 ----- .github/workflows/build.yml | 36 +++++++++++++++++++++----------- 3 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 .github/build/build_info.json delete mode 100644 .github/build/compiler_arch.json diff --git a/.github/build/build_info.json b/.github/build/build_info.json new file mode 100644 index 00000000..1722e81c --- /dev/null +++ b/.github/build/build_info.json @@ -0,0 +1,13 @@ +{ + "linux": { + "386": {"arch": "i686", "name": "linux-32"}, + "amd64": {"arch": "x86_64", "name": "linux-64"}, + "arm5": {"arch": "arm", "abi": "eabi", "name": "linux-arm32-v5"}, + "arm7": {"arch": "armv7l", "abi": "eabihf", "name": "linux-arm32-v7a"}, + "arm64": {"arch": "aarch64", "name": "linux-arm64-v8a"} + }, + "darwin": { + "amd64": {"arch": "o64", "name": "macos-64"}, + "arm64": {"arch": "oa64", "name": "macos-arm64-v8a"} + } +} \ No newline at end of file diff --git a/.github/build/compiler_arch.json b/.github/build/compiler_arch.json deleted file mode 100644 index 0b944697..00000000 --- a/.github/build/compiler_arch.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "386": {"linux": "i686"}, - "amd64": {"linux": "x86_64", "darwin": "o64"}, - "arm64": {"linux": "aarch64", "darwin": "oa64"} -} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50978a06..447ec9e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,13 +84,20 @@ jobs: # Exclude i386 on darwin. - goarch: 386 goos: darwin + include: + # BEGIN Linux ARM 5 7 + - goos: linux + goarch: arm + goarm: 7 + - goos: linux + goarch: arm + goarm: 5 + # END Linux ARM 5 7 env: CGO_ENABLED: 1 GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} - DIST: nginx-ui-${{ matrix.GOOS }}-${{ matrix.GOARCH }} - outputs: - dist: ${{ env.DIST }} + GOARM: ${{ matrix.goarm }} steps: - name: Checkout uses: actions/checkout@v2 @@ -106,29 +113,34 @@ jobs: path: | ~/.cache/go-build ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}-go-${{ hashFiles('**/go.sum') }} + key: ${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}-go- + ${{ runner.os }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}-go- - name: Setup compiler environment id: info run: | - export _ARCH=$(jq ".[\"$GOARCH\"].$GOOS" -r < .github/build/compiler_arch.json) - echo "::set-output name=ARCH_NAME::$_ARCH" + export _NAME=nginx-ui-$(jq ".$GOOS[\"$GOARCH$GOARM\"].name" -r < .github/build/build_info.json) + export _ARCH=$(jq ".$GOOS[\"$GOARCH$GOARM\"].arch" -r < .github/build/build_info.json) + export _ABI=$(jq ".$GOOS[\"$GOARCH$GOARM\"].abi // \"\"" -r < .github/build/build_info.json) + echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, ABI: $_ABI, RELEASE_NAME: $_NAME" + echo "ARCH_NAME=$_ARCH" >> $GITHUB_ENV + echo "ABI=$_ABI" >> $GITHUB_ENV + echo "DIST=$_NAME" >> $GITHUB_ENV - name: Install musl cross compiler if: env.GOOS == 'linux' uses: Lesmiscore/musl-cross-compilers@v0.5 id: musl with: - target: ${{ steps.info.outputs.ARCH_NAME }}-linux-musl + target: ${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }} - name: Post install musl cross compiler if: env.GOOS == 'linux' run: | echo "PATH=${{ steps.musl.outputs.path }}:$PATH" >> $GITHUB_ENV - echo "CC=${{ steps.info.outputs.ARCH_NAME }}-linux-musl-gcc" >> $GITHUB_ENV - echo "CXX=${{ steps.info.outputs.ARCH_NAME }}-linux-musl-g++" >> $GITHUB_ENV + echo "CC=${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}-gcc" >> $GITHUB_ENV + echo "CXX=${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}-g++" >> $GITHUB_ENV echo "LD_FLAGS=--extldflags '-static'" >> $GITHUB_ENV - name: Install darwin cross compiler @@ -138,8 +150,8 @@ jobs: tar xvaf crossosx.tar.zst echo "LD_LIBRARY_PATH=$(pwd)/crossosx/lib/" >> $GITHUB_ENV echo "PATH=$(pwd)/crossosx/bin/:$PATH" >> $GITHUB_ENV - echo "CC=${{ steps.info.outputs.ARCH_NAME }}-clang" >> $GITHUB_ENV - echo "CXX=${{ steps.info.outputs.ARCH_NAME }}-clang++" >> $GITHUB_ENV + echo "CC=${{ env.ARCH_NAME }}-clang" >> $GITHUB_ENV + echo "CXX=${{ env.ARCH_NAME }}-clang++" >> $GITHUB_ENV echo "LD_FLAGS=-s -w" >> $GITHUB_ENV - name: Download frontend artifacts From 1c7dbfe63a332e53502c7232fc2a89b5cd72d833 Mon Sep 17 00:00:00 2001 From: Hintay Date: Tue, 5 Jul 2022 19:45:09 +0800 Subject: [PATCH 2/2] Updated install scripts and added ARMv6 supports. --- .github/build/build_info.json | 1 + .github/workflows/build.yml | 7 +++++-- README-zh_CN.md | 2 +- README-zh_TW.md | 2 +- README.md | 2 +- install.sh | 17 ++++++++++++++--- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/build/build_info.json b/.github/build/build_info.json index 1722e81c..11347ccb 100644 --- a/.github/build/build_info.json +++ b/.github/build/build_info.json @@ -3,6 +3,7 @@ "386": {"arch": "i686", "name": "linux-32"}, "amd64": {"arch": "x86_64", "name": "linux-64"}, "arm5": {"arch": "arm", "abi": "eabi", "name": "linux-arm32-v5"}, + "arm6": {"arch": "armv5l", "abi": "eabihf", "name": "linux-arm32-v6"}, "arm7": {"arch": "armv7l", "abi": "eabihf", "name": "linux-arm32-v7a"}, "arm64": {"arch": "aarch64", "name": "linux-arm64-v8a"} }, diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 447ec9e3..e990da44 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,14 +85,17 @@ jobs: - goarch: 386 goos: darwin include: - # BEGIN Linux ARM 5 7 + # BEGIN Linux ARM 5 6 7 - goos: linux goarch: arm goarm: 7 + - goos: linux + goarch: arm + goarm: 6 - goos: linux goarch: arm goarm: 5 - # END Linux ARM 5 7 + # END Linux ARM 5 6 7 env: CGO_ENABLED: 1 GOOS: ${{ matrix.goos }} diff --git a/README-zh_CN.md b/README-zh_CN.md index 5b222580..2e5a2bc3 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -107,7 +107,7 @@ Nginx UI 遵循 Nginx 的标准,创建的网站配置文件位于 Nginx 配置 Nginx UI 可在以下平台中使用: - Mac OS X 10.10 Yosemite 及之后版本(amd64 / arm64) -- Linux 2.6.23 及之后版本(x86 / amd64 / arm64) +- Linux 2.6.23 及之后版本(x86 / amd64 / arm64 / armv5 / armv6 / armv7) - 包括但不限于 Debian 7 / 8、Ubuntu 12.04 / 14.04 及后续版本、CentOS 6 / 7、Arch Linux - FreeBSD (x86 / amd64) - OpenBSD (x86 / amd64) diff --git a/README-zh_TW.md b/README-zh_TW.md index c61ef853..2bbd5a04 100644 --- a/README-zh_TW.md +++ b/README-zh_TW.md @@ -107,7 +107,7 @@ Nginx UI 遵循 Nginx 的標準,建立的網站配置檔案位於 Nginx 配置 Nginx UI 可在以下平臺中使用: - Mac OS X 10.10 Yosemite 及之後版本(amd64 / arm64) -- Linux 2.6.23 及之後版本(x86 / amd64 / arm64) +- Linux 2.6.23 及之後版本(x86 / amd64 / arm64 / armv5 / armv6 / armv7) - 包括但不限於 Debian 7 / 8、Ubuntu 12.04 / 14.04 及後續版本、CentOS 6 / 7、Arch Linux - FreeBSD (x86 / amd64) - OpenBSD (x86 / amd64) diff --git a/README.md b/README.md index 90f1d9e8..78dd4b3b 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ to the `sites-enabled` directory. Therefore, you may need to adjust the way the Nginx UI is available on the following platforms: - Mac OS X 10.10 Yosemite and later (amd64 / arm64) -- Linux 2.6.23 and later (x86 / amd64 / arm64) +- Linux 2.6.23 and later (x86 / amd64 / arm64 / armv5 / armv6 / armv7) - Including but not limited to Debian 7 / 8, Ubuntu 12.04 / 14.04 and later, CentOS 6 / 7, Arch Linux - FreeBSD (x86 / amd64) - OpenBSD (x86 / amd64) diff --git a/install.sh b/install.sh index 20ebc985..bcc81d90 100644 --- a/install.sh +++ b/install.sh @@ -134,13 +134,24 @@ identify_the_operating_system_and_architecture() { if [[ "$(uname)" == 'Linux' ]]; then case "$(uname -m)" in 'i386' | 'i686') - MACHINE='386' + MACHINE='32' ;; 'amd64' | 'x86_64') - MACHINE='amd64' + MACHINE='64' + ;; + 'armv5tel') + MACHINE='arm32-v5' + ;; + 'armv6l') + MACHINE='arm32-v6' + grep Features /proc/cpuinfo | grep -qw 'vfp' || MACHINE='arm32-v5' + ;; + 'armv7' | 'armv7l') + MACHINE='arm32-v7a' + grep Features /proc/cpuinfo | grep -qw 'vfp' || MACHINE='arm32-v5' ;; 'armv8' | 'aarch64') - MACHINE='arm64' + MACHINE='arm64-v8a' ;; *) echo -e "${FontRed}error: The architecture is not supported.${FontSuffix}"