Attached port is for textproc/podofo, a library and command-line tools
for carrying out some operations on PDFs, and the diff inline below
removes the patch to permit Calibre to be built without it.

For the podofo port, I had to modify it to use malloc/free rather than
alloca which was failing with linker errors when trying to link some of
the (c++) files. Seems to work OK and what I've been able to run of the
test suite is happy.

OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/textproc/calibre/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- Makefile    31 Mar 2014 23:54:35 -0000      1.28
+++ Makefile    31 Mar 2014 23:57:31 -0000
@@ -3,6 +3,7 @@
 COMMENT =              ebook management application
 
 DISTNAME =             calibre-1.30.0
+REVISION =             0
 CATEGORIES =           textproc
 MASTER_SITES =         ${MASTER_SITE_SOURCEFORGE:=calibre/}
 EXTRACT_SUFX =         .tar.xz
@@ -19,16 +20,15 @@ WANTLIB += ${MODPY_WANTLIB}
 WANTLIB += ICE MagickCore MagickWand lib/qt4/QtDBus lib/qt4/QtGui
 WANTLIB += lib/qt4/QtSvg lib/qt4/QtXml SM X11 Xext Xi Xinerama Xrender
 WANTLIB += chm fontconfig freetype icudata icui18n icuio icuuc m mtp
-WANTLIB += pthread stdc++ usb-1.0 z
+WANTLIB += podofo pthread stdc++ usb-1.0 z
 
 LIB_DEPENDS=           devel/chmlib \
                        devel/libmtp \
                        devel/libusb1 \
                        graphics/ImageMagick \
-                       textproc/icu4c
+                       textproc/icu4c \
+                       textproc/podofo
 
-# XXX PoDoFo should be ported and added here; then remove hack
-# XXX from patch-setup_extensions_py that makes it optional
 COMMON_DEPENDS =       databases/py-apsw \
                        devel/py-dateutil \
                        devel/xdg-utils \
@@ -70,8 +70,8 @@ MAKE_ENV +=           QMAKE="${LOCALBASE}/bin/qma
 MAKE_ENV +=            LDFLAGS="${LDFLAGS}"
 MAKE_ENV +=            FT_LIB_DIR="${X11BASE}/lib"
 MAKE_ENV +=            XDG_DATA_DIRS="${PREFIX}/share"
-#MAKE_ENV +=           PODOFO_INC_DIR="${LOCALBASE}/include/podofo"
-#MAKE_ENV +=           PODOFO_LIB_DIR="${LOCALBASE}/lib"
+MAKE_ENV +=            PODOFO_INC_DIR="${LOCALBASE}/include/podofo"
+MAKE_ENV +=            PODOFO_LIB_DIR="${LOCALBASE}/lib"
 
 # Requires /sys filesystem for HW detection
 MAKE_ENV +=            WITH_USB=no
Index: patches/patch-setup_extensions_py
===================================================================
RCS file: /cvs/ports/textproc/calibre/patches/patch-setup_extensions_py,v
retrieving revision 1.6
diff -u -p -r1.6 patch-setup_extensions_py
--- patches/patch-setup_extensions_py   31 Mar 2014 23:54:35 -0000      1.6
+++ patches/patch-setup_extensions_py   31 Mar 2014 23:57:31 -0000
@@ -1,6 +1,5 @@
 $OpenBSD: patch-setup_extensions_py,v 1.6 2014/03/31 23:54:35 sthen Exp $
 
-- XXX make podofo optional as it isn't ported yet; should be fixed
 - fix various header search paths
 - don't override compiler optimizer levels
 - build with libmtp/libusb1 on OpenBSD (possibly useless as it looks like it
@@ -35,15 +34,7 @@ it's correct with "env" here (handled in
  
      def preflight(self, obj_dir, compiler, linker, builder, cflags, ldflags):
          pass
-@@ -201,6 +194,7 @@ extensions = [
-                     libraries=['podofo'],
-                     lib_dirs=[podofo_lib],
-                     inc_dirs=[podofo_inc, os.path.dirname(podofo_inc)],
-+                    optional=1,
-                     error=podofo_error),
- 
-     Extension('pictureflow',
-@@ -281,9 +275,10 @@ if isosx:
+@@ -281,9 +274,10 @@ if isosx:
                  ldflags=['-framework', 'CoreServices', '-framework', 'IOKit'])
              )
  
@@ -55,7 +46,7 @@ it's correct with "env" here (handled in
          libraries=['usb-1.0']
      ))
  
-@@ -297,6 +292,7 @@ if islinux or isosx:
+@@ -297,6 +291,7 @@ if islinux or isosx:
          'calibre/devices/mtp/unix/upstream/music-players.h',
          'calibre/devices/mtp/unix/upstream/device-flags.h',
          ],
@@ -63,7 +54,7 @@ it's correct with "env" here (handled in
          libraries=['mtp']
      ))
  
-@@ -324,9 +320,9 @@ if isbsd:
+@@ -324,9 +319,9 @@ if isbsd:
      cflags.append('-pthread')
      ldflags.append('-shared')
      cflags.append('-I'+sysconfig.get_python_inc())
@@ -74,7 +65,7 @@ it's correct with "env" here (handled in
  if isosx:
      x, p = ('i386', 'x86_64')
      archs = ['-arch', x, '-arch', p, '-isysroot',
-@@ -533,7 +529,7 @@ class Build(Command):
+@@ -533,7 +528,7 @@ class Build(Command):
          DESTDIR = .
          TARGET = calibre
          QT *= svg
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/textproc/calibre/pkg/PLIST,v
retrieving revision 1.11
diff -u -p -r1.11 PLIST
--- pkg/PLIST   31 Mar 2014 23:54:36 -0000      1.11
+++ pkg/PLIST   31 Mar 2014 23:57:32 -0000
@@ -2323,6 +2323,7 @@ lib/calibre/calibre/plugins/magick.so
 lib/calibre/calibre/plugins/matcher.so
 lib/calibre/calibre/plugins/msdes.so
 lib/calibre/calibre/plugins/pictureflow.so
+lib/calibre/calibre/plugins/podofo.so
 lib/calibre/calibre/plugins/progress_indicator.so
 lib/calibre/calibre/plugins/qt_hack.so
 lib/calibre/calibre/plugins/speedup.so

Attachment: podofo.tgz
Description: application/tar-gz

Reply via email to