Version is now set in src/include/Cytoplasm.h.
Some checks failed
Compile Cytoplasm / Compile Cytoplasm (x86_64, freebsd-v14.0) (push) Failing after 10s
Compile Cytoplasm / Compile Cytoplasm (x86, debian-v12.4) (push) Successful in 13s
Compile Cytoplasm / Compile Cytoplasm (x86, freebsd-v14.0) (push) Failing after 10s
Compile Cytoplasm / Compile Cytoplasm (x86_64, alpine-v3.19) (push) Successful in 11s
Compile Cytoplasm / Compile Cytoplasm (x86_64, debian-v12.4) (push) Successful in 13s
Compile Cytoplasm / Compile Cytoplasm (x86, alpine-v3.19) (push) Successful in 12s
Compile Cytoplasm / Compile Cytoplasm (x86, netbsd-v9.3) (push) Successful in 14s
Compile Cytoplasm / Compile Cytoplasm (x86_64, netbsd-v9.3) (push) Successful in 16s
Compile Cytoplasm / Compile Cytoplasm (x86_64, openbsd-v7.4) (push) Successful in 19s

This commit is contained in:
Jordan Bancino 2024-01-13 17:08:02 -05:00
parent e413092a54
commit bc54f0ebfb
4 changed files with 12 additions and 12 deletions

7
configure vendored
View file

@ -19,7 +19,7 @@ CFLAGS="-O1 -D_DEFAULT_SOURCE -I${INCLUDE}"
LIBS="-lm -lpthread"
# Default args for all platforms.
SCRIPT_ARGS="--prefix=/usr/local --lib-name=Cytoplasm --lib-version=0.4.1"
SCRIPT_ARGS="--prefix=/usr/local --lib-name=Cytoplasm"
# Set SSL flags depending on the platform.
case "$(uname)" in
@ -86,9 +86,6 @@ for arg in $SCRIPT_ARGS; do
--lib-name=*)
LIB_NAME=$(echo "$arg" | cut -d '=' -f 2-)
;;
--lib-version=*)
LIB_VERSION=$(echo "$arg" | cut -d '=' -f 2-)
;;
--enable-debug)
DEBUG="-O0 -g"
;;
@ -107,7 +104,7 @@ if [ -n "$TLS_IMPL" ]; then
LIBS="${LIBS} ${TLS_LIBS}"
fi
CFLAGS="${CFLAGS} '-DLIB_NAME=\"${LIB_NAME}\"' '-DLIB_VERSION=\"${LIB_VERSION}\"' ${DEBUG}"
CFLAGS="${CFLAGS} '-DLIB_NAME=\"${LIB_NAME}\"' ${DEBUG}"
LDFLAGS="${LIBS} ${LDFLAGS}"
#

View file

@ -33,13 +33,13 @@ CytoplasmGetVersion(void)
const char *
CytoplasmGetVersionStr(void)
{
#define S(x) #x
return "v" S(CYTOPLASM_VERSION_MAJOR) "." S(CYTOPLASM_VERSION_MINOR) "." S(CYTOPLASM_VERSION_PATCH)
return "v" STRINGIFY(CYTOPLASM_VERSION_MAJOR)
"." STRINGIFY(CYTOPLASM_VERSION_MINOR)
"." STRINGIFY(CYTOPLASM_VERSION_PATCH)
#if CYTOPLASM_VERSION_ALPHA
"-alpha" S(CYTOPLASM_VERSION_ALPHA)
"-alpha" STRINGIFY(CYTOPLASM_VERSION_ALPHA)
#elif CYTOPLASM_VERSION_BETA
"-beta" S(CYTOPLASM_VERSION_BETA)
"-beta" STRINGIFY(CYTOPLASM_VERSION_BETA)
#endif
;
#undef S
}

View file

@ -34,6 +34,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include <Cytoplasm.h>
#include <Http.h>
#include <Memory.h>
#include <Util.h>
@ -154,7 +155,7 @@ HttpRequest(HttpRequestMethod method, int flags, unsigned short port, char *host
HttpRequestMethodToString(method), path);
HttpRequestHeader(context, "Connection", "close");
HttpRequestHeader(context, "User-Agent", LIB_NAME "/" LIB_VERSION);
HttpRequestHeader(context, "User-Agent", LIB_NAME "/" STRINGIFY(CYTOPLASM_VERSION));
HttpRequestHeader(context, "Host", host);
return context;

View file

@ -29,10 +29,12 @@
#define CYTOPLASM_VERSION_PATCH 1
#define CYTOPLASM_VERSION ((CYTOPLASM_VERSION_MAJOR * 10000) + (CYTOPLASM_VERSION_MINOR * 100) + (CYTOPLASM_VERSION_PATCH))
#define CYTOPLASM_VERSION_ALPHA 0
#define CYTOPLASM_VERSION_ALPHA 1
#define CYTOPLASM_VERSION_BETA 0
#define CYTOPLASM_VERSION_STABLE (!CYTOPLASM_VERSION_ALPHA && !CYTOPLASM_VERSION_BETA)
#define STRINGIFY(x) #x
/***
* @Nm Cytoplasm
* @Nd A simple API that provides metadata on the library itself.