git: 97d2f200cd1f - main - net-im/concord: New port: Discord library written in C
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 21 Sep 2024 21:42:47 UTC
The branch main has been updated by vvd:
URL: https://cgit.FreeBSD.org/ports/commit/?id=97d2f200cd1f21f86c92d2644f563a86a89d5c65
commit 97d2f200cd1f21f86c92d2644f563a86a89d5c65
Author: Souji Thenria <mail@souji-thenria.net>
AuthorDate: 2024-09-21 21:40:55 +0000
Commit: Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-09-21 21:42:33 +0000
net-im/concord: New port: Discord library written in C
Concord is an asynchronous C99 Discord API library with minimal external
dependencies, and a low-level translation of the Discord official
documentation to C code.
https://github.com/Cogmasters/concord
PR: 279553
---
net-im/Makefile | 1 +
net-im/concord/Makefile | 52 +++++++++++++++++++
net-im/concord/distinfo | 3 ++
net-im/concord/files/Makefile.examples | 48 ++++++++++++++++++
net-im/concord/files/config.json.examples | 21 ++++++++
net-im/concord/files/patch-src_Makefile | 10 ++++
net-im/concord/pkg-descr | 3 ++
net-im/concord/pkg-plist | 84 +++++++++++++++++++++++++++++++
8 files changed, 222 insertions(+)
diff --git a/net-im/Makefile b/net-im/Makefile
index 75794ba362eb..9a079739aafe 100644
--- a/net-im/Makefile
+++ b/net-im/Makefile
@@ -4,6 +4,7 @@
SUBDIR += biboumi
SUBDIR += chatterino2
SUBDIR += coccinella
+ SUBDIR += concord
SUBDIR += conduit
SUBDIR += convey
SUBDIR += coyim
diff --git a/net-im/concord/Makefile b/net-im/concord/Makefile
new file mode 100644
index 000000000000..628a4052dd5c
--- /dev/null
+++ b/net-im/concord/Makefile
@@ -0,0 +1,52 @@
+PORTNAME= concord
+DISTVERSIONPREFIX= v
+DISTVERSION= 2.3.0
+CATEGORIES= net-im devel
+
+MAINTAINER= mail@souji-thenria.net
+COMMENT= Discord library written in C
+WWW= https://github.com/Cogmasters/concord
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= curl>=7.56.1:ftp/curl
+RUN_DEPENDS= curl>=7.56.1:ftp/curl
+
+USE_GITHUB= yes
+GH_ACCOUNT= Cogmasters
+
+MAKE_ARGS= DESTINCLUDE_DIR=${STAGEDIR}${PREFIX}/include/concord \
+ DESTLIBDIR=${STAGEDIR}${PREFIX}/lib
+
+OPTIONS_DEFINE= DEBUG_HTTP DEBUG_WEBSOCKETS EXAMPLES SIGINTCATCH
+OPTIONS_DEFAULT= EXAMPLES SHARED
+OPTIONS_SINGLE= TARGETS
+OPTIONS_SINGLE_TARGETS= DEBUG SHARED STATIC
+OPTIONS_SUB= yes
+
+DEBUG_HTTP_DESC= Verbose debugging for HTTP communication
+DEBUG_WEBSOCKETS_DESC= Verbose debugging for WebSockets communication
+SHARED_DESC= Build dynamically linked version
+SIGINTCATCH_DESC= Shutdown gracefully when a SIGINT is received
+STATIC_DESC= Build statically linked version
+
+DEBUG_VARS= ALL_TARGET=debug
+DEBUG_HTTP_CFLAGS= -DCCORD_DEBUG_HTTP
+DEBUG_WEBSOCKETS_CFLAGS= -DCCORD_DEBUG_WEBSOCKETS
+SHARED_LIB_DEPENDS= libcurl.so:ftp/curl
+SHARED_VARS= ALL_TARGET=shared
+SIGINTCATCH_CFLAGS= -DCCORD_SIGINTCATCH
+STATIC_VARS= ALL_TARGET=static
+
+post-install-EXAMPLES-on:
+ ${REINPLACE_CMD} -e 's|#include "\([^"]*\)\.h"|#include <concord/\1.h>|; \
+ s|\.\./config\.json|config.json|' ${WRKSRC}/examples/*.c
+ cd ${WRKSRC}/examples && ${COPYTREE_SHARE} "*.c" ${STAGEDIR}${EXAMPLESDIR}
+ ${INSTALL_DATA} ${FILESDIR}/Makefile.examples ${STAGEDIR}${EXAMPLESDIR}/Makefile
+ ${INSTALL_DATA} ${FILESDIR}/config.json.examples ${STAGEDIR}${EXAMPLESDIR}/config.json
+
+post-install-SHARED-on:
+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libdiscord.so
+
+.include <bsd.port.mk>
diff --git a/net-im/concord/distinfo b/net-im/concord/distinfo
new file mode 100644
index 000000000000..4a4b7a418c54
--- /dev/null
+++ b/net-im/concord/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1726788532
+SHA256 (Cogmasters-concord-v2.3.0_GH0.tar.gz) = 3e789e6c6f9f3b5c480aaf4fb337819043c53fcce8b50966e95d7b5daef38d4d
+SIZE (Cogmasters-concord-v2.3.0_GH0.tar.gz) = 775124
diff --git a/net-im/concord/files/Makefile.examples b/net-im/concord/files/Makefile.examples
new file mode 100644
index 000000000000..0866c1e421d0
--- /dev/null
+++ b/net-im/concord/files/Makefile.examples
@@ -0,0 +1,48 @@
+CC ?= cc
+
+STD_BOTS = 8ball \
+ audit-log \
+ ban \
+ cache \
+ channel \
+ components \
+ copycat \
+ embed \
+ emoji \
+ fetch-messages \
+ guild-template \
+ guild \
+ invite \
+ manual-dm \
+ pin \
+ ping-pong \
+ presence \
+ reaction \
+ shell \
+ slash-commands \
+ slash-commands2 \
+ spam \
+ webhook \
+ timers
+VOICE_BOTS = voice-join
+
+BOTS += $(STD_BOTS)
+
+CFLAGS += -O0 -g -pthread -Wall -I/usr/local/include
+LDFLAGS = -L/usr/local/lib
+LDLIBS = -ldiscord -lcurl
+
+all: $(BOTS)
+
+voice:
+ @ CFLAGS=-DCCORD_VOICE BOTS=$(VOICE_BOTS) $(MAKE)
+
+echo:
+ @ echo -e 'CC: $(CC)\n'
+ @ echo -e 'STD_BOTS: $(STD_BOTS)\n'
+ @ echo -e 'VOICE_BOTS: $(VOICE_BOTS)\n'
+
+clean:
+ @ rm -f $(STD_BOTS) $(VOICE_BOTS)
+
+.PHONY: all echo clean
diff --git a/net-im/concord/files/config.json.examples b/net-im/concord/files/config.json.examples
new file mode 100644
index 000000000000..04cbe0bbe0f2
--- /dev/null
+++ b/net-im/concord/files/config.json.examples
@@ -0,0 +1,21 @@
+{
+ "logging": {
+ "level": "trace",
+ "filename": "bot.log",
+ "quiet": false,
+ "overwrite": true,
+ "use_color": true,
+ "http": {
+ "enable": true,
+ "filename": "http.log"
+ },
+ "disable_modules": ["WEBSOCKETS", "USER_AGENT"]
+ },
+ "discord": {
+ "token": "YOUR-BOT-TOKEN",
+ "default_prefix": {
+ "enable": false,
+ "prefix": "YOUR-COMMANDS-PREFIX"
+ }
+ }
+}
diff --git a/net-im/concord/files/patch-src_Makefile b/net-im/concord/files/patch-src_Makefile
new file mode 100644
index 000000000000..1b36f1549d7c
--- /dev/null
+++ b/net-im/concord/files/patch-src_Makefile
@@ -0,0 +1,10 @@
+--- src/Makefile.orig 2024-09-20 12:42:26 UTC
++++ src/Makefile
+@@ -82,7 +82,7 @@ $(SOLIB): deps
+ $(ARLIB): deps
+ $(AR) $(ARFLAGS) $@ $(OBJS) $(GENCODECS_OBJ) $(CORE_OBJS)
+ $(SOLIB): deps
+- $(CC) -shared -lcurl -o $@ $(OBJS) $(GENCODECS_OBJ) $(CORE_OBJS)
++ $(CC) -shared -L$(PREFIX)/lib -lcurl -o $@ $(OBJS) $(GENCODECS_OBJ) $(CORE_OBJS)
+ $(DYLIB): deps
+ $(CC) -dynamiclib $(DYFLAGS) -o $@ $(OBJS) $(GENCODECS_OBJ) $(CORE_OBJS)
diff --git a/net-im/concord/pkg-descr b/net-im/concord/pkg-descr
new file mode 100644
index 000000000000..f9ff3432b28b
--- /dev/null
+++ b/net-im/concord/pkg-descr
@@ -0,0 +1,3 @@
+Concord is an asynchronous C99 Discord API library with minimal external
+dependencies, and a low-level translation of the Discord official documentation
+to C code.
diff --git a/net-im/concord/pkg-plist b/net-im/concord/pkg-plist
new file mode 100644
index 000000000000..b7d737740297
--- /dev/null
+++ b/net-im/concord/pkg-plist
@@ -0,0 +1,84 @@
+include/concord/all.PRE.h
+include/concord/anomap.h
+include/concord/application_command.h
+include/concord/attributes.h
+include/concord/audit_log.h
+include/concord/auto_moderation.h
+include/concord/carray.h
+include/concord/channel.h
+include/concord/chash.h
+include/concord/clock.h
+include/concord/cog-utils.h
+include/concord/concord-once.h
+include/concord/curl-websocket.h
+include/concord/discord-cache.h
+include/concord/discord-events.h
+include/concord/discord-internal.h
+include/concord/discord-request.h
+include/concord/discord-response.h
+include/concord/discord-voice.h
+include/concord/discord-worker.h
+include/concord/discord.h
+include/concord/discord_codecs.PRE.h
+include/concord/discord_codecs.h
+include/concord/emoji.h
+include/concord/error.h
+include/concord/gateway.h
+include/concord/gencodecs-process.PRE.h
+include/concord/gencodecs.h
+include/concord/guild.h
+include/concord/guild_scheduled_event.h
+include/concord/guild_template.h
+include/concord/interaction.h
+include/concord/invite.h
+include/concord/io_poller.h
+include/concord/jsmn-find.h
+include/concord/jsmn.h
+include/concord/json-build.h
+include/concord/log.h
+include/concord/logconf.h
+include/concord/oauth2.h
+include/concord/osname.h
+include/concord/priority_queue.h
+include/concord/queriec.h
+include/concord/queue.h
+include/concord/sha1.h
+include/concord/stage_instance.h
+include/concord/sticker.h
+include/concord/threadpool.h
+include/concord/types.h
+include/concord/user-agent.h
+include/concord/user.h
+include/concord/voice.h
+include/concord/webhook.h
+include/concord/websockets.h
+%%DEBUG%%lib/libdiscord.a
+%%STATIC%%lib/libdiscord.a
+%%SHARED%%lib/libdiscord.so
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/8ball.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/Makefile
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/audit-log.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ban.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cache.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/channel.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/components.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/config.json
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/copycat.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/embed.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/emoji.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/fetch-messages.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/guild-template.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/guild.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/invite.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/manual-dm.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pin.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ping-pong.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/presence.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/reaction.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/shell.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/slash-commands.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/slash-commands2.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/spam.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/timers.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/voice-join.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/webhook.c