Skip to content

Commit

Permalink
Merge pull request #30 from zdenop/master
Browse files Browse the repository at this point in the history
autotool, VC++ 2008 solution, version info
  • Loading branch information
agl committed Jul 3, 2012
2 parents 863a79a + f24661a commit dde5750
Show file tree
Hide file tree
Showing 30 changed files with 808 additions and 85 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
autom4te*
test*
*.o
*.a
Debug*
Release*
*.suo
*.ncb
*.user
*.patch
*.png
*.jpg
*.jb2
*.tiff
*.tif
*.exe
.hg*
*m4*
config.*
configure
install-sh
*.in
missing
ltmain.sh
9 changes: 9 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Author:
=======
Adam Langley <[email protected]>

Contributors:
=============
Misty De Meo <[email protected]>
zdenop <[email protected]>
Steven Lee http://www.rubypdf.com
18 changes: 18 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
See also doc/PATENTS.

Copyright 2006 Google Inc. All Rights Reserved.
Author: [email protected] (Adam Langley)

Copyright (C) 2006 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
40 changes: 40 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
0.28: (not yet released)
* Update to the latest Leptonica (1.68)
* autotools support, VC++ 2008 solution
* fix binary file open mode on Windows
* version info (-V --version)
* pdf.py now correctly retains DPI from input images (thanks to Steven Lee
http://blog.rubypdf.com/2011/09/09/jbig2-pdf-py-patch-the-right-way-to-get-dpi/)

0.27:
* Update to the latest Leptonica (1.58)
* Fix comments in pdf.py (thanks Dan)

0.26:
* Update to the latest Leptonica (1.53)

0.25:
* Should build on Windows if you get a leptonica which does so (thanks to
Dwight Kelly and a man known only as Dennis)

0.24:
* Update to leptonica 1.38
* Add ability to gray symbols but it's commented out because it does little
good
* Refinement support broke because of memory savings in leptonica

0.23:
* Quick release to support leptonica 1.37 (now bundled)

0.22:
* Added segmentation support to extract text from mixed images
* Flyspeck removal disabled for now
* A few minor fixes

0.21:
* Patch from Alberto Accomazzi to fix the pdf.py script and to output more
sensible filenames in pdf mode
* Symbols which are only used once are now included in a per-page dictionary
(great for scans of old books)
* Fixed several scale bugs (one at 65K symbols and one at 100K symbols)
* Page numbers > 256 went wrong
27 changes: 27 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
First, read the file PATENTS in the same directory as this file.

Fetch leptonica from its website (http://leptonica.com/) and build it.
For this you will also need the standard libtiff, libpng and libjpeg.

If you're running a Unix-like OS, such as Linux, BSD, Mac OS X or msys
just run:

./autogen.sh
./configure
make
make install (or sudo make install)


VC++ 2008 Notes
===============

Download leptonica-1.68-win32-lib-include-dirs.zip from
http://leptonica.com/download.html and unpack it so 'include', 'lib' and
'jbig2enc' directories are at the same directory (or adjust include path
in VC++ project).

Download stdint.h for Microsoft Visual Studio (part of package
msinttypes-r26.zip from http://code.google.com/p/msinttypes/downloads/list)
and place it to 'include' directory.

Them open vs2008/jbig2enc.sln in Visual C++ 2008 and build solution.
1 change: 0 additions & 1 deletion LEPTONICA_VERSION

This file was deleted.

21 changes: 0 additions & 21 deletions Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src doc
dist_bin_SCRIPTS = pdf.py
dist_doc_DATA = AUTHORS ChangeLog COPYING INSTALL NEWS README
EXTRA_DIST = autogen.sh
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See Changelog
5 changes: 0 additions & 5 deletions PATENTS

This file was deleted.

52 changes: 9 additions & 43 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,28 @@ better compression than G4. This encoder can:
* Compress multipage documents

It uses the (Apache-ish licensed) Leptonica library:
http://www.leptonica.com/
http://leptonica.com/

You'll need version 1.68 - which is included with the distribution tarball.
You'll need version 1.68.

KNOWN BUGS:

The refinement coding causes Acrobat to crash. It's not known if this is a bug
in Acrobat, though it may well be.

BUILDING:

First, read the file PATENTS in the same directory as this file.

Fetch leptonica from its website and build it. For this you will also
need the standard libtiff, libpng and libjpeg.

If leptonica was unpacked in ../leptonlib-1.68/ you should just be able to type
make. Otherwise, fix up the path at the beginning of the Makefile first.

USAGE:

See the jbig2enc.h header for the high level API, or the jbig2 program for an
example of usage. It's very short and most of it is taken up with argument
parsing.

CHANGES:

0.27:
* Update to the latest Leptonica (1.58)
* Fix comments in pdf.py (thanks Dan)

0.26:
* Update to the latest Leptonica (1.53)
example of usage:

0.25:
* Should build on Windows if you get a leptonica which does so (thanks to
Dwight Kelly and a man known only as Dennis)
$ jbig2 -s -p -v *.jpg && pdf.py output >out.pdf

0.24:
* Update to leptonica 1.38
* Add ability to gray symbols but it's commented out because it does little
good
* Refinement support broke because of memory savings in leptonica
to encode jbig2 files for pdf creation.
If you want to encode an image and then view output first to include in pdf

0.23:
* Quick release to support leptonica 1.37 (now bundled)
$ jbig2 -s -S -p -v -O out.png *.jpg

0.22:
* Added segmentation support to extract text from mixed images
* Flyspeck removal disabled for now
* A few minor fixes
If you want to encode an image as jbig2 (can be view in STDU Viewer) run:

0.21:
* Patch from Alberto Accomazzi to fix the pdf.py script and to output more
sensible filenames in pdf mode
* Symbols which are only used once are now included in a per-page dictionary
(great for scans of old books)
* Fixed several scale bugs (one at 65K symbols and one at 100K symbols)
* Page numbers > 256 went wrong
$ jbig2 -s feyn.tif >feyn.jb2
72 changes: 72 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/sh

# This is a simple script which is meant to help developers
# better deal with the GNU autotools, specifically:
#
# aclocal
# autoconf
# automake
#
# The whole thing is quite complex...
#
# The idea is to run this collection of tools on a single platform,
# typically the main development platform, running a recent version of
# autoconf. In theory, if we had these tools on each platform where we
# ever expected to port the software, we would never need to checkin
# more than a few autotools configuration files. However, the whole
# idea is to generate a configure script and associated files in a way
# that is portable across platforms, so we *have* to check in a whole
# bunch of files generated by all these tools.

# The real source files are:
#
# acinclude.m4 (used by aclocal)
# configure.ac (main autoconf file)
# Makefile.am, */Makefile.am (automake config files)
#
# All the rest is auto-generated.

# create m4 directory if it not exists
if [ ! -d m4 ]; then
mkdir m4
fi

bail_out()
{
echo
echo " Something went wrong, bailing out!"
echo
exit 1
}

# --- Step 1: Generate aclocal.m4

echo "Running aclocal"
aclocal || bail_out

# --- Step 2:

echo "Running libtoolize"
libtoolize -f -c || glibtoolize -f -c || bail_out
libtoolize --automake || glibtoolize --automake || bail_out

# --- Step 3: Generate Makefile.in,
# Using --add-missing --copy makes sure that, if these files are missing,
# they are copied from the system so they can be used in a distribution.

echo "Running automake --add-missing --copy"
automake --add-missing -c > /dev/null || bail_out

# --- Step 4: Generate configure from:
# . configure.ac
#

echo "Running autoconf"
autoconf || bail_out

echo ""
echo "All done."
echo "To build the software now, do something like:"
echo ""
echo "$ ./configure [...other options]"
echo "$ make"
80 changes: 80 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
AC_PREREQ(2.50)
AC_INIT([jbig2enc], [0.28], [[email protected]], [jbig2enc-0.28],
[https://github.com/agl/jbig2enc])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign no-dependencies])
AC_PROG_CXX
AC_PROG_LIBTOOL

# Release versioning
GENERIC_MAJOR_VERSION=0
GENERIC_MINOR_VERSION=28
GENERIC_MICRO_VERSION=0

# API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION)
GENERIC_API_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
GENERIC_LIBRARY_VERSION=$GENERIC_MAJOR_VERSION:$GENERIC_MINOR_VERSION
AC_SUBST(GENERIC_API_VERSION)
AC_SUBST(GENERIC_MAJOR_VERSION)

AC_SUBST(GENERIC_LIBRARY_VERSION)
PACKAGE=$GENERIC_LIBRARY_NAME
AC_SUBST(GENERIC_LIBRARY_NAME)

GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
AC_SUBST(GENERIC_RELEASE)
AC_SUBST(GENERIC_VERSION)

# this should fix automake 1.12 build and compatible with automake 1.11
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

# default conditional
AM_CONDITIONAL(MINGW, false)

#############################
#
# Platform specific setup
#
#############################
AC_CANONICAL_HOST
case $host_os in
mingw32*)
AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
AM_CONDITIONAL(MINGW, true)
;;
*)
# default
;;
esac

AC_CHECK_LIB([lept], [findFileFormatStream], [], [
echo "Error! Leptonica not detected."
exit -1
])
AC_CHECK_LIB([tiff], [TIFFGetVersion], [], [
echo "Error! libtiff not detected."
exit -1
])
AC_CHECK_LIB([jpeg], [jpeg_set_defaults], [], [
echo "Error! libjpeg not detected."
exit -1
])
AC_CHECK_LIB([png], [png_get_io_ptr], [], [
echo "Error! libpng not detected."
exit -1
])
AC_CHECK_LIB([z], [zlibVersion], [], [
echo "Error! zlib not detected."
exit -1
])
AC_CHECK_LIB([m], [sqrt], [], [
echo "Error! libm not detected."
exit -1
])
AC_CONFIG_FILES([
Makefile
src/Makefile
doc/Makefile
])
AC_OUTPUT
1 change: 1 addition & 0 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist_doc_DATA = PATENTS jbig2enc.html
Loading

0 comments on commit dde5750

Please sign in to comment.