<commit_before>require "formula"

class FreeradiusServer < Formula
  homepage "http://freeradius.org/"
  url "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-2.2.6.tar.gz"
  sha1 "25b0a057b1fffad5a030946e8af0c6170e5cdf46"
  revision 1

  devel do
    url "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-3.0.5.tar.bz2"
    sha1 "53432d83618f0719f8cab5957567fc173959f6e7"
    depends_on "talloc" => :build
  end

  bottle do
    sha1 "3a583d46e2c12badc7addf99fa1db83a8d5315b4" => :yosemite
    sha1 "ee905079281616a48339201938d11fe525d8b23f" => :mavericks
    sha1 "2e8de634e8fcf37a2a4d969d33371281667e5d2d" => :mountain_lion
  end

  depends_on "openssl"

  # libtool is glibtool on OS X
  stable do
    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build
    patch :DATA
  end

  def install
    openssl = Formula["openssl"]

    ENV.deparallelize

    args = [
      "--prefix=#{prefix}",
      "--sbindir=#{bin}",
      "--localstatedir=#{var}",
      "--with-openssl-includes=#{openssl.opt_include}",
      "--with-openssl-libraries=#{openssl.opt_lib}",
    ]

    if build.stable?
      args << "--with-system-libtool"
      args << "--with-system-libltdl"
      inreplace "autogen.sh", "libtool", "glibtool"
      system "./autogen.sh"
    end

    if build.devel?
      talloc = Formula["talloc"]
      args << "--with-talloc-lib-dir=#{talloc.opt_lib}"
      args << "--with-talloc-include-dir=#{talloc.opt_include}"
    end

    system "./configure", *args
    system "make"
    system "make", "install"
  end

  def post_install
    (var/"run/radiusd").mkpath
    (var/"log/radius").mkpath
  end
end

__END__
diff --git a/configure.in b/configure.in
index 62b0de8..97e0243 100644
--- a/configure.in
+++ b/configure.in
@@ -101,7 +101,7 @@ AC_SUBST(LTDL_SUBDIRS)
 dnl use system-wide libtool, if it exists
 AC_ARG_WITH(system-libtool,
 [  --with-system-libtool   Use the libtool installed in your system (default=use our own)],
-[ AC_PATH_PROG(LIBTOOL, libtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
+[ AC_PATH_PROG(LIBTOOL, glibtool,,$PATH:/usr/local/bin) AC_LIBTOOL_DLOPEN
  AC_PROG_LIBTOOL],
 [
   LIBTOOL="`pwd`/libtool"<commit_msg>freeradius-server: revision for openssl<commit_after>class FreeradiusServer < Formula
  homepage "http://freeradius.org/"
  revision 2

  stable do
    url "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-2.2.6.tar.gz"
    sha1 "25b0a057b1fffad5a030946e8af0c6170e5cdf46"

    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build
  end

  devel do
    url "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-3.0.6.tar.bz2"
    sha1 "37c5a38f74a8b228abe9682db9f3184a9c7d9639"
    depends_on "talloc" => :build
  end

  bottle do
    sha1 "3a583d46e2c12badc7addf99fa1db83a8d5315b4" => :yosemite
    sha1 "ee905079281616a48339201938d11fe525d8b23f" => :mavericks
    sha1 "2e8de634e8fcf37a2a4d969d33371281667e5d2d" => :mountain_lion
  end

  depends_on "openssl"

  def install
    ENV.deparallelize

    args = %W[
      --prefix=#{prefix}
      --sbindir=#{bin}
      --localstatedir=#{var}
      --with-openssl-includes=#{Formula["openssl"].opt_include}
      --with-openssl-libraries=#{Formula["openssl"].opt_lib}
    ]

    if build.stable?
      # libtool is glibtool on OS X
      inreplace "configure.in", "libtool,,", "glibtool,,"
      inreplace "autogen.sh", "libtool", "glibtool"

      args << "--with-system-libtool"
      args << "--with-system-libltdl"
      system "./autogen.sh"
    end

    if build.devel?
      args << "--with-talloc-lib-dir=#{Formula["talloc"].opt_lib}"
      args << "--with-talloc-include-dir=#{Formula["talloc"].opt_include}"
    end

    system "./configure", *args
    system "make"
    system "make", "install"
  end

  def post_install
    (var/"run/radiusd").mkpath
    (var/"log/radius").mkpath
  end

  test do
    assert_match /77C8009C912CFFCF3832C92FC614B7D1/, shell_output("#{bin}/smbencrypt homebrew")
  end
end
{'fraction_non_alphanumeric': 0.14222112292851843, 'fraction_numerical': 0.08112787534009398, 'mean_word_length': 3.3390557939914163, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, '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': '941148', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1601, 'n_words': 256}