diff options
author | Richard Jones <rjones@redhat.com> | 2010-02-23 10:36:51 +0000 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-02-24 18:51:04 +0000 |
commit | aa5d6c138b55e25994ac723e94f32b009366927c (patch) | |
tree | 7f44afd830cd788d9ff99a8ddb7881da083e5ef3 /perl | |
parent | ffd32d61d4fad969a6a0baec8c15774eac5ea2e2 (diff) | |
download | hivex-aa5d6c138b55e25994ac723e94f32b009366927c.tar.gz hivex-aa5d6c138b55e25994ac723e94f32b009366927c.tar.xz hivex-aa5d6c138b55e25994ac723e94f32b009366927c.zip |
Add build framework for OCaml, Perl, Python bindings.
(No bindings are actually built, this just adds the build, test
and generator framework for them).
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Makefile.PL.in | 30 | ||||
-rw-r--r-- | perl/Makefile.am | 60 | ||||
-rwxr-xr-x | perl/run-perl-tests | 21 | ||||
-rw-r--r-- | perl/typemap | 18 |
4 files changed, 129 insertions, 0 deletions
diff --git a/perl/Makefile.PL.in b/perl/Makefile.PL.in new file mode 100644 index 0000000..e6e3d72 --- /dev/null +++ b/perl/Makefile.PL.in @@ -0,0 +1,30 @@ +# hivex Perl bindings +# Copyright (C) 2009-2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +use ExtUtils::MakeMaker; + +WriteMakefile ( + FIRST_MAKEFILE => 'Makefile-pl', + + NAME => 'Win::Hivex', + VERSION => '@PACKAGE_VERSION@', + + LIBS => '-L@top_builddir@/lib/.libs -lhivex', + INC => '-I@top_builddir@/lib -I@top_srcdir@/lib', + TYPEMAPS => [ '@srcdir@/typemap' ], + CCFLAGS => '@CFLAGS@', + ); diff --git a/perl/Makefile.am b/perl/Makefile.am new file mode 100644 index 0000000..9d5b692 --- /dev/null +++ b/perl/Makefile.am @@ -0,0 +1,60 @@ +# hivex Perl bindings +# Copyright (C) 2009-2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +EXTRA_DIST = \ + Makefile.PL.in \ + run-perl-tests \ + lib/Win/Hivex.pm \ + Hivex.xs \ + t/*.t \ + typemap + +if HAVE_PERL + +# Interfacing automake and ExtUtils::MakeMaker known to be +# a nightmare, news at 11. + +# hivex source dependencies +.PHONY: src_deps +src_deps: $(top_builddir)/lib/libhivex.la + +TESTS = run-perl-tests + +$(TESTS): src_deps all + +TESTS_ENVIRONMENT = \ + LD_LIBRARY_PATH=$(top_builddir)/lib/.libs + +INSTALLDIRS = site + +all: Makefile-pl src_deps + $(MAKE) -f Makefile-pl + +Makefile-pl: Makefile.PL + perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix) + +# No! Otherwise it is deleted before the clean-local rule runs. +#CLEANFILES = Makefile-pl + +clean-local: + -$(MAKE) -f Makefile-pl clean + rm -f Makefile-pl + +install-data-hook: + $(MAKE) -f Makefile-pl DESTDIR=$(DESTDIR) install + +endif diff --git a/perl/run-perl-tests b/perl/run-perl-tests new file mode 100755 index 0000000..770df94 --- /dev/null +++ b/perl/run-perl-tests @@ -0,0 +1,21 @@ +#!/bin/sh - +# hivex Perl bindings +# Copyright (C) 2009-2010 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +set -e + +make -f Makefile-pl test "$@" diff --git a/perl/typemap b/perl/typemap new file mode 100644 index 0000000..752ca0d --- /dev/null +++ b/perl/typemap @@ -0,0 +1,18 @@ +TYPEMAP +char * T_PV +const char * T_PV +guestfs_h * O_OBJECT_guestfs_h +int64_t T_IV + +INPUT +O_OBJECT_guestfs_h + if (sv_isobject ($arg) && SvTYPE (SvRV ($arg)) == SVt_PVMG) + $var = ($type) SvIV ((SV *) SvRV ($arg)); + else { + warn (\"${Package}::$func_name(): $var is not a blessed SV reference\"); + XSRETURN_UNDEF; + } + +OUTPUT +O_OBJECT_guestfs_h + sv_setref_pv ($arg, "Sys::Guestfs", (void *) $var); |