cross compiling Makefile

pull/585/head
hunterlong 2020-05-11 13:17:56 -07:00
parent 68ab5fed19
commit 3e724ccb04
5 changed files with 79 additions and 18 deletions

View File

@ -237,6 +237,11 @@ jobs:
go-version: '1.14.2'
- uses: actions/checkout@v2
- name: Install cross compiling libraries
run: sudo apt-get install libc6-armel-cross libc6-dev-armel-cross \
binutils-arm-linux-gnueabi libncurses5-dev gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf gcc-arm-linux-gnueabi g++-arm-linux-gnueabi -y
- name: Install Libraries
run: |
sudo apt update

View File

@ -151,16 +151,62 @@ install-local: build
generate:
cd source && go generate
# cross compile build for darwin, windows, linux, and ARM archictures.
build-bins: build-folders
GO111MODULE="on" GOOS=windows GOARCH=amd64 go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-amd64/statping.exe ./cmd
GO111MODULE="on" GOOS=windows GOARCH=386 go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-windows-amd64/statping.exe ./cmd
GO111MODULE="on" GOOS=darwin GOARCH=amd64 go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-darwin-amd64/statping ./cmd
GO111MODULE="on" GOOS=darwin GOARCH=386 go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-darwin-386/statping ./cmd
GO111MODULE="on" GOOS=linux GOARCH=amd64 go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-amd64/statping ./cmd
GO111MODULE="on" GOOS=linux GOARCH=386 go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-386/statping ./cmd
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ GO111MODULE="on" GOOS=linux GOARCH=arm GOARM=7 go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm/statping ./cmd
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ GO111MODULE="on" GOOS=linux GOARCH=arm64 GOARM=8 go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-arm64/statping ./cmd
build-folders:
mkdir build || true
for os in windows darwin linux;\
do \
for arch in 386 amd64 arm arm64;\
do \
mkdir -p releases/statping-$$os-$$arch/; \
done \
done
compress-folders:
mkdir build || true
for os in darwin linux;\
do \
for arch in 386 amd64 arm arm64;\
do \
chmod +x releases/statping-$$os-$$arch/statping || true; \
tar -czf releases/statping-$$os-$$arch.tar.gz -C releases/statping-$$os-$$arch statping || true; \
done \
done
chmod +x releases/statping-windows-386/statping.exe || true
chmod +x releases/statping-windows-amd64/statping.exe || true
zip -j releases/statping-windows-386.zip releases/statping-windows-386/statping.exe || true; \
zip -j releases/statping-windows-amd64.zip releases/statping-windows-amd64/statping.exe || true; \
find ./releases/ -name "*.tar.gz" -type f -size +1M -exec mv "{}" build/ \;
find ./releases/ -name "*.zip" -type f -size +1M -exec mv "{}" build/ \;
build-linux:
mkdir build || true
export PWD=`pwd`
@for arch in $(ARCHS);\
@for arch in 386 amd64;\
do \
echo "Building v${VERSION} for linux-$$arch"; \
mkdir -p releases/statping-$$os-$$arch/; \
GO111MODULE="on" GOOS=$$os GOARCH=$$arch go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-$$os-$$arch/statping ${PWD}/cmd || true; \
chmod +x releases/statping-$$os-$$arch/statping || true; \
tar -czf releases/statping-$$os-$$arch.tar.gz -C releases/statping-$$os-$$arch statping || true; \
mkdir -p releases/statping-linux-$$arch/; \
GO111MODULE="on" GOOS=linux GOARCH=$$arch go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-$$arch/statping ${PWD}/cmd || true; \
chmod +x releases/statping-linux-$$arch/statping || true; \
tar -czf releases/statping-linux-$$arch.tar.gz -C releases/statping-linux-$$arch statping || true; \
done
@for arch in arm arm64;\
do \
echo "Building v${VERSION} for linux-$$arch"; \
mkdir -p releases/statping-linux-$$arch/; \
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ GO111MODULE="on" GOOS=linux GOARCH=$$arch go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o releases/statping-linux-$$arch/statping ${PWD}/cmd || true; \
chmod +x releases/statping-linux-$$arch/statping || true; \
tar -czf releases/statping-linux-$$arch.tar.gz -C releases/statping-linux-$$arch statping || true; \
done
find ./releases/ -name "*.tar.gz" -type f -size +1M -exec mv "{}" build/ \;

View File

@ -7,6 +7,8 @@ const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const helpers = require('./helpers');
const commonConfig = require('./webpack.config.common');
const environment = require('./dev.env');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const webpackConfig = merge(commonConfig, {
mode: 'development',
@ -29,9 +31,12 @@ const webpackConfig = merge(commonConfig, {
new webpack.EnvironmentPlugin(environment),
new webpack.HotModuleReplacementPlugin(),
new FriendlyErrorsPlugin(),
new HtmlPlugin({
template: 'public/index.html',
})
new HtmlPlugin({
template: 'public/index.html',
}),
new BundleAnalyzerPlugin({
analyzerPort: 9090
})
],
devServer: {
compress: true,

View File

@ -94,7 +94,7 @@
"vue-template-compiler": "~2.6",
"wait-on": "^4.0.1",
"webpack": "~4.29",
"webpack-bundle-analyzer": "~3.3",
"webpack-bundle-analyzer": "^3.7.0",
"webpack-cli": "~3.2",
"webpack-dev-server": "~3.1",
"webpack-hot-middleware": "~2.24",

View File

@ -2153,7 +2153,7 @@ acorn-walk@^6.0.1, acorn-walk@^6.1.1:
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c"
integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==
acorn-walk@^7.0.0:
acorn-walk@^7.0.0, acorn-walk@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.1.1.tgz#345f0dffad5c735e7373d2fec9a1023e6a44b83e"
integrity sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==
@ -2168,6 +2168,11 @@ acorn@^7.1.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf"
integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==
acorn@^7.1.1:
version "7.2.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.2.0.tgz#17ea7e40d7c8640ff54a694c889c26f31704effe"
integrity sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==
address@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/address/-/address-1.1.2.tgz#bf1116c9c758c51b7a933d296b72c221ed9428b6"
@ -7343,7 +7348,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
lodash@4.17.15, lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@~4.17.12:
lodash@4.17.15, lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@~4.17.12:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
@ -12048,13 +12053,13 @@ webpack-bundle-analyzer@^3.6.0:
opener "^1.5.1"
ws "^6.0.0"
webpack-bundle-analyzer@~3.3:
version "3.3.2"
resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-3.3.2.tgz#3da733a900f515914e729fcebcd4c40dde71fc6f"
integrity sha512-7qvJLPKB4rRWZGjVp5U1KEjwutbDHSKboAl0IfafnrdXMrgC0tOtZbQD6Rw0u4cmpgRN4O02Fc0t8eAT+FgGzA==
webpack-bundle-analyzer@^3.7.0:
version "3.7.0"
resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-3.7.0.tgz#84da434e89442899b884d9ad38e466d0db02a56f"
integrity sha512-mETdjZ30a3Yf+NTB/wqTgACK7rAYQl5uxKK0WVTNmF0sM3Uv8s3R58YZMW7Rhu0Lk2Rmuhdj5dcH5Q76zCDVdA==
dependencies:
acorn "^6.0.7"
acorn-walk "^6.1.1"
acorn "^7.1.1"
acorn-walk "^7.1.1"
bfj "^6.1.1"
chalk "^2.4.1"
commander "^2.18.0"
@ -12062,7 +12067,7 @@ webpack-bundle-analyzer@~3.3:
express "^4.16.3"
filesize "^3.6.1"
gzip-size "^5.0.0"
lodash "^4.17.10"
lodash "^4.17.15"
mkdirp "^0.5.1"
opener "^1.5.1"
ws "^6.0.0"