diff options
author | lex <lexinhell@gmail.com> | 2016-02-29 16:23:19 +0300 |
---|---|---|
committer | lex <lexinhell@gmail.com> | 2016-02-29 16:23:19 +0300 |
commit | 9b11b5c463b9035e46037d9d6acb1095e0d001cf (patch) | |
tree | cf1c869a739f3dd19bc7072a1a25e4e1db5e4d19 | |
parent | 62a42a38a6c3b8e6d58dfee4c602118ba64290e6 (diff) |
Fixed compile problem
-rw-r--r-- | Changes | 3 | ||||
-rwxr-xr-x | Makefile.PL | 60 | ||||
-rwxr-xr-x | MyHTML.pm | 10 | ||||
-rw-r--r-- | examples/detect_encoding.pl | 2 | ||||
-rwxr-xr-x | xs/tree_node.xs | 2 |
5 files changed, 56 insertions, 21 deletions
@@ -1,2 +1,5 @@ +0.24 Mon Feb 29 2016 16:16:03 GMT+0300 + Fixed compile problem + 0.23 Sun Feb 28 2016 19:26:03 GMT+0300 First release diff --git a/Makefile.PL b/Makefile.PL index 1cfa981..6f7b9e4 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,34 +1,64 @@ +package MYINSTALLER; + use strict; use utf8; use FindBin; +use File::Find; use ExtUtils::MakeMaker; -use Config; my $myhtml_source_dir = $FindBin::Bin ."/source"; -my $myhtml_lib_dir = "$myhtml_source_dir/lib"; - -print "Build MyHTML library: "; -my $res = `make -j4 -C $myhtml_source_dir`; +our ($LIST_COMPILE, $LIST_OBJECTS); -unless ($?) { - print "done\n"; -} -else { - print "fault\n"; +sub find_all_obj_files { + my ($dir_name) = @_; + + my @list; + my @obj_list; + + my $search = sub { + return unless $_ =~ /\.c$/; + + my $obj_name = $_; #$File::Find::name; + $obj_name =~ s/\.c$/.o/; + + push @obj_list, "source/$obj_name"; + push @list, "-o source/$obj_name ". $File::Find::name; + }; + + find({ wanted => $search, follow => 1 }, "$dir_name/myhtml"); + + return (\@list, \@obj_list); } -WriteMakefile( +($LIST_COMPILE, $LIST_OBJECTS) = find_all_obj_files($myhtml_source_dir); + +my $fdfdf = WriteMakefile( AUTHOR => 'Alexander Borisov <lex.borisov@gmail.com>', - ABSTRACT_FROM => 'MyHTML.pm', + ABSTRACT => 'Fast HTML Parser using Threads with no outside dependencies', VERSION_FROM => 'MyHTML.pm', NAME => 'HTML::MyHTML', LICENSE => 'Apache 2.0', LINKTYPE => 'dynamic', - MYEXTLIB => "$myhtml_lib_dir/static_libmyhtml.a", LIBS => ["-lpthread"], - INC => "-I$myhtml_source_dir", - clean => {FILES => "$myhtml_source_dir/myhtml/*libmyhtml* $myhtml_source_dir/myhtml/*.o $myhtml_source_dir/myhtml/utils/*.o $myhtml_lib_dir/*"} + OBJECT => [@$LIST_OBJECTS, "MyHTML.o"], + INC => "-I$myhtml_source_dir", + #MYEXTLIB => "$myhtml_source_dir/myhtml/myhtml.o", + clean => {FILES => "$myhtml_source_dir/myhtml/*libmyhtml* $myhtml_source_dir/*.o $myhtml_source_dir/myhtml/*.o $myhtml_source_dir/myhtml/utils/*.o"} ); +package MY; +use Config; + +sub postamble { + my $self = shift; + my @list; + + foreach my $name (@{$MYINSTALLER::LIST_COMPILE}) { + push @list, "\t". '$(CC) -Wall -Werror -O2 -fPIC --std=c99 -pthread $(INC) -c '. $name; + } + + return join "\n", @list; +} + @@ -22,7 +22,7 @@ use strict; use vars qw($AUTOLOAD $VERSION $ABSTRACT @ISA @EXPORT); BEGIN { - $VERSION = 0.23; + $VERSION = 0.24; $ABSTRACT = "Fast HTML Parser using Threads with no outside dependencies"; @ISA = qw(Exporter DynaLoader); @@ -140,6 +140,8 @@ This Parser based on L<MyHTML library|https://github.com/lexborisov/myhtml> (it =item * Passes all tree construction tests from L<html5lib-tests|https://github.com/html5lib/html5lib-tests> +See latest version on L<https://github.com/lexborisov/perl-html-myhtml|https://github.com/lexborisov/perl-html-myhtml> + =back =head1 SYNOPSIS @@ -160,7 +162,7 @@ This Parser based on L<MyHTML library|https://github.com/lexborisov/myhtml> (it # print result print "Print HTML Tree:\n"; - $tree->document->print_childs($tree, *STDOUT, 0); + $tree->document->print_children($tree, *STDOUT, 0); print "\nGet all DIV elements of HTML Tree:\n"; my $list = $tree->get_elements_by_tag_name("div"); @@ -674,11 +676,11 @@ Print a node $node->print($tree, $fh, $inc); -=head3 print_childs +=head3 print_children Print tree of a node. Print excluding current node - $node->print_childs($tree, $fh, $inc); + $node->print_children($tree, $fh, $inc); =head3 print_all diff --git a/examples/detect_encoding.pl b/examples/detect_encoding.pl index cea8102..a91e597 100644 --- a/examples/detect_encoding.pl +++ b/examples/detect_encoding.pl @@ -25,7 +25,7 @@ $myhtml->parse($tree, $encoding, $body); # print result print "Print HTML Tree:\n"; -$tree->document->print_childs($tree, *STDOUT, 0); +$tree->document->print_children($tree, *STDOUT, 0); $tree->destroy(); diff --git a/xs/tree_node.xs b/xs/tree_node.xs index 24b02f8..2a1350c 100755 --- a/xs/tree_node.xs +++ b/xs/tree_node.xs @@ -301,7 +301,7 @@ print(node, tree, fh, inc) #=sort 23 void -print_childs(node, tree, fh, inc) +print_children(node, tree, fh, inc) HTML::MyHTML::Tree::Node node; HTML::MyHTML::Tree tree; FILE* fh; |