mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 02:11:58 +08:00
[mchehab-zbar] Add new port (#16113)
* Add mchehab/zbar * Quote all paths Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com> * Update to 0.23.90 * Flip name * Update version registry Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com>
This commit is contained in:
parent
c350275db4
commit
55112eb54a
89
ports/mchehab-zbar/c99.patch
Normal file
89
ports/mchehab-zbar/c99.patch
Normal file
@ -0,0 +1,89 @@
|
||||
diff --git a/zbar/symbol.c b/zbar/symbol.c
|
||||
index 27dbc87..1059a72 100644
|
||||
--- a/zbar/symbol.c
|
||||
+++ b/zbar/symbol.c
|
||||
@@ -100,40 +100,29 @@ const char *zbar_get_orientation_name (zbar_orientation_t orient)
|
||||
|
||||
int _zbar_get_symbol_hash (zbar_symbol_type_t sym)
|
||||
{
|
||||
- static const signed char hash[ZBAR_CODE128 + 1] = {
|
||||
- [0 ... ZBAR_CODE128] = -1,
|
||||
-
|
||||
- /* [ZBAR_FOO] = 0, is empty */
|
||||
- [ZBAR_SQCODE] = 1,
|
||||
- [ZBAR_CODE128] = 2,
|
||||
- [ZBAR_EAN13] = 3,
|
||||
- [ZBAR_UPCA] = 4,
|
||||
- [ZBAR_EAN8] = 5,
|
||||
- [ZBAR_UPCE] = 6,
|
||||
- [ZBAR_ISBN13] = 7,
|
||||
- [ZBAR_ISBN10] = 8,
|
||||
- [ZBAR_CODE39] = 9,
|
||||
- [ZBAR_I25] = 10,
|
||||
- [ZBAR_PDF417] = 11,
|
||||
- [ZBAR_QRCODE] = 12,
|
||||
- [ZBAR_DATABAR] = 13,
|
||||
- [ZBAR_DATABAR_EXP] = 14,
|
||||
- [ZBAR_CODE93] = 15,
|
||||
- [ZBAR_EAN2] = 16,
|
||||
- [ZBAR_EAN5] = 17,
|
||||
- [ZBAR_COMPOSITE] = 18,
|
||||
- [ZBAR_CODABAR] = 19,
|
||||
-
|
||||
- /* Please update NUM_SYMS accordingly */
|
||||
- };
|
||||
- int h;
|
||||
-
|
||||
- assert (sym >= ZBAR_PARTIAL && sym <= ZBAR_CODE128);
|
||||
-
|
||||
- h = hash[sym];
|
||||
- assert (h >= 0 && h < NUM_SYMS);
|
||||
-
|
||||
- return h;
|
||||
+ switch(sym)
|
||||
+ {
|
||||
+ default: return -1;
|
||||
+ case ZBAR_SQCODE: return 1;
|
||||
+ case ZBAR_CODE128: return 2;
|
||||
+ case ZBAR_EAN13: return 3;
|
||||
+ case ZBAR_UPCA: return 4;
|
||||
+ case ZBAR_EAN8: return 5;
|
||||
+ case ZBAR_UPCE: return 6;
|
||||
+ case ZBAR_ISBN13: return 7;
|
||||
+ case ZBAR_ISBN10: return 8;
|
||||
+ case ZBAR_CODE39: return 9;
|
||||
+ case ZBAR_I25: return 10;
|
||||
+ case ZBAR_PDF417: return 11;
|
||||
+ case ZBAR_QRCODE: return 12;
|
||||
+ case ZBAR_DATABAR: return 13;
|
||||
+ case ZBAR_DATABAR_EXP: return 14;
|
||||
+ case ZBAR_CODE93: return 15;
|
||||
+ case ZBAR_EAN2: return 16;
|
||||
+ case ZBAR_EAN5: return 17;
|
||||
+ case ZBAR_COMPOSITE: return 18;
|
||||
+ case ZBAR_CODABAR: return 19;
|
||||
+ }
|
||||
}
|
||||
|
||||
void _zbar_symbol_free (zbar_symbol_t *sym)
|
||||
diff --git a/zbar/window/win.c b/zbar/window/win.c
|
||||
index b949f65..7edcfa2 100644
|
||||
--- a/zbar/window/win.c
|
||||
+++ b/zbar/window/win.c
|
||||
@@ -194,7 +194,7 @@ int _zbar_window_draw_polygon (zbar_window_t *w,
|
||||
win_set_rgb(hdc, rgb);
|
||||
|
||||
point_t org = w->scaled_offset;
|
||||
- POINT gdipts[npts + 1];
|
||||
+ POINT* gdipts = malloc((npts + 1) * sizeof(POINT));
|
||||
int i;
|
||||
for(i = 0; i < npts; i++) {
|
||||
point_t p = window_scale_pt(w, pts[i]);
|
||||
@@ -204,6 +204,7 @@ int _zbar_window_draw_polygon (zbar_window_t *w,
|
||||
gdipts[npts] = gdipts[0];
|
||||
|
||||
Polyline(hdc, gdipts, npts + 1);
|
||||
+ free(gdipts);
|
||||
return(0);
|
||||
}
|
||||
|
13
ports/mchehab-zbar/issue219.patch
Normal file
13
ports/mchehab-zbar/issue219.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/zbar/decoder/databar.c b/zbar/decoder/databar.c
|
||||
index 8cfa848..ffb972e 100644
|
||||
--- a/zbar/decoder/databar.c
|
||||
+++ b/zbar/decoder/databar.c
|
||||
@@ -695,7 +695,7 @@ lookup_sequence (databar_segment_t *seg,
|
||||
seq[i++] = s;
|
||||
}
|
||||
dbprintf(2, "}");
|
||||
- seq[n] = -1;
|
||||
+ if (n<22) {seq[n]=-1;} /* https://github.com/mchehab/zbar/issues/219 */
|
||||
return(fixed < 1);
|
||||
}
|
||||
|
48
ports/mchehab-zbar/portfile.cmake
Normal file
48
ports/mchehab-zbar/portfile.cmake
Normal file
@ -0,0 +1,48 @@
|
||||
if(EXISTS ${CURRENT_INSTALLED_DIR}/share/zbar/copyright)
|
||||
message(FATAL_ERROR "${PORT} conflicts with zbar. Please remove zbar before installing ${PORT}.")
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO mchehab/zbar
|
||||
REF 0.23.90
|
||||
SHA512 d73d71873bec68ee021997512a9edbd223f5f5fe43c66c4dd3502224ba6009be2e5e1714766cb8e1056244673e87e0939ed0319116f61d7371b5ab79fb5e04eb
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
c99.patch
|
||||
issue219.patch
|
||||
windows.patch
|
||||
x64.patch
|
||||
)
|
||||
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
NO_ADDITIONAL_PATHS
|
||||
ADD_BIN_TO_PATH
|
||||
ADDITIONAL_MSYS_PACKAGES findutils gettext gettext-devel liblzma tar xz
|
||||
OPTIONS
|
||||
--disable-video
|
||||
--without-gtk
|
||||
--without-imagemagick
|
||||
--without-java
|
||||
--without-python
|
||||
--without-qt
|
||||
)
|
||||
|
||||
vcpkg_install_make()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(REMOVE_RECURSE
|
||||
"${CURRENT_PACKAGES_DIR}/bin"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE
|
||||
"${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
"${CURRENT_PACKAGES_DIR}/share/doc")
|
||||
|
||||
file(RENAME "${CURRENT_PACKAGES_DIR}/share/zbar" "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
configure_file("${SOURCE_PATH}/COPYING" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
|
11
ports/mchehab-zbar/vcpkg.json
Normal file
11
ports/mchehab-zbar/vcpkg.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "mchehab-zbar",
|
||||
"version": "0.23.90",
|
||||
"description": "ZBar is an open source software suite for reading bar codes from various sources, including webcams. This fork is actively maintained.",
|
||||
"homepage": "https://github.com/mchehab/zbar",
|
||||
"license": "LGPL-2.1-or-later",
|
||||
"supports": "windows & !uwp",
|
||||
"dependencies": [
|
||||
"libiconv"
|
||||
]
|
||||
}
|
68
ports/mchehab-zbar/windows.patch
Normal file
68
ports/mchehab-zbar/windows.patch
Normal file
@ -0,0 +1,68 @@
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index c8fea14..eb0a097 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -55,7 +55,7 @@ AC_DEFINE_UNQUOTED([LIB_VERSION_REVISION],
|
||||
[Library revision])
|
||||
|
||||
AM_CPPFLAGS="-I\$(top_srcdir)/include"
|
||||
-AM_CFLAGS="-Wall -Wno-parentheses"
|
||||
+AM_CFLAGS="-Wall"
|
||||
AM_CXXFLAGS="$AM_CFLAGS"
|
||||
AC_SUBST([AM_CPPFLAGS])
|
||||
AC_SUBST([AM_CFLAGS])
|
||||
diff --git a/zbar/Makefile.am b/zbar/Makefile.am
|
||||
index ca54d01..6c0cd83 100644
|
||||
--- a/zbar/Makefile.am
|
||||
+++ b/zbar/Makefile.am
|
||||
@@ -68,7 +68,7 @@ if WIN32
|
||||
|
||||
libzbar_la_SOURCES += processor/win.c libzbar.rc
|
||||
libzbar_la_CPPFLAGS += -mthreads
|
||||
-libzbar_la_LDFLAGS += -mthreads
|
||||
+libzbar_la_LDFLAGS += -mthreads -Xcompiler -Wl,-DEBUG
|
||||
# FIXME broken
|
||||
libzbar_la_LIBADD += libzbar-rc.lo
|
||||
else
|
||||
diff --git a/zbar/libzbar.rc b/zbar/libzbar.rc
|
||||
index 413635b..c241f82 100644
|
||||
--- a/zbar/libzbar.rc
|
||||
+++ b/zbar/libzbar.rc
|
||||
@@ -17,8 +17,7 @@ VS_VERSION_INFO VERSIONINFO
|
||||
VALUE "InternalName", "libzbar"
|
||||
VALUE "OriginalFilename", "libzbar-" XSTR(LIB_VERSION_MAJOR) ".dll"
|
||||
|
||||
- VALUE "FileVersion", XSTR(LIB_VERSION_MAJOR) "." \
|
||||
- XSTR(LIB_VERSION_MINOR) "." XSTR(LIB_VERSION_REVISION)
|
||||
+ VALUE "FileVersion", XSTR(LIB_VERSION_MAJOR) "." XSTR(LIB_VERSION_MINOR) "." XSTR(LIB_VERSION_REVISION)
|
||||
VALUE "ProductVersion", PACKAGE_VERSION
|
||||
|
||||
VALUE "FileDescription", "Bar code reader library"
|
||||
diff --git a/zbar/processor.h b/zbar/processor.h
|
||||
index d5e9fef..54d6584 100644
|
||||
--- a/zbar/processor.h
|
||||
+++ b/zbar/processor.h
|
||||
@@ -27,7 +27,9 @@
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
-#include <unistd.h>
|
||||
+#ifndef WIN32
|
||||
+# include <unistd.h>
|
||||
+#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
diff --git a/zbar/thread.h b/zbar/thread.h
|
||||
index 96d6415..252d3f2 100644
|
||||
--- a/zbar/thread.h
|
||||
+++ b/zbar/thread.h
|
||||
@@ -35,7 +35,7 @@
|
||||
# define HAVE_THREADS
|
||||
# define ZTHREAD DWORD WINAPI
|
||||
|
||||
-typedef ZTHREAD (zbar_thread_proc_t)(void*);
|
||||
+typedef ZTHREAD zbar_thread_proc_t(void*);
|
||||
|
||||
typedef DWORD zbar_thread_id_t;
|
||||
|
21
ports/mchehab-zbar/x64.patch
Normal file
21
ports/mchehab-zbar/x64.patch
Normal file
@ -0,0 +1,21 @@
|
||||
diff --git a/zbar/decoder.c b/zbar/decoder.c
|
||||
index 7f7336f..e9ffc45 100644
|
||||
--- a/zbar/decoder.c
|
||||
+++ b/zbar/decoder.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <stdlib.h> /* malloc, calloc, free */
|
||||
#include <stdio.h> /* snprintf */
|
||||
#include <string.h> /* memset, strlen */
|
||||
+#include <stddef.h> /* offsetof */
|
||||
|
||||
#include <zbar.h>
|
||||
|
||||
@@ -113,7 +114,7 @@ void zbar_decoder_destroy (zbar_decoder_t *dcode)
|
||||
|
||||
void zbar_decoder_reset (zbar_decoder_t *dcode)
|
||||
{
|
||||
- memset(dcode, 0, (long)&dcode->buf_alloc - (long)dcode);
|
||||
+ memset(dcode, 0, offsetof(zbar_decoder_t, buf_alloc));
|
||||
#if ENABLE_EAN == 1
|
||||
ean_reset(&dcode->ean);
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for windres to rc which do not understand '-i -o --output-format'.
|
||||
# cvtres is invoked by the linker
|
||||
scriptversion=2021-04-02.18; # UTC
|
||||
scriptversion=2022-08-24.12; # UTC
|
||||
|
||||
|
||||
nl='
|
||||
@ -59,67 +59,61 @@ func_file_conv ()
|
||||
func_windres_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
bin=
|
||||
in=
|
||||
out=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
if test -z "$bin"; then
|
||||
bin=$1
|
||||
elif test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
--output-format=*)
|
||||
;;
|
||||
--define*)
|
||||
eat=1
|
||||
set x "$@" "-d $2"
|
||||
shift
|
||||
;;
|
||||
eat=1
|
||||
set -- "$@" "-d $2"
|
||||
;;
|
||||
--include-dir*)
|
||||
eat=1
|
||||
func_file_conv "$2"
|
||||
set x "$@" "-I $file"
|
||||
shift
|
||||
;;
|
||||
eat=1
|
||||
func_file_conv "$2"
|
||||
set -- "$@" "-I $file"
|
||||
;;
|
||||
-o)
|
||||
eat=1
|
||||
func_file_conv "$2"
|
||||
out="$file"
|
||||
echo "OUTPUT:$file"
|
||||
set x "$@"
|
||||
shift
|
||||
;;
|
||||
*.obj)
|
||||
func_file_conv "$1"
|
||||
out="$file"
|
||||
echo "OUTPUT:$file"
|
||||
set x "$@"
|
||||
shift
|
||||
;;
|
||||
--output-format=*)
|
||||
set x "$@"
|
||||
shift
|
||||
;;
|
||||
-i)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
in="$file"
|
||||
echo "INPUT:$file"
|
||||
set x "$@"
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "${1//\\\"/\"}"
|
||||
shift
|
||||
set -- "$@" "${1//\\\"/\"}"
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
# libtool reorders arguments; save unqualified one as input
|
||||
func_file_conv "$1"
|
||||
in="$file"
|
||||
echo "INPUT:$file"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
echo "$@" -fo "$out" "$in"
|
||||
exec "$@" -fo "$out" "$in"
|
||||
echo "$bin" "$@" -fo "$out" "$in"
|
||||
exec "$bin" "$@" -fo "$out" "$in"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -4552,6 +4552,10 @@
|
||||
"baseline": "2.28.1",
|
||||
"port-version": 0
|
||||
},
|
||||
"mchehab-zbar": {
|
||||
"baseline": "0.23.90",
|
||||
"port-version": 0
|
||||
},
|
||||
"mcpp": {
|
||||
"baseline": "2.7.2.14",
|
||||
"port-version": 3
|
||||
|
9
versions/m-/mchehab-zbar.json
Normal file
9
versions/m-/mchehab-zbar.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "7c066057a5c24bbea65e26e9e7519db938a2932e",
|
||||
"version": "0.23.90",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user