[ocrfeeder: 2/3] Added autotools



commit ad62e880fa94434d20147097b2c9a35d782dba7b
Author: Joaquim Rocha <jrocha igalia com>
Date:   Sat Jan 1 17:15:10 2011 +0100

    Added autotools
    
    Now the build is managed by autotools

 ChangeLog                                          |    1 +
 Makefile                                           |   59 --
 Makefile.am                                        |    3 +
 autogen.sh                                         |   21 +
 bin/Makefile.am                                    |    6 +
 ocrfeeder-cli => bin/ocrfeeder-cli.in              |    6 +-
 ocrfeeder => bin/ocrfeeder.in                      |    6 +-
 configure.ac                                       |   55 ++
 gnome-doc-utils.make                               |  655 ++++++++++++++++++++
 help/Makefile.am                                   |   24 +
 m4/.gitignore                                      |    1 +
 resources/Makefile.am                              |   15 +
 resources/icons/Makefile.am                        |    8 +
 src/Makefile.am                                    |    1 +
 src/ocrfeeder/Makefile.am                          |   13 +
 src/ocrfeeder/feeder/Makefile.am                   |   11 +
 src/ocrfeeder/odf/Makefile.am                      |   37 ++
 src/ocrfeeder/studio/Makefile.am                   |   13 +
 src/ocrfeeder/util/Makefile.am                     |   13 +
 .../util/{constants.py => constants.py.in}         |   11 +-
 20 files changed, 893 insertions(+), 66 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..8ba3ad0
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1 @@
+git log
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..db6f580
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,3 @@
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+
+SUBDIRS = src resources po bin help
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..9bebbb0
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Calls gnome-autogen to build Makefiles and run configure
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+PKG_NAME="ocrfeeder"
+
+(test -f $srcdir/configure.ac) || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level $PKG_NAME directory"
+    exit 1
+}
+
+which gnome-autogen.sh || {
+    echo "You need to install gnome-common module and make"
+    echo "sure the gnome-autogen.sh script is in your \$PATH."
+    exit 1
+}
+
+USE_GNOME2_MACROS=1 . gnome-autogen.sh
diff --git a/bin/Makefile.am b/bin/Makefile.am
new file mode 100644
index 0000000..ef56261
--- /dev/null
+++ b/bin/Makefile.am
@@ -0,0 +1,6 @@
+bin_SCRIPTS = ocrfeeder ocrfeeder-cli
+
+CLEANFILES = ocrfeeder ocrfeeder-cli
+
+all: $(bin_SCRIPTS)
+	@chmod +x $(bin_SCRIPTS)
diff --git a/ocrfeeder-cli b/bin/ocrfeeder-cli.in
old mode 100755
new mode 100644
similarity index 94%
rename from ocrfeeder-cli
rename to bin/ocrfeeder-cli.in
index 9570149..90b7c2b
--- a/ocrfeeder-cli
+++ b/bin/ocrfeeder-cli.in
@@ -21,9 +21,13 @@
 
 import sys
 import os
-local_src = os.path.dirname(os.path.abspath(__file__)) + '/src'
+local_src = os.path.dirname(os.path.abspath(__file__)) + '../src'
 if os.path.exists(local_src):
     sys.path = [local_src] + sys.path
+installed_src = os.path.join('@prefix@', 'lib', 'python PYTHON_VERSION@',
+                             'site-packages')
+if os.path.exists(installed_src):
+    sys.path.insert(1, installed_src)
 
 import Image
 from ocrfeeder.util.constants import OCRFEEDER_STUDIO_VERSION
diff --git a/ocrfeeder b/bin/ocrfeeder.in
old mode 100755
new mode 100644
similarity index 81%
rename from ocrfeeder
rename to bin/ocrfeeder.in
index 90a8868..dd335fd
--- a/ocrfeeder
+++ b/bin/ocrfeeder.in
@@ -20,9 +20,13 @@
 
 import sys
 import os
-local_src = os.path.dirname(os.path.abspath(__file__)) + '/src'
+local_src = os.path.dirname(os.path.abspath(__file__)) + '../src'
 if os.path.exists(local_src):
     sys.path = [local_src] + sys.path
+installed_src = os.path.join('@prefix@', 'lib', 'python PYTHON_VERSION@',
+                             'site-packages')
+if os.path.exists(installed_src):
+    sys.path.insert(1, installed_src)
 
 from ocrfeeder.studio.studioBuilder import Studio
 
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..ab62811
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,55 @@
+AC_PREREQ([2.63])
+AC_INIT([ocrfeeder],
+        [0.7.1a],
+        [https://bugzilla.gnome.org/enter_bug.cgi?product=ocrfeeder],
+        [ocrfeeder])
+
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE([1.11])
+AM_MAINTAINER_MODE([enable])
+# Support silent build rules. Disable by either passing --disable-silent-rules
+# to configure or passing V=1 to make
+AM_SILENT_RULES([yes])
+
+dnl == check for python ==
+AM_PATH_PYTHON(2.5)
+
+dnl == Library dependencies ==
+PYGTK_REQUIRED=2.16
+
+PKG_CHECK_MODULES(OCRFEEDER, [
+  pygtk-2.0     >= $PYGTK_REQUIRED])
+AC_SUBST(OCRFEEDER_CFLAGS)
+AC_SUBST(OCRFEEDER_LIBS)
+
+dnl == i18n ==
+GETTEXT_PACKAGE=ocrfeeder
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The gettext package])
+AM_GLIB_GNU_GETTEXT
+
+dnl == intltool check ==
+IT_PROG_INTLTOOL([0.35.0])
+
+dnl == Documentation ==
+GNOME_DOC_INIT
+
+dnl == generate makefiles ==
+AC_OUTPUT([
+Makefile
+po/Makefile.in
+bin/Makefile
+bin/ocrfeeder
+bin/ocrfeeder-cli
+src/Makefile
+src/ocrfeeder/Makefile
+src/ocrfeeder/feeder/Makefile
+src/ocrfeeder/odf/Makefile
+src/ocrfeeder/studio/Makefile
+src/ocrfeeder/util/Makefile
+src/ocrfeeder/util/constants.py
+help/Makefile
+resources/Makefile
+resources/icons/Makefile
+])
diff --git a/gnome-doc-utils.make b/gnome-doc-utils.make
new file mode 100644
index 0000000..97fd549
--- /dev/null
+++ b/gnome-doc-utils.make
@@ -0,0 +1,655 @@
+# gnome-doc-utils.make - make magic for building documentation
+# Copyright (C) 2004-2005 Shaun McCance <shaunm gnome org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+################################################################################
+## @@ Generating Header Files
+
+## @ DOC_H_FILE
+## The name of the header file to generate
+DOC_H_FILE ?=
+
+## @ DOC_H_DOCS
+## The input DocBook files for generating the header file
+DOC_H_DOCS ?=
+
+$(DOC_H_FILE): $(DOC_H_DOCS);
+	@rm -f $  tmp; touch $  tmp;
+	echo 'const gchar* documentation_credits[] = {' >> $  tmp
+	list='$(DOC_H_DOCS)'; for doc in $$list; do \
+	  xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
+	  if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
+	  xsltproc --path "$$xmlpath" $(_credits) $$doc; \
+	done | sort | uniq \
+	  | awk 'BEGIN{s=""}{n=split($$0,w,"<");if(s!=""&&s!=substr(w[1],1,length(w[1])-1)){print s};if(n>1){print $$0;s=""}else{s=$$0}};END{if(s!=""){print s}}' \
+	  | sed -e 's/\\/\\\\/' -e 's/"/\\"/' -e 's/\(.*\)/\t"\1",/' >> $  tmp
+	echo '	NULL' >> $  tmp
+	echo '};' >> $  tmp
+	echo >> $  tmp
+	list='$(DOC_H_DOCS)'; for doc in $$list; do \
+	  xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
+	  if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
+	  docid=`echo "$$doc" | sed -e 's/.*\/\([^/]*\)\.xml/\1/' \
+	    | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`; \
+	  echo $$xmlpath; \
+	  ids=`xsltproc --xinclude --path "$$xmlpath" $(_ids) $$doc`; \
+	  for id in $$ids; do \
+	    echo '#define HELP_'`echo $$docid`'_'`echo $$id \
+	      | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`' "'$$id'"' >> $  tmp; \
+	  done; \
+	  echo >> $  tmp; \
+	done;
+	cp $  tmp $@ && rm -f $  tmp
+
+dist-check-gdu:
+if !HAVE_GNOME_DOC_UTILS
+	@echo "*** GNOME Doc Utils must be installed in order to make dist"
+	@false
+endif
+
+.PHONY: dist-doc-header
+dist-doc-header: $(DOC_H_FILE)
+	@if test -f "$(DOC_H_FILE)"; then d=; else d="$(srcdir)/"; fi; \
+	echo "$(INSTALL_DATA) $${d}$(DOC_H_FILE) $(distdir)/$(DOC_H_FILE)"; \
+	$(INSTALL_DATA) "$${d}$(DOC_H_FILE)" "$(distdir)/$(DOC_H_FILE)";
+
+doc-dist-hook: dist-check-gdu $(if $(DOC_H_FILE),dist-doc-header)
+
+.PHONY: clean-doc-header
+_clean_doc_header = $(if $(DOC_H_FILE),clean-doc-header)
+clean-local: $(_clean_doc_header)
+distclean-local: $(_clean_doc_header)
+mostlyclean-local: $(_clean_doc_header)
+maintainer-clean-local: $(_clean_doc_header)
+clean-doc-header:
+	rm -f $(DOC_H_FILE)
+
+all: $(DOC_H_FILE)
+
+
+################################################################################
+## @@ Generating Documentation Files
+
+## @ DOC_MODULE
+## The name of the document being built
+DOC_MODULE ?=
+
+## @ DOC_ID
+## The unique identifier for a Mallard document
+DOC_ID ?=
+
+## @ DOC_PAGES
+## Page files in a Mallard document
+DOC_PAGES ?=
+
+## @ DOC_ENTITIES
+## Files included with a SYSTEM entity
+DOC_ENTITIES ?=
+
+## @ DOC_INCLUDES
+## Files included with XInclude
+DOC_INCLUDES ?=
+
+## @ DOC_FIGURES
+## Figures and other external data
+DOC_FIGURES ?=
+
+## @ DOC_FORMATS
+## The default formats to be built and installed
+DOC_FORMATS ?= docbook
+_DOC_REAL_FORMATS = $(if $(DOC_USER_FORMATS),$(DOC_USER_FORMATS),$(DOC_FORMATS))
+
+## @ DOC_LINGUAS
+## The languages this document is translated into
+DOC_LINGUAS ?=
+_DOC_REAL_LINGUAS = $(if $(filter environment,$(origin LINGUAS)),		\
+	$(filter $(LINGUAS),$(DOC_LINGUAS)),					\
+	$(DOC_LINGUAS))
+
+_DOC_ABS_SRCDIR = @abs_srcdir@
+
+
+################################################################################
+## Variables for Bootstrapping
+
+_xml2po ?= `which xml2po`
+_xml2po_mode = $(if $(DOC_ID),mallard,docbook)
+
+_db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils`
+_db2omf  ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils`
+_malrng  ?= `$(PKG_CONFIG) --variable malrng gnome-doc-utils`
+_chunks  ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/chunks.xsl
+_credits ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/credits.xsl
+_ids ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/ids.xsl
+
+if ENABLE_SK
+_ENABLE_SK = true
+_skpkgdatadir ?= `scrollkeeper-config --pkgdatadir`
+_sklocalstatedir ?= `scrollkeeper-config --pkglocalstatedir`
+_skcontentslist ?= $(_skpkgdatadir)/Templates/C/scrollkeeper_cl.xml
+endif
+
+
+################################################################################
+## @@ Rules for OMF Files
+
+db2omf_args =									\
+	--stringparam db2omf.basename $(DOC_MODULE)				\
+	--stringparam db2omf.format $(3)					\
+	--stringparam db2omf.dtd						\
+	$(shell xmllint --format $(2) | grep -h PUBLIC | head -n 1 		\
+		| sed -e 's/.*PUBLIC \(\"[^\"]*\"\).*/\1/')			\
+	--stringparam db2omf.lang $(notdir $(patsubst %/$(notdir $(2)),%,$(2)))	\
+	--stringparam db2omf.omf_dir "$(OMF_DIR)"				\
+	--stringparam db2omf.help_dir "$(HELP_DIR)"				\
+	--stringparam db2omf.omf_in "$(_DOC_OMF_IN)"				\
+	$(if $(_ENABLE_SK),							\
+	  --stringparam db2omf.scrollkeeper_cl "$(_skcontentslist)")		\
+	$(_db2omf) $(2)
+
+## @ _DOC_OMF_IN
+## The OMF input file
+_DOC_OMF_IN = $(if $(DOC_MODULE),$(wildcard $(_DOC_ABS_SRCDIR)/$(DOC_MODULE).omf.in))
+
+## @ _DOC_OMF_DB
+## The OMF files for DocBook output
+_DOC_OMF_DB = $(if $(_DOC_OMF_IN),						\
+	$(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-$(lc).omf))
+
+$(_DOC_OMF_DB) : $(_DOC_OMF_IN)
+$(_DOC_OMF_DB) : $(DOC_MODULE)-%.omf : %/$(DOC_MODULE).xml
+	@test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || {	\
+	  echo "The file '$(_skcontentslist)' does not exist." >&2;		\
+	  echo "Please check your ScrollKeeper installation." >&2;		\
+	  exit 1; }
+	xsltproc -o $@ $(call db2omf_args,$@,$<,'docbook') || { rm -f "$@"; exit 1; }
+
+## @ _DOC_OMF_HTML
+## The OMF files for HTML output
+_DOC_OMF_HTML = $(if $(_DOC_OMF_IN),						\
+	$(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-html-$(lc).omf))
+
+$(_DOC_OMF_HTML) : $(_DOC_OMF_IN)
+$(_DOC_OMF_HTML) : $(DOC_MODULE)-html-%.omf : %/$(DOC_MODULE).xml
+if ENABLE_SK
+	@test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || {	\
+	  echo "The file '$(_skcontentslist)' does not exist" >&2;		\
+	  echo "Please check your ScrollKeeper installation." >&2;		\
+	  exit 1; }
+endif
+	xsltproc -o $@ $(call db2omf_args,$@,$<,'xhtml') || { rm -f "$@"; exit 1; }
+
+## @ _DOC_OMF_ALL
+## All OMF output files to be built
+# FIXME
+_DOC_OMF_ALL =									\
+	$(if $(filter docbook,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_DB))		\
+	$(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_HTML))
+
+.PHONY: omf
+omf: $(_DOC_OMF_ALL)
+
+
+################################################################################
+## @@ C Locale Documents
+
+## @ _DOC_C_MODULE
+## The top-level documentation file in the C locale
+_DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml)
+
+## @ _DOC_C_PAGES
+## Page files in a Mallard document in the C locale
+_DOC_C_PAGES = $(foreach page,$(DOC_PAGES),C/$(page))
+
+## @ _DOC_C_ENTITIES
+## Files included with a SYSTEM entity in the C locale
+_DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent))
+
+## @ _DOC_C_XINCLUDES
+## Files included with XInclude in the C locale
+_DOC_C_INCLUDES = $(foreach inc,$(DOC_INCLUDES),C/$(inc))
+
+## @ _DOC_C_DOCS
+## All documentation files in the C locale
+_DOC_C_DOCS =								\
+	$(_DOC_C_ENTITIES)	$(_DOC_C_INCLUDES)			\
+	$(_DOC_C_PAGES)		$(_DOC_C_MODULE)
+
+## @ _DOC_C_DOCS_NOENT
+## All documentation files in the C locale,
+## except files included with a SYSTEM entity
+_DOC_C_DOCS_NOENT =							\
+	$(_DOC_C_MODULE)	$(_DOC_C_INCLUDES)			\
+	$(_DOC_C_PAGES)
+
+## @ _DOC_C_FIGURES
+## All figures and other external data in the C locale
+_DOC_C_FIGURES = $(if $(DOC_FIGURES),					\
+	$(foreach fig,$(DOC_FIGURES),C/$(fig)),				\
+	$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/C/figures/*.png)))
+
+## @ _DOC_C_HTML
+## All HTML documentation in the C locale
+# FIXME: probably have to shell escape to determine the file names
+_DOC_C_HTML = $(foreach f,						\
+	$(shell xsltproc --xinclude 					\
+	  --stringparam db.chunk.basename "$(DOC_MODULE)"		\
+	  $(_chunks) "C/$(DOC_MODULE).xml"),				\
+	C/$(f).xhtml)
+
+###############################################################################
+## @@ Other Locale Documentation
+
+## @ _DOC_POFILES
+## The .po files used for translating the document
+_DOC_POFILES = $(if $(DOC_MODULE)$(DOC_ID),					\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(lc).po))
+
+.PHONY: po
+po: $(_DOC_POFILES)
+
+## @ _DOC_MOFILES
+## The .mo files used for translating the document
+_DOC_MOFILES = $(patsubst %.po,%.mo,$(_DOC_POFILES))
+
+.PHONY: mo
+mo: $(_DOC_MOFILES)
+
+## @ _DOC_LC_MODULES
+## The top-level documentation files in all other locales
+_DOC_LC_MODULES = $(if $(DOC_MODULE),						\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml))
+
+## @ _DOC_LC_PAGES
+## Page files in a Mallard document in all other locales
+_DOC_LC_PAGES =									\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach page,$(_DOC_C_PAGES),	\
+		$(lc)/$(notdir $(page)) ))
+
+## @ _DOC_LC_XINCLUDES
+## Files included with XInclude in all other locales
+_DOC_LC_INCLUDES =								\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach inc,$(_DOC_C_INCLUDES),	\
+		$(lc)/$(notdir $(inc)) ))
+
+## @ _DOC_LC_HTML
+## All HTML documentation in all other locales
+# FIXME: probably have to shell escape to determine the file names
+_DOC_LC_HTML =									\
+	$(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach doc,$(_DOC_C_HTML),		\
+		$(lc)/$(notdir $(doc)) ))
+
+## @ _DOC_LC_DOCS
+## All documentation files in all other locales
+_DOC_LC_DOCS =									\
+	$(_DOC_LC_MODULES)	$(_DOC_LC_INCLUDES)	$(_DOC_LC_PAGES)	\
+	$(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
+
+## @ _DOC_LC_FIGURES
+## All figures and other external data in all other locales
+_DOC_LC_FIGURES = $(foreach lc,$(_DOC_REAL_LINGUAS),				\
+	$(patsubst C/%,$(lc)/%,$(_DOC_C_FIGURES)) )
+
+_DOC_SRC_FIGURES =								\
+	$(foreach fig,$(_DOC_C_FIGURES), $(foreach lc,C $(_DOC_REAL_LINGUAS),	\
+		$(wildcard $(srcdir)/$(lc)/$(patsubst C/%,%,$(fig))) ))
+
+$(_DOC_POFILES):
+	@if ! test -d $(dir $@); then \
+	  echo "mkdir $(dir $@)"; \
+	  mkdir "$(dir $@)"; \
+	fi
+	@if test ! -f $@ -a -f $(srcdir)/$@; then \
+	  echo "cp $(srcdir)/$@ $@"; \
+	  cp "$(srcdir)/$@" "$@"; \
+	fi;
+	@docs=; \
+	list='$(_DOC_C_DOCS_NOENT)'; for doc in $$list; do \
+	  docs="$$docs $(_DOC_ABS_SRCDIR)/$$doc"; \
+	done; \
+	if ! test -f $@; then \
+	  echo "(cd $(dir $@) && \
+	    $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
+	    cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
+	  (cd $(dir $@) && \
+	    $(_xml2po) -m $(_xml2po_mode) -e $$docs > $(notdir $@).tmp && \
+	    cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
+	else \
+	  echo "(cd $(dir $@) && \
+	    $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs)"; \
+	  (cd $(dir $@) && \
+	    $(_xml2po) -m $(_xml2po_mode) -e -u $(notdir $@) $$docs); \
+	fi
+
+$(_DOC_MOFILES): %.mo: %.po
+	@if ! test -d $(dir $@); then \
+	  echo "mkdir $(dir $@)"; \
+	  mkdir "$(dir $@)"; \
+	fi
+	msgfmt -o $@ $<
+
+# FIXME: fix the dependancy
+# FIXME: hook xml2po up
+$(_DOC_LC_DOCS) : $(_DOC_MOFILES)
+$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
+	if ! test -d $(dir $@); then mkdir $(dir $@); fi
+	if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$(_DOC_ABS_SRCDIR)/"; fi; \
+	mo="$(dir $@)$(patsubst %/$(notdir $@),%,$@).mo"; \
+	if [ -f "$${mo}" ]; then mo="../$${mo}"; else mo="$(_DOC_ABS_SRCDIR)/$${mo}"; fi; \
+	(cd $(dir $@) && \
+	  $(_xml2po) -m $(_xml2po_mode) -e -t "$${mo}" \
+	    "$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
+	    cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
+
+## @ _DOC_POT
+## A pot file
+_DOC_POT = $(if $(DOC_MODULE),$(DOC_MODULE).pot)
+.PHONY: pot
+pot: $(_DOC_POT)
+$(_DOC_POT): $(_DOC_C_DOCS_NOENT)
+	$(_xml2po) -m $(_xml2po_mode) -e -o $@ $^
+
+
+################################################################################
+## @@ All Documentation
+
+## @ _DOC_HTML_ALL
+## All HTML documentation, only if it's built
+_DOC_HTML_ALL = $(if $(filter html HTML,$(_DOC_REAL_FORMATS)), \
+	$(_DOC_C_HTML) $(_DOC_LC_HTML))
+
+_DOC_HTML_TOPS = $(foreach lc,C $(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xhtml)
+
+$(_DOC_HTML_TOPS): $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
+	xsltproc -o $@ --xinclude --param db.chunk.chunk_top "false()" --stringparam db.chunk.basename "$(DOC_MODULE)" --stringparam db.chunk.extension ".xhtml" $(_db2html) $(patsubst %.xhtml,%.xml,$@)
+
+
+################################################################################
+## All
+
+all:							\
+	$(_DOC_C_DOCS)		$(_DOC_LC_DOCS)		\
+	$(_DOC_OMF_ALL)		$(_DOC_DSK_ALL)		\
+	$(_DOC_HTML_ALL)	$(_DOC_POFILES)
+
+
+################################################################################
+## Clean
+
+.PHONY: clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir
+
+clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML)
+clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML)
+clean-doc-lc:
+	rm -f $(_DOC_LC_DOCS)
+	rm -f $(_DOC_MOFILES)
+	@list='$(_DOC_POFILES)'; for po in $$list; do \
+	  if ! test "$$po" -ef "$(srcdir)/$$po"; then \
+	    echo "rm -f $$po"; \
+	    rm -f "$$po"; \
+	  fi; \
+	done
+#	.xml2.po.mo cleaning is obsolete as of 0.18.1 and could be removed in 0.20.x
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  if test -f "$$lc/.xml2po.mo"; then \
+	    echo "rm -f $$lc/.xml2po.mo"; \
+	    rm -f "$$lc/.xml2po.mo"; \
+	  fi; \
+	done
+clean-doc-dir: clean-doc-lc
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  for dir in `find $$lc -depth -type d`; do \
+	    if ! test $$dir -ef $(srcdir)/$$dir; then \
+	      echo "rmdir $$dir"; \
+	      rmdir "$$dir"; \
+	   fi; \
+	  done; \
+	done
+
+_clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
+_clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
+_clean_lc  = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc)
+_clean_dir = $(if $(DOC_MODULE)$(DOC_ID),clean-doc-dir)
+
+clean-local:						\
+	$(_clean_omf)		$(_clean_dsk)		\
+	$(_clean_lc)		$(_clean_dir)
+distclean-local:					\
+	$(_clean_omf)		$(_clean_dsk)		\
+	$(_clean_lc)		$(_clean_dir)
+mostlyclean-local:					\
+	$(_clean_omf)		$(_clean_dsk)		\
+	$(_clean_lc)		$(_clean_dir)
+maintainer-clean-local:					\
+	$(_clean_omf)		$(_clean_dsk)		\
+	$(_clean_lc)		$(_clean_dir)
+
+
+
+################################################################################
+## Dist
+
+.PHONY: dist-doc-docs dist-doc-pages dist-doc-figs dist-doc-omf dist-doc-dsk
+doc-dist-hook: 						\
+	$(if $(DOC_MODULE)$(DOC_ID),dist-doc-docs)	\
+	$(if $(_DOC_C_FIGURES),dist-doc-figs)		\
+	$(if $(_DOC_OMF_IN),dist-doc-omf)
+#	$(if $(_DOC_DSK_IN),dist-doc-dsk)
+
+dist-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  echo " $(mkinstalldirs) $(distdir)/$$lc"; \
+	  $(mkinstalldirs) "$(distdir)/$$lc"; \
+	done
+	@list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)'; \
+	for doc in $$list; do \
+	  if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
+	    docdir=`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	    if ! test -d "$(distdir)/$$docdir"; then \
+	      echo "$(mkinstalldirs) $(distdir)/$$docdir"; \
+	      $(mkinstalldirs) "$(distdir)/$$docdir"; \
+	    fi; \
+	  echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
+	  $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
+	done
+
+dist-doc-figs: $(_DOC_SRC_FIGURES)
+	@list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; \
+	for fig in $$list; do \
+	  if test -f "$$fig"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$fig"; then \
+	    figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	    if ! test -d "$(distdir)/$$figdir"; then \
+	      echo "$(mkinstalldirs) $(distdir)/$$figdir"; \
+	      $(mkinstalldirs) "$(distdir)/$$figdir"; \
+	    fi; \
+	    echo "$(INSTALL_DATA) $$d$$fig $(distdir)/$$fig"; \
+	    $(INSTALL_DATA) "$$d$$fig" "$(distdir)/$$fig"; \
+	  fi; \
+	done;
+
+dist-doc-omf:
+	@if test -f "$(_DOC_OMF_IN)"; then d=; else d="$(srcdir)/"; fi; \
+	echo "$(INSTALL_DATA) $$d$(_DOC_OMF_IN) $(distdir)/$(notdir $(_DOC_OMF_IN))"; \
+	$(INSTALL_DATA) "$$d$(_DOC_OMF_IN)" "$(distdir)/$(notdir $(_DOC_OMF_IN))"
+
+dist-doc-dsk:
+	@if test -f "$(_DOC_DSK_IN)"; then d=; else d="$(srcdir)/"; fi; \
+	echo "$(INSTALL_DATA) $$d$(_DOC_DSK_IN) $(distdir)/$(notdir $(_DOC_DSK_IN))"; \
+	$(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
+
+
+
+################################################################################
+## Check
+
+.PHONY: check-doc-docs check-doc-omf
+check:							\
+	$(if $(DOC_MODULE),check-doc-docs)		\
+	$(if $(DOC_ID),check-doc-pages)			\
+	$(if $(_DOC_OMF_IN),check-doc-omf)
+
+check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  if test -f "$$lc"; \
+	    then d=; \
+	    xmlpath="$$lc"; \
+	  else \
+	    d="$(srcdir)/"; \
+	    xmlpath="$$lc:$(srcdir)/$$lc"; \
+	  fi; \
+	  echo "xmllint --noout --noent --path $$xmlpath --xinclude --postvalid $$d$$lc/$(DOC_MODULE).xml"; \
+	  xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
+	done
+
+check-doc-pages: $(_DOC_C_PAGES) $(_DOC_LC_PAGES)
+	for lc in C $(_DOC_REAL_LINGUAS); do \
+	  if test -f "$$lc"; \
+	    then d=; \
+	    xmlpath="$$lc"; \
+	  else \
+	    d="$(srcdir)/"; \
+	    xmlpath="$$lc:$(srcdir)/$$lc"; \
+	  fi; \
+	  for page in $(DOC_PAGES); do \
+	    echo "xmllint --noout --noent --path $$xmlpath --xinclude --relaxng $(_malrng) $$d$$lc/$$page"; \
+	    xmllint --noout --noent --path "$$xmlpath" --xinclude --relaxng "$(_malrng)" "$$d$$lc/$$page"; \
+	  done; \
+	done
+
+check-doc-omf: $(_DOC_OMF_ALL)
+	@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
+	  echo "xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \
+	  xmllint --noout --xinclude --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf; \
+	done
+
+
+
+################################################################################
+## Install
+
+.PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
+
+_doc_install_dir = $(if $(DOC_ID),$(DOC_ID),$(DOC_MODULE))
+
+install-data-local:					\
+	$(if $(DOC_MODULE)$(DOC_ID),install-doc-docs)	\
+	$(if $(_DOC_HTML_ALL),install-doc-html)		\
+	$(if $(_DOC_C_FIGURES),install-doc-figs)	\
+	$(if $(_DOC_OMF_IN),install-doc-omf)
+#	$(if $(_DOC_DSK_IN),install-doc-dsk)
+
+install-doc-docs:
+	@for lc in C $(_DOC_REAL_LINGUAS); do \
+	  echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc"; \
+	  $(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$lc; \
+	done
+	@list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
+	  if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
+	  docdir="$$lc/"`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	  docdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$docdir"; \
+	  if ! test -d "$$docdir"; then \
+	    echo "$(mkinstalldirs) $$docdir"; \
+	    $(mkinstalldirs) "$$docdir"; \
+	  fi; \
+	  echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	  $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc; \
+	done
+
+install-doc-figs:
+	@list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \
+	  for lc in C $(_DOC_REAL_LINGUAS); do \
+	    figsymlink=false; \
+	    if test -f "$$lc/$$fig"; then \
+	      figfile="$$lc/$$fig"; \
+	    elif test -f "$(srcdir)/$$lc/$$fig"; then \
+	      figfile="$(srcdir)/$$lc/$$fig"; \
+	    else \
+	      figsymlink=true; \
+	    fi; \
+	    figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
+	    figdir="$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$figdir"; \
+	    if ! test -d "$$figdir"; then \
+	      echo "$(mkinstalldirs) $$figdir"; \
+	      $(mkinstalldirs) "$$figdir"; \
+	    fi; \
+	    figbase=`echo $$fig | sed -e 's/^.*\///'`; \
+	    if $$figsymlink; then \
+	      echo "cd $$figdir && $(LN_S) -f ../../C/$$fig $$figbase"; \
+	      ( cd "$$figdir" && $(LN_S) -f "../../C/$$fig" "$$figbase" ); \
+	    else \
+	      echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
+	      $(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
+	    fi; \
+	  done; \
+	done
+
+install-doc-html:
+	echo install-html
+
+install-doc-omf:
+	$(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)
+	@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
+	  echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	  $(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf; \
+	done
+	@if test "x$(_ENABLE_SK)" = "xtrue"; then \
+	  echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
+	  scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)"; \
+	fi;
+
+install-doc-dsk:
+	echo install-dsk
+
+
+
+################################################################################
+## Uninstall
+
+.PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
+uninstall-local:					\
+	$(if $(DOC_MODULE)$(DOC_ID),uninstall-doc-docs)	\
+	$(if $(_DOC_HTML_ALL),uninstall-doc-html)	\
+	$(if $(_DOC_C_FIGURES),uninstall-doc-figs)	\
+	$(if $(_DOC_OMF_IN),uninstall-doc-omf)
+#	$(if $(_DOC_DSK_IN),uninstall-doc-dsk)
+
+uninstall-doc-docs:
+	@list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
+	  echo " rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	  rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$doc"; \
+	done
+
+uninstall-doc-figs:
+	@list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
+	  echo "rm -f $(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
+	  rm -f "$(DESTDIR)$(HELP_DIR)/$(_doc_install_dir)/$$fig"; \
+	done;
+
+uninstall-doc-omf:
+	@list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
+	  if test "x$(_ENABLE_SK)" = "xtrue"; then \
+	    echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	    scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	  fi; \
+	  echo "rm -f $(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	  rm -f "$(DESTDIR)$(OMF_DIR)/$(_doc_install_dir)/$$omf"; \
+	done
diff --git a/help/Makefile.am b/help/Makefile.am
new file mode 100644
index 0000000..8ca3787
--- /dev/null
+++ b/help/Makefile.am
@@ -0,0 +1,24 @@
+include $(top_srcdir)/gnome-doc-utils.make
+
+DOC_ID = ocrfeeder
+
+DOC_FIGURES = \
+	figures/areas-edition.png
+	figures/content-areas.png
+
+DOC_PAGES = \
+	addingfolder.page \
+	addingimage.page \
+	automaticrecognition.page \
+	deskewing.page \
+	documentgeneration.page \
+	finetuning.page \
+	importingfromscanner.page \
+	importingpdf.page \
+	index.page \
+	manualeditionandcorrection.page \
+	ocrconfiguration.page \
+	projects.page \
+	unpaper.page
+
+dist-hook: doc-dist-hook
\ No newline at end of file
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 0000000..3492dc4
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1 @@
+gnome-doc-utils.m4
diff --git a/resources/Makefile.am b/resources/Makefile.am
new file mode 100644
index 0000000..19f6b21
--- /dev/null
+++ b/resources/Makefile.am
@@ -0,0 +1,15 @@
+SUBDIRS = icons
+
+desktopdir = $(datadir)/applications
+desktop_in_files = ocrfeeder.desktop.in
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+ INTLTOOL_DESKTOP_RULE@
+
+spellchecker_uidir = $(datadir)/ocrfeeder
+spellchecker_ui_DATA = spell-checker.ui
+
+man_MANS = ocrfeeder.1 ocrfeeder-cli.1
+
+EXTRA_DIST = $(desktop_in_files)
+
+CLEANFILES = $(desktop_DATA)
diff --git a/resources/icons/Makefile.am b/resources/icons/Makefile.am
new file mode 100644
index 0000000..00c28ce
--- /dev/null
+++ b/resources/icons/Makefile.am
@@ -0,0 +1,8 @@
+iconsdir = $(datadir)/ocrfeeder/icons/
+icons_DATA = \
+	detect_icon.svg \
+	ocrfeeder.svg \
+	ocr.svg \
+	window_icon.png
+
+EXTRA_DIST = $(icons_DATA)
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..eb4ef4a
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = ocrfeeder/
\ No newline at end of file
diff --git a/src/ocrfeeder/Makefile.am b/src/ocrfeeder/Makefile.am
new file mode 100644
index 0000000..3bf4845
--- /dev/null
+++ b/src/ocrfeeder/Makefile.am
@@ -0,0 +1,13 @@
+ocrfeederdir = $(pkgpythondir)/
+
+ocrfeeder_PYTHON = \
+	__init__.py
+
+SUBDIRS = \
+	feeder/ \
+	studio/ \
+	util/ \
+	odf/
+
+clean-local:
+	rm -rf *.pyc *.pyo
\ No newline at end of file
diff --git a/src/ocrfeeder/feeder/Makefile.am b/src/ocrfeeder/feeder/Makefile.am
new file mode 100644
index 0000000..b01a730
--- /dev/null
+++ b/src/ocrfeeder/feeder/Makefile.am
@@ -0,0 +1,11 @@
+ocrfeeder_feederdir = $(pkgpythondir)/feeder/
+
+ocrfeeder_feeder_PYTHON = \
+	__init__.py \
+	documentGeneration.py \
+	imageManipulation.py \
+	layoutAnalysis.py \
+	ocrEngines.py
+
+clean-local:
+	rm -rf *.pyc *.pyo
\ No newline at end of file
diff --git a/src/ocrfeeder/odf/Makefile.am b/src/ocrfeeder/odf/Makefile.am
new file mode 100644
index 0000000..0838ebf
--- /dev/null
+++ b/src/ocrfeeder/odf/Makefile.am
@@ -0,0 +1,37 @@
+ocrfeeder_odfdir = $(pkgpythondir)/odf/
+
+ocrfeeder_odf_PYTHON = \
+	__init__.py \
+	anim.py \
+	attrconverters.py \
+	chart.py \
+	config.py \
+	dc.py \
+	dr3d.py \
+	draw.py \
+	element.py \
+	form.py \
+	grammar.py \
+	load.py \
+	manifest.py \
+	math.py \
+	meta.py \
+	namespaces.py \
+	number.py \
+	odf2xhtml.py \
+	odfmanifest.py \
+	office.py \
+	ooostyles.py \
+	opendocument.py \
+	presentation.py \
+	script.py \
+	style.py \
+	svg.py \
+	table.py \
+	text.py \
+	thumbnail.py \
+	userfield.py \
+	xforms.py
+
+clean-local:
+	rm -rf *.pyc *.pyo
\ No newline at end of file
diff --git a/src/ocrfeeder/studio/Makefile.am b/src/ocrfeeder/studio/Makefile.am
new file mode 100644
index 0000000..83895b6
--- /dev/null
+++ b/src/ocrfeeder/studio/Makefile.am
@@ -0,0 +1,13 @@
+ocrfeeder_studiodir = $(pkgpythondir)/studio/
+
+ocrfeeder_studio_PYTHON = \
+	__init__.py \
+	configuration.py \
+	customWidgets.py \
+	dataHolder.py \
+	studioBuilder.py \
+	widgetModeler.py \
+	widgetPresenter.py
+
+clean-local:
+	rm -rf *.pyc *.pyo
\ No newline at end of file
diff --git a/src/ocrfeeder/util/Makefile.am b/src/ocrfeeder/util/Makefile.am
new file mode 100644
index 0000000..f9e9acc
--- /dev/null
+++ b/src/ocrfeeder/util/Makefile.am
@@ -0,0 +1,13 @@
+ocrfeeder_utildir = $(pkgpythondir)/util/
+
+ocrfeeder_util_PYTHON = \
+	__init__.py \
+	asyncworker.py \
+	constants.py \
+	graphics.py \
+	lib.py
+
+DISTCLEANFILES = constants.py
+
+clean-local:
+	rm -rf *.pyc *.pyo
diff --git a/src/ocrfeeder/util/constants.py b/src/ocrfeeder/util/constants.py.in
similarity index 89%
rename from src/ocrfeeder/util/constants.py
rename to src/ocrfeeder/util/constants.py.in
index b291f65..725fb54 100644
--- a/src/ocrfeeder/util/constants.py
+++ b/src/ocrfeeder/util/constants.py.in
@@ -24,7 +24,7 @@ import locale
 
 OCRFEEDER_STUDIO_NAME = 'OCRFeeder'
 OCRFEEDER_COMPACT_NAME = 'ocrfeeder'
-OCRFEEDER_STUDIO_VERSION = '0.7.1a'
+OCRFEEDER_STUDIO_VERSION = '@VERSION@'
 OCRFEEDER_STUDIO_AUTHORS = ['Joaquim Rocha <joaquimrocha1 gmail com>']
 OCRFEEDER_STUDIO_ARTISTS = ['Joaquim Rocha <joaquimrocha1 gmail com>']
 OCRFEEDER_COPYRIGHT = 'Copyright © 2008-2010 Joaquim Rocha\n' \
@@ -47,21 +47,22 @@ GPL_STATEMENT = """
 OCRFEEDER_STUDIO_COMMENTS = 'The complete OCR suite.'
 
 # DIRECTORIES
-DEFAULT_SYSTEM_APP_DIR = os.path.join(sys.prefix, 'share', 'ocrfeeder')
+DEFAULT_SYSTEM_APP_DIR = os.path.join('@prefix@', 'share', 'ocrfeeder')
 APP_DIR = DEFAULT_SYSTEM_APP_DIR
 RESOURCES_DIR = APP_DIR
 
 # If the path does not exist (devel setup) set the
 # APP_DIR and RESOURCES_DIR to local paths
-if not os.path.exists(APP_DIR):
-    APP_DIR = os.path.dirname(os.path.dirname(__file__))
+_dirname = os.path.abspath(os.path.dirname(__file__))
+if not os.path.exists(APP_DIR) or not _dirname.startswith('@prefix@'):
+    APP_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
     RESOURCES_DIR = os.path.join(APP_DIR, '../../resources')
 RESOURCES_DIR = os.path.abspath(RESOURCES_DIR)
 
 # I18N
 DEFAULT_LANGUAGES = os.environ.get('LANGUAGE', '').split(':')
 DEFAULT_LANGUAGES += ['en_US', 'pt_PT']
-LOCALE_DIR = os.path.join(sys.prefix, 'share', 'locale')
+LOCALE_DIR = os.path.join('@prefix@', '@DATADIRNAME@', 'locale')
 OCRFEEDER_DEFAULT_LOCALE = locale.getdefaultlocale()[0]
 
 # CUSTOM ICONS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]