homebrew-core/Formula/freetds.rb
2016-11-06 01:13:34 -08:00

85 lines
2.7 KiB
Ruby

class Freetds < Formula
desc "Libraries to talk to Microsoft SQL Server and Sybase databases"
homepage "http://www.freetds.org/"
url "ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.16.tar.gz"
mirror "https://fossies.org/linux/privat/freetds-1.00.16.tar.gz"
sha256 "2a770580348ddb1b817e0b70bd2e739e67c7462b0c2f2c96b5634ac4525b4ae4"
bottle do
sha256 "940ca4f64cee85ee2b69cd1c95a2e85dd58e93f0d61710220fe0656804733d54" => :sierra
sha256 "c2aed99497cfa0df1c9a968a9229bca2b0fddaa20b49f7207403917c6455c9dc" => :el_capitan
sha256 "43731a3757f1f2cc164c051fa4d1894356bce9cdaf8f22c7746ca1453cbac8a5" => :yosemite
end
head do
url "https://github.com/FreeTDS/freetds.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "gettext" => :build
depends_on "libtool" => :build
end
option :universal
option "with-msdblib", "Enable Microsoft behavior in the DB-Library API where it diverges from Sybase's"
option "with-sybase-compat", "Enable close compatibility with Sybase's ABI, at the expense of other features"
option "with-odbc-wide", "Enable odbc wide, prevent unicode - MemoryError's"
option "with-krb5", "Enable Kerberos support"
deprecated_option "enable-msdblib" => "with-msdblib"
deprecated_option "enable-sybase-compat" => "with-sybase-compat"
deprecated_option "enable-odbc-wide" => "with-odbc-wide"
deprecated_option "enable-krb" => "with-krb5"
depends_on "pkg-config" => :build
depends_on "unixodbc" => :optional
depends_on "libiodbc" => :optional
depends_on "openssl" => :recommended
def install
if build.with?("unixodbc") && build.with?("libiodbc")
odie "freetds: --without-libiodbc must be specified when using --with-unixodbc"
end
args = %W[
--prefix=#{prefix}
--with-tdsver=7.3
--mandir=#{man}
]
if build.with? "openssl"
args << "--with-openssl=#{Formula["openssl"].opt_prefix}"
end
if build.with? "unixodbc"
args << "--with-unixodbc=#{Formula["unixodbc"].opt_prefix}"
end
if build.with? "libiodbc"
args << "--with-libiodbc=#{Formula["libiodbc"].opt_prefix}"
end
# Translate formula's "--with" options to configuration script's "--enable"
# options
%w[msdblib sybase-compat odbc-wide krb5].each do |option|
if build.with? option
args << "--enable-#{option}"
end
end
ENV.universal_binary if build.universal?
if build.head?
system "./autogen.sh", *args
else
system "./configure", *args
end
system "make"
ENV.j1 # Or fails to install on multi-core machines
system "make", "install"
end
test do
system "#{bin}/tsql", "-C"
end
end