From c87c61763fd041d56d2f43df3eb09938e254ad3b Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Tue, 29 May 2018 14:13:13 +0200 Subject: [PATCH] Bump to lipzip/rel-1-5-1/b95cf3fd (#1721) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps to LibZipSharp/master/4d3e59c8 Main reason is to include fixes for a couple CVEs. Changes: * 1.3.0 * Support bzip2 compressed zip archives * Improve file progress callback code * Fix `zip_fdopen()` * CVE-2017-12858: Fix double `free()`. * CVE-2017-14107: Improve EOCD64 parsing. * 1.3.1 * Install `zipconf.h` into `${PREFIX}/include` * Add `zip_libzip_version()` * Fix AES tests on Linux * 1.3.2 * Fix bug introduced in last: `zip_t` was erroneously freed if `zip_close()` failed. * 1.4.0 * Improve build with `cmake` * Retire autoconf/automake build system * Add `zip_source_buffer_fragment()`. * Add support to clone unchanged beginning of archive (instead of rewriting it). Supported for buffer sources and on Apple File System. * Add support for Microsoft Universal Windows Platform. * 1.5.0 * Use standard cryptographic library instead of custom AES implementation. This also simplifies the license. * Use clang-format to format the source code. * More Windows improvements. * 1.5.1 * Choose format of installed documentation based on available tools. * Fix visibility of symbols. * Fix zipcmp directory support. * Don’t set RPATH on Linux. * Use Libs.private for link dependencies in pkg-config file. * Fix build with LibreSSL. * Various bugfixes. Additionally: * make it possible to build Windows version of libzip on Linux with mingw (no mxe required) * build on macOS targeting Windows with system/brew cmake * Linux "host" builds *must* use the system `cmake`, to prevent it from using any MXE-cross-compiled versions. * export `MACOSX_DEPLOYMENT_TARGET=10.11` in the top-level Makefile to specify the minimum version of macOS we support. Without this it is possible that code built on 10.11 with Xcode targeting a newer version of the system will not work on macOS older than the version targetted by Xcode being used. For instance, if we build on macOS 10.11 with Xcode 8.2 (which targets macOS 10.12) then the code which just built on 10.11 may not work on this very system - because it may use APIs available only starting from 10.12 --- .gitmodules | 2 +- Makefile | 4 ++++ external/LibZipSharp | 2 +- external/libzip | 2 +- .../Xamarin.ProjectTools.Darwin.projitems | 2 +- src/libzip-windows/libzip-windows.csproj | 2 +- src/libzip-windows/libzip-windows.projitems | 21 +++++++++++++++---- src/libzip-windows/mingw-linux-32.cmake | 20 ++++++++++++++++++ src/libzip-windows/mingw-linux-64.cmake | 20 ++++++++++++++++++ src/libzip/CMakeCacheInitialOSX.txt | 13 ++++++++++++ src/libzip/libzip.projitems | 8 +++---- src/libzip/libzip.targets | 2 +- 12 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 src/libzip-windows/mingw-linux-32.cmake create mode 100644 src/libzip-windows/mingw-linux-64.cmake create mode 100644 src/libzip/CMakeCacheInitialOSX.txt diff --git a/.gitmodules b/.gitmodules index 4c8a5f6ed..f8fca965e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,7 +20,7 @@ [submodule "external/libzip"] path = external/libzip url = https://github.com/nih-at/libzip.git - branch = master + branch = rel-1-5-1 [submodule "external/LibZipSharp"] path = external/LibZipSharp url = https://github.com/grendello/LibZipSharp.git diff --git a/Makefile b/Makefile index 920c9bd7d..071616c0c 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,10 @@ SOLUTION = Xamarin.Android.sln TEST_TARGETS = build-tools/scripts/RunTests.targets API_LEVEL ?= +ifeq ($(OS_NAME),Darwin) +export MACOSX_DEPLOYMENT_TARGET := 10.11 +endif + ifneq ($(V),0) MONO_OPTIONS += --debug endif diff --git a/external/LibZipSharp b/external/LibZipSharp index b7aab1e26..4d3e59c89 160000 --- a/external/LibZipSharp +++ b/external/LibZipSharp @@ -1 +1 @@ -Subproject commit b7aab1e26aed3e0269a73cc6f8ce973169741f76 +Subproject commit 4d3e59c8960562309c817a4c367300e6a20bf9b7 diff --git a/external/libzip b/external/libzip index 1d8b1ac4d..b95cf3fdd 160000 --- a/external/libzip +++ b/external/libzip @@ -1 +1 @@ -Subproject commit 1d8b1ac4d20b8ef8d3f5d496dabebaa0ff9019ff +Subproject commit b95cf3fdd4c1271f922017f092d02a878873425c diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.Darwin.projitems b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.Darwin.projitems index 57a40ae69..e316e8bb0 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.Darwin.projitems +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Xamarin.ProjectTools.Darwin.projitems @@ -1,7 +1,7 @@  - + PreserveNewest diff --git a/src/libzip-windows/libzip-windows.csproj b/src/libzip-windows/libzip-windows.csproj index 647f42326..648df6500 100644 --- a/src/libzip-windows/libzip-windows.csproj +++ b/src/libzip-windows/libzip-windows.csproj @@ -16,7 +16,7 @@ - + ResolveReferences; _BuildUnlessCached diff --git a/src/libzip-windows/libzip-windows.projitems b/src/libzip-windows/libzip-windows.projitems index f77d1cab3..712077bcc 100644 --- a/src/libzip-windows/libzip-windows.projitems +++ b/src/libzip-windows/libzip-windows.projitems @@ -1,15 +1,28 @@ + + \usr\bin\cmake + $(CMakeBinary32) + -DCMAKE_TOOLCHAIN_FILE=$(MSBuildThisFileDirectory)\mingw-linux-32.cmake + -DCMAKE_TOOLCHAIN_FILE=$(MSBuildThisFileDirectory)\mingw-linux-64.cmake + + + cmake + cmake + -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -DBUILD_SHARED_LIBS=ON + $(CMakeCommonFlags) -DCMAKE_C_COMPILER=$(AndroidMxeFullPath)\bin\$(MingwCommandPrefix32)-gcc -DCMAKE_CXX_COMPILER=$(AndroidMxeFullPath)\bin\$(MingwCommandPrefix32)-g++ -DCMAKE_RC_COMPILER=$(AndroidMxeFullPath)\bin\$(MingwCommandPrefix32)-windres -DCMAKE_FIND_ROOT_PATH=$(AndroidMxeFullPath)\$(MingwCommandPrefix32) + $(CMakeCommonFlags) -DCMAKE_C_COMPILER=$(AndroidMxeFullPath)\bin\$(MingwCommandPrefix64)-gcc -DCMAKE_CXX_COMPILER=$(AndroidMxeFullPath)\bin\$(MingwCommandPrefix64)-g++ -DCMAKE_RC_COMPILER=$(AndroidMxeFullPath)\bin\$(MingwCommandPrefix64)-windres -DCMAKE_FIND_ROOT_PATH=$(AndroidMxeFullPath)\$(MingwCommandPrefix64) + <_LibZipTarget Include="host-mxe-Win64" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win64:'))"> - $(AndroidMxeFullPath)\bin\x86_64-w64-mingw32.static-cmake - + $(CMakeBinary64) + $(CMakeFlags64) x64/libzip.dll lib/libzip.dll <_LibZipTarget Include="host-mxe-Win32" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':mxe-Win32:'))"> - $(AndroidMxeFullPath)\bin\i686-w64-mingw32.static-cmake - + $(CMakeBinary32) + $(CMakeFlags32) libzip.dll lib/libzip.dll diff --git a/src/libzip-windows/mingw-linux-32.cmake b/src/libzip-windows/mingw-linux-32.cmake new file mode 100644 index 000000000..c96f47f66 --- /dev/null +++ b/src/libzip-windows/mingw-linux-32.cmake @@ -0,0 +1,20 @@ +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Windows) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc) +SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) +SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(BUILD_SHARED_LIBS ON) diff --git a/src/libzip-windows/mingw-linux-64.cmake b/src/libzip-windows/mingw-linux-64.cmake new file mode 100644 index 000000000..11e55825e --- /dev/null +++ b/src/libzip-windows/mingw-linux-64.cmake @@ -0,0 +1,20 @@ +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Windows) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(BUILD_SHARED_LIBS ON) diff --git a/src/libzip/CMakeCacheInitialOSX.txt b/src/libzip/CMakeCacheInitialOSX.txt new file mode 100644 index 000000000..134f91200 --- /dev/null +++ b/src/libzip/CMakeCacheInitialOSX.txt @@ -0,0 +1,13 @@ +# Force minimum macOS version to be 10.11 as this is the oldest version of the OS we support. +# Setting this on command line won't work, for some reason, so we override the value her +set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "Minimum OS X deployment version" FORCE) + +# This is necessary when cmake runs on a 10.11 system with Xcode 8.x installed in which case +# the headers (and SDK libraries) target a later version of macOS but the host OS might not +# have some functions found. `clonefile` is one of them - it was added in 10.12. Cmake will +# happily "detect" clonefile even though the *host* OS doesn't have it which results in the +# library being build but failing to load. +# +# Forcing a cache entry here will override the detection result, even though cmake will *still* +# show clonefile as found in the detection output. +set(HAVE_CLONEFILE "" CACHE INTERNAL "Force 10.11 compatibility on XA build bots" FORCE) diff --git a/src/libzip/libzip.projitems b/src/libzip/libzip.projitems index 7582776eb..94d3b82ec 100644 --- a/src/libzip/libzip.projitems +++ b/src/libzip/libzip.projitems @@ -3,13 +3,13 @@ <_LibZipTarget Include="host-Darwin" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Darwin:'))"> cmake - -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" - libzip.3.0.dylib - lib/libzip.3.0.dylib + -C$(MSBuildThisFileDirectory)/CMakeCacheInitialOSX.txt -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DBUILD_SHARED_LIBS=ON + libzip.5.0.dylib + lib/libzip.5.0.dylib <_LibZipTarget Include="host-Linux" Condition="$(AndroidSupportedHostJitAbisForConditionalChecks.Contains (':Linux:')) AND '$(_LinuxBuildLibZip)' == 'true' "> cmake - + -DBUILD_SHARED_LIBS=ON libzip.so lib/libzip.so diff --git a/src/libzip/libzip.targets b/src/libzip/libzip.targets index 6f1dc0278..ee0e27734 100644 --- a/src/libzip/libzip.targets +++ b/src/libzip/libzip.targets @@ -45,7 +45,7 @@ Inputs="@(_LibZipTargetMakefile)" Outputs="@(Content)">