Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into tools
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal committed Oct 23, 2024
2 parents b183ea6 + 76ca355 commit 6defa28
Show file tree
Hide file tree
Showing 220 changed files with 3,303 additions and 1,068 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ file(GLOB VCPKG_TEST_INCLUDES CONFIGURE_DEPENDS "include/vcpkg-test/*.h")

set(VCPKG_FUZZ_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg-fuzz/main.cpp")
set(TLS12_DOWNLOAD_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/tls12-download.c")
set(CLOSES_EXIT_MINUS_ONE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/closes-exit-minus-one.c")
set(CLOSES_STDIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/closes-stdin.c")
set(CLOSES_STDOUT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/closes-stdout.c")
set(READS_STDIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/reads-stdin.c")
Expand Down Expand Up @@ -500,7 +501,7 @@ if (BUILD_TESTING)
target_link_libraries(vcpkg-test PRIVATE log)
endif()

add_dependencies(vcpkg-test reads-stdin closes-stdin closes-stdout test-editor)
add_dependencies(vcpkg-test reads-stdin closes-exit-minus-one closes-stdin closes-stdout test-editor)

if(CMAKE_VERSION GREATER_EQUAL "3.16")
target_precompile_headers(vcpkg-test REUSE_FROM vcpkglib)
Expand Down Expand Up @@ -534,6 +535,11 @@ if(VCPKG_BUILD_TLS12_DOWNLOADER)
endif()

if (BUILD_TESTING)
# === Target: closes-exit-minus-one ===

add_executable(closes-exit-minus-one ${CLOSES_EXIT_MINUS_ONE_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg.manifest")
set_property(TARGET closes-exit-minus-one PROPERTY PDB_NAME "closes-exit-minus-one${VCPKG_PDB_SUFFIX}")

# === Target: closes-stdin ===

add_executable(closes-stdin ${CLOSES_STDIN_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg.manifest")
Expand Down Expand Up @@ -585,7 +591,7 @@ if(CLANG_FORMAT)
COMMAND "${CLANG_FORMAT}" -i -verbose ${VCPKG_TEST_INCLUDES}

COMMAND "${CLANG_FORMAT}" -i -verbose ${VCPKG_FUZZ_SOURCES} ${TLS12_DOWNLOAD_SOURCES}
${CLOSES_STDIN_SOURCES} ${CLOSES_STDOUT_SOURCES} ${READS_STDIN_SOURCES}
${CLOSES_STDIN_SOURCES} ${CLOSES_STDOUT_SOURCES} ${READS_STDIN_SOURCES} ${CLOSES_EXIT_MINUS_ONE_SOURCES}
${TEST_EDITOR_SOURCES} ${TEST_SCRIPT_ASSET_CACHE_SOURCES}
)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ if("native" IN_LIST FEATURES)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/test.py" "${CURRENT_INSTALLED_DIR_NATIVE}")
endif()

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME cmake-config-many-targets)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME hello-world-1)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME hello-world-2)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/../../../LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/zconf.h.cmakein b/zconf.h.cmakein
index a7f24cc..a1b359b 100644
--- a/zconf.h.cmakein
+++ b/zconf.h.cmakein
@@ -434,11 +434,19 @@ typedef uLong FAR uLongf;
#endif

#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_UNISTD_H
+# if ~(~HAVE_UNISTD_H + 0) == 0 && ~(~HAVE_UNISTD_H + 1) == 1
+# define Z_HAVE_UNISTD_H
+# elif HAVE_UNISTD_H != 0
+# define Z_HAVE_UNISTD_H
+# endif
#endif

#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_STDARG_H
+# if ~(~HAVE_STDARG_H + 0) == 0 && ~(~HAVE_STDARG_H + 1) == 1
+# define Z_HAVE_STDARG_H
+# elif HAVE_STDARG_H != 0
+# define Z_HAVE_STDARG_H
+# endif
#endif

#ifdef STDC
diff --git a/zconf.h.in b/zconf.h.in
index 5e1d68a..32f53c8 100644
--- a/zconf.h.in
+++ b/zconf.h.in
@@ -432,11 +432,19 @@ typedef uLong FAR uLongf;
#endif

#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_UNISTD_H
+# if ~(~HAVE_UNISTD_H + 0) == 0 && ~(~HAVE_UNISTD_H + 1) == 1
+# define Z_HAVE_UNISTD_H
+# elif HAVE_UNISTD_H != 0
+# define Z_HAVE_UNISTD_H
+# endif
#endif

#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_STDARG_H
+# if ~(~HAVE_STDARG_H + 0) == 0 && ~(~HAVE_STDARG_H + 1) == 1
+# define Z_HAVE_STDARG_H
+# elif HAVE_STDARG_H != 0
+# define Z_HAVE_STDARG_H
+# endif
#endif

#ifdef STDC

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Source: zlib
Version: 1.2.11
Port-Version: 8
Homepage: https://www.zlib.net/
Description: A compression library
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
[email protected] [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fe939d..e4fc213 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,7 +59,7 @@ endif()
#
check_include_file(unistd.h Z_HAVE_UNISTD_H)

-if(MSVC)
+if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fe939d..a1291d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@ set(VERSION "1.2.11")

option(ASM686 "Enable building i686 assembly implementation")
option(AMD64 "Enable building amd64 assembly implementation")
+option(SKIP_BUILD_EXAMPLES "Skip build of the examples" OFF)

set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
@@ -124,9 +125,11 @@ set(ZLIB_SRCS
)

if(NOT MINGW)
- set(ZLIB_DLL_SRCS
- win32/zlib1.rc # If present will override custom build rule below.
- )
+ if(BUILD_SHARED_LIBS)
+ set(ZLIB_DLL_SRCS
+ win32/zlib1.rc # If present will override custom build rule below.
+ )
+ endif()
endif()

if(CMAKE_COMPILER_IS_GNUCC)
@@ -180,11 +183,12 @@ if(MINGW)
-I ${CMAKE_CURRENT_BINARY_DIR}
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
- set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
+ if(BUILD_SHARED_LIBS)
+ set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
+ endif()
endif(MINGW)

-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
+add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)

@@ -201,7 +205,7 @@ endif()

if(UNIX)
# On unix-like platforms the library is almost always called libz
- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
+ set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
@@ -211,7 +215,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32)
endif()

if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
- install(TARGETS zlib zlibstatic
+ install(TARGETS zlib
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
@@ -230,6 +234,7 @@ endif()
# Example binaries
#============================================================================

+if (NOT SKIP_BUILD_EXAMPLES)
add_executable(example test/example.c)
target_link_libraries(example zlib)
add_test(example example)
@@ -247,3 +252,4 @@ if(HAVE_OFF64_T)
target_link_libraries(minigzip64 zlib)
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
endif()
+endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
set(VERSION 1.2.11)

vcpkg_download_distfile(ARCHIVE_FILE
URLS "http://www.zlib.net/zlib-${VERSION}.tar.gz" "https://downloads.sourceforge.net/project/libpng/zlib/${VERSION}/zlib-${VERSION}.tar.gz"
FILENAME "zlib1211.tar.gz"
SHA512 73fd3fff4adeccd4894084c15ddac89890cd10ef105dd5e1835e1e9bbb6a49ff229713bd197d203edfa17c2727700fce65a2a235f07568212d820dca88b528ae
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE_FILE}
REF ${VERSION}
PATCHES
"cmake_dont_build_more_than_needed.patch"
"0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch"
"add_debug_postfix_on_mingw.patch"
)

# This is generated during the cmake build
file(REMOVE ${SOURCE_PATH}/zconf.h)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DSKIP_INSTALL_FILES=ON
-DSKIP_BUILD_EXAMPLES=ON
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
)

vcpkg_install_cmake()

# Install the pkgconfig file
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string(${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/zlib.pc "-lz" "-lzlib")
endif()
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/zlib.pc DESTINATION ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string(${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/zlib.pc "-lz" "-lzlibd")
endif()
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/zlib.pc DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
endif()

vcpkg_fixup_pkgconfig()

file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

vcpkg_copy_pdbs()

file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package zlib is compatible with built-in CMake targets:

find_package(ZLIB REQUIRED)
target_link_libraries(main PRIVATE ZLIB::ZLIB)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/zconf.h.cmakein b/zconf.h.cmakein
index a7f24cc..a1b359b 100644
--- a/zconf.h.cmakein
+++ b/zconf.h.cmakein
@@ -434,11 +434,19 @@ typedef uLong FAR uLongf;
#endif

#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_UNISTD_H
+# if ~(~HAVE_UNISTD_H + 0) == 0 && ~(~HAVE_UNISTD_H + 1) == 1
+# define Z_HAVE_UNISTD_H
+# elif HAVE_UNISTD_H != 0
+# define Z_HAVE_UNISTD_H
+# endif
#endif

#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_STDARG_H
+# if ~(~HAVE_STDARG_H + 0) == 0 && ~(~HAVE_STDARG_H + 1) == 1
+# define Z_HAVE_STDARG_H
+# elif HAVE_STDARG_H != 0
+# define Z_HAVE_STDARG_H
+# endif
#endif

#ifdef STDC
diff --git a/zconf.h.in b/zconf.h.in
index 5e1d68a..32f53c8 100644
--- a/zconf.h.in
+++ b/zconf.h.in
@@ -432,11 +432,19 @@ typedef uLong FAR uLongf;
#endif

#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_UNISTD_H
+# if ~(~HAVE_UNISTD_H + 0) == 0 && ~(~HAVE_UNISTD_H + 1) == 1
+# define Z_HAVE_UNISTD_H
+# elif HAVE_UNISTD_H != 0
+# define Z_HAVE_UNISTD_H
+# endif
#endif

#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_STDARG_H
+# if ~(~HAVE_STDARG_H + 0) == 0 && ~(~HAVE_STDARG_H + 1) == 1
+# define Z_HAVE_STDARG_H
+# elif HAVE_STDARG_H != 0
+# define Z_HAVE_STDARG_H
+# endif
#endif

#ifdef STDC

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Source: zlib
Version: 1.2.11
Port-Version: 8
Homepage: https://www.zlib.net/
Description: A compression library
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
[email protected] [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fe939d..e4fc213 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,7 +59,7 @@ endif()
#
check_include_file(unistd.h Z_HAVE_UNISTD_H)

-if(MSVC)
+if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
Loading

0 comments on commit 6defa28

Please sign in to comment.