Magellan Linux

Contents of /trunk/include/meson.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 30741 - (show annotations) (download)
Tue Mar 27 12:08:28 2018 UTC (6 years, 1 month ago) by niro
File size: 3513 byte(s)
-meson_configure(): fixed mlibdir evaluation
1 # $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 echo "-Denable-${feature}=false"
23 }
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 local default_opts
59
60 default_opts+=" --buildtype=release"
61 default_opts+=" --prefix=/usr"
62 default_opts+=" --sysconfdir=/etc"
63 default_opts+=" --localstatedir=/var/lib"
64 default_opts+=' --libexecdir=/usr/$(mlibdir)/${PNAME}'
65
66 if [[ ${MULTILIB_BUILD} = true ]]
67 then
68 # must be escaped so the mlibdir variable gets evaluated later
69 default_opts+=' --libdir=/usr/$(mlibdir)'
70 all-abis meson setup ${default_opts} ${configure_opts} ${SRCDIR}-$(mabi)/${SRCSUBDIR} ${BUILDDIR}/build-$(mabi) || die
71 else
72 # the mlibdir variable gets right now evaluated
73 default_opts+=" --libdir=/usr/$(mlibdir)"
74 meson setup ${default_opts} ${configure_opts} ${SRCDIR}/${SRCSUBDIR} ${BUILDDIR}/build || die
75 fi
76 }
77
78 mninja()
79 {
80 if [[ ${MULTILIB_BUILD} = true ]]
81 then
82 all-abis ninja -C ${SRCDIR}-$(mabi)/${SRCSUBDIR} -C ${BUILDDIR}/build-$(mabi) -v ${MAKEOPTS} "$@"
83 else
84 ninja -C ${SRCDIR}/${SRCSUBDIR} -C ${BUILDDIR}/build -v ${MAKEOPTS} "$@"
85 fi
86 }
87
88 meson_setup_builddir()
89 {
90 if [[ ${MULTILIB_BUILD} = true ]]
91 then
92 all-abis install -d ${BUILDDIR}/build-$(mabi) || die
93 else
94 install -d ${BUILDDIR}/build || die
95 fi
96 }
97
98 meson_src_compile()
99 {
100 if [[ ${MULTILIB_BUILD} != true ]]
101 then
102 cd ${SRCDIR}
103 fi
104
105 meson_setup_builddir || die
106 meson_configure "$@" || die
107 mninja || die
108 }
109
110 meson_src_check()
111 {
112 cd ${BUILDDIR}/build
113 meson test || die
114 }
115
116 meson_multilib_src_check()
117 {
118 local abi
119 local abis_to_run="${MULTILIB_ABIS}"
120
121 # respect MULTILIB_ONLY_ABI variable
122 [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
123 for abi in ${abis_to_run}
124 do
125 cd ${BUILDDIR}/build-${abi}
126 meson test || die
127 done
128 }
129
130 meson_src_install()
131 {
132 cd ${BUILDDIR}/build
133 DESTDIR=${BINDIR} ninja install || die
134
135 cd ${SRCDIR}
136 local i
137 for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
138 FAQ LICENSE NEWS README TODO
139 do
140 if [ -f ${SRCDIR}/${i} ]
141 then
142 minstalldocs ${i} || die
143 fi
144 done
145 }
146
147 meson_multilib_src_install()
148 {
149 local abi
150 local abis_to_run="${MULTILIB_ABIS}"
151
152 # respect MULTILIB_ONLY_ABI variable
153 [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
154 for abi in ${abis_to_run}
155 do
156 cd ${BUILDDIR}/build-${abi}
157 DESTDIR=${BINDIR} ninja install || die
158
159 cd ${SRCDIR}-${abi}
160 local i
161 for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
162 FAQ LICENSE NEWS README TODO
163 do
164 if [ -f ${SRCDIR}-${abi}/${i} ]
165 then
166 minstalldocs ${i} || die
167 fi
168 done
169 done
170 }
171
172 export_inherits meson src_prepare src_compile
173 if [[ ${MULTILIB_BUILD} = true ]]
174 then
175 export_inherits meson_multilib src_check src_install
176 else
177 export_inherits meson src_check src_install
178 fi