aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authornibbles 2bits2012-09-19 09:53:51 -0700
committerMax Howell2012-09-24 09:58:47 -0400
commit214491a97442af53d226bf70bff4829d64cb0642 (patch)
tree4130d8914ad43c0af93b3d5f4b5b6ab32981dd08 /Library/Formula
parent128a59cc20f123acdff5b9cfbb220cb2d80d8cea (diff)
downloadhomebrew-214491a97442af53d226bf70bff4829d64cb0642.tar.bz2
libnids: build the shared library
libnids is used by dsniff, but libnids only builds a static library due to being coded in 2005 before much use of `.dylib` etc. By patching libnids to build a shared library, we can get dsniff to link against it and against glib and gthread correctly without `LDFLAGS` hacking. - Add deps on automake anb libtool to run `autoreconf` - Run autoreconf to fix any issues in 2005 era configure. - Add configure flag to `--enable-shared` - Add patch to fix errors building shared with `-soname` and `.so` - Works well with superenv and dnsiff Fixes #14363 Closes #15011. Signed-off-by: Max Howell <mxcl@me.com>
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/libnids.rb42
1 files changed, 41 insertions, 1 deletions
diff --git a/Library/Formula/libnids.rb b/Library/Formula/libnids.rb
index 448d61d7e..f928e2891 100644
--- a/Library/Formula/libnids.rb
+++ b/Library/Formula/libnids.rb
@@ -9,11 +9,20 @@ class Libnids < Formula
option "disable-libglib", "Don't use glib2 for multiprocessing support"
depends_on 'pkg-config' => :build
+ depends_on :automake => :build
+ depends_on :libtool => :build
depends_on 'libnet' => :recommended unless build.include? "disable-libnet"
depends_on 'glib' => :recommended unless build.include? "disable-libglib"
+ # Patch fixes -soname and .so shared library issues. Unreported.
+ def patches
+ DATA
+ end
+
def install
- args = ["--prefix=#{prefix}", "--mandir=#{man}"]
+ # autoreconf the old 2005 era code for sanity.
+ system 'autoreconf', '-ivf'
+ args = ["--prefix=#{prefix}", "--mandir=#{man}", "--enable-shared"]
args << "--disable-libnet" if build.include? "disable-libnet"
args << "--disable-libglib" if build.include? "disable-libglib"
@@ -21,3 +30,34 @@ class Libnids < Formula
system "make install"
end
end
+
+__END__
+--- a/src/Makefile.in 2010-03-01 13:13:17.000000000 -0800
++++ b/src/Makefile.in 2012-09-19 09:48:23.000000000 -0700
+@@ -13,7 +13,7 @@
+ libdir = @libdir@
+ mandir = @mandir@
+ LIBSTATIC = libnids.a
+-LIBSHARED = libnids.so.1.24
++LIBSHARED = libnids.1.24.dylib
+
+ CC = @CC@
+ CFLAGS = @CFLAGS@ -DLIBNET_VER=@LIBNET_VER@ -DHAVE_ICMPHDR=@ICMPHEADER@ -DHAVE_TCP_STATES=@TCPSTATES@ -DHAVE_BSD_UDPHDR=@HAVE_BSD_UDPHDR@
+@@ -65,7 +65,7 @@
+ ar -cr $@ $(OBJS)
+ $(RANLIB) $@
+ $(LIBSHARED): $(OBJS_SHARED)
+- $(CC) -shared -Wl,-soname,$(LIBSHARED) -o $(LIBSHARED) $(OBJS_SHARED) $(LIBS) $(LNETLIB) $(PCAPLIB)
++ $(CC) -Wl,-dylib -Wl,-install_name -Wl,$(LIBSHARED) -Wl,-headerpad_max_install_names -o $(LIBSHARED) $(OBJS_SHARED) $(LIBS) $(LNETLIB) $(PCAPLIB)
+
+ _install install: $(LIBSTATIC)
+ ../mkinstalldirs $(install_prefix)$(libdir)
+@@ -76,7 +76,7 @@
+ $(INSTALL) -c -m 644 libnids.3 $(install_prefix)$(mandir)/man3
+ _installshared installshared: install $(LIBSHARED)
+ $(INSTALL) -c -m 755 $(LIBSHARED) $(install_prefix)$(libdir)
+- ln -s -f $(LIBSHARED) $(install_prefix)$(libdir)/libnids.so
++ ln -s -f $(LIBSHARED) $(install_prefix)$(libdir)/libnids.dylib
+
+ clean:
+ rm -f *.o *~ $(LIBSTATIC) $(LIBSHARED)