commit 71a32ce77a7db1b3bc1230ed908fd9c68ee9dfe8
parent 039a8ce9c56a327d3740134b455b8516bbabb253
Author: TheJackiMonster <thejackimonster@gmail.com>
Date: Fri, 3 Feb 2023 20:49:14 +0100
Use meson as build system
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat:
12 files changed, 185 insertions(+), 360 deletions(-)
diff --git a/Makefile.am b/Makefile.am
@@ -1,17 +0,0 @@
-# This Makefile.am is in the public domain
-
-EXTRA_DIST = \
- Doxyfile \
- HOWTO.md
-
-SUBDIRS = \
- include \
- src \
- tests
-
-ACLOCAL_AMFLAGS = -I m4
-
-docs:
- mkdir -p doc
- doxygen
-
diff --git a/bootstrap b/bootstrap
@@ -1,2 +0,0 @@
-#!/bin/sh
-autoreconf -vfi
diff --git a/configure.ac b/configure.ac
@@ -1,251 +0,0 @@
-# This file is part of GNUnet.
-# Copyright (C) 2022 GNUnet e.V.
-#
-# GNUnet is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License as published
-# by the Free Software Foundation, either version 3 of the License,
-# or (at your option) any later version.
-#
-# GNUnet is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# SPDX-License-Identifier: AGPL3.0-or-later
-#
-# Process this file with autoconf to produce a configure script.
-#
-#
-AC_INIT([libgnunetchat],[m4_esyscmd_s(sh contrib/get_version.sh)],[bug-gnunet@gnu.org])
-
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_MACRO_DIRS([m4])
-
-AC_CONFIG_HEADERS([
- include/gnunet/gnunet_chat_config.h
-])
-
-AC_CANONICAL_TARGET
-AC_CANONICAL_HOST
-
-AM_INIT_AUTOMAKE([tar-ustar])
-AM_SILENT_RULES
-
-# maybe use AC_USE_SYSTEM_EXTENSIONS?
-AH_TOP([#define _GNU_SOURCE 1])
-
-AC_PROG_AWK
-AC_PROG_CC
-AC_PROG_CC_C_O
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-AC_PROG_MKDIR_P
-PKG_PROG_PKG_CONFIG([0.29.2])
-
-LT_INIT([disable-static dlopen])
-
-AS_IF([test "x$enable_shared" = "xno"],
- [AC_MSG_ERROR([GNUnet works only with shared libraries, sorry])])
-
-# test for GNUnet core
-gnunet=0
-lookin=${prefix}
-GNUNET_CFLAGS=""
-GNUNET_CPPFLAGS=""
-GNUNET_LIBS=""
-AC_MSG_CHECKING(for GNUnet core)
-AC_ARG_WITH(gnunet,
- [ --with-gnunet=PFX Base of GNUnet installation],
- [AC_MSG_RESULT([$with_gnunet])
- AS_CASE([$with_gnunet],
- [no],[lookin=""],
- [yes],[lookin="${prefix}"],
- [lookin="$with_gnunet"])
- ],
- [
- AC_MSG_RESULT([--with-gnunet not specified])
- PKG_CHECK_MODULES([GNUNET], [gnunetutil >= 0.18.0], gnunet=1)
- AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h],
- AC_CHECK_LIB([gnunetutil], [GNUNET_xfree_],
- [
- EXT_LIB_PATH="-L${lookin}/lib $EXT_LIB_PATH"
- if test -d "${lookin}/lib64"; then
- EXT_LIB_PATH="-L${lookin}/lib64 $EXT_LIB_PATH"
- fi
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_arm_service.h],
- AC_CHECK_LIB([gnunetarm], [GNUNET_ARM_connect],
- [
- gnunet_arm=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_fs_service.h],
- AC_CHECK_LIB([gnunetfs], [GNUNET_FS_start],
- [
- gnunet_fs=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_gns_service.h],
- AC_CHECK_LIB([gnunetgns], [GNUNET_GNS_connect],
- [
- gnunet_gns=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_identity_service.h],
- AC_CHECK_LIB([gnunetidentity], [GNUNET_IDENTITY_connect],
- [
- gnunet_identity=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_messenger_service.h],
- AC_CHECK_LIB([gnunetmessenger], [GNUNET_MESSENGER_connect],
- [
- gnunet_messenger=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_namestore_service.h],
- AC_CHECK_LIB([gnunetnamestore], [GNUNET_NAMESTORE_connect],
- [
- gnunet_namestore=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_regex_service.h],
- AC_CHECK_LIB([gnunetregex], [GNUNET_REGEX_search],
- [
- gnunet_regex=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- ]
-)
-
-AS_IF([test "x$gnunet" = "x0" -a ! "x$lookin" = "x"],
-[
- AC_MSG_CHECKING(for GNUnet util library in $lookin)
- backup_LIBS="$LIBS"
- backup_CFLAGS="$CFLAGS"
- backup_CPPFLAGS="$CPPFLAGS"
- GNUNET_LIBS="-L${lookin}/lib"
- if test -d "${lookin}/lib64"; then
- GNUNET_LIBS="-L${lookin}/lib64 $GNUNET_LIBS"
- fi
- GNUNET_CFLAGS="-I${lookin}/include"
- GNUNET_CPPFLAGS="-I${lookin}/include"
- LIBS="$GNUNET_LIBS $backup_LIBS"
- CFLAGS="$GNUNET_CFLAGS $backup_CFLAGS"
- CPPFLAGS="$GNUNET_CPPFLAGS $backup_CPPFLAGS"
- AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h],
- AC_CHECK_LIB([gnunetutil], [GNUNET_xfree_],
- [
- gnunet=1
- EXT_LIB_PATH="-L${lookin}/lib $EXT_LIB_PATH"
- if test -d "${lookin}/lib64"; then
- EXT_LIB_PATH="-L${lookin}/lib64 $EXT_LIB_PATH"
- fi
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_arm_service.h],
- AC_CHECK_LIB([gnunetarm], [GNUNET_ARM_connect],
- [
- gnunet_arm=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_fs_service.h],
- AC_CHECK_LIB([gnunetfs], [GNUNET_FS_start],
- [
- gnunet_fs=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_gns_service.h],
- AC_CHECK_LIB([gnunetgns], [GNUNET_GNS_connect],
- [
- gnunet_gns=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_identity_service.h],
- AC_CHECK_LIB([gnunetidentity], [GNUNET_IDENTITY_connect],
- [
- gnunet_identity=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_messenger_service.h],
- AC_CHECK_LIB([gnunetmessenger], [GNUNET_MESSENGER_connect],
- [
- gnunet_messenger=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_namestore_service.h],
- AC_CHECK_LIB([gnunetnamestore], [GNUNET_NAMESTORE_connect],
- [
- gnunet_namestore=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
- AC_CHECK_HEADERS([gnunet/gnunet_regex_service.h],
- AC_CHECK_LIB([gnunetregex], [GNUNET_REGEX_search],
- [
- gnunet_regex=1
- ]
- ),,[#include <gnunet/platform.h>]
- )
-
- LIBS="$backup_LIBS"
- CFLAGS="$backup_CFLAGS"
- CPPFLAGS="$backup_CPPFLAGS"
-])
-
-AS_IF([
- test "x$gnunet" = "x0" ||
- test "x$gnunet_arm" = "x0" ||
- test "x$gnunet_fs" = "x0" ||
- test "x$gnunet_gns" = "x0" ||
- test "x$gnunet_identity" = "x0" ||
- test "x$gnunet_messenger" = "x0" ||
- test "x$gnunet_namestore" = "x0" ||
- test "x$gnunet_regex" = "x0"
- ],
- [
- AC_MSG_ERROR([libgnunetchat requires GNUnet])
- ]
-)
-
-AC_SUBST(GNUNET_CFLAGS)
-AC_SUBST(GNUNET_LIBS)
-CFLAGS="$GNUNET_CFLAGS $CFLAGS"
-LIBS="$GNUNET_LIBS $LIBS"
-
-AC_ARG_ENABLE([debug],
-[ --enable-debug turn on debugging],
-[case "${enableval}" in
- yes) debug=true ;;
- no) debug=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
-esac],[debug=false])
-AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
-
-AC_CONFIG_FILES([
- Makefile
- include/Makefile
- src/Makefile
- tests/Makefile
-])
-
-AC_OUTPUT
diff --git a/doc/generate.sh b/doc/generate.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+cd "${MESON_SOURCE_ROOT}"
+doxygen 'Doxyfile'
+\ No newline at end of file
diff --git a/include/Makefile.am b/include/Makefile.am
@@ -1,7 +0,0 @@
-# This Makefile.am is in the public domain
-
-gnunetincludedir = $(includedir)/gnunet
-
-gnunetinclude_HEADERS = \
- gnunet/gnunet_chat_lib.h
-
diff --git a/include/include b/include/include
@@ -1 +0,0 @@
-../include
-\ No newline at end of file
diff --git a/include/meson.build b/include/meson.build
@@ -0,0 +1,24 @@
+#
+# This file is part of GNUnet.
+# Copyright (C) 2023 GNUnet e.V.
+#
+# GNUnet is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License,
+# or (at your option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: AGPL3.0-or-later
+#
+
+install_headers(
+ 'gnunet/gnunet_chat_lib.h',
+ subdir: 'gnunet',
+)
diff --git a/meson.build b/meson.build
@@ -0,0 +1,59 @@
+#
+# This file is part of GNUnet.
+# Copyright (C) 2023 GNUnet e.V.
+#
+# GNUnet is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License,
+# or (at your option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: AGPL3.0-or-later
+#
+
+project(
+ 'libgnunetchat',
+ 'c',
+ license: 'AGPL3.0-or-later',
+ version: run_command('contrib/get_version.sh').stdout().strip(),
+)
+
+src_include = include_directories('src', 'include/gnunet')
+tests_include = include_directories('tests', 'include')
+
+gnunetchat_deps = [
+ dependency('gnunetarm'),
+ dependency('gnunetfs'),
+ dependency('gnunetgns'),
+ dependency('gnunetidentity'),
+ dependency('gnunetmessenger'),
+ dependency('gnunetnamestore'),
+ dependency('gnunetregex'),
+ dependency('gnunetutil'),
+]
+
+subdir('include')
+subdir('src')
+
+gnunetchat_lib = library(
+ 'gnunetchat',
+ gnunetchat_sources,
+ install: true,
+ dependencies: gnunetchat_deps,
+ include_directories: src_include,
+ extra_files: gnunetchat_internal,
+)
+
+subdir('tests')
+
+run_target(
+ 'docs',
+ command: 'doc/generate.sh',
+)
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -1,47 +0,0 @@
-# This Makefile.am is in the public domain
-AM_CFLAGS = -I$(top_srcdir)/include/gnunet
-
-EXTRA_DIST = \
- gnunet_chat_contact_intern.c \
- gnunet_chat_context_intern.c \
- gnunet_chat_group_intern.c \
- gnunet_chat_handle_intern.c \
- gnunet_chat_lib_intern.c \
- gnunet_chat_lobby_intern.c
-
-lib_LTLIBRARIES = libgnunetchat.la
-
-libgnunetchat_la_SOURCES = \
- gnunet_chat_account.c gnunet_chat_account.h \
- gnunet_chat_contact.c gnunet_chat_contact.h \
- gnunet_chat_context.c gnunet_chat_context.h \
- gnunet_chat_file.c gnunet_chat_file.h \
- gnunet_chat_group.c gnunet_chat_group.h \
- gnunet_chat_handle.c gnunet_chat_handle.h \
- gnunet_chat_invitation.c gnunet_chat_invitation.h \
- gnunet_chat_lobby.c gnunet_chat_lobby.h \
- gnunet_chat_message.c gnunet_chat_message.h \
- gnunet_chat_uri.c gnunet_chat_uri.h \
- gnunet_chat_util.c gnunet_chat_util.h \
- gnunet_chat_lib.c
-
-libgnunetchat_la_LIBADD = \
- -lgnunetarm \
- -lgnunetfs \
- -lgnunetgns \
- -lgnunetidentity \
- -lgnunetmessenger \
- -lgnunetnamestore \
- -lgnunetregex \
- -lgnunetutil
-
-libgnunetchat_la_CFLAGS = \
- -fPIC -pedantic -Wall -Wextra
-
-if DEBUG
-libgnunetchat_la_CFLAGS += \
- -O0 -D _DEBUG -ggdb3
-else
-libgnunetchat_la_CFLAGS += \
- -O2 -D NDEBUG
-endif
diff --git a/src/meson.build b/src/meson.build
@@ -0,0 +1,43 @@
+#
+# This file is part of GNUnet.
+# Copyright (C) 2023 GNUnet e.V.
+#
+# GNUnet is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License,
+# or (at your option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: AGPL3.0-or-later
+#
+
+gnunetchat_sources = files([
+ 'gnunet_chat_account.c', 'gnunet_chat_account.h',
+ 'gnunet_chat_contact.c', 'gnunet_chat_contact.h',
+ 'gnunet_chat_context.c', 'gnunet_chat_context.h',
+ 'gnunet_chat_file.c', 'gnunet_chat_file.h',
+ 'gnunet_chat_group.c', 'gnunet_chat_group.h',
+ 'gnunet_chat_handle.c', 'gnunet_chat_handle.h',
+ 'gnunet_chat_invitation.c', 'gnunet_chat_invitation.h',
+ 'gnunet_chat_lobby.c', 'gnunet_chat_lobby.h',
+ 'gnunet_chat_message.c', 'gnunet_chat_message.h',
+ 'gnunet_chat_uri.c', 'gnunet_chat_uri.h',
+ 'gnunet_chat_util.c', 'gnunet_chat_util.h',
+ 'gnunet_chat_lib.c',
+])
+
+gnunetchat_internal = files([
+ 'gnunet_chat_contact_intern.c',
+ 'gnunet_chat_context_intern.c',
+ 'gnunet_chat_group_intern.c',
+ 'gnunet_chat_handle_intern.c',
+ 'gnunet_chat_lobby_intern.c',
+ 'gnunet_chat_lib_intern.c',
+])
diff --git a/tests/Makefile.am b/tests/Makefile.am
@@ -1,34 +0,0 @@
-# This Makefile.am is in the public domain
-AM_CFLAGS = -I$(top_srcdir)/include
-AM_LDFLAGS = -L$(top_srcdir)
-
-EXTRA_DIST = \
- test_gnunet_chat.h
-
-check_PROGRAMS = \
- test_gnunet_chat_handle.test \
- test_gnunet_chat_lobby.test \
- test_gnunet_chat_file.test
-
-AM_TESTS_ENVIRONMENT = \
- export LD_LIBRARY_PATH=$(top_srcdir);
-TESTS = \
- $(check_PROGRAMS)
-
-test_gnunet_chat_handle_test_SOURCES = \
- test_gnunet_chat_handle.c
-test_gnunet_chat_handle_test_LDADD = \
- -lcheck \
- $(top_builddir)/src/libgnunetchat.la
-
-test_gnunet_chat_lobby_test_SOURCES = \
- test_gnunet_chat_lobby.c
-test_gnunet_chat_lobby_test_LDADD = \
- -lcheck \
- $(top_builddir)/src/libgnunetchat.la
-
-test_gnunet_chat_file_test_SOURCES = \
- test_gnunet_chat_file.c
-test_gnunet_chat_file_test_LDADD = \
- -lcheck \
- $(top_builddir)/src/libgnunetchat.la
diff --git a/tests/meson.build b/tests/meson.build
@@ -0,0 +1,55 @@
+#
+# This file is part of GNUnet.
+# Copyright (C) 2023 GNUnet e.V.
+#
+# GNUnet is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License,
+# or (at your option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: AGPL3.0-or-later
+#
+
+test_deps = [
+ dependency('check'),
+ dependency('gnunetutil'),
+]
+
+test_gnunet_chat_handle = executable(
+ 'test_gnunet_chat_handle.test',
+ 'test_gnunet_chat_handle.c',
+ dependencies: test_deps,
+ link_with: gnunetchat_lib,
+ include_directories: tests_include,
+ extra_files: 'test_gnunet_chat.h',
+)
+
+test_gnunet_chat_lobby = executable(
+ 'test_gnunet_chat_lobby.test',
+ 'test_gnunet_chat_lobby.c',
+ dependencies: test_deps,
+ link_with: gnunetchat_lib,
+ include_directories: tests_include,
+ extra_files: 'test_gnunet_chat.h',
+)
+
+test_gnunet_chat_file = executable(
+ 'test_gnunet_chat_file.test',
+ 'test_gnunet_chat_file.c',
+ dependencies: test_deps,
+ link_with: gnunetchat_lib,
+ include_directories: tests_include,
+ extra_files: 'test_gnunet_chat.h',
+)
+
+test('test_gnunet_chat_handle', test_gnunet_chat_handle, depends: gnunetchat_lib)
+test('test_gnunet_chat_lobby', test_gnunet_chat_lobby, depends: gnunetchat_lib)
+test('test_gnunet_chat_file', test_gnunet_chat_file, depends: gnunetchat_lib)