2 # configure script adapter for Meson
3 # Based on build-api: https://github.com/cgwalters/build-api
4 # Copyright 2010, 2011, 2013 Colin Walters <walters@verbum.org>
5 # Copyright 2016, 2017 Emmanuele Bassi
6 # Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
10 # Little helper function for reading args from the commandline.
11 # it automatically handles -a b and -a=b variants, and returns 1 if
12 # we need to shift $3.
17 local rematch
='^[^=]*=(.*)$'
18 if [[ $2 =~
$rematch ]]; then
19 read "$1" <<< "${BASH_REMATCH[1]}"
22 # There is no way to shift our callers args, so
23 # return 1 to indicate they should do it instead.
32 local cmd
=$
( which $2 2>/dev
/null
)
34 if [ -x "$cmd" ]; then
41 cmd
=$
( which $alt 2>/dev
/null
)
43 if [ -x "$cmd" ]; then
50 echo -e "\e[1;31mERROR\e[0m: Command '$2' not found"
54 sanitycheck MESON
'meson'
55 sanitycheck NINJA
'ninja' 'ninja-build'
61 --prefix) read_arg prefix
"$@" ||
shift;;
62 --bindir) read_arg bindir
"$@" ||
shift;;
63 --sbindir) read_arg sbindir
"$@" ||
shift;;
64 --libexecdir) read_arg libexecdir
"$@" ||
shift;;
65 --datarootdir) read_arg datarootdir
"$@" ||
shift;;
66 --datadir) read_arg datadir
"$@" ||
shift;;
67 --sysconfdir) read_arg sysconfdir
"$@" ||
shift;;
68 --libdir) read_arg libdir
"$@" ||
shift;;
69 --mandir) read_arg mandir
"$@" ||
shift;;
70 --includedir) read_arg includedir
"$@" ||
shift;;
71 --enable-*) enables
+=("-D${1/--enable-/}=true");;
72 --disable-*) enables
+=("-D${1/--disable-/}=false");;
73 *) echo -e "\e[1;33mINFO\e[0m: Ignoring unknown option '$1'";;
79 test -z ${prefix} && prefix
="/usr/local"
80 test -z ${bindir} && bindir
=${prefix}/bin
81 test -z ${sbindir} && sbindir
=${prefix}/sbin
82 test -z ${libexecdir} && libexecdir
=${prefix}/bin
83 test -z ${datarootdir} && datarootdir
=${prefix}/share
84 test -z ${datadir} && datadir
=${datarootdir}
85 test -z ${sysconfdir} && sysconfdir
=${prefix}/etc
86 test -z ${libdir} && libdir
=${prefix}/lib
87 test -z ${mandir} && mandir
=${prefix}/share
/man
88 test -z ${includedir} && includedir
=${prefix}/include
90 # The source directory is the location of this file
93 # The build directory is the current location
96 # If we're calling this file from the source directory then
97 # we automatically create a build directory and ensure that
98 # both Meson and Ninja invocations are relative to that
100 if [[ -f "${builddir}/meson.build" ]]; then
102 builddir
="${builddir}/_build"
103 NINJA_OPT
="-C ${builddir}"
106 # Wrapper Makefile for Ninja
108 # Generated by configure; do not edit
111 CC="\$(CC)" CXX="\$(CXX)" ${NINJA} ${NINJA_OPT}
114 DESTDIR="\$(DESTDIR)" ${NINJA} ${NINJA_OPT} install
117 ${MESON} test ${NINJA_OPT}
121 echo " meson:....... ${MESON}"
122 echo " ninja:....... ${NINJA}"
123 echo " prefix:...... ${prefix}"
124 echo " bindir:...... ${bindir}"
125 echo " sbindir:..... ${sbindir}"
126 echo " libexecdir:.. ${libexecdir}"
127 echo " datarootdir:. ${datarootdir}"
128 echo " datadir:..... ${datadir}"
129 echo " sysconfdir:.. ${sysconfdir}"
130 echo " libdir:...... ${libdir}"
131 echo " mandir:...... ${mandir}"
132 echo " includedir:.. ${includedir}"
133 echo " extra: ${enables[@]}"
138 --libexecdir=${libexecdir} \
139 --datadir=${datadir} \
140 --sysconfdir=${sysconfdir} \
142 --includedir=${includedir} \
144 --default-library shared \
149 # vim: ai ts=8 noet sts=2 ft=sh