homebrew-core/Formula/freetds.rb
2018-09-21 12:31:36 +08:00

82 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 "http://www.freetds.org/files/stable/freetds-1.00.98.tar.bz2"
mirror "https://fossies.org/linux/privat/freetds-1.00.98.tar.bz2"
sha256 "a340ad1ce0d320551686af587db1ef93fe6130a14f8e7bde0fd3b33ab4d0515a"
bottle do
sha256 "bcd468f7e79650683c46172ddf35606fe36453009b54877e3bf6e941ec153312" => :mojave
sha256 "5ed416f2e9b2308da78bb031e69866f12343b288db3cbe08d4c892cf65a598ad" => :high_sierra
sha256 "b22d8d8bf72c139e56ec7d5389a6459669852e17fe2e2e84ddcc352e694995d2" => :sierra
sha256 "1d280805055fd549f0ad1da5d79387aa4ae18e11f486f07f619ba6f135d776fa" => :el_capitan
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 "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 "openssl" => :recommended
depends_on "libiodbc" => :optional
depends_on "unixodbc" => :optional
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}
--sysconfdir=#{etc}
]
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|
args << "--enable-#{option}" if build.with? option
end
if build.head?
system "./autogen.sh", *args
else
system "./configure", *args
end
system "make"
ENV.deparallelize # Or fails to install on multi-core machines
system "make", "install"
end
test do
system "#{bin}/tsql", "-C"
end
end