Skip to content

Commit

Permalink
Merge pull request #194885 from Homebrew/pkgconf-symlink
Browse files Browse the repository at this point in the history
pkgconf: drop-in replacement for `pkg-config`
  • Loading branch information
BrewTestBot authored Nov 12, 2024
2 parents 871be5c + 2fb7565 commit 0c35794
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 118 deletions.
1 change: 1 addition & 0 deletions Aliases/pkg-config
2 changes: 1 addition & 1 deletion Aliases/pkgconfig
92 changes: 0 additions & 92 deletions Formula/p/pkg-config.rb

This file was deleted.

53 changes: 28 additions & 25 deletions Formula/p/pkgconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@ class Pkgconf < Formula
desc "Package compiler and linker metadata toolkit"
homepage "https://github.com/pkgconf/pkgconf"
url "https://distfiles.ariadne.space/pkgconf/pkgconf-2.3.0.tar.xz"
mirror "http://distfiles.ariadne.space/pkgconf/pkgconf-2.3.0.tar.xz"
sha256 "3a9080ac51d03615e7c1910a0a2a8df08424892b5f13b0628a204d3fcce0ea8b"
license "ISC"
revision 1

livecheck do
url "https://distfiles.ariadne.space/pkgconf/"
regex(/href=.*?pkgconf[._-]v?(\d+(?:\.\d+)+)\.t/i)
end

bottle do
sha256 arm64_sequoia: "18c4da47fd2032c4edfac853b772e1a16a745a0c67335b86931fb2bec8c10933"
sha256 arm64_sonoma: "4d7c5803943bf2dcc8cb9ff8c838ea4283eeab24f49982df044cbc3031856fd8"
sha256 arm64_ventura: "e0b2a95c807578a166fab8467305f1d54db32fe0656a4d6cb746c2356146b074"
sha256 arm64_monterey: "ac13529811ba6f3e57f7f4048711720d073e10a8797768073626f5d6daabbf76"
sha256 sequoia: "9b44fe313d296fa10617d6b58ea1eab78bf217b6f00478ad98b01e0375475472"
sha256 sonoma: "1db60da1d512bb109dd455f03856e790a156137f9d77f1f507ac72d538a1c1e2"
sha256 ventura: "5f272a6b79920f7c236eaa01d94fc8da99ebc79947a56d1808a19d436571c9c8"
sha256 monterey: "802a81f3ca1ea1a14699d6e2359e0ccd30ef310142c6c305b17d881cbd6d2ed0"
sha256 x86_64_linux: "67710376078e1191ece25d69214d9ced135195b07c24a386db0d9aee590c8ead"
sha256 arm64_sequoia: "e20314280a6fccd1153b13f137f9e7a15fc4450c877d548360a259c22266efa0"
sha256 arm64_sonoma: "5f83615f295e78e593c767d84f3eddf61bfb0b849a1e6a5ea343506b30b2c620"
sha256 arm64_ventura: "715c2c815d44a6c06da7e249c6b7d6f10c51784866c1ca43c22e5d56c45d5ebd"
sha256 sonoma: "b180115e5725a12657fa74d80f0c8f15e852d6c84b7f982b72b5be4f5cd0e97a"
sha256 ventura: "7077e63921d21433ef33d38a2a4cd14f2b08bccf6647bcc25b3f285135e9038c"
sha256 x86_64_linux: "4fe98600d631d8d816217b96f905beb7ee40f2b736a3b74621973f908b6d295a"
end

head do
Expand All @@ -30,8 +29,6 @@ class Pkgconf < Formula
depends_on "libtool" => :build
end

conflicts_with "pkg-config", because: "both install `pkg.m4` file"

def install
if build.head?
ENV["LIBTOOLIZE"] = "glibtoolize"
Expand All @@ -42,27 +39,33 @@ def install
#{HOMEBREW_PREFIX}/lib/pkgconfig
#{HOMEBREW_PREFIX}/share/pkgconfig
]
pc_path << if OS.mac?
pc_path << "/usr/local/lib/pkgconfig"
pc_path << "/usr/lib/pkgconfig"
"#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"
pc_path += if OS.mac?
%W[
/usr/local/lib/pkgconfig
/usr/lib/pkgconfig
#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}
]
else
"#{HOMEBREW_LIBRARY}/Homebrew/os/linux/pkgconfig"
["#{HOMEBREW_LIBRARY}/Homebrew/os/linux/pkgconfig"]
end

pc_path = pc_path.uniq.join(File::PATH_SEPARATOR)

configure_args = std_configure_args + %W[
--with-pkg-config-dir=#{pc_path}
]

system "./configure", *configure_args
system "./configure", "--disable-silent-rules",
"--with-pkg-config-dir=#{pc_path.uniq.join(File::PATH_SEPARATOR)}",
*std_configure_args
system "make"
system "make", "install"

# Make `pkgconf` a drop-in replacement for `pkg-config` by adding symlink[^1].
# Similar to Debian[^2], Fedora, ArchLinux and MacPorts.
#
# [^1]: https://github.com/pkgconf/pkgconf/#pkg-config-symlink
# [^2]: https://salsa.debian.org/debian/pkgconf/-/blob/debian/unstable/debian/pkgconf.links?ref_type=heads
bin.install_symlink "pkgconf" => "pkg-config"
man1.install_symlink "pkgconf.1" => "pkg-config.1"
end

test do
(testpath/"foo.pc").write <<~EOS
(testpath/"foo.pc").write <<~PC
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}/include
Expand All @@ -73,7 +76,7 @@ def install
Version: 1.0.0
Cflags: -I${includedir}/foo
Libs: -L${libdir} -lfoo
EOS
PC

ENV["PKG_CONFIG_LIBDIR"] = testpath
system bin/"pkgconf", "--validate", "foo"
Expand Down

0 comments on commit 0c35794

Please sign in to comment.