Re: git: b430a140c818 - main - net-im/purple-gowhatsapp: add WhatsApp plugin for libpurple

From: Daniel Engberg <daniel.engberg.lists_at_pyret.net>
Date: Sat, 20 Jan 2024 22:15:42 UTC
On 2024-01-20T21:30:10.000+01:00, Mikhail Teterin <mi@FreeBSD.org>
wrote:

> The branch main has been updated by mi:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=b430a140c818789ed59ac538a708df67be42fc2a
> 
> commit b430a140c818789ed59ac538a708df67be42fc2a
> 
> Author:     Mikhail Teterin <mi@FreeBSD.org>
> 
> AuthorDate: 2024-01-20 20:29:50 +0000
> 
> Commit:     Mikhail Teterin <mi@FreeBSD.org>
> 
> CommitDate: 2024-01-20 20:29:50 +0000
> 
>     net-im/purple-gowhatsapp: add WhatsApp plugin for libpurple
> 
>     
> 
>     The bulk of the code is implemented in Go, and so some challenges remain.
> 
>     Help would be most welcome.
> 
> ---
> 
>  net-im/Makefile                                |  1 +
> 
>  net-im/purple-gowhatsapp/Makefile              | 49 ++++++++++++++++++++++++++
> 
>  net-im/purple-gowhatsapp/distinfo              |  3 ++
> 
>  net-im/purple-gowhatsapp/files/patch-configure | 27 ++++++++++++++
> 
>  net-im/purple-gowhatsapp/pkg-descr             |  5 +++
> 
>  net-im/purple-gowhatsapp/pkg-plist             |  5 +++
> 
>  6 files changed, 90 insertions(+)
> 
> diff --git a/net-im/Makefile b/net-im/Makefile
> 
> index e55c9365ebf8..63ce6b19620c 100644
> 
> --- a/net-im/Makefile
> 
> +++ b/net-im/Makefile
> 
> @@ -104,6 +104,7 @@
> 
>      SUBDIR += purple-discord
> 
>      SUBDIR += purple-facebook
> 
>      SUBDIR += purple-googlechat
> 
> +    SUBDIR += purple-gowhatsapp
> 
>      SUBDIR += purple-mattermost
> 
>      SUBDIR += purple-plugin-pack
> 
>      SUBDIR += purple-rocketchat
> 
> diff --git a/net-im/purple-gowhatsapp/Makefile b/net-im/purple-gowhatsapp/Makefile
> 
> new file mode 100644
> 
> index 000000000000..c04ecd199d16
> 
> --- /dev/null
> 
> +++ b/net-im/purple-gowhatsapp/Makefile
> 
> @@ -0,0 +1,49 @@
> 
> +PORTNAME=    purple-gowhatsapp
> 
> +DISTVERSIONPREFIX=v
> 
> +DISTVERSION=    1.13.0
> 
> +CATEGORIES=    net-im
> 
> +
> 
> +MAINTAINER=    mi@aldan.algebra.com
> 
> +COMMENT=    WhatsApp plugin for libpurple
> 
> +WWW=        https://github.com/hoehermann/purple-gowhatsapp
> 
> +
> 
> +LICENSE=    GPLv3
> 
> +LICENSE_FILE=    ${WRKSRC}/LICENSE
> 
> +
> 
> +LIB_DEPENDS=    libpurple.so:net-im/libpurple [http://libpurple.so:net-im/libpurple]    \
> 
> +        libopusfile.so:audio/opusfile [http://libopusfile.so:audio/opusfile]
> 
> +
> 
> +USES=    go:no_targets cmake dos2unix
> 
> +
> 
> +OPTIONS_MULTI=            DB-backend
> 
> +OPTIONS_MULTI_DB-backend=    SQLITE3 POSTGRES MYSQL
> 
> +OPTIONS_DEFAULT=SQLITE3
> 
> +.for o in ${OPTIONS_MULTI_DB}
> 
> +$o_DESC=    Support use of $o for storing account information
> 
> +.endfor
> 
> +
> 
> +USE_GITHUB=    yep...
> 
> +GH_ACCOUNT=    hoehermann
> 
> +DOS2UNIX_GLOB=    CMake*.txt
> 
> +
> 
> +CMAKE_ARGS=    -DPURPLE_INCLUDE_DIRS=${LOCALBASE}/include/libpurple    \
> 
> +        -DPURPLE_LIBRARY_DIRS=${LOCALBASE}/lib    \
> 
> +        -DPURPLE_PLUGIN_DIR=${PREFIX}/lib/purple-2 \
> 
> +        -DPURPLE_DATA_DIR=${PREFIX}/share
> 
> +LDFLAGS+=    -L${LOCALBASE}/lib
> 
> +
> 
> +post-patch-POSTGRES-off:
> 
> +    ${REINPLACE_CMD} '/lib\/pq/d' ${WRKSRC}/src/go/login.go
> 
> +
> 
> +post-patch-MYSQL-off:
> 
> +    ${REINPLACE_CMD} '/go-sql-driver\/mysql/d' ${WRKSRC}/src/go/login.go
> 
> +
> 
> +post-patch-SQLIT3-off:
> 
> +    ${REINPLACE_CMD} '/mattn\/go-sqlite3/d' ${WRKSRC}/src/go/login.go
> 
> +
> 
> +# The downloaded Go-files are read-only and the simple rm -f does not work
> 
> +# against them (unless invoked as root). Here we relax the permissions first:
> 
> +pre-clean:
> 
> +    -@${FIND} ${WRKDIR} | ${XARGS} ${CHMOD} u+w
> 
> +
> 
> +.include <bsd.port.mk> [http://bsd.port.mk>];
> 
> diff --git a/net-im/purple-gowhatsapp/distinfo b/net-im/purple-gowhatsapp/distinfo
> 
> new file mode 100644
> 
> index 000000000000..440dd580ed44
> 
> --- /dev/null
> 
> +++ b/net-im/purple-gowhatsapp/distinfo
> 
> @@ -0,0 +1,3 @@
> 
> +TIMESTAMP = 1705716803
> 
> +SHA256 (hoehermann-purple-gowhatsapp-v1.13.0_GH0.tar.gz) = 153229acd476ff1f98497074402944869c73e85ad06d6cfa8529bf4861960c96
> 
> +SIZE (hoehermann-purple-gowhatsapp-v1.13.0_GH0.tar.gz) = 140285
> 
> diff --git a/net-im/purple-gowhatsapp/files/patch-configure b/net-im/purple-gowhatsapp/files/patch-configure
> 
> new file mode 100644
> 
> index 000000000000..b8775407932d
> 
> --- /dev/null
> 
> +++ b/net-im/purple-gowhatsapp/files/patch-configure
> 
> @@ -0,0 +1,27 @@
> 
> +--- CMakeLists.txt    2023-09-01 16:15:26.000000000 -0400
> 
> ++++ CMakeLists.txt    2024-01-19 21:50:01.130852000 -0500
> 
> +@@ -4,3 +4,2 @@
> 
> + 
> 
> + set(Purple_DIR "${CMAKE_CURRENT_SOURCE_DIR}/submodules/purple-cmake" CACHE PATH "Where to find purple-config.cmake")
> 
> +-find_package(Purple REQUIRED)
> 
> +@@ -41,4 +40,2 @@
> 
> + 
> 
> + install(DIRECTORY "pixmaps" DESTINATION "${PURPLE_DATA_DIR}" FILES_MATCHING PATTERN "*.png")
> 
> +-
> 
> +-include(cpack.cmake)
> 
> +--- src/go/go.mod.in [http://go.mod.in]    2023-09-01 16:15:26.000000000 -0400
> 
> ++++ src/go/go.mod.in [http://go.mod.in]    2024-01-19 23:14:27.315646000 -0500
> 
> +@@ -2,13 +2,2 @@
> 
> + 
> 
> + go 1.18
> 
> +-
> 
> +-require (
> 
> +-    github.com/alfg/mp4 [http://github.com/alfg/mp4] v0.0.0-20210728035756-55ea58c08aeb
> 
> +-    github.com/go-sql-driver/mysql [http://github.com/go-sql-driver/mysql] v1.6.0
> 
> +-    github.com/lib/pq [http://github.com/lib/pq] v1.10.4
> 
> +-    github.com/mattn/go-sqlite3 [http://github.com/mattn/go-sqlite3] v1.14.10
> 
> +-    github.com/mdp/qrterminal/v3 [http://github.com/mdp/qrterminal/v3] v3.0.0
> 
> +-    github.com/skip2/go-qrcode [http://github.com/skip2/go-qrcode] v0.0.0-20200617195104-da1b6568686e
> 
> +-    golang.org/x/net [http://golang.org/x/net] v0.5.0 
> 
> +-    go.mau.fi/whatsmeow [http://go.mau.fi/whatsmeow] latest
> 
> +-)
> 
> diff --git a/net-im/purple-gowhatsapp/pkg-descr b/net-im/purple-gowhatsapp/pkg-descr
> 
> new file mode 100644
> 
> index 000000000000..89e601b1a08d
> 
> --- /dev/null
> 
> +++ b/net-im/purple-gowhatsapp/pkg-descr
> 
> @@ -0,0 +1,5 @@
> 
> +A libpurple/Pidgin plugin for WhatsApp.
> 
> +
> 
> +This is a re-write of purple-gowhatsapp, switching back-ends from
> 
> +go-whatsapp to whatsmeow. whatsmeow is written by Tulir Asokan. It
> 
> +has multi-device support.
> 
> diff --git a/net-im/purple-gowhatsapp/pkg-plist b/net-im/purple-gowhatsapp/pkg-plist
> 
> new file mode 100644
> 
> index 000000000000..b4b08ff3d299
> 
> --- /dev/null
> 
> +++ b/net-im/purple-gowhatsapp/pkg-plist
> 
> @@ -0,0 +1,5 @@
> 
> +lib/purple-2/libwhatsmeow.so [http://libwhatsmeow.so]
> 
> +share/pixmaps/pidgin/protocols/16/whatsapp.png
> 
> +share/pixmaps/pidgin/protocols/22/whatsapp.png
> 
> +share/pixmaps/pidgin/protocols/48/whatsapp.png
> 
> +share/pixmaps/pidgin/protocols/64/whatsapp.png

Hi,

Please at least enable DEVELOPER=yes and fix any warnings

Use the standard definition for POSTGRES, PGSQL

https://cgit.freebsd.org/ports/tree/Mk/bsd.options.desc.mk#n410

SQLITE option is broken

"post-patch-SQLIT3-off"

Overall ordering in Makefile can be improved, LDFLAGS can probably be
replaced with USES= localbase:ldflags

Configure logs suggests that USES= pkgconfig should be added

It also fails to build

https://pdr2.bofh.network/data/140-diizzy/2024-01-20_15h50m31s/logs/errors/purple-gowhatsapp-1.13.0.log

If you're unsure please consider to create a review / PR instead of
just committing.

Please back this out for now.

Best regards,

Daniel