<commit_before>#!/usr/bin/ruby
require 'global'
require 'formula'
require 'keg'
require 'brew.h'

show_summary_heading = false

def text_for_keg_only_formula f
  if f.keg_only?.kind_of? String
    rationale = "The formula provides the following rationale:\n\n#{f.keg_only?.chomp}"
  else
    rationale = "The formula didn't provide any rationale for this."
  end
  <<-EOS
#{f.name} is keg-only. This means it is not symlinked into Homebrew's
prefix. #{rationale}

Generally there are no consequences of this for you, however if you build your
own software and it requires this formula, you may want to run this command to
link it into the Homebrew prefix:

     brew link #{f.name}
EOS
end


def ENV_append key, value, separator = ' '
  if ENV[key] and not ENV[key].empty?
    ENV[key] += separator+value
  else
    ENV[key] = value
  end
end


def install f
  f.deps.each do |dep|
    dep = Formula.factory dep
    if dep.keg_only?
      ENV_append 'LDFLAGS', "-L#{dep.lib}"
      ENV_append 'CPPFLAGS', "-I#{dep.include}"
      ENV_append 'PATH', "#{dep.bin}", ':'
    end
  end

  build_time = nil
  begin
    f.brew do
      if ARGV.flag? '--interactive'
        ohai "Entering interactive mode"
        puts "Type `exit' to return and finalize the installation"
        puts "Install to this prefix: #{f.prefix}"
        interactive_shell
        nil
      elsif ARGV.include? '--help'
        system './configure --help'
        exit $?
      else
        f.prefix.mkpath
        beginning=Time.now
        f.install<commit_msg>Add to PKG_CONFIG_PATH for keg-only deps<commit_after>#!/usr/bin/ruby
require 'global'
require 'formula'
require 'keg'
require 'brew.h'

show_summary_heading = false

def text_for_keg_only_formula f
  if f.keg_only?.kind_of? String
    rationale = "The formula provides the following rationale:\n\n#{f.keg_only?.chomp}"
  else
    rationale = "The formula didn't provide any rationale for this."
  end
  <<-EOS
#{f.name} is keg-only. This means it is not symlinked into Homebrew's
prefix. #{rationale}

Generally there are no consequences of this for you, however if you build your
own software and it requires this formula, you may want to run this command to
link it into the Homebrew prefix:

     brew link #{f.name}
EOS
end


def ENV_prepend key, value, separator = ' '
  if ENV[key] and not ENV[key].empty?
    ENV[key] = value+separator+ENV[key]
  else
    ENV[key] = value
  end
end


def install f
  f.deps.each do |dep|
    dep = Formula.factory dep
    if dep.keg_only?
      ENV_prepend 'LDFLAGS', "-L#{dep.lib}"
      ENV_prepend 'CPPFLAGS', "-I#{dep.include}"
      ENV_prepend 'PATH', "#{dep.bin}", ':'
      ENV_prepend 'PKG_CONFIG_PATH', dep.lib+'pkgconfig', ':'
    end
  end

  build_time = nil
  begin
    f.brew do
      if ARGV.flag? '--interactive'
        ohai "Entering interactive mode"
        puts "Type `exit' to return and finalize the installation"
        puts "Install to this prefix: #{f.prefix}"
        interactive_shell
        nil
      elsif ARGV.include? '--help'
        system './configure --help'
        exit $?
      else
        f.prefix.mkpath
        beginning=Time.now
        f.install
{'fraction_non_alphanumeric': 0.10539602398232881, 'fraction_numerical': 0.0, 'mean_word_length': 2.819277108433735, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7290418', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1049, 'n_words': 343}