@@ -207,7 +207,7 @@ sub setup_argv
207207 WITH_GTK3 => $ENV {PRIMA_WITH_GTK3 } // ($^O !~ / mswin32/i ),
208208 WITH_OPENMP => $ENV {PRIMA_WITH_OPENMP } // 1,
209209 WITH_COCOA => $ENV {PRIMA_WITH_COCOA } // ($^O eq ' darwin' ),
210- WITH_HOMEBREW => $ENV {PRIMA_WITH_HOMEBREW } // ($^O eq ' darwin' ),
210+ WITH_HOMEBREW => $ENV {PRIMA_WITH_HOMEBREW } // ($^O eq ' darwin' && -d ' /opt/homebrew ' ),
211211 OPTION_IS_ALT => $ENV {OPTION_IS_ALT } // ($^O eq ' darwin' ),
212212 WITH_LIBTHAI => $ENV {PRIMA_WITH_LIBTHAI } // 1,
213213 DEBUG => $ENV {PRIMA_DEBUG } // 0,
@@ -1423,21 +1423,22 @@ sub homebrew_nopkgconfig
14231423{
14241424 my $package = shift ;
14251425 my $root = ' /opt/homebrew' ;
1426+ return unless -d $root ;
14261427
14271428 printlog " Checking for $package using homebrew directory structure..." ;
14281429
1429- goto FAIL unless -d $root ;
14301430 $root .= " /Cellar/$package " ;
14311431 goto FAIL unless -d $root ;
14321432
14331433 my @dirs = sort { $b cmp $a } grep { -d $_ } <$root /*>;
14341434 goto FAIL unless @dirs ;
14351435 $root = $dirs [0];
1436+ my @inc = <$root /include/*.h>;
1437+
14361438 goto FAIL unless
14371439 -d " $root /include" &&
14381440 -d " $root /lib" &&
1439- (<$root /include/*.h>)
1440- ;
1441+ @inc ;
14411442
14421443 my @libs = grep {
14431444 s [ .*\/ ] [] ;
@@ -1680,9 +1681,6 @@ sub setup_xft
16801681This happened because broken setup was detected where both harfbuzz and libXft
16811682depend on freetype2, but one on /opt/X11 and another in /usr/local.
16821683This _WILL_ result in coredumps.
1683- BROKEN_PATH_SETUP
1684-
1685- $END .= <<BROKEN_PATH_SETUP if $cmd_options {WITH_HOMEBREW };
16861684
16871685To resolve the issue install libXft that uses the recent freetype2, with
16881686
@@ -2128,15 +2126,15 @@ sub setup_codecs
21282126 $found = 1 if pkgconfig('libjxl');
21292127 } elsif ( $codec eq 'tiff') {
21302128 $found = 1 if pkgconfig('libtiff-5') || pkgconfig('libtiff-4');
2129+ # homebrew's tiff needs zlib that has .pc laying in some cryptic location, so just hack this intead
2130+ $found = 1 if $MacOSX && !$cmd_options {WITH_HOMEBREW} && homebrew_nopkgconfig('libtiff');
21312131 } elsif ( $codec eq 'Xpm') {
21322132 $found = 1 if pkgconfig('xpm');
21332133 } # gif and jpeg -- I've never seen yet these libs shipped with .pc file, so don't check them so far
2134- elsif ( $MacOSX && !$cmd_options {WITH_HOMEBREW}) {
2134+ elsif ( $MacOSX && !$cmd_options {WITH_HOMEBREW} && $codec eq 'gif' ) {
21352135 # there's no generic path adding on this configuration, so make a horrible hack
21362136 # specifically for this:
2137- if ( $codec eq 'gif') {
2138- $found = 1 if homebrew_nopkgconfig('giflib');
2139- }
2137+ $found = 1 if homebrew_nopkgconfig('giflib');
21402138 }
21412139 if ( $found ) {
21422140 push( @ACTIVE_CODECS , $codec );
0 commit comments