mirror of
https://github.com/openziti/zrok.git
synced 2024-12-23 23:29:22 +01:00
switch 32bit release to armhf dynamically linked
This commit is contained in:
parent
477edd503c
commit
a60c0bfab3
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -159,7 +159,7 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- run: sudo apt update
|
||||
- run: sudo apt-get install gcc-arm-linux-gnueabi
|
||||
- run: sudo apt-get install gcc-arm-linux-gnueabihf
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
144
.goreleaser-linux-armel.yml
Normal file
144
.goreleaser-linux-armel.yml
Normal file
@ -0,0 +1,144 @@
|
||||
# this is a DiY build config for the soft-float, armel platform (32bit ARMv7 devices lacking an FPU) see
|
||||
# instructions to cross-build this binary in ./docker/images/cross-build/README.md or
|
||||
# https://github.com/openziti/zrok/tree/main/docker/images/cross-build#readme
|
||||
version: 2
|
||||
builds:
|
||||
- id: zrok-armel
|
||||
main: ./cmd/zrok
|
||||
binary: zrok
|
||||
ldflags:
|
||||
- "-s -w -X github.com/openziti/zrok/build.Version={{.Tag}} -X github.com/openziti/zrok/build.Hash={{.ShortCommit}}"
|
||||
env:
|
||||
- CC=arm-linux-gnueabi-gcc
|
||||
- CGO_ENABLED=1
|
||||
- CC_FOR_TARGET=gcc-arm-linux-gnueabi
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- arm
|
||||
goarm:
|
||||
- 7
|
||||
|
||||
nfpms:
|
||||
- package_name: zrok
|
||||
id: zrok-cli
|
||||
vendor: NetFoundry
|
||||
homepage: https://zrok.io/
|
||||
maintainer: support@zrok.io
|
||||
description: |-
|
||||
zrok is a next-generation sharing platform, designed to make sharing network and file resources simple and
|
||||
secure.
|
||||
license: Apache 2.0
|
||||
|
||||
# Build IDs for the builds you want to create NFPM packages for.
|
||||
builds:
|
||||
- zrok-armel
|
||||
|
||||
# Formats to be generated.
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
|
||||
# {{ .ConventionalFileName }} satisfies the RPM name convention.
|
||||
file_name_template: "{{ .ConventionalFileName }}"
|
||||
|
||||
# Umask to be used on files without explicit mode set. (overridable)
|
||||
umask: 0o002
|
||||
|
||||
# Package version within this release version.
|
||||
release: 1
|
||||
|
||||
# Section.
|
||||
section: default
|
||||
|
||||
# Priority.
|
||||
priority: optional
|
||||
|
||||
# GoReleaser will automatically add the binaries here
|
||||
bindir: /opt/openziti/bin
|
||||
|
||||
# Contents to add to the package.
|
||||
contents:
|
||||
- src: /opt/openziti/bin/zrok
|
||||
dst: /usr/bin/zrok
|
||||
type: "symlink"
|
||||
|
||||
- package_name: zrok-share
|
||||
id: zrok-share
|
||||
vendor: NetFoundry
|
||||
homepage: https://zrok.io/
|
||||
maintainer: support@zrok.io
|
||||
description: |-
|
||||
This package provides zrok-share.service. To enable, edit the "/opt/openziti/etc/zrok/zrok-share.env" file with the
|
||||
desired target for sharing, and run "systemctl enable --now zrok-share.service".
|
||||
license: Apache 2.0
|
||||
|
||||
# do not bundle the built binaries, only supporting files
|
||||
meta: true
|
||||
|
||||
# Formats to be generated.
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
|
||||
# {{ .ConventionalFileName }} satisfies the RPM name convention.
|
||||
file_name_template: "{{ .ConventionalFileName }}"
|
||||
|
||||
# Umask to be used on files without explicit mode set. (overridable)
|
||||
umask: 0o002
|
||||
|
||||
# Package version within this release version.
|
||||
release: 1
|
||||
|
||||
# Section.
|
||||
section: default
|
||||
|
||||
# Priority.
|
||||
priority: optional
|
||||
|
||||
# GoReleaser will automatically add the binaries here
|
||||
dependencies:
|
||||
- zrok
|
||||
|
||||
# this allows users to satisfy the requirement for jq another way, not with the package manager, e.g.
|
||||
# apt install --no-recommends zrok-share
|
||||
recommends:
|
||||
- jq
|
||||
|
||||
overrides:
|
||||
# yum and dnf do not automatically install "weak deps" aka "recommends", so we need to add them as a dependency
|
||||
rpm:
|
||||
dependencies:
|
||||
- zrok
|
||||
- jq
|
||||
|
||||
# Contents to add to the package.
|
||||
contents:
|
||||
- dst: /lib/systemd/system/
|
||||
src: ./nfpm/zrok-share.service
|
||||
|
||||
- dst: /etc/systemd/system/zrok-share.service.d/override.conf
|
||||
src: ./nfpm/zrok-share.service.override.conf
|
||||
|
||||
- dst: /opt/openziti/etc/zrok
|
||||
type: dir
|
||||
file_info:
|
||||
mode: 0755
|
||||
|
||||
- dst: /opt/openziti/bin/
|
||||
src: ./nfpm/zrok-share.bash
|
||||
file_info:
|
||||
mode: 0755
|
||||
|
||||
- dst: /opt/openziti/bin/
|
||||
src: ./nfpm/zrok-enable.bash
|
||||
file_info:
|
||||
mode: 0755
|
||||
|
||||
- dst: /opt/openziti/etc/zrok/
|
||||
src: ./nfpm/zrok-share.env
|
||||
type: config|noreplace
|
||||
|
||||
- dst: /opt/openziti/etc/zrok/
|
||||
src: ./etc/caddy/multiple_upstream.Caddyfile
|
||||
type: config|noreplace
|
@ -1,15 +1,15 @@
|
||||
# this is the release build config for hard-float, arm/v7 platform (32bit ARM devices with a FPU)
|
||||
version: 2
|
||||
builds:
|
||||
- id: zrok-armv7
|
||||
- id: zrok-armhf
|
||||
main: ./cmd/zrok
|
||||
binary: zrok
|
||||
ldflags:
|
||||
- '-extldflags "-static"'
|
||||
- "-s -w -X github.com/openziti/zrok/build.Version={{.Tag}} -X github.com/openziti/zrok/build.Hash={{.ShortCommit}}"
|
||||
env:
|
||||
- CC=arm-linux-gnueabi-gcc
|
||||
- CC=arm-linux-gnueabihf-gcc
|
||||
- CGO_ENABLED=1
|
||||
- CC_FOR_TARGET=gcc-arm-linux-gnueabi
|
||||
- CC_FOR_TARGET=gcc-arm-linux-gnueabihf
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
@ -30,7 +30,7 @@ nfpms:
|
||||
|
||||
# Build IDs for the builds you want to create NFPM packages for.
|
||||
builds:
|
||||
- zrok-armv7
|
||||
- zrok-armhf
|
||||
|
||||
# Formats to be generated.
|
||||
formats:
|
||||
|
@ -17,6 +17,7 @@ ARG go_cache=/usr/share/go
|
||||
RUN apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
gcc-arm-linux-gnueabi \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
gcc-aarch64-linux-gnu \
|
||||
wget \
|
||||
git \
|
||||
|
@ -1,21 +1,15 @@
|
||||
|
||||
# Cross-build Container for Building the Linux Executables for this zrok Project
|
||||
|
||||
Running this container produces three executables for zrok, one for each platform architecture: amd64, arm, arm64. You may specify the target CPU architecture as a parameter to the `docker run` command.
|
||||
Running this container produces one snapshot executable for zrok from the current checkout, even if dirty. Platform choices are: `amd64`, `arm64`, `arm` (the arm/v7 "armhf" ABI target), and `armel` (the arm/v7 "armel" ABI). You may specify the target architecture as a parameter to the `docker run` command.
|
||||
|
||||
## Build the Container Image
|
||||
|
||||
You only need to build the container image once unless you change the Dockerfile or `./linux-build.sh`.
|
||||
|
||||
```bash
|
||||
# build a container image named "zrok-builder" with the same version of Go that's declared in go.mod
|
||||
docker buildx build \
|
||||
--tag=zrok-builder \
|
||||
--build-arg uid=$UID \
|
||||
--build-arg gid=$GID \
|
||||
--build-arg golang_version=$(grep -Po '^go\s+\K\d+\.\d+(\.\d+)?$' go.mod) \
|
||||
--load \
|
||||
./docker/images/cross-build/
|
||||
# build a container image named "zrok-builder"
|
||||
docker buildx build -t zrok-builder ./docker/images/cross-build --load;
|
||||
```
|
||||
|
||||
## Run the Container to Build Executables for the Desired Architectures
|
||||
@ -24,23 +18,11 @@ Executing the following `docker run` command will:
|
||||
|
||||
1. Mount the top-level of this repo on the container's `/mnt`
|
||||
2. Run `linux-build.sh ${@}` inside the container
|
||||
3. Deposit built executables in `./dist/`
|
||||
3. Deposit built executable in `./dist/`
|
||||
|
||||
```bash
|
||||
# build for all three architectures: amd64 arm arm64
|
||||
docker run \
|
||||
--rm \
|
||||
--name=zrok-builder \
|
||||
--volume=$PWD:/mnt \
|
||||
zrok-builder
|
||||
|
||||
# build only amd64
|
||||
docker run \
|
||||
--rm \
|
||||
--name=zrok-builder \
|
||||
--volume=$PWD:/mnt \
|
||||
zrok-builder \
|
||||
amd64
|
||||
# cross-build for arm64/aarch64 architecture on Linux
|
||||
docker run --user "${UID}" --rm --volume=${HOME}/.cache/go-build:/usr/share/go --volume "${PWD}:/mnt" zrok-builder arm64
|
||||
```
|
||||
|
||||
You will find the built artifacts in `./dist/`.
|
||||
|
@ -1,10 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# build the Linux artifacts for amd64, arm, arm64
|
||||
# build the Linux artifact for amd64, armhf, armel, or arm64
|
||||
#
|
||||
# runs one background job per desired architecture unless there are too few CPUs
|
||||
#
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
@ -13,7 +10,7 @@ set -o xtrace
|
||||
|
||||
resolveArch() {
|
||||
case ${1} in
|
||||
arm|armv7*|arm/v7*|armhf*) echo armhf
|
||||
arm|armv7*|arm/v7*) echo armhf
|
||||
;;
|
||||
armv8*|arm/v8*) echo arm64
|
||||
;;
|
||||
@ -22,11 +19,11 @@ resolveArch() {
|
||||
esac
|
||||
}
|
||||
|
||||
# if no architectures supplied then default list of three
|
||||
# if no architectures supplied then default to amd64
|
||||
if (( ${#} )); then
|
||||
typeset -a JOBS=(${@})
|
||||
else
|
||||
typeset -a JOBS=(amd64 arm arm64)
|
||||
typeset -a JOBS=(amd64)
|
||||
fi
|
||||
|
||||
(
|
||||
@ -43,7 +40,7 @@ for ARCH in "${JOBS[@]}"; do
|
||||
goreleaser build \
|
||||
--clean \
|
||||
--snapshot \
|
||||
--output ./dist/ \
|
||||
--output "./dist/" \
|
||||
--config "./.goreleaser-linux-$(resolveArch "${ARCH}").yml"
|
||||
done
|
||||
|
||||
|
@ -64,11 +64,9 @@ Download the binary distribution for your Linux distribution's architecture or r
|
||||
<Details>
|
||||
<summary>Script to install binary in `/usr/local/bin/zrok`</summary>
|
||||
|
||||
This script auto-selects the correct architecture, and may be helpful for Raspberry Pi users.
|
||||
This script auto-selects the correct architecture and may be helpful for Raspberry Pi users.
|
||||
|
||||
```text
|
||||
(set -euo pipefail;
|
||||
|
||||
cd $(mktemp -d);
|
||||
|
||||
ZROK_VERSION=$(
|
||||
@ -77,11 +75,15 @@ ZROK_VERSION=$(
|
||||
);
|
||||
|
||||
case $(uname -m) in
|
||||
x86_64) GOXARCH=amd64 ;;
|
||||
aarch64|arm64) GOXARCH=arm64 ;;
|
||||
armv7|armhf|arm) GOXARCH=arm ;;
|
||||
*) echo "ERROR: unknown arch '$(uname -m)'" >&2
|
||||
exit 1 ;;
|
||||
x86_64) GOXARCH=amd64
|
||||
;;
|
||||
aarch64|arm64) GOXARCH=arm64
|
||||
;;
|
||||
arm*) GOXARCH=arm
|
||||
;;
|
||||
*) echo "ERROR: unknown arch '$(uname -m)'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac;
|
||||
|
||||
curl -sSfL \
|
||||
@ -89,8 +91,8 @@ curl -sSfL \
|
||||
| tar -xz -f -;
|
||||
|
||||
sudo install -o root -g root ./zrok /usr/local/bin/;
|
||||
|
||||
zrok version;
|
||||
)
|
||||
```
|
||||
|
||||
</Details>
|
||||
|
Loading…
Reference in New Issue
Block a user