geoffmcl / html-tidy

Fork of HTML::Tidy, a Perl wrapper about libtidy
http://search.cpan.org/dist/HTML-Tidy
0 stars 0 forks source link

Update HTML::Tidy to use latest 5.7.3 libtidy #3

Closed geoffmcl closed 6 years ago

geoffmcl commented 6 years ago

Tidy recently officially released a 5.6.0...

After the release a few relatively minor bugs were found, and these were fixed in next, and the version bumped to 5.7.3... these may or may not be ported back to release 5.6.0...

But I want to update my Perl 64-bit HTML::Tidy installation to use this latest 5.7.3 tidy library...

This update will be done in the next branch here...

Rather arbitrarily, will call this the 5.60 version of HTML::Tidy...

geoffmcl commented 6 years ago

Ended up choosing version 5.61, and made the next branch the default branch...

geoffmcl commented 6 years ago

Made a considerable number of enhancement to my Windows build-me.bat...

I have tidy installed in F:/Projects/software.x64, and had previously hard coded Makefile.PL to use this installation... until I add a way to externalize this, other builders will have to adjust this accordingly...

Now using my build-me.bat, which first sets up a MSVC 14 x64 build environment, I was able to build a new Tidy.dll... but there was a wrinkle...

For some reason, the tools run when you run perl Makefile.PL build a Makefile that includes a linker option -nodefaultlib, which leaves unresolved externals...

So I built a perl module, modmakefile.pl to scan the makefile, remove that option, and write a Makefile.mak, which is then passed to nmake... this is all part of the build-me.bat... I wish I could find a way to tell the perl tools to not add this...

Then we came to the test... and several failed... must now dig into this...

geoffmcl commented 6 years ago

Yippee, got a 100% test PASS... in the main was achieved by modifying or adding a config file for the test, and one just a strange change in row/column reported... but all now pass...

Now to try to externalize the tidy/libtidy installation to use... it should be possible to use a Tidy installed anywhere, even from our binaries zip distribution, which includes the tidy public headers, and the static tidys.lib library...

Maybe by setting TIDY_ROOT in the environment to point to the installation root folder... this is the environment variable that can be used for the FindTidy.cmake cmake module, or something like that...

geoffmcl commented 6 years ago

First cut of using external setting of TIDY_ROOT, and some other Makefile.PL tidy ups... and it WORKED...

More testing an experimentation required, but it is looking good...

Would be great if there are others out there to give it a try, and provide feedback... thanks...

geoffmcl commented 6 years ago

Now builds in Ubuntu linux 14.04 LTS, 64-bit, using my installed libtidy.so, version 5.7.3... all tests pass, etc...

Looking good, but feedback very welcome... thanks...

geoffmcl commented 6 years ago

Wow, you can learn something new everyday...

So far all the [n]make test were passing in Ubuntu linux 14.04 x64 and Windows 10 x64, so I tried a build and test in Raspbian 8 armv71 and some tests failed!

Well, first, of course I had to install some more modules, like Test::Exception, and optionally Test::Pod and Test::Pod::Coverage and at the same time updated the CPAN version... but still got some interesting failures... like -

t/cfg-for-parse.t .... 1/3
#   Failed test 'Matching errors'
#   at t/cfg-for-parse.t line 29.
#     Structures begin differing at:
#          $got->[0] = 'DATA (3:1) Error: <neck> is not recognised!'
#     $expected->[0] = 'DATA (3:1) Error: <neck> is not recognized!'
# Looks like you failed 1 test of 3.
t/cfg-for-parse.t .... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests

Took me quite some time to see the difference - just an s vs a z!

Eventually running $ locale in Ubuntu shows LANG=en_US.UTF-8, while in Raspbian shows LANG=en_GB.UTF-8, and there is the difference. The test contains the US recognized, while in Raspbian, library Tidy selected and shows the GB recognised.

Yowee, the Tidy library auto language selection is working very well - that is good. But how to temporarily change the language so the tests will pass?

Well, I do not understand it exactly but it turned out simple. Change the language to C, by simply typing LANG=C, and all tests PASSED. Maybe other builders, testers would know to ensure a default language must be set before running the test...

So now the tests PASS have installed this new version on Raspbian...

Onward with testing...

geoffmcl commented 6 years ago

Added a note about the default language of your system, and running make test...

geoffmcl commented 6 years ago

Created a 5.61 tagged release... so closing this...

as always look forward to feedback... thanks