Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 03-24-2009, 03:22 PM   #706
Buran
Geek
Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.
 
Buran's Avatar
 
Posts: 190
Karma: 471136
Join Date: Mar 2009
Location: Brentwood, MO
Device: Kindle Oasis Waterproof 32GB 3G (without offers)
Cool

I'm trying to get MobiPerl working so that I can convert some non-DRMed books in Mobi format to html so that I can touch them up and improve on the formatting done by the original creators (I'm picky and some free books aren't done well).

Alas, I'm running up against issues with getting the GD module in Perl working; I'm running Mac OS X Leopard 10.5.7 and I've installed seemingly everything needed to make it work, EXCEPT this module. I seem to be running up against an insurmountable bug.

I've installed X11, the X11 SDK, Fink, MacPorts, and I've followed the instructions in the MobiPerl page and on the MobieRead wiki. All attempts hang at making the GD module work. Here's what I see when trying to do the install using CPAN (I know it's long, but for completeness' sake ...)

Code:
cpan> install GD
CPAN: Storable loaded ok
Going to read /Users/buran/.cpan/Metadata
  Database was generated on Sat, 21 Mar 2009 22:27:01 GMT
Running install for module GD
Running make for L/LD/LDS/GD-2.41.tar.gz
CPAN: Digest::MD5 loaded ok
CPAN: Compress::Zlib loaded ok
Checksum for /Users/buran/.cpan/sources/authors/id/L/LD/LDS/GD-2.41.tar.gz ok
Scanning cache /Users/buran/.cpan/build for sizes
Deleting from cache: /Users/buran/.cpan/build/GD-2.41 (2.1>0.0 MB)
GD-2.41/
GD-2.41/t/
GD-2.41/t/test.out.3.jpeg
GD-2.41/t/GD.t
GD-2.41/t/tile.jpeg
GD-2.41/t/test.out.4.jpeg
GD-2.41/t/test.out.5.jpeg
GD-2.41/t/test.out.6.jpeg
GD-2.41/t/test.out.7.jpeg
GD-2.41/t/test.out.8.jpeg
GD-2.41/t/test.out.9.jpeg
GD-2.41/t/test.out.3.png-1
GD-2.41/t/Polyline.t
GD-2.41/t/test.out.4.png-1
GD-2.41/t/test.out.4.png-2
GD-2.41/t/test.out.10.png-1
GD-2.41/t/test.out.10.png-2
GD-2.41/t/test.out.10.png-3
GD-2.41/t/test.out.1.png
GD-2.41/t/test.out.2.gif
GD-2.41/t/test.out.2.png
GD-2.41/t/test.out.3.gif
GD-2.41/t/test.out.3.png
GD-2.41/t/test.out.4.gif
GD-2.41/t/test.out.4.png
GD-2.41/t/test.out.5.gif
GD-2.41/t/test.out.5.png
GD-2.41/t/test.out.6.gif
GD-2.41/t/test.out.6.png
GD-2.41/t/test.out.7.gif
GD-2.41/t/test.out.7.png
GD-2.41/t/test.out.8.gif
GD-2.41/t/test.out.8.png
GD-2.41/t/test.out.9.gif
GD-2.41/t/test.out.9.png
GD-2.41/t/test.out.5.png-1
GD-2.41/t/Generic.ttf
GD-2.41/t/test.out.6.png-1
GD-2.41/t/test.out.7.png-1
GD-2.41/t/frog.jpg
GD-2.41/t/frog.xpm
GD-2.41/t/test.out.10.jpeg
GD-2.41/t/test.out.8.png-1
GD-2.41/t/test.out.8.png-2
GD-2.41/t/test.out.8.png-3
GD-2.41/t/test.out.8.png-4
GD-2.41/t/test.out.8.png-5
GD-2.41/t/test.out.8.png-6
GD-2.41/t/tile.gif
GD-2.41/t/tile.png
GD-2.41/t/test.out.2.png-1
GD-2.41/t/test.out.9.png-1
GD-2.41/t/test.out.9.png-2
GD-2.41/t/palettemap.png
GD-2.41/t/test.out.10.gif
GD-2.41/t/test.out.10.png
GD-2.41/t/test.out.2.jpeg
GD-2.41/GD/
GD-2.41/GD/Group.pm
GD-2.41/GD/Polygon.pm
GD-2.41/GD/Simple.pm
GD-2.41/GD/Image.pm.PLS
GD-2.41/GD/Polyline.pm
GD-2.41/GD.pm
GD-2.41/GD.xs
GD-2.41/demos/
GD-2.41/demos/brushes.pl
GD-2.41/demos/font_list.png
GD-2.41/demos/fonttest
GD-2.41/demos/polys.pl
GD-2.41/demos/fills.pl
GD-2.41/demos/truetype_test
GD-2.41/demos/shapes.pl
GD-2.41/demos/copies.pl
GD-2.41/demos/ttf.pl
GD-2.41/demos/gd_example.cgi
GD-2.41/demos/tile.png
GD-2.41/demos/polyline.pl
GD-2.41/demos/transform.pl
GD-2.41/qd.pl
GD-2.41/README
GD-2.41/Makefile.PL
GD-2.41/README.QUICKDRAW
GD-2.41/META.yml
GD-2.41/typemap
GD-2.41/bdf_scripts/
GD-2.41/bdf_scripts/README
GD-2.41/bdf_scripts/bdf2gdfont.PLS
GD-2.41/bdf_scripts/bdftogd
GD-2.41/bdf_scripts/bdf2gdfont.pl
GD-2.41/README.unix
GD-2.41/ChangeLog
GD-2.41/MANIFEST

  CPAN.pm: Going to build L/LD/LDS/GD-2.41.tar.gz

Configuring for libgd version 2.0.33.
Checking for stray libgd header files...none found.

Included Features:          GD_XPM GD_JPEG GD_FONTCONFIG GD_FREETYPE GD_PNG GD_GIF GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33
GD library used from:       /sw
Checking if your kit is complete...
Looks good
Writing Makefile for GD
/usr/bin/perl GD/Image.pm.PLS GD/Image.pm
Extracting Image.pm (with variable substitutions)
cp GD/Polyline.pm blib/lib/GD/Polyline.pm
cp qd.pl blib/lib/qd.pl
cp GD/Image.pm blib/lib/GD/Image.pm
cp GD.pm blib/lib/GD.pm
AutoSplitting blib/lib/GD.pm (blib/lib/auto/GD)
cp GD/Simple.pm blib/lib/GD/Simple.pm
cp GD/Polygon.pm blib/lib/GD/Polygon.pm
/usr/bin/perl /System/Library/Perl/5.8.8/ExtUtils/xsubpp  -typemap /System/Library/Perl/5.8.8/ExtUtils/typemap -typemap typemap  GD.xs > GD.xsc && mv GD.xsc GD.c
cc -c  -I/sw/include -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include -O3   -DVERSION=\"2.41\" -DXS_VERSION=\"2.41\"  "-I/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE"  -DHAVE_JPEG -DHAVE_FT -DHAVE_XPM -DHAVE_GIF -DHAVE_PNG -DHAVE_ANIMGIF -DVERSION_33 -DHAVE_UNCLOSEDPOLY -DHAVE_FONTCONFIG -DHAVE_FTCIRCLE GD.c
Running Mkbootstrap for GD ()
chmod 644 GD.bs
rm -f blib/arch/auto/GD/GD.bundle
LD_RUN_PATH="/usr/X11/lib:/sw/lib:/usr/lib" cc -mmacosx-version-min=10.5.6  -arch i386 -arch ppc -bundle -undefined dynamic_lookup -L/usr/local/lib GD.o  -o blib/arch/auto/GD/GD.bundle         \
           -L/usr/X11/lib -L/sw/lib -L/sw/lib -L/usr/X11/lib -L/sw/lib -lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng12 -lz -lgd      \
          
ld warning: in /sw/lib/libjpeg.dylib, file is not of required architecture
ld warning: in /sw/lib/libgd.dylib, file is not of required architecture
chmod 755 blib/arch/auto/GD/GD.bundle
cp GD.bs blib/arch/auto/GD/GD.bs
chmod 644 blib/arch/auto/GD/GD.bs
/usr/bin/perl "-Iblib/arch" "-Iblib/lib" bdf_scripts/bdf2gdfont.PLS bdf_scripts/bdf2gdfont.pl
Extracting bdf2gdfont.pl (with variable substitutions)
cp bdf_scripts/bdf2gdfont.pl blib/script/bdf2gdfont.pl
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/bdf2gdfont.pl
Manifying blib/man1/bdf2gdfont.pl.1
Manifying blib/man3/GD::Polyline.3pm
Manifying blib/man3/GD::Image.3pm
Manifying blib/man3/GD::Simple.3pm
Manifying blib/man3/GD.3pm
Manifying blib/man3/GD::Polygon.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/GD..........Can't load './blib/arch/auto/GD/GD.bundle' for module GD: dlopen(./blib/arch/auto/GD/GD.bundle, 2): Library not loaded: /usr/X11/lib/libpng12.0.dylib
  Referenced from: /sw/lib/libgd.2.dylib
  Reason: Incompatible library version: libgd.2.dylib requires version 25.0.0 or later, but libpng12.0.dylib provides version 1.0.0 at /System/Library/Perl/5.8.8/darwin-thread-multi-2level/DynaLoader.pm line 230.
 at t/GD.t line 14
Compilation failed in require at t/GD.t line 14.
BEGIN failed--compilation aborted at t/GD.t line 14.
t/GD..........dubious                                                        
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-12
        Failed 12/12 tests, 0.00% okay
t/Polyline....Can't load '/Users/buran/.cpan/build/GD-2.41/blib/arch/auto/GD/GD.bundle' for module GD: dlopen(/Users/buran/.cpan/build/GD-2.41/blib/arch/auto/GD/GD.bundle, 2): Library not loaded: /usr/X11/lib/libpng12.0.dylib
  Referenced from: /sw/lib/libgd.2.dylib
  Reason: Incompatible library version: libgd.2.dylib requires version 25.0.0 or later, but libpng12.0.dylib provides version 1.0.0 at /System/Library/Perl/5.8.8/darwin-thread-multi-2level/DynaLoader.pm line 230.
 at /Users/buran/.cpan/build/GD-2.41/blib/lib/GD/Polyline.pm line 45
Compilation failed in require at /Users/buran/.cpan/build/GD-2.41/blib/lib/GD/Polyline.pm line 45.
BEGIN failed--compilation aborted at /Users/buran/.cpan/build/GD-2.41/blib/lib/GD/Polyline.pm line 45.
Compilation failed in require at t/Polyline.t line 10.
BEGIN failed--compilation aborted at t/Polyline.t line 10.
t/Polyline....dubious                                                        
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED test 1
        Failed 1/1 tests, 0.00% okay
Failed Test  Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/GD.t          2   512    12   23 191.67%  1-12
t/Polyline.t    2   512     1    2 200.00%  1
Failed 2/2 test scripts, 0.00% okay. 13/13 subtests failed, 0.00% okay.
make: *** [test_dynamic] Error 2
  /usr/bin/make test -- NOT OK
Running make install
  make test had returned bad status, won't install without force

cpan>
I've bolded what I believe is the problem, and I researched the problem and found the following:

Re: [Fink-users] libpng12.0.dylib not loaded

So I installed x11sdk.pkg from a 10.5.4 disk ... and tried again. Same result. Of course, if I try to run mobi2html anyway, it immediately tries to run with the ONE MODULE I can't seem to get working, and dies.

I have a Windows box, but I don't want to use that for this task. It's really inconvenient for me to do anything with it other than use it for games (long story, but true). Can't I get a precompiled GD.pm from anywhere that actually works? Fink and MacPorts can't seem to help me. (I did install gd2 via Fink, which isn't fixing this problem).

I can't be the only person in the world having this problem. There MUST be a solution!

Of course, gd seems to be fine in PHP ... as far as I can tell, anyway. But there's no such thing as MobiPHP, is there?

The MobiPerl site has precompiled binaries ... for Windows. No help.

And of course, Calibre works on this system but doesn't have a way to dump the text to HTML that I can tell... or does it?

Once I get the text into HTML I can rebuild them into new .prc files for my Kindle 2 (I've done this for a few books already that I had in HTML in the first place). The problem is getting the text out of the .prc file in the first place.

Honestly, I don't care about cover images in the first place as I can grab a cover image online anyway, for when I do make a new .prc ... if all we want is to dump the text to HTML, why do we need a graphics library? What about a Perl/PHP script that will ONLY save the text? I manually input the metadata I want when I reassemble the .prc after editing.

Last edited by Buran; 03-24-2009 at 03:33 PM.
Buran is offline   Reply With Quote
Old 03-24-2009, 03:31 PM   #707
bwaldron
Wizard
bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.
 
bwaldron's Avatar
 
Posts: 1,230
Karma: 543210
Join Date: Feb 2008
Location: Gatlinburg, Tennessee
Device: Kindles: Paperwhite Signature Ed., Oasis 2, Voyage
Quote:
Originally Posted by Buran View Post
And of course, Calibre works on this system but doesn't have a way to dump the text to HTML that I can tell... or does it?
It does: mobi2oeb (command-line tool).
bwaldron is offline   Reply With Quote
Advert
Old 03-24-2009, 03:32 PM   #708
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Maybe the following is relevant:

http://www.faqs.org/docs/bugzilla/osx.html

If you now some Perl it is probably easy to modify the scripts not to use GD. And is GD really used for mobi2html?

I think GD is used to convert the image data to jpeg and to read in the file and give a data string.
tompe is offline   Reply With Quote
Old 03-24-2009, 03:36 PM   #709
Buran
Geek
Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.
 
Buran's Avatar
 
Posts: 190
Karma: 471136
Join Date: Mar 2009
Location: Brentwood, MO
Device: Kindle Oasis Waterproof 32GB 3G (without offers)
Fantastic -- except the link for the required make patch is dead.
Buran is offline   Reply With Quote
Old 03-24-2009, 03:36 PM   #710
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 73,979
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
I used to have a working installation on Mac OS X 10.5.6, so it's certainly possible. After a drive failure I have to reinstall everything, so I'm working with the visual guide in the wiki to make sure that it's accurate.

So far I've found that the jpeglib instructions aren't complete, and it's a slow process checking things.

As for GD, I seem to remember that apart from the Perl interface to GD, you also need to install the GD library itself. But I haven't got to that bit yet, so I have no more to go on than vague memories.



Quote:
Originally Posted by Buran View Post
I'm trying to get MobiPerl working so that I can convert some non-DRMed books in Mobi format to html so that I can touch them up and improve on the formatting done by the original creators (I'm picky and some free books aren't done well).

Alas, I'm running up against issues with getting the GD module in Perl working; I'm running Mac OS X Leopard 10.5.7 and I've installed seemingly everything needed to make it work, EXCEPT this module. I seem to be running up against an insurmountable bug.

I've installed X11, the X11 SDK, Fink, MacPorts, and I've followed the instructions in the MobiPerl page and on the MobieRead wiki. All attempts hang at making the GD module work. Here's what I see when trying to do the install using CPAN (I know it's long, but for completeness' sake ...)
pdurrant is offline   Reply With Quote
Advert
Old 03-24-2009, 03:41 PM   #711
Buran
Geek
Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.
 
Buran's Avatar
 
Posts: 190
Karma: 471136
Join Date: Mar 2009
Location: Brentwood, MO
Device: Kindle Oasis Waterproof 32GB 3G (without offers)
I did install gd (gd2). I'm hunting for a mirror of that makefile patch right now. Hopefully I can find one someplace. I do recall installing libjpeg via fink, though.
Buran is offline   Reply With Quote
Old 03-24-2009, 03:58 PM   #712
Buran
Geek
Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.
 
Buran's Avatar
 
Posts: 190
Karma: 471136
Join Date: Mar 2009
Location: Brentwood, MO
Device: Kindle Oasis Waterproof 32GB 3G (without offers)
Bah.

Code:
bash-3.2# sudo patch < gd-makefile.patch 
patching file Makefile.PL
Hunk #1 FAILED at 3.
Hunk #2 FAILED at 23.
I think this is the patch file.

patchfile

Alas, the patch doesn't match the makefile... looks like I have to manually hack it.

The Makefile:

Code:
use ExtUtils::MakeMaker qw(prompt WriteMakefile);
use Config;
use strict;

require 5.6.0;

unless (@ARGV) {
warn <<END;
Notice: Type perl Makefile.PL -h for command-line option summary.

END
}


# =====> PATHS: CHECK AND ADJUST <=====
my (@INC,@LIBPATH,@LIBS);
my $AUTOCONFIG = 0;      # global set by try_to_autoconfigure() below

my ($options,$lib_gd_path,$lib_ft_path,$lib_png_path,$lib_jpeg_path,$lib_xpm_path,$lib_zlib_path,$force);

use Getopt::Long;
GetOptions("ignore_missing_gd" => \$force);

unless (try_to_autoconfigure(\$options,\$lib_gd_path,\@INC,\@LIBPATH,\@LIBS) || $force) {
    die <<END;
**UNRECOVERABLE ERROR**
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd.
END
}

@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
@LIBPATH = qw(-L/usr/lib/X11 -L/usr/X11R6/lib -L/usr/X11/lib -L/usr/lib) unless @LIBPATH;
@LIBS    = qw(-lgd) unless @LIBS;

# support for AMD64 libraries
if (-d '/usr/lib64') {
  my @libs64 = map {my $a = $_; $a=~ s/lib$/lib64/; $a} @LIBPATH;
  @LIBPATH = (@LIBPATH,@libs64);
}

#############################################################################################
# Build options passed in to script to support reproducible builds via Makefiles
#############################################################################################
my $result = GetOptions("options=s"       => \$options,
			"lib_gd_path=s"   => \$lib_gd_path,
			"lib_ft_path=s"   => \$lib_ft_path,
			"lib_png_path=s"  => \$lib_png_path,
			"lib_jpeg_path=s" => \$lib_jpeg_path,
			"lib_xpm_path=s"  => \$lib_xpm_path,
			"lib_zlib_path=s" => \$lib_zlib_path,
		       );
unless ($result) {
  print STDERR <<END;
Usage: perl Makefile.PL [options]

Configure GD module.

 Options:
     -options       "JPEG,FT,PNG,GIF,XPM,ANIMGIF"   feature options, separated by commas
     -lib_gd_path   path            path to libgd
     -lib_ft_path   path            path to Freetype library
     -lib_png_path  path            path to libpng
     -lib_jpeg_path path            path to libjpeg
     -lib_xpm_path  path            path to libxpm
     -lib_zlib_path path            path to libpng
     -ignore_missing_gd             Ignore missing or old libgd installations and try to compile anyway

If no options are passed on the command line.  The program will
attempt to autoconfigure itself with the gdlib-config program (present
in GD versions 2.0.27 or later).  Otherwise it will prompt for these
values interactively.
END
}

if( defined($options) )
{
    print "Included Features:          $options\n";
}
if( defined($lib_gd_path) )
{
    print "GD library used from:       $lib_gd_path\n";
}
if( defined($lib_ft_path) )
{
    print "FreeType library used from: $lib_ft_path\n";
    @INC     = ("-I$lib_ft_path/include", @INC);
    @LIBPATH = ("-L$lib_ft_path/lib", @LIBPATH);
}
if( defined($lib_png_path) )  
{
    print "PNG library used from:      $lib_png_path\n";
    @INC     = ("-I$lib_png_path/include", @INC);
    @LIBPATH = ("-L$lib_png_path/lib", @LIBPATH); 
}
if( defined($lib_jpeg_path) )  
{
    print "JPEG library used from:      $lib_jpeg_path\n";
    @INC     = ("-I$lib_jpeg_path/include", @INC);
    @LIBPATH = ("-L$lib_jpeg_path/lib", @LIBPATH); 
}
if( defined($lib_xpm_path) )  
{
    print "XPM library used from:      $lib_xpm_path\n";
    @INC     = ("-I$lib_xpm_path/include", @INC);
    @LIBPATH = ("-L$lib_xpm_path/lib", @LIBPATH); 
}
if( defined($lib_zlib_path) ) 
{
    print "Zlib library used from:     $lib_zlib_path\n";
    @INC     = ("-I$lib_zlib_path/include", @INC);
    @LIBPATH = ("-L$lib_zlib_path/lib", @LIBPATH); 
}
#############################################################################################

if ($^O eq 'VMS'){
  warn "This is a build on OpenVMS. In case of problems with the build\n";
  warn "do not bother Lincoln Stein but get in touch with\n";
  warn "Martin P.J. Zinser (zinser\@decus.de)\n\n";

  if ($ENV{"LIB_ROOT"} eq "") {
    warn "Define lib_root as a concealed logical pointing to the\n";
    warn "Top directory where you have your libraries installed\n";
    warn "E.g. define/job/trans=conc lib_root public\$device:[public.util.libs.]\n";
    warn "Also define the logical pubbin to point to the location\n";
    warn "of the object libraries\n";
    warn "Then re-invoke Makefile.PL\n";
    warn "Exiting now...\n";
    exit;
  }

  @INC     = qw(-I/lib_root/gd -I/lib_root/libpng -I/lib_root/zlib);
  @LIBPATH = qw(-Lpubbin);
  @LIBS    = qw(-llibgd.olb -llibpng.olb -llibz.olb);
}

# workaround for solaris systems?
elsif ($^O =~ /solaris/i) {
    push @LIBS,'-liconv';
}

###################################################################
# path to libgd, skip prompt if passed in from above
###################################################################
my $PREFIX = $lib_gd_path;
if( ! defined($lib_gd_path) )
{
  warn "\n";
  $PREFIX = prompt('Where is libgd installed?','/usr/lib');
}

unless ($AUTOCONFIG || $PREFIX eq '/usr/lib') {
  $PREFIX =~ s!/lib$!!;
  unshift @INC,"-I$PREFIX/include";
  unshift @LIBPATH,"-L$PREFIX/lib";
}

# FEATURE FLAGS

##################################################################################################################
# If build options have not been passed in then prompt for settings
##################################################################################################################
my ($JPEG, $FT, $XPM, $GIF,$ANIMGIF,$UNCLOSEDPOLY,$FONTCONFIG,$PNG,$FTCIRCLE,$VERSION_33);
if( defined($options) )
{
  $JPEG      = $options =~ m/JPEG/i;
  $FT        = $options =~ m/FT|FREETYPE/i;
  $XPM       = $options =~ m/XPM/i;
  $GIF       = $options =~ m/GIF/i;
  $PNG       = $options =~ m/PNG/i;
  $ANIMGIF   = $GIF && $options =~ m/ANIMGIF/i;
  $VERSION_33= $options =~ m/VERSION_33/i;
  $UNCLOSEDPOLY  = $options =~ m/UNCLOSEDPOLY/i;
  $FONTCONFIG  = $options =~ m/FONTCONFIG/i;
  $FTCIRCLE  = $options =~ m/FTCIRCLE/i;
}
else
{
    warn "\nPlease choose the features that match how libgd was built:\n";
    $JPEG    = lc prompt('Build JPEG support?','y') eq 'y';
    $PNG     = lc prompt('Build PNG support?','y') eq 'y';
    $FT      = lc prompt('Build FreeType support?','y') eq 'y';
    $GIF     = lc prompt('Build GIF support?','y') eq 'y';
    $ANIMGIF = $GIF && lc prompt('Build support for animated GIFs?','y') eq 'y';
    $XPM     = $^O !~ /^freebsd|MSWin32$/ && lc prompt('Build XPM support?','y') eq 'y';
}
##################################################################################################################

my $FCGI    = 0;   # set to 1 to build compatability with fastCGI

#### no user-serviceable parts below #####

if (!$AUTOCONFIG) {
  warn "\nIf you experience compile problems, please check the \@INC, \@LIBPATH and \@LIBS\n",
       "arrays defined in Makefile.PL and manually adjust, if necessary.\n\n";

  push @LIBS,'-lfreetype'      if $FT;
  push @LIBS,'-ljpeg'          if $JPEG;
  push @LIBS,'-lpng','-lz'     if $PNG;
  push @LIBS, '-lm'       unless $^O eq 'MSWin32';
  push @INC, '-I/lib_root/libjpeg' if ($JPEG && $^O eq 'VMS');
  push @INC, '-I/lib_root/ft2/include/freetype' if ($FT && $^O eq 'VMS');
  push @INC, '-I/X11' if ($XPM && $^O eq 'VMS');

  # FreeBSD 3.3 with libgd built from ports croaks if -lXpm is specified 
  if ($^O ne 'freebsd' && $^O ne 'MSWin32') { 
    push @LIBS,'-lX11','-lXpm' if $XPM; 
  }
}

my $CAPI = defined $ExtUtils::MakeMaker::CAPI_support;
my $DEFINES = '';
$DEFINES    .= ' -DHAVE_JPEG'    if $JPEG;
$DEFINES    .= ' -DHAVE_FT'      if $FT;
$DEFINES    .= ' -DHAVE_XPM'     if $XPM;
$DEFINES    .= ' -DHAVE_GIF'     if $GIF;
$DEFINES    .= ' -DHAVE_PNG'     if $PNG;
$DEFINES    .= ' -DFCGI'         if $FCGI;
$DEFINES    .= ' -DHAVE_ANIMGIF' if $ANIMGIF;
$DEFINES    .= ' -DVERSION_33'   if $VERSION_33;
$DEFINES    .= ' -DHAVE_UNCLOSEDPOLY' if $UNCLOSEDPOLY;
$DEFINES    .= ' -DHAVE_FONTCONFIG'   if $FONTCONFIG;
$DEFINES    .= ' -DHAVE_FTCIRCLE'  if $FTCIRCLE;
open F,">.config.cache";
print F $DEFINES,"\n";
close F;

WriteMakefile(
    'NAME'	=> 'GD',
    'VERSION_FROM'	=> 'GD.pm',
    'PREREQ_PM' => {
		    'Math::Trig' => 0,
		    },
    'PM'        => { 'GD.pm' => '$(INST_LIBDIR)/GD.pm',
                     'GD/Polyline.pm' => '$(INST_LIBDIR)/GD/Polyline.pm',
                     'GD/Polygon.pm' => '$(INST_LIBDIR)/GD/Polygon.pm',
                     'GD/Simple.pm' => '$(INST_LIBDIR)/GD/Simple.pm',
                     'GD/Image.pm' => '$(INST_LIBDIR)/GD/Image.pm',
                     'qd.pl' => '$(INST_LIBDIR)/qd.pl'},
    'dist'      => {'COMPRESS'=>'gzip -9f', 'SUFFIX' => 'gz',
	            'ZIP'=>'/usr/bin/zip','ZIPFLAGS'=>'-rl'},
    'LIBS'      => [join(' ',$ENV{'GD_LIBS'},@LIBPATH,@LIBS)],
    'INC'       => join(' ',$ENV{'GD_INC'},@INC),
    'PL_FILES'  => {'bdf_scripts/bdf2gdfont.PLS' => 'bdf_scripts/bdf2gdfont.pl',
		    'GD/Image.pm.PLS' => 'GD/Image.pm',
		   },
#    'CFLAGS'    => '-nostdinclude',
    'EXE_FILES' => ['bdf_scripts/bdf2gdfont.pl'],
    'AUTHOR'    => 'Lincoln Stein (lstein@cshl.org)',
    'ABSTRACT'  => 'Interface to Gd Graphics Library',
     $CAPI ? ('CAPI'      => 'TRUE') : (),
    'DEFINE'	=> $DEFINES,
);

exit 0;

sub try_to_autoconfigure {
  my ($options,$lib_gd_path,$INC,$LIBPATH,$LIBS) = @_;
  my $config = `gdlib-config --all`;
  return unless $config;
  $AUTOCONFIG++;

  my ($version) = $config =~ /^GD library\s+(\S+)/m;
  warn "Configuring for libgd version $version.\n";

  my ($cflags)     = $config =~ /^cflags:\s+(.+)/m;
  my ($ldflags)    = $config =~ /^ldflags:\s+(.+)/m;
  my ($libs)       = $config =~ /^libs:\s+(.+)/m;
  my ($libdir)     = $config =~ /^libdir:\s+(.+)/m;
  my ($features)   = $config =~ /^features:\s+(.+)/m;
  my ($includedir) = $config =~ /^includedir:\s+(.+)/m;

  @$INC          = map {s/^-I// && "-I$_"} split /\s+/,$cflags;
  @$LIBPATH      = map {s/^-L// && "-L$_"} split /\s+/,$ldflags;
  @$LIBS         = split /\s+/,$libs;

  push @$LIBS,"-lgd";
  push @$LIBPATH,"-L$libdir";
  ($$lib_gd_path = $libdir) =~ s!/[^/]+$!!;
  $$options      = $features;

  my ($minor)    = $version =~ /^2\.\d+\.(\d+)$/;
  $$options     .= " GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33" if defined($minor) && $minor >= 33;

  my @correct_inc = map {s/^-I// && $_} split /\s+/,$cflags;
  check_for_stray_headers(@correct_inc);
  return 1;
}

sub check_for_stray_headers {
  my @official_libraries = @_;
  my %official_libraries = map {$_=>1} @official_libraries;
  print STDERR "Checking for stray libgd header files...";
  my $cc          = $Config{'cc'};
  my $data        = `$cc -print-search-dirs`;
  $data         ||= '';
  my ($libraries)    = $data =~ /^libraries: =(.+)/m;
  my @cc_libs        = split /:/,$libraries;
  foreach (@cc_libs) { s/\/$//; }

  my %libraries   = map {$_=>1} (@cc_libs,'/include','/usr/include',
				 '/usr/local/include','/opt/include',
				 '/usr/X11R6/include');
  my $problems;
  foreach (keys %libraries) {

    s/\blib\b/include/;
    next if $official_libraries{$_};
    next unless -e "$_/gd.h";

    warn "\n\n** WARNING: found gd.h header file in ${_}gd.h, but it is expected at $official_libraries[0]/gd.h. This may cause compile errors! **\n";
    $problems++;
  }
  print STDERR $problems ? "** Possible problems found **\n" : "none found.\n";
  print STDERR "\n";
}

sub MY::postamble {
    my $postamble = <<'END';
html: GD.pm
	pod2html --outfile=GD.html GD.pm

END
    $postamble;
}
Pretty nuts for a simple utility, but I hate giving up. Still, I'll let it smolder for a bit -- mobi2oeb got me a text file that I can whip into shape. Alas, the book I fed it doesn't seem to have any styles or anything so I can't tell if it italicizes, etc. if the original book was italicized, etc.

Last edited by Buran; 03-24-2009 at 04:11 PM.
Buran is offline   Reply With Quote
Old 03-24-2009, 06:16 PM   #713
pilotbob
Grand Sorcerer
pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.pilotbob ought to be getting tired of karma fortunes by now.
 
pilotbob's Avatar
 
Posts: 19,832
Karma: 11844413
Join Date: Jan 2007
Location: Tampa, FL USA
Device: Kindle Touch
Quote:
Originally Posted by pdurrant View Post
so I'm working with the visual guide in the wiki to make sure that it's accurate.

So far I've found that the jpeglib instructions aren't complete, and it's a slow process checking things.
Great to hear. When I did it I mostly stole it the steps from another web site. However, the steps I posted did work as published on my 10.5.5 (at the time) system.

BOb
pilotbob is offline   Reply With Quote
Old 03-24-2009, 06:31 PM   #714
Buran
Geek
Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.Buran ought to be getting tired of karma fortunes by now.
 
Buran's Avatar
 
Posts: 190
Karma: 471136
Join Date: Mar 2009
Location: Brentwood, MO
Device: Kindle Oasis Waterproof 32GB 3G (without offers)
Hopefully new steps can be worked out to make it work on 10.5.7. I'm not sure what they changed, but I'm not the only one pulling my hair out trying to get the GD module to work as I've seen complaints from people trying to install Bugzilla and other things that require it.

Thanks, everyone, for all the quick responses, by the way! I'm impressed and appreciate it greatly.
Buran is offline   Reply With Quote
Old 04-04-2009, 11:26 PM   #715
windrose
Junior Member
windrose began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Apr 2009
Device: none
hi, I installed mobiperl 0.0.41 on my slam64(an unofficial 64bit slackware based distro) which works just fine with English text files.

But when I try to convert utf-8 encoded Chinese html files into mobi format with html2mobi, the Chinese characters are converted into unreadable ascii characters. I checked html2mobi options but found nothing to solve this problem.

Any advice? Thanks in advance.
windrose is offline   Reply With Quote
Old 04-05-2009, 07:38 PM   #716
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Quote:
Originally Posted by windrose View Post
hi, I installed mobiperl 0.0.41 on my slam64(an unofficial 64bit slackware based distro) which works just fine with English text files.

But when I try to convert utf-8 encoded Chinese html files into mobi format with html2mobi, the Chinese characters are converted into unreadable ascii characters. I checked html2mobi options but found nothing to solve this problem.

Any advice? Thanks in advance.
I thought that this should work but I have to admit that the utf-8 character encoding is not tested so much. I checked the code now and it seems that utf-8 is not supported. What you can try is in MobiHeader.pm to change the CODEPAGE value from 1252 to 65001.

I think the converter in Caibre have better support for utf-8 so you might want to try this instead. You can also run mobigen either using the Linux version or running the Windows version using Wine.
tompe is offline   Reply With Quote
Old 04-06-2009, 03:34 AM   #717
windrose
Junior Member
windrose began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Apr 2009
Device: none
Quote:
Originally Posted by tompe View Post
I thought that this should work but I have to admit that the utf-8 character encoding is not tested so much. I checked the code now and it seems that utf-8 is not supported. What you can try is in MobiHeader.pm to change the CODEPAGE value from 1252 to 65001.
Thanks Tom. I changed the CODEPAGE value in MobiHeader.pm to 65001 but it didn't help.
windrose is offline   Reply With Quote
Old 04-06-2009, 06:35 AM   #718
tompe
Grand Sorcerer
tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.tompe ought to be getting tired of karma fortunes by now.
 
Posts: 7,452
Karma: 7185064
Join Date: Oct 2007
Location: Linköpng, Sweden
Device: Kindle Voyage, Nexus 5, Kindle PW
Quote:
Originally Posted by windrose View Post
Thanks Tom. I changed the CODEPAGE value in MobiHeader.pm to 65001 but it didn't help.
Can you send me or point me to an example file?
tompe is offline   Reply With Quote
Old 04-06-2009, 11:16 PM   #719
windrose
Junior Member
windrose began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Apr 2009
Device: none
I get the text file from project gutenberg and convert it to html file with txt2html. Here's an example you can try for yourself: http://www.gutenberg.org/files/24041/24041-0.txt
windrose is offline   Reply With Quote
Old 04-07-2009, 10:24 AM   #720
samhain
Junior Member
samhain began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Apr 2009
Device: kindle
Hello,

After having fun getting the tools setup on Mac OSX Leopard I have got html2mobi working successfully.

I am now trying to use mobi2mobi to add title and author information to a mobi file and I receive the following error:

substr outside of string at /usr/local/lib/perl5/site_perl/5.8.6//MobiPerl/MobiHeader.pm line 750.

If anyone has any ideas that could help it would be much appreciated.

Thanks

- Steven
samhain is offline   Reply With Quote
Reply

Tags
mobi2mobi, mobils


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mobi2Mobi Mobi2Mobi v0.13 - GUI for Mobiperl tools Jad Kindle Formats 476 03-15-2015 05:51 PM
Tools for Editing Kindle .mobi Files? GJN Kindle Formats 33 12-26-2013 02:05 PM
Handy Perl Script to convert HTML0 files to smartquotes maggotb0y Sony Reader 0 04-12-2007 11:49 AM
PRS-500 Perl tools to generate Reader content TadW Sony Reader Dev Corner 0 01-08-2007 05:55 AM
gmail copy (gmcp) - Perl script to copy files to/from Gmail Colin Dunstan Lounge 0 09-04-2004 01:24 PM


All times are GMT -4. The time now is 09:39 PM.


MobileRead.com is a privately owned, operated and funded community.