summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorNoel Gordon <noel@chromium.org>2021-05-27 01:07:15 +0000
committerCopybara-Service <copybara-worker@google.com>2021-05-26 18:13:29 -0700
commit5ef44f037eea3aa532b8470a090f392a4b0830bd (patch)
tree7c1d6972ffd8173d75a467d09e093a1371a55b6e /contrib
parent35aa87e1aefabcaa049b300f90b50d7a573c838d (diff)
downloadzlib-5ef44f037eea3aa532b8470a090f392a4b0830bd.tar.gz
[zlib] Build minizip zip and unzip tools
Minizip is a library provided by //third_party/zlib. Its zip and unzip tools can be built in a developer checkout for testing purposes with: autoninja -C out/Release minizip_bin autoninja -C out/Release miniunz_bin Add GN build rules for these files. Patch minizip and miniunz tools so they compile. Add a patch file and minizip.md for usage. On Android, disable large file support (see bug comment #12). off_t is 32 bits (instead of 64 bits) and should compile on the bots where this patch failed compile before [1] and was reverted (CL:2895825). [1] Added CQ android_asan, android_archive_rel_ng try jobs to pre-test that compile works on these waterfall builders. Bug: 1207895 Change-Id: Idbb3414a2c14fc541e31d6eff97859245296003f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2919568 Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org> Commit-Queue: Noel Gordon <noel@chromium.org> Cr-Commit-Position: refs/heads/master@{#886990} NOKEYCHECK=True GitOrigin-RevId: a45e197d9695de4214f27e4c218b82e256b10d06
Diffstat (limited to 'contrib')
-rw-r--r--contrib/minizip/miniunz.c13
-rw-r--r--contrib/minizip/minizip.c7
-rw-r--r--contrib/minizip/minizip.md9
3 files changed, 18 insertions, 11 deletions
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c
index 3d65401..08737f6 100644
--- a/contrib/minizip/miniunz.c
+++ b/contrib/minizip/miniunz.c
@@ -12,7 +12,7 @@
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
*/
-#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!defined(__ANDROID_API__))
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64
#endif
@@ -27,7 +27,7 @@
#endif
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream)
@@ -45,6 +45,7 @@
#include <time.h>
#include <errno.h>
#include <fcntl.h>
+#include <sys/stat.h>
#ifdef _WIN32
# include <direct.h>
@@ -97,7 +98,7 @@ void change_file_date(filename,dosdate,tmu_date)
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
CloseHandle(hFile);
#else
-#ifdef unix || __APPLE__
+#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
struct utimbuf ut;
struct tm newdate;
newdate.tm_sec = tmu_date.tm_sec;
@@ -125,11 +126,9 @@ int mymkdir(dirname)
const char* dirname;
{
int ret=0;
-#ifdef _WIN32
+#if defined(_WIN32)
ret = _mkdir(dirname);
-#elif unix
- ret = mkdir (dirname,0775);
-#elif __APPLE__
+#elif defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
ret = mkdir (dirname,0775);
#endif
return ret;
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c
index 4288962..b794953 100644
--- a/contrib/minizip/minizip.c
+++ b/contrib/minizip/minizip.c
@@ -12,8 +12,7 @@
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
*/
-
-#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
+#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) && (!defined(__ANDROID_API__))
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64
#endif
@@ -28,7 +27,7 @@
#endif
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream)
@@ -94,7 +93,7 @@ uLong filetime(f, tmzip, dt)
return ret;
}
#else
-#ifdef unix || __APPLE__
+#if defined(unix) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__ANDROID_API__)
uLong filetime(f, tmzip, dt)
char *f; /* name of file to get info on */
tm_zip *tmzip; /* return value: access, modific. and creation times */
diff --git a/contrib/minizip/minizip.md b/contrib/minizip/minizip.md
new file mode 100644
index 0000000..9f15dd2
--- /dev/null
+++ b/contrib/minizip/minizip.md
@@ -0,0 +1,9 @@
+Minizip is a library provided by //third_party/zlib [1]. Its zip and unzip
+tools can be built in a developer checkout for testing purposes with:
+
+```shell
+ autoninja -C out/Release minizip_bin
+ autoninja -C out/Release miniunz_bin
+```
+
+[1] Upstream is https://github.com/madler/zlib/tree/master/contrib/minizip