From d08cce0da10870f3f5826b7bf89947324fc3e6f7 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Thu, 5 Dec 2013 10:13:15 +0100 Subject: [PATCH 01/31] add perl to travis matrix --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8c5af52..9ec7606 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,14 @@ matrix: language: python python: 2.7 env: BINDINGS=python + - compiler: gcc + language: perl + perl: 5.14 + env: BINDINGS=perl + - compiler: clang + language: perl + perl: 5.14 + env: BINDINGS=perl before_install: - sudo apt-get update -qq - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq swig python-dev; fi From 97be291096a76d0ca140feb9ef75a6ac125134df Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Thu, 5 Dec 2013 10:18:28 +0100 Subject: [PATCH 02/31] override perl dependency installation --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9ec7606..41126f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ matrix: before_install: - sudo apt-get update -qq - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq swig python-dev; fi +install: true script: - scons bindings=$BINDINGS test notifications: From 7d054b1f926ab01ff279889495ab7370dd7bc739 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Thu, 5 Dec 2013 10:21:10 +0100 Subject: [PATCH 03/31] perl needs swig too --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 41126f0..6d8fc8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ matrix: before_install: - sudo apt-get update -qq - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq swig python-dev; fi + - if [ "$BINDINGS" == "perl" ]; then sudo apt-get install -qq swig; fi install: true script: - scons bindings=$BINDINGS test From b8c963db9541487971d792afb5b1dc6e2b37b066 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Thu, 5 Dec 2013 11:15:55 +0100 Subject: [PATCH 04/31] try setting CC in the environment for clang+bindings builds to get travis to actually use clang for them --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d8fc8d..10b70d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: - compiler: clang language: python python: 2.7 - env: BINDINGS=python + env: BINDINGS=python CC=clang - compiler: gcc language: perl perl: 5.14 @@ -21,7 +21,7 @@ matrix: - compiler: clang language: perl perl: 5.14 - env: BINDINGS=perl + env: BINDINGS=perl CC=clang before_install: - sudo apt-get update -qq - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq swig python-dev; fi From baf7aa23e3f6b74de0885ea0c8e7cdf3d7537b51 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 03:16:01 +0100 Subject: [PATCH 05/31] remove -DHAMMER_INTERNAL__NO_STDARG_H from CFLAGS for perl bindings build --- src/bindings/perl/SConscript | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bindings/perl/SConscript b/src/bindings/perl/SConscript index c9a20fd..e978b95 100644 --- a/src/bindings/perl/SConscript +++ b/src/bindings/perl/SConscript @@ -5,8 +5,7 @@ Import("env libhammer_shared testruns targets") perlenv = env.Clone() perlenv.Append(CCFLAGS=["-fpic", '-DSWIG', '-Wno-all', - '-Wno-extra', '-Wno-error', - '-DHAMMER_INTERNAL__NO_STDARG_H'], + '-Wno-extra', '-Wno-error'], CPPPATH=["../.."], LIBS=['hammer'], LIBPATH=["../.."], From 767afacf6be015b784c489967174e1722e85fb5b Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 03:19:45 +0100 Subject: [PATCH 06/31] remove -DHAMMER_INTERNAL__NO_STDARG_H from Makefile.PL too --- src/bindings/perl/Makefile.PL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings/perl/Makefile.PL b/src/bindings/perl/Makefile.PL index c9bf9db..4e457fc 100644 --- a/src/bindings/perl/Makefile.PL +++ b/src/bindings/perl/Makefile.PL @@ -10,6 +10,6 @@ WriteMakefile( LIBS => ["-lhammer"], OBJECT => 'hammer_wrap.o', INC => '-I../..', - CCFLAGS => "$Config{ccflags} -DSWIG -DHAMMER_INTERNAL__NO_STDARG_H -std=gnu99", + CCFLAGS => "$Config{ccflags} -DSWIG -std=gnu99", ); From a811b512418d33dc2b267b191e0740bc815e376c Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 03:55:52 +0100 Subject: [PATCH 07/31] use whatever compiler CC says to compile perl bindings --- src/bindings/perl/SConscript | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bindings/perl/SConscript b/src/bindings/perl/SConscript index e978b95..49b693a 100644 --- a/src/bindings/perl/SConscript +++ b/src/bindings/perl/SConscript @@ -11,6 +11,7 @@ perlenv.Append(CCFLAGS=["-fpic", '-DSWIG', '-Wno-all', LIBPATH=["../.."], SWIGFLAGS=["-DHAMMER_INTERNAL__NO_STDARG_H", "-Isrc/", "-perl"]) +perlenv['ENV']['CC'] = perlenv['CC'] import os if 'PERL_MM_OPT' in os.environ: perlenv['ENV']['PERL_MM_OPT'] = os.environ['PERL_MM_OPT'] @@ -20,7 +21,7 @@ if 'PERL5LIB' in os.environ: swig = ['hammer.i'] hammer_wrap = perlenv.Command(['hammer_wrap.c', 'hammer.pm'], swig, "swig $SWIGFLAGS $SOURCE") -makefile = perlenv.Command(['Makefile'], ['Makefile.PL'], "perl $SOURCE") +makefile = perlenv.Command(['Makefile'], ['Makefile.PL'], "perl $SOURCE CC=" + perlenv['ENV']['CC']) targetdir = os.path.dirname(str(hammer_wrap[0].path)) From b794dbf72de682dd3fb49a19f56c5fb15abde652 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 04:03:55 +0100 Subject: [PATCH 08/31] SWIGPERL check around bool typedef --- src/hammer.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hammer.h b/src/hammer.h index 6756c0c..22f77f5 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -35,7 +35,9 @@ extern "C" { #ifndef __cplusplus #ifndef HAMMER_INTERNAL__NO_STDARG_H +#ifndef SWIGPERL typedef int bool; +#endif // SWIGPERL #endif // HAMMER_INTERNAL__NO_STDARG_H #endif @@ -242,7 +244,7 @@ typedef struct HBenchmarkResults_ { rtype_t name##__m(HAllocator* mm__, params, ...); \ rtype_t name##__a(void *args[]); \ rtype_t name##__ma(HAllocator *mm__, void *args[]) -#endif // HAMMER_INTERNAL__NO_STDARG_H +#endif // SWIG // }}} From f53f474de293c75fd8398a65171eedbcb829a8cd Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 04:27:44 +0100 Subject: [PATCH 09/31] try to resolve missing bool/true/false problems with perl bindings --- src/bindings/perl/Makefile.PL | 2 +- src/bindings/perl/hammer.i | 3 ++- src/hammer.h | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bindings/perl/Makefile.PL b/src/bindings/perl/Makefile.PL index 4e457fc..c9bf9db 100644 --- a/src/bindings/perl/Makefile.PL +++ b/src/bindings/perl/Makefile.PL @@ -10,6 +10,6 @@ WriteMakefile( LIBS => ["-lhammer"], OBJECT => 'hammer_wrap.o', INC => '-I../..', - CCFLAGS => "$Config{ccflags} -DSWIG -std=gnu99", + CCFLAGS => "$Config{ccflags} -DSWIG -DHAMMER_INTERNAL__NO_STDARG_H -std=gnu99", ); diff --git a/src/bindings/perl/hammer.i b/src/bindings/perl/hammer.i index ff9d7f4..eaf504d 100644 --- a/src/bindings/perl/hammer.i +++ b/src/bindings/perl/hammer.i @@ -1,6 +1,7 @@ %module hammer; %begin %{ #include +#include #include %} @@ -36,7 +37,7 @@ SWIG_exception_fail(SWIG_TypeError, "Expected array ref"); AV* av = (AV*) SvRV($input); - size_t amax = av_top_index(av) + 1; // I want the length, not the top index... + size_t amax = av_len(av) + 1; // I want the length, not the top index... // TODO: is this array copied? $1 = malloc((amax+1) * sizeof(*$1)); $1[amax] = NULL; diff --git a/src/hammer.h b/src/hammer.h index 22f77f5..e536c0b 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -35,9 +35,7 @@ extern "C" { #ifndef __cplusplus #ifndef HAMMER_INTERNAL__NO_STDARG_H -#ifndef SWIGPERL typedef int bool; -#endif // SWIGPERL #endif // HAMMER_INTERNAL__NO_STDARG_H #endif From 4b86fa1f5aad9b783ee54ae4b964b44cc4425880 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 04:33:40 +0100 Subject: [PATCH 10/31] try travis with perl 5.18 instead of 5.14 --- .travis.yml | 4 ++-- src/bindings/perl/hammer.i | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 10b70d5..3e1199f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,11 @@ matrix: env: BINDINGS=python CC=clang - compiler: gcc language: perl - perl: 5.14 + perl: 5.18 env: BINDINGS=perl - compiler: clang language: perl - perl: 5.14 + perl: 5.18 env: BINDINGS=perl CC=clang before_install: - sudo apt-get update -qq diff --git a/src/bindings/perl/hammer.i b/src/bindings/perl/hammer.i index eaf504d..6e3a133 100644 --- a/src/bindings/perl/hammer.i +++ b/src/bindings/perl/hammer.i @@ -1,7 +1,6 @@ %module hammer; %begin %{ #include -#include #include %} From 85000da58162715c88debfa97fa725598ca006b3 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 04:52:30 +0100 Subject: [PATCH 11/31] put stdbool.h in hammer.h to try and fix perl bindings on travis --- src/bindings/perl/Makefile.PL | 2 +- src/hammer.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bindings/perl/Makefile.PL b/src/bindings/perl/Makefile.PL index c9bf9db..4e457fc 100644 --- a/src/bindings/perl/Makefile.PL +++ b/src/bindings/perl/Makefile.PL @@ -10,6 +10,6 @@ WriteMakefile( LIBS => ["-lhammer"], OBJECT => 'hammer_wrap.o', INC => '-I../..', - CCFLAGS => "$Config{ccflags} -DSWIG -DHAMMER_INTERNAL__NO_STDARG_H -std=gnu99", + CCFLAGS => "$Config{ccflags} -DSWIG -std=gnu99", ); diff --git a/src/hammer.h b/src/hammer.h index e536c0b..7715774 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -34,9 +34,10 @@ extern "C" { #endif #ifndef __cplusplus -#ifndef HAMMER_INTERNAL__NO_STDARG_H -typedef int bool; -#endif // HAMMER_INTERNAL__NO_STDARG_H +#include + //#ifndef HAMMER_INTERNAL__NO_STDARG_H + //typedef int bool; + //#endif // HAMMER_INTERNAL__NO_STDARG_H #endif typedef struct HParseState_ HParseState; From 8d564af139f0c898c9ecf96af5022cf06e551632 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 05:59:07 +0100 Subject: [PATCH 12/31] SWIG docs suggest -DHAS_BOOL --- src/bindings/perl/Makefile.PL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings/perl/Makefile.PL b/src/bindings/perl/Makefile.PL index 4e457fc..a629deb 100644 --- a/src/bindings/perl/Makefile.PL +++ b/src/bindings/perl/Makefile.PL @@ -10,6 +10,6 @@ WriteMakefile( LIBS => ["-lhammer"], OBJECT => 'hammer_wrap.o', INC => '-I../..', - CCFLAGS => "$Config{ccflags} -DSWIG -std=gnu99", + CCFLAGS => "$Config{ccflags} -DSWIG -DHAS_BOOL -std=gnu99", ); From 80b597cfbf244506a800367c2afd10c94ac37e9b Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 06:11:48 +0100 Subject: [PATCH 13/31] move stdbool.h to top level --- src/hammer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hammer.h b/src/hammer.h index 7715774..16bff4d 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -20,6 +20,7 @@ #ifndef HAMMER_INTERNAL__NO_STDARG_H #include #endif // HAMMER_INTERNAL__NO_STDARG_H +#include #include #include #include "allocator.h" @@ -34,7 +35,6 @@ extern "C" { #endif #ifndef __cplusplus -#include //#ifndef HAMMER_INTERNAL__NO_STDARG_H //typedef int bool; //#endif // HAMMER_INTERNAL__NO_STDARG_H From 42a3b05c23a6de0fef4bbba92cce9b27020ee0c7 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 06:24:17 +0100 Subject: [PATCH 14/31] add stdbool.h to perl hammer.i to stop bool from being #undef'd --- src/bindings/perl/hammer.i | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bindings/perl/hammer.i b/src/bindings/perl/hammer.i index 6e3a133..eaf504d 100644 --- a/src/bindings/perl/hammer.i +++ b/src/bindings/perl/hammer.i @@ -1,6 +1,7 @@ %module hammer; %begin %{ #include +#include #include %} From 05819581675e221cca3202aa4e75c22a7241ce90 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 07:29:16 +0100 Subject: [PATCH 15/31] the bug was in SWIG pre 2.0.8. Update travis to use ubuntu raring, which has this. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 3e1199f..63728a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ matrix: perl: 5.18 env: BINDINGS=perl CC=clang before_install: + - sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu raring main universe" - sudo apt-get update -qq - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq swig python-dev; fi - if [ "$BINDINGS" == "perl" ]; then sudo apt-get install -qq swig; fi From 53e13657b034492e2a31076e0102aa358c6676c5 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 07:47:55 +0100 Subject: [PATCH 16/31] use a backport instead so as to not break python or other things --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 63728a7..b8e56ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,10 +23,11 @@ matrix: perl: 5.18 env: BINDINGS=perl CC=clang before_install: - - sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu raring main universe" + - sudo add-apt-repository ppa:asolovets/backports - sudo apt-get update -qq - - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq swig python-dev; fi - - if [ "$BINDINGS" == "perl" ]; then sudo apt-get install -qq swig; fi + - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig; swig -version; fi + - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi + install: true script: - scons bindings=$BINDINGS test From 3e6269637db317d6bb11fc903b68c29204fb474b Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 07:50:47 +0100 Subject: [PATCH 17/31] auto-accept ppa --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b8e56ab..bb007f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ matrix: perl: 5.18 env: BINDINGS=perl CC=clang before_install: - - sudo add-apt-repository ppa:asolovets/backports + - sudo add-apt-repository ppa:asolovets/backports -y - sudo apt-get update -qq - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi From 9e597d48012966cc6f2e7b55bd1b83759d5fc322 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 08:19:19 +0100 Subject: [PATCH 18/31] use ppa version of swig --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bb007f8..808f2da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: before_install: - sudo add-apt-repository ppa:asolovets/backports -y - sudo apt-get update -qq - - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig; swig -version; fi + - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig=2.0.10-0ubuntu2~precise1~ppa1; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From c9a1d00261c985ee477ab3de989072912dbff6fa Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 08:23:48 +0100 Subject: [PATCH 19/31] fix package version? --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 808f2da..c5212a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: before_install: - sudo add-apt-repository ppa:asolovets/backports -y - sudo apt-get update -qq - - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig=2.0.10-0ubuntu2~precise1~ppa1; swig -version; fi + - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig=2.0.10-0ubuntu2; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From 0be2d433cc9f8a9f50a8fccd8dc2e15e1d897c08 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 08:33:10 +0100 Subject: [PATCH 20/31] retry package version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c5212a6..1fd064a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: before_install: - sudo add-apt-repository ppa:asolovets/backports -y - sudo apt-get update -qq - - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig=2.0.10-0ubuntu2; swig -version; fi + - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig=2.0.10-0; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From 8ce7d2615261ff508a1f5bd6e4791b7cbea9ad77 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 08:43:34 +0100 Subject: [PATCH 21/31] package is swig2.0, not swig --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1fd064a..0748907 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: before_install: - sudo add-apt-repository ppa:asolovets/backports -y - sudo apt-get update -qq - - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig=2.0.10-0; swig -version; fi + - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig2.0=2.0.10-0ubuntu2~precise1~ppa1; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From ac5c281cbe1ee43fcb2098c1f5b6b6894d8b5dca Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 08:46:03 +0100 Subject: [PATCH 22/31] apt-get install swig2.0 loudly; another try on version name --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0748907..cda0613 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: before_install: - sudo add-apt-repository ppa:asolovets/backports -y - sudo apt-get update -qq - - if [ "$BINDINGS" != "none" ]; then sudo apt-get install -qq swig2.0=2.0.10-0ubuntu2~precise1~ppa1; swig -version; fi + - if [ "$BINDINGS" != "none" ]; then sudo apt-get install swig2.0=2.0.10-0ubuntu2; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From 0e65ebfb1b8a169efdcf0f293c2a1a677300e452 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 08:47:47 +0100 Subject: [PATCH 23/31] try swig2.0 w/o specific version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cda0613..445e10a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ matrix: before_install: - sudo add-apt-repository ppa:asolovets/backports -y - sudo apt-get update -qq - - if [ "$BINDINGS" != "none" ]; then sudo apt-get install swig2.0=2.0.10-0ubuntu2; swig -version; fi + - if [ "$BINDINGS" != "none" ]; then sudo apt-get install swig2.0; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From bd4177c434903c73bdf5d5869dd1c3e550a33141 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 08:52:10 +0100 Subject: [PATCH 24/31] have to actually install the swig package --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 445e10a..50d6153 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,9 +23,8 @@ matrix: perl: 5.18 env: BINDINGS=perl CC=clang before_install: - - sudo add-apt-repository ppa:asolovets/backports -y - - sudo apt-get update -qq - - if [ "$BINDINGS" != "none" ]; then sudo apt-get install swig2.0; swig -version; fi + - sudo apt-get update + - if [ "$BINDINGS" != "none" ]; then sudo apt-get install swig; sudo add-apt-repository ppa:asolovets/backports -y; sudo apt-get update; sudo apt-get install swig2.0; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From 83bf5ce505046dc35ab579e59c11cacea57cd02f Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 09:03:58 +0100 Subject: [PATCH 25/31] Thank you, Meredith, but your package is in a different PPA --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 50d6153..366c0a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: env: BINDINGS=perl CC=clang before_install: - sudo apt-get update - - if [ "$BINDINGS" != "none" ]; then sudo apt-get install swig; sudo add-apt-repository ppa:asolovets/backports -y; sudo apt-get update; sudo apt-get install swig2.0; swig -version; fi + - if [ "$BINDINGS" != "none" ]; then sudo add-apt-repository ppa:dns/irc -y; sudo apt-get update; sudo apt-get install swig=2.0.8-1irc1~12.04; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From f8933dd5b13e7def14f7c5fdf819984f8d4a1ffb Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 09:10:29 +0100 Subject: [PATCH 26/31] add LD_LIBRARY_PATH explicitly --- src/bindings/perl/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings/perl/SConscript b/src/bindings/perl/SConscript index 49b693a..5ddd673 100644 --- a/src/bindings/perl/SConscript +++ b/src/bindings/perl/SConscript @@ -32,7 +32,7 @@ Default(libhammer_perl) perltestenv = perlenv.Clone() perltestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0])) perltests = ['t/hammer.t'] -perltestexec = perltestenv.Command(None, perltests + libhammer_perl + libhammer_shared, "make test -C " + targetdir) +perltestexec = perltestenv.Command(None, perltests + libhammer_perl + libhammer_shared, "LD_LIBRARY_PATH=" + os.path.dirname(str(libhammer_shared[0])) + " make test -C " + targetdir) perltest = Alias("testperl", [perltestexec], perltestexec) AlwaysBuild(perltestexec) testruns.append(perltest) From 1e4863d71e25a4f3260c49aefc95fe81430df5c0 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 09:24:19 +0100 Subject: [PATCH 27/31] makemaker needed a -L to find libhammer.so --- src/bindings/perl/Makefile.PL | 2 +- src/bindings/perl/SConscript | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bindings/perl/Makefile.PL b/src/bindings/perl/Makefile.PL index a629deb..68b6782 100644 --- a/src/bindings/perl/Makefile.PL +++ b/src/bindings/perl/Makefile.PL @@ -7,7 +7,7 @@ chdir(dirname($0)); WriteMakefile( NAME => "hammer", - LIBS => ["-lhammer"], + LIBS => ["-L../../ -lhammer"], OBJECT => 'hammer_wrap.o', INC => '-I../..', CCFLAGS => "$Config{ccflags} -DSWIG -DHAS_BOOL -std=gnu99", diff --git a/src/bindings/perl/SConscript b/src/bindings/perl/SConscript index 5ddd673..49b693a 100644 --- a/src/bindings/perl/SConscript +++ b/src/bindings/perl/SConscript @@ -32,7 +32,7 @@ Default(libhammer_perl) perltestenv = perlenv.Clone() perltestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0])) perltests = ['t/hammer.t'] -perltestexec = perltestenv.Command(None, perltests + libhammer_perl + libhammer_shared, "LD_LIBRARY_PATH=" + os.path.dirname(str(libhammer_shared[0])) + " make test -C " + targetdir) +perltestexec = perltestenv.Command(None, perltests + libhammer_perl + libhammer_shared, "make test -C " + targetdir) perltest = Alias("testperl", [perltestexec], perltestexec) AlwaysBuild(perltestexec) testruns.append(perltest) From 6a09f2abfb63414c57fb53590d0c0b4b75445c8a Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 09:28:09 +0100 Subject: [PATCH 28/31] quiet down apt again; use more perl --- .travis.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 366c0a9..374b6c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,9 +22,25 @@ matrix: language: perl perl: 5.18 env: BINDINGS=perl CC=clang + - compiler: gcc + language: perl + perl: 5.14 + env: BINDINGS=perl + - compiler: clang + language: perl + perl: 5.14 + env: BINDINGS=perl CC=clang + - compiler: gcc + language: perl + perl: 5.10 + env: BINDINGS=perl + - compiler: clang + language: perl + perl: 5.10 + env: BINDINGS=perl CC=clang before_install: - - sudo apt-get update - - if [ "$BINDINGS" != "none" ]; then sudo add-apt-repository ppa:dns/irc -y; sudo apt-get update; sudo apt-get install swig=2.0.8-1irc1~12.04; swig -version; fi + - sudo apt-get update -qq + - if [ "$BINDINGS" != "none" ]; then sudo add-apt-repository ppa:dns/irc -y; sudo apt-get update -qq; sudo apt-get install -qq swig=2.0.8-1irc1~12.04; swig -version; fi - if [ "$BINDINGS" == "python" ]; then sudo apt-get install -qq python-dev; fi install: true From 146504266c44caaa346fe8d79335e1ce9e812047 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 09:36:10 +0100 Subject: [PATCH 29/31] should version numbers be strings? --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 374b6c0..cb81ea8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,35 +8,35 @@ matrix: include: - compiler: gcc language: python - python: 2.7 + python: "2.7" env: BINDINGS=python - compiler: clang language: python - python: 2.7 + python: "2.7" env: BINDINGS=python CC=clang - compiler: gcc language: perl - perl: 5.18 + perl: "5.18" env: BINDINGS=perl - compiler: clang language: perl - perl: 5.18 + perl: "5.18" env: BINDINGS=perl CC=clang - compiler: gcc language: perl - perl: 5.14 + perl: "5.14" env: BINDINGS=perl - compiler: clang language: perl - perl: 5.14 + perl: "5.14" env: BINDINGS=perl CC=clang - compiler: gcc language: perl - perl: 5.10 + perl: "5.10" env: BINDINGS=perl - compiler: clang language: perl - perl: 5.10 + perl: "5.10" env: BINDINGS=perl CC=clang before_install: - sudo apt-get update -qq From 9da2636978b5b2f76dcfe12147f7dfa47e3e622b Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 09:41:08 +0100 Subject: [PATCH 30/31] decrufting --- src/hammer.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/hammer.h b/src/hammer.h index 16bff4d..2914b8f 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -34,12 +34,6 @@ extern "C" { #endif -#ifndef __cplusplus - //#ifndef HAMMER_INTERNAL__NO_STDARG_H - //typedef int bool; - //#endif // HAMMER_INTERNAL__NO_STDARG_H -#endif - typedef struct HParseState_ HParseState; typedef enum HParserBackend_ { From 6fa1618812659a9ab8adb9d96a98f3aac1c9f83f Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Fri, 6 Dec 2013 10:19:56 +0100 Subject: [PATCH 31/31] update README.md with perl info --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6f087c6..f0faf28 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Features * Java (not currently building; give us a few days) * Python * Ruby (not yet implemented) - * Perl (not yet implemented) + * Perl * [Go](https://github.com/prevoty/hammer) * PHP (not yet implemented) * .NET (not yet implemented) @@ -30,18 +30,18 @@ Installing ========== ### Prerequisites * SCons -* a JDK ### Optional Dependencies -* pkg-config (for `make test`) -* glib-2.0 (>= 2.29) (for `make test`) -* glib-2.0-dev (for `make test`) -* swig (for Python bindings) +* pkg-config (for `scons test`) +* glib-2.0 (>= 2.29) (for `scons test`) +* glib-2.0-dev (for `scons test`) +* swig (for Python/Perl bindings; Perl requires >= 2.0.8) * python2.7-dev (for Python bindings) +* a JDK (for Java bindings) To build, type `scons`. To run the built-in test suite, type `scons test`. For a debug build, add `--variant=debug` -To build bindings, pass a "bindings" argument to scons, e.g. `scons bindings=python`. `scons bindings=python test` will build Python bindings and run tests for both C and Python. `--variant=debug` is valid here too. +To build bindings, pass a "bindings" argument to scons, e.g. `scons bindings=python`. `scons bindings=python test` will build Python bindings and run tests for both C and Python. `--variant=debug` is valid here too. You can build more than one set of bindings at a time; just separate them with commas, e.g. `scons bindings=python,perl`. For Java, if jni.h and jni_md.h aren't already somewhere on your include path, prepend `C_INCLUDE_PATH=/path/to/jdk/include` to that. @@ -66,6 +66,8 @@ Known Issues ============ The Python bindings only work with Python 2.7. SCons doesn't work with Python 3, and PyCapsule isn't available in 2.6 and below, so 2.7 is all you get. Sorry about that. +The requirement for SWIG >= 2.0.8 for Perl bindings is due to a [known bug](http://sourceforge.net/p/swig/patches/324/) in SWIG. [ppa:dns/irc](https://launchpad.net/~dns/+archive/irc) has backports of SWIG 2.0.8 for Ubuntu versions 10.04-12.10; you can also [build SWIG from source](http://www.swig.org/download.html). + Community ========= Please join us at `#hammer` on `irc.upstandinghackers.com` if you have any questions or just want to talk about parsing.