Commits

Toby Inkster committed f489f5d

packaging improvements

Comments (0)

Files changed (5)

 Revision history for Perl extension XML::LibXML::Devel::SetLineNumber.
 
-0.01  Wed Mar 14 19:42:23 2012
-	- original version; created by h2xs 1.23 with options
-		-n XML::LibXML::Devel::SetLineNumber
+0.001  2012-03-16
 
+	- initial version
 Changes
+libxml.c
+libxml.h
+lib/XML/LibXML/Devel/SetLineNumber.pm
 Makefile.PL
 MANIFEST
+MANIFEST.SKIP
+META.json
+META.yml
 ppport.h
 README
 SetLineNumber.xs
-fallback/const-c.inc
-fallback/const-xs.inc
-lib/XML/LibXML/Devel/SetLineNumber.pm
+t/01basic.t
+t/02working.t
+typemap
+^blib
+^\.
+^Makefile.old
+^XML-LibXML-Devel-SetLineNumber-
+^build
-use 5.010001;
+use 5.008003;
 use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
+
 WriteMakefile(
-    NAME              => 'XML::LibXML::Devel::SetLineNumber',
-    VERSION_FROM      => 'lib/XML/LibXML/Devel/SetLineNumber.pm', # finds $VERSION
-    PREREQ_PM         => {}, # e.g., Module::Name => 1.1
-    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
-      (ABSTRACT_FROM  => 'lib/XML/LibXML/Devel/SetLineNumber.pm', # retrieve abstract from module
-       AUTHOR         => 'Toby Inkster <tai@(none)>') : ()),
-    LIBS    => '-L/usr/local/lib -L/usr/lib -lxml2 -lm',
-    INC     => '-I/usr/include/libxml2/ -I/usr/local/include -I/usr/include -I.',
-    DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
-    OBJECT            => '$(O_FILES)', # link all the C files too
+	NAME              => 'XML::LibXML::Devel::SetLineNumber',
+	VERSION_FROM      => 'lib/XML/LibXML/Devel/SetLineNumber.pm', # finds $VERSION
+	PREREQ_PM         => {}, # e.g., Module::Name => 1.1
+	ABSTRACT_FROM     => 'lib/XML/LibXML/Devel/SetLineNumber.pm', 
+	AUTHOR            => 'Toby Inkster <tobyink@cpan.org>',
+	LIBS              => &get_libs,
+	INC               => (&get_inc . ' -I.'),
+	DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
+	OBJECT            => '$(O_FILES)', # link all the C files too
 );
+
+sub get_libs
+{
+	return $ENV{PERL_LIBXML_SETLINE_LIBS}
+		if $ENV{PERL_LIBXML_SETLINE_LIBS};
+	
+	my $libs;
+	chomp( $libs ||= qx{xml2-config --libs} );
+	chomp( $libs ||= qx{pkg-config --libs libxml-2.0} );
+	
+	die "Could not determine location of libxml2 libs.\n"
+	  . "Please supply PERL_LIBXML_SETLINE_LIBS environment variable."
+		unless $libs =~ /^-/;
+	
+	return $libs;
+}
+
+sub get_inc
+{
+	return $ENV{PERL_LIBXML_SETLINE_INC}
+		if $ENV{PERL_LIBXML_SETLINE_INC};
+		
+	my $incs;
+	chomp( $incs ||= qx{xml2-config --cflags} );
+	chomp( $incs ||= qx{pkg-config --cflags libxml-2.0} );
+	
+	die "Could not determine location of libxml2 headers.\n"
+	  . "Please supply PERL_LIBXML_SETLINE_INC environment variable."
+		unless $incs =~ /^-/;
+	
+	return $incs;
+}
+
-XML-LibXML-Devel-SetLineNumber version 0.01
-===========================================
-
-The README is used to introduce the module and provide instructions on
-how to install the module, any machine dependencies it may have (for
-example C compilers and installed libraries) and any other information
-that should be provided before the module is installed.
-
-A README file is required for CPAN modules since CPAN extracts the
-README file from a module distribution so that people browsing the
-archive can use it get an idea of the modules uses. It is usually a
-good idea to provide version information here so that people can
-decide whether fixes for the module are worth downloading.
+XML-LibXML-Devel-SetLineNumber version 0.001
+============================================
 
 INSTALLATION
 
 To install this module type the following:
 
-   perl Makefile.PL
-   make
-   make test
-   make install
+  perl Makefile.PL
+  make
+  make test
+  make install
 
-DEPENDENCIES
+Makefile.PL will attempt to determine the location of your libxml2
+compiled libraries and header files using xml2-config or pkg-config,
+but this may fail. If they do, you can manually specify the locations
+using environment variables. For example, in tcsh:
 
-This module requires these other modules and libraries:
+  setenv PERL_LIBXML_SETLINE_LIBS "-lxml2 -lz -lm"
+  setenv PERL_LIBXML_SETLINE_INC "-I/usr/include/libxml2"
+  
+In bash:
 
-  blah blah blah
+  PERL_LIBXML_SETLINE_LIBS="-lxml2 -lz -lm"
+  PERL_LIBXML_SETLINE_INC="-I/usr/include/libxml2"
+
+In cmd.exe:
+
+  set PERL_LIBXML_SETLINE_LIBS="-LC:\libxml2\lib"
+  set PERL_LIBXML_SETLINE_INC="-IC:\libxml2\include"
 
 COPYRIGHT AND LICENCE