Skip to content

Commit

Permalink
implement autotools and directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Jul 2, 2012
1 parent 863a79a commit d2b0bf4
Show file tree
Hide file tree
Showing 25 changed files with 277 additions and 73 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
5 changes: 5 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Adam Langley <[email protected]>

Contributors:
Misty De Meo <[email protected]>
zdenop <[email protected]>
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.
37 changes: 37 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
0.28: (not yet released)
* Update to the latest Leptonica (1.68)
* pdf.py now correctly retains DPI from input images (thanks to RubyPDF)
* autotools support

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
12 changes: 12 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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)
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
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
66 changes: 66 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/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.

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

# --- Step 1: Generate aclocal.m4

echo "Running aclocal"
aclocal || bail_out


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

# --- Step 2: 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 3: 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
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
AM_CXXFLAGS = -Wall

lib_LTLIBRARIES = libjbig2enc.la
libjbig2enc_la_SOURCES = jbig2enc.cc jbig2arith.cc jbig2sym.cc
include_HEADERS = jbig2arith.h jbig2sym.h jbig2structs.h jbig2segments.h

bin_PROGRAMS = jbig2
jbig2_SOURCES = jbig2.cc
jbig2_LDADD = libjbig2enc.la
jbig2_LDFLAGS = -all-static

if MINGW
jbig2_LDADD += -lws2_32
endif
5 changes: 2 additions & 3 deletions jbig2.cc → src/jbig2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#include <string.h>
#include <unistd.h>

#include <allheaders.h>
#include <pix.h>
#include <leptonica/allheaders.h>

#include "jbig2enc.h"

Expand Down Expand Up @@ -68,7 +67,7 @@ pixInfo(PIX *pix, const char *msg) {
pix->w, pix->h, pix->d, pix->xres, pix->yres, pix->refcount);
}

#ifdef _MSC_VER
#ifdef WIN32
// -----------------------------------------------------------------------------
// Windows, sadly, lacks asprintf
// -----------------------------------------------------------------------------
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d2b0bf4

Please sign in to comment.