1 # SPDX-License-Identifier: LGPL-2.1+
3 # Copyright 2017 Zbigniew Jędrzejewski-Szmek
5 # elogind is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
10 # elogind is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with elogind; If not, see <http://www.gnu.org/licenses/>.
18 #if 0 /// elogind has a shorter list
19 # basic_sources = files('''
187 # socket-protocol-list.c
188 # socket-protocol-list.h
236 basic_sources_plain = files('''
310 parse-printf-format.c
311 parse-printf-format.h
378 missing_h = files('missing.h')
380 generate_gperfs = find_program('generate-gperfs.py')
382 #if 0 /// elogind has only the cap and errno list.
383 # generate_af_list = find_program('generate-af-list.sh')
384 # af_list_txt = custom_target(
386 # output : 'af-list.txt',
387 # command : [generate_af_list, cpp],
390 # generate_arphrd_list = find_program('generate-arphrd-list.sh')
391 # arphrd_list_txt = custom_target(
393 # output : 'arphrd-list.txt',
394 # command : [generate_arphrd_list, cpp],
398 generate_cap_list = find_program('generate-cap-list.sh')
399 cap_list_txt = custom_target(
401 output : 'cap-list.txt',
402 #if 0 /// elogind needs musl_missing.h, so generate_cap_list must know the source root
403 # command : [generate_cap_list, cpp, config_h, missing_h],
405 command : [generate_cap_list, cpp, meson.source_root(), config_h, missing_h],
409 generate_errno_list = find_program('generate-errno-list.sh')
410 errno_list_txt = custom_target(
412 output : 'errno-list.txt',
413 command : [generate_errno_list, cpp],
416 generate_socket_protocol_list = find_program('generate-socket-protocol-list.sh')
417 socket_protocol_list_txt = custom_target(
418 'socket-protocol-list.txt',
419 output : 'socket-protocol-list.txt',
420 command : [generate_socket_protocol_list, cpp],
423 generated_gperf_headers = []
424 #if 0 /// elogind has only the cap and errno list.
425 # foreach item : [['af', af_list_txt, 'af', ''],
426 # ['arphrd', arphrd_list_txt, 'arphrd', 'ARPHRD_'],
427 # ['cap', cap_list_txt, 'capability', ''],
428 # ['errno', errno_list_txt, 'errno', ''],
429 # ['socket-protocol', socket_protocol_list_txt, 'socket_protocol', 'IPPROTO_']]
431 foreach item : [['cap', cap_list_txt, 'capability', ''],
432 ['errno', errno_list_txt, 'errno', '']]
435 fname = '@0@-from-name.gperf'.format(item[0])
436 gperf_file = custom_target(
440 command : [generate_gperfs, item[2], item[3], '@INPUT@'],
443 fname = '@0@-from-name.h'.format(item[0])
444 target1 = custom_target(
449 '-L', 'ANSI-C', '-t', '--ignore-case',
450 '-N', 'lookup_@0@'.format(item[2]),
451 '-H', 'hash_@0@_name'.format(item[2]),
456 fname = '@0@-to-name.h'.format(item[0])
457 awkscript = '@0@-to-name.awk'.format(item[0])
458 target2 = custom_target(
460 input : [awkscript, item[1]],
462 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
465 generated_gperf_headers += [target1, target2]
468 basic_sources += [missing_h] + generated_gperf_headers
470 libbasic = static_library(
473 include_directories : includes,
474 dependencies : [threads,
476 #if 0 /// no blkid in elogind
481 c_args : ['-fvisibility=default'],
484 # A convenience library that is separate from libbasic to avoid
485 # unnecessary linking to libgcrypt.
486 libbasic_gcrypt = static_library(
490 include_directories : includes,
491 dependencies : [libgcrypt],
492 c_args : ['-fvisibility=default'])