Skip to content

Instantly share code, notes, and snippets.

@mistydemeo
Last active December 17, 2015 00:10
Show Gist options
  • Save mistydemeo/5519261 to your computer and use it in GitHub Desktop.
Save mistydemeo/5519261 to your computer and use it in GitHub Desktop.
Homebrew OpenSMTPD formula
require 'formula'
class Opensmtpd < Formula
homepage 'http://www.opensmtpd.org'
url 'http://www.opensmtpd.org/archives/opensmtpd-5.3.1p1.tar.gz'
sha256 '64e0aaa5145894af23a1e28cba7e8435931a6c4e671db7669327478e01a1c28e'
version '5.3.1p1'
depends_on :autoconf
depends_on :automake
depends_on :libtool
# build fails with the system bison
depends_on 'bison' => :build
depends_on 'pkg-config' => :build
depends_on 'libevent'
if HOMEBREW_PREFIX.to_s == '/usr/local'
conflicts_with 'berkeley-db', :because => <<-EOS.undent
OpenSMTPD is only compatible with DB 1.5, which comes
with OS X; having a more recent version linked into /usr/local will
cause OpenSMTPD's build to fail.
EOS
end
def patches
# OS X doesn't define MSG_NOSIGNAL
# Reported upstream: http://article.gmane.org/gmane.mail.opensmtpd.general/533
"https://gist.github.com/rheoli/530ca21dd31da0c9670e/raw/5a673e94a61012a2544826465008a889eea26681/res_send_async.c.patch"
end
def install
# README.md specifies this as necessary
ENV.append_to_cflags "-DBIND_8_COMPAT=1"
system "./bootstrap"
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--with-libevent-dir=#{Formula.factory('libevent').opt_prefix}"
system "make install"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment