summaryrefslogtreecommitdiffstats
path: root/src/blogc-runserver
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2024-05-21 01:29:20 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2024-05-21 01:29:20 +0200
commitb54b8f5b25403cf3b9623804b2491ec78a8b913e (patch)
tree8100b69a2fd1e37d1eb400a33c92ec3c984f208b /src/blogc-runserver
parent0bbc18869720ad042b668742ca48e5cb8a37491a (diff)
downloadblogc-b54b8f5b25403cf3b9623804b2491ec78a8b913e.tar.gz
blogc-b54b8f5b25403cf3b9623804b2491ec78a8b913e.tar.bz2
blogc-b54b8f5b25403cf3b9623804b2491ec78a8b913e.zip
build: replace autotools with cmake
this patch removes all the autoconf/automake/libtool build infrastructure and replaces it with cmake. notable default behavior changes: - man pages are not pre-built, and are not built by default, must be enabled with `-DBUILD_MANPAGES=ON`. removed features: - srpm packaging, to be reintroduced at some point. - deb packaging, now handled externally via rafaelmartins/deb.rgm.io more stuff must be missing, please report bugs!
Diffstat (limited to 'src/blogc-runserver')
-rw-r--r--src/blogc-runserver/CMakeLists.txt37
-rw-r--r--src/blogc-runserver/main.c6
2 files changed, 42 insertions, 1 deletions
diff --git a/src/blogc-runserver/CMakeLists.txt b/src/blogc-runserver/CMakeLists.txt
new file mode 100644
index 0000000..09f203e
--- /dev/null
+++ b/src/blogc-runserver/CMakeLists.txt
@@ -0,0 +1,37 @@
+# SPDX-FileCopyrightText: 2022 Rafael G. Martins <rafael@rafaelmartins.eng.br>
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(NOT DEFINED HAVE_ARPA_INET_H OR
+ NOT DEFINED HAVE_FCNTL_H OR
+ NOT DEFINED HAVE_LIMITS_H OR
+ NOT DEFINED HAVE_NETINET_IN_H OR
+ NOT DEFINED HAVE_SIGNAL_H OR
+ NOT DEFINED HAVE_SYS_SOCKET_H OR
+ NOT DEFINED HAVE_SYS_STAT_H OR
+ NOT DEFINED HAVE_SYS_TYPES_H OR
+ NOT DEFINED HAVE_UNISTD_H)
+ message(FATAL_ERROR "Missing header dependencies for blogc-runserver")
+endif()
+
+add_library(libblogc_runserver STATIC
+ httpd-utils.c
+ httpd-utils.h
+ httpd.c
+ httpd.h
+ mime.c
+ mime.h
+)
+
+target_link_libraries(libblogc_runserver PRIVATE
+ libblogc_common
+)
+
+add_executable(blogc-runserver
+ main.c
+)
+
+target_link_libraries(blogc-runserver PRIVATE
+ libblogc_runserver
+)
+
+install(TARGETS blogc-runserver)
diff --git a/src/blogc-runserver/main.c b/src/blogc-runserver/main.c
index ca402ec..8abd83a 100644
--- a/src/blogc-runserver/main.c
+++ b/src/blogc-runserver/main.c
@@ -11,6 +11,10 @@
#include "../common/utils.h"
#include "httpd.h"
+#ifndef PACKAGE_VERSION
+#define PACKAGE_VERSION "Unknown"
+#endif
+
static void
print_help(const char *default_host, const char *default_port)
@@ -71,7 +75,7 @@ main(int argc, char **argv)
print_help(default_host, default_port);
goto cleanup;
case 'v':
- printf("%s\n", PACKAGE_STRING);
+ printf("blogc " PACKAGE_VERSION "\n");
goto cleanup;
case 't':
if (argv[i][2] != '\0')