Monday, June 05, 2023

Re: UPDATE: graphics/zxing

On 2023/06/04 12:49, Stuart Henderson wrote:
> On 2023/06/04 11:01, Rafael Sadowski wrote:
> > On Sun Jun 04, 2023 at 09:38:46AM +0200, Rafael Sadowski wrote:
> > > Hi Stuart, Hi ports@,
> > >
> > > I would like to update zxing because I need zxing>=2.0 as a dependency
> > > for KDE Gear 23.04 (kitinerary). Looks like our zxing port is pretty
> > > old. The disadvantage of these update is the loss of bin/zxing.
> > >
> > > Looks like nothing depends on it expect kitinerary.
> > >
> > > Do we need BUILD_PYTHON_MODULE enabled?
> >
> > After feedback from Stuart, thanks:
> >
> > - Remove includes, shared libs ... from current port and build a static
> > linked zxing binary (Tests are still passed).
> > - Add a new port graphics/zxing-cpp (attached)
>
> Thanks, this reads good to me, I'm away atm but will test soon.

The new port and graphics/zxing diffs are OK sthen@.

If you wish to build the ZXingReader/ZXingWriter tools it can be
done like this, but they're not a replacement for the binary in the
old zxing, QR code detection is worse in the files I need to use this
with.

diff -uNp -r zxing-cpp.orig/Makefile zxing-cpp/Makefile
--- zxing-cpp.orig/Makefile Sun Jun 4 09:53:12 2023
+++ zxing-cpp/Makefile Mon Jun 5 13:01:51 2023
@@ -3,6 +3,9 @@ COMMENT= C++ barcode image processing library
GH_ACCOUNT= zxing-cpp
GH_PROJECT= zxing-cpp
GH_TAGNAME= v2.0.0
+DISTFILES= ${GH_DISTFILE} \
+ stb-20230129-5736b15{5736b15f7ea0ffb08dd38af21067c314d6a3aae9}.tar.gz:0
+MASTER_SITES0= https://github.com/nothings/stb/archive/

SHARED_LIBS += ZXing 0.0 # 0.0

@@ -16,7 +19,7 @@ PERMIT_PACKAGE= Yes
# C++17
COMPILER= base-clang ports-gcc

-WANTLIB += ${COMPILER_LIBCXX} m
+WANTLIB += ${COMPILER_LIBCXX} c m

MODULES= devel/cmake

@@ -27,10 +30,9 @@ BUILD_DEPENDS= devel/gtest
CONFIGURE_ARGS= -DCMAKE_LIBRARY_PATH=${LOCALBASE}/lib \
-DBUILD_UNIT_TESTS=yes

-CONFIGURE_ARGS += -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON \
- -DBUILD_DEPENDENCIES=LOCAL
+CONFIGURE_ARGS += -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON

-# Depends on stb
-CONFIGURE_ARGS += -DBUILD_EXAMPLES=OFF
+post-extract:
+ mv ${WRKDIR}/stb-* ${WRKSRC}/example/stb

.include <bsd.port.mk>
diff -uNp -r zxing-cpp.orig/distinfo zxing-cpp/distinfo
--- zxing-cpp.orig/distinfo Sun Jun 4 09:41:13 2023
+++ zxing-cpp/distinfo Mon Jun 5 12:52:51 2023
@@ -1,2 +1,4 @@
+SHA256 (stb-20230129-5736b15.tar.gz) = 0Akh1JsGr2Kqa/uXwbE2vsZh3RHdTuy8sNofbafO20w=
SHA256 (zxing-cpp-2.0.0.tar.gz) = ErdrcAXDDTQmX8IDVtNA2hebC01D0sGzW8yoZ3YGn3Y=
+SIZE (stb-20230129-5736b15.tar.gz) = 1393071
SIZE (zxing-cpp-2.0.0.tar.gz) = 856413
diff -uNp -r zxing-cpp.orig/patches/patch-zxing_cmake zxing-cpp/patches/patch-zxing_cmake
--- zxing-cpp.orig/patches/patch-zxing_cmake Thu Jan 1 01:00:00 1970
+++ zxing-cpp/patches/patch-zxing_cmake Mon Jun 5 12:50:29 2023
@@ -0,0 +1,17 @@
+Index: zxing.cmake
+--- zxing.cmake.orig
++++ zxing.cmake
+@@ -11,12 +11,8 @@ macro(zxing_add_package_stb)
+ endif()
+
+ if (NOT STB_FOUND)
+- include(FetchContent)
+- FetchContent_Declare (stb
+- GIT_REPOSITORY https://github.com/nothings/stb.git)
+- FetchContent_MakeAvailable (stb)
+ add_library(stb::stb INTERFACE IMPORTED)
+- target_include_directories(stb::stb INTERFACE ${stb_SOURCE_DIR})
++ target_include_directories(stb::stb INTERFACE stb)
+ else()
+ add_library(stb::stb ALIAS PkgConfig::STB)
+ endif()
diff -uNp -r zxing-cpp.orig/pkg/PLIST zxing-cpp/pkg/PLIST
--- zxing-cpp.orig/pkg/PLIST Sun Jun 4 09:41:13 2023
+++ zxing-cpp/pkg/PLIST Mon Jun 5 13:01:18 2023
@@ -1,3 +1,5 @@
+@bin bin/ZXingReader
+@bin bin/ZXingWriter
include/ZXing/
include/ZXing/BarcodeFormat.h
include/ZXing/BitHacks.h

No comments:

Post a Comment