Skip to content

Commit

Permalink
Merge pull request #348 from xiaods/dev
Browse files Browse the repository at this point in the history
fix: update build sciript
  • Loading branch information
xiaods authored Oct 21, 2024
2 parents b030929 + 3d4ff39 commit e9b2982
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions hack/build
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ GO=${GO-go}

PKG="github.com/xiaods/k8e"
PKG_CONTAINERD="github.com/containerd/containerd"
PKG_CRICTL="github.com/kubernetes-sigs/cri-tools"
PKG_CRICTL="sigs.k8s.io/cri-tools/pkg"
PKG_K8S_BASE="k8s.io/component-base"
PKG_K8S_CLIENT="k8s.io/client-go/pkg"
PKG_CNI_PLUGINS="github.com/containernetworking/plugins"
PKG_CRI_DOCKERD="github.com/Mirantis/cri-dockerd"
PKG_ETCD="go.etcd.io/etcd"

buildDate=$(date -u '+%Y-%m-%dT%H:%M:%SZ')

Expand Down Expand Up @@ -41,6 +42,8 @@ VERSIONFLAGS="
-X ${PKG_CRI_DOCKERD}/cmd/version.Version=${VERSION_CRI_DOCKERD}
-X ${PKG_CRI_DOCKERD}/cmd/version.GitCommit=HEAD
-X ${PKG_CRI_DOCKERD}/cmd/version.BuildTime=${buildDate}
-X ${PKG_ETCD}/api/version.GitSHA=HEAD
"
if [ -n "${DEBUG}" ]; then
GCFLAGS="-N -l"
Expand All @@ -51,7 +54,7 @@ fi
STATIC="
-extldflags '-static -lm -ldl -lz -lpthread'
"
TAGS="apparmor seccomp netcgo osusergo providerless urfave_cli_no_docs"
TAGS="ctrd apparmor seccomp netcgo osusergo providerless urfave_cli_no_docs"
RUNC_TAGS="apparmor seccomp"
RUNC_STATIC="static"

Expand All @@ -74,6 +77,15 @@ fi

mkdir -p bin

if [ ${ARCH} = armv7l ] || [ ${ARCH} = arm ]; then
export GOARCH="arm"
export GOARM="7"
fi

if [ ${ARCH} = s390x ]; then
export GOARCH="s390x"
fi

k8e_binaries=(
"bin/k8e-agent"
"bin/k8e-server"
Expand All @@ -83,13 +95,12 @@ k8e_binaries=(
"bin/k8e-certificate"
"bin/k8e-completion"
"bin/kubectl"
"bin/containerd"
"bin/crictl"
"bin/ctr"
)

containerd_binaries=(
# bin/containerd must be here in 1.25
"bin/containerd"
"bin/containerd-shim"
"bin/containerd-shim-runc-v2"
"bin/runc"
Expand Down Expand Up @@ -141,10 +152,9 @@ export GOPATH=$(pwd)/build

case ${OS} in
linux)
echo Building containerd
echo Building containerd-shim
pushd ./build/src/github.com/containerd/containerd
TAGS="${TAGS/netcgo/netgo}"
CGO_ENABLED=1 "${GO}" build -tags "$TAGS" -gcflags="all=${GCFLAGS}" -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC" -o bin/containerd ./cmd/containerd
CGO_ENABLED=1 "${GO}" build -tags "$TAGS" -gcflags="all=${GCFLAGS}" -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC" -o bin/containerd-shim-runc-v2 ./cmd/containerd-shim-runc-v2
popd
cp -vf ./build/src/github.com/containerd/containerd/bin/* ./bin/
Expand Down

0 comments on commit e9b2982

Please sign in to comment.