632b8f39e4612e9a4db9b75fddb4453ff10a7cfa
[systembsd.git] / scripts / gen-gdbus-interfaces.sh
1 #!/bin/sh
2
3 # Copyright (c) 2014 Ian Sutton <ian@kremlin.cc>
4 #
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
17 # cd to root of repository
18 REPO=$(dirname "$(readlink -f $0)")/../
19 cd $REPO
20
21 if [[ $# -ne 1 ]];then
22 echo "syntax: ./gen-dbus-interfaces <interface name>"
23 exit 1
24 elif [[ $1 != "hostnamed" && $1 != "localed" && $1 != "timedated" && $1 != "logind" ]];then
25 echo "<interface name> must be 'hostnamed', 'localed', 'timedated', or 'logind'"
26 exit 1
27 fi
28
29 # cd to interface-specific source directory to avoid preprocessor pathing bug
30 cd src/interfaces/$1
31
32 gdbus-codegen \
33 --interface-prefix org.freedesktop. \
34 --generate-docbook $REPO/doc/$1-docbook.xml \
35 --generate-c-code $1-gen \
36 $REPO/conf/$1-ispect.xml
37
38 echo "Success"
39 exit 0