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
This commit is contained in:
Souji Thenria 2024-09-22 00:40:55 +03:00 committed by Vladimir Druzenko
parent a374c732af
commit 97d2f200cd
8 changed files with 222 additions and 0 deletions

View file

@ -4,6 +4,7 @@
SUBDIR += biboumi
SUBDIR += chatterino2
SUBDIR += coccinella
SUBDIR += concord
SUBDIR += conduit
SUBDIR += convey
SUBDIR += coyim

52
net-im/concord/Makefile Normal file
View file

@ -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>

3
net-im/concord/distinfo Normal file
View file

@ -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

View file

@ -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

View file

@ -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"
}
}
}

View file

@ -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)

3
net-im/concord/pkg-descr Normal file
View file

@ -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.

84
net-im/concord/pkg-plist Normal file
View file

@ -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