Magellan Linux

Annotation of /trunk/include/meson.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29798 - (hide annotations) (download)
Thu Oct 12 12:07:06 2017 UTC (7 years ago) by niro
File size: 3353 byte(s)
-set builddir in mninja
1 niro 29787 # $Id$
2     # meson config tools
3    
4     SDEPEND="${SDEPEND}
5     >= dev-util/meson-0.43
6     >= dev-util/ninja-1.8"
7    
8     # enables features like --enable-blah with make
9     meson_enable()
10     {
11     local feature="$1"
12     local option="$2"
13     [[ -z ${option} ]] && option="true"
14    
15     echo "-Denable-${feature}=${option}"
16     }
17    
18     # disables features like --disable-blah with make
19     meson_disable()
20     {
21     local feature="$1"
22 niro 29793 echo "-Denable-${feature}=false"
23 niro 29787 }
24    
25     # enables features like --with-blah with make
26     meson_with()
27     {
28     local feature="$1"
29     local option="$2"
30     [[ -z ${option} ]] && option="true"
31    
32     echo "-Dwith-${feature}=${option}"
33     }
34    
35     # enables features like --with-blah with make
36     meson_without()
37     {
38     local feature="$1"
39     echo "-Dwith-{feature}=false"
40     }
41    
42     # generic meson opts
43     meson_opt()
44     {
45     local feature="$1"
46     local option="$2"
47     echo "-D${feature}=${option}"
48     }
49    
50     meson_src_prepare()
51     {
52     munpack ${SRCFILE} || die
53     }
54    
55     meson_configure()
56     {
57     local configure_opts="$@"
58 niro 29793 local default_opts
59 niro 29787
60 niro 29793 default_opts+=" --buildtype=release"
61     default_opts+=" --prefix=/usr"
62     default_opts+=" --sysconfdir=/etc"
63     default_opts+=" --localstatedir=/var/lib"
64     default_opts+=" --libdir=/usr/$(mlibdir)"
65     default_opts+=" --libexecdir=/usr/$(mlibdir)/${PNAME}"
66    
67     if [[ ${MULTILIB_BUILD} = true ]]
68     then
69 niro 29797 all-abis meson setup ${default_opts} ${configure_opts} ${SRCDIR}-$(mabi)/${SRCSUBDIR} ${BUILDDIR}/build-$(mabi) || die
70 niro 29793 else
71 niro 29797 meson setup ${default_opts} ${configure_opts} ${SRCDIR}/${SRCSUBDIR} ${BUILDDIR}/build || die
72 niro 29793 fi
73 niro 29787 }
74    
75     mninja()
76     {
77 niro 29793 if [[ ${MULTILIB_BUILD} = true ]]
78     then
79 niro 29798 all-abis ninja -C ${SRCDIR}-$(mabi)/${SRCSUBDIR} -C ${BUILDDIR}/build-$(mabi) -v ${MAKEOPTS} "$@"
80 niro 29793 else
81 niro 29798 ninja -C ${SRCDIR}/${SRCSUBDIR} -C ${BUILDDIR}/build -v ${MAKEOPTS} "$@"
82 niro 29793 fi
83 niro 29787 }
84    
85 niro 29793 meson_setup_builddir()
86     {
87     if [[ ${MULTILIB_BUILD} = true ]]
88     then
89     all-abis install -d ${BUILDDIR}/build-$(mabi) || die
90     else
91     install -d ${BUILDDIR}/build || die
92     fi
93     }
94    
95 niro 29787 meson_src_compile()
96     {
97 niro 29793 if [[ ${MULTILIB_BUILD} != true ]]
98     then
99     cd ${SRCDIR}
100     fi
101 niro 29787
102 niro 29793 meson_setup_builddir || die
103     meson_configure "$@" || die
104 niro 29787 mninja || die
105     }
106    
107     meson_src_check()
108     {
109     cd ${BUILDDIR}/build
110     meson test || die
111     }
112    
113 niro 29793 meson_multilib_src_check()
114     {
115     local abi
116     local abis_to_run="${MULTILIB_ABIS}"
117    
118     # respect MULTILIB_ONLY_ABI variable
119     [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
120     for abi in ${abis_to_run}
121     do
122     cd ${BUILDDIR}/build-${abi}
123     meson test || die
124     done
125     }
126    
127 niro 29787 meson_src_install()
128     {
129     cd ${BUILDDIR}/build
130     DESTDIR=${BINDIR} ninja install || die
131    
132     cd ${SRCDIR}
133     local i
134     for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
135     FAQ LICENSE NEWS README TODO
136     do
137     if [ -f ${SRCDIR}/${i} ]
138     then
139     minstalldocs ${i} || die
140     fi
141     done
142     }
143    
144 niro 29793 meson_multilib_src_install()
145     {
146     local abi
147     local abis_to_run="${MULTILIB_ABIS}"
148    
149     # respect MULTILIB_ONLY_ABI variable
150     [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
151     for abi in ${abis_to_run}
152     do
153     cd ${BUILDDIR}/build-${abi}
154     DESTDIR=${BINDIR} ninja install || die
155    
156     cd ${SRCDIR}-${abi}
157     local i
158     for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
159     FAQ LICENSE NEWS README TODO
160     do
161     if [ -f ${SRCDIR}-${abi}/${i} ]
162     then
163     minstalldocs ${i} || die
164     fi
165     done
166     done
167     }
168    
169     export_inherits meson src_prepare src_compile
170     if [[ ${MULTILIB_BUILD} = true ]]
171     then
172     export_inherits meson_multilib src_check src_install
173     else
174     export_inherits meson src_check src_install
175     fi