Package: gocr
Version: 0.48

Dear GOCR package maintainers!

I am currently working on creating a Debian package for opensource
project OSRA - chemical formular optical recognition tool [1]. In order
to compile this project we need libPgm2asc.a library plus all relevant
headers as a separate package (e.g. gocr-dev). Packaging libPgm2asc.so
as yet another package (gocr-lib) may also be considered, but it is not
required by ORSA package. If OSRA will be one day put into Debian
repository, there might be need for gocr-lib as well (if Debian policy
is strictly to avoid static linking unless absolutely necessary).

I attach the patch I have generated in my development Debian based on
gocr-0.48 package. What I have added:

- Triggering library compilation during the build cycle
- Including all relevant headers into the -dev package

I will be happy if the patch (or the general idea) is accepted.

Thank you in advance!

[1] http://cactus.nci.nih.gov/osra/

-- 
With best regards,
Dmitry
diff -du -ruN gocr-0.48.orig/debian/control gocr-0.48/debian/control
--- gocr-0.48.orig/debian/control       2010-05-19 08:00:03.000000000 -0500
+++ gocr-0.48/debian/control    2010-05-19 03:57:53.000000000 -0500
@@ -33,3 +33,15 @@
  It can read pnm, pbm, pgm, ppm, some pcx and tga image files.
  .
  It is a tlc/tk GUI to gocr (a command line program).
+
+Package: gocr-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libc6-dev
+Description: gocr development libraries
+ gocr is a multi-platform OCR (Optical Character Recognition) program.
+ .
+ It can read pnm, pbm, pgm, ppm, some pcx and tga image files.
+ .
+ This package contains shared libraies and headers for those who want to 
develop
+ software based on gocr core.
+
diff -du -ruN gocr-0.48.orig/debian/rules gocr-0.48/debian/rules
--- gocr-0.48.orig/debian/rules 2010-05-19 08:00:03.000000000 -0500
+++ gocr-0.48/debian/rules      2010-05-21 04:22:37.000000000 -0500
@@ -9,9 +9,22 @@
 # Uncomment this to turn on verbose mode.
 export DH_VERBOSE=1
 
+DEV_INSTALL    := debian/gocr-dev.install
+
+override_dh_auto_build:
+       dh_auto_build
+       dh_auto_build -- libs
 
 override_dh_install:
+# Generate the list of dependant header files to be included into -dev package:
+       echo '# This file is autogenerated form 
debian/rules.\nsrc/libPgm2asc.a\tusr/lib' > $(DEV_INSTALL)
+       make -C src libs-depends | grep -io --perl-regexp ' [\w\.\/]+\.h' | 
sort -u | sed -e 's:^ :src/:' | tr '\n' ' ' >> $(DEV_INSTALL)
+       echo '\tusr/include/gocr' >> $(DEV_INSTALL)
+
+# Rename the executable:
        mv $(CURDIR)/debian/tmp/bin/gocr.tcl $(CURDIR)/debian/tmp/bin/gocr-tk
+
+# Continue with normal operation:
        dh_install
 
 %:
--- gocr-0.48.orig/src/Makefile.in      2009-04-09 04:06:53.000000000 -0500
+++ gocr-0.48/src/Makefile.in   2010-05-21 06:19:02.000000000 -0500
@@ -64,7 +64,7 @@
 
 .SUFFIXES: .s .o .c .h
 # do not look for files if help (etc) is given
-.PHONY : doc clean install libs default
+.PHONY : doc clean install libs default libs-depends
 
 .c.o: gocr.h pgm2asc.h ../include/config.h
        $(CC) $(CFLAGS) -c -o $*.o $<
@@ -89,13 +89,16 @@
 
 lib$(PGMASCLIB)....@package_version@.so: $(LIBOBJS)
        $(CC) -fPIC -shared -Wl,-h$@ -o $@ $(LIBOBJS)
-       -ln -s $@ lib$(PGMASCLIB).so
+       -ln -sf $@ lib$(PGMASCLIB).so
 
 lib$(PGMASCLIB).a: $(LIBOBJS)
        #       -rm -f $@
        $(AR) cru $@ $(LIBOBJS)
        $(RANLIB) $@
 
+libs-depends:
+       $(CC) $(CFLAGS) -MM $(patsubst %.o,%.c,$(LIBOBJS))
+
 $(LIBOBJS): Makefile
 
 # PHONY = don't look at file clean, -rm = start rm and ignore errors
@@ -124,7 +127,7 @@
        #for X in $(INCLUDEFILES); do rm -f $(DESTDIR)$(includedir)/$$X; done
 
 clean:
-       -rm -f *.o *~
+       -rm -f *.o *~ *.so *.a
 
 proper: clean
        -rm -f gocr libPgm2asc.*

Reply via email to