Skip to content

Commit 4b0dd5b

Browse files
committed
Bump libzip to 1.6.1 and Patch Mingw compile errors
1 parent dc90442 commit 4b0dd5b

File tree

7 files changed

+112
-20
lines changed

7 files changed

+112
-20
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

azure-pipelines.yml

Lines changed: 70 additions & 10 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:
59106
vmImage: xcode9-macos10.13
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'

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}

libzip-windows.patch

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
2+
index d5bf5804..d80c5b53 100644
3+
--- a/lib/CMakeLists.txt
4+
+++ b/lib/CMakeLists.txt
5+
@@ -164,6 +164,8 @@ SET(LIBZIP_SOURCES
6+
7+
IF(WIN32)
8+
SET(LIBZIP_OPSYS_FILES
9+
+ zip_mkstempm.c
10+
+ zip_random_win32.c
11+
zip_source_win32handle.c
12+
zip_source_win32utf8.c
13+
zip_source_win32w.c
14+
diff --git a/lib/zip_random_win32.c b/lib/zip_random_win32.c
15+
index 16d0f647..ae273b31 100644
16+
--- a/lib/zip_random_win32.c
17+
+++ b/lib/zip_random_win32.c
18+
@@ -72,9 +72,9 @@ zip_random_uint32(void) {
19+
}
20+
21+
if (!seeded) {
22+
- srandom((unsigned int)time(NULL));
23+
+ srand((unsigned int)time(NULL));
24+
}
25+
26+
- return (zip_uint32_t)random();
27+
+ return (zip_uint32_t)rand();
28+
}
29+
#endif

0 commit comments

Comments
 (0)