ports/126653: [patch] converters/chmview Fix build error on amd64

Valerio Daelli valerio.daelli at gmail.com
Tue Aug 19 09:20:04 UTC 2008


>Number:         126653
>Category:       ports
>Synopsis:       [patch] converters/chmview Fix build error on amd64
>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:   Tue Aug 19 09:20:04 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Valerio Daelli
>Release:        7.0-STABLE
>Organization:
IFOM IEO CAMPUS
>Environment:
FreeBSD unknown.local.net 7.0-STABLE FreeBSD 7.0-STABLE #7: Wed Aug  6 06:58:56 CEST 2008     root at unknown.local.net:/usr/obj/usr/src/sys/HOST  amd64
>Description:
This patch solves a compilation problem for chmview.
Now it works on both i386 and amd64.
>How-To-Repeat:

>Fix:
cd /usr/ports/converters/chmview
patch -p1 < /root/chmview-patch


Patch attached with submission follows:

diff -ruN chmview.orig/Makefile chmview/Makefile
--- chmview.orig/Makefile	2007-03-11 09:03:15.000000000 +0100
+++ chmview/Makefile	2008-08-18 11:18:09.000000000 +0200
@@ -23,9 +23,7 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${ARCH} != "i386"
-BROKEN=		is not 64-bit clean
-.endif
+ONLY_FOR_ARCHS=       i386 amd64
 
 pre-patch:
 	@${CP} ${FILESDIR}/Makefile ${WRKSRC}
diff -ruN chmview.orig/files/patch-aa chmview/files/patch-aa
--- chmview.orig/files/patch-aa	2007-03-05 13:15:12.000000000 +0100
+++ chmview/files/patch-aa	2008-08-18 14:59:33.000000000 +0200
@@ -1,6 +1,7 @@
---- ../src/chmview.c
-+++ chmview.c.new
-@@ -17,16 +17,30 @@
+diff -ruN src.old/chmview.c src/chmview.c
+--- src.old/chmview.c	2005-03-07 21:29:18.000000000 +0100
++++ chmview.c	2008-08-18 14:39:39.000000000 +0200
+@@ -17,19 +17,33 @@
      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
  
@@ -30,7 +31,11 @@
 +
  struct cb_data
  {
-   int extractwithoutpath;
+-  int extractwithoutpath;
++  long extractwithoutpath;
+   char *path;
+   int pathlen;
+ };
 @@ -44,6 +58,7 @@
    return p;
  }
@@ -79,6 +84,15 @@
  
  const char ILLEGAL_SYMB[] = "<>:|?*\"";
  const char ILLEGAL_REPL[] = "()_!__'";
+@@ -94,7 +142,7 @@
+   }
+ }
+ 
+-static int savetofile(struct chmFile *c, struct chmUnitInfo *ui, int extractwithoutpath)
++static int savetofile(struct chmFile *c, struct chmUnitInfo *ui, long extractwithoutpath)
+ {
+   LONGINT64 length=0;
+   char *outbuf=NULL;
 @@ -103,6 +151,9 @@
    char fullpath[CHM_MAX_PATHLEN*2+1];
    char target[CHM_MAX_PATHLEN*2+1];
@@ -122,7 +136,14 @@
    ReplaceIllegalChars(target);
    strcat(fullpath,extractwithoutpath?pointtoname(target):(target[0]=='/'?target+1:target));
    if (!extractwithoutpath)
-@@ -153,15 +223,19 @@
+@@ -147,26 +217,30 @@
+   return 0;
+ }
+ 
+-void extract(struct chmFile *c, struct chmUnitInfo *ui, int extractwithoutpath)
++void extract(struct chmFile *c, struct chmUnitInfo *ui, long extractwithoutpath)
+ {
+   char target[CHM_MAX_PATHLEN*2+1];
    wchar_t temp[CHM_MAX_PATHLEN+1];
  
    decode_UTF8(temp,ui->path);
@@ -138,12 +159,26 @@
      error=1;
      //return CHM_ENUMERATOR_FAILURE;
 -  }
--  printf("OK\n");
 +  } else
-+		printf("OK\n");
+   printf("OK\n");
  }
  
  int _extract_callback_all(struct chmFile *c, struct chmUnitInfo *ui, void *context)
+ {
+-  extract(c,ui,(int)context);
++  extract(c,ui,(long)context);
+   return CHM_ENUMERATOR_CONTINUE;
+ }
+ 
+@@ -180,7 +254,7 @@
+   return CHM_ENUMERATOR_CONTINUE;
+ }
+ 
+-extractdir(struct chmFile *c, char *path, int extractwithoutpath)
++extractdir(struct chmFile *c, char *path, long extractwithoutpath)
+ {
+   struct cb_data data = {extractwithoutpath,path,strlen(path)};
+   chm_enumerate(c,CHM_ENUMERATE_ALL,_extract_callback_dir,(void *)&data);
 @@ -193,7 +267,11 @@
    wchar_t temp[CHM_MAX_PATHLEN+1];
  
@@ -166,6 +201,15 @@
    c = chm_open(infname);
    if (!c)
      exit(-1);
+@@ -265,7 +346,7 @@
+       char target[CHM_MAX_PATHLEN*2+1];
+       wchar_t temp[CHM_MAX_PATHLEN+1];
+       int status;
+-      int extractwithoutpath = command[0]=='e'?1:0;
++      long extractwithoutpath = command[0]=='e'?1:0;
+ 
+       if (argc == 4)
+       {
 @@ -305,7 +386,11 @@
              strcat(target,name+1);
            else
diff -ruN chmview.orig/files/patch-bb chmview/files/patch-bb
--- chmview.orig/files/patch-bb	1970-01-01 01:00:00.000000000 +0100
+++ chmview/files/patch-bb	2008-08-18 14:52:15.000000000 +0200
@@ -0,0 +1,23 @@
+diff -ruN src.old/chm_lib.c src/chm_lib.c
+--- src.old/chm_lib.c	2008-08-18 10:22:30.000000000 +0200
++++ chm_lib.c	2008-08-18 11:10:20.000000000 +0200
+@@ -170,8 +170,18 @@
+ typedef unsigned long           UInt32;
+ typedef long long               Int64;
+ typedef unsigned long long      UInt64;
+-#else
+ 
++/* AMD64 */
++#elif __amd64__
++typedef unsigned char           UChar;
++typedef short                   Int16;
++typedef unsigned short          UInt16;
++typedef long                    Int32;
++typedef unsigned long           UInt32;
++typedef long long               Int64;
++typedef unsigned long long      UInt64;
++
++#else
+ /* yielding an error is preferable to yielding incorrect behavior */
+ #error "Please define the sized types for your platform in chm_lib.c"
+ #endif


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list