diff options
author | rafan <rafan@FreeBSD.org> | 2007-03-05 20:15:12 +0800 |
---|---|---|
committer | rafan <rafan@FreeBSD.org> | 2007-03-05 20:15:12 +0800 |
commit | 925f39a06e3dc5355e80e8306f31aa8dea29ebd5 (patch) | |
tree | f0353b29f67df11a2ef45e5c099851b73ddfccee /converters | |
parent | dca7dc4d4b918e3cff23b9f388145e0f1148130b (diff) | |
download | freebsd-ports-gnome-925f39a06e3dc5355e80e8306f31aa8dea29ebd5.tar.gz freebsd-ports-gnome-925f39a06e3dc5355e80e8306f31aa8dea29ebd5.tar.zst freebsd-ports-gnome-925f39a06e3dc5355e80e8306f31aa8dea29ebd5.zip |
- Update to 2.0 beta 3
- Use USE_DOS2UNIX instead our own wheel
PR: ports/109393
Submitted by: Ivan Petrov <petrovdear at gmail.com>
Diffstat (limited to 'converters')
-rw-r--r-- | converters/chmview/Makefile | 12 | ||||
-rw-r--r-- | converters/chmview/distinfo | 6 | ||||
-rw-r--r-- | converters/chmview/files/Makefile | 15 | ||||
-rw-r--r-- | converters/chmview/files/convert.sh | 20 | ||||
-rw-r--r-- | converters/chmview/files/patch-aa | 185 | ||||
-rw-r--r-- | converters/chmview/files/patch-ab | 95 |
6 files changed, 192 insertions, 141 deletions
diff --git a/converters/chmview/Makefile b/converters/chmview/Makefile index a08983fee37b..82de5fef2c9d 100644 --- a/converters/chmview/Makefile +++ b/converters/chmview/Makefile @@ -6,31 +6,25 @@ # PORTNAME= chmview -PORTVERSION= 1.0 -PORTREVISION= 2 +DISTVERSION= 2.0b3 CATEGORIES= converters textproc MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= trexinc -DISTNAME= chmview +DISTNAME= CHMView_${DISTVERSION} MAINTAINER= ports@FreeBSD.org COMMENT= Extractor from .chm files USE_ZIP= yes +USE_DOS2UNIX= yes WRKSRC= ${WRKDIR}/src PLIST_FILES= bin/chmview -PORTDOCS= chmformat.html pre-patch: - @${SH} ${FILESDIR}/convert.sh ${WRKSRC} @${CP} ${FILESDIR}/Makefile ${WRKSRC} do-install: @${INSTALL_PROGRAM} ${WRKSRC}/chmview ${PREFIX}/bin/ -.if !defined(NOPORTDOCS) - -@${MKDIR} ${DOCSDIR} - @${INSTALL_DATA} ${WRKSRC}/${PORTDOCS} ${DOCSDIR}/ -.endif .include <bsd.port.mk> diff --git a/converters/chmview/distinfo b/converters/chmview/distinfo index 5ae4ddeed004..8d235aeb0b46 100644 --- a/converters/chmview/distinfo +++ b/converters/chmview/distinfo @@ -1,3 +1,3 @@ -MD5 (chmview.zip) = 8b9dcae298aeda972d4b5ab56af466f0 -SHA256 (chmview.zip) = c26d24ddb6be98b73f9e472d1c478462ba1c6fa59a3e49c697eb08955c35bb27 -SIZE (chmview.zip) = 66764 +MD5 (CHMView_2.0b3.zip) = ebe6b61bcf08672348b608969206e9a2 +SHA256 (CHMView_2.0b3.zip) = d9cd81b1f5a1851e2ea47f6e6b7dd6ba76578fcd26c8d636df2d80be4a050adf +SIZE (CHMView_2.0b3.zip) = 50891 diff --git a/converters/chmview/files/Makefile b/converters/chmview/files/Makefile index 2512ed0131ed..7384cdcdef2e 100644 --- a/converters/chmview/files/Makefile +++ b/converters/chmview/files/Makefile @@ -5,18 +5,19 @@ OBJDIR = . EXEDIR = . EXENAME = $(EXEDIR)/chmview -CFLAGS += -g -LFLAGS += -g +CFLAGS += -DUNIX all: $(EXENAME) OBJS = $(OBJDIR)/chmview.o \ - $(OBJDIR)/chmlib.o \ - $(OBJDIR)/lzx.o + $(OBJDIR)/chm_lib.o \ + $(OBJDIR)/lzx.o \ + $(OBJDIR)/utf8.o -$(OBJDIR)/chmview.o: chmview.c chmlib.h -$(OBJDIR)/chmlib.o: chmlib.c chmlib.h fixendian.h lzx.h -$(OBJDIR)/lzx.o: lzx.c lzx.h lzx_int.h +$(OBJDIR)/chmview.o: chmview.c chm_lib.h +$(OBJDIR)/chm_lib.o: chm_lib.c chm_lib.h lzx.h +$(OBJDIR)/utf8.o: utf8.c utf8.h +$(OBJDIR)/lzx.o: lzx.c lzx.h .c.o: $(CC) $(CFLAGS) -c ${.IMPSRC} diff --git a/converters/chmview/files/convert.sh b/converters/chmview/files/convert.sh deleted file mode 100644 index d2a0192f09a2..000000000000 --- a/converters/chmview/files/convert.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -if [ X$1 = X ] -then - exit 0 -fi - -if ! cd $1 -then - exit 1 -fi - -rm makefile - -for FILE in * -do - tr -d '\r' <${FILE} >${FILE}.NEW - mv ${FILE}.NEW ${FILE} -done - diff --git a/converters/chmview/files/patch-aa b/converters/chmview/files/patch-aa index 2420b1ae8087..1992580c9b9d 100644 --- a/converters/chmview/files/patch-aa +++ b/converters/chmview/files/patch-aa @@ -1,9 +1,180 @@ -diff -r -u ../src/chmlib.h ./chmlib.h ---- ../src/chmlib.h Sun Dec 1 01:26:02 2002 -+++ ./chmlib.h Fri Mar 28 17:40:39 2003 -@@ -129,3 +129,5 @@ - chmfile *chm_openfile(char *fname); +--- ../src/chmview.c ++++ chmview.c.new +@@ -17,16 +17,30 @@ + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ - void chm_close(chmfile *l); ++#ifndef UNIX + #include <windows.h> ++#endif + -+#define MODE 0755 + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + #include <limits.h> ++ ++#ifdef UNIX ++#include <errno.h> ++#include <locale.h> ++#else + #include <dir.h> ++#endif + + #include "chm_lib.h" + #include "utf8.h" + ++#ifdef UNIX ++#define _strnicmp strncasecmp ++#define MODE 755 ++#endif ++ + struct cb_data + { + int extractwithoutpath; +@@ -44,6 +58,7 @@ + return p; + } + ++#ifndef UNIX + int makedir(char *path) + { + char *end; +@@ -75,6 +90,39 @@ + } + return 1; + } ++#else ++static int makedir(char *path) ++{ ++ char *slash; ++ int was_error, done, err; ++ ++ slash = path; ++ done = 0; ++ was_error = 0; ++ ++ do { ++ slash = index(slash + 1, '/'); ++ if (slash) ++ { ++ *slash = 0; ++ if (mkdir(path, MODE) == -1 && EEXIST != errno) ++ was_error = 1; ++ *slash = '/'; ++ } ++ else ++ done = 1; ++ } while (! done && ! was_error); ++ ++ if (was_error) ++ { ++ perror("mkdir"); ++ exit(1); ++ /* return 0; */ ++ } ++ ++ return 1; ++} ++#endif + + const char ILLEGAL_SYMB[] = "<>:|?*\""; + const char ILLEGAL_REPL[] = "()_!__'"; +@@ -103,6 +151,9 @@ + char fullpath[CHM_MAX_PATHLEN*2+1]; + char target[CHM_MAX_PATHLEN*2+1]; + wchar_t temp[CHM_MAX_PATHLEN+1]; ++#ifdef UNIX ++ size_t pathlen; ++#endif + + if (ui->length) + { +@@ -116,13 +167,32 @@ + return -1; + } + } ++#ifndef UNIX + GetCurrentDirectory(sizeof(fullpath)-1,fullpath); + while ((p = strstr(fullpath,"\\")) != NULL) + *p = '/'; + if (fullpath[strlen(fullpath)-1] != '/') + strcat(fullpath,"/"); ++#else ++ getcwd(fullpath, sizeof(fullpath)-1); ++ pathlen = strlen(fullpath); ++ if (pathlen == 0) ++ return -1; /* impossible but... defensive programming */ ++ if (fullpath[pathlen - 1] != '/') ++ { ++ if (pathlen == PATH_MAX) ++ return -1; ++ else ++ fullpath[pathlen] = '/'; ++ fullpath[pathlen+1] = 0; ++ } ++#endif + decode_UTF8(temp,ui->path); ++#ifndef UNIX + WideCharToMultiByte(CP_ACP,0,temp,-1,target,sizeof(target),NULL,NULL); ++#else ++ wcstombs(target, temp, sizeof(target)); ++#endif + ReplaceIllegalChars(target); + strcat(fullpath,extractwithoutpath?pointtoname(target):(target[0]=='/'?target+1:target)); + if (!extractwithoutpath) +@@ -153,15 +223,19 @@ + wchar_t temp[CHM_MAX_PATHLEN+1]; + + decode_UTF8(temp,ui->path); ++#ifndef UNIX + WideCharToMultiByte(CP_OEMCP,0,temp,-1,target,sizeof(target),NULL,NULL); ++#else ++ wcstombs(target, temp, sizeof(target)); ++#endif + printf("Extracting %s ",target); + if (savetofile(c, ui, extractwithoutpath)) + { + printf("Error\n"); + error=1; + //return CHM_ENUMERATOR_FAILURE; +- } +- printf("OK\n"); ++ } else ++ printf("OK\n"); + } + + int _extract_callback_all(struct chmFile *c, struct chmUnitInfo *ui, void *context) +@@ -193,7 +267,11 @@ + wchar_t temp[CHM_MAX_PATHLEN+1]; + + decode_UTF8(temp,ui->path); ++#ifndef UNIX + WideCharToMultiByte(CP_OEMCP,0,temp,-1,target,sizeof(target),NULL,NULL); ++#else ++ wcstombs(target, temp, sizeof(target)); ++#endif + + if ((target)[0] == '/') + { +@@ -243,6 +321,9 @@ + + infname = argv[2]; + ++#ifdef UNIX ++ setlocale(LC_ALL,""); ++#endif + c = chm_open(infname); + if (!c) + exit(-1); +@@ -305,7 +386,11 @@ + strcat(target,name+1); + else + strcat(target,name); ++#ifndef UNIX + MultiByteToWideChar(CP_ACP,0,target,-1,temp,sizeof(temp)); ++#else ++ mbstowcs(temp, target, sizeof(target)); ++#endif + encode_UTF8(target,temp); + status = chm_resolve_object(c,target,&ui); + if (status==CHM_RESOLVE_SUCCESS && ui.path[strlen(ui.path)-1]!='/') diff --git a/converters/chmview/files/patch-ab b/converters/chmview/files/patch-ab deleted file mode 100644 index 8ea84981592b..000000000000 --- a/converters/chmview/files/patch-ab +++ /dev/null @@ -1,95 +0,0 @@ -diff -r -u ../src/chmview.c ./chmview.c ---- ../src/chmview.c Fri Mar 28 20:59:31 2003 -+++ ./chmview.c Fri Mar 28 19:01:39 2003 -@@ -3,9 +3,7 @@ - #include <limits.h> - #include <errno.h> - #include <string.h> --#include <dir.h> - #include "chmlib.h" --#define PATH_MAX 512 - - static char *pointtoname(char *path) - { -@@ -15,6 +13,7 @@ - return p; - } - -+#if 0 - static int makedir(char *path) - { - char *end; -@@ -47,6 +46,38 @@ - } - return 1; - } -+#else -+static int makedir(char *path) -+{ -+ char *slash; -+ int was_error, done, err; -+ -+ slash = path; -+ done = 0; -+ was_error = 0; -+ -+ do { -+ slash = index(slash + 1, '/'); -+ if (slash) -+ { -+ *slash = 0; -+ if (mkdir(path, MODE) == -1 && EEXIST != errno) -+ was_error = 1; -+ *slash = '/'; -+ } -+ else -+ done = 1; -+ } while (! done && ! was_error); -+ -+ if (was_error) -+ { -+ perror("mkdir"); -+ return 0; -+ } -+ -+ return 1; -+} -+#endif - - static int savetofile(chmfile *c, char *target, int extractwithoutpath) - { -@@ -55,18 +86,25 @@ - char *rtarget; - char *p; - FILE *f; -- char path[PATH_MAX]; -- char fullpath[PATH_MAX]; -+ char fullpath[PATH_MAX + 1]; -+ size_t pathlen; - - if (chm_getfile(c, target, &length, &outbuf) != 0) - return 1; -- getcurdir(0,path); -- fullpath[0]=getdisk()+'A'; fullpath[1]=':'; fullpath[2]='/'; fullpath[3]='\0'; -- strcat(fullpath,path); -- while ((p = strstr(fullpath,"\\")) != NULL) -- *p = '/'; -- if (fullpath[strlen(fullpath)-1] != '/') -- strcat(fullpath,"/"); -+ -+ getcwd(fullpath,PATH_MAX-1); -+ pathlen = strlen(fullpath); -+ if (pathlen == 0) -+ return -1; /* impossible but... defensive programming */ -+ if (fullpath[pathlen - 1] != '/') -+ { -+ if (pathlen == PATH_MAX) -+ return -1; -+ else -+ fullpath[pathlen] = '/'; -+ fullpath[pathlen+1] = 0; -+ } -+ - strcat(fullpath,extractwithoutpath?pointtoname(target):target+1); - if (!extractwithoutpath) - if (!makedir(fullpath)) |