Commit 6e802dc9 by Leonard Gram

build: builds armv6 with rpi1 compat gcc.

parent 35965e0e
......@@ -439,6 +439,15 @@ jobs:
name: Update RPM repository
command: './scripts/build/update_repo/update-rpm.sh "oss" "$GPG_KEY_PASSWORD" "$CIRCLE_TAG" "dist"'
store-build-artifacts:
docker:
- image: circleci/node:8
steps:
- attach_workspace:
at: .
- store_artifacts:
path: ./dist
workflows:
version: 2
build-master:
......@@ -572,3 +581,14 @@ workflows:
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- store-build-artifacts:
requires:
- build
- test-backend
- test-frontend
- codespell
- gometalinter
- mysql-integration-test
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
......@@ -48,6 +48,7 @@ var (
enterprise bool = false
skipRpmGen bool = false
skipDebGen bool = false
printGenVersion bool = false
)
func main() {
......@@ -71,6 +72,7 @@ func main() {
flag.BoolVar(&isDev, "dev", isDev, "optimal for development, skips certain steps")
flag.BoolVar(&skipRpmGen, "skipRpm", skipRpmGen, "skip rpm package generation (default: false)")
flag.BoolVar(&skipDebGen, "skipDeb", skipDebGen, "skip deb package generation (default: false)")
flag.BoolVar(&printGenVersion, "gen-version", printGenVersion, "generate Grafana version and output (default: false)")
flag.Parse()
buildId = shortenBuildId(buildIdRaw)
......@@ -81,6 +83,11 @@ func main() {
pkgArch = goarch
}
if printGenVersion {
printGeneratedVersion()
return
}
log.Printf("Version: %s, Linux Version: %s, Package Iteration: %s\n", version, linuxPackageVersion, linuxPackageIteration)
if flag.NArg() == 0 {
......@@ -221,6 +228,7 @@ func readVersionFromPackageJson() {
type linuxPackageOptions struct {
packageType string
packageArch string
homeDir string
binPath string
serverBinPath string
......@@ -241,14 +249,14 @@ type linuxPackageOptions struct {
}
func createDebPackages() {
previousPkgArch := pkgArch
if pkgArch == "armv7" {
pkgArch = "armhf"
} else if pkgArch == "armv6" {
pkgArch = "armel"
debPkgArch := pkgArch
if pkgArch == "armv7" || pkgArch == "armv6" {
debPkgArch = "armhf"
}
createPackage(linuxPackageOptions{
packageType: "deb",
packageArch: debPkgArch,
homeDir: "/usr/share/grafana",
binPath: "/usr/sbin",
configDir: "/etc/grafana",
......@@ -264,19 +272,19 @@ func createDebPackages() {
depends: []string{"adduser", "libfontconfig"},
})
pkgArch = previousPkgArch
}
func createRpmPackages() {
previousPkgArch := pkgArch
rpmPkgArch := pkgArch
switch {
case pkgArch == "armv7":
pkgArch = "armhfp"
rpmPkgArch = "armhfp"
case pkgArch == "arm64":
pkgArch = "aarch64"
rpmPkgArch = "aarch64"
}
createPackage(linuxPackageOptions{
packageType: "rpm",
packageArch: rpmPkgArch,
homeDir: "/usr/share/grafana",
binPath: "/usr/sbin",
configDir: "/etc/grafana",
......@@ -292,7 +300,6 @@ func createRpmPackages() {
depends: []string{"/sbin/service", "fontconfig", "freetype", "urw-fonts"},
})
pkgArch = previousPkgArch
}
func createLinuxPackages() {
......@@ -351,6 +358,10 @@ func createPackage(options linuxPackageOptions) {
name += "-enterprise"
args = append(args, "--replaces", "grafana")
}
fmt.Printf("pkgArch is set to '%s', generated arch is '%s'\n", pkgArch, options.packageArch)
if pkgArch == "armv6" {
name += "-rpi"
}
args = append(args, "--name", name)
description := "Grafana"
......@@ -371,8 +382,8 @@ func createPackage(options linuxPackageOptions) {
args = append(args, "--deb-no-default-config-files")
}
if pkgArch != "" {
args = append(args, "-a", pkgArch)
if options.packageArch != "" {
args = append(args, "-a", options.packageArch)
}
if linuxPackageIteration != "" {
......@@ -437,6 +448,16 @@ func setup() {
runPrint("go", "install", "-v", "./pkg/cmd/grafana-server")
}
func printGeneratedVersion() {
var genVersion string
if includeBuildId {
genVersion = fmt.Sprintf("%v-%v", linuxPackageVersion, linuxPackageIteration)
} else {
genVersion = version
}
fmt.Print(genVersion)
}
func test(pkg string) {
setBuildEnv()
runPrint("go", "test", "-short", "-timeout", "60s", pkg)
......
......@@ -8,6 +8,7 @@ set -e
EXTRA_OPTS="$@"
CCARMV6=/opt/rpi-tools/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
CCARMV7=arm-linux-gnueabihf-gcc
CCARM64=aarch64-linux-gnu-gcc
CCOSX64=/tmp/osxcross/target/bin/o64-clang
......@@ -29,10 +30,18 @@ else
fi
echo "Build arguments: $OPT"
echo "current dir: $(pwd)"
if [ -d "dist" ]; then
rm -rf dist
fi
mkdir dist
go run build.go -gen-version ${OPT} > dist/grafana.version
# build only amd64 for enterprise
if echo "$EXTRA_OPTS" | grep -vq enterprise ; then
go run build.go -goarch armv6 -cc ${CCARMV7} ${OPT} build
go run build.go -goarch armv6 -cc ${CCARMV6} ${OPT} build
go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
go run build.go -goos darwin -cc ${CCOSX64} ${OPT} build
......@@ -45,12 +54,6 @@ CC=${CCX64} go run build.go ${OPT} build
yarn install --pure-lockfile --no-progress
echo "current dir: $(pwd)"
if [ -d "dist" ]; then
rm -rf dist
fi
if [ "$CIRCLE_TAG" != "" ]; then
echo "Building frontend and packaging from tag $CIRCLE_TAG"
else
......
......@@ -8,6 +8,7 @@ set -e
EXTRA_OPTS="$@"
CCARMV6=/opt/rpi-tools/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
CCARMV7=arm-linux-gnueabihf-gcc
CCARM64=aarch64-linux-gnu-gcc
CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
......@@ -26,9 +27,18 @@ else
OPT="-buildId=${CIRCLE_WORKFLOW_ID} ${EXTRA_OPTS}"
fi
echo "Build arguments: $OPT"
echo "current dir: $(pwd)"
if [ -d "dist" ]; then
rm -rf dist
fi
mkdir dist
go run build.go -gen-version ${OPT} > dist/grafana.version
go run build.go -goarch armv6 -cc ${CCARMV7} ${OPT} build
go run build.go -goarch armv6 -cc ${CCARMV6} ${OPT} build
go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
......@@ -36,12 +46,6 @@ CC=${CCX64} go run build.go ${OPT} build
yarn install --pure-lockfile --no-progress
echo "current dir: $(pwd)"
if [ -d "dist" ]; then
rm -rf dist
fi
echo "Building frontend"
go run build.go ${OPT} build-frontend
......
......@@ -103,7 +103,8 @@ RUN apt-get update && \
| tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install --no-install-recommends yarn && \
curl -L https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz \
| tar -xz -C /usr/local
| tar -xz -C /usr/local && \
git clone https://github.com/raspberrypi/tools.git /opt/rpi-tools --depth=1
RUN apt-get install -y \
gcc libc-dev make && \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment