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

Support BSD in util Bash scripts #5598

Closed
lcheylus opened this issue Nov 29, 2023 · 1 comment · Fixed by #5774
Closed

Support BSD in util Bash scripts #5598

lcheylus opened this issue Nov 29, 2023 · 1 comment · Fixed by #5774

Comments

@lcheylus
Copy link
Contributor

lcheylus commented Nov 29, 2023

For Bash scripts in util/ (build-gnu.sh, run-gnu-test.sh, build-code_coverage.sh...), commands for make and readlink are not compatible with BSD OS (FreeBSD, NetBSD and OpenBSD).

  • GNU make, not compatible with make on BSD
  • readlink uses -m flag : not present for readlink on BSD, only in GNU coreutils readlink

On BSD:

  • GNU make could be installed via package (gmake on OpenBSD)
  • GNU coreutils (readlink) is available in coreutils package on OpenBSD

Proposal to modify Bash scripts to be compatible with BSD OS and Linux (with GNU coreutils installed by default)

  • checks OS and defines MAKE/READLINK variables
# Check OS to use GNU coreutils and make: specific version on *BSD
case "$OSTYPE" in
    *bsd*)
        MAKE="gmake"
        READLINK="greadlink"
        ;;
    *)
        MAKE="make"
        READLINK="readlink"
        ;;
esac
  • replace make by ${MAKE}
  • replace readlink by ${READLINK}
@sylvestre
Copy link
Sponsor Contributor

Sure, don't hesitate to submit a PR

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 a pull request may close this issue.

2 participants