diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe59ce6..5dada64 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,13 +23,11 @@ jobs: - name: Clone and build po2lmo run: | - git clone https://github.com/openwrt-dev/po2lmo.git - cd po2lmo - make - cd .. - cp po2lmo/po2lmo ./po2lmo - chmod +x ./po2lmo rm -rf po2lmo + git clone https://github.com/openwrt-dev/po2lmo.git po2lmo-build + cd po2lmo-build + make + sudo make install - name: Build binaries run: | diff --git a/build.sh b/build.sh index 7f6182f..68527b4 100755 --- a/build.sh +++ b/build.sh @@ -8,7 +8,7 @@ set -e project_name="ua3f" -release_version="1.8.1" +release_version="1.8.2" target=main.go dist=./dist release_dir=./bin @@ -44,25 +44,25 @@ for target_item in $TARGET_LIST; do case "$goarch" in mipsle-softfloat) - GOOS=$goos GOARCH=mipsle GOMIPS=softfloat go build -trimpath -ldflags="-s -w" -o "$obj_name" "$target" + CGO_ENABLED=0 GOOS=$goos GOARCH=mipsle GOMIPS=softfloat go build -trimpath -ldflags="-s -w" -o "$obj_name" "$target" ;; mipsle-hardfloat) - GOOS=$goos GOARCH=mipsle GOMIPS=hardfloat go build -trimpath -ldflags="-s -w" -o "$obj_name" "$target" + CGO_ENABLED=0 GOOS=$goos GOARCH=mipsle GOMIPS=hardfloat go build -trimpath -ldflags="-s -w" -o "$obj_name" "$target" ;; armv7) - GOOS=$goos GOARCH=arm GOARM=7 go build -trimpath -ldflags="-s -w" -o "$obj_name" "$target" + CGO_ENABLED=0 GOOS=$goos GOARCH=arm GOARM=7 go build -trimpath -ldflags="-s -w" -o "$obj_name" "$target" ;; armv8) alias_name=$project_name-$release_version-${goos}-arm64 if [ ! -f "../dist/bin/$alias_name" ]; then echo ">>> Building $goos/arm64 (for armv8 alias)" - GOOS=$goos GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o "$alias_name" "$target" + CGO_ENABLED=0 GOOS=$goos GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o "$alias_name" "$target" cp "$alias_name" ../dist/bin/ fi cp "../dist/bin/$alias_name" "$obj_name" ;; *) - GOOS=$goos GOARCH="$goarch" go build -trimpath -ldflags="-s -w" -o "$obj_name" "$target" + CGO_ENABLED=0 GOOS=$goos GOARCH="$goarch" go build -trimpath -ldflags="-s -w" -o "$obj_name" "$target" ;; esac @@ -106,7 +106,7 @@ mkdir -p \ cp openwrt/files/ua3f.init $opkg_template/etc/init.d/ua3f cp openwrt/files/ua3f.uci $opkg_template/etc/config/ua3f cp -r openwrt/files/luci/* $opkg_template/usr/lib/lua/luci/ -./po2lmo openwrt/po/zh_cn/ua3f.po $opkg_template/usr/lib/lua/luci/i18n/ua3f.zh-cn.lmo +po2lmo openwrt/po/zh_cn/ua3f.po $opkg_template/usr/lib/lua/luci/i18n/ua3f.zh-cn.lmo # only build ipk for linux targets for target_item in $TARGET_LIST; do @@ -119,6 +119,8 @@ for target_item in $TARGET_LIST; do obj_name=$project_name-$release_version-${goos}-${goarch} [ -f "$dist/bin/$obj_name" ] || continue + echo ">>> Building IPK for $goos/$goarch ..." + mv "$dist/bin/$obj_name" $opkg_template/usr/bin/ua3f sh "$ipkg_build" "$opkg_template" mv "$project_name"_"$release_version"-1_all.ipk "$dist/$project_name"_"$release_version"-1_"${goos}_${goarch}".ipk diff --git a/ipkg-build.sh b/ipkg-build.sh index 0cba54d..ea0341c 100755 --- a/ipkg-build.sh +++ b/ipkg-build.sh @@ -12,13 +12,14 @@ set -e version=1.0 FIND="$(command -v find)" FIND="${FIND:-$(command -v gfind)}" -TAR="${TAR:-$(command -v gtar)}" +# Try gtar first (macOS), fall back to tar (Linux) +TAR="$(command -v gtar 2>/dev/null || command -v tar)" # try to use fixed source epoch if [ -n "$PKG_SOURCE_DATE_EPOCH" ]; then - TIMESTAMP=$(date --date="@$PKG_SOURCE_DATE_EPOCH") + TIMESTAMP=$(date --date="@$PKG_SOURCE_DATE_EPOCH" 2>/dev/null || date -r "$PKG_SOURCE_DATE_EPOCH") elif [ -n "$SOURCE_DATE_EPOCH" ]; then - TIMESTAMP=$(date --date="@$SOURCE_DATE_EPOCH") + TIMESTAMP=$(date --date="@$SOURCE_DATE_EPOCH" 2>/dev/null || date -r "$SOURCE_DATE_EPOCH") else TIMESTAMP=$(date) fi diff --git a/ipkg/CONTROL/control b/ipkg/CONTROL/control index 935753f..0a48387 100644 --- a/ipkg/CONTROL/control +++ b/ipkg/CONTROL/control @@ -1,5 +1,5 @@ Package: ua3f -Version: 1.8.1-1 +Version: 1.8.2-1 Depends: luci-compat, ipset, iptables, iptables-mod-tproxy, iptables-mod-extra, iptables-mod-nat-extra, kmod-ipt-conntrack, iptables-mod-ipopt, iptables-mod-nfqueue, iptables-mod-conntrack-extra, kmod-nf-conntrack-netlink Source: /feed/openwrt SourceName: UA3F diff --git a/ipkg/CONTROL/control-e b/ipkg/CONTROL/control-e index 935753f..0a48387 100644 --- a/ipkg/CONTROL/control-e +++ b/ipkg/CONTROL/control-e @@ -1,5 +1,5 @@ Package: ua3f -Version: 1.8.1-1 +Version: 1.8.2-1 Depends: luci-compat, ipset, iptables, iptables-mod-tproxy, iptables-mod-extra, iptables-mod-nat-extra, kmod-ipt-conntrack, iptables-mod-ipopt, iptables-mod-nfqueue, iptables-mod-conntrack-extra, kmod-nf-conntrack-netlink Source: /feed/openwrt SourceName: UA3F diff --git a/openwrt/Makefile b/openwrt/Makefile index 752559f..3e5a41b 100644 --- a/openwrt/Makefile +++ b/openwrt/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=UA3F -PKG_VERSION:=1.8.1 +PKG_VERSION:=1.8.2 PKG_RELEASE:=1 # PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/openwrt/files/luci/model/cbi/ua3f.lua b/openwrt/files/luci/model/cbi/ua3f.lua index 781980d..3db6128 100644 --- a/openwrt/files/luci/model/cbi/ua3f.lua +++ b/openwrt/files/luci/model/cbi/ua3f.lua @@ -6,7 +6,7 @@ local NamedSection = cbi.NamedSection local ua3f = cbi.Map("ua3f", "UA3F", [[ - Version: 1.8.1 + Version: 1.8.2
Across the Campus we can reach every corner in the world. ]] diff --git a/po2lmo b/po2lmo deleted file mode 100755 index 8b5e9ef..0000000 Binary files a/po2lmo and /dev/null differ diff --git a/src/main.go b/src/main.go index 6211b00..bb7fc1e 100644 --- a/src/main.go +++ b/src/main.go @@ -15,7 +15,7 @@ import ( "github.com/sunbk201/ua3f/internal/statistics" ) -const version = "1.8.1" +const version = "1.8.2" func main() { cfg, showVer := config.Parse()