project(
'meson-test', ['c'],
default_options: [
'prefix=/usr/local',
]
)
prefixdir = get_option('prefix')
datadir = join_paths(prefixdir, get_option('datadir'))
sbindir = join_paths(prefixdir, get_option('sbindir'))
sysconfdir1 = join_paths(prefixdir, get_option('sysconfdir'))
sysconfdir2 = prefixdir / get_option('sysconfdir')
sysconfdir3 = prefixdir + get_option('sysconfdir')
message('datadir: ' + datadir)
message('sbindir: ' + sbindir)
message('sysconfdir1: ' + sysconfdir1)
message('sysconfdir2: ' + sysconfdir2)
message('sysconfdir3: ' + sysconfdir3)
** with /etc as sysconfdir
$ muon setup .build-muon
detected compiler gcc '12.2.1' (['cc']), linker ld.bfd
configuring 'meson-test', version: undefined
message datadir: /usr/local/share
message sbindir: /usr/local/sbin
message sysconfdir1: /etc
message sysconfdir2: /etc
message sysconfdir3: /usr/local/etc
$ meson setup .build
The Meson build system
Version: 1.0.1
Source dir: /home/wagi/work/meson-test
Build dir: /home/wagi/work/meson-test/.build
Build type: native build
Project name: meson-test
Project version: undefined
C compiler for the host machine: cc (gcc 12.2.1 "cc (SUSE Linux) 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27]")
C linker for the host machine: cc ld.bfd 2.40.20230127-2
Host machine cpu family: x86_64
Host machine cpu: x86_64
Message: datadir: /usr/local/share
Message: sbindir: /usr/local/sbin
Message: sysconfdir1: /usr/local/etc
Message: sysconfdir2: /usr/local/etc
Message: sysconfdir3: /usr/localetc
Build targets in project: 0
Found ninja-1.11.1 at /usr/bin/ninja
** with 'etc' as sysconfdir
$ muon setup -Dsysconfdir=etc .build-muon
detected compiler gcc '12.2.1' (['cc']), linker ld.bfd
configuring 'meson-test', version: undefined
message datadir: /usr/local/share
message sbindir: /usr/local/sbin
message sysconfdir1: /usr/local/etc
message sysconfdir2: /usr/local/etc
message sysconfdir3: /usr/localetc
setup complete
$ meson setup -Dsysconfdir=etc .build
The Meson build system
Version: 1.0.1
Source dir: /home/wagi/work/meson-test
Build dir: /home/wagi/work/meson-test/.build
Build type: native build
Project name: meson-test
Project version: undefined
C compiler for the host machine: cc (gcc 12.2.1 "cc (SUSE Linux) 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27]")
C linker for the host machine: cc ld.bfd 2.40.20230127-2
Host machine cpu family: x86_64
Host machine cpu: x86_64
Message: datadir: /usr/local/share
Message: sbindir: /usr/local/sbin
Message: sysconfdir1: /usr/local/etc
Message: sysconfdir2: /usr/local/etc
Message: sysconfdir3: /usr/localetc
Build targets in project: 0
meson-test undefined
User defined options
sysconfdir: etc
Found ninja-1.11.1 at /usr/bin/ninja
I am a bit lost how to write a a meson.build file which works for Meson and
muon and give the correct result. Though I am not really sure what 'correct'
means here. When the sysconfdir is not absolut both tools do the same thing
but with the absolute path Meson is always prefixing whereas muon honors
the absolute path. I tend to say muon is more right.
I wasn't able to figure out this by looking at the documentation (maybe I just
missed the important part).
Thanks,
Daniel
ps: Sorry for the HTML mess, writing this via a web interface