Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildsystem: fix go-based packages #4357

Merged
merged 4 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions config/functions
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,47 @@ target_has_feature() {
listcontains "$TARGET_FEATURES" "$1"
}

# configure variables for go
go_configure() {
unset GOARCH GOARM
case ${TARGET_ARCH} in
x86_64)
export GOARCH=amd64
;;
arm)
export GOARCH=arm

case ${TARGET_CPU} in
arm1176jzf-s)
export GOARM=6
;;
*)
export GOARM=7
;;
esac
;;
aarch64)
export GOARCH=arm64
;;
esac

export GOOS=linux
export GOROOT=${TOOLCHAIN}/lib/golang
export PATH=${PATH}:${GOROOT}/bin

go_configure_path

export CGO_ENABLED=1
export CGO_NO_EMULATION=1
export CGO_CFLAGS=$CFLAGS
}

go_configure_path() {
export GOLANG=${TOOLCHAIN}/lib/golang/bin/go
export GOPATH=${PKG_BUILD}/.gopath
export GOFLAGS="-modcacherw"
}

# find path for matching file or directory, searching standard directory hierarchy, using optional default
# if a path is located it will be set in FOUND_PATH and exit code will be 0.
find_path() {
Expand Down
34 changes: 4 additions & 30 deletions packages/addons/addon-depends/containerd/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,20 @@ PKG_TOOLCHAIN="manual"
PKG_GIT_COMMIT="a4bc1d432a2c33aa2eed37f338dceabb93641310"

pre_make_target() {
case ${TARGET_ARCH} in
x86_64)
export GOARCH=amd64
;;
arm)
export GOARCH=arm

case ${TARGET_CPU} in
arm1176jzf-s)
export GOARM=6
;;
*)
export GOARM=7
;;
esac
;;
aarch64)
export GOARCH=arm64
;;
esac
go_configure

export GOOS=linux
export CGO_ENABLED=1
export CGO_NO_EMULATION=1
export CGO_CFLAGS=${CFLAGS}
export CONTAINERD_VERSION=${PKG_VERSION}
export CONTAINERD_REVISION=${PKG_GIT_COMMIT}
export CONTAINERD_PKG=github.com/containerd/containerd
export LDFLAGS="-w -extldflags -static -X ${CONTAINERD_PKG}/version.Version=${CONTAINERD_VERSION} -X ${CONTAINERD_PKG}/version.Revision=${CONTAINERD_REVISION} -X ${CONTAINERD_PKG}/version.Package=${CONTAINERD_PKG} -extld $CC"
export GOLANG=${TOOLCHAIN}/lib/golang/bin/go
export GOPATH=${PKG_BUILD}/.gopath
export GOROOT=${TOOLCHAIN}/lib/golang
export PATH=${PATH}:${GOROOT}/bin

mkdir -p ${PKG_BUILD}/.gopath
mkdir -p ${GOPATH}
if [ -d ${PKG_BUILD}/vendor ]; then
mv ${PKG_BUILD}/vendor ${PKG_BUILD}/.gopath/src
mv ${PKG_BUILD}/vendor ${GOPATH}/src
fi

ln -fs ${PKG_BUILD} ${PKG_BUILD}/.gopath/src/github.com/containerd/containerd
ln -fs ${PKG_BUILD} ${GOPATH}/src/github.com/containerd/containerd
}

make_target() {
Expand Down
4 changes: 2 additions & 2 deletions packages/addons/addon-depends/go/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)

PKG_NAME="go"
PKG_VERSION="1.12.9"
PKG_SHA256="c31433aa0bb01856c812d40a91336e25cbce2e50800eb9fe88a7adf0305f1a5b"
PKG_VERSION="1.14.2"
PKG_SHA256="97b24d8992a8623eaf717cfc18a190b33f789cadd8cafdfd3c1b3616fd511d16"
PKG_LICENSE="BSD"
PKG_SITE="https://golang.org"
PKG_URL="https://github.com/golang/go/archive/${PKG_NAME}${PKG_VERSION}.tar.gz"
Expand Down
34 changes: 4 additions & 30 deletions packages/addons/addon-depends/libnetwork/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,17 @@ PKG_LONGDESC="A native Go implementation for connecting containers."
PKG_TOOLCHAIN="manual"

pre_make_target() {
case $TARGET_ARCH in
x86_64)
export GOARCH=amd64
;;
arm)
export GOARCH=arm
go_configure

case $TARGET_CPU in
arm1176jzf-s)
export GOARM=6
;;
*)
export GOARM=7
;;
esac
;;
aarch64)
export GOARCH=arm64
;;
esac

export GOOS=linux
export CGO_ENABLED=0
export CGO_NO_EMULATION=1
export CGO_CFLAGS=$CFLAGS
export LDFLAGS="-extld $CC"
export GOLANG=$TOOLCHAIN/lib/golang/bin/go
export GOPATH=$PKG_BUILD/.gopath
export GOROOT=$TOOLCHAIN/lib/golang
export PATH=$PATH:$GOROOT/bin

mkdir -p $PKG_BUILD/.gopath
mkdir -p ${GOPATH}
if [ -d $PKG_BUILD/vendor ]; then
mv $PKG_BUILD/vendor $PKG_BUILD/.gopath/src
mv $PKG_BUILD/vendor ${GOPATH}/src
fi

ln -fs $PKG_BUILD $PKG_BUILD/.gopath/src/github.com/docker/libnetwork
ln -fs $PKG_BUILD ${GOPATH}/src/github.com/docker/libnetwork
}

make_target() {
Expand Down
35 changes: 4 additions & 31 deletions packages/addons/addon-depends/runc/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,16 @@ PKG_TOOLCHAIN="manual"
PKG_GIT_COMMIT="425e105d5a03fabd737a126ad93d62a9eeede87f"

pre_make_target() {
case $TARGET_ARCH in
x86_64)
export GOARCH=amd64
;;
arm)
export GOARCH=arm
go_configure

case $TARGET_CPU in
arm1176jzf-s)
export GOARM=6
;;
*)
export GOARM=7
;;
esac
;;
aarch64)
export GOARCH=arm64
;;
esac

export GOOS=linux
export CGO_ENABLED=1
export CGO_NO_EMULATION=1
export CGO_CFLAGS=$CFLAGS
export LDFLAGS="-w -extldflags -static -X main.gitCommit=${PKG_GIT_COMMIT} -X main.version=$(cat ./VERSION) -extld $CC"
export GOLANG=$TOOLCHAIN/lib/golang/bin/go
export GOPATH=$PKG_BUILD/.gopath
export GOROOT=$TOOLCHAIN/lib/golang
export PATH=$PATH:$GOROOT/bin

mkdir -p $PKG_BUILD/.gopath
mkdir -p ${GOPATH}
if [ -d $PKG_BUILD/vendor ]; then
mv $PKG_BUILD/vendor $PKG_BUILD/.gopath/src
mv $PKG_BUILD/vendor ${GOPATH}/src
fi

ln -fs $PKG_BUILD $PKG_BUILD/.gopath/src/github.com/opencontainers/runc
ln -fs $PKG_BUILD ${GOPATH}/src/github.com/opencontainers/runc
}

make_target() {
Expand Down
109 changes: 43 additions & 66 deletions packages/addons/service/docker/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,86 +23,63 @@ PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Docker"
PKG_ADDON_TYPE="xbmc.service"

PKG_DOCKER_BUILDTAGS="daemon \
autogen \
exclude_graphdriver_devicemapper \
exclude_graphdriver_aufs \
exclude_graphdriver_btrfs \
journald"

configure_target() {
export DOCKER_BUILDTAGS="daemon \
autogen \
exclude_graphdriver_devicemapper \
exclude_graphdriver_aufs \
exclude_graphdriver_btrfs \
journald"

case ${TARGET_ARCH} in
x86_64)
export GOARCH=amd64
;;
arm)
export GOARCH=arm

case ${TARGET_CPU} in
arm1176jzf-s)
export GOARM=6
;;
*)
export GOARM=7
;;
esac
;;
aarch64)
export GOARCH=arm64
;;
esac

export GOOS=linux
export CGO_ENABLED=1
export CGO_NO_EMULATION=1
export CGO_CFLAGS=${CFLAGS}
go_configure

PKG_GOPATH_ENGINE=${GOPATH}
PKG_GOPATH_CLI=${GOPATH}_cli
export GOPATH=${PKG_GOPATH_CLI}:${PKG_GOPATH_ENGINE}

export LDFLAGS="-w -linkmode external -extldflags -Wl,--unresolved-symbols=ignore-in-shared-libs -extld $CC"
export GOLANG=${TOOLCHAIN}/lib/golang/bin/go
export GOPATH=${PKG_BUILD}/.gopath_cli:${PKG_BUILD}/.gopath
export GOROOT=${TOOLCHAIN}/lib/golang
export PATH=${PATH}:${GOROOT}/bin

mkdir -p ${PKG_BUILD}/.gopath
mkdir -p ${PKG_BUILD}/.gopath_cli
mkdir -p ${PKG_GOPATH_ENGINE}
mkdir -p ${PKG_GOPATH_CLI}

PKG_ENGINE_PATH=${PKG_BUILD}/components/engine
PKG_CLI_PATH=${PKG_BUILD}/components/cli

if [ -d ${PKG_ENGINE_PATH}/vendor ]; then
mv ${PKG_ENGINE_PATH}/vendor ${PKG_BUILD}/.gopath/src
mv ${PKG_ENGINE_PATH}/vendor ${PKG_GOPATH_ENGINE}/src
fi

if [ -d ${PKG_CLI_PATH}/vendor ]; then
mv ${PKG_CLI_PATH}/vendor ${PKG_BUILD}/.gopath_cli/src
mv ${PKG_CLI_PATH}/vendor ${PKG_GOPATH_CLI}/src
fi

# Fix missing/incompatible .go files
cp -rf ${PKG_BUILD}/.gopath/src/github.com/moby/buildkit/frontend/* ${PKG_BUILD}/.gopath_cli/src/github.com/moby/buildkit/frontend
cp -rf ${PKG_BUILD}/.gopath/src/github.com/moby/buildkit/frontend/gateway/* ${PKG_BUILD}/.gopath_cli/src/github.com/moby/buildkit/frontend/gateway
cp -rf ${PKG_BUILD}/.gopath/src/github.com/moby/buildkit/solver/* ${PKG_BUILD}/.gopath_cli/src/github.com/moby/buildkit/solver
cp -rf ${PKG_BUILD}/.gopath/src/github.com/moby/buildkit/util/progress/* ${PKG_BUILD}/.gopath_cli/src/github.com/moby/buildkit/util/progress
cp -rf ${PKG_BUILD}/.gopath/src/github.com/docker/swarmkit/manager/* ${PKG_BUILD}/.gopath_cli/src/github.com/docker/swarmkit/manager
cp -rf ${PKG_BUILD}/.gopath/src/github.com/coreos/etcd/raft/* ${PKG_BUILD}/.gopath_cli/src/github.com/coreos/etcd/raft
cp -rf ${PKG_BUILD}/.gopath/src/golang.org/x/* ${PKG_BUILD}/.gopath_cli/src/golang.org/x
cp -rf ${PKG_BUILD}/.gopath/src/github.com/opencontainers/runtime-spec/specs-go/* ${PKG_BUILD}/.gopath_cli/src/github.com/opencontainers/runtime-spec/specs-go

rm -rf ${PKG_BUILD}/.gopath_cli/src/github.com/containerd/containerd
mkdir -p ${PKG_BUILD}/.gopath_cli/src/github.com/containerd/containerd
cp -rf ${PKG_BUILD}/.gopath/src/github.com/containerd/containerd/* ${PKG_BUILD}/.gopath_cli/src/github.com/containerd/containerd

rm -rf ${PKG_BUILD}/.gopath_cli/src/github.com/containerd/continuity
mkdir -p ${PKG_BUILD}/.gopath_cli/src/github.com/containerd/continuity
cp -rf ${PKG_BUILD}/.gopath/src/github.com/containerd/continuity/* ${PKG_BUILD}/.gopath_cli/src/github.com/containerd/continuity

mkdir -p ${PKG_BUILD}/.gopath_cli/src/github.com/docker/docker/builder
cp -rf ${PKG_ENGINE_PATH}/builder/* ${PKG_BUILD}/.gopath_cli/src/github.com/docker/docker/builder

if [ ! -L ${PKG_BUILD}/.gopath/src/github.com/docker/docker ];then
ln -fs ${PKG_ENGINE_PATH} ${PKG_BUILD}/.gopath/src/github.com/docker/docker
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/moby/buildkit/frontend/* ${PKG_GOPATH_CLI}/src/github.com/moby/buildkit/frontend
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/moby/buildkit/frontend/gateway/* ${PKG_GOPATH_CLI}/src/github.com/moby/buildkit/frontend/gateway
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/moby/buildkit/solver/* ${PKG_GOPATH_CLI}/src/github.com/moby/buildkit/solver
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/moby/buildkit/util/progress/* ${PKG_GOPATH_CLI}/src/github.com/moby/buildkit/util/progress
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/docker/swarmkit/manager/* ${PKG_GOPATH_CLI}/src/github.com/docker/swarmkit/manager
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/coreos/etcd/raft/* ${PKG_GOPATH_CLI}/src/github.com/coreos/etcd/raft
cp -rf ${PKG_GOPATH_ENGINE}/src/golang.org/x/* ${PKG_GOPATH_CLI}/src/golang.org/x
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/opencontainers/runtime-spec/specs-go/* ${PKG_GOPATH_CLI}/src/github.com/opencontainers/runtime-spec/specs-go

rm -rf ${PKG_GOPATH_CLI}/src/github.com/containerd/containerd
mkdir -p ${PKG_GOPATH_CLI}/src/github.com/containerd/containerd
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/containerd/containerd/* ${PKG_GOPATH_CLI}/src/github.com/containerd/containerd

rm -rf ${PKG_GOPATH_CLI}/src/github.com/containerd/continuity
mkdir -p ${PKG_GOPATH_CLI}/src/github.com/containerd/continuity
cp -rf ${PKG_GOPATH_ENGINE}/src/github.com/containerd/continuity/* ${PKG_GOPATH_CLI}/src/github.com/containerd/continuity

mkdir -p ${PKG_GOPATH_CLI}/src/github.com/docker/docker/builder
cp -rf ${PKG_ENGINE_PATH}/builder/* ${PKG_GOPATH_CLI}/src/github.com/docker/docker/builder

if [ ! -L ${PKG_GOPATH_ENGINE}/src/github.com/docker/docker ];then
ln -fs ${PKG_ENGINE_PATH} ${PKG_GOPATH_ENGINE}/src/github.com/docker/docker
fi

if [ ! -L ${PKG_BUILD}/.gopath_cli/src/github.com/docker/cli ];then
ln -fs ${PKG_CLI_PATH} ${PKG_BUILD}/.gopath_cli/src/github.com/docker/cli
if [ ! -L ${PKG_GOPATH_CLI}/src/github.com/docker/cli ];then
ln -fs ${PKG_CLI_PATH} ${PKG_GOPATH_CLI}/src/github.com/docker/cli
fi

# used for docker version
Expand All @@ -120,8 +97,8 @@ make_target() {
PKG_CLI_FLAGS="-X 'github.com/docker/cli/cli/version.Version=${VERSION}'"
PKG_CLI_FLAGS="${PKG_CLI_FLAGS} -X 'github.com/docker/cli/cli/version.GitCommit=${GITCOMMIT}'"
PKG_CLI_FLAGS="${PKG_CLI_FLAGS} -X 'github.com/docker/cli/cli/version.BuildTime=${BUILDTIME}'"
${GOLANG} build -v -o bin/docker -a -tags "${DOCKER_BUILDTAGS}" -ldflags "${LDFLAGS} ${PKG_CLI_FLAGS}" ./components/cli/cmd/docker
${GOLANG} build -v -o bin/dockerd -a -tags "${DOCKER_BUILDTAGS}" -ldflags "${LDFLAGS}" ./components/engine/cmd/dockerd
${GOLANG} build -v -o bin/docker -a -tags "${PKG_DOCKER_BUILDTAGS}" -ldflags "${LDFLAGS} ${PKG_CLI_FLAGS}" ./components/cli/cmd/docker
${GOLANG} build -v -o bin/dockerd -a -tags "${PKG_DOCKER_BUILDTAGS}" -ldflags "${LDFLAGS}" ./components/engine/cmd/dockerd
}

makeinstall_target() {
Expand Down
3 changes: 3 additions & 0 deletions packages/addons/service/syncthing/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
110
- Update to 1.5.0

109
- Update to 1.4.2

Expand Down
Loading