ports/78152: Archmage is not compatible with textproc/pychm
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Feb 27 16:30:26 UTC 2005
>Number: 78152
>Category: ports
>Synopsis: Archmage is not compatible with textproc/pychm
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Feb 27 16:30:24 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Vsevolod Stakhov
>Release: FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD nemezida.highsecure.ru 5.3-STABLE FreeBSD 5.3-STABLE #2: Fri Jan 28 02:15:40 MSK 2005 root at nemezida.highsecure.ru:/mnt/data/usr/obj/mnt/data/usr/src/sys/NK i386
>Description:
Chmlib, that is in archmage is too different from original chmlib, so we
need to use its own version instead of textproc/pychm. Also we should change
misc/chmlib and add some extensions there.
>How-To-Repeat:
>Fix:
archmage.patch:
diff -urP /tmp/archmage/Makefile textproc/archmage/Makefile
--- /tmp/archmage/Makefile Sat Feb 26 12:37:15 2005
+++ textproc/archmage/Makefile Sat Feb 26 12:24:30 2005
@@ -2,7 +2,7 @@
# Date created: 22 February 2005
# Whom: Vsevolod Stakhov <vsevolod at highsecure.ru>
#
-# $FreeBSD$
+# $FreeBSD: ports/textproc/archmage/Makefile,v 1.1 2005/02/22 20:06:53 sem Exp $
#
PORTNAME= archmage
@@ -14,7 +14,7 @@
MAINTAINER= vsevolod at highsecure.ru
COMMENT= Extensible reader/decompiler of files in CHM format
-RUN_DEPENDS= ${PYTHONPREFIX_SITELIBDIR}/chm/_chmlib.so:${PORTSDIR}/textproc/pychm
+LIB_DEPENDS= chm.0:${PORTSDIR}/misc/chmlib
NO_BUILD= yes
USE_PYTHON= yes
@@ -26,5 +26,14 @@
post-patch:
@${REINPLACE_CMD} -e "s,/usr/share,${PREFIX}/share," ${WRKSRC}/arch.conf
@${REINPLACE_CMD} -e "s,/etc/arch\.conf,${PREFIX}/etc/arch\.conf," ${WRKSRC}/CHM.py
+ @${MV} ${WRKSRC}/archmage ${WRKSRC}/archmage.orig
+ @${MKDIR} ${WRKSRC}/archmage
+ @${MV} ${WRKSRC}/archmage.orig ${WRKSRC}/archmage/archmage
+ @${LN} -s ${WRKSRC}/chmlib/chmlib.py ${WRKSRC}/archmage/
+ @${MV} ${WRKSRC}/CHM.py ${WRKSRC}/archmage/
+ @${MV} ${WRKSRC}/mod_chm.py ${WRKSRC}/archmage/
+
+post-install:
+ @${ECHO} "archmage" > ${PYTHON_SITELIBDIR}/archmage.pth
.include <bsd.port.mk>
diff -urP /tmp/archmage/files/patch-aa textproc/archmage/files/patch-aa
--- /tmp/archmage/files/patch-aa Sat Feb 26 12:37:15 2005
+++ textproc/archmage/files/patch-aa Sat Feb 26 12:29:37 2005
@@ -1,25 +1,33 @@
---- setup.py.orig Tue Feb 22 19:18:40 2005
-+++ setup.py Tue Feb 22 19:19:26 2005
-@@ -14,7 +14,7 @@
+--- setup.py.orig Fri Aug 15 08:11:14 2003
++++ setup.py Sat Feb 26 12:29:32 2005
+@@ -12,9 +12,9 @@
+ url = "archmage.sf.net",
+ version = "0.0.6",
- py_modules = ['chmlib', 'CHM', 'mod_chm'],
- scripts = ['archmage'],
+- py_modules = ['chmlib', 'CHM', 'mod_chm'],
+- scripts = ['archmage'],
- data_files = [ ('/etc/', [ 'arch.conf' ] ),
++ py_modules = ['archmage.chmlib', 'archmage.CHM', 'archmage.mod_chm'],
++ scripts = ['archmage/archmage'],
+ data_files = [ ('etc/', [ 'arch.conf' ] ),
( 'share/archmage/templates/',
['templates/arch_contents.html',
'templates/arch_frameset.html',
-@@ -65,13 +65,4 @@
+@@ -65,13 +65,11 @@
'templates/icons/7.gif',
'templates/icons/8.gif',
'templates/icons/9.gif']) ],
- ext_modules = [ Extension(name = '_chmlib',
-- sources =
++ ext_modules = [ Extension(name = 'archmage._chmlib',
+ sources =
- [ 'chmlib/chm_lib.c',
- 'chmlib/wrapper.c',
- 'chmlib/lzx.c',
- 'chmlib/az_chmlib_add.c'
-- ],
++ [ 'chmlib/wrapper.c',
+ ],
- include_dirs=["chmlib"])
-- ]
++ libraries=["chm"]
++ )
+ ]
)
diff -urP /tmp/archmage/pkg-plist textproc/archmage/pkg-plist
--- /tmp/archmage/pkg-plist Sat Feb 26 12:37:15 2005
+++ textproc/archmage/pkg-plist Sat Feb 26 12:35:03 2005
@@ -48,13 +48,18 @@
%%DATADIR%%/templates/icons/7.gif
%%DATADIR%%/templates/icons/8.gif
%%DATADIR%%/templates/icons/9.gif
-%%PYTHON_SITELIBDIR%%/CHM.py
-%%PYTHON_SITELIBDIR%%/CHM.pyo
-%%PYTHON_SITELIBDIR%%/CHM.pyc
-%%PYTHON_SITELIBDIR%%/chmlib.py
-%%PYTHON_SITELIBDIR%%/chmlib.pyo
-%%PYTHON_SITELIBDIR%%/mod_chm.py
-%%PYTHON_SITELIBDIR%%/mod_chm.pyo
-%%PYTHON_SITELIBDIR%%/mod_chm.pyc
+%%PYTHON_SITELIBDIR%%/archmage.pth
+%%PYTHON_SITELIBDIR%%/archmage/CHM.py
+%%PYTHON_SITELIBDIR%%/archmage/CHM.pyo
+%%PYTHON_SITELIBDIR%%/archmage/CHM.pyc
+%%PYTHON_SITELIBDIR%%/archmage/chmlib.py
+%%PYTHON_SITELIBDIR%%/archmage/chmlib.pyc
+%%PYTHON_SITELIBDIR%%/archmage/chmlib.pyo
+%%PYTHON_SITELIBDIR%%/archmage/_chmlib.so
+%%PYTHON_SITELIBDIR%%/archmage/mod_chm.py
+%%PYTHON_SITELIBDIR%%/archmage/mod_chm.pyo
+%%PYTHON_SITELIBDIR%%/archmage/mod_chm.pyc
+ at dirrm %%PYTHON_SITELIBDIR%%/archmage
@dirrm %%DATADIR%%/templates/icons
@dirrm %%DATADIR%%/templates
+ at dirrm %%DATADIR%%
misc/chmlib/files:
patch-Makefile.in
--- Makefile.in.orig Fri Feb 25 18:43:09 2005
+++ Makefile.in Fri Feb 25 18:43:21 2005
@@ -26,7 +26,7 @@
%.lo: %.c
${LIBTOOL} --mode=compile ${CC} -c -o $@ $^ ${CFLAGS}
-src/libchm.la: src/chm_lib.lo src/lzx.lo
+src/libchm.la: src/chm_lib.lo src/lzx.lo src/az_chmlib_add.lo
${LIBTOOL} --mode=link ${CC} -o $@ $^ ${LDFLAGS} -rpath ${INSTALLPREFIX}/lib
install: src/libchm.la
patch-az_chmlib_add.c
--- /dev/null Fri Feb 25 18:33:00 2005
+++ src/az_chmlib_add.c Fri Feb 25 18:29:45 2005
@@ -0,0 +1,54 @@
+#include <string.h>
+#include "chm_lib.h"
+
+/*
+ * callback function for enumerate API
+ */
+int _get_name(struct chmFile *h,
+ chmUnitInfo *ui,
+ void *context)
+{
+ int i;
+
+
+ chm_dir *dirp = (chm_dir *)context;
+
+ dirp->info=realloc(dirp->info,(dirp->nentries+1)*sizeof (char*));
+
+ dirp->info[dirp->nentries] = malloc(sizeof(ui->path));
+ strcpy(dirp->info[dirp->nentries], ui->path);
+
+ dirp->nentries++;
+ return CHM_ENUMERATOR_CONTINUE;
+}
+
+chm_dir get_names(struct chmFile *h)
+//note: you should free() dir.info and all dir.info[i] in caller
+{
+ chm_dir dir;
+
+ dir.nentries=0;
+ dir.info = NULL;
+
+ if (! chm_enumerate(h,
+ CHM_ENUMERATE_ALL,
+ _get_name,
+ (void *)&dir))
+ printf(" *** ERROR ***\n");
+
+ return dir;
+}
+
+
+int main()
+{
+ int i;
+
+ struct chmFile *h = chm_open("/home/az/new/txt/chm/reg.chm");
+ chm_dir dir=get_names(h);
+ for(i=0;i<dir.nentries;i++)
+ printf("%d: %s\n",i,dir.info[i]);
+
+ return 0;
+}
+
patch-chm_lib.c
--- src/chm_lib.c.orig Tue Apr 8 10:33:30 2003
+++ src/chm_lib.c Tue Apr 8 10:40:56 2003
@@ -156,6 +156,17 @@
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
+/* FreeBSD */
+#elif __FreeBSD__
+#include <inttypes.h>
+typedef unsigned char UChar;
+typedef int16_t Int16;
+typedef uint16_t UInt16;
+typedef int32_t Int32;
+typedef uint32_t UInt32;
+typedef int64_t Int64;
+typedef uint64_t UInt64;
+
/* I386, 32-bit, non-Windows */
/* Sparc */
/* MIPS */
patch-chm_lib.h:
--- src/chm_lib.h.orig Fri Feb 25 21:26:09 2005
+++ src/chm_lib.h Fri Feb 25 21:26:57 2005
@@ -78,6 +78,12 @@
char path[CHM_MAX_PATHLEN+1];
};
+typedef struct chmUnitInfo chmUnitInfo;
+typedef struct chm_dir {
+ int nentries;
+ char **info;
+} chm_dir;
+
/* open an ITS archive */
#ifdef PPC_BSTR
/* RWE 6/12/2003 */
@@ -133,6 +139,7 @@
CHM_ENUMERATOR e,
void *context);
+chm_dir get_names(struct chmFile *h);
#ifdef __cplusplus
}
#endif
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list