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

[bazel] Create a static library link rule #21198

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

cfrantz
Copy link
Contributor

@cfrantz cfrantz commented Feb 5, 2024

Bazel currently does not have a rule which can emit a static library suitable as a release artifact. Adapt one of the implementations discussed in the bazel community to our needs.

sw/device/lib/crypto/BUILD Outdated Show resolved Hide resolved
name = "otcrypto",
hdrs = [
"otcrypto.h",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we now delete this header file, or is it still useful? The purpose was to give callers the ability to import the entire cryptolib with one import rather than revealing the internal structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep it if you feel it better serves the customer.

As discussed offline, we'll have to determine what a release of cryptolib looks like to downstream customers and possibly consider packaging the library archive and headers as a release artifact. We can tackle that work when we understand how a downstream customer will want to incorporate cryptolib into their project.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Output is named ./bazel-bin/sw/device/lib/crypto/otcrypto.a instead of libotcrypto.a

Bazel currently does not have a rule which can emit a static library
suitable as a release artifact.  Adapt one of the implementations
discussed in the bazel community to our needs.

Signed-off-by: Chris Frantz <[email protected]>
@cfrantz cfrantz marked this pull request as ready for review February 7, 2024 16:44
@cfrantz cfrantz added the CherryPick:earlgrey_es_sival This PR should be cherry-picked to earlgrey_es_sival label Feb 7, 2024
@cfrantz cfrantz merged commit aa7867b into lowRISC:master Feb 7, 2024
33 checks passed
Copy link

github-actions bot commented Feb 7, 2024

Backport failed for earlgrey_es_sival, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin earlgrey_es_sival
git worktree add -d .worktree/backport-21198-to-earlgrey_es_sival origin/earlgrey_es_sival
cd .worktree/backport-21198-to-earlgrey_es_sival
git switch --create backport-21198-to-earlgrey_es_sival
git cherry-pick -x 86a935fe2e77b96e374642a64f816f943d921739

@vsukhoml
Copy link

vsukhoml commented Feb 8, 2024

This rule produce otcrypto.a. So name shall possible change to libotcrypto or rule shall add lib prefix to name so linker can find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPick:earlgrey_es_sival This PR should be cherry-picked to earlgrey_es_sival
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants