ExtUtils-Depends-0.305/000755 001750 000024 00000000000 12211202224 015077 5ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/Changes000644 001750 000024 00000006625 12211200312 016377 0ustar00brianstaff000000 000000 Revision history for Perl extension ExtUtils::Depends. 0.305 Mon Sep 2 14:16:58 PDT 2013 - Makefile.PL: converted to CPAN::Meta::Spec v2 - Updated license in RPM spec file; closes RT#88196 - Updated contact info and added git repo info to POD - Add comments for find_extra_libs method (closes RT#43900) - Fixed typo (closes RT#86572) 0.304 Wed Jan 26 08:48:18 CET 2011 - More robust detection of gcc toolchains on Win32 (Closes: RT#62455) (sisyphus). - Don't assume dlltool is called 'dlltool' on Win32+gcc. Ask Config.pm instead (Closes: RT#62455) (sisyphus). 0.303 Mon Nov 29 19:42:59 CET 2010 - Fix a race condition when running the tests in parallel. 0.302 Sat Jul 4 15:28:35 CEST 2009 - Create import libraries if necessary to fix linking when gcc is used on MSWin32 (Strawberry Perl, for example). 0.301 Sat Sep 6 20:11:01 CEST 2008 - On Cygwin, link directly against the DLLs of dependencies. Patch by Yaakov. - Require perl 5.6.0. 0.300 Sun Mar 30 17:35:35 CEST 2008 - On MSWin32 and cygwin, find the link libraries of dependencies and put them into LIBS. - Add tests. - Correct typos in the documentation. - In get_makefile_vars, comment out the code that put the installed libraries into @OBJECT, which caused them to get deleted on realclean. - In Makefile.PL, don't use the bogus package "MAIN". - Remove debug spew. 0.205 Sun Jan 23 13:20:14 EST 2005 - Disable the RPM-related postamble on Win32. The 'date' command on windows is interactive, and caused Makefile.PL to hang. 0.204 Sun Sep 19 23:26:23 CEST 2004 - Use capitals at the start of everything that is printed out, to unify Makefile.PL output. 0.203 Fri Mar 12 16:09:35 EST 2004 - don't output a PM pair from get_makefile_vars unless we actually have data in the pm key. 0.202 Fri Mar 5 00:26:18 EST 2004 - add long-overdue version-checking import implementation. - fixed a bad initial value bug that caused crashes if your setup did not need a call to set_libs. [Ross] - distribute the spec file. [Ross] 0.201 Thu Feb 12 15:33:47 EST 2004 - add_headers() is now deprecated. it's functionality is provided by install(), and it is already a no-op in 0.200. - remove code referring to @headers, since we don't actually keep a separate list of headers anymore. (should we?) - load() no longer returns the "header" key -- it should've been "headers", but i've simply removed all that code. 0.200 Tue Feb 10 01:21:57 EST 2004 - completely rewritten. attempted to retain backward compatibility, but some esoteric functionality is probably missing. now stores dependency lists, so that module chaining is more useful. - document just about everything. - really, really, really needs a regression test suite. 0.104 Fri Nov 21 01:34:57 EST 2003 - remove debian packaging files - add licensing terms to pod. Depends was originally part of gtk-perl, which itself bore this copyright notice. 0.103 Fri Aug 15 09:59:42 EDT 2003 - add files for maintaining debian packages. 0.102 Tue Jul 8 14:10:29 EDT 2003 - use File::Spec->file_name_is_absolute instead of non-portable m{^/}. still uses direct string manipulation on paths, but this fix lets the module function correctly under native Win32 perl. 0.101 Fri Jun 20 23:37:19 CEST 2003 - added primitive load-only testsuite. 0.1 Thu Jun 19 01:29:25 CEST 2003 - original version; created by extracting it from glib. ExtUtils-Depends-0.305/lib/000755 001750 000024 00000000000 12211202223 015644 5ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/Makefile.PL000644 001750 000024 00000006401 12211177501 017063 0ustar00brianstaff000000 000000 #!/usr/bin/perl # We require 5.6 for sanity in general, and for 'our' in particular. use 5.006; use ExtUtils::MakeMaker; my %prereqs = ( 'File::Spec' => 0, 'Data::Dumper' => 0, 'IO::File' => 0, ); my %meta_merge = ( q(meta-spec) => { version => '2', url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec', }, author => ['Gtk2-Perl Team '], release_status => 'stable', # valid values: https://metacpan.org/module/CPAN::Meta::Spec#license license => 'perl_5', resources => { license => 'http://dev.perl.org/licenses/', homepage => 'http://gtk2-perl.sourceforge.net', x_MailingList => 'https://mail.gnome.org/mailman/listinfo/gtk-perl-list', bugtracker => { web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depens', mailto => 'bug-ExtUtils-Depends [at] rt.cpan.org', }, repository => { url => 'git://git.gnome.org/perl-ExtUtils-Depends', type => 'git', web => 'http://git.gnome.org/browse/perl-ExtUtils-Depends', }, }, prereqs => { configure => { requires => {%prereqs}, # no direct ref for 5.14 compatibility }, build => { requires => { 'Test::More' => 0, }, }, test => { recommends => { 'Test::Number::Delta' => 1.0, }, }, }, keywords => ['XS', 'XS extensions', 'dependency'], no_index => { package => 'ExtUtils::MM', }, ); WriteMakefile( dist => { $^O eq 'MSWin32' ? () : (PREOP => 'pod2text lib/ExtUtils/Depends.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;'), COMPRESS => 'gzip -9v', SUFFIX => '.gz', }, NAME => 'ExtUtils::Depends', VERSION_FROM => 'lib/ExtUtils/Depends.pm', PREREQ_PM => \%prereqs, MIN_PERL_VERSION => 5.006, #for META.yml META_MERGE => \%meta_merge, LICENSE => 'perl', ); use Cwd; sub MY::postamble { # none of this rpm stuff is useful on win32, and actually it can cause # nmake to barf. return @_ if $^O eq 'MSWin32'; my @dirs = qw{$(RPMS_DIR) $(RPMS_DIR)/BUILD $(RPMS_DIR)/RPMS $(RPMS_DIR)/SOURCES $(RPMS_DIR)/SPECS $(RPMS_DIR)/SRPMS}; my $cwd = getcwd(); chomp (my $date = `date +"%a %b %d %Y"`); my %subs = ( 'VERSION' => '$(VERSION)', 'SOURCE' => '$(DISTNAME)-$(VERSION).tar.gz', 'DATE' => $date, ); my $substitute = '$(PERL) -npe \''.join('; ', map { "s/\\\@$_\\\@/$subs{$_}/g"; } keys %subs).'\''; " realclean :: -\$(RM_F) perl-\$(DISTNAME).spec RPMS_DIR=\$(HOME)/rpms \$(RPMS_DIR)/: -mkdir @dirs SUBSTITUTE=$substitute perl-\$(DISTNAME).spec :: perl-\$(DISTNAME).spec.in \$(VERSION_FROM) Makefile \$(SUBSTITUTE) \$< > \$@ dist-rpms :: Makefile dist perl-\$(DISTNAME).spec \$(RPMS_DIR)/ cp \$(DISTNAME)-\$(VERSION).tar.gz \$(RPMS_DIR)/SOURCES/ rpmbuild -ba --define \"_topdir \$(RPMS_DIR)\" perl-\$(DISTNAME).spec dist-srpms :: Makefile dist perl-\$(DISTNAME).spec \$(RPMS_DIR)/ cp \$(DISTNAME)-\$(VERSION).tar.gz \$(RPMS_DIR)/SOURCES/ rpmbuild -bs --define \"_topdir \$(RPMS_DIR)\" perl-\$(DISTNAME).spec " } ExtUtils-Depends-0.305/MANIFEST000644 001750 000024 00000000772 12211202224 016236 0ustar00brianstaff000000 000000 Changes lib/ExtUtils/Depends.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP MYMETA.json MYMETA.yml perl-ExtUtils-Depends.spec.in README t/01_load.t t/02_save_load.t t/03_deps.t t/04_extra_libs.t t/inc/DepTest/DepTest.dll t/inc/DepTest/DepTest.lib t/inc/DepTest/Install/.keep t/inc/DepTest/libDepTest.dll.a t/lib/TestHelper.pm META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) ExtUtils-Depends-0.305/MANIFEST.SKIP000644 001750 000024 00000000113 11663370763 017020 0ustar00brianstaff000000 000000 ^blib ^MAINTAINERS$ ^Makefile$ ^pm_to_blib$ ^\.git \.doap$ ^MANIFEST\.bak$ ExtUtils-Depends-0.305/META.json000644 001750 000024 00000003535 12211202224 016526 0ustar00brianstaff000000 000000 { "abstract" : "unknown", "author" : [ "Gtk2-Perl Team " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.68, CPAN::Meta::Converter version 2.131560", "keywords" : [ "XS", "XS extensions", "dependency" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "ExtUtils-Depends", "no_index" : { "directory" : [ "t", "inc" ], "package" : [ "ExtUtils::MM" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Test::More" : "0" } }, "configure" : { "requires" : { "Data::Dumper" : "0", "File::Spec" : "0", "IO::File" : "0" } }, "runtime" : { "requires" : { "Data::Dumper" : "0", "File::Spec" : "0", "IO::File" : "0", "perl" : "5.006" } }, "test" : { "recommends" : { "Test::Number::Delta" : "1" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-ExtUtils-Depends [at] rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depens" }, "homepage" : "http://gtk2-perl.sourceforge.net", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://git.gnome.org/perl-ExtUtils-Depends", "web" : "http://git.gnome.org/browse/perl-ExtUtils-Depends" }, "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list" }, "version" : "0.305" } ExtUtils-Depends-0.305/META.yml000644 001750 000024 00000001671 12211202223 016354 0ustar00brianstaff000000 000000 --- abstract: unknown author: - 'Gtk2-Perl Team ' build_requires: ExtUtils::MakeMaker: 0 Test::More: 0 configure_requires: Data::Dumper: 0 File::Spec: 0 IO::File: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.68, CPAN::Meta::Converter version 2.131560' keywords: - XS - 'XS extensions' - dependency license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: ExtUtils-Depends no_index: directory: - t - inc package: - ExtUtils::MM requires: Data::Dumper: 0 File::Spec: 0 IO::File: 0 perl: 5.006 resources: MailingList: https://mail.gnome.org/mailman/listinfo/gtk-perl-list bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depens homepage: http://gtk2-perl.sourceforge.net license: http://dev.perl.org/licenses/ repository: git://git.gnome.org/perl-ExtUtils-Depends version: 0.305 ExtUtils-Depends-0.305/MYMETA.json000644 001750 000024 00000003535 12211202213 016772 0ustar00brianstaff000000 000000 { "abstract" : "unknown", "author" : [ "Gtk2-Perl Team " ], "dynamic_config" : 0, "generated_by" : "ExtUtils::MakeMaker version 6.68, CPAN::Meta::Converter version 2.131560", "keywords" : [ "XS", "XS extensions", "dependency" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "ExtUtils-Depends", "no_index" : { "directory" : [ "t", "inc" ], "package" : [ "ExtUtils::MM" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Test::More" : "0" } }, "configure" : { "requires" : { "Data::Dumper" : "0", "File::Spec" : "0", "IO::File" : "0" } }, "runtime" : { "requires" : { "Data::Dumper" : "0", "File::Spec" : "0", "IO::File" : "0", "perl" : "5.006" } }, "test" : { "recommends" : { "Test::Number::Delta" : "1" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-ExtUtils-Depends [at] rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depens" }, "homepage" : "http://gtk2-perl.sourceforge.net", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://git.gnome.org/perl-ExtUtils-Depends", "web" : "http://git.gnome.org/browse/perl-ExtUtils-Depends" }, "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list" }, "version" : "0.305" } ExtUtils-Depends-0.305/MYMETA.yml000644 001750 000024 00000001671 12211202213 016621 0ustar00brianstaff000000 000000 --- abstract: unknown author: - 'Gtk2-Perl Team ' build_requires: ExtUtils::MakeMaker: 0 Test::More: 0 configure_requires: Data::Dumper: 0 File::Spec: 0 IO::File: 0 dynamic_config: 0 generated_by: 'ExtUtils::MakeMaker version 6.68, CPAN::Meta::Converter version 2.131560' keywords: - XS - 'XS extensions' - dependency license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: ExtUtils-Depends no_index: directory: - t - inc package: - ExtUtils::MM requires: Data::Dumper: 0 File::Spec: 0 IO::File: 0 perl: 5.006 resources: MailingList: https://mail.gnome.org/mailman/listinfo/gtk-perl-list bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depens homepage: http://gtk2-perl.sourceforge.net license: http://dev.perl.org/licenses/ repository: git://git.gnome.org/perl-ExtUtils-Depends version: 0.305 ExtUtils-Depends-0.305/perl-ExtUtils-Depends.spec.in000644 001750 000024 00000003031 12211172320 022461 0ustar00brianstaff000000 000000 Summary: ExtUtils-Depends Perl module Name: perl-ExtUtils-Depends Version: @VERSION@ Release: 1 Packager: gtk-perl-list@gnome.org License: Perl Group: Development/Tools URL: http://search.cpan.org/dist/ExtUtils-Depends/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch BuildRequires: perl >= 2:5.8.0 Source0: @SOURCE@ %description This module tries to make it easy to build Perl extensions that use functions and typemaps provided by other perl extensions. This means that a perl extension is treated like a shared library that provides also a C and an XS interface besides the perl one. This works as long as the base extension is loaded with the RTLD_GLOBAL flag (usually done with a sub dl_load_flags {0x01} in the main .pm file) if you need to use functions defined in the module. %prep %setup -q -n ExtUtils-Depends-%{version} %build CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix} make OPTIMIZE="$RPM_OPT_FLAGS" make test %install %makeinstall [ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress find $RPM_BUILD_ROOT \( -name perllocal.pod -o -name .packlist \) -exec rm -v {} \; find $RPM_BUILD_ROOT/usr -type f -print | \ sed "s@^$RPM_BUILD_ROOT@@g" | \ grep -v perllocal.pod | \ grep -v "\.packlist" > %{name}-%{version}-filelist if [ "$(cat %{name}-%{version}-filelist)X" = "X" ] ; then exit -1 fi %clean rm -rf $RPM_BUILD_ROOT %files -f %{name}-%{version}-filelist %defattr(-,root,root) %changelog * @DATE@ gtk-perl-list@gnome.org - @VERSION@ - Specfile autogenerated. ExtUtils-Depends-0.305/README000644 001750 000024 00000016502 12211202224 015763 0ustar00brianstaff000000 000000 NAME ExtUtils::Depends - Easily build XS extensions that depend on XS extensions SYNOPSIS use ExtUtils::Depends; $package = new ExtUtils::Depends ('pkg::name', 'base::package') # set the flags and libraries to compile and link the module $package->set_inc("-I/opt/blahblah"); $package->set_libs("-lmylib"); # add a .c and an .xs file to compile $package->add_c('code.c'); $package->add_xs('module-code.xs'); # add the typemaps to use $package->add_typemaps("typemap"); # install some extra data files and headers $package->install (qw/foo.h data.txt/); # save the info $package->save_config('Files.pm'); WriteMakefile( 'NAME' => 'Mymodule', $package->get_makefile_vars() ); DESCRIPTION This module tries to make it easy to build Perl extensions that use functions and typemaps provided by other perl extensions. This means that a perl extension is treated like a shared library that provides also a C and an XS interface besides the perl one. This works as long as the base extension is loaded with the RTLD_GLOBAL flag (usually done with a sub dl_load_flags {0x01} in the main .pm file) if you need to use functions defined in the module. The basic scheme of operation is to collect information about a module in the instance, and then store that data in the Perl library where it may be retrieved later. The object can also reformat this information into the data structures required by ExtUtils::MakeMaker's WriteMakefile function. When creating a new Depends object, you give it a name, which is the name of the module you are building. You can also specify the names of modules on which this module depends. These dependencies will be loaded automatically, and their typemaps, header files, etc merged with your new object's stuff. When you store the data for your object, the list of dependencies are stored with it, so that another module depending on your needn't know on exactly which modules yours depends. For example: Gtk2 depends on Glib Gnome2::Canvas depends on Gtk2 ExtUtils::Depends->new ('Gnome2::Canvas', 'Gtk2'); this command automatically brings in all the stuff needed for Glib, since Gtk2 depends on it. METHODS $object = ExtUtils::Depends->new($name, @deps) Create a new depends object named *$name*. Any modules listed in *@deps* (which may be empty) are added as dependencies and their dependency information is loaded. An exception is raised if any dependency information cannot be loaded. $depends->add_deps (@deps) Add modules listed in *@deps* as dependencies. (hashes) = $depends->get_deps Fetch information on the dependencies of *$depends* as a hash of hashes, which are dependency information indexed by module name. See "load". $depends->set_inc (@newinc) Add strings to the includes or cflags variables. $depends->set_libs (@newlibs) Add strings to the libs (linker flags) variable. $depends->add_pm (%pm_files) Add files to the hash to be passed through ExtUtils::WriteMakefile's PM key. $depends->add_xs (@xs_files) Add xs files to be compiled. $depends->add_c (@c_files) Add C files to be compiled. $depends->add_typemaps (@typemaps) Add typemap files to be used and installed. $depends->add_headers (list) No-op, for backward compatibility. $depends->install (@files) Install *@files* to the data directory for *$depends*. This actually works by adding them to the hash of pm files that gets passed through WriteMakefile's PM key. $depends->save_config ($filename) Save the important information from *$depends* to *$filename*, and set it up to be installed as *name*::Install::Files. Note: the actual value of *$filename* seems to be irrelevant, but its usage is kept for backward compatibility. hash = $depends->get_makefile_vars Return the information in *$depends* in a format digestible by WriteMakefile. This sets at least the following keys: INC LIBS TYPEMAPS PM And these if there is data to fill them: clean OBJECT XS hashref = ExtUtils::Depends::load (name) Load and return dependency information for *name*. Croaks if no such information can be found. The information is returned as an anonymous hash containing these keys: instpath The absolute path to the data install directory for this module. typemaps List of absolute pathnames for this module's typemap files. inc CFLAGS string for this module. libs LIBS string for this module. deps List of modules on which this one depends. This key will not exist when loading files created by old versions of ExtUtils::Depends. $depends->load_deps Load *$depends* dependencies, by calling "load" on each dependency module. This is usually done for you, and should only be needed if you want to call "get_deps" after calling "add_deps" manually. SUPPORT Bugs/Feature Requests Version 0.2 discards some of the more esoteric features provided by the older versions. As they were completely undocumented, and this module has yet to reach 1.0, this may not exactly be a bug. This module is tightly coupled to the ExtUtils::MakeMaker architecture. You can submit new bugs/feature requests by using one of two bug trackers (below). CPAN Request Tracker You can submit bugs/feature requests via the web by going to (requires PAUSE ID or Bitcard), or by sending an e-mail to "bug-ExtUtils-Depends at rt.cpan.org". Gnome.org Bugzilla Report bugs/feature requests to the 'gnome-perl' product (requires login) Patches that implement new features with test cases, and/or test cases that exercise existing bugs are always welcome. The Gtk-Perl mailing list is at "gtk-perl-list at gnome dot org". Source Code The source code to ExtUtils::Depends is available at the Gnome.org Git repo (). Create your own copy of the Git repo with: git clone git://git.gnome.org/perl-ExtUtils-Depends (Git protocol) git clone https://git.gnome.org/browse/perl-ExtUtils-Depends/ (HTTPS) SEE ALSO ExtUtils::MakeMaker. AUTHOR Paolo Molaro wrote the original version for Gtk-Perl. muppet rewrote the innards for version 0.2, borrowing liberally from Paolo's code. MAINTAINER The Gtk2 project, /"gtk-perl-list at gnome dot org". LICENSE This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself. ExtUtils-Depends-0.305/t/000755 001750 000024 00000000000 12211202223 015341 5ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/t/01_load.t000644 001750 000024 00000000144 11663370763 016775 0ustar00brianstaff000000 000000 #!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use_ok ('ExtUtils::Depends'); ExtUtils-Depends-0.305/t/02_save_load.t000644 001750 000024 00000004241 11663370763 020016 0ustar00brianstaff000000 000000 #!/usr/bin/perl use strict; use warnings; use Test::More tests => 24; use FindBin; use lib "$FindBin::Bin/lib"; use TestHelper; use ExtUtils::Depends; my $tmp_inc = temp_inc; my $dep_info = ExtUtils::Depends->new ('DepTest'); my $inc = '-Iinclude -I/usr/local/include -W -Wall -Werror -ansi'; $dep_info->set_inc ($inc); my $libs = '-L/usr/local/lib -lfoobar'; $dep_info->set_libs ($libs); my %pm_mapping = ('DepTest.pm' => 'build/DepTest.pm', 'DepTest/Helper.pm' => 'build/DepTest/Helper.pm'); $dep_info->add_pm (%pm_mapping); my @xs_files = qw(DepTestFoo.xs DepTestBar.xs); $dep_info->add_xs (@xs_files); my @c_files = qw(dep-test-foo.c dep-test-bar.c); $dep_info->add_c (@c_files); my @typemaps = qw(build/foo.typemap build/bar.typemap); $dep_info->add_typemaps (@typemaps); my @installed_files = qw(dep.h dep-private.h); $dep_info->install (@installed_files); $dep_info->save_config (catfile $tmp_inc, qw(DepTest Install Files.pm)); # --------------------------------------------------------------------------- # my %vars = $dep_info->get_makefile_vars; is_deeply ($vars{TYPEMAPS}, \@typemaps); is ($vars{INC}, $inc); is ($vars{LIBS}, $libs); foreach my $pm (keys %pm_mapping) { like ($vars{PM}{$pm}, qr/\Q$pm_mapping{$pm}\E/); } ok (exists $vars{PM}{catfile $tmp_inc, qw(DepTest Install Files.pm)}); foreach my $file (@installed_files) { like ($vars{PM}{$file}, qr/\Q$file\E/); } foreach my $xs_file (@xs_files) { ok (exists $vars{XS}{$xs_file}); } foreach my $file (@c_files, @xs_files) { (my $stem = $file) =~ s/\.(?:c|xs)\z//; like ($vars{OBJECT}, qr/\Q$stem\E/); like ($vars{clean}{FILES}, qr/\Q$stem\E/); } # --------------------------------------------------------------------------- # my $info = ExtUtils::Depends::load ('DepTest'); my $install_part = qr|DepTest.Install|; like ($info->{inc}, $install_part); ok (-1 != index $info->{inc}, $inc); isa_ok ($info->{typemaps}, 'ARRAY'); like ($info->{instpath}, $install_part); is_deeply ($info->{deps}, []); is ($info->{libs}, $libs); # --------------------------------------------------------------------------- # ExtUtils-Depends-0.305/t/03_deps.t000644 001750 000024 00000001450 11663370763 017014 0ustar00brianstaff000000 000000 #!/usr/bin/perl use strict; use warnings; use Test::More tests => 2; use FindBin; use lib "$FindBin::Bin/lib"; use TestHelper; use ExtUtils::Depends; my $tmp_inc = temp_inc; my $dep_info = ExtUtils::Depends->new ('DepTest'); $dep_info->save_config (catfile $tmp_inc, qw(DepTest Install Files.pm)); # --------------------------------------------------------------------------- # my $info = ExtUtils::Depends->new ('UseTest', 'DepTest'); my %deps = $info->get_deps; ok (exists $deps{DepTest}); # --------------------------------------------------------------------------- # $info = ExtUtils::Depends->new ('UseTest'); $info->add_deps ('DepTest'); $info->load_deps; %deps = $info->get_deps; ok (exists $deps{DepTest}); # --------------------------------------------------------------------------- # ExtUtils-Depends-0.305/t/04_extra_libs.t000644 001750 000024 00000001333 11663370763 020216 0ustar00brianstaff000000 000000 #!/usr/bin/perl use strict; use warnings; use Test::More; use FindBin; use lib "$FindBin::Bin/lib"; use TestHelper; use ExtUtils::Depends; my $tmp_inc = temp_inc; plan (($^O eq 'MSWin32' || $^O eq 'cygwin') ? (tests => 1) : (skip_all => 'test only applicable to MSWin32 and cygwin')); my $dep_info = ExtUtils::Depends->new ('DepTest'); $dep_info->save_config (catfile $tmp_inc, qw(DepTest Install Files.pm)); # --------------------------------------------------------------------------- # my $use_info = ExtUtils::Depends->new ('UseTest', 'DepTest'); my %vars = $use_info->get_makefile_vars; like ($vars{LIBS}, qr/DepTest/); # --------------------------------------------------------------------------- # ExtUtils-Depends-0.305/t/inc/000755 001750 000024 00000000000 12211202223 016112 5ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/t/lib/000755 001750 000024 00000000000 12211202223 016107 5ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/t/lib/TestHelper.pm000644 001750 000024 00000000570 11663370763 020557 0ustar00brianstaff000000 000000 use strict; use warnings; package TestHelper; use File::Temp 'tempdir'; use File::Path 'mkpath'; use File::Spec::Functions 'catdir', 'catfile'; use base 'Exporter'; our @EXPORT = ('temp_inc', 'catfile'); sub temp_inc { my $tmpinc = tempdir(CLEANUP => 1); mkpath(catdir($tmpinc, qw(DepTest Install)), 0, 0711); unshift @INC, $tmpinc; return $tmpinc; } 1; ExtUtils-Depends-0.305/t/inc/DepTest/000755 001750 000024 00000000000 12211202223 017462 5ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/t/inc/DepTest/DepTest.dll000644 001750 000024 00000000000 11663370763 021546 0ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/t/inc/DepTest/DepTest.lib000644 001750 000024 00000000000 11663370763 021541 0ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/t/inc/DepTest/Install/000755 001750 000024 00000000000 12211202223 021070 5ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/t/inc/DepTest/libDepTest.dll.a000644 001750 000024 00000000000 11663370763 022454 0ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/t/inc/DepTest/Install/.keep000644 001750 000024 00000000000 11663370763 022034 0ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/lib/ExtUtils/000755 001750 000024 00000000000 12211202223 017425 5ustar00brianstaff000000 000000 ExtUtils-Depends-0.305/lib/ExtUtils/Depends.pm000644 001750 000024 00000036764 12211177775 021414 0ustar00brianstaff000000 000000 # # $Id$ # package ExtUtils::Depends; use strict; use warnings; use Carp; use File::Find; use File::Spec; use Data::Dumper; our $VERSION = '0.305'; sub import { my $class = shift; return unless @_; die "$class version $_[0] is required--this is only version $VERSION" if $VERSION < $_[0]; } sub new { my ($class, $name, @deps) = @_; my $self = bless { name => $name, deps => {}, inc => [], libs => '', pm => {}, typemaps => [], xs => [], c => [], }, $class; $self->add_deps (@deps); # attempt to load these now, so we'll find out as soon as possible # whether the dependencies are valid. we'll load them again in # get_makefile_vars to catch any added between now and then. $self->load_deps; return $self; } sub add_deps { my $self = shift; foreach my $d (@_) { $self->{deps}{$d} = undef unless $self->{deps}{$d}; } } sub get_deps { my $self = shift; $self->load_deps; # just in case return %{$self->{deps}}; } sub set_inc { my $self = shift; push @{ $self->{inc} }, @_; } sub set_libs { my ($self, $newlibs) = @_; $self->{libs} = $newlibs; } sub add_pm { my ($self, %pm) = @_; while (my ($key, $value) = each %pm) { $self->{pm}{$key} = $value; } } sub _listkey_add_list { my ($self, $key, @list) = @_; $self->{$key} = [] unless $self->{$key}; push @{ $self->{$key} }, @list; } sub add_xs { shift->_listkey_add_list ('xs', @_) } sub add_c { shift->_listkey_add_list ('c', @_) } sub add_typemaps { my $self = shift; $self->_listkey_add_list ('typemaps', @_); $self->install (@_); } # no-op, only used for source back-compat sub add_headers { carp "add_headers() is a no-op" } ####### PRIVATE sub basename { (File::Spec->splitdir ($_[0]))[-1] } # get the name in Makefile syntax. sub installed_filename { my $self = shift; return '$(INST_ARCHLIB)/$(FULLEXT)/Install/'.basename ($_[0]); } sub install { # install things by adding them to the hash of pm files that gets # passed through WriteMakefile's PM key. my $self = shift; foreach my $f (@_) { $self->add_pm ($f, $self->installed_filename ($f)); } } sub save_config { use Data::Dumper; use IO::File; my ($self, $filename) = @_; my $file = IO::File->new (">".$filename) or croak "can't open '$filename' for writing: $!\n"; print $file "package $self->{name}\::Install::Files;\n\n"; # for modern stuff print $file "".Data::Dumper->Dump([{ inc => join (" ", @{ $self->{inc} }), libs => $self->{libs}, typemaps => [ map { basename $_ } @{ $self->{typemaps} } ], deps => [keys %{ $self->{deps} }], }], ['self']); # for ancient stuff print $file "\n\n# this is for backwards compatiblity\n"; print $file "\@deps = \@{ \$self->{deps} };\n"; print $file "\@typemaps = \@{ \$self->{typemaps} };\n"; print $file "\$libs = \$self->{libs};\n"; print $file "\$inc = \$self->{inc};\n"; # this is ridiculous, but old versions of ExtUtils::Depends take # first $loadedmodule::CORE and then $INC{$file} --- the fallback # includes the Filename.pm, which is not useful. so we must add # this crappy code. we don't worry about portable pathnames, # as the old code didn't either. (my $mdir = $self->{name}) =~ s{::}{/}g; print $file <<"EOT"; \$CORE = undef; foreach (\@INC) { if ( -f \$_ . "/$mdir/Install/Files.pm") { \$CORE = \$_ . "/$mdir/Install/"; last; } } EOT print $file "\n1;\n"; close $file; # we need to ensure that the file we just created gets put into # the install dir with everything else. #$self->install ($filename); $self->add_pm ($filename, $self->installed_filename ('Files.pm')); } sub load { my $dep = shift; my @pieces = split /::/, $dep; my @suffix = qw/ Install Files /; my $relpath = File::Spec->catfile (@pieces, @suffix) . '.pm'; my $depinstallfiles = join "::", @pieces, @suffix; eval { require $relpath } or die " *** Can't load dependency information for $dep:\n $@\n"; # #print Dumper(\%INC); # effectively $instpath = dirname($INC{$relpath}) @pieces = File::Spec->splitdir ($INC{$relpath}); pop @pieces; my $instpath = File::Spec->catdir (@pieces); no strict; croak "No dependency information found for $dep" unless $instpath; if (not File::Spec->file_name_is_absolute ($instpath)) { $instpath = File::Spec->rel2abs ($instpath); } my @typemaps = map { File::Spec->rel2abs ($_, $instpath) } @{"$depinstallfiles\::typemaps"}; { instpath => $instpath, typemaps => \@typemaps, inc => "-I$instpath ".${"$depinstallfiles\::inc"}, libs => ${"$depinstallfiles\::libs"}, # this will not exist when loading files from old versions # of ExtUtils::Depends. (exists ${"$depinstallfiles\::"}{deps} ? (deps => \@{"$depinstallfiles\::deps"}) : ()), } } sub load_deps { my $self = shift; my @load = grep { not $self->{deps}{$_} } keys %{ $self->{deps} }; foreach my $d (@load) { my $dep = load ($d); $self->{deps}{$d} = $dep; if ($dep->{deps}) { foreach my $childdep (@{ $dep->{deps} }) { push @load, $childdep unless $self->{deps}{$childdep} or grep {$_ eq $childdep} @load; } } } } sub uniquify { my %seen; # we use a seen hash, but also keep indices to preserve # first-seen order. my $i = 0; foreach (@_) { $seen{$_} = ++$i unless exists $seen{$_}; } #warn "stripped ".(@_ - (keys %seen))." redundant elements\n"; sort { $seen{$a} <=> $seen{$b} } keys %seen; } sub get_makefile_vars { my $self = shift; # collect and uniquify things from the dependencies. # first, ensure they are completely loaded. $self->load_deps; ##my @defbits = map { split } @{ $self->{defines} }; my @incbits = map { split } @{ $self->{inc} }; my @libsbits = split /\s+/, $self->{libs}; my @typemaps = @{ $self->{typemaps} }; foreach my $d (keys %{ $self->{deps} }) { my $dep = $self->{deps}{$d}; #push @defbits, @{ $dep->{defines} }; push @incbits, @{ $dep->{defines} } if $dep->{defines}; push @incbits, split /\s+/, $dep->{inc} if $dep->{inc}; push @libsbits, split /\s+/, $dep->{libs} if $dep->{libs}; push @typemaps, @{ $dep->{typemaps} } if $dep->{typemaps}; } # we have a fair bit of work to do for the xs files... my @clean = (); my @OBJECT = (); my %XS = (); foreach my $xs (@{ $self->{xs} }) { (my $c = $xs) =~ s/\.xs$/\.c/i; (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i; $XS{$xs} = $c; push @OBJECT, $o; # according to the MakeMaker manpage, the C files listed in # XS will be added automatically to the list of cleanfiles. push @clean, $o; } # we may have C files, as well: foreach my $c (@{ $self->{c} }) { (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i; push @OBJECT, $o; push @clean, $o; } my %vars = ( INC => join (' ', uniquify @incbits), LIBS => join (' ', uniquify $self->find_extra_libs, @libsbits), TYPEMAPS => [@typemaps], ); $self->build_dll_lib(\%vars) if $^O =~ /MSWin32/; # we don't want to provide these if there is no data in them; # that way, the caller can still get default behavior out of # MakeMaker when INC, LIBS and TYPEMAPS are all that are required. $vars{PM} = $self->{pm} if %{ $self->{pm} }; $vars{clean} = { FILES => join (" ", @clean), } if @clean; $vars{OBJECT} = join (" ", @OBJECT) if @OBJECT; $vars{XS} = \%XS if %XS; %vars; } sub build_dll_lib { my ($self, $vars) = @_; $vars->{macro} ||= {}; $vars->{macro}{'INST_DYNAMIC_LIB'} = '$(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)'; } # Search for extra library files to link against on Windows (either native # Windows library # files, or Cygwin library files) # NOTE: not meant to be called publicly, so no POD documentation sub find_extra_libs { my $self = shift; my %mappers = ( MSWin32 => sub { $_[0] . '\.(?:lib|a)' }, cygwin => sub { $_[0] . '\.dll'}, ); my $mapper = $mappers{$^O}; return () unless defined $mapper; my @found_libs = (); foreach my $name (keys %{ $self->{deps} }) { (my $stem = $name) =~ s/^.*:://; my $lib = $mapper->($stem); my $pattern = qr/$lib$/; my $matching_dir; my $matching_file; find (sub { if ((not $matching_file) && /$pattern/) {; $matching_dir = $File::Find::dir; $matching_file = $File::Find::name; } }, map { -d $_ ? ($_) : () } @INC); # only extant dirs if ($matching_file && -f $matching_file) { push @found_libs, ('-L' . $matching_dir, '-l' . $stem); next; } } return @found_libs; } # Hook into ExtUtils::MakeMaker to create an import library on MSWin32 when gcc # is used. FIXME: Ideally, this should be done in EU::MM itself. package # wrap to fool the CPAN indexer ExtUtils::MM; use Config; sub static_lib { my $base = shift->SUPER::static_lib(@_); return $base unless $^O =~ /MSWin32/ && $Config{cc} =~ /\bgcc\b/i; my $DLLTOOL = $Config{'dlltool'} || 'dlltool'; return <<"__EOM__" # This isn't actually a static lib, it just has the same name on Win32. \$(INST_DYNAMIC_LIB): \$(INST_DYNAMIC) $DLLTOOL --def \$(EXPORT_LIST) --output-lib \$\@ --dllname \$(BASEEXT).\$(SO) \$(INST_DYNAMIC) dynamic:: \$(INST_DYNAMIC_LIB) __EOM__ } 1; __END__ =head1 NAME ExtUtils::Depends - Easily build XS extensions that depend on XS extensions =head1 SYNOPSIS use ExtUtils::Depends; $package = new ExtUtils::Depends ('pkg::name', 'base::package') # set the flags and libraries to compile and link the module $package->set_inc("-I/opt/blahblah"); $package->set_libs("-lmylib"); # add a .c and an .xs file to compile $package->add_c('code.c'); $package->add_xs('module-code.xs'); # add the typemaps to use $package->add_typemaps("typemap"); # install some extra data files and headers $package->install (qw/foo.h data.txt/); # save the info $package->save_config('Files.pm'); WriteMakefile( 'NAME' => 'Mymodule', $package->get_makefile_vars() ); =head1 DESCRIPTION This module tries to make it easy to build Perl extensions that use functions and typemaps provided by other perl extensions. This means that a perl extension is treated like a shared library that provides also a C and an XS interface besides the perl one. This works as long as the base extension is loaded with the RTLD_GLOBAL flag (usually done with a sub dl_load_flags {0x01} in the main .pm file) if you need to use functions defined in the module. The basic scheme of operation is to collect information about a module in the instance, and then store that data in the Perl library where it may be retrieved later. The object can also reformat this information into the data structures required by ExtUtils::MakeMaker's WriteMakefile function. When creating a new Depends object, you give it a name, which is the name of the module you are building. You can also specify the names of modules on which this module depends. These dependencies will be loaded automatically, and their typemaps, header files, etc merged with your new object's stuff. When you store the data for your object, the list of dependencies are stored with it, so that another module depending on your needn't know on exactly which modules yours depends. For example: Gtk2 depends on Glib Gnome2::Canvas depends on Gtk2 ExtUtils::Depends->new ('Gnome2::Canvas', 'Gtk2'); this command automatically brings in all the stuff needed for Glib, since Gtk2 depends on it. =head1 METHODS =over =item $object = ExtUtils::Depends->new($name, @deps) Create a new depends object named I<$name>. Any modules listed in I<@deps> (which may be empty) are added as dependencies and their dependency information is loaded. An exception is raised if any dependency information cannot be loaded. =item $depends->add_deps (@deps) Add modules listed in I<@deps> as dependencies. =item (hashes) = $depends->get_deps Fetch information on the dependencies of I<$depends> as a hash of hashes, which are dependency information indexed by module name. See C. =item $depends->set_inc (@newinc) Add strings to the includes or cflags variables. =item $depends->set_libs (@newlibs) Add strings to the libs (linker flags) variable. =item $depends->add_pm (%pm_files) Add files to the hash to be passed through ExtUtils::WriteMakefile's PM key. =item $depends->add_xs (@xs_files) Add xs files to be compiled. =item $depends->add_c (@c_files) Add C files to be compiled. =item $depends->add_typemaps (@typemaps) Add typemap files to be used and installed. =item $depends->add_headers (list) No-op, for backward compatibility. =item $depends->install (@files) Install I<@files> to the data directory for I<$depends>. This actually works by adding them to the hash of pm files that gets passed through WriteMakefile's PM key. =item $depends->save_config ($filename) Save the important information from I<$depends> to I<$filename>, and set it up to be installed as I::Install::Files. Note: the actual value of I<$filename> seems to be irrelevant, but its usage is kept for backward compatibility. =item hash = $depends->get_makefile_vars Return the information in I<$depends> in a format digestible by WriteMakefile. This sets at least the following keys: INC LIBS TYPEMAPS PM And these if there is data to fill them: clean OBJECT XS =item hashref = ExtUtils::Depends::load (name) Load and return dependency information for I. Croaks if no such information can be found. The information is returned as an anonymous hash containing these keys: =over =item instpath The absolute path to the data install directory for this module. =item typemaps List of absolute pathnames for this module's typemap files. =item inc CFLAGS string for this module. =item libs LIBS string for this module. =item deps List of modules on which this one depends. This key will not exist when loading files created by old versions of ExtUtils::Depends. =back =item $depends->load_deps Load I<$depends> dependencies, by calling C on each dependency module. This is usually done for you, and should only be needed if you want to call C after calling C manually. =back =head1 SUPPORT =head2 Bugs/Feature Requests Version 0.2 discards some of the more esoteric features provided by the older versions. As they were completely undocumented, and this module has yet to reach 1.0, this may not exactly be a bug. This module is tightly coupled to the ExtUtils::MakeMaker architecture. You can submit new bugs/feature requests by using one of two bug trackers (below). =over =item CPAN Request Tracker You can submit bugs/feature requests via the web by going to L (requires PAUSE ID or Bitcard), or by sending an e-mail to L. =item Gnome.org Bugzilla Report bugs/feature requests to the 'gnome-perl' product (requires login) L =back Patches that implement new features with test cases, and/or test cases that exercise existing bugs are always welcome. The Gtk-Perl mailing list is at L. =head2 Source Code The source code to L is available at the Gnome.org Git repo (L). Create your own copy of the Git repo with: git clone git://git.gnome.org/perl-ExtUtils-Depends (Git protocol) git clone https://git.gnome.org/browse/perl-ExtUtils-Depends/ (HTTPS) =head1 SEE ALSO ExtUtils::MakeMaker. =head1 AUTHOR Paolo Molaro wrote the original version for Gtk-Perl. muppet rewrote the innards for version 0.2, borrowing liberally from Paolo's code. =head1 MAINTAINER The Gtk2 project, L/L. =head1 LICENSE This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself. =cut