Skip to content

Commit

Permalink
build-sys: tidy up project a little bit
Browse files Browse the repository at this point in the history
Remove obsolete files, reindent and wrap meson lines, and sort out ninfod
build system fixme markup.

Signed-off-by: Sami Kerola <[email protected]>
  • Loading branch information
kerolasa committed Oct 28, 2018
1 parent 89f1cdc commit 44d747a
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 25 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
*~
*.o

*.diff
*.orig
*.patch
*.plist
*.rej

core
.gdb_history
.gdbinit

# Meson build
/builddir
1 change: 0 additions & 1 deletion SNAPSHOT.h

This file was deleted.

Empty file removed builddir/.placeholder
Empty file.
2 changes: 0 additions & 2 deletions doc/.gitignore

This file was deleted.

16 changes: 7 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ endif
opt = get_option('USE_IDN')
if opt == true
idn_dep = cc.find_library('idn2', required : false)
if idn_dep.found()
add_project_arguments('-DUSE_IDN', language : 'c')
conf.set('USE_IDN', 1, description : 'If set use Internationalized Domain Name library.')
endif
if idn_dep.found()
add_project_arguments('-DUSE_IDN', language : 'c')
conf.set('USE_IDN', 1,
description : 'If set use Internationalized Domain Name library.')
endif
else
idn_dep = dependency('disabler-appears-to-disable-executable-build', required : false)
endif
Expand All @@ -89,7 +90,8 @@ elif opt == 'openssl'
conf.set('USE_OPENSSL', 1, description : 'if set use openssl crypto library.')
elif opt == 'none'
crypto_dep = dependency('disabler-appears-to-disable-executable-build', required : false)
conf.set('PING6_NONCE_MEMORY', 1, description : 'If set RFC6744 random does not use any CRYPTO lib.')
conf.set('PING6_NONCE_MEMORY', 1,
description : 'If set RFC6744 random does not use any CRYPTO lib.')
endif

systemd = dependency('systemd', required : false)
Expand Down Expand Up @@ -135,7 +137,6 @@ if build_ninfod == true
'netinet/in.h',
'netinet/ip6.h',
'openssl/md5.h',
'pthread.h',
'pwd.h',
'string.h',
'strings.h',
Expand All @@ -154,11 +155,8 @@ if build_ninfod == true
endforeach
threads = dependency('threads')
if threads.found()
# FIXME: these are redundant, one should be removed.
conf.set('ENABLE_THREADS', 1,
description : 'Defined if libpthread is found.')
conf.set('HAVE_LIBPTHREAD', 1,
description : 'Defined if libpthread is found.')
endif
opt = get_option('NINFOD_MESSAGES')
if opt == true
Expand Down
3 changes: 2 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ option('USE_CAP', type : 'boolean', value : true,
option('USE_IDN', type : 'boolean', value : true,
description : 'IDN support (with libidn2)')

option('USE_CRYPTO', type : 'combo', choices : [ 'none', 'gcrypt', 'nettle', 'openssl' ], value : 'openssl',
option('USE_CRYPTO', type : 'combo',
choices : [ 'none', 'gcrypt', 'nettle', 'openssl' ], value : 'openssl',
description: 'Crypto library support for ping6')

option('BUILD_ARPING', type : 'boolean', value : true,
Expand Down
12 changes: 6 additions & 6 deletions ninfod/ninfod_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# include <stdlib.h>
# endif
#endif
#if ENABLE_THREADS && HAVE_PTHREAD_H
#if ENABLE_THREADS
# include <pthread.h>
#endif
#if HAVE_STRING_H
Expand Down Expand Up @@ -110,7 +110,7 @@
/* Variables */
int initialized = 0;

#if ENABLE_THREADS && HAVE_LIBPTHREAD
#if ENABLE_THREADS
pthread_attr_t pattr;
#endif

Expand Down Expand Up @@ -397,7 +397,7 @@ void init_core(int forced)

srand(seed);

#if ENABLE_THREADS && HAVE_LIBPTHREAD
#if ENABLE_THREADS
if (initialized)
pthread_attr_destroy(&pattr);

Expand Down Expand Up @@ -425,7 +425,7 @@ void init_core(int forced)
return;
}

#if ENABLE_THREADS && HAVE_LIBPTHREAD
#if ENABLE_THREADS
static void *ni_send_thread(void *data)
{
#if ENABLE_DEBUG
Expand Down Expand Up @@ -511,7 +511,7 @@ int pr_nodeinfo(struct packetcontext *p)
int i;
char *cp;
#endif
#if ENABLE_THREADS && HAVE_PTHREAD_H
#if ENABLE_THREADS
pthread_t thread;
#endif
int rc;
Expand Down Expand Up @@ -669,7 +669,7 @@ int pr_nodeinfo(struct packetcontext *p)

/* Step 10: Send the reply
* XXX: with possible random delay */
#if ENABLE_THREADS && HAVE_LIBPTHREAD
#if ENABLE_THREADS
/* ni_send_thread() frees p */
if (pthread_create(&thread, &pattr, ni_send_thread, p)) {
free(p->replydata);
Expand Down
2 changes: 1 addition & 1 deletion ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static double ping_strtod(const char *str, const char *err_msg)
if (errno == ERANGE)
error(2, errno, "%s: %s", err_msg, str);
error(2, 0, "%s: %s", err_msg, str);
return num;
return 0.0;
}

int
Expand Down

0 comments on commit 44d747a

Please sign in to comment.