<commit_before>require "formula"

class Transmission < Formula
  homepage "http://www.transmissionbt.com/"
  url "https://transmission.cachefly.net/transmission-2.84.tar.xz"
  sha1 "455359bc1fa34aeecc1bac9255ad0c884b94419c"

  option "with-nls", "Build with native language support"

  depends_on "pkg-config" => :build
  depends_on "curl" if MacOS.version <= :leopard
  depends_on "libevent"

  if build.with? "nls"
    depends_on "intltool" => :build
    depends_on "gettext"
  end
  depends_on "homebrew/homebrew-dupes/libiconv" unless OS.mac?

  def install
    ENV.append "LDFLAGS", "-framework Foundation -prebind" if OS.mac?
    ENV.append "LDFLAGS", "-liconv"

    args = %W[--disable-dependency-tracking
              --prefix=#{prefix}
              --disable-mac
              --without-gtk]

    args << "--disable-nls" if build.without? "nls"

    #fixes issue w/ webui files not being found #21151
    #submitted upstream: https://trac.transmissionbt.com/ticket/5304
    inreplace "libtransmission/platform.c", "SYS_DARWIN", "BUILD_MAC_CLIENT"
    inreplace "libtransmission/utils.c", "SYS_DARWIN", "BUILD_MAC_CLIENT"

    system "./configure", *args
    system "make" # Make and install in one step fails
    system "make install"

    (var/"transmission").mkpath
  end

  def caveats; <<-EOS.undent
    This formula only installs the command line utilities.
    Transmission.app can be downloaded from Transmission's website:
      http://www.transmissionbt.com
    EOS
  end

  plist_options :manual => 'transmission-daemon --foreground'

  def plist; <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>Label</key>
        <string>#{plist_name}</string>
        <key>ProgramArguments</key>
        <array>
          <string>#{opt_bin}/transmission-daemon</string>
          <string>--foreground</string>
          <string>--config-dir</string>
          <string>#{var}/transmission/</string>
          <string>--log-info</string>
          <string>--logfile</string>
          <string>#{var}/transmission/transmission-daemon.log</string>
        </array>
        <key>KeepAlive</key>
        <dict>
          <key>NetworkState</key>
          <true/>
        </dict>
      </dict>
    </plist>
    EOS
  end
end
<commit_msg>transmission 2.84: Disable libiconv for Linuxbrew<commit_after>require "formula"

class Transmission < Formula
  homepage "http://www.transmissionbt.com/"
  url "https://transmission.cachefly.net/transmission-2.84.tar.xz"
  sha1 "455359bc1fa34aeecc1bac9255ad0c884b94419c"

  option "with-nls", "Build with native language support"

  depends_on "pkg-config" => :build
  depends_on "curl" if MacOS.version <= :leopard
  depends_on "libevent"

  if build.with? "nls"
    depends_on "intltool" => :build
    depends_on "gettext"
  end

  def install
    ENV.append "LDFLAGS", "-framework Foundation -prebind" if OS.mac?
    ENV.append "LDFLAGS", "-liconv" if OS.mac?

    args = %W[--disable-dependency-tracking
              --prefix=#{prefix}
              --disable-mac
              --without-gtk]

    args << "--disable-nls" if build.without? "nls"

    #fixes issue w/ webui files not being found #21151
    #submitted upstream: https://trac.transmissionbt.com/ticket/5304
    inreplace "libtransmission/platform.c", "SYS_DARWIN", "BUILD_MAC_CLIENT"
    inreplace "libtransmission/utils.c", "SYS_DARWIN", "BUILD_MAC_CLIENT"

    system "./configure", *args
    system "make" # Make and install in one step fails
    system "make install"

    (var/"transmission").mkpath
  end

  def caveats; <<-EOS.undent
    This formula only installs the command line utilities.
    Transmission.app can be downloaded from Transmission's website:
      http://www.transmissionbt.com
    EOS
  end

  plist_options :manual => 'transmission-daemon --foreground'

  def plist; <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>Label</key>
        <string>#{plist_name}</string>
        <key>ProgramArguments</key>
        <array>
          <string>#{opt_bin}/transmission-daemon</string>
          <string>--foreground</string>
          <string>--config-dir</string>
          <string>#{var}/transmission/</string>
          <string>--log-info</string>
          <string>--logfile</string>
          <string>#{var}/transmission/transmission-daemon.log</string>
        </array>
        <key>KeepAlive</key>
        <dict>
          <key>NetworkState</key>
          <true/>
        </dict>
      </dict>
    </plist>
    EOS
  end
end

{'fraction_non_alphanumeric': 0.14229331117573743, 'fraction_numerical': 0.019318653926049024, 'mean_word_length': 2.7152777777777777, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 2, '>': 79, 'https://': 4, 'lorem ipsum': 0, 'www.': 6, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '624802', 'n_tokens_mistral': 1691, 'n_tokens_neox': 1589, 'n_words': 331}