Re: git: ef8919adec5c - main - net-mgmt/andwatch: Add new port

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Fri, 28 Mar 2025 18:40:52 UTC
On 2025-03-28 12:45, Renato Botelho wrote:
> The branch main has been updated by garga:
>
> URL:https://cgit.FreeBSD.org/ports/commit/?id=ef8919adec5cb3e4256c3421529a7bbbfbf55917
>
> commit ef8919adec5cb3e4256c3421529a7bbbfbf55917
> Author:     Denny Page<dennypage@me.com>
> AuthorDate: 2025-03-27 18:18:43 +0000
> Commit:     Renato Botelho<garga@FreeBSD.org>
> CommitDate: 2025-03-28 11:45:12 +0000
>
>      net-mgmt/andwatch: Add new port
>      
>      ANDwatch monitors Arp (IPV4) and Neighbor Discovery (IPv6)
>      packets, maintains a database of IP address to hardware
>      address (Ethernet) mappings, and issues notifications when
>      the hardware address of an IP address changes.
>      
>      PR:             284907
> ---
>   net-mgmt/Makefile                      |  1 +
>   net-mgmt/andwatch/Makefile             | 41 ++++++++++++++++++++++++++++++++++
>   net-mgmt/andwatch/distinfo             |  3 +++
>   net-mgmt/andwatch/files/pkg-message.in | 20 +++++++++++++++++
>   net-mgmt/andwatch/pkg-descr            |  4 ++++
>   net-mgmt/andwatch/pkg-plist            |  6 +++++
>   6 files changed, 75 insertions(+)
>
> diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
> index 148a708d12c7..fb024a06c187 100644
> --- a/net-mgmt/Makefile
> +++ b/net-mgmt/Makefile
> @@ -7,6 +7,7 @@
>       SUBDIR += aggregate
>       SUBDIR += aircrack-ng
>       SUBDIR += alertmanager
> +    SUBDIR += andwatch
>       SUBDIR += ap-utils
>       SUBDIR += argus3
>       SUBDIR += argus3-clients
> diff --git a/net-mgmt/andwatch/Makefile b/net-mgmt/andwatch/Makefile
> new file mode 100644
> index 000000000000..34972ed87c8c
> --- /dev/null
> +++ b/net-mgmt/andwatch/Makefile
> @@ -0,0 +1,41 @@
> +PORTNAME=	andwatch
> +PORTVERSION=	2.1.0
> +DISTVERSIONPREFIX=	v
> +CATEGORIES=	net-mgmt
> +
> +MAINTAINER=	dennypage@me.com
> +COMMENT=	ANDwatch - Arp and Neighbor Discovery monitor
> +WWW=		https://github.com/dennypage/andwatch
> +
> +LICENSE=	BSD2CLAUSE
> +
> +LIB_DEPENDS=	libpcap.so:net/libpcap \
> +		libsqlite3.so:databases/sqlite3 \
> +		libcurl.so:ftp/curl
> +
> +USE_GITHUB=	yes
> +GH_ACCOUNT=	dennypage
> +
> +CFLAGS+=	-I${LOCALBASE}/include
> +LDFLAGS+=	-L${LOCALBASE}/lib
> +
> +SUB_FILES=	pkg-message
> +
> +post-patch:
> +	${REINPLACE_CMD} -e "/LIB_DIR/s,/var/lib,/var/db," \
> +		${WRKSRC}/andwatch.h
> +	${REINPLACE_CMD} -e 's/$$(CC)/$$(CC) $$(CFLAGS) $$(LDFLAGS)/' \
> +		${WRKSRC}/Makefile
> +
> +do-install:
> +	${INSTALL_PROGRAM} ${WRKSRC}/andwatchd ${STAGEDIR}${PREFIX}/bin
> +	${INSTALL_PROGRAM} ${WRKSRC}/andwatch-query ${STAGEDIR}${PREFIX}/bin
> +	${INSTALL_PROGRAM} ${WRKSRC}/andwatch-query-ma ${STAGEDIR}${PREFIX}/bin
> +	${INSTALL_PROGRAM} ${WRKSRC}/andwatch-update-ma ${STAGEDIR}${PREFIX}/bin
> +	@${MKDIR} ${STAGEDIR}${DATADIR}
> +	${INSTALL_DATA} ${WRKSRC}/andwatch-notify.sh ${STAGEDIR}${DATADIR}
> +
> +post-install:
> +	${MKDIR} ${STAGEDIR}/var/db/andwatch
> +
> +.include <bsd.port.mk>
> diff --git a/net-mgmt/andwatch/distinfo b/net-mgmt/andwatch/distinfo
> new file mode 100644
> index 000000000000..5a10cdfa910e
> --- /dev/null
> +++ b/net-mgmt/andwatch/distinfo
> @@ -0,0 +1,3 @@
> +TIMESTAMP = 1740595076
> +SHA256 (dennypage-andwatch-v2.1.0_GH0.tar.gz) = c02df4ab16214d1a4f98051d056f98a53cf33504caa8296f50b4cc8b3b6b09fc
> +SIZE (dennypage-andwatch-v2.1.0_GH0.tar.gz) = 20475
> diff --git a/net-mgmt/andwatch/files/pkg-message.in b/net-mgmt/andwatch/files/pkg-message.in
> new file mode 100644
> index 000000000000..2e55879274fa
> --- /dev/null
> +++ b/net-mgmt/andwatch/files/pkg-message.in
> @@ -0,0 +1,20 @@
> +[
> +{ type: install
> +  message: <<EOM
> +Before using ANDwatch, you must create the MAC Address database. The
> +The MAC Address database is created with the following command:
> +
> +    %%PREFIX%%/bin/andwatch-update-ma
> +
> +It is generally a good idea to update the MAC Address database on a
> +periodic basis to incorporate new address assignments. This update
> +can be done via cron. Here is an example cron entry to update the
> +MAC Address database once per month:
> +
> +    0 0 1 * * root /usr/bin/nice -n20 %%PREFIX%%/bin/andwatch-update-ma
> +
> +Note that the database update is performed live, and andwatchd does
> +not need to be stopped in order to run the update.
> +EOM
> +}
> +]
> diff --git a/net-mgmt/andwatch/pkg-descr b/net-mgmt/andwatch/pkg-descr
> new file mode 100644
> index 000000000000..789e027aa5f2
> --- /dev/null
> +++ b/net-mgmt/andwatch/pkg-descr
> @@ -0,0 +1,4 @@
> +ANDwatch monitors Arp (IPV4) and Neighbor Discovery (IPv6)
> +packets, maintains a database of IP address to hardware
> +address (Ethernet) mappings, and issues notifications when
> +the hardware address of an IP address changes.
> diff --git a/net-mgmt/andwatch/pkg-plist b/net-mgmt/andwatch/pkg-plist
> new file mode 100644
> index 000000000000..24c4f3a176d2
> --- /dev/null
> +++ b/net-mgmt/andwatch/pkg-plist
> @@ -0,0 +1,6 @@
> +bin/andwatchd
> +bin/andwatch-query
> +bin/andwatch-query-ma
> +bin/andwatch-update-ma
> +%%DATADIR%%/andwatch-notify.sh
> +@dir /var/db/andwatch

Hi,

Please follow Porters Handbook (variables and ordering),

https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-master_sites-github

See Example 16

sqlite3 should use the sqlite helper, 
https://docs.freebsd.org/en/books/porters-handbook/book/#using-databases-uses

C/LDFLAGS should use the localbase helper, 
https://cgit.freebsd.org/ports/tree/Mk/Uses/localbase.mk

Since submitter is upstream, why not ask submitter fix the project 
Makefile instead of doing a bunch of hacks?

Best regards,

Daniel