-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
class PkgConfig < Formula | ||
desc "Manage compile and link flags for libraries" | ||
homepage "https://freedesktop.org/wiki/Software/pkg-config/" | ||
url "https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz" | ||
mirror "http://fresh-center.net/linux/misc/pkg-config-0.29.2.tar.gz" | ||
mirror "http://fresh-center.net/linux/misc/legacy/pkg-config-0.29.2.tar.gz" | ||
sha256 "6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591" | ||
license "GPL-2.0-or-later" | ||
revision 3 | ||
|
||
livecheck do | ||
url "https://pkg-config.freedesktop.org/releases/" | ||
regex(/href=.*?pkg-config[._-]v?(\d+(?:\.\d+)+)\./i) | ||
end | ||
|
||
bottle do | ||
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/pkg-config-0.29.2" | ||
sha256 cellar: :any_skip_relocation, aarch64_linux: "93d9c18bc0d8a5ab75dd54dcec921358da79d4036c8de7471de4d3aa15279fb7" | ||
end | ||
|
||
conflicts_with "pkgconf", because: "both install `pkg.m4` file" | ||
|
||
# FIXME: The bottle is mistakenly considered relocatable on Linux. | ||
# See https://github.com/Homebrew/homebrew-core/pull/85032. | ||
pour_bottle? only_if: :default_prefix | ||
|
||
def install | ||
pc_path = %W[ | ||
#{HOMEBREW_PREFIX}/lib/pkgconfig | ||
#{HOMEBREW_PREFIX}/share/pkgconfig | ||
] | ||
pc_path << if OS.mac? | ||
system_include_path = "#{MacOS.sdk_path_if_needed}/usr/include" | ||
|
||
pc_path << "/usr/local/lib/pkgconfig" | ||
pc_path << "/usr/lib/pkgconfig" | ||
"#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}" | ||
else | ||
system_include_path = "/usr/include" | ||
|
||
"#{HOMEBREW_LIBRARY}/Homebrew/os/linux/pkgconfig" | ||
end | ||
|
||
pc_path = pc_path.uniq.join(File::PATH_SEPARATOR) | ||
|
||
# Work-around for build issue with Xcode 15.3 | ||
# https://gitlab.freedesktop.org/pkg-config/pkg-config/-/issues/81 | ||
ENV.append_to_cflags "-Wno-int-conversion" | ||
|
||
system "./configure", "--disable-debug", | ||
"--prefix=#{prefix}", | ||
"--disable-host-tool", | ||
"--with-internal-glib", | ||
"--with-pc-path=#{pc_path}", | ||
"--with-system-include-path=#{system_include_path}" | ||
system "make" | ||
system "make", "install" | ||
end | ||
|
||
test do | ||
(testpath/"foo.pc").write <<~EOS | ||
prefix=/usr | ||
exec_prefix=${prefix} | ||
includedir=${prefix}/include | ||
libdir=${exec_prefix}/lib | ||
Name: foo | ||
Description: The foo library | ||
Version: 1.0.0 | ||
Cflags: -I${includedir}/foo | ||
Libs: -L${libdir} -lfoo | ||
EOS | ||
|
||
ENV["PKG_CONFIG_LIBDIR"] = testpath | ||
system bin/"pkg-config", "--validate", "foo" | ||
assert_equal "1.0.0\n", shell_output("#{bin}/pkg-config --modversion foo") | ||
assert_equal "-lfoo\n", shell_output("#{bin}/pkg-config --libs foo") | ||
assert_equal "-I/usr/include/foo\n", shell_output("#{bin}/pkg-config --cflags foo") | ||
end | ||
end |