Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implement autotools and directory structure

  • Loading branch information...
commit d2b0bf4647f193c10a599e36f1f9620fa5e4514a 1 parent 863a79a
@zdenop zdenop authored
View
24 .gitignore
@@ -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
View
5 AUTHORS
@@ -0,0 +1,5 @@
+Adam Langley <agl@imperialviolet.org>
+
+Contributors:
+Misty De Meo <mistydemeo@gmail.com>
+zdenop <zdenop@gmail.com>
View
18 COPYING
@@ -0,0 +1,18 @@
+See also doc/PATENTS.
+
+Copyright 2006 Google Inc. All Rights Reserved.
+Author: agl@imperialviolet.org (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.
View
37 ChangeLog
@@ -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
View
12 INSTALL
@@ -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)
View
1  LEPTONICA_VERSION
@@ -1 +0,0 @@
-1.68
View
21 Makefile
@@ -1,21 +0,0 @@
-CC=g++
-LEPTONICA=../leptonica-1.68
-# For example, a fink MacOSX install:
-# EXTRA=-I/sw/include/ -I/sw/include/libpng -I/sw/include/libjpeg -L/sw/lib
-CFLAGS=-I${LEPTONICA}/src -Wall -I/usr/include -L/usr/lib -O3 ${EXTRA}
-
-jbig2: libjbig2enc.a jbig2.cc
- $(CC) -o jbig2 jbig2.cc -L. -ljbig2enc ${LEPTONICA}/src/.libs/liblept.a $(CFLAGS) -lpng -ljpeg -ltiff -lm -lz
-
-libjbig2enc.a: jbig2enc.o jbig2arith.o jbig2sym.o
- ar -rcv libjbig2enc.a jbig2enc.o jbig2arith.o jbig2sym.o
-
-jbig2enc.o: jbig2enc.cc jbig2arith.h jbig2sym.h jbig2structs.h jbig2segments.h
- $(CC) -c jbig2enc.cc $(CFLAGS)
-jbig2arith.o: jbig2arith.cc jbig2arith.h
- $(CC) -c jbig2arith.cc $(CFLAGS)
-jbig2sym.o: jbig2sym.cc jbig2arith.h
- $(CC) -c jbig2sym.cc -DUSE_EXT $(CFLAGS)
-
-clean:
- rm -f *.o jbig2 libjbig2enc.a
View
5 Makefile.am
@@ -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
View
1  NEWS
@@ -0,0 +1 @@
+See Changelog
View
52 README
@@ -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
View
66 autogen.sh
@@ -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"
View
80 configure.ac
@@ -0,0 +1,80 @@
+AC_PREREQ(2.50)
+AC_INIT([jbig2enc], [0.28], [agl@imperialviolet.org], [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
View
1  doc/Makefile.am
@@ -0,0 +1 @@
+dist_doc_DATA = PATENTS jbig2enc.html
View
0  PATENTS → doc/PATENTS
File renamed without changes
View
0  jbig2enc.html → doc/jbig2enc.html
File renamed without changes
View
14 src/Makefile.am
@@ -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
View
5 jbig2.cc → src/jbig2.cc
@@ -24,8 +24,7 @@
#include <string.h>
#include <unistd.h>
-#include <allheaders.h>
-#include <pix.h>
+#include <leptonica/allheaders.h>
#include "jbig2enc.h"
@@ -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
// -----------------------------------------------------------------------------
View
0  jbig2arith.cc → src/jbig2arith.cc
File renamed without changes
View
0  jbig2arith.h → src/jbig2arith.h
File renamed without changes
View
3  jbig2enc.cc → src/jbig2enc.cc
@@ -22,8 +22,7 @@
#include <stdio.h>
#include <string.h>
-#include <allheaders.h>
-#include <pix.h>
+#include <leptonica/allheaders.h>
#include <math.h>
#if defined(sun)
View
0  jbig2enc.h → src/jbig2enc.h
File renamed without changes
View
2  jbig2segments.h → src/jbig2segments.h
@@ -19,7 +19,7 @@
#define THIRD_PARTY_JBIG2ENC_JBIG2SEGMENTS_H__
#include <vector>
-#ifdef _MSC_VER
+#ifdef WIN32
#include <winsock2.h>
#else
#include <netinet/in.h>
View
0  jbig2structs.h → src/jbig2structs.h
File renamed without changes
View
3  jbig2sym.cc → src/jbig2sym.cc
@@ -28,8 +28,7 @@
#include <stdio.h>
-#include <allheaders.h>
-#include <pix.h>
+#include <leptonica/allheaders.h>
#include <math.h>
View
0  jbig2sym.h → src/jbig2sym.h
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.