aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Druzenko <vvd@FreeBSD.org>2024-09-30 20:31:42 +0000
committerVladimir Druzenko <vvd@FreeBSD.org>2024-09-30 20:40:33 +0000
commit27e816ac013a9cb938481342c26d3398b04453f9 (patch)
tree7d3020da7b689ac56418a7867eaa9b958472fe24
parent66b4ff53ef44882b1eb779b6e15d18b3282994e7 (diff)
downloadports-27e816ac013a9cb938481342c26d3398b04453f9.tar.gz
ports-27e816ac013a9cb938481342c26d3398b04453f9.zip
net-im/concord: Improve port
- Add USE_LDCONFIG - port installs .so library. - Allow build both shared and static libraries at same time. - Prebuild examples. PR: 279553 Approved by: Souji Thenria <mail@souji-thenria.net>
-rw-r--r--net-im/concord/Makefile35
-rw-r--r--net-im/concord/files/patch-Makefile11
-rw-r--r--net-im/concord/files/patch-examples_Makefile11
-rw-r--r--net-im/concord/files/patch-src_Makefile7
-rw-r--r--net-im/concord/pkg-plist30
5 files changed, 71 insertions, 23 deletions
diff --git a/net-im/concord/Makefile b/net-im/concord/Makefile
index 628a4052dd5c..91919838e58a 100644
--- a/net-im/concord/Makefile
+++ b/net-im/concord/Makefile
@@ -10,43 +10,44 @@ 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
+LIB_DEPENDS= libcurl.so:ftp/curl
USE_GITHUB= yes
GH_ACCOUNT= Cogmasters
+USE_LDCONFIG= yes
MAKE_ARGS= DESTINCLUDE_DIR=${STAGEDIR}${PREFIX}/include/concord \
DESTLIBDIR=${STAGEDIR}${PREFIX}/lib
+MAKE_JOBS_UNSAFE= yes
-OPTIONS_DEFINE= DEBUG_HTTP DEBUG_WEBSOCKETS EXAMPLES SIGINTCATCH
-OPTIONS_DEFAULT= EXAMPLES SHARED
-OPTIONS_SINGLE= TARGETS
-OPTIONS_SINGLE_TARGETS= DEBUG SHARED STATIC
+OPTIONS_DEFINE= DEBUG DEBUG_HTTP DEBUG_WEBSOCKETS EXAMPLES SIGINTCATCH
+OPTIONS_DEFAULT= EXAMPLES
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
+EXAMPLES_USES= localbase:ldflags
+EXAMPLES_VARS= ALL_TARGET=examples
SIGINTCATCH_CFLAGS= -DCCORD_SIGINTCATCH
-STATIC_VARS= ALL_TARGET=static
+
+post-patch-EXAMPLES-on:
+ ${REINPLACE_CMD} -e 's|\.\./config\.json|config.json|' ${WRKSRC}/examples/*.c
+
+post-install-DEBUG-off:
+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libdiscord.so
post-install-EXAMPLES-on:
- ${REINPLACE_CMD} -e 's|#include "\([^"]*\)\.h"|#include <concord/\1.h>|; \
- s|\.\./config\.json|config.json|' ${WRKSRC}/examples/*.c
+ ${REINPLACE_CMD} -e 's|#include "\([^"]*\)\.h"|#include <concord/\1.h>|' \
+ ${WRKSRC}/examples/*.c
cd ${WRKSRC}/examples && ${COPYTREE_SHARE} "*.c" ${STAGEDIR}${EXAMPLESDIR}
- ${INSTALL_DATA} ${FILESDIR}/Makefile.examples ${STAGEDIR}${EXAMPLESDIR}/Makefile
+ cd ${WRKSRC}/examples && ${COPYTREE_BIN} "*" ${STAGEDIR}${EXAMPLESDIR} \
+ '! -name Makefile ! -name *\.bak ! -name *\.c ! -name *\.orig'
+ ${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/files/patch-Makefile b/net-im/concord/files/patch-Makefile
new file mode 100644
index 000000000000..eff7f8b40ecd
--- /dev/null
+++ b/net-im/concord/files/patch-Makefile
@@ -0,0 +1,11 @@
+--- Makefile.orig 2024-05-06 23:04:41 UTC
++++ Makefile
+@@ -20,7 +20,7 @@ CFLAGS ?= -O2
+
+ CFLAGS ?= -O2
+
+-all: static
++all: shared static
+
+ static:
+ @ CFLAGS="$(CFLAGS)" $(MAKE) -C $(CORE_DIR)
diff --git a/net-im/concord/files/patch-examples_Makefile b/net-im/concord/files/patch-examples_Makefile
new file mode 100644
index 000000000000..9a6e0ef3190e
--- /dev/null
+++ b/net-im/concord/files/patch-examples_Makefile
@@ -0,0 +1,11 @@
+--- examples/Makefile.orig 2024-09-22 09:38:52 UTC
++++ examples/Makefile
+@@ -36,7 +36,7 @@ CFLAGS += -O0 -g -pthread -Wall \
+
+ CFLAGS += -O0 -g -pthread -Wall \
+ -I$(INCLUDE_DIR) -I$(CORE_DIR) -I$(GENCODECS_DIR)
+-LDFLAGS = -L$(TOP)/lib
++LDFLAGS += -L$(TOP)/lib
+ LDLIBS = -ldiscord -lcurl
+
+ all: $(BOTS)
diff --git a/net-im/concord/files/patch-src_Makefile b/net-im/concord/files/patch-src_Makefile
index 1b36f1549d7c..5eb202b4c985 100644
--- a/net-im/concord/files/patch-src_Makefile
+++ b/net-im/concord/files/patch-src_Makefile
@@ -1,10 +1,11 @@
---- src/Makefile.orig 2024-09-20 12:42:26 UTC
+--- src/Makefile.orig 2024-05-06 23:04:41 UTC
+++ src/Makefile
@@ -82,7 +82,7 @@ $(SOLIB): deps
$(ARLIB): deps
- $(AR) $(ARFLAGS) $@ $(OBJS) $(GENCODECS_OBJ) $(CORE_OBJS)
+ $(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)
+ $(CC) -dynamiclib $(DYFLAGS) -o $@ $(OBJS) $(GENCODECS_OBJ) $(CORE_OBJS)
+
diff --git a/net-im/concord/pkg-plist b/net-im/concord/pkg-plist
index b7d737740297..596c4b40d1d6 100644
--- a/net-im/concord/pkg-plist
+++ b/net-im/concord/pkg-plist
@@ -52,33 +52,57 @@ 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
+lib/libdiscord.a
+lib/libdiscord.so
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/8ball
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/8ball.c
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/Makefile
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/audit-log
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/audit-log.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ban
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ban.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cache
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/cache.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/channel
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/channel.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/components
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/components.c
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/config.json
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/copycat
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/copycat.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/embed
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/embed.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/emoji
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/emoji.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/fetch-messages
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/fetch-messages.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/guild
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/guild-template
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/guild-template.c
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/guild.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/invite
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/invite.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/manual-dm
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/manual-dm.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pin
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pin.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ping-pong
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ping-pong.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/presence
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/presence.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/reaction
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/reaction.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/shell
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/shell.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/slash-commands
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/slash-commands.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/slash-commands2
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/slash-commands2.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/spam
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/spam.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/timers
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/timers.c
+@comment %%PORTEXAMPLES%%%%EXAMPLESDIR%%/voice-join
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/voice-join.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/webhook
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/webhook.c