Skip to content

Support BSD in util Bash scripts #5598

@lcheylus

Description

@lcheylus

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}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions