fix: add zip build patches
This commit is contained in:
parent
947582432e
commit
615944e6cd
@ -1,17 +1,52 @@
|
|||||||
NAME="zip"
|
NAME="zip"
|
||||||
DESC="ZIP file utilities"
|
DESC="ZIP file utilities"
|
||||||
VERSION="3.0"
|
VERSION="3.0"
|
||||||
FILES=("https://downloads.sourceforge.net/infozip/zip30.tar.gz")
|
|
||||||
HASHES=("7b74551e63f8ee6aab6fbc86676c0d37")
|
FILES=(
|
||||||
DEPENDS=()
|
"https://downloads.sourceforge.net/infozip/zip${VERSION/./}.tar.gz"
|
||||||
|
"zip-${VERSION}-exec-stack.patch"
|
||||||
|
"zip-${VERSION}-format-security.patch"
|
||||||
|
"zip-${VERSION}-no-crypt.patch"
|
||||||
|
"zip-${VERSION}-pic.patch"
|
||||||
|
"zip-${VERSION}-zipnote-freeze.patch"
|
||||||
|
"zip-${VERSION}-build.patch"
|
||||||
|
)
|
||||||
|
HASHES=(
|
||||||
|
"f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369"
|
||||||
|
"5e46b247107c71f34e00c93d27d9f5cf0812d1c8ffc171fc71addee715308ff5"
|
||||||
|
"62618a8af67488508598f8d562e3aff43f18d311b642758ea5ab3c80c8284373"
|
||||||
|
"32d263c492dbc2b37b71d0aa80e566283422e8e6493d91f8aa12946d6d587a4a"
|
||||||
|
"afca923887828f6ccdcb98bcb1130f138d014614ca49c2a2526bd0fdc91dda6e"
|
||||||
|
"c4eac1c60d8c71dd5242999255a30beda3925b628ff17a658bf1bfb2ef11cd3e"
|
||||||
|
"a66386c3a48019d8063a48c3610a28862412926f04a3b8f44662c6a87bb250f5"
|
||||||
|
)
|
||||||
|
|
||||||
|
DEPENDS=("bzip2")
|
||||||
|
BUILD=()
|
||||||
|
|
||||||
PACKAGE() {
|
PACKAGE() {
|
||||||
tar xf zip30.tar.gz && cd zip30
|
tar xf "zip${VERSION/./}.tar.gz"
|
||||||
|
cd "zip${VERSION/./}"
|
||||||
|
|
||||||
make -f unix/Makefile generic_gcc
|
#sed -e "/^CFLAGS_NOOPT =/s/\$/ $CPPFLAGS $CFLAGS/" -i unix/Makefile
|
||||||
make prefix="$ROOTDIR/usr" \
|
#sed -e "s/^LFLAGS1=''/LFLAGS1=$LDFLAGS/" -i unix/configure
|
||||||
MANDIR="$ROOTDIR/usr/share/man/man1" \
|
|
||||||
|
export CFLAGS="${CFLAGS} -std=gnu89"
|
||||||
|
export CPPLAGS="${CPPLAGS} -std=gnu89"
|
||||||
|
|
||||||
|
patch -p1 -i "../zip-${VERSION}-no-crypt.patch"
|
||||||
|
patch -p1 -i "../zip-${VERSION}-pic.patch"
|
||||||
|
patch -p1 -i "../zip-${VERSION}-exec-stack.patch"
|
||||||
|
patch -p1 -i "../zip-${VERSION}-build.patch"
|
||||||
|
patch -p1 -i "../zip-${VERSION}-zipnote-freeze.patch"
|
||||||
|
patch -p1 -i "../zip-${VERSION}-format-security.patch"
|
||||||
|
|
||||||
|
sh ./unix/configure "-I. -DUNIX ${CFLAGS} ${CPPFLAGS}"
|
||||||
|
|
||||||
|
make -f unix/Makefile prefix=/usr generic_gcc
|
||||||
|
make prefix="${ROOTDIR}/usr" \
|
||||||
|
MANDIR="${ROOTDIR}/usr/share/man/man1" \
|
||||||
-f unix/Makefile install
|
-f unix/Makefile install
|
||||||
|
|
||||||
cd .. && rm -r zip30
|
cd .. && rm -r "zip${VERSION/./}"
|
||||||
}
|
}
|
||||||
|
36
src/zip/zip-3.0-build.patch
Normal file
36
src/zip/zip-3.0-build.patch
Normal 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"
|
22
src/zip/zip-3.0-exec-stack.patch
Normal file
22
src/zip/zip-3.0-exec-stack.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
add proper GNU stack markings so we dont get the default: executable
|
||||||
|
|
||||||
|
--- zip-2.31/crc_i386.S
|
||||||
|
+++ zip-2.31/crc_i386.S
|
||||||
|
@@ -238,3 +238,7 @@
|
||||||
|
#endif /* i386 || _i386 || _I386 || __i386 */
|
||||||
|
|
||||||
|
#endif /* !USE_ZLIB && !CRC_TABLE_ONLY */
|
||||||
|
+
|
||||||
|
+#if defined __ELF__ && defined __linux__
|
||||||
|
+.section .note.GNU-stack,"",@progbits
|
||||||
|
+#endif
|
||||||
|
--- zip-2.31/match.S
|
||||||
|
+++ zip-2.31/match.S
|
||||||
|
@@ -405,3 +405,7 @@
|
||||||
|
#endif /* i386 || _I386 || _i386 || __i386 */
|
||||||
|
|
||||||
|
#endif /* !USE_ZLIB */
|
||||||
|
+
|
||||||
|
+#if defined __ELF__ && defined __linux__
|
||||||
|
+.section .note.GNU-stack,"",@progbits
|
||||||
|
+#endif
|
20
src/zip/zip-3.0-format-security.patch
Normal file
20
src/zip/zip-3.0-format-security.patch
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
--- a/zip.c
|
||||||
|
+++ b/zip.c
|
||||||
|
@@ -1028,7 +1028,7 @@
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(text)/sizeof(char *); i++)
|
||||||
|
{
|
||||||
|
- printf(text[i]);
|
||||||
|
+ fputs(text[i], stdout);
|
||||||
|
putchar('\n');
|
||||||
|
}
|
||||||
|
#ifdef DOS
|
||||||
|
@@ -1225,7 +1225,7 @@
|
||||||
|
CR_MAJORVER, CR_MINORVER, CR_BETA_VER, CR_VERSION_DATE);
|
||||||
|
for (i = 0; i < sizeof(cryptnote)/sizeof(char *); i++)
|
||||||
|
{
|
||||||
|
- printf(cryptnote[i]);
|
||||||
|
+ fputs(cryptnote[i], stdout);
|
||||||
|
putchar('\n');
|
||||||
|
}
|
||||||
|
++i; /* crypt support means there IS at least one compilation option */
|
57
src/zip/zip-3.0-no-crypt.patch
Normal file
57
src/zip/zip-3.0-no-crypt.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
fix building when NO_CRYPT is used
|
||||||
|
|
||||||
|
forward ported from zip-2.32
|
||||||
|
|
||||||
|
http://bugs.gentoo.org/238398
|
||||||
|
|
||||||
|
--- a/zip.c
|
||||||
|
+++ b/zip.c
|
||||||
|
@@ -3452,6 +3452,9 @@ char **argv; /* command line tokens */
|
||||||
|
|
||||||
|
/* Key not yet specified. If needed, get/verify it now. */
|
||||||
|
if (key_needed) {
|
||||||
|
+#if !CRYPT
|
||||||
|
+ ZIPERR(ZE_PARMS, "encryption not supported");
|
||||||
|
+#else /* CRYPT */
|
||||||
|
if ((key = malloc(IZ_PWLEN+1)) == NULL) {
|
||||||
|
ZIPERR(ZE_MEM, "was getting encryption password");
|
||||||
|
}
|
||||||
|
@@ -3478,6 +3481,7 @@ char **argv; /* command line tokens */
|
||||||
|
if (r) {
|
||||||
|
ZIPERR(ZE_PARMS, "password verification failed");
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
if (key) {
|
||||||
|
/* if -P "" could get here */
|
||||||
|
--- a/zipcloak.c
|
||||||
|
+++ b/zipcloak.c
|
||||||
|
@@ -744,6 +744,28 @@ struct option_struct far options[] = {
|
||||||
|
|
||||||
|
int main OF((void));
|
||||||
|
|
||||||
|
+void zipmessage_nl(a, nl)
|
||||||
|
+ZCONST char *a;
|
||||||
|
+int nl;
|
||||||
|
+{
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void zipmessage(a, b)
|
||||||
|
+ZCONST char *a, *b;
|
||||||
|
+{
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int set_filetype(out_path)
|
||||||
|
+ char *out_path;
|
||||||
|
+{
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int rename_split(temp_name, out_path)
|
||||||
|
+ char *temp_name;
|
||||||
|
+ char *out_path;
|
||||||
|
+{
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void zipwarn(msg1, msg2)
|
||||||
|
ZCONST char *msg1, *msg2;
|
||||||
|
{
|
15
src/zip/zip-3.0-pic.patch
Normal file
15
src/zip/zip-3.0-pic.patch
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
if our toolchain generates PIC by default, then do not use the hand written
|
||||||
|
assembly files as none of it is PIC friendly.
|
||||||
|
|
||||||
|
--- a/unix/configure
|
||||||
|
+++ b/unix/configure
|
||||||
|
@@ -29,6 +29,9 @@
|
||||||
|
echo Check if we can use asm code
|
||||||
|
OBJA=""
|
||||||
|
OCRCU8=""
|
||||||
|
+piclib="$(echo | $CPP -dM $CFLAGS - | grep -i __pic__)"
|
||||||
|
+echo "Checking if compiler wants to create pic code"
|
||||||
|
+[ "$piclib" = "" ] && \
|
||||||
|
if eval "$CPP match.S > _match.s 2>/dev/null"; then
|
||||||
|
if test ! -s _match.s || grep error < _match.s > /dev/null; then
|
||||||
|
:
|
61
src/zip/zip-3.0-zipnote-freeze.patch
Normal file
61
src/zip/zip-3.0-zipnote-freeze.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
diff -dupr zip30-old/fileio.c zip30/fileio.c
|
||||||
|
--- a/fileio.c
|
||||||
|
+++ b/fileio.c
|
||||||
|
@@ -3502,7 +3502,7 @@ zwchar *local_to_wide_string(local_strin
|
||||||
|
if ((wc_string = (wchar_t *)malloc((wsize + 1) * sizeof(wchar_t))) == NULL) {
|
||||||
|
ZIPERR(ZE_MEM, "local_to_wide_string");
|
||||||
|
}
|
||||||
|
- wsize = mbstowcs(wc_string, local_string, strlen(local_string) + 1);
|
||||||
|
+ wsize = mbstowcs(wc_string, local_string, wsize + 1);
|
||||||
|
wc_string[wsize] = (wchar_t) 0;
|
||||||
|
|
||||||
|
/* in case wchar_t is not zwchar */
|
||||||
|
diff -dupr zip30-old/zipfile.c zip30/zipfile.c
|
||||||
|
--- a/zipfile.c
|
||||||
|
+++ b/zipfile.c
|
||||||
|
@@ -5406,7 +5406,9 @@ int putlocal(z, rewrite)
|
||||||
|
if (z->flg & UTF8_BIT) {
|
||||||
|
/* If this flag is set, then restore UTF-8 as path name */
|
||||||
|
use_uname = 1;
|
||||||
|
+ tempzn -= nam;
|
||||||
|
nam = strlen(z->uname);
|
||||||
|
+ tempzn += nam;
|
||||||
|
} else {
|
||||||
|
/* use extra field */
|
||||||
|
add_Unicode_Path_local_extra_field(z);
|
||||||
|
@@ -5647,7 +5650,9 @@ int putcentral(z)
|
||||||
|
if (z->flg & UTF8_BIT) {
|
||||||
|
/* If this flag is set, then restore UTF-8 as path name */
|
||||||
|
use_uname = 1;
|
||||||
|
+ tempzn -= nam;
|
||||||
|
nam = strlen(z->uname);
|
||||||
|
+ tempzn += nam;
|
||||||
|
} else {
|
||||||
|
add_Unicode_Path_cen_extra_field(z);
|
||||||
|
}
|
||||||
|
diff -dupr zip30/zipnote.c zip30/zipnote.c
|
||||||
|
--- a/zipnote.c
|
||||||
|
+++ b/zipnote.c
|
||||||
|
@@ -575,6 +575,13 @@ char **argv; /* command line
|
||||||
|
strcpy(z->iname, a+2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifdef UNICODE_SUPPORT
|
||||||
|
+#define UTF8_BIT (1 << 11)
|
||||||
|
+ if (using_utf8) {
|
||||||
|
+ z->uname = z->iname;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Don't update z->nam here, we need the old value a little later.....
|
||||||
|
* The update is handled in zipcopy().
|
||||||
|
@@ -661,7 +668,7 @@ char **argv; /* command line
|
||||||
|
if ((r = zipcopy(z)) != ZE_OK)
|
||||||
|
ziperr(r, "was copying an entry");
|
||||||
|
}
|
||||||
|
- fclose(x);
|
||||||
|
+ fclose(in_file);
|
||||||
|
|
||||||
|
/* Write central directory and end of central directory with new comments */
|
||||||
|
if ((c = zftello(y)) == (zoff_t)-1) /* get start of central */
|
Loading…
Reference in New Issue
Block a user