Skip to content

Commit

Permalink
[zint] Initial port (microsoft#27836)
Browse files Browse the repository at this point in the history
  • Loading branch information
koprok authored Nov 23, 2022
1 parent cb76ac9 commit 5fe0ac0
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ports/zint/0001-fix-static-lib.patch
Original file line number Diff line number Diff line change
@@ -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)
28 changes: 28 additions & 0 deletions ports/zint/0002-install-export.patch
Original file line number Diff line number Diff line change
@@ -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
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
+)
+
+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()
13 changes: 13 additions & 0 deletions ports/zint/0003-fix-parallel-configure.patch
Original file line number Diff line number Diff line change
@@ -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)
44 changes: 44 additions & 0 deletions ports/zint/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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")
5 changes: 5 additions & 0 deletions ports/zint/unofficial-zint-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if(@ZINT_USE_PNG@)
include(CMakeFindDependencyMacro)
find_dependency(PNG)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-zint-targets.cmake")
25 changes: 25 additions & 0 deletions ports/zint/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
1 change: 1 addition & 0 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions versions/z-/zint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "4877dc23ac1534d68383a3297eb1c44560a4d1e5",
"version": "2.11.1",
"port-version": 0
}
]
}

0 comments on commit 5fe0ac0

Please sign in to comment.