distribution/packages/services/docker/cli/package.mk

49 lines
1.6 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="cli"
PKG_VERSION="$(get_pkg_version moby)"
PKG_SHA256="2f5949173515b70daa0b78fea7185ffd219ca31f7381a0e1218eeefc7f70199c"
PKG_LICENSE="ASL"
PKG_SITE="https://github.com/docker/cli"
PKG_URL="https://github.com/docker/cli/archive/v${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain go:host"
PKG_LONGDESC="The Docker CLI"
PKG_TOOLCHAIN="manual"
# Git commit of the matching release https://github.com/docker/cli/releases
export PKG_GIT_COMMIT="3e9117b7e241439e314eaf6fe944b4019fbaa941"
configure_target() {
go_configure
export LDFLAGS="-w -linkmode external -extldflags -Wl,--unresolved-symbols=ignore-in-shared-libs -extld ${CC}"
# used for docker version
export GITCOMMIT=${PKG_GIT_COMMIT}
export VERSION=${PKG_VERSION}
export BUILDTIME="$(date --utc)"
cat > "${PKG_BUILD}/go.mod" << EOF
module github.com/docker/cli
go 1.18
EOF
GO111MODULE=auto ${GOLANG} mod tidy -modfile 'vendor.mod' -compat 1.18
GO111MODULE=auto ${GOLANG} mod vendor -modfile vendor.mod
}
make_target() {
mkdir -p bin
PKG_CLI_FLAGS="-X 'github.com/docker/cli/cli/version.Version=${VERSION}'"
PKG_CLI_FLAGS+=" -X 'github.com/docker/cli/cli/version.GitCommit=${GITCOMMIT}'"
PKG_CLI_FLAGS+=" -X 'github.com/docker/cli/cli/version.BuildTime=${BUILDTIME}'"
${GOLANG} build -mod=mod -modfile=vendor.mod -v -o bin/docker -a -tags "${PKG_DOCKER_BUILDTAGS}" -ldflags "${LDFLAGS} ${PKG_CLI_FLAGS}" ./cmd/docker
}
makeinstall_target() {
mkdir -p ${INSTALL}/usr/bin
cp bin/* ${INSTALL}/usr/bin
chmod 0755 ${INSTALL}/usr/bin/*
}