homebrew-core/Formula/gearman.rb
Dossy Shiobara ec13fb4be6 gearman: apply patch to fix configure
In gearman-0.28, configure.ac has some bad copypasta that ends up
breaking the build on platforms that do not have librt, such as
MacOS X.

configure.ac --

    173 # Check for -lrt
    174 AC_CHECK_LIB([rt], [clock_gettime],
    175              [
    176               RT_LIB="-lrt"
    177               AC_SUBST(RT_LIB)
    178               AC_DEFINE([HAVE_LIBRT], [ 1 ], [Have clock_gettime])
    179               ],
    180              [
    181               AC_DEFINE([HAVE_LIBRT], [ 0 ], [Have clock_gettime])
    182               ])
    183
    184 # Check for -lm
    185 AC_CHECK_LIB([m], [floor],
    186              [
    187               M_LIB="-lrt"
    188               AC_SUBST(M_LIB)
    189               AC_DEFINE([HAVE_LIBRT], [ 1 ], [Have clock_gettime])
    190               ],
    191              [
    192               AC_DEFINE([HAVE_LIBRT], [ 0 ], [Have clock_gettime])
    193               ])

As the comment on line 184 indicates, it's supposed to be checking for
libm, not librt.  This commit corrects this, which fixes issue Homebrew/homebrew#10222.

Closes Homebrew/homebrew#10823.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-03-11 11:24:17 -05:00

105 lines
2.8 KiB
Ruby

require 'formula'
class Gearman < Formula
homepage 'http://gearman.org/'
url 'http://launchpad.net/gearmand/trunk/0.28/+download/gearmand-0.28.tar.gz'
md5 '43fc281297489a53d4ee081e33c728db'
depends_on 'boost'
depends_on 'libevent'
depends_on 'ossp-uuid'
def patches
# gearman-0.28 build error "ld: library not found for -lrt"
# see https://bugs.launchpad.net/gearmand/+bug/951198
DATA
end
def install
system "./configure", "--prefix=#{prefix}"
system "make install"
plist_path.write startup_plist
plist_path.chmod 0644
end
def caveats
<<-EOS.undent
If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp #{plist_path} ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
If this is an upgrade and you already have the #{plist_path.basename} loaded:
launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
cp #{plist_path} ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
To start gearmand manually:
gearmand -d
EOS
end
def startup_plist
return <<-EOPLIST
<?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>Program</key>
<string>#{sbin}/gearmand</string>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>#{`whoami`.chomp}</string>
</dict>
</plist>
EOPLIST
end
end
__END__
--- gearmand-0.28/configure.ac.orig 2012-03-09 14:56:28.000000000 -0500
+++ gearmand-0.28/configure.ac 2012-03-09 14:56:58.000000000 -0500
@@ -184,12 +184,12 @@
# Check for -lm
AC_CHECK_LIB([m], [floor],
[
- M_LIB="-lrt"
+ M_LIB="-lm"
AC_SUBST(M_LIB)
- AC_DEFINE([HAVE_LIBRT], [ 1 ], [Have clock_gettime])
+ AC_DEFINE([HAVE_LIBM], [ 1 ], [Have floor])
],
[
- AC_DEFINE([HAVE_LIBRT], [ 0 ], [Have clock_gettime])
+ AC_DEFINE([HAVE_LIBM], [ 0 ], [Have floor])
])
AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
--- gearmand-0.28/configure.orig 2012-03-09 15:06:11.000000000 -0500
+++ gearmand-0.28/configure 2012-03-09 15:06:45.000000000 -0500
@@ -25755,16 +25790,16 @@
$as_echo "$ac_cv_lib_m_floor" >&6; }
if test "x$ac_cv_lib_m_floor" = xyes; then :
- M_LIB="-lrt"
+ M_LIB="-lm"
-$as_echo "#define HAVE_LIBRT 1 " >>confdefs.h
+$as_echo "#define HAVE_LIBM 1 " >>confdefs.h
else
-$as_echo "#define HAVE_LIBRT 0 " >>confdefs.h
+$as_echo "#define HAVE_LIBM 0 " >>confdefs.h
fi