Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Meson #608

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ tests/*/*/*_test
tests/*/*/*_tests
include/xbps.h

subprojects/libarchive-*
subprojects/openssl-*
subprojects/packagecache
subprojects/zlib-*

# vim backup files
.*.swp
*~
19 changes: 19 additions & 0 deletions bin/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
subdir('xbps-alternatives')
subdir('xbps-create')
subdir('xbps-dgraph')
subdir('xbps-install')
subdir('xbps-pkgdb')
subdir('xbps-query')
subdir('xbps-reconfigure')
subdir('xbps-remove')
subdir('xbps-rindex')
subdir('xbps-uhelper')
subdir('xbps-checkvers')
subdir('xbps-fbulk')
subdir('xbps-digest')
subdir('xbps-fetch')

if host_machine.system() == 'linux'
subdir('xbps-uchroot')
subdir('xbps-uunshare')
endif
4 changes: 4 additions & 0 deletions bin/xbps-alternatives/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c']

install_man('xbps-alternatives.1')
executable('xbps-alternatives', src, dependencies: libxbps_dep, install: true)
10 changes: 10 additions & 0 deletions bin/xbps-checkvers/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
src = ['main.c']

install_man('xbps-checkvers.1')
executable(
'xbps-checkvers',
src,
c_args: '-Wno-deprecated-declarations',
dependencies: libxbps_dep,
install: true,
)
4 changes: 4 additions & 0 deletions bin/xbps-create/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c']

install_man('xbps-create.1')
executable('xbps-create', src, dependencies: libxbps_dep, install: true)
4 changes: 4 additions & 0 deletions bin/xbps-dgraph/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c']

install_man('xbps-dgraph.1')
executable('xbps-dgraph', src, dependencies: libxbps_dep, install: true)
4 changes: 4 additions & 0 deletions bin/xbps-digest/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c']

install_man('xbps-digest.1')
executable('xbps-digest', src, dependencies: libxbps_dep, install: true)
4 changes: 4 additions & 0 deletions bin/xbps-fbulk/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c']

install_man('xbps-fbulk.1')
executable('xbps-fbulk', src, dependencies: libxbps_dep, install: true)
4 changes: 4 additions & 0 deletions bin/xbps-fetch/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c', '../xbps-install/fetch_cb.c']

install_man('xbps-fetch.1')
executable('xbps-fetch', src, dependencies: libxbps_dep, install: true)
41 changes: 41 additions & 0 deletions bin/xbps-install/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
src = [
'main.c',
'transaction.c',
'question.c',
'fetch_cb.c',
'state_cb.c',
'util.c',
]

clock_gettime_code = '''
#include <time.h>
int main(void) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return 0;
}
'''

CC = meson.get_compiler('c')

rt = CC.find_library('rt', required: false)
rt_dep = rt.found() ? rt : []
extra_flags = []

if CC.compiles(
clock_gettime_code,
name: 'clock_gettime() available',
args: '-D_GNU_SOURCE',
dependencies: rt_dep,
)
extra_flags = '-DHAVE_CLOCK_GETTIME'
endif

install_man('xbps-install.1')
executable(
'xbps-install',
src,
c_args: extra_flags,
dependencies: [libxbps_dep, rt_dep],
install: true,
)
12 changes: 12 additions & 0 deletions bin/xbps-pkgdb/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
src = [
'main.c',
'check.c',
'check_pkg_files.c',
'check_pkg_alternatives.c',
'check_pkg_rundeps.c',
'check_pkg_symlinks.c',
'check_pkg_unneeded.c',
]

install_man('xbps-pkgdb.1')
executable('xbps-pkgdb', src, dependencies: libxbps_dep, install: true)
12 changes: 12 additions & 0 deletions bin/xbps-query/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
src = [
'main.c',
'list.c',
'show-deps.c',
'show-info-files.c',
'ownedby.c',
'search.c',
'../xbps-install/util.c',
]

install_man('xbps-query.1')
executable('xbps-query', src, dependencies: libxbps_dep, install: true)
4 changes: 4 additions & 0 deletions bin/xbps-reconfigure/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c', 'find-deps.c']

install_man('xbps-reconfigure.1')
executable('xbps-reconfigure', src, dependencies: libxbps_dep, install: true)
10 changes: 10 additions & 0 deletions bin/xbps-remove/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
src = [
'main.c',
'clean-cache.c',
'../xbps-install/question.c',
'../xbps-install/util.c',
'../xbps-install/transaction.c',
]

install_man('xbps-remove.1')
executable('xbps-remove', src, dependencies: libxbps_dep, install: true)
11 changes: 11 additions & 0 deletions bin/xbps-rindex/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
src = [
'main.c',
'index-add.c',
'index-clean.c',
'remove-obsoletes.c',
'repoflush.c',
'sign.c',
]

install_man('xbps-rindex.1')
executable('xbps-rindex', src, dependencies: libxbps_dep, install: true)
4 changes: 4 additions & 0 deletions bin/xbps-uchroot/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c']

install_man('xbps-uchroot.1')
executable('xbps-uchroot', src, dependencies: libxbps_dep, install: true)
4 changes: 4 additions & 0 deletions bin/xbps-uhelper/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c', '../xbps-install/fetch_cb.c']

install_man('xbps-uhelper.1')
executable('xbps-uhelper', src, dependencies: libxbps_dep, install: true)
4 changes: 4 additions & 0 deletions bin/xbps-uunshare/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = ['main.c']

install_man('xbps-uunshare.1')
executable('xbps-uunshare', src, dependencies: libxbps_dep, install: true)
39 changes: 39 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
install_man('xbps.d.5')
install_data(
'60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d.plist',
install_dir: dbdir,
)
install_data(
'repod-main.conf',
'xbps.conf',
install_dir: get_option('datadir') / 'xbps.d',
rename: ['00-repository-main.conf', 'xbps.conf'],
)
install_data(
'_xbps',
'_xbps_src',
install_dir: get_option('datadir') / 'zsh/site-functions',
)
install_data(
'xbps.bash',
install_dir: get_option('datadir') / 'bash-completion/completions',
rename: 'xbps',
)

foreach file : [
'xbps-checkvers',
'xbps-create',
'xbps-dgraph',
'xbps-install',
'xbps-pkgdb',
'xbps-query',
'xbps-reconfigure',
'xbps-remove',
'xbps-rindex',
]
install_symlink(
file,
pointing_to: 'xbps',
install_dir: get_option('datadir') / 'bash-completion/completions',
)
endforeach
39 changes: 39 additions & 0 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
doxygen = find_program('doxygen', required: true)
graphviz_dot = find_program('dot', required: true)

dot_format = get_option('api-docs-format')

foreach dotfile : [
'xbps_transaction_dictionary',
'xbps_pkgdb_dictionary',
'xbps_pkg_props_dictionary',
'xbps_pkg_files_dictionary',
'xbps_binary_pkg_content',
]
custom_target(
command: [graphviz_dot, '-T' + dot_format, '@INPUT@', '-o', '@OUTPUT@'],
input: dotfile + '.dot',
output: dotfile + '.' + dot_format,
build_by_default: true,
)
endforeach

sed = find_program('sed', required: true)
distver = get_option('api-docs-distver')
if distver == ''
command = [
'sh',
'-c',
sed.full_path() + ' -e \'s|@@PROJECT_NUMBER@@|$(date +%Y%m%d)|\' @INPUT@',
]
else
command = [sed, '-e', 's|@@PROJECT_NUMBER@@|' + distver + '|', '@INPUT@']
endif
xbps_api_doxyfile = custom_target(
command: command,
input: 'xbps_api_doxyfile.in',
capture: true,
output: 'xbps_api_doxyfile',
)

run_target('doxygen', command: [doxygen, xbps_api_doxyfile])
11 changes: 11 additions & 0 deletions include/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
xbps_h_configure_target = configure_file(
input: 'xbps.h.in',
output: 'xbps.h',
copy: true,
install: true,
install_dir: get_option('includedir'),
)

install_subdir('xbps', install_dir: get_option('includedir'))

xbps_include = include_directories('.')
19 changes: 19 additions & 0 deletions lib/compat/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
compat_functions = []

if not compatibility_functions['vasprintf']
compat_functions += 'vasprintf.c'
endif
if not compatibility_functions['strcasestr']
compat_functions += 'strcasestr.c'
endif
if not compatibility_functions['strlcpy']
compat_functions += 'strlcpy.c'
endif
if not compatibility_functions['strlcat']
compat_functions += 'strlcat.c'
endif
if not compatibility_functions['humanize_number']
compat_functions += 'humanize_number.c'
endif

compat_files = files(compat_functions)
1 change: 1 addition & 0 deletions lib/external/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
external_files = files('dewey.c', 'fexec.c', 'mkpath.c')
43 changes: 43 additions & 0 deletions lib/fetch/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
src = ['common.c', 'fetch.c', 'file.c', 'ftp.c', 'http.c']

strnstr_code = '''
#include <string.h>
int main(void) {
const char big[] = "foo";
const char little[] = "f";
strnstr(big, little, 3);
return 0;
}
'''

enable_strnstr = []
CC = meson.get_compiler('c')
if CC.links(strnstr_code, name: 'strnstr() available')
enable_strnstr = '-DHAVE_STRNSTR'
endif

ftperr = custom_target(
'ftperr',
command: [files('errlist.sh'), 'ftp_errlist', 'FTP', '@INPUT@'],
capture: true,
input: 'ftp.errors',
output: 'ftperr.h',
)

httperr = custom_target(
'httperr',
command: [files('errlist.sh'), 'http_errlist', 'HTTP', '@INPUT@'],
capture: true,
input: 'http.errors',
output: 'httperr.h',
)

libfetch = static_library(
'fetch',
src,
ftperr,
httperr,
c_args: ['-DFTP_COMBINE_CWDS', '-DINET6', '-DWITH_SSL', enable_strnstr],
gnu_symbol_visibility: 'hidden',
include_directories: [xbps_include, '.'],
)
Loading
Loading