LHA: add expander rule and fix libiconv detection

* Makes it possible to extract LHA archives with Expander
* Makes it possible to extract archives with non-utf8 file names inside
This commit is contained in:
Adrien Destugues
2014-07-17 09:46:11 +02:00
parent 51df6b2c0d
commit 2db725ed3e
2 changed files with 66 additions and 5 deletions

View File

@@ -9,8 +9,8 @@ COPYRIGHT="1991, Masaru Oki
HOMEPAGE="http://sourceforge.jp/projects/lha/"
SRC_URI="http://jaist.dl.sourceforge.jp/lha/22231/lha-1.14i-ac20050924p1.tar.gz"
CHECKSUM_SHA256="b5261e9f98538816aa9e64791f23cb83f1632ecda61f02e54b6749e9ca5e9ee4"
REVISION="1"
ARCHITECTURES="x86 ?x86_gcc2 ?x86_64"
REVISION="2"
ARCHITECTURES="x86 x86_gcc2 ?x86_64"
PROVIDES="
lha = $portVersion
@@ -19,10 +19,12 @@ PROVIDES="
REQUIRES="
haiku >= $haikuVersion
lib:libiconv
"
BUILD_REQUIRES="
haiku_devel >= $haikuVersion
devel:libiconv
"
BUILD_PREREQUIRES="
@@ -43,13 +45,17 @@ SOURCE_DIR="lha-1.14i-ac20050924p1"
BUILD()
{
autoreconf -vfi
runConfigure ./configure
make
LDFLAGS=-liconv runConfigure ./configure
make $jobArgs
}
INSTALL()
{
make install
# Create expander rule
mkdir -p $dataDir/expander/rules
echo '"application/x-lharc" .lha "lha l --system-kanji-code=utf8 %s" "lha x --system-kanji-code=utf8 %s"' > $dataDir/expander/rules/lha
}
TEST()

View File

@@ -1,4 +1,4 @@
From d6ee6e73f4d5db9e15580bfa746a0e885bbd9218 Mon Sep 17 00:00:00 2001
From 4b488a3cdb9f40f91f81008b131e41b676a9937c Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Sun, 24 Nov 2013 19:28:57 -0700
Subject: Updates for newer autotools and misc fixes
@@ -56,3 +56,58 @@ index 79e1330..cd456eb 100644
--
1.8.3.4
From d8d031cbd5bdeceb1f75653ccd00483501964672 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 17 Jul 2014 09:00:08 +0200
Subject: Detect and use Haiku's version of libiconv.
* Makes it possible to extract archives with non-utf8 files inside.
diff --git a/configure.ac b/configure.ac
index cb0524a..35763ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,7 +62,7 @@ AC_CHECK_FUNCS(strchr strdup memcpy memset memmove strcasecmp)
AC_CHECK_FUNCS(mktime timelocal tzset ftime gettimeofday utime)
AC_CHECK_FUNCS(ftruncate chsize lchown mkstemp ftello)
AC_CHECK_FUNCS(getpwuid getgrgid getpwnam getgrnam)
-AC_CHECK_FUNCS(iconv basename)
+AC_CHECK_FUNCS(libiconv basename)
AC_REPLACE_FUNCS(vsnprintf fnmatch)
if test $ac_header_dirent = no; then
diff --git a/src/header.c b/src/header.c
index e8d083d..c157727 100644
--- a/src/header.c
+++ b/src/header.c
@@ -1736,7 +1736,7 @@ ConvertUTF8ToEncoding(const char* inUTF8Buf,
return cfResult;
}
-#elif HAVE_ICONV
+#elif HAVE_LIBICONV
#include <iconv.h>
static int
@@ -1786,7 +1786,7 @@ sjis_to_utf8(char *dst, const char *src, size_t dstsize)
kCFStringEncodingDOSJapanese,
kCFStringEncodingUseHFSPlusCanonical) == 0)
return dst;
-#elif HAVE_ICONV
+#elif HAVE_LIBICONV
if (ConvertEncodingByIconv(src, dst, dstsize, "SJIS", "UTF-8") != -1)
return dst;
#else
@@ -1810,7 +1810,7 @@ utf8_to_sjis(char *dst, const char *src, size_t dstsize)
kCFStringEncodingDOSJapanese,
kCFStringEncodingUseHFSPlusCanonical) == 0)
return dst;
-#elif HAVE_ICONV
+#elif HAVE_LIBICONV
if (ConvertEncodingByIconv(src, dst, dstsize, "UTF-8", "SJIS") != -1)
return dst;
#else
--
1.8.3.4