golang.org/x/build@v0.0.0-20240506185731-218518f32b70/env/linux-ppc64/osuosl/deb-patches/docker-hack.patch (about)

     1  From 55b2d59738979b6b27983d961dd5730ffc0786a5 Mon Sep 17 00:00:00 2001
     2  From: "Paul E. Murphy" <murp@ibm.com>
     3  Date: Tue, 4 Oct 2022 20:55:48 +0000
     4  Subject: [PATCH] HACK: build on ppc64
     5  
     6  Build the static docker binaries, disable pie, disable cgo, and
     7  dependencies which break if cgo is disabled.
     8  ---
     9   debian/docker.io.install         |  2 +-
    10   debian/patches/nopie-ppc64.patch | 15 +++++++++++++++
    11   debian/patches/series            |  1 +
    12   debian/rules                     |  8 +++++---
    13   4 files changed, 22 insertions(+), 4 deletions(-)
    14   create mode 100644 debian/patches/nopie-ppc64.patch
    15  
    16  diff --git a/debian/docker.io.install b/debian/docker.io.install
    17  index 9de7672..4080d24 100644
    18  --- a/debian/docker.io.install
    19  +++ b/debian/docker.io.install
    20  @@ -1,5 +1,5 @@
    21   _build/bin/docker usr/bin/
    22  -_build/src/github.com/docker/docker/bundles/dynbinary-daemon/dockerd usr/sbin/
    23  +_build/src/github.com/docker/docker/bundles/binary-daemon/dockerd usr/sbin/
    24   
    25   engine/contrib/check-config.sh                usr/share/docker.io/contrib/
    26   engine/contrib/dockerd-rootless.sh            usr/share/docker.io/contrib/
    27  diff --git a/debian/patches/nopie-ppc64.patch b/debian/patches/nopie-ppc64.patch
    28  new file mode 100644
    29  index 0000000..474f8b0
    30  --- /dev/null
    31  +++ b/debian/patches/nopie-ppc64.patch
    32  @@ -0,0 +1,15 @@
    33  +Disable pie on ppc64. It is not supported by golang.
    34  +--- a/engine/hack/make/.binary
    35  ++++ b/engine/hack/make/.binary
    36  +@@ -70,9 +70,9 @@
    37  + 		esac
    38  + 	fi
    39  + 
    40  +-	# -buildmode=pie is not supported on Windows and Linux on mips and riscv64.
    41  ++	# -buildmode=pie is not supported on Windows and Linux on mips, riscv64, and ppc64.
    42  + 	case "$(go env GOOS)/$(go env GOARCH)" in
    43  +-		windows/* | linux/mips* | linux/riscv*) ;;
    44  ++		windows/* | linux/mips* | linux/riscv* | linux/ppc64) ;;
    45  + 
    46  + 		*)
    47  + 			BUILDFLAGS+=("-buildmode=pie")
    48  diff --git a/debian/patches/series b/debian/patches/series
    49  index 300f0d6..4b5bf8c 100644
    50  --- a/debian/patches/series
    51  +++ b/debian/patches/series
    52  @@ -30,3 +30,4 @@ test--skip-pkg-system-chtimes-mips64.patch
    53   test--skip-TestGetRootUIDGID.patch
    54   test--skip-TestStateRunStop.patch
    55   avoid-consul.patch
    56  +nopie-ppc64.patch
    57  diff --git a/debian/rules b/debian/rules
    58  index 4cab23e..b54d0d2 100755
    59  --- a/debian/rules
    60  +++ b/debian/rules
    61  @@ -42,11 +42,13 @@ endif
    62   
    63   # Cf. scripts/build/binary scripts/build/.variables
    64   CLI_BUILDTIME := $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" +"%Y-%m-%dT%H:%M:%SZ")
    65  +ifeq (,$(filter $(DEB_BUILD_ARCH), ppc64))
    66   CLI_BUILDTAGS := pkcs11
    67  +endif
    68   CLI_LDFLAGS   += -X $(CLI_PKG)/cli/version.BuildTime=$(CLI_BUILDTIME)
    69   CLI_LDFLAGS   += -X $(CLI_PKG)/cli/version.GitCommit=$(CLI_GITCOMMIT)
    70   CLI_LDFLAGS   += -X $(CLI_PKG)/cli/version.Version=$(DOCKER_VERSION)
    71  -ifeq (,$(filter $(DEB_BUILD_ARCH), mipsel mips64el))
    72  +ifeq (,$(filter $(DEB_BUILD_ARCH), mipsel mips64el ppc64))
    73   CLI_BUILDMODE := -buildmode=pie
    74   endif
    75   
    76  @@ -117,7 +119,7 @@ override_dh_auto_build:
    77   ##	build ("cd" first to ensure we build from within GOPATH)
    78   	cd $(GOPATH)/src/$(ENGINE_PKG) \
    79   	&& KEEPBUNDLE=$(ENGINE_KEEPBUNDLE) VERSION=$(DOCKER_VERSION) DOCKER_BUILDTAGS='$(ENGINE_BUILDTAGS)' \
    80  -	   DOCKER_GITCOMMIT=$(ENGINE_GITCOMMIT) PRODUCT=docker ./hack/make.sh dynbinary
    81  +	   DOCKER_GITCOMMIT=$(ENGINE_GITCOMMIT) PRODUCT=docker ./hack/make.sh binary
    82   
    83   	DH_GOPKG=$(CLI_PKG) DH_GOLANG_BUILDPKG=$(CLI_PKG)/cmd/docker \
    84   	  dh_auto_build -v -- -tags '$(CLI_BUILDTAGS)' -ldflags '$(CLI_LDFLAGS)' $(CLI_BUILDMODE)
    85  @@ -136,7 +138,7 @@ endif
    86   
    87   override_dh_install:
    88   	## Rename binaries
    89  -	cd $(GOPATH)/src/$(ENGINE_PKG)/bundles/dynbinary-daemon \
    90  +	cd $(GOPATH)/src/$(ENGINE_PKG)/bundles/binary-daemon \
    91   	&& mv dockerd-$(DOCKER_VERSION) dockerd
    92   	cd $(GOPATH)/bin \
    93   	&& mv proxy docker-proxy
    94  -- 
    95  2.37.2
    96