Skip to content

Commit

Permalink
x-add-version: Check that port-version is the next integer (#1495)
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal authored Sep 30, 2024
1 parent 48946f6 commit ab89885
Show file tree
Hide file tree
Showing 41 changed files with 760 additions and 142 deletions.

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
jloup@gzip.org madler@alumni.caltech.edu
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
jloup@gzip.org madler@alumni.caltech.edu
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 ab89885

Please sign in to comment.