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

Move installation of include headers into a separate script (NFC) #552

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

abrown
Copy link
Collaborator

@abrown abrown commented Nov 20, 2024

This change is not meant to change any functionality, only move some Bash-specific logic out of the Makefile into its own script: install-include-headers.sh. This reduces the perceived complexity of the Makefile but the complexity is still there, tucked away in this script. This script also has the advantage that it can be run separately if needed.

This commit comes after a few different attempts at building up Makefile lists of headers to copy over along with the various locations they must be copied from. It is certainly possible to do this, but due to how we need to remove some headers from the list, it ends up being easier to just cp and then rm, which this script retains.

This change is not meant to change any functionality, only move some
Bash-specific logic out of the `Makefile` into its own script:
`install-include-headers.sh`. This reduces the perceived complexity of
the `Makefile` but the complexity is still there, tucked away in this
script. This script also has the advantage that it can be run separately
if needed.

This commit comes after a few different attempts at building up
`Makefile` lists of headers to copy over along with the various
locations they must be copied from. It is certainly possible to do this,
but due to how we need to remove some headers from the list, it ends up
being easier to just `cp` and then `rm`, which this script retains.
@sbc100
Copy link
Member

sbc100 commented Nov 21, 2024

This change is not meant to change any functionality

I kind of like the llvm (and now emscripten) convention of adding . NFC to the end of the PR title for such changes.

(edit: meaning Non Functional Change)

@abrown abrown changed the title Move installation of include headers into a separate script Move installation of include headers into a separate script (NFC) Nov 22, 2024
Copy link
Member

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

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

Overall this looks good; just one minor comment:

#
# Usage: SYSROOT_INC=... TARGET_TRIPLE=... ./install-include-headers.sh

set -e
Copy link
Member

Choose a reason for hiding this comment

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

I recommend adding set -euo pipefail to all bash scripts. In particular here, -u will catch the case where someone forgets to set SYSROOT_INC or TARGET_TRIPLE.

Also removes the ability to set `DRY_RUN` due to `set -u`; instead, this
allows redefining the commands that remove and copy the headers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants