Skip to content

Commit

Permalink
Add a script to set up PKG_CONFIG_PATH for certain packages on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m committed Jan 8, 2024
1 parent 7349ecf commit 4e43408
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/setup_pkgconfig_with_homebrew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Homebrew does not put the .pc files in a common place that pkg-config can find.
# This script sets up the PKG_CONFIG_PATH so that the packages can be found by Natalie.
# You can run this prior to running `bin/natalie` or `rake test` or whatever.
#
# Usage:
#
# eval(test/setup_pkgconfig_with_homebrew.sh)

set -e

packages=("libyaml")

if ! type -P brew &>/dev/null; then
echo "Could not find $(brew) command. This script assumes you have Homebrew installed."
exit 1
fi

for package in ${packages[@]}; do
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix $package)/lib/pkgconfig"
done

echo "export PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\""

0 comments on commit 4e43408

Please sign in to comment.