git: 31518129c6af - main - net-p2p/xbt: new BitTorrent tracker port had been added (+)

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Wed, 16 Nov 2022 03:45:40 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=31518129c6af7a445831fa96d407d4d1d344d75d

commit 31518129c6af7a445831fa96d407d4d1d344d75d
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-11-16 03:42:02 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-11-16 03:42:02 +0000

    net-p2p/xbt: new BitTorrent tracker port had been added (+)
    
    It is written in modern C++ and designed for high performance
    while consuming little resources (CPU and RAM).
    
    Consisting of just a dozen files, it can be easily built with
    BSD or GNU make.
---
 net-p2p/Makefile                        |  1 +
 net-p2p/xbt/Makefile                    | 33 +++++++++++++++++++++++++++++++++
 net-p2p/xbt/distinfo                    |  3 +++
 net-p2p/xbt/files/makefile              | 30 ++++++++++++++++++++++++++++++
 net-p2p/xbt/files/patch-misc_socket.cpp |  9 +++++++++
 net-p2p/xbt/pkg-descr                   |  6 ++++++
 6 files changed, 82 insertions(+)

diff --git a/net-p2p/Makefile b/net-p2p/Makefile
index f9df23ecfd93..fbb6df2e48c4 100644
--- a/net-p2p/Makefile
+++ b/net-p2p/Makefile
@@ -104,6 +104,7 @@
     SUBDIR += udpt
     SUBDIR += uhub
     SUBDIR += vuze
+    SUBDIR += xbt
     SUBDIR += xmrig
     SUBDIR += zetacoin
     SUBDIR += zetacoin-daemon
diff --git a/net-p2p/xbt/Makefile b/net-p2p/xbt/Makefile
new file mode 100644
index 000000000000..316fe67cfc10
--- /dev/null
+++ b/net-p2p/xbt/Makefile
@@ -0,0 +1,33 @@
+PORTNAME=	xbt
+PORTVERSION=	g20221002
+CATEGORIES=	net-p2p
+
+MAINTAINER=	danfe@FreeBSD.org
+COMMENT=	High-performance low-overhead BitTorrent tracker
+WWW=		https://xbtt.sourceforge.net/
+
+LICENSE=	GPLv3
+
+BUILD_DEPENDS=	${LOCALBASE}/include/boost/asio.hpp:devel/boost-libs
+
+USES=		compiler:c++17-lang mysql pkgconfig
+USE_GITHUB=	yes
+GH_ACCOUNT=	OlafvdSpek
+GH_TAGNAME=	9c7dbc4
+
+MAKEFILE=	${FILESDIR}/makefile
+
+PLIST_FILES=	bin/${PORTNAME}_tracker \
+		@sample\ etc/xbt_tracker.conf.sample \
+		${DATADIR_REL}/xbt_tracker.sql
+
+do-install:
+	${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/${PORTNAME}_tracker \
+		${STAGEDIR}${PREFIX}/bin
+	@${MKDIR} ${STAGEDIR}${DATADIR}
+	${INSTALL_DATA} ${INSTALL_WRKSRC}/Tracker/xbt_tracker.sql \
+		${STAGEDIR}${DATADIR}
+	${INSTALL_DATA} ${INSTALL_WRKSRC}/Tracker/xbt_tracker.conf.default \
+		${STAGEDIR}${PREFIX}/etc/xbt_tracker.conf.sample
+
+.include <bsd.port.mk>
diff --git a/net-p2p/xbt/distinfo b/net-p2p/xbt/distinfo
new file mode 100644
index 000000000000..079effc2084c
--- /dev/null
+++ b/net-p2p/xbt/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1664705861
+SHA256 (OlafvdSpek-xbt-g20221002-9c7dbc4_GH0.tar.gz) = dfc99aa59f661f5df2479cc10f27422b51b696353bfd1cbb2cfe5a155e25989c
+SIZE (OlafvdSpek-xbt-g20221002-9c7dbc4_GH0.tar.gz) = 276909
diff --git a/net-p2p/xbt/files/makefile b/net-p2p/xbt/files/makefile
new file mode 100644
index 000000000000..f6f6f0f55679
--- /dev/null
+++ b/net-p2p/xbt/files/makefile
@@ -0,0 +1,30 @@
+CXXFLAGS+=	-std=c++17 -Wall -Wextra
+CPPFLAGS+=	-Imisc -I$(LOCALBASE)/include
+LIBS!=		pkg-config --libs mysqlclient
+LIBS+=		-lz
+
+misc_OBJS=	misc/bt_misc.o \
+		misc/database.o \
+		misc/sha1.o \
+		misc/socket.o \
+		misc/sql_query.o \
+		misc/xcc_z.o
+
+tracker_OBJS=	Tracker/config.o \
+		Tracker/connection.o \
+		Tracker/epoll.o \
+		Tracker/tracker.o \
+		Tracker/tracker_input.o \
+		Tracker/transaction.o
+
+CCACHE!=	command -v ccache
+
+.cpp.o:
+	$(CCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $<
+
+xbt_tracker: $(misc_OBJS) $(tracker_OBJS)
+	$(CXX) $(LDFLAGS) -o $@ $>$^ $(LIBS)
+
+all: xbt_tracker
+
+.PHONY: all
diff --git a/net-p2p/xbt/files/patch-misc_socket.cpp b/net-p2p/xbt/files/patch-misc_socket.cpp
new file mode 100644
index 000000000000..43bbdcbcf280
--- /dev/null
+++ b/net-p2p/xbt/files/patch-misc_socket.cpp
@@ -0,0 +1,9 @@
+--- misc/socket.cpp.orig	2022-10-02 10:17:41 UTC
++++ misc/socket.cpp
+@@ -1,5 +1,6 @@
+ #include "socket.h"
+ 
++#include <array>
+ #include <cstring>
+ #include <cstdio>
+ 
diff --git a/net-p2p/xbt/pkg-descr b/net-p2p/xbt/pkg-descr
new file mode 100644
index 000000000000..46fb6d311bc8
--- /dev/null
+++ b/net-p2p/xbt/pkg-descr
@@ -0,0 +1,6 @@
+XBT (Extended BitTorrent) tracker is a BitTorrent tracker written in
+modern C++.  It's designed to offer high performance while consuming
+little resources (CPU and RAM).  It's a pure tracker, so it doesn't
+offer a frontend; please use any (e.g. PHP-based) frontend you want.
+The tracker stores statistics in a MySQL database/table; version 5 or
+higher is required.