feat(Makefile): add support for arch mips

Usage:
```sh
TARGET_OS=linux GOARCH=mipsle TARGET_MIPS=softfloat make cloudflared
```
This commit is contained in:
源文雨 2025-02-20 16:32:58 +09:00
parent d969fdec3e
commit 82ecc979de
2 changed files with 12 additions and 2 deletions

View File

@ -119,6 +119,11 @@ else
PACKAGE_ARCH := $(TARGET_ARCH)
endif
#basically for GOMIPS=softfloat
ifneq ($(TARGET_MIPS), )
MIPS_COMMAND := GOMIPS=$(TARGET_MIPS)
endif
#for FIPS compliance, FPM defaults to MD5.
RPM_DIGEST := --rpm-digest sha256
@ -134,7 +139,7 @@ cloudflared:
ifeq ($(FIPS), true)
$(info Building cloudflared with go-fips)
endif
GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) $(ARM_COMMAND) go build -mod=vendor $(GO_BUILD_TAGS) $(LDFLAGS) $(IMPORT_PATH)/cmd/cloudflared
GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) $(ARM_COMMAND) $(MIPS_COMMAND) go build -mod=vendor $(GO_BUILD_TAGS) $(LDFLAGS) $(IMPORT_PATH)/cmd/cloudflared
ifeq ($(FIPS), true)
./check-fips.sh cloudflared
endif

View File

@ -10,7 +10,7 @@ export CGO_ENABLED=0
export ARTIFACT_DIR=artifacts/
mkdir -p $ARTIFACT_DIR
linuxArchs=("386" "amd64" "arm" "armhf" "arm64")
linuxArchs=("386" "amd64" "arm" "armhf" "arm64" "mipsel")
export TARGET_OS=linux
for arch in ${linuxArchs[@]}; do
unset TARGET_ARM
@ -27,6 +27,11 @@ for arch in ${linuxArchs[@]}; do
export TARGET_ARCH=arm
export TARGET_ARM=7
fi
## Support for softmips builds
if [[ $arch == mipsel ]] ; then
export GOMIPS=softfloat
fi
make cloudflared-deb
mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb