Skip to content

Commit c952ac9

Browse files
committed
Add Meson
-Werror is dropped, because Meson's werror is more strict than configure one. This implementation does not support running tests. The Kyua testsuite heavily relies on in-source builds. Tests would have to be rewritten (at least the Kyuafile files, but probably more) to support Meson. Meson does not support retrieving git info and providing it as a compiler flag. Meson's vcs_tag() mechanism supports outputting to a (header or source) file only. This would mean that xbps.h.in would have to be modified. No substitution is done on xbps.h.in. See void-linux#598 for explanation. _DEFAULT_SOURCE is dropped, because _GNU_SOURCE implies _DEFAULT_SOURCE. -D_FILE_OFFSET_BITS=64 is set automatically by Meson. Work in progress!
1 parent e82437f commit c952ac9

File tree

31 files changed

+745
-0
lines changed

31 files changed

+745
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ tests/*/*/*_test
3535
tests/*/*/*_tests
3636
include/xbps.h
3737

38+
subprojects/libarchive-*
39+
subprojects/openssl-*
40+
subprojects/packagecache
41+
subprojects/zlib-*
42+
3843
# vim backup files
3944
.*.swp
4045
*~

bin/meson.build

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
subdir('xbps-alternatives')
2+
subdir('xbps-create')
3+
subdir('xbps-dgraph')
4+
subdir('xbps-install')
5+
subdir('xbps-pkgdb')
6+
subdir('xbps-query')
7+
subdir('xbps-reconfigure')
8+
subdir('xbps-remove')
9+
subdir('xbps-rindex')
10+
subdir('xbps-uhelper')
11+
subdir('xbps-checkvers')
12+
subdir('xbps-fbulk')
13+
subdir('xbps-digest')
14+
subdir('xbps-fetch')
15+
16+
if host_machine.system() == 'linux'
17+
subdir('xbps-uchroot')
18+
subdir('xbps-uunshare')
19+
endif

bin/xbps-alternatives/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c']
2+
3+
install_man('xbps-alternatives.1')
4+
executable('xbps-alternatives', src, dependencies: libxbps_dep, install: true)

bin/xbps-checkvers/meson.build

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
src = ['main.c']
2+
3+
install_man('xbps-checkvers.1')
4+
executable(
5+
'xbps-checkvers',
6+
src,
7+
c_args: '-Wno-deprecated-declarations',
8+
dependencies: libxbps_dep,
9+
install: true,
10+
)

bin/xbps-create/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c']
2+
3+
install_man('xbps-create.1')
4+
executable('xbps-create', src, dependencies: libxbps_dep, install: true)

bin/xbps-dgraph/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c']
2+
3+
install_man('xbps-dgraph.1')
4+
executable('xbps-dgraph', src, dependencies: libxbps_dep, install: true)

bin/xbps-digest/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c']
2+
3+
install_man('xbps-digest.1')
4+
executable('xbps-digest', src, dependencies: libxbps_dep, install: true)

bin/xbps-fbulk/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c']
2+
3+
install_man('xbps-fbulk.1')
4+
executable('xbps-fbulk', src, dependencies: libxbps_dep, install: true)

bin/xbps-fetch/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c', '../xbps-install/fetch_cb.c']
2+
3+
install_man('xbps-fetch.1')
4+
executable('xbps-fetch', src, dependencies: libxbps_dep, install: true)

bin/xbps-install/meson.build

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
src = [
2+
'main.c',
3+
'transaction.c',
4+
'question.c',
5+
'fetch_cb.c',
6+
'state_cb.c',
7+
'util.c',
8+
]
9+
10+
clock_gettime_code = '''
11+
#include <time.h>
12+
int main(void) {
13+
struct timespec ts;
14+
clock_gettime(CLOCK_MONOTONIC, &ts);
15+
return 0;
16+
}
17+
'''
18+
19+
CC = meson.get_compiler('c')
20+
21+
rt = CC.find_library('rt', required: false)
22+
extra_flags = []
23+
24+
if rt.found()
25+
if CC.compiles(
26+
clock_gettime_code,
27+
name: 'clock_gettime() available',
28+
args: '-D_GNU_SOURCE',
29+
dependencies: rt,
30+
)
31+
extra_flags = '-DHAVE_CLOCK_GETTIME'
32+
endif
33+
else
34+
if CC.compiles(
35+
clock_gettime_code,
36+
name: 'clock_gettime() available',
37+
args: '-D_GNU_SOURCE',
38+
)
39+
extra_flags = '-DHAVE_CLOCK_GETTIME'
40+
endif
41+
endif
42+
43+
install_man('xbps-install.1')
44+
executable(
45+
'xbps-install',
46+
src,
47+
c_args: extra_flags,
48+
dependencies: libxbps_dep,
49+
install: true,
50+
)

bin/xbps-pkgdb/meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
src = [
2+
'main.c',
3+
'check.c',
4+
'check_pkg_files.c',
5+
'check_pkg_alternatives.c',
6+
'check_pkg_rundeps.c',
7+
'check_pkg_symlinks.c',
8+
'check_pkg_unneeded.c',
9+
]
10+
11+
install_man('xbps-pkgdb.1')
12+
executable('xbps-pkgdb', src, dependencies: libxbps_dep, install: true)

bin/xbps-query/meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
src = [
2+
'main.c',
3+
'list.c',
4+
'show-deps.c',
5+
'show-info-files.c',
6+
'ownedby.c',
7+
'search.c',
8+
'../xbps-install/util.c',
9+
]
10+
11+
install_man('xbps-query.1')
12+
executable('xbps-query', src, dependencies: libxbps_dep, install: true)

bin/xbps-reconfigure/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c', 'find-deps.c']
2+
3+
install_man('xbps-reconfigure.1')
4+
executable('xbps-reconfigure', src, dependencies: libxbps_dep, install: true)

bin/xbps-remove/meson.build

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
src = [
2+
'main.c',
3+
'clean-cache.c',
4+
'../xbps-install/question.c',
5+
'../xbps-install/util.c',
6+
'../xbps-install/transaction.c',
7+
]
8+
9+
install_man('xbps-remove.1')
10+
executable('xbps-remove', src, dependencies: libxbps_dep, install: true)

bin/xbps-rindex/meson.build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
src = [
2+
'main.c',
3+
'index-add.c',
4+
'index-clean.c',
5+
'remove-obsoletes.c',
6+
'repoflush.c',
7+
'sign.c',
8+
]
9+
10+
install_man('xbps-rindex.1')
11+
executable('xbps-rindex', src, dependencies: libxbps_dep, install: true)

bin/xbps-uchroot/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c']
2+
3+
install_man('xbps-uchroot.1')
4+
executable('xbps-uchroot', src, dependencies: libxbps_dep, install: true)

bin/xbps-uhelper/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c', '../xbps-install/fetch_cb.c']
2+
3+
install_man('xbps-uhelper.1')
4+
executable('xbps-uhelper', src, dependencies: libxbps_dep, install: true)

bin/xbps-uunshare/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src = ['main.c']
2+
3+
install_man('xbps-uunshare.1')
4+
executable('xbps-uunshare', src, dependencies: libxbps_dep, install: true)

data/meson.build

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
install_man('xbps.d.5')
2+
install_data(
3+
'60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d.plist',
4+
install_dir: dbdir,
5+
)
6+
install_data(
7+
'repod-main.conf',
8+
'xbps.conf',
9+
install_dir: get_option('datadir') / 'xbps.d',
10+
rename: ['00-repository-main.conf', 'xbps.conf'],
11+
)
12+
install_data(
13+
'_xbps',
14+
'_xbps_src',
15+
install_dir: get_option('datadir') / 'zsh/site-functions',
16+
)
17+
install_data(
18+
'xbps.bash',
19+
install_dir: get_option('datadir') / 'bash-completion/completions',
20+
rename: 'xbps',
21+
)
22+
23+
foreach file : [
24+
'xbps-checkvers',
25+
'xbps-create',
26+
'xbps-dgraph',
27+
'xbps-install',
28+
'xbps-pkgdb',
29+
'xbps-query',
30+
'xbps-reconfigure',
31+
'xbps-remove',
32+
'xbps-rindex',
33+
]
34+
install_symlink(
35+
file,
36+
pointing_to: 'xbps',
37+
install_dir: get_option('datadir') / 'bash-completion/completions',
38+
)
39+
endforeach

doc/meson.build

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
doxygen = find_program('doxygen', required: true)
2+
graphviz_dot = find_program('dot', required: true)
3+
4+
dot_format = get_option('api-docs-format')
5+
6+
foreach dotfile : [
7+
'xbps_transaction_dictionary',
8+
'xbps_pkgdb_dictionary',
9+
'xbps_pkg_props_dictionary',
10+
'xbps_pkg_files_dictionary',
11+
'xbps_binary_pkg_content',
12+
]
13+
custom_target(
14+
command: [graphviz_dot, '-T' + dot_format, '@INPUT@', '-o', '@OUTPUT@'],
15+
input: dotfile + '.dot',
16+
output: dotfile + '.' + dot_format,
17+
build_by_default: true,
18+
)
19+
endforeach
20+
21+
sed = find_program('sed', required: true)
22+
distver = get_option('api-docs-distver')
23+
if distver == ''
24+
command = [
25+
'sh',
26+
'-c',
27+
sed.full_path() + ' -e \'s|@@PROJECT_NUMBER@@|$(date +%Y%m%d)|\' @INPUT@',
28+
]
29+
else
30+
command = [sed, '-e', 's|@@PROJECT_NUMBER@@|' + distver + '|', '@INPUT@']
31+
endif
32+
xbps_api_doxyfile = custom_target(
33+
command: command,
34+
input: 'xbps_api_doxyfile.in',
35+
capture: true,
36+
output: 'xbps_api_doxyfile',
37+
)
38+
39+
run_target('doxygen', command: [doxygen, xbps_api_doxyfile])

include/meson.build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
xbps_h_configure_target = configure_file(
2+
input: 'xbps.h.in',
3+
output: 'xbps.h',
4+
copy: true,
5+
install: true,
6+
install_dir: get_option('includedir'),
7+
)
8+
9+
install_subdir('xbps', install_dir: get_option('includedir'))
10+
11+
xbps_include = include_directories('.')

lib/compat/meson.build

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
compat_functions = []
2+
3+
if not compatibility_functions['vasprintf']
4+
compat_functions += 'vasprintf.c'
5+
endif
6+
if not compatibility_functions['strcasestr']
7+
compat_functions += 'strcasestr.c'
8+
endif
9+
if not compatibility_functions['strlcpy']
10+
compat_functions += 'strlcpy.c'
11+
endif
12+
if not compatibility_functions['strlcat']
13+
compat_functions += 'strlcat.c'
14+
endif
15+
if not compatibility_functions['humanize_number']
16+
compat_functions += 'humanize_number.c'
17+
endif
18+
19+
compat_files = files(compat_functions)

lib/external/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
external_files = files('dewey.c', 'fexec.c', 'mkpath.c')

lib/fetch/meson.build

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
src = ['common.c', 'fetch.c', 'file.c', 'ftp.c', 'http.c']
2+
3+
strnstr_code = '''
4+
#include <string.h>
5+
int main(void) {
6+
const char big[] = "foo";
7+
const char little[] = "f";
8+
strnstr(big, little, 3);
9+
return 0;
10+
}
11+
'''
12+
13+
enable_strnstr = []
14+
CC = meson.get_compiler('c')
15+
if CC.links(strnstr_code, name: 'strnstr() available')
16+
enable_strnstr = '-DHAVE_STRNSTR'
17+
endif
18+
19+
ftperr = custom_target(
20+
'ftperr',
21+
command: [files('errlist.sh'), 'ftp_errlist', 'FTP', '@INPUT@'],
22+
capture: true,
23+
input: 'ftp.errors',
24+
output: 'ftperr.h',
25+
)
26+
27+
httperr = custom_target(
28+
'httperr',
29+
command: [files('errlist.sh'), 'http_errlist', 'HTTP', '@INPUT@'],
30+
capture: true,
31+
input: 'http.errors',
32+
output: 'httperr.h',
33+
)
34+
35+
libfetch = static_library(
36+
'fetch',
37+
src,
38+
ftperr,
39+
httperr,
40+
c_args: ['-DFTP_COMBINE_CWDS', '-DINET6', '-DWITH_SSL', enable_strnstr],
41+
gnu_symbol_visibility: 'hidden',
42+
include_directories: [xbps_include, '.'],
43+
)

0 commit comments

Comments
 (0)