From 5fe0ac056c2fc175667efd638d1463ba6da0b1a9 Mon Sep 17 00:00:00 2001 From: Todor Prokopov Date: Wed, 23 Nov 2022 20:35:36 +0200 Subject: [PATCH] [zint] Initial port (#27836) --- ports/zint/0001-fix-static-lib.patch | 13 ++++++ ports/zint/0002-install-export.patch | 28 +++++++++++++ ports/zint/0003-fix-parallel-configure.patch | 13 ++++++ ports/zint/portfile.cmake | 44 ++++++++++++++++++++ ports/zint/unofficial-zint-config.cmake.in | 5 +++ ports/zint/vcpkg.json | 25 +++++++++++ scripts/ci.baseline.txt | 1 + versions/baseline.json | 4 ++ versions/z-/zint.json | 9 ++++ 9 files changed, 142 insertions(+) create mode 100644 ports/zint/0001-fix-static-lib.patch create mode 100644 ports/zint/0002-install-export.patch create mode 100644 ports/zint/0003-fix-parallel-configure.patch create mode 100644 ports/zint/portfile.cmake create mode 100644 ports/zint/unofficial-zint-config.cmake.in create mode 100644 ports/zint/vcpkg.json create mode 100644 versions/z-/zint.json diff --git a/ports/zint/0001-fix-static-lib.patch b/ports/zint/0001-fix-static-lib.patch new file mode 100644 index 00000000000..f30f071b26c --- /dev/null +++ b/ports/zint/0001-fix-static-lib.patch @@ -0,0 +1,13 @@ +diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt +index 854674d..d62176b 100644 +--- a/backend/CMakeLists.txt ++++ b/backend/CMakeLists.txt +@@ -13,7 +13,7 @@ set(zint_TWODIM_SRCS code16k.c codablock.c dmatrix.c pdf417.c qr.c maxicode.c co + set(zint_OUTPUT_SRCS vector.c ps.c svg.c emf.c bmp.c pcx.c gif.c png.c tif.c raster.c output.c) + set(zint_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS}) + +-add_library(zint SHARED ${zint_SRCS}) ++add_library(zint ${zint_SRCS}) + + if(WIN32) + target_sources(${PROJECT_NAME} PRIVATE libzint.rc) diff --git a/ports/zint/0002-install-export.patch b/ports/zint/0002-install-export.patch new file mode 100644 index 00000000000..c10c020235e --- /dev/null +++ b/ports/zint/0002-install-export.patch @@ -0,0 +1,28 @@ +diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt +index 854674d..f61a294 100644 +--- a/backend/CMakeLists.txt ++++ b/backend/CMakeLists.txt +@@ -47,7 +47,7 @@ endif() + if(ZINT_USE_PNG AND PNG_FOUND) + zint_target_link_libraries(PNG::PNG) + else() +- zint_target_compile_definitions(PUBLIC NO_PNG) ++ zint_target_compile_definitions(PRIVATE NO_PNG) + endif() + + if(ZINT_TEST) +@@ -63,7 +63,13 @@ if(MSVC) + target_compile_definitions(zint PRIVATE DLL_EXPORT) + endif() + +-install(TARGETS zint ${INSTALL_TARGETS_DEFAULT_ARGS}) ++target_include_directories(zint PUBLIC ++ $ ++ $ ++) ++ ++install(TARGETS zint EXPORT unofficial-zint-targets ${INSTALL_TARGETS_DEFAULT_ARGS}) ++install(EXPORT unofficial-zint-targets NAMESPACE unofficial::zint:: DESTINATION share/unofficial-zint) + if(ZINT_STATIC) + install(TARGETS zint-static ${INSTALL_TARGETS_DEFAULT_ARGS}) + endif() diff --git a/ports/zint/0003-fix-parallel-configure.patch b/ports/zint/0003-fix-parallel-configure.patch new file mode 100644 index 00000000000..cb831fac1e0 --- /dev/null +++ b/ports/zint/0003-fix-parallel-configure.patch @@ -0,0 +1,13 @@ +diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt +index 854674d..c9d7627 100644 +--- a/backend/CMakeLists.txt ++++ b/backend/CMakeLists.txt +@@ -4,8 +4,6 @@ + + project(zint) + +-configure_file(zintconfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/zintconfig.h) +- + set(zint_COMMON_SRCS common.c library.c large.c reedsol.c gs1.c eci.c general_field.c) + set(zint_ONEDIM_SRCS bc412.c code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c) + set(zint_POSTAL_SRCS postal.c auspost.c imail.c mailmark.c) diff --git a/ports/zint/portfile.cmake b/ports/zint/portfile.cmake new file mode 100644 index 00000000000..ad0901f6236 --- /dev/null +++ b/ports/zint/portfile.cmake @@ -0,0 +1,44 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO zint/zint + REF 2.11.1 + SHA512 21dbe5dc99b46f79ac1a819fd4e20de22bee8928da5f6b4883a0767243a8633c65f559ac60328dcd70b75a90438c0047c31c6ace1a10750a2579042f54aa801b + HEAD_REF master + PATCHES + 0001-fix-static-lib.patch + 0002-install-export.patch + 0003-fix-parallel-configure.patch +) + +vcpkg_check_features( + OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + png ZINT_USE_PNG +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DZINT_USE_QT=OFF + -DZINT_TEST=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-zint) +vcpkg_copy_pdbs() + +vcpkg_copy_tools(TOOL_NAMES zint AUTO_CLEAN) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/man") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/apps") + +configure_file( + "${CMAKE_CURRENT_LIST_DIR}/unofficial-zint-config.cmake.in" + "${CURRENT_PACKAGES_DIR}/share/unofficial-zint/unofficial-zint-config.cmake" + @ONLY +) + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/zint/unofficial-zint-config.cmake.in b/ports/zint/unofficial-zint-config.cmake.in new file mode 100644 index 00000000000..cfd0be03d19 --- /dev/null +++ b/ports/zint/unofficial-zint-config.cmake.in @@ -0,0 +1,5 @@ +if(@ZINT_USE_PNG@) + include(CMakeFindDependencyMacro) + find_dependency(PNG) +endif() +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-zint-targets.cmake") diff --git a/ports/zint/vcpkg.json b/ports/zint/vcpkg.json new file mode 100644 index 00000000000..92917100d85 --- /dev/null +++ b/ports/zint/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "zint", + "version": "2.11.1", + "description": "A barcode encoding library supporting over 50 symbologies", + "homepage": "https://github.com/zint/zint", + "license": null, + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "png": { + "description": "Build with PNG support", + "dependencies": [ + "libpng" + ] + } + } +} diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 7e728948f1e..4709d400a41 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1157,6 +1157,7 @@ yara:arm-uwp=fail yara:x64-uwp=fail z3:arm-uwp=fail z3:x64-uwp=fail +zint:x64-osx=fail # clapack is replaced by lapack-reference on the platforms lapack-reference supports clapack:x64-linux=skip diff --git a/versions/baseline.json b/versions/baseline.json index 1f463a1fd88..1255cd8cb28 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8256,6 +8256,10 @@ "baseline": "0.5.5", "port-version": 3 }, + "zint": { + "baseline": "2.11.1", + "port-version": 0 + }, "zkpp": { "baseline": "0.2.3", "port-version": 2 diff --git a/versions/z-/zint.json b/versions/z-/zint.json new file mode 100644 index 00000000000..5d6949c2941 --- /dev/null +++ b/versions/z-/zint.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "4877dc23ac1534d68383a3297eb1c44560a4d1e5", + "version": "2.11.1", + "port-version": 0 + } + ] +}