[bind10-dev] brewing gtest

Francis Dupont fdupont at isc.org
Wed Jan 16 22:08:22 UTC 2013


> > => do you have still the formula somewhere? I installed it manually
> 
> Unfortunately, not.  I've checked my local clones of the formula but
> all of them have been updated.  (As you probably know you should be
> able to find it from the repository, but it's probably much faster to
> build it by hand).

=> I tried to get the last one from the repository but it was for 1.5.0.
I managed to write oen for 1.6.0 (in PS in case one needs it).

Thanks

Francis Dupont <fdupont at isc.org>

PS:
-------------------------------- gtest.rb --------------------------------
require 'formula'

class Gtest < Formula
  url 'http://googletest.googlecode.com/files/gtest-1.6.0.zip'
  homepage 'http://code.google.com/p/googletest/'
  md5 '4577b49f2973c90bf9ba69aa8166b786'

  def options
    [
      ["--universal", "Build for both 32 & 64 bit Intel."],
    ]
  end

  def patches
    # re-enable make install
    DATA
  end

  def install
    ENV.universal_binary if ARGV.build_universal?

    system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
    # gtest-config tries to be clever in locating libraries, but Homebrew's
    # Cellar confuses it. This lets `gtest-config --libs` work correctly
    inreplace 'scripts/gtest-config', '`dirname $0`', '$bindir'
    system "make install"
  end
end

__END__
diff -r -u gtest-1.6.0-dist/Makefile.am gtest-1.6.0/Makefile.am
--- gtest-1.6.0-dist/Makefile.am	2011-04-15 21:49:12.000000000 +0200
+++ gtest-1.6.0/Makefile.am	2013-01-16 10:25:06.000000000 +0100
@@ -160,6 +160,10 @@
   codegear/gtest_main.cbproj \
   codegear/gtest_unittest.cbproj
 
+# Scripts and utilities
+bin_SCRIPTS = scripts/gtest-config
+CLEANFILES = $(bin_SCRIPTS)
+
 # Distribute and install M4 macro
 m4datadir = $(datadir)/aclocal
 m4data_DATA = m4/gtest.m4
@@ -287,16 +291,5 @@
 
 # Death tests may produce core dumps in the build directory. In case
 # this happens, clean them to keep distcleancheck happy.
-CLEANFILES = core
+CLEANFILES += core
 
-# Disables 'make install' as installing a compiled version of Google
-# Test can lead to undefined behavior due to violation of the
-# One-Definition Rule.
-
-install-exec-local:
-	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
-	false
-
-install-data-local:
-	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
-	false
diff -r -u gtest-1.6.0-dist/Makefile.in gtest-1.6.0/Makefile.in
--- gtest-1.6.0-dist/Makefile.in	2011-04-15 21:51:48.000000000 +0200
+++ gtest-1.6.0/Makefile.in	2013-01-16 10:44:03.000000000 +0100
@@ -124,6 +124,8 @@
 test_gtest_all_test_OBJECTS = $(am_test_gtest_all_test_OBJECTS)
 test_gtest_all_test_DEPENDENCIES = lib/libgtest_main.la \
 	lib/libgtest.la
+binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(bin_SCRIPTS)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/build-aux
 depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
 am__depfiles_maybe = depfiles
@@ -401,6 +403,13 @@
   src/gtest.cc
 
 
+# Scripts and utilities
+bin_SCRIPTS = scripts/gtest-config
+
+# Death tests may produce core dumps in the build directory. In case
+# this happens, clean them to keep distcleancheck happy.
+CLEANFILES = $(bin_SCRIPTS) core
+
 # Distribute and install M4 macro
 m4datadir = $(datadir)/aclocal
 m4data_DATA = m4/gtest.m4
@@ -487,9 +496,6 @@
 
 test_fused_gtest_test_CPPFLAGS = -I"$(srcdir)/fused-src"
 
-# Death tests may produce core dumps in the build directory. In case
-# this happens, clean them to keep distcleancheck happy.
-CLEANFILES = core
 all: all-am
 
 .SUFFIXES:
@@ -665,6 +671,26 @@
 test/gtest_all_test$(EXEEXT): $(test_gtest_all_test_OBJECTS) $(test_gtest_all_test_DEPENDENCIES) test/$(am__dirstamp)
 	@rm -f test/gtest_all_test$(EXEEXT)
 	$(CXXLINK) $(test_gtest_all_test_OBJECTS) $(test_gtest_all_test_LDADD) $(LIBS)
+install-binSCRIPTS: $(bin_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f $$d$$p; then \
+	    f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+	    echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	    $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \
+	  else :; fi; \
+	done
+
+uninstall-binSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_SCRIPTS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -1151,7 +1177,7 @@
 	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(DATA) $(HEADERS)
 installdirs:
 	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkginclude_internaldir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -1215,14 +1241,14 @@
 
 info-am:
 
-install-data-am: install-data-local install-m4dataDATA \
+install-data-am: install-m4dataDATA \
 	install-pkgincludeHEADERS install-pkginclude_internalHEADERS
 
 install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-exec-local install-libLTLIBRARIES
+install-exec-am: install-binSCRIPTS install-libLTLIBRARIES
 
 install-html: install-html-am
 
@@ -1265,8 +1291,8 @@
 
 ps-am:
 
-uninstall-am: uninstall-libLTLIBRARIES uninstall-m4dataDATA \
-	uninstall-pkgincludeHEADERS \
+uninstall-am: uninstall-binSCRIPTS uninstall-libLTLIBRARIES \
+	uninstall-m4dataDATA uninstall-pkgincludeHEADERS \
 	uninstall-pkginclude_internalHEADERS
 
 .MAKE: check-am install-am install-strip
@@ -1279,6 +1305,7 @@
 	distclean-generic distclean-hdr distclean-libtool \
 	distclean-tags distcleancheck distdir distuninstallcheck dvi \
 	dvi-am html html-am info info-am install install-am \
+	install-binSCRIPTS uninstall-binSCRIPTS \
 	install-data install-data-am install-data-local install-dvi \
 	install-dvi-am install-exec install-exec-am install-exec-local \
 	install-html install-html-am install-info install-info-am \
@@ -1312,18 +1339,6 @@
 maintainer-clean-local:
 	rm -rf "$(srcdir)/fused-src"
 
-# Disables 'make install' as installing a compiled version of Google
-# Test can lead to undefined behavior due to violation of the
-# One-Definition Rule.
-
-install-exec-local:
-	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
-	false
-
-install-data-local:
-	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
-	false
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:


More information about the bind10-dev mailing list