]> _ Git - alire.git/commit
MacOS; export PATH variables for includes and libraries. (#1420)
authorSimon Wright <simon@pushface.org>
Mon, 21 Aug 2023 15:14:46 +0000 (16:14 +0100)
committerGitHub <noreply@github.com>
Mon, 21 Aug 2023 15:14:46 +0000 (17:14 +0200)
commit239ac4e516ab50b8527598f5b1be8cf0232f239a
tree2f0d6c9bc3b7a87eec489e27fd5ad138380ff057
parent7b9b4cae1c75627a00b32e848d763806af300f6d
MacOS; export PATH variables for includes and libraries. (#1420)

* MacOS; export PATH variables for includes and libraries.

Homebrew and MacPorts install include files and libraries in places
where GCC won't look by default.

GCC will use these environment variables if set:

   C_INCLUDE_PATH     for C includes
   CPLUS_INCLUDE_PATH for C++ includes
   LIBRARY_PATH       for libraries

Both of the distribution managers place (symbolic links to) include
files in ${top_level}/include and libraries in ${top_level}/lib.

   For Homebrew on Intel silicon, top_level is normally /usr/local.
   For Homebrew on Apple silicon, top_level is normally /opt/homebrew.
   For MacPorts,                  top_level is normally /opt/local

  * src/alire/alire-platforms-current.ads (Load_Environment): add note
      on macOS use.
  * src/alire/os_macos/alire-platforms-current__macos.adb
    (context): added Alire.Environment (was limited), Ada.Directories.
    (Brew_Access): new.
    (Homebrew_Present): if Brew_Access is not null.
    (Detected_Distribution): made into an expression function.
    (Containing_Containing_Dir): new, used in Distribution_Root.
    (Distribution_Root): reworked.
    (Load_Environment): if either distribution is present, arrange to
      export the environment variables to suit.

* Update testsuite to match new macOS distribution detection.

  * testsuite/drivers/helpers.py (distribution): if on macOS, check whether
      the distribution management tool is on the PATH. We used to check for
      the environment variable HOMEBREW_PREFIX, but users don't have to
      arrange for this to be set in order to run Homebrew.

      First, if 'brew' is found, the distribution is Homebrew.
      If not and 'port' is found, the distribution is MacPorts.
      Otherwise, the distribution is unknown.

* In the macOS CI workflow, run the test script once only.

  * .github/workflows/ci-macos.yml (Run test script): remove the second
      call, which set up HOMEBREW_PREFIX (now no longer used by alr),
      and remove the note '(without Homebrew)' in the first.
.github/workflows/ci-macos.yml
src/alire/alire-platforms-current.ads
src/alire/os_macos/alire-platforms-current__macos.adb
testsuite/drivers/helpers.py