@@ -4,6 +4,7 @@ class Pkgconf < Formula
4
4
url "https://distfiles.ariadne.space/pkgconf/pkgconf-2.3.0.tar.xz"
5
5
sha256 "3a9080ac51d03615e7c1910a0a2a8df08424892b5f13b0628a204d3fcce0ea8b"
6
6
license "ISC"
7
+ revision 1
7
8
8
9
livecheck do
9
10
url "https://distfiles.ariadne.space/pkgconf/"
@@ -28,35 +29,61 @@ class Pkgconf < Formula
28
29
depends_on "libtool" => :build
29
30
end
30
31
31
- conflicts_with "pkg-config" , because : "both install `pkg .m4` file "
32
+ depends_on "pkg.m4"
32
33
33
34
def install
34
35
if build . head?
35
36
ENV [ "LIBTOOLIZE" ] = "glibtoolize"
36
37
system "./autogen.sh"
37
38
end
38
39
40
+ system_prefix = "/usr"
39
41
pc_path = %W[
40
42
#{ HOMEBREW_PREFIX } /lib/pkgconfig
41
43
#{ HOMEBREW_PREFIX } /share/pkgconfig
42
44
]
43
45
pc_path << if OS . mac?
44
- pc_path << "/usr/local/lib/pkgconfig"
46
+ system_prefix = "#{ MacOS . sdk_path_if_needed } /usr"
47
+
48
+ pc_path << "/usr/local/lib/pkgconfig" if HOMEBREW_PREFIX . to_s != "/usr/local"
45
49
pc_path << "/usr/lib/pkgconfig"
46
50
"#{ HOMEBREW_LIBRARY } /Homebrew/os/mac/pkgconfig/#{ MacOS . version } "
47
51
else
48
52
"#{ HOMEBREW_LIBRARY } /Homebrew/os/linux/pkgconfig"
49
53
end
50
54
51
- pc_path = pc_path . uniq . join ( File ::PATH_SEPARATOR )
52
-
53
- configure_args = std_configure_args + %W[
54
- --with-pkg-config-dir=#{ pc_path }
55
+ args = %W[
56
+ --with-pkg-config-dir=#{ pc_path . uniq . join ( File ::PATH_SEPARATOR ) }
57
+ --with-personality-dir=#{ HOMEBREW_PREFIX } /share/pkgconfig/personality.d:#{ etc } /pkgconfig/personality.d
58
+ --with-system-includedir=#{ HOMEBREW_PREFIX } /include:#{ system_prefix } /include
59
+ --with-system-libdir=#{ HOMEBREW_PREFIX } /lib:#{ system_prefix } /lib
60
+ --disable-silent-rules
55
61
]
56
62
57
- system "./configure" , *configure_args
63
+ system "./configure" , *args , * std_configure_args
58
64
system "make"
59
65
system "make" , "install"
66
+
67
+ # Move `pkg.m4` into libexec to make it easier for migration to `pkgconf`
68
+ libexec . install share /"aclocal/pkg.m4"
69
+
70
+ # TODO: Consider making `pkgconf` a drop-in replacement to `pkg-config` by adding
71
+ # symlink and restoring conflicts. Similar to Debian, Fedora, ArchLinux and MacPorts.
72
+ # Alternatively can keep separate non-conflicting commands and update `pkg.m4` to use
73
+ # `pkgconf` copy after sufficiently migrated.
74
+ # Ref: https://github.com/pkgconf/pkgconf/#pkg-config-symlink
75
+ # Ref: https://salsa.debian.org/debian/pkgconf/-/blob/debian/unstable/debian/pkgconf.links?ref_type=heads
76
+ #
77
+ # bin.install_symlink "pkgconf" => "pkg-config"
78
+ # man1.install_symlink "pkgconf.1" => "pkg-config.1"
79
+ end
80
+
81
+ def caveats
82
+ <<~EOS
83
+ To allow easier migration from `pkg-config` to `pkgconf`, the `pkgconf` formula
84
+ uses `pkg-config`'s pkg.m4 to avoid conflict. If you need the copy from `pkgconf`,
85
+ then it is available at #{ libexec } /pkg.m4
86
+ EOS
60
87
end
61
88
62
89
test do
0 commit comments