docker: cross-compile, manual build
Their build script attempt to fetch pre-build binary on certain platform. Build them ourselves.
This commit is contained in:
parent
b401bed252
commit
10f2beb1eb
|
@ -1,61 +1,138 @@
|
||||||
# Template file for 'docker'
|
# Template file for 'docker'
|
||||||
pkgname=docker
|
pkgname=docker
|
||||||
version=19.03.12
|
version=19.03.12
|
||||||
revision=1
|
revision=2
|
||||||
wrksrc="${pkgname}-ce-${version}"
|
create_wrksrc=yes
|
||||||
hostmakedepends="git go pkg-config curl cmake tar"
|
build_style=go
|
||||||
|
hostmakedepends="go pkg-config cmake tar"
|
||||||
makedepends="libbtrfs-devel sqlite-devel device-mapper-devel libseccomp-devel
|
makedepends="libbtrfs-devel sqlite-devel device-mapper-devel libseccomp-devel
|
||||||
libapparmor-devel libltdl-devel"
|
libapparmor-devel libltdl-devel"
|
||||||
depends="containerd runc"
|
depends="containerd runc"
|
||||||
short_desc="Pack, ship and run any application as a lightweight container"
|
short_desc="Pack, ship and run any application as a lightweight container"
|
||||||
maintainer="Andrea Brancaleoni <abc@pompel.me>"
|
maintainer="Andrea Brancaleoni <abc@pompel.me>"
|
||||||
license="Apache-2.0"
|
license="Apache-2.0, MIT"
|
||||||
homepage="http://www.docker.io"
|
homepage="http://www.docker.io"
|
||||||
distfiles="https://github.com/docker/docker-ce/archive/v${version}.tar.gz"
|
|
||||||
checksum=d321f959e41fd9b24c23d95779d30d9ead1120bfddedf157ef5c047cf3d997a1
|
_tini_version=0.18.0
|
||||||
|
_libnetwork="bump_${version%.${version#*.*.}}"
|
||||||
|
|
||||||
|
distfiles="
|
||||||
|
https://github.com/docker/docker-ce/archive/v${version}.tar.gz>docker-ce-$version.tar.gz
|
||||||
|
https://github.com/krallin/tini/archive/v$_tini_version.tar.gz>tini-$_tini_version.tar.gz
|
||||||
|
https://github.com/moby/libnetwork/archive/$_libnetwork.tar.gz>libnetwork-$_libnetwork.tar.gz"
|
||||||
|
checksum="d321f959e41fd9b24c23d95779d30d9ead1120bfddedf157ef5c047cf3d997a1
|
||||||
|
1097675352d6317b547e73f9dc7c6839fd0bb0d96dafc2e5c95506bb324049a2
|
||||||
|
a5e190a5acd6f20a2eb73a0b083d9ba1279ac1cc97a93c66cdecf3c40e0e384a"
|
||||||
|
|
||||||
|
|
||||||
# These are required at run-time.
|
# These are required at run-time.
|
||||||
depends+=" iptables xz git"
|
depends+=" iptables xz git"
|
||||||
nopie=yes
|
nopie=yes
|
||||||
nostrip=yes
|
nostrip=yes
|
||||||
nocross=yes
|
|
||||||
archs="aarch64* armv7l* x86_64* ppc64le*"
|
archs="aarch64* armv7l* x86_64* ppc64le*"
|
||||||
system_groups="docker"
|
system_groups="docker"
|
||||||
|
|
||||||
_docker_components="tini proxy dockercli"
|
do_configure() {
|
||||||
|
msg_normal "Configuring docker-init\n"
|
||||||
|
mkdir -p $wrksrc/tini-$_tini_version/build
|
||||||
|
cd $wrksrc/tini-$_tini_version/build
|
||||||
|
local cmake_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None"
|
||||||
|
|
||||||
do_build() {
|
if [ "$CROSS_BUILD" ]; then
|
||||||
cd components/cli
|
case "$XBPS_TARGET_MACHINE" in
|
||||||
# AUTO_GOPATH=1 doesn't seem to work for CLI
|
x86_64*) _CMAKE_SYSTEM_PROCESSOR=x86_64 ;;
|
||||||
rm -rf .gopath
|
aarch64*) _CMAKE_SYSTEM_PROCESSOR=aarch64 ;;
|
||||||
mkdir -p .gopath/src/github.com/docker
|
arm*) _CMAKE_SYSTEM_PROCESSOR=arm ;;
|
||||||
ln -sf $wrksrc/components/cli .gopath/src/github.com/docker/
|
ppc64le*) _CMAKE_SYSTEM_PROCESSOR=ppc64le ;;
|
||||||
GOPATH=$wrksrc/components/cli/.gopath LDFLAGS='' \
|
*) msg_error "BUG: $pkgver: unknown target machine\n" ;;
|
||||||
make VERSION=${version} dynbinary
|
esac
|
||||||
rm -rf .gopath
|
cat >cross_${XBPS_CROSS_TRIPLET}.cmake <<-_EOF
|
||||||
|
SET(CMAKE_SYSTEM_NAME Linux)
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
|
||||||
cd ../../components/engine
|
SET(CMAKE_C_COMPILER ${CC})
|
||||||
AUTO_GOPATH=1 DOCKER_BUILDTAGS='seccomp apparmor' VERSION=${version} DOCKER_GITCOMMIT=v${version} \
|
SET(CMAKE_CXX_COMPILER ${CXX})
|
||||||
hack/make.sh dynbinary
|
SET(CMAKE_CROSSCOMPILING TRUE)
|
||||||
|
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR ${_CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH ${XBPS_CROSS_BASE})
|
||||||
|
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
_EOF
|
||||||
|
cmake_args+=" -DCMAKE_TOOLCHAIN_FILE=cross_${XBPS_CROSS_TRIPLET}.cmake"
|
||||||
|
fi
|
||||||
|
CFLAGS="${CFLAGS/ -pipe / }" CXXFLAGS="${CXXFLAGS/ -pipe / }" \
|
||||||
|
cmake ${cmake_args} ..
|
||||||
|
|
||||||
|
mkdir -p $wrksrc/gopath/src/github.com/docker
|
||||||
|
|
||||||
|
msg_normal "Preparing docker-proxy import path\n"
|
||||||
|
cd $wrksrc/libnetwork-$_libnetwork
|
||||||
|
rm -f $wrksrc/gopath/src/github.com/docker/libnetwork
|
||||||
|
ln -s "$PWD" $wrksrc/gopath/src/github.com/docker/libnetwork
|
||||||
|
|
||||||
|
msg_normal "Preparing docker-cli import path\n"
|
||||||
|
cd $wrksrc/docker-ce-$version
|
||||||
|
rm -f $wrksrc/gopath/src/github.com/docker/cli
|
||||||
|
ln -s "$PWD/components/cli" $wrksrc/gopath/src/github.com/docker/cli
|
||||||
|
rm -f $wrksrc/gopath/src/github.com/docker/docker
|
||||||
|
ln -s "$PWD/components/engine" $wrksrc/gopath/src/github.com/docker/docker
|
||||||
|
|
||||||
|
BUILDTIME=$(date --utc --rfc-3339 ns)
|
||||||
|
BUILDTIME=${BUILDTIME/ /T}
|
||||||
|
vsed -i -e "
|
||||||
|
/GitCommit/s/\".*\"/\"v$version\"/;
|
||||||
|
/Version/s/\".*\"/\"$version\"/;
|
||||||
|
/BuildTime/s/\".*\"/\"$BUILDTIME\"/;
|
||||||
|
" \
|
||||||
|
components/engine/dockerversion/version_lib.go \
|
||||||
|
components/cli/cli/version/version.go
|
||||||
}
|
}
|
||||||
|
|
||||||
pre_build() {
|
do_build() {
|
||||||
cd components/engine
|
export GOPATH="$wrksrc/gopath"
|
||||||
vmkdir usr/bin
|
mkdir -p $wrksrc/gopath/bin
|
||||||
vsed -i "s|/usr/local|$DESTDIR/usr|g" hack/dockerfile/install/install.sh
|
|
||||||
for COMPONENT in $_docker_components; do
|
msg_normal "Building docker-init\n"
|
||||||
AUTO_GOPATH=1 LDFLAGS='' DOCKER_BUILDTAGS='seccomp apparmor' DOCKER_GITCOMMIT=v${version} \
|
cd $wrksrc/tini-$_tini_version/build
|
||||||
hack/dockerfile/install/install.sh $COMPONENT
|
make tini-static
|
||||||
done
|
|
||||||
|
msg_normal "Building docker-proxy\n"
|
||||||
|
go build -buildmode=pie \
|
||||||
|
-ldflags="$go_ldflags -linkmode=external" \
|
||||||
|
-o $wrksrc/gopath/bin/docker-proxy \
|
||||||
|
github.com/docker/libnetwork/cmd/proxy
|
||||||
|
|
||||||
|
msg_normal "Building docker cli\n"
|
||||||
|
go build -buildmode=pie \
|
||||||
|
-ldflags="$go_ldflags" -o $wrksrc/gopath/bin/docker \
|
||||||
|
github.com/docker/cli/cmd/docker
|
||||||
|
|
||||||
|
msg_normal "Building docker daemon\n"
|
||||||
|
go build -buildmode=pie \
|
||||||
|
-tags 'libdm_dlsym_deferred_remove seccomp apparmor' \
|
||||||
|
-ldflags="$go_ldflags" \
|
||||||
|
-o $wrksrc/gopath/bin/dockerd \
|
||||||
|
github.com/docker/docker/cmd/dockerd
|
||||||
}
|
}
|
||||||
|
|
||||||
do_install() {
|
do_install() {
|
||||||
vbin components/engine/bundles/dynbinary-daemon/dockerd dockerd
|
vbin tini-$_tini_version/build/tini-static docker-init
|
||||||
vbin components/cli/build/docker docker
|
vlicense tini-$_tini_version/LICENSE docker-init.MIT
|
||||||
vinstall components/cli/contrib/completion/bash/docker 644 usr/share/bash-completion/completions
|
vbin gopath/bin/docker-proxy
|
||||||
vinstall components/cli/contrib/completion/zsh/_docker 644 usr/share/zsh/site-functions
|
vbin gopath/bin/docker
|
||||||
vinstall components/cli/contrib/completion/fish/docker.fish 644 usr/share/fish/vendor_completions.d
|
vbin gopath/bin/dockerd
|
||||||
vinstall components/engine/contrib/syntax/vim/syntax/dockerfile.vim 644 usr/share/vim/vimfiles/snytax/dockerfile.vim
|
cd docker-ce-$version
|
||||||
vinstall components/engine/contrib/syntax/vim/ftdetect/dockerfile.vim 644 usr/share/vim/vimfiles/ftdetect/dockerfile.vim
|
vcompletion components/cli/contrib/completion/bash/docker bash
|
||||||
|
vcompletion components/cli/contrib/completion/zsh/_docker zsh
|
||||||
|
vcompletion components/cli/contrib/completion/fish/docker.fish fish
|
||||||
|
vinstall components/engine/contrib/syntax/vim/syntax/dockerfile.vim 644 \
|
||||||
|
usr/share/vim/vimfiles/syntax/dockerfile.vim
|
||||||
|
vinstall components/engine/contrib/syntax/vim/ftdetect/dockerfile.vim 644 \
|
||||||
|
usr/share/vim/vimfiles/ftdetect/dockerfile.vim
|
||||||
|
vlicense components/engine/contrib/syntax/vim/LICENSE dockerfile.vim.BSD-2-Clause
|
||||||
vsv docker
|
vsv docker
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue