Add zip package.

This commit is contained in:
Alexpux 2013-11-17 20:07:29 +04:00
parent 408a61ac65
commit 0d4ae02987
3 changed files with 159 additions and 0 deletions

36
zip/PKGBUILD Normal file
View File

@ -0,0 +1,36 @@
# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
pkgname=zip
pkgver=3.0
_pkgver=30
pkgrel=1
pkgdesc="Creates PKZIP-compatible .zip files"
arch=('i686' 'x86_64')
url="http://www.info-zip.org/Zip.html"
license=('BSD')
depends=('libbz2')
options=('!makeflags')
source=("ftp://ftp.info-zip.org/pub/infozip/src/${pkgname}${_pkgver}.zip"
'zip-3.0-11.src.patch'
'zip-3.0-build.patch')
md5sums=('e88492c8abd68fa9cfba72bc08757dba'
'd52cb016b3c9dfb69eb292992bb5c6f0'
'bc878d9aa48efb540538d33843650e74')
prepare() {
cd "${srcdir}/${pkgname}${_pkgver}"
patch -p2 -i ${srcdir}/zip-3.0-11.src.patch
patch -p1 -i ${srcdir}/zip-3.0-build.patch
}
build() {
cd "${srcdir}/${pkgname}${_pkgver}"
make -f unix/Makefile cygwin LOCAL_ZIP="$CFLAGS -DFORCE_UNIX_OVER_WIN32" prefix=/usr
}
package() {
cd "${srcdir}/${pkgname}${_pkgver}"
make -f unix/Makefile prefix=${pkgdir}/usr \
MANDIR=${pkgdir}/usr/share/man/man1 E=.exe install
install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
}

87
zip/zip-3.0-11.src.patch Normal file
View File

@ -0,0 +1,87 @@
--- origsrc/zip30/revision.h 2008-07-05 13:24:56.000000000 -0400
+++ src/zip30/revision.h 2009-08-04 16:46:09.143600000 -0400
@@ -58,7 +58,7 @@ ZCONST char *copyright[] = {
};
ZCONST char * far versinfolines[] = {
-"This is %s %s (%s), by Info-ZIP.",
+"This is %s %s (%s), by Cygwin. Original by Info-ZIP.",
"Currently maintained by E. Gordon. Please send bug reports to",
"the authors using the web page at www.info-zip.org; see README for details.",
"",
--- origsrc/zip30/unix/Makefile 2008-05-07 02:33:56.000000000 -0400
+++ src/zip30/unix/Makefile 2009-08-04 16:46:09.150600000 -0400
@@ -227,7 +227,7 @@ cray_v3:
# Cygwin
cygwin:
- $(MAKE) $(MAKEF) generic CC="gcc" CPP="gcc -E" EXE=".exe"
+ $(MAKE) $(MAKEF) generic CC="gcc" CPP="gcc -E" E=".exe"
# LynxOS
lynx:
--- origsrc/zip30/unix/configure 2009-08-04 16:46:02.792600000 -0400
+++ src/zip30/unix/configure 2009-08-04 16:46:09.174600000 -0400
@@ -204,9 +204,19 @@ int main()
return 0;
}
_EOF_
- $CC $CFLAGS -o conftest conftest.c -lbz2 > /dev/null 2>/dev/null
+ $CC $CFLAGS $LDFLAGS -o conftest conftest.c -lbz2 > /dev/null 2>/dev/null
if test $? -eq 0; then
- echo "-- OS supports bzip2 - linking in bzip2"
+ nm `$CC $CFLAGS $LDFLAGS -print-file-name=libbz2.a` | grep bz_internal_error > /dev/null
+ if test $? -eq 0; then
+ echo "-- OS supports bzip2 - linking in bzip2"
+ else
+ echo " OS provides bzip2 library but not built with the"
+ echo " BZ_NO_STDIO option"
+ echo " WARNING: We recommend using a bzip2 library compiled"
+ echo " with BZ_NO_STDIO defined for proper error handling"
+ echo " Please see the Zip installation instructions"
+ echo " Continuing anyway with standard bzip2 library..."
+ fi
CFLAGS="${CFLAGS} -DBZIP2_SUPPORT"
LFLAGS2="${LFLAGS2} -lbz2"
else
--- origsrc/zip30/unix/unix.c 2008-06-19 00:26:18.000000000 -0400
+++ src/zip30/unix/unix.c 2009-08-04 16:46:09.210600000 -0400
@@ -239,6 +239,14 @@ int *pdosflag; /* output: force
dosflag = dosify; /* default for non-DOS and non-OS/2 */
/* Find starting point in name before doing malloc */
+#ifdef __CYGWIN__
+ /* Strip drive specification */
+ t = *x && isascii((uch)*x) && *(x + 1) == ':' ? x + 2 : x;
+ /* Convert backslashes to slashes */
+ for (n = t; *n; n++)
+ if (*n == '\\')
+ *n = '/';
+#endif
/* Strip "//host/share/" part of a UNC name */
if (!strncmp(x,"//",2) && (x[2] != '\0' && x[2] != '/')) {
n = x + 2;
@@ -251,8 +259,12 @@ int *pdosflag; /* output: force
}
if (*n != '\0')
t = n + 1;
+#ifdef __CYGWIN__
+ } /* we may already have adjusted t */
+#else
} else
t = x;
+#endif
while (*t == '/')
t++; /* strip leading '/' chars to get a relative path */
while (*t == '.' && t[1] == '/')
--- origsrc/zip30/zipsplit.c 2008-05-08 04:17:16.000000000 -0400
+++ src/zip30/zipsplit.c 2009-08-04 16:46:09.217600000 -0400
@@ -890,7 +890,7 @@ char **argv; /* command line
strcpy(name, INDEX);
printf("creating: %s\n", path);
indexmade = 1;
- if ((f = fopen(path, "w")) == NULL)
+ if ((f = fopen(path, FOPW)) == NULL) /* cygwin fix: use FOPW */
{
if (u && retry()) goto redobin;
ziperr(ZE_CREAT, path);

36
zip/zip-3.0-build.patch Normal file
View File

@ -0,0 +1,36 @@
respect build environment settings
--- zip/unix/configure
+++ zip/unix/configure
@@ -18,7 +18,7 @@
CC=${1-cc}
CFLAGS=${2-"-I. -DUNIX"}
-LFLAGS1=''
+LFLAGS1="${LDFLAGS}"
LFLAGS2=''
LN="ln -s"
@@ -118,7 +118,7 @@ _EOF_
fi
# optimization flags
-if test -n "${CFLAGS_OPT}"; then
+if false; then
CFLAGS="${CFLAGS} ${CFLAGS_OPT}"
CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
fi
@@ -220,13 +220,6 @@ fi
echo Check for the C preprocessor
# on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
CPP="${CC} -E"
-# solaris as(1) needs -P, maybe others as well ?
-[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
-[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
-[ -f /lib/cpp ] && CPP=/lib/cpp
-[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
-[ -f /xenix ] && CPP="${CC} -E"
-[ -f /lynx.os ] && CPP="${CC} -E"
echo "#include <stdio.h>" > conftest.c
$CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"