diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-19 08:08:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-19 08:08:45 -0400 |
commit | 948c5e915aec709beb4e171a72c7e54504889baf (patch) | |
tree | 2fa0dc52e5c9e05ba9f81b22c806d359abc99a26 /podman.spec.rpkg | |
parent | 7093885df73989acd2aa2dd936695d0b30a3dcf8 (diff) | |
parent | 653117087fd6d6d956ce212bfbec0e4091a96010 (diff) | |
download | podman-948c5e915aec709beb4e171a72c7e54504889baf.tar.gz podman-948c5e915aec709beb4e171a72c7e54504889baf.tar.bz2 podman-948c5e915aec709beb4e171a72c7e54504889baf.zip |
Merge pull request #13870 from kolyshkin/makefile-cleanups
Makefile: simplify for modern Go
Diffstat (limited to 'podman.spec.rpkg')
-rw-r--r-- | podman.spec.rpkg | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/podman.spec.rpkg b/podman.spec.rpkg index 12d1584af..c9127c2d9 100644 --- a/podman.spec.rpkg +++ b/podman.spec.rpkg @@ -13,17 +13,9 @@ %endif %if ! 0%{?gobuild:1} -%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; +%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; %endif -%global provider github -%global provider_tld com -%global project containers -%global repo %{name} -# https://github.com/containers/%%{name} -%global import_path %{provider}.%{provider_tld}/%{project}/%{repo} -%global git0 https://%{import_path} - # git_dir_name returns repository name derived from remote Git repository URL Name: {{{ git_dir_name }}} @@ -156,8 +148,7 @@ connections as well. # This will invoke `make` command in the directory with the extracted sources. %build %set_build_flags -export GO111MODULE=off -export GOPATH=$(pwd)/_build:$(pwd) +%global gomodulesmode GO111MODULE=on export CGO_CFLAGS=$CFLAGS # These extra flags present in $CFLAGS have been skipped for now as they break the build CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-flto=auto//g') @@ -168,33 +159,26 @@ CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-an export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" %endif -mkdir _build -pushd _build -mkdir -p src/%{provider}.%{provider_tld}/%{project} -ln -s ../../../../ src/%{import_path} -popd -ln -s vendor src - %if 0%{?rhel} rm -rf vendor/github.com/containers/storage/drivers/register/register_btrfs.go %endif # build date. FIXME: Makefile uses '/v2/libpod', that doesn't work here? -LDFLAGS="-X %{import_path}/libpod/define.buildInfo=$(date +%s)" +LDFLAGS="-X ./libpod/define.buildInfo=$(date +%s)" # build rootlessport first -%gobuild -o bin/rootlessport %{import_path}/cmd/rootlessport +%gobuild -o bin/rootlessport ./cmd/rootlessport # set base buildtags common to both %%{name} and %%{name}-remote export BASEBUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/selinux_tag.sh) $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)" # build %%{name} export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh)" -%gobuild -o bin/%{name} %{import_path}/cmd/%{name} +%gobuild -o bin/%{name} ./cmd/%{name} # build %%{name}-remote export BUILDTAGS="$BASEBUILDTAGS exclude_graphdriver_btrfs btrfs_noversion remote" -%gobuild -o bin/%{name}-remote %{import_path}/cmd/%{name} +%gobuild -o bin/%{name}-remote ./cmd/%{name} make docs docker-docs |