Date: Thu, 18 Oct 2007 09:05:32 GMT From: Yarodin <yarodin@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/117290: New port: archivers/unrar-iconv Extract, view & test RAR archives with iconv support Message-ID: <200710180905.l9I95Wp4024100@www.freebsd.org> Resent-Message-ID: <200710180910.l9I9A1i7055027@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 117290 >Category: ports >Synopsis: New port: archivers/unrar-iconv Extract, view & test RAR archives with iconv support >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: Thu Oct 18 09:10:01 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Yarodin >Release: >Organization: >Environment: >Description: The unRAR utility is a freeware program, distributed with source code and developed for extracting, testing and viewing the contents of archives created with the RAR archiver, version 1.50 and above. For the usage and distribution license please read the file LICENSE.TXT. The unRAR utility is a minor part of the RAR archiver and contains RAR uncompression algorithm. UnRAR requires very small volume of memory to operate. ADD: iconv support. See new switches la,ll,lo at unrar -? WWW: http://www.rarsoft.com/ >How-To-Repeat: >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # unrar-iconv # unrar-iconv/files # unrar-iconv/files/patch-iconv # unrar-iconv/Makefile # unrar-iconv/distinfo # unrar-iconv/pkg-descr # echo c - unrar-iconv mkdir -p unrar-iconv > /dev/null 2>&1 echo c - unrar-iconv/files mkdir -p unrar-iconv/files > /dev/null 2>&1 echo x - unrar-iconv/files/patch-iconv sed 's/^X//' >unrar-iconv/files/patch-iconv << 'END-of-unrar-iconv/files/patch-iconv' X--- cmddata.cpp Tue Oct 4 11:57:54 2005 X+++ cmddata.cpp Mon Jan 16 18:06:24 2006 X@@ -123,6 +123,34 @@ X if (Test && Extract) X Test=false; X BareOutput=(CmdChar=='L' || CmdChar=='V') && Command[1]=='B'; X+#ifdef WITH_ICONV X+ if ( (encInt[0] != '\0') || (encExt[0] != '\0') ) { X+ char fullEncInt[ENC_MAXLEN + OPT_MAXLEN + 1]; X+ char fullEncExt[ENC_MAXLEN + OPT_MAXLEN + 1]; X+ X+ strcpy(fullEncInt, encInt); X+ strcpy(fullEncExt, encExt); X+ X+ if (encOpt[0] == '\0') strcpy(encOpt, OPT_DEFAULT); X+ X+ if (encOpt[0] != '\0') { X+ strcat(fullEncInt, "//"); strcat(fullEncInt, encOpt); X+ strcat(fullEncExt, "//"); strcat(fullEncExt, encOpt); X+ } X+ X+ h_E2I = iconv_open(fullEncInt, encExt); X+ h_I2E = iconv_open(fullEncExt, encInt); X+ X+ if ( (h_E2I == (iconv_t)(-1)) || (h_I2E == (iconv_t)(-1)) ) { X+ if (h_E2I != (iconv_t)(-1)) iconv_close(h_E2I); X+ if (h_I2E != (iconv_t)(-1)) iconv_close(h_I2E); X+ mprintf(St(MIconvCannotOpen), encInt, encExt, encOpt); X+ } X+ } else { X+ h_E2I = (iconv_t)(-1); X+ h_I2E = (iconv_t)(-1); X+ } X+#endif X } X X X@@ -746,6 +774,22 @@ X break; X } X break; X+#ifdef WITH_ICONV X+ case 'L': X+ switch(toupper(Switch[1])) X+ { X+ case 'L': X+ strncpy(encExt, Switch+2, sizeof(encExt)-1); X+ break; X+ case 'A': X+ strncpy(encInt, Switch+2, sizeof(encInt)-1); X+ break; X+ case 'O': X+ strncpy(encOpt, Switch+2, sizeof(encOpt)-1); X+ break; X+ } X+ break; X+#endif X #ifndef GUI X case '?' : X OutHelp(); X@@ -964,7 +920,11 @@ X MCHelpCmdT,MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD, X MCHelpSwAP,MCHelpSwAVm,MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU, X MCHelpSwDH,MCHelpSwEP,MCHelpSwEP3,MCHelpSwF,MCHelpSwIDP,MCHelpSwIERR, X- MCHelpSwINUL,MCHelpSwIOFF,MCHelpSwKB,MCHelpSwN,MCHelpSwNa,MCHelpSwNal, X+ MCHelpSwINUL,MCHelpSwIOFF,MCHelpSwKB, X+#ifdef WITH_ICONV X+ MCHelpSwLA,MCHelpSwLL,MCHelpSwLO, X+#endif X+ MCHelpSwN,MCHelpSwNa,MCHelpSwNal, X MCHelpSwOp,MCHelpSwOm,MCHelpSwOC,MCHelpSwOR,MCHelpSwOW,MCHelpSwP, X MCHelpSwPm,MCHelpSwR,MCHelpSwRI,MCHelpSwSL,MCHelpSwSM,MCHelpSwTA, X MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,MCHelpSwVUnr, X--- global.hpp Tue Oct 4 11:57:54 2005 X+++ global.hpp Mon Jan 16 18:04:41 2006 X@@ -9,6 +9,19 @@ X X EXTVAR ErrorHandler ErrHandler; X X+#ifdef WITH_ICONV X X+#define OPT_DEFAULT "IGNORE" /* ignore unrepresentable chars */ X+ X+#define ENC_MAXLEN 32 /* encoding name maximum length */ X+#define OPT_MAXLEN 9 /* strlen("TRANSLIT") */ X+ X+EXTVAR iconv_t h_E2I; /* ExtToInt handler */ X+EXTVAR iconv_t h_I2E; /* IntToExt handler */ X+EXTVAR char encInt[ENC_MAXLEN]; /* internal (archive) encoding */ X+EXTVAR char encExt[ENC_MAXLEN]; /* external (filesystem) encoding */ X+EXTVAR char encOpt[OPT_MAXLEN]; /* encoding option (ignore/translit) */ X+ X+#endif X X #endif X--- loclang.hpp Tue Oct 4 11:57:54 2005 X+++ loclang.hpp Mon Jan 16 18:04:41 2006 X@@ -6,7 +6,7 @@ X #define MCopyright "\nRAR %s Copyright (c) 1993-%d Alexander Roshal %d %s %d" X #define MRegTo "\nRegistered to %s\n" X #define MShare "\nShareware version Type RAR -? for help\n" X-#define MUCopyright "\nUNRAR %s freeware Copyright (c) 1993-%d Alexander Roshal\n" X+#define MUCopyright "\nUNRAR %s (iconv) freeware Copyright (c) 1993-%d Alexander Roshal\n" X #define MBeta "beta" X #define MMonthJan "Jan" X #define MMonthFeb "Feb" X@@ -310,7 +310,7 @@ X #define MSyncScanError "\nFile search errors, cannot synchronize archive" X #define MCorrectingName "\nWARNING: Attempting to correct the invalid file name" X #define MUnpCannotMerge "\nWARNING: You need to start extraction from a previous volume to unpack %s" X-#define MUnknownOption "\nERROR: Unknown option: %s" X+#define MUnknownOption "\nERROR: Unknown option: %s\n" X #define MSubHeadCorrupt "\nERROR: Corrupt data header found, ignored" X #define MSubHeadUnknown "\nWARNING: Unknown data header format, ignored" X #define MSubHeadDataCRC "\nERROR: Corrupt %s data block" X@@ -338,3 +338,9 @@ X #define MMaxPathLimit "\nTotal path and file name length must not exceed %d characters" X #define MRecVolLimit "\nTotal number of usual and recovery volumes must not exceed 255" X #define MVolumeNumber "volume %d" X+#ifdef WITH_ICONV X+#define MCHelpSwLA "\n la<encoding> Archive internal filenames encoding" X+#define MCHelpSwLL "\n ll<encoding> Your locale encoding" X+#define MCHelpSwLO "\n lo<option> Encoding option {ignore,translit,<empty>}" X+#define MIconvCannotOpen "\nCannot open iconv to convert between '%s' and '%s' with option '%s'" X+#endif X--- makefile.unix Sat Apr 30 11:00:12 2005 X+++ makefile.unix Mon Jan 16 18:04:41 2006 X@@ -10,6 +10,13 @@ X CXXFLAGS=-O2 X DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE X STRIP=strip X+# iconv stuff. Remove #ICONV# to enable X+# where to get iconv.h X+CXXFLAGS+= -I/usr/local/include X+# where to get libiconv.so* X+LIBS+= -L/usr/local/lib -liconv X+# enable iconv stuff X+DEFINES+= -DWITH_ICONV X X # Linux using LCC X #CXX=lcc X--- os.hpp Tue Oct 4 11:57:54 2005 X+++ os.hpp Mon Jan 16 18:04:41 2006 X@@ -169,6 +169,10 @@ X #include <utime.h> X #include <locale.h> X X+#ifdef WITH_ICONV X+#include <iconv.h> X+#endif X+ X #ifdef S_IFLNK X #define SAVE_LINKS X #endif X--- strfn.cpp Tue Oct 4 11:57:54 2005 X+++ strfn.cpp Mon Jan 16 18:04:41 2006 X@@ -22,23 +22,49 @@ X X void ExtToInt(const char *Src,char *Dest) X { X+#ifdef WITH_ICONV X+ static size_t ret; X+ ret = (size_t)(-1); X+ if (h_E2I != (iconv_t)(-1)) { X+ static size_t inbytesleft, outbytesleft; X+ X+ inbytesleft = strlen(Src); X+ outbytesleft = inbytesleft; X+ ret = iconv(h_E2I, &Src, &inbytesleft, &Dest, &outbytesleft); X+ } X+ if (ret == (size_t)(-1)) strcpy(Dest, Src); X+#else /* !WITH_ICONV */ X #if defined(_WIN_32) X CharToOem(Src,Dest); X #else X if (Dest!=Src) X strcpy(Dest,Src); X #endif X+#endif /* !WITH_ICONV */ X } X X X void IntToExt(const char *Src,char *Dest) X { X+#ifdef WITH_ICONV X+ static size_t ret; X+ ret = (size_t)(-1); X+ if (h_I2E != (iconv_t)(-1)) { X+ static size_t inbytesleft, outbytesleft; X+ X+ inbytesleft = strlen(Src); X+ outbytesleft = inbytesleft; X+ ret = iconv(h_I2E, &Src, &inbytesleft, &Dest, &outbytesleft); X+ } X+ if (ret == (size_t)(-1)) strcpy(Dest, Src); X+#else /* !WITH_ICONV */ X #if defined(_WIN_32) X OemToChar(Src,Dest); X #else X if (Dest!=Src) X strcpy(Dest,Src); X #endif X+#endif /* !WITH_ICONV */ X } END-of-unrar-iconv/files/patch-iconv echo x - unrar-iconv/Makefile sed 's/^X//' >unrar-iconv/Makefile << 'END-of-unrar-iconv/Makefile' X# New ports collection makefile for: unrar-iconv X# Date created: 18 Oct 2007 X# Whom: Yarodin <yarodin@gmail.com> X# X# $FreeBSD$ X# X XPORTNAME= unrar XPORTVERSION= 3.71.b1 XCATEGORIES+= archivers XMASTER_SITES= RAR XPKGNAMESUFFIX= -iconv XDISTNAME= unrarsrc-3.7.8 X XMAINTAINER= yarodin@gmail.com XCOMMENT= Extract, view & test RAR archives with iconv support X XWRKSRC= ${WRKDIR}/unrar X XCONFLICTS?= zh-unrar-[0-9]* unrar-[0-9]* XUSE_GMAKE= yes X XPLIST_FILES= bin/unrar XPORTDOCS= license.txt readme.txt X Xpost-patch: X @${SED} -e 's|g++|${CXX}|g' -e 's|-O2|${CXXFLAGS}|g' \ X ${WRKSRC}/makefile.unix > ${WRKSRC}/Makefile X Xdo-install: X ${INSTALL_PROGRAM} ${WRKSRC}/unrar ${PREFIX}/bin X.if !defined(NOPORTDOCS) X @${MKDIR} ${DOCSDIR} X ${INSTALL_DATA} ${WRKSRC}/license.txt ${DOCSDIR} X ${INSTALL_DATA} ${WRKSRC}/readme.txt ${DOCSDIR} X.endif X X.include <bsd.port.mk> END-of-unrar-iconv/Makefile echo x - unrar-iconv/distinfo sed 's/^X//' >unrar-iconv/distinfo << 'END-of-unrar-iconv/distinfo' XMD5 (unrarsrc-3.7.8.tar.gz) = b783f1932bc0c73902c6399f7c2c6f43 XSHA256 (unrarsrc-3.7.8.tar.gz) = 10476e8f0152830922d1038cbc852ec08cdbcd9945fa6b4b8aca16bb736084e9 XSIZE (unrarsrc-3.7.8.tar.gz) = 131120 END-of-unrar-iconv/distinfo echo x - unrar-iconv/pkg-descr sed 's/^X//' >unrar-iconv/pkg-descr << 'END-of-unrar-iconv/pkg-descr' X The unRAR utility is a freeware program, distributed with source X code and developed for extracting, testing and viewing the X contents of archives created with the RAR archiver, version 1.50 X and above. For the usage and distribution license please read the X file LICENSE.TXT. X X The unRAR utility is a minor part of the RAR archiver and contains X RAR uncompression algorithm. UnRAR requires very small volume of X memory to operate. X X ADD: iconv support. See new switches la,ll,lo at unrar -? X XWWW: http://www.rarsoft.com/ END-of-unrar-iconv/pkg-descr exit >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710180905.l9I95Wp4024100>