Skip to content

Commit

Permalink
devel/kore: fix build on armv7 and clean up
Browse files Browse the repository at this point in the history
 - fix a warning about a wrong formatting specifier
 - exorcise -Werror so future warnings do not break the build
 - as a result, simplify Makefile
 - switch to C11 to avoid some warnings
 - reinstate %%OPENSSLINC%% patch bits dropped in previous commit
 - patch in %%LOCALBASE%% correctly

MFH:		2023Q4
  • Loading branch information
clausecker committed Nov 18, 2023
1 parent 4d8e2de commit bd7b56a
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 21 deletions.
21 changes: 6 additions & 15 deletions devel/kore/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PORTNAME= kore
PORTVERSION= 4.2.3
DISTVERSION= 4.2.3
PORTREVISON= 1
CATEGORIES= devel www
MASTER_SITES= https://kore.io/releases/

Expand All @@ -16,9 +17,7 @@ BROKEN_SSL_REASON= Requires OpenSSL 3.0.0 deprecated RSA_* routines
USES= compiler:c11 gmake ssl

MAKE_ARGS= OPENSSL_PATH=${OPENSSLBASE}
CFLAGS+= ${CFLAGS_${CHOSEN_COMPILER_TYPE}}
# 12.0 + -pedantic
CFLAGS_clang= -Wno-error=c11-extensions
CFLAGS+= -std=c11

PORTEXAMPLES= *

Expand Down Expand Up @@ -49,17 +48,9 @@ PYTHON_BINARY_ALIAS= python3-config=${PYTHON_CMD}-config
TASKS_MAKE_ARGS= TASKS=1
TLS_MAKE_ARGS_OFF= NOTLS=1

.include <bsd.port.pre.mk>

.if ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} >= 160
CFLAGS+= -Wno-error=deprecated-declarations -Wno-error=incompatible-pointer-types-discards-qualifiers
.endif

post-patch:
.if ${LOCALBASE} != /usr/local
@${REINPLACE_CMD} 's|/usr/local/|${LOCALBASE}/|g' \
pre-configure:
@${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}/|g' \
${WRKSRC}/Makefile
.endif
@${REINPLACE_CMD} 's|%%OPENSSLINC%%|${OPENSSLINC}|g' \
${WRKSRC}/src/cli.c

Expand All @@ -71,4 +62,4 @@ post-install-EXAMPLES-on:
@cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}
@cd ${WRKSRC}/conf && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}

.include <bsd.port.post.mk>
.include <bsd.port.mk>
38 changes: 36 additions & 2 deletions devel/kore/files/patch-Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
--- Makefile.orig 2020-09-08 19:35:30 UTC
--- Makefile.orig 2022-08-22 11:18:44 UTC
+++ Makefile
@@ -48,12 +48,6 @@ ifneq ("$(DEBUG)", "")
@@ -31,9 +31,9 @@ S_SRC+= src/tls_$(TLS_BACKEND).c
FEATURES=
FEATURES_INC=

-CFLAGS+=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
-CFLAGS+=-Wsign-compare -Iinclude/kore -I$(OBJDIR) -std=c99 -pedantic
+CFLAGS+=-Wsign-compare -Iinclude/kore -I$(OBJDIR) -pedantic
CFLAGS+=-Wtype-limits -fno-common
CFLAGS+=-DPREFIX='"$(PREFIX)"' -fstack-protector-all

@@ -66,12 +66,6 @@ ifneq ("$(DEBUG)", "")
FEATURES+=-DKORE_DEBUG
endif

Expand All @@ -13,3 +25,25 @@
ifneq ("$(NOSENDFILE)", "")
CFLAGS+=-DKORE_NO_SENDFILE
endif
@@ -120,8 +114,8 @@ endif

OSNAME=$(shell uname -s | sed -e 's/[-_].*//g' | tr A-Z a-z)
ifeq ("$(OSNAME)", "freebsd")
- KORE_CURL_LIB=-L/usr/local/lib -lcurl
- KORE_CURL_INC=-I/usr/local/include
+ KORE_CURL_LIB=-L%%LOCALBASE%%/lib -lcurl
+ KORE_CURL_INC=-I%%LOCALBASE%%/include
endif

ifneq ("$(ACME)", "")
@@ -161,8 +155,8 @@ else ifeq ("$(OSNAME)", "linux")
else
S_SRC+=src/bsd.c
ifneq ("$(JSONRPC)", "")
- CFLAGS+=-I/usr/local/include
- LDFLAGS+=-L/usr/local/lib
+ CFLAGS+=-I%%LOCALBASE%%/include
+ LDFLAGS+=-L%%LOCALBASE%%/lib
endif
endif

13 changes: 9 additions & 4 deletions devel/kore/files/patch-kodev_Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
--- kodev/Makefile.orig 2020-09-08 19:35:30 UTC
--- kodev/Makefile.orig 2022-08-22 11:18:44 UTC
+++ kodev/Makefile
@@ -12,14 +12,8 @@ S_SRC= ../src/cli.c
CFLAGS+=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
@@ -9,17 +9,11 @@ INSTALL_DIR=$(PREFIX)/bin

S_SRC= ../src/cli.c

-CFLAGS+=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
CFLAGS+=-Wsign-compare -Iincludes -std=c99 -pedantic
-CFLAGS+=-Wsign-compare -Iincludes -std=c99 -pedantic
-CFLAGS+=-DPREFIX='"$(PREFIX)"'
-LDFLAGS=-lcrypto
-
Expand All @@ -12,6 +16,7 @@
-else
- CFLAGS+=-O2
-endif
+CFLAGS+=-Wsign-compare -Iincludes -pedantic
+CFLAGS+=-DPREFIX='"$(PREFIX)"' -I$(OPENSSL_PATH)/include
+LDFLAGS+=-L$(OPENSSL_PATH)/lib -lcrypto

Expand Down
11 changes: 11 additions & 0 deletions devel/kore/files/patch-src_cli.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/cli.c.orig 2022-08-22 11:18:44 UTC
+++ src/cli.c
@@ -867,6 +867,8 @@ cli_ldflags(int argc, char **argv)
cli_kore_load_file("linker", NULL, &p, &len);
printf("%.*s ", (int)len, p);

+ printf("-I%%OPENSSLINC%% ");
+
#if defined(__MACH__)
printf("-dynamiclib -undefined suppress -flat_namespace ");
#else
11 changes: 11 additions & 0 deletions devel/kore/files/patch-src_python.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/python.c.orig 2023-11-17 22:08:08 UTC
+++ src/python.c
@@ -4828,7 +4828,7 @@ pyhttp_iterobj_next(struct pyhttp_iterobj *iterobj)
}

kore_buf_reset(&iterobj->buf);
- kore_buf_appendf(&iterobj->buf, "%lx\r\n", length);
+ kore_buf_appendf(&iterobj->buf, "%zx\r\n", length);
kore_buf_append(&iterobj->buf, ptr, length);
kore_buf_appendf(&iterobj->buf, "\r\n");

10 changes: 10 additions & 0 deletions devel/kore/files/patch-tools_kore-serve_conf_build.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- tools/kore-serve/conf/build.conf.orig 2022-08-22 11:18:44 UTC
+++ tools/kore-serve/conf/build.conf
@@ -2,7 +2,6 @@ single_binary=yes
kore_source=../../
kore_flavor=NOTLS=1

-cflags=-std=c99 -Werror
cflags=-Wall -Wmissing-declarations -Wshadow
cflags=-Wstrict-prototypes -Wmissing-prototypes
cflags=-Wpointer-arith -Wcast-qual -Wsign-compare

0 comments on commit bd7b56a

Please sign in to comment.