From 5aeb13fc6eda81b2a2ef79fb71c66c48c7cb8134 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sat, 19 Jan 2013 19:17:08 -0700 Subject: [PATCH] do not bother building the zeromq test programs Some of the tests require pthreads, and the build system isn't always correct about when it shouldn't try to build such tests. --- dist.ini | 1 + files/zeromq-3.2.2-no-tests.patch | 13 +++++++++++++ inc/My/Build.pm | 20 +++++++++++++------- 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 files/zeromq-3.2.2-no-tests.patch diff --git a/dist.ini b/dist.ini index c7407a3..38844d0 100644 --- a/dist.ini +++ b/dist.ini @@ -36,5 +36,6 @@ Cwd = 0 Digest::SHA = 0 File::Path = 0 File::Spec::Functions = 0 +IPC::Run = 0 LWP::Simple = 0 diff --git a/files/zeromq-3.2.2-no-tests.patch b/files/zeromq-3.2.2-no-tests.patch new file mode 100644 index 0000000..0c3c57f --- /dev/null +++ b/files/zeromq-3.2.2-no-tests.patch @@ -0,0 +1,13 @@ +--- a/Makefile.in 2012-11-23 00:58:57.000000000 -0700 ++++ b/Makefile.in 2013-01-18 23:08:21.794836073 -0700 +@@ -256,8 +256,8 @@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + ACLOCAL_AMFLAGS = -I config +-@BUILD_PGM_FALSE@SUBDIRS = src doc perf tests +-@BUILD_PGM_TRUE@SUBDIRS = foreign/openpgm src doc perf tests ++@BUILD_PGM_FALSE@SUBDIRS = src doc ++@BUILD_PGM_TRUE@SUBDIRS = foreign/openpgm src doc + DIST_SUBDIRS = foreign/openpgm src doc perf tests builds/msvc + EXTRA_DIST = \ + autogen.sh \ diff --git a/inc/My/Build.pm b/inc/My/Build.pm index ca4a02a..a6a55f4 100644 --- a/inc/My/Build.pm +++ b/inc/My/Build.pm @@ -10,6 +10,7 @@ use Cwd qw/realpath/; use Digest::SHA qw/sha1_hex/; use File::Path qw/remove_tree/; use File::Spec::Functions qw/catdir catfile/; +use IPC::Run qw/run/; use LWP::Simple qw/getstore RC_OK/; use Module::Build; @@ -33,7 +34,7 @@ sub ACTION_code { %vars = $self->probe_zeromq; } - if ($vars{inc_version} && $vars{lib_version}) { + if ($vars{inc_version} && $vars{lib_version} && $vars{inc_dir} && $vars{lib_dir}) { say "Found ØMQ $vars{lib_version}; skipping installation"; } else { say "ØMQ not found; building from source..."; @@ -42,7 +43,7 @@ sub ACTION_code { # write vars to ZMQ.pm my $module = catfile qw/blib lib Alien ZMQ.pm/; - open my $LIB, "<$module" or die "Cannot read module"; + open my $LIB, '<', $module or die "Cannot read module"; my $lib = do { local $/; <$LIB> }; close $LIB; $lib =~ s/^sub inc_dir.*$/sub inc_dir { "$vars{inc_dir}" }/m; @@ -51,12 +52,12 @@ sub ACTION_code { $lib =~ s/^sub lib_version.*$/sub lib_version { v$vars{lib_version} }/m; my @stats = stat $module; chmod 0644, $module; - open $LIB, ">$module" or die "Cannot write config to module"; + open $LIB, '>', $module or die "Cannot write config to module"; print $LIB $lib; close $LIB; chmod $stats[2], $module; - open my $TARGET, ">build-zeromq"; + open my $TARGET, '>', "build-zeromq"; print $TARGET time, "\n"; close $TARGET; } @@ -67,7 +68,7 @@ sub probe_zeromq { my %config = $cb->get_config; my $src = "test-$$.c"; - open my $SRC, ">$src"; + open my $SRC, '>', $src; print $SRC < #include @@ -164,7 +165,7 @@ sub install_zeromq { say "Verifying..."; my $sha1sum = Digest::SHA->new; - open my $ARCHIVE, "<$archive"; + open my $ARCHIVE, '<', $archive or die "Can't open source archive"; binmode $ARCHIVE; $sha1sum->addfile($ARCHIVE); close $ARCHIVE; @@ -178,10 +179,15 @@ sub install_zeromq { my $basedir = $self->base_dir; my $datadir = catdir($basedir, "share"); my $srcdir = catdir($basedir, "zeromq-$version"); + chdir $srcdir; + + say "Patching..."; + for my $patch (glob("$basedir/files/zeromq-$version-*.patch")) { + run ["patch"], '<', $patch or die "Failed to patch ØMQ"; + } say "Configuring..."; my @config = $cb->split_like_shell($self->args('zmq-config') || ""); - chdir $srcdir; $cb->do_system(qw/sh configure CPPFLAGS=-Wno-error/, "--prefix=$prefix", @config) or die "Failed to configure ØMQ"; -- 2.43.0