Skip to content

Commit a0973d4

Browse files
authored
Bump libzip to 1.6.1 (#49)
In order to build libzip 1.6.1 we had to switch over to using an actual Windows machine. This was because libzip now no longer compiles in mingw. To help with this we are using the excellent [vcpkg](https://github.com/Microsoft/vcpkg) project. This project helps us grab and install dependencies in a cross platform manner. However it is only used on windows at the moment.
1 parent dc90442 commit a0973d4

File tree

8 files changed

+115
-30
lines changed

8 files changed

+115
-30
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "external/libzip"]
22
path = external/libzip
33
url = https://github.com/nih-at/libzip.git
4+
[submodule "external/vcpkg"]
5+
path = external/vcpkg
6+
url = https://github.com/Microsoft/vcpkg

LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="$(MSBuildThisFileDirectory)..\LibZipSharp.props" />
33
<PropertyGroup>
4-
<TargetFramework>net471</TargetFramework>
4+
<TargetFrameworks>net471</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows')) And $([MSBuild]::IsOsPlatform('Linux'))">$(TargetFrameworks);netcoreapp3.1</TargetFrameworks>
56

67
<IsPackable>false</IsPackable>
78
<LibZipSharpBundleAllNativeLibraries>true</LibZipSharpBundleAllNativeLibraries>
89
<ReferenceNuget Condition="'$(ReferenceNuget)' == ''">False</ReferenceNuget>
910
</PropertyGroup>
1011

1112
<ItemGroup>
12-
<PackageReference Include="nunit" Version="3.10.1" />
13-
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
13+
<PackageReference Include="nunit" Version="3.12.0" />
14+
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
1415
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
1516
<PackageReference Include="Xamarin.LibZipSharp" Version="$(_LibZipSharpNugetVersion)" Condition="'$(ReferenceNuget)' == 'True'" />
16-
<PackageReference Include="NUnit.ConsoleRunner" Version="3.10.0" />
17+
<PackageReference Include="NUnit.ConsoleRunner" Version="3.11.1" />
1718
</ItemGroup>
1819

1920
<ItemGroup>
@@ -32,8 +33,8 @@
3233
<PropertyGroup>
3334
<Host Condition="'$(OS)' != 'Windows_NT'">mono </Host>
3435
</PropertyGroup>
35-
<Exec Command="$(Host)$(NuGetPackageRoot)nunit.consolerunner/3.10.0/tools/nunit3-console.exe LibZipSharp.UnitTest.dll"
36-
WorkingDirectory="$(OutputPath)"
36+
<Exec Command="$(Host)$(NuGetPackageRoot)/nunit.consolerunner/3.11.1/tools/nunit3-console.exe LibZipSharp.UnitTest.dll"
37+
WorkingDirectory="$(OutputPath)net471"
3738
/>
3839
</Target>
3940
</Project>

LibZipSharp.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<_LibZipSharpNugetVersion>1.0.10</_LibZipSharpNugetVersion>
3+
<_LibZipSharpNugetVersion>1.0.11</_LibZipSharpNugetVersion>
44
</PropertyGroup>
55
</Project>

azure-pipelines.yml

Lines changed: 94 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,51 @@ variables:
1414
stages:
1515
- stage: Build
1616
jobs:
17+
- job: buildWindows
18+
pool:
19+
vmImage: vs2017-win2016
20+
steps:
21+
- script: |
22+
echo "Hello"
23+
git submodule update --init --recursive
24+
cd external/vcpkg
25+
bootstrap-vcpkg.bat
26+
displayName: "Build vcpkg"
27+
- script: |
28+
external\vcpkg\vcpkg.exe integrate install
29+
external\vcpkg\vcpkg.exe install zlib:x64-windows-static bzip2:x64-windows-static
30+
mkdir .\build\Windows\64
31+
cd .\build\Windows\64
32+
cmake -DCMAKE_TOOLCHAIN_FILE=..\..\..\external\vcpkg\scripts\buildsystems\vcpkg.cmake ..\..\..\external\libzip -G "Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=on -DVCPKG_TARGET_TRIPLET=x64-windows-static
33+
cmake --build . --config Release
34+
displayName: "x64 Build"
35+
- script: |
36+
external\vcpkg\vcpkg.exe integrate install
37+
external\vcpkg\vcpkg.exe install zlib:x86-windows-static bzip2:x86-windows-static
38+
mkdir .\build\Windows\32
39+
cd .\build\Windows\32
40+
cmake -DCMAKE_TOOLCHAIN_FILE=..\..\..\external\vcpkg\scripts\buildsystems\vcpkg.cmake ..\..\..\external\libzip -G "Visual Studio 15 2017" -DBUILD_SHARED_LIBS=on -DVCPKG_TARGET_TRIPLET=x86-windows-static
41+
cmake --build . --config Release
42+
displayName: "x86 Build"
43+
- task: ArchiveFiles@2
44+
inputs:
45+
rootFolderOrFile: build\Windows\64\lib\Release\zip.dll
46+
includeRootFolder: false
47+
archiveType: 7z
48+
replaceExistingArchive: true
49+
archiveFile: $(Build.ArtifactStagingDirectory)\libzip-windows-x86.7z
50+
- task: ArchiveFiles@2
51+
inputs:
52+
rootFolderOrFile: build\Windows\64\lib\Release\zip.dll
53+
includeRootFolder: false
54+
archiveType: 7z
55+
replaceExistingArchive: true
56+
archiveFile: $(Build.ArtifactStagingDirectory)\libzip-windows-x64.7z
57+
- task: PublishBuildArtifacts@1
58+
displayName: upload artifacts
59+
inputs:
60+
artifactName: 'native'
61+
pathtoPublish: $(Build.ArtifactStagingDirectory)
1762
- job: buildlinux
1863
pool:
1964
vmImage: ubuntu-16.04
@@ -36,14 +81,14 @@ stages:
3681
displayName: 'Build Linux x86'
3782
- task: ArchiveFiles@2
3883
inputs:
39-
rootFolderOrFile: build/Linux/32/lib/libzip.so.5.0
84+
rootFolderOrFile: build/Linux/32/lib/libzip.so.5.1
4085
includeRootFolder: false
4186
archiveType: 7z
4287
replaceExistingArchive: true
4388
archiveFile: $(Build.ArtifactStagingDirectory)/libzip-linux-x86.7z
4489
- task: ArchiveFiles@2
4590
inputs:
46-
rootFolderOrFile: build/Linux/64/lib/libzip.so.5.0
91+
rootFolderOrFile: build/Linux/64/lib/libzip.so.5.1
4792
includeRootFolder: false
4893
archiveType: 7z
4994
replaceExistingArchive: true
@@ -54,21 +99,23 @@ stages:
5499
artifactName: 'native'
55100
pathtoPublish: $(Build.ArtifactStagingDirectory)
56101
- job: build
57-
dependsOn: buildlinux
102+
dependsOn:
103+
- buildlinux
104+
- buildWindows
58105
pool:
59-
vmImage: xcode9-macos10.13
106+
vmImage: macOS-10.14
60107
steps:
61108
- bash: |
62-
brew tap xamarin/xamarin-android-windeps
63-
brew upgrade https://raw.githubusercontent.com/Homebrew/homebrew-core/a6542037a48a55061a4c319e6bb174b3715f7cbe/Formula/mingw-w64.rb
64-
brew install mingw-w64 p7zip
65-
brew install ninja xamarin/xamarin-android-windeps/mingw-zlib
109+
brew install p7zip ninja
66110
git submodule update --init --recursive
67111
- bash: |
68112
HOSTOS=Darwin ./build_native
69-
./build_windows
113+
displayName: 'Build Darwin'
114+
- bash: |
70115
mkdir -p build/Linux/64
71116
mkdir -p build/Linux/32
117+
mkdir -p build/Windows/64
118+
mkdir -p build/Windows/32
72119
find build/* | grep libzip
73120
- task: DownloadBuildArtifacts@0
74121
displayName: download artifacts
@@ -85,10 +132,23 @@ stages:
85132
inputs:
86133
archiveFilePatterns: $(Build.ArtifactStagingDirectory)/native/libzip-linux-x86.7z
87134
destinationFolder: build/Linux/32
135+
- task: ExtractFiles@1
136+
displayName: Extract 64 bit Windows native
137+
inputs:
138+
archiveFilePatterns: $(Build.ArtifactStagingDirectory)/native/libzip-windows-x64.7z
139+
destinationFolder: build/Windows/64
140+
- task: ExtractFiles@1
141+
displayName: Extract 32 bit Windows native
142+
inputs:
143+
archiveFilePatterns: $(Build.ArtifactStagingDirectory)/native/libzip-windows-x86.7z
144+
destinationFolder: build/Windows/32
88145
- bash: |
89-
mv build/Linux/32/libzip.so.5.0 build/Linux/32/libzip.so
90-
mv build/Linux/64/libzip.so.5.0 build/Linux/64/libzip.so
146+
mv build/Linux/32/libzip.so.5.1 build/Linux/32/libzip.so
147+
mv build/Linux/64/libzip.so.5.1 build/Linux/64/libzip.so
148+
mv build/Windows/32/zip.dll build/Windows/32/libzip.dll
149+
mv build/Windows/64/zip.dll build/Windows/64/libzip.dll
91150
rm $(Build.ArtifactStagingDirectory)/native/libzip-linux-*.7z
151+
rm $(Build.ArtifactStagingDirectory)/native/libzip-windows-*.7z
92152
displayName: 'Find libzip'
93153
- task: MSBuild@1
94154
displayName: 'Build solution libZipSharp.csproj'
@@ -136,22 +196,37 @@ stages:
136196
solution: LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj
137197
configuration: Release
138198
msbuildArguments: /restore /t:RunNunitTests /p:ReferenceNuget=True /v:diag
199+
- task: DotNetCoreCLI@2
200+
displayName: "Run Tests under .net Core"
201+
inputs:
202+
command: test
203+
projects: 'LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj'
204+
arguments: '--configuration Release --framework netcoreapp3.1 --no-build'
139205
- job: testmacos
140206
displayName: 'Test MacOS'
141207
pool:
142-
vmImage: xcode9-macos10.13
208+
vmImage: macOS-10.14
143209
steps:
144210
- task: DownloadBuildArtifacts@0
145211
displayName: download artifacts
146212
inputs:
147213
artifactName: NuGet
148214
downloadPath: $(Build.SourcesDirectory)
215+
- task: UseDotNet@2
216+
inputs:
217+
version: '3.1.x'
149218
- task: MSBuild@1
150219
displayName: 'Build solution LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj'
151220
inputs:
152221
solution: LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj
153222
configuration: Release
154223
msbuildArguments: /restore /t:RunNunitTests /p:ReferenceNuget=True /v:diag
224+
# - task: DotNetCoreCLI@2
225+
# displayName: "Run Tests under .net Core"
226+
# inputs:
227+
# command: test
228+
# projects: 'LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj'
229+
# arguments: '--configuration Release --framework netcoreapp3.1 --no-build'
155230
- job: testwindows
156231
displayName: 'Test Windows'
157232
pool:
@@ -163,11 +238,17 @@ stages:
163238
artifactName: NuGet
164239
downloadPath: $(Build.SourcesDirectory)
165240
- task: MSBuild@1
166-
displayName: 'Build solution LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj'
241+
displayName: 'Build solution LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj and Run tests'
167242
inputs:
168243
solution: LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj
169244
configuration: Release
170245
msbuildArguments: /restore /t:RunNunitTests /p:ReferenceNuget=True /v:diag
246+
- task: DotNetCoreCLI@2
247+
displayName: "Run Tests under .net Core"
248+
inputs:
249+
command: test
250+
projects: 'LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj'
251+
arguments: '--configuration Release --framework netcoreapp3.1 --no-build'
171252
- stage: Publish
172253
dependsOn: Test
173254
condition: eq(variables['System.TeamProject'], 'devdiv') # only sign the packages when running on Windows, and using the private server which has the certificates

external/libzip

Submodule libzip updated 424 files

external/vcpkg

Submodule vcpkg added at 7365cd7

libZipSharp.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
<Link>libZipSharp.dll.config</Link>
4444
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4545
</None>
46-
<None Include="build\Darwin\64\lib\libzip.5.0.dylib" PackagePath="runtimes\osx\native\libzip.dylib" Pack="true" />
47-
<None Include="build\Windows\64\lib\libzip.dll" PackagePath="runtimes\win-x64\native\libzip.dll" Pack="true" />
48-
<None Include="build\Windows\32\lib\libzip.dll" PackagePath="runtimes\win-x86\native\libzip.dll" Pack="true" />
46+
<None Include="build\Darwin\64\lib\libzip.5.1.dylib" PackagePath="runtimes\osx\native\libzip.dylib" Pack="true" />
47+
<None Include="build\Windows\64\libzip.dll" PackagePath="runtimes\win-x64\native\libzip.dll" Pack="true" />
48+
<None Include="build\Windows\32\libzip.dll" PackagePath="runtimes\win-x86\native\libzip.dll" Pack="true" />
4949
<None Include="build\Linux\64\libzip.so" PackagePath="runtimes\linux-x64\native\libzip.so" Pack="true" />
5050
<None Include="build\Linux\32\libzip.so" PackagePath="runtimes\linux-x86\native\libzip.so" Pack="true" />
5151
<None Include="LICENSE" PackagePath="Licences" Pack="true" />

libzip-static.patch

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
22
index 92c4becc..e58b7db3 100644
33
--- a/lib/CMakeLists.txt
44
+++ b/lib/CMakeLists.txt
5-
@@ -211,7 +211,7 @@ ENDIF()
6-
7-
ADD_LIBRARY(zip ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPTIONAL_FILES} ${LIBZIP_OPSYS_FILES})
8-
SET_TARGET_PROPERTIES(zip PROPERTIES VERSION 5.0 SOVERSION 5)
9-
-TARGET_LINK_LIBRARIES(zip ${ZLIB_LIBRARY} ${OPTIONAL_LIBRARY})
10-
+TARGET_LINK_LIBRARIES(zip ${ZLIB_LIBRARY} ${OPTIONAL_LIBRARY} OpenSSL::Crypto -ldl -pthread)
5+
@@ -228,7 +228,7 @@ ENDIF()
6+
7+
8+
-TARGET_LINK_LIBRARIES(zip PRIVATE ${ZLIB_LIBRARIES} ${OPTIONAL_LIBRARY})
9+
+TARGET_LINK_LIBRARIES(zip PRIVATE ${ZLIB_LIBRARY} ${OPTIONAL_LIBRARY} OpenSSL::Crypto -ldl -pthread)
1110
INSTALL(TARGETS zip
1211
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
1312
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}

0 commit comments

Comments
 (0)