Skip to content

Commit

Permalink
+ Arm 交叉编译
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Nov 28, 2021
1 parent cce107e commit 37594d3
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,37 @@ release: clean
hi:
echo ${VERSION}

.PHONY: arm
arm:
mkdir -p dist/release
git clone https://github.com/YaoApp/xiang dist/release
git clone https://github.com/YaoApp/kun dist/kun
git clone https://github.com/YaoApp/xun dist/xun
git clone https://github.com/YaoApp/gou dist/gou

# UI制品
git clone https://github.com/YaoApp/xiang-ui .tmp/ui
sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/ui/public/icon/md_icon.css
cd .tmp/ui && cnpm install && npm run build
rm -rf dist/release/ui
mv .tmp/ui/dist dist/release/ui

# 静态文件打包
mkdir -p .tmp/data
cp -r dist/release/ui .tmp/data/
cp -r dist/release/xiang .tmp/data/
go-bindata -fs -pkg data -o dist/release/data/bindata.go -prefix ".tmp/data/" .tmp/data/...
rm -rf .tmp/data
rm -rf .tmp/ui

# 制品
mkdir -p dist
CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 go build -v -o ../../.tmp/xiang-${VERSION}-linux-arm

rm -rf dist/release
mkdir -p dist/release
mv .tmp/xiang-*-* dist/release/
chmod +x dist/release/xiang-*-*

.PHONY: clean
clean:
Expand Down
20 changes: 20 additions & 0 deletions docker/ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# version cat /etc/issue
apt-get update
apt-get -y install curl vim git iputils-ping build-essential gcc-arm-linux-gnueabi

# Install Go
cd /usr/local && tar xvfz /code/xiang/docker/go1.17.3.linux-amd64.tar.gz
ln -s /usr/local/go/bin/go /usr/local/bin/go
ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt

# Install Node

export GO111MODULE="on"
export GOPATH="/root/go"
export GOPROXY="https://goproxy.cn"
export http_proxy="socks5://192.168.199.178:1080"
export https_proxy="socks5://192.168.199.178:1080"
export NODE_OPTIONS="--max-old-space-size=5120"

export PATH=~/go/bin:$PATH

0 comments on commit 37594d3

Please sign in to comment.