Permalink
Browse files

A whole bunch of changes, mainly build-related.. ugh

  • Loading branch information...
1 parent 5025f61 commit 2aec41cf438be4689c45af0e264d8ec18d0a8c97 @mnunberg committed Feb 14, 2012
View
218 Client.xs

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -14,8 +14,6 @@ lib/Couchbase/Client/IDXConst.pm
lib/Couchbase/Client/README.pod
-lib/Couchbase/Client/Errors_const.pm
-lib/Couchbase/Client/IDXConst_const.pm
lib/Couchbase/Client/Compat.pm
lib/Couchbase/Client/Async.pm
@@ -54,8 +52,8 @@ print_constants.pl
t/00-load.t
t/01-main.t
+t/tmp/CouchbaseMock.jar
src/memcached-headers.tar.gz
-
-src/libcouchbase-1.0.0_45_g58818c5.tar.gz
-src/libvbucket-1.8.0.1_4_g677e403.tar.gz
+src/libcouchbase-1.0.0_50_g1a42d9e.tar.gz
+src/libvbucket-1.8.0.1_5_ga4397f3.tar.gz
View
@@ -3,3 +3,5 @@
^\.
^src/
^inst_dir/
+.+_const\.pm
+^author_utils
View
@@ -0,0 +1,59 @@
+Changes
+MANIFEST
+MANIFEST.SKIP
+Makefile.PL
+README.pod
+
+PLCB_ConfUtil.pm
+PLCB_Config.pm
+
+lib/Couchbase/Client.pm
+lib/Couchbase/Client/Return.pm
+lib/Couchbase/Client/Errors.pm
+lib/Couchbase/Client/IDXConst.pm
+
+lib/Couchbase/Client/README.pod
+
+lib/Couchbase/Client/Compat.pm
+
+lib/Couchbase/Client/Async.pm
+lib/Couchbase/Client/Async/Event.pm
+lib/Couchbase/Client/Async/Request.pm
+
+lib/Couchbase/MockServer.pm
+lib/Couchbase/Test/ClientSync.pm
+lib/Couchbase/Test/Common.pm
+lib/Couchbase/Test/Async.pm
+lib/Couchbase/Test/Async/Loop.pm
+lib/Couchbase/Test/Settings.pm
+lib/Couchbase/Test/Interop.pm
+lib/Couchbase/Test/Netfail.pm
+
+Client.xs
+Client_multi.xs
+Async.xs
+
+perl-couchbase.h
+perl-couchbase-async.h
+plcb-util.h
+plcb-return.h
+
+callbacks.c
+convert.c
+ctor.c
+async.c
+async_callbacks.c
+async_events.c
+
+build_libraries.pl
+idx_constants.pl
+error_constants.pl
+print_constants.pl
+
+t/00-load.t
+t/01-main.t
+t/tmp/CouchbaseMock.jar
+
+src/memcached-headers.tar.gz
+src/libcouchbase-__LIBCOUCHBASE_RELEASE__.tar.gz
+src/libvbucket-__LIBVBUCKET_RELEASE__.tar.gz
View
@@ -9,6 +9,8 @@ use File::Spec;
use Config;
use lib __DIR__;
+use PLCB_ConfUtil;
+
GetOptions(
'dynamic' => \my $UseDynamic,
@@ -24,18 +26,21 @@ my $myextlib;
my $inc;
my $libs;
+my $buildscript_options = "";
+
if(!$UseDynamic) {
- my $inst_dir = File::Spec->catfile('src', 'inst');
+ my $inst_dir = PLCB_ConfUtil::get_inst_dir();
+ $inc = '-I' . File::Spec->catfile($inst_dir, 'include');
+
my $lib_dir = File::Spec->catfile($inst_dir, 'lib');
+ $libs = "-L$lib_dir -lsasl2 -levent -ldl -lresolv";
+
#Set path for linker and friends
$myextlib = join(' ',
map(File::Spec->catfile($lib_dir, $_.'$(LIB_EXT)'),
qw(libcouchbase libvbucket)));
- #set include path
- $inc = '-I' . File::Spec->catfile($inst_dir, 'include');
- $libs = '-lsasl2 -levent -ldl -lresolv';
{
no warnings 'once';
*MY::postamble = \&_static_my_postamble;
@@ -48,10 +53,14 @@ if(!$UseDynamic) {
foreach ([\$inc, \$ExtraInclude], [\$libs, \$ExtraLDPath]) {
my ($defl,$extra) = @$_;
if($$extra) {
+ $$defl ||= "";
$$defl = "$$extra $$defl";
}
}
+#Write our temporary parameters
+PLCB_ConfUtil::write_tmpflags($inc, $libs);
+
# .c files
my @source_modules = qw(
callbacks
@@ -82,8 +91,9 @@ WriteMakefile(
: ()),
PL_FILES => {
- "error_constants.pl" => "lib/Couchbase/Client/Errors_const.pm",
- "idx_constants.pl" => "lib/Couchbase/Client/IDXConst_const.pm"
+ #Force them to build into blib
+ "error_constants.pl" => '$(INST_LIB)/Couchbase/Client/Errors_const.pm',
+ "idx_constants.pl" => '$(INST_LIB)/Couchbase/Client/IDXConst_const.pm'
},
CONFIGURE_REQUIRES => {
@@ -96,12 +106,14 @@ WriteMakefile(
'Class::XSAccessor' => 1.11,
'Test::More' => 0,
+ #We need libevent for whatever we're doing
+ 'Alien::Libevent' => 0.001004,
+
#These modules are needed for tests, but not strictly required for
#functionality
'Log::Fu' => 0.25,
'Test::Class' => 0.36,
- 'LWP::UserAgent' => 0,
#these are needed for asynchronous tests and modules
'POE::Sugar::Attributes' => 0.02,
@@ -116,16 +128,25 @@ WriteMakefile(
LIBS => $libs,
INC => $inc,
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
- clean => { FILES => 'Couchbase-Client-*' },
+ clean => { FILES => 'Couchbase-Client-* COMPILER_FLAGS' },
);
+sub MY::libscan {
+ my ($self,$path) = @_;
+ if($path =~ /\.pl$/i) {
+ return "";
+ } else {
+ return $path;
+ }
+}
sub _static_my_postamble {
my $make_text = <<'EOM';
$(MYEXTLIB):
- $(PERLRUN) build_libraries.pl
+ $(PERLRUN) build_libraries.pl __BUILD_LIBRARIES_OPTIONS__
EOM
+ $make_text =~ s/__BUILD_LIBRARIES_OPTIONS__/$buildscript_options/g;
$make_text =~ s/^\s+/\t/msg;
$make_text;
}
View
@@ -2,6 +2,11 @@ package PLCB_ConfUtil;
use strict;
use warnings;
use Dir::Self;
+use File::Spec;
+use File::Path qw(rmtree);
+use Data::Dumper;
+use Config;
+
use lib __DIR__;
my $config = do 'PLCB_Config.pm';
@@ -11,14 +16,7 @@ if(!$config) {
}
sub set_gcc_env {
- my $existing_env = $ENV{C_INCLUDE_PATH};
- $existing_env ||= "";
- my $new_env = $config->{COUCHBASE_INCLUDE_PATH};
- if(!$new_env) {
- return;
- } else {
- $ENV{C_INCLUDE_PATH} = "$new_env:$existing_env";
- }
+
}
sub get_gcc_linker_flags {
@@ -41,4 +39,46 @@ sub get_include_dir {
}
}
+sub clean_cbc_sources {
+ my $dir_base = $config->{SRC_DIR};
+
+ foreach my $lib (qw(couchbase vbucket)) {
+ my $dir = sprintf("lib%s-%s", $lib,
+ $config->{ "LIB" . uc($lib) . "_RELEASE" });
+ $dir = File::Spec->catfile($dir_base, $dir);
+ rmtree($dir);
+ }
+ rmtree($config->{SRC_INST});
+}
+
+sub get_toplevel_dir {
+ $config->{SRC_DIR};
+}
+
+sub get_inst_dir {
+ $config->{SRC_INST};
+}
+
+my $TEMPFILE = File::Spec->catfile(__DIR__, "COMPILER_FLAGS");
+
+sub write_tmpflags {
+ my ($cflags,$ldflags) = @_;
+ open my $fh, ">", $TEMPFILE or die "$TEMPFILE: $@";
+ my $h = {
+ CFLAGS => $cflags,
+ LDFLAGS => $ldflags
+ };
+ print $fh Dumper($h);
+}
+
+sub env_from_tmpflags {
+ my $confhash = do "$TEMPFILE";
+ $ENV{CFLAGS} .= ' ' . $confhash->{CFLAGS} . ' ' . $Config{ccflags};
+ $ENV{CFLAGS} .= ' -I' . __DIR__;
+ $ENV{LDFLAGS}= "";
+# $ENV{LDFLAGS} .= ' ' . $confhash->{LDFLAGS};
+
+# printf("CFLAGS: %s\nLDFLAGS=%s\n", $ENV{CFLAGS}, $ENV{LDFLAGS});
+}
+
1;
View
@@ -1,20 +1,29 @@
package PLCB_Config;
use strict;
use warnings;
+use Dir::Self;
+use File::Spec;
+use Hash::Util qw(lock_keys);
#this perl 'hash' contains configuration information necessary
#to bootstrap and/or configure the perl couchbase client and run
#necessary tests.
my $params = {
#URL from which to download the mock JAR file for tests
- #COUCHBASE_MOCK_JARURL =>
- # "http://files.couchbase.com/maven2/org/couchbase/mock/".
- # "CouchbaseMock/0.5-SNAPSHOT/CouchbaseMock-0.5-20120202.071818-12.jar",
- COUCHBASE_MOCK_JARURL => 'http://files.avsej.net/CouchbaseMock.jar',
- LIBVBUCKET_RELEASE => '1.8.0.1_4_g677e403',
- LIBCOUCHBASE_RELEASE => '1.0.0_45_g58818c5'
+ COUCHBASE_MOCK_JARURL => 'https://github.com/downloads/mnunberg/' .
+ 'perl-Couchbase-Client/CouchbaseMock-0.5-SNAPSHOT.jar',
+
+ #version numbers for libcouchbase and libvbucket
+ LIBVBUCKET_RELEASE => '1.8.0.1_5_ga4397f3',
+ LIBCOUCHBASE_RELEASE => '1.0.0_50_g1a42d9e'
};
+#don't change these, or there may be bad consequences
+$params->{SRC_DIR} = File::Spec->catfile(__DIR__, 'src');
+$params->{SRC_INST} = File::Spec->catfile($params->{SRC_DIR}, 'inst');
+
+lock_keys(%$params);
+
return $params; #return value
File renamed without changes.
@@ -0,0 +1,8 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Dir::Self;
+use lib __DIR__ . "../";
+use PLCB_ConfUtil;
+
+PLCB_ConfUtil::clean_cbc_sources();
Oops, something went wrong.

0 comments on commit 2aec41c

Please sign in to comment.