build script improvements

Esse commit está contido em:
Felix Geisendörfer
2013-12-25 19:06:56 +01:00
commit 2a49321909
3 arquivos alterados com 29 adições e 3 exclusões
+19 -3
Ver Arquivo
@@ -1,10 +1,21 @@
#!/usr/bin/env bash
# build.bash [-arch <arch>] [-os <os>] [-version <version>] <path>
#
# - creates an empty folder at the given path
# - compile the http assets into a .go file using makefs
# - compile the deploy binary (installer) for the target platform
# - compile godrone for linux/arm
# - include the start.sh script, the license file, and the config file
set -eu
main() {
local scripts_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
local root_dir="$( cd "${scripts_dir}"/.. && pwd )"
local base_pkg='github.com/felixge/godrone'
local godrone_pkg="${base_pkg}/cmd/godrone"
local deploy_pkg="${base_pkg}/cmd/deploy"
local arch="$(go env GOARCH)"
local os="$(go env GOOS)"
local ldflags=''
@@ -39,11 +50,16 @@ main() {
rm -rf "${out_dir}"
mkdir -p "${out_dir}"
makefs "${root_dir}/http/fs"
# used to create .go file from http assets
go get github.com/felixge/makefs/cmd/makefs
go get "${godrone_pkg}"
go get "${deploy_pkg}"
TMPDIR="${scripts_dir}" makefs "${root_dir}/http/fs"
env \
GOOS="${os}" \
GOARCH="${arch}" \
go build -o "${out_dir}/${deploy_name}" "${base_pkg}/cmd/deploy"
go build -o "${out_dir}/${deploy_name}" "${deploy_pkg}"
env \
GOOS=linux \
GOARCH=arm \
@@ -52,7 +68,7 @@ main() {
go build \
-o "${out_dir}/godrone" \
-ldflags "${ldflags}" \
"${base_pkg}/cmd/godrone"
"${godrone_pkg}"
cp "${scripts_dir}/start.sh" "${out_dir}"
cp "${root_dir}/LICENSE.txt" "${out_dir}"
cp "${root_dir}/cmd/godrone/godrone.conf" "${out_dir}"
+4
Ver Arquivo
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
set -eu
# dist.bash <version>
#
# Creates archive files ready for distribution for all selected platforms.
main() {
local version="$1"
local scripts_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+6
Ver Arquivo
@@ -1,4 +1,10 @@
#!/bin/sh
# start.sh
#
# Moves a newly uploaded godrone.next folder to its final location, then starts
# the godrone binary inside of it.
set -eu
src_dir="$(pwd)"