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

Various Makefile improvements #1140

Merged
merged 4 commits into from
Apr 26, 2023

Conversation

dvzrv
Copy link
Contributor

@dvzrv dvzrv commented Apr 18, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

Allows overriding various go compiler flags (-ldflags via GO_LDFLAGS, CGO_ENABLED and GOFLAGS).
Allows building from a source tarball by allowing to provide a custom version string using VERSION (git is no longer required during build time, which is great if one is relying on source tarballs to build this project).

Which issue(s) this PR fixes:

Fixes #676 (auto-closed by bot...)

Special notes for your reviewer:

I am packaging this project for Arch Linux and started to more and more hack around the Makefile to be able to provide our own distribution flags and to apply our go packaging guidelines.

Does this PR introduce a user-facing change?

The Makefile now allows adding additional `-ldflags` by providing `GO_LDFLAGS`, setting `CGO_ENABLED` by providing `CGO_ENABLED`, overriding build flags by setting `GOFLAGS` (defaults to `-trimpath`) and providing a custom version string using `VERSION` (defaults to using `git` to derive a unique version string based on the latest tag). 

Makefile: Allow using `VERSION` to provide a version override when building the project.
This allows for building using a tarball, without requiring git.
Makefile: Allow providing `GO_LDFLAGS` externally (e.g. via export
of the variable in the build environment), which is what downstream
distributions use to build with their linker flags (e.g. for external
link mode and/or debug packages).
This prepends externally provided `GO_LDFLAGS` to the version
declaration.
Makefile: Allow providing `GOFLAGS` in the build environment to set go
compiler flags and set the default to `-trimpath`.
This is required for downstream distributions to be able to build
position independent executables and working debug symbols.
Makefile: Allow setting CGO_ENABLED (defaults to 0).
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Apr 18, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 18, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Apr 18, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @dvzrv!

It looks like this is your first PR to kubernetes-sigs/cri-tools 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cri-tools has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 18, 2023
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this pull request Apr 18, 2023
Switch to using source tarball by patching Makefile:
kubernetes-sigs/cri-tools#1140
Attempt to get debug package to work.

git-svn-id: file:///srv/repos/svn-community/svn@1447263 9fca08f4-af9d-4005-b8df-a31f2cc04f65
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this pull request Apr 18, 2023
Switch to using source tarball by patching Makefile:
kubernetes-sigs/cri-tools#1140
Attempt to get debug package to work.

git-svn-id: file:///srv/repos/svn-community/svn@1447263 9fca08f4-af9d-4005-b8df-a31f2cc04f65
Foxboron pushed a commit to Foxboron/archlinux-pkgbuilds that referenced this pull request Apr 20, 2023
@saschagrunert
Copy link
Member

@dvzrv may I ask you to sign the CLA?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 25, 2023
@dvzrv
Copy link
Contributor Author

dvzrv commented Apr 25, 2023

@dvzrv may I ask you to sign the CLA?

It's done. I didn't realize there was a CLA for this project and I am not so super happy about it 😢
Either way, I'm happy to provide a fix for the Makefile so downstreams can properly build this!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 26, 2023
@saschagrunert
Copy link
Member

Thank you @dvzrv ! 🙏

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dvzrv, saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 26, 2023
@k8s-ci-robot k8s-ci-robot merged commit 11dfe65 into kubernetes-sigs:master Apr 26, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to build from source tarball
3 participants