Annotation of /trunk/include/cmake.sminc
Parent Directory | Revision Log
Revision 29992 -
(hide annotations)
(download)
Fri Oct 20 06:34:55 2017 UTC (7 years ago) by niro
File size: 4781 byte(s)
Fri Oct 20 06:34:55 2017 UTC (7 years ago) by niro
File size: 4781 byte(s)
-path trough cmake_configure opts in cmake_src_compile()
1 | niro | 2 | # $Header: /magellan-cvs/smage/include/cmake.sminc,v 1.9 2008/04/20 17:40:19 niro Exp $ |
2 | # cmake config tools | ||
3 | |||
4 | SDEPEND="${SDEPEND} | ||
5 | niro | 29889 | >= dev-util/cmake-2.4.7 |
6 | >= virtual/sed" | ||
7 | niro | 2 | |
8 | # enables features like --enable-blah with make | ||
9 | cmake_enable() | ||
10 | { | ||
11 | local feature="$1" | ||
12 | local option="$2" | ||
13 | [[ -z ${option} ]] && option=ON | ||
14 | |||
15 | echo "-DENABLE_${feature}=${option}" | ||
16 | } | ||
17 | |||
18 | # disables features like --disable-blah with make | ||
19 | cmake_disable() | ||
20 | { | ||
21 | local feature="$1" | ||
22 | echo "-DENABLE_${feature}=OFF" | ||
23 | } | ||
24 | |||
25 | # enables features like --with-blah with make | ||
26 | cmake_with() | ||
27 | { | ||
28 | local feature="$1" | ||
29 | local option="$2" | ||
30 | [[ -z ${option} ]] && option=ON | ||
31 | |||
32 | echo "-DWITH_${feature}=${option}" | ||
33 | } | ||
34 | |||
35 | # enables features like --with-blah with make | ||
36 | cmake_without() | ||
37 | { | ||
38 | local feature="$1" | ||
39 | echo "-DWITH_${feature}=OFF" | ||
40 | } | ||
41 | |||
42 | # tell cmake that we support a feature | ||
43 | cmake_have() | ||
44 | { | ||
45 | local feature="$1" | ||
46 | local option="$2" | ||
47 | [[ -z ${option} ]] && option=ON | ||
48 | |||
49 | echo "-DHAVE_${feature}=${option}" | ||
50 | } | ||
51 | |||
52 | # tell cmake that we don't support a feature | ||
53 | cmake_have_not() | ||
54 | { | ||
55 | local feature="$1" | ||
56 | echo "-DHAVE_${feature}=OFF" | ||
57 | } | ||
58 | |||
59 | # tell cmake that we want a feature | ||
60 | cmake_want() | ||
61 | { | ||
62 | local feature="$1" | ||
63 | local option="$2" | ||
64 | [[ -z ${option} ]] && option=ON | ||
65 | |||
66 | echo "-DWANT_${feature}=${option}" | ||
67 | } | ||
68 | |||
69 | # tell cmake that we don't want a feature | ||
70 | cmake_want_not() | ||
71 | { | ||
72 | local feature="$1" | ||
73 | echo "-DWANT_${feature}=OFF" | ||
74 | } | ||
75 | |||
76 | # tell cmake that we don't want a feature using -DNO | ||
77 | cmake_no() | ||
78 | { | ||
79 | local feature="$1" | ||
80 | echo "-DNO_${feature}=1" | ||
81 | } | ||
82 | |||
83 | # tell cmake that we forcefully build a feature | ||
84 | cmake_build() | ||
85 | { | ||
86 | local feature="$1" | ||
87 | local option="$2" | ||
88 | [[ -z ${option} ]] && option=ON | ||
89 | |||
90 | echo "-DBUILD_${feature}=${option}" | ||
91 | } | ||
92 | |||
93 | # tell cmake that we don't build a feature | ||
94 | cmake_build_not() | ||
95 | { | ||
96 | local feature="$1" | ||
97 | echo "-DBUILD_${feature}=OFF" | ||
98 | } | ||
99 | |||
100 | niro | 8012 | # install cmake opts |
101 | cmake_install() | ||
102 | { | ||
103 | local feature="$1" | ||
104 | local option="$2" | ||
105 | niro | 8018 | echo "-DINSTALL_${feature}=${option}" |
106 | niro | 8012 | } |
107 | |||
108 | # generic cmake opts | ||
109 | cmake_opt() | ||
110 | { | ||
111 | local feature="$1" | ||
112 | local option="$2" | ||
113 | niro | 8018 | echo "-D${feature}=${option}" |
114 | niro | 8012 | } |
115 | |||
116 | niro | 29889 | cmake_libsuffix() |
117 | { | ||
118 | local libsuffix | ||
119 | |||
120 | libsuffix="$(mlibdir)" | ||
121 | libsuffix="${libsuffix/lib}" | ||
122 | echo "${libsuffix}" | ||
123 | } | ||
124 | |||
125 | niro | 2 | cmake_src_prepare() |
126 | { | ||
127 | munpack ${SRCFILE} || die | ||
128 | } | ||
129 | |||
130 | cmake_configure() | ||
131 | { | ||
132 | local configure_opts="$@" | ||
133 | niro | 29802 | local default_opts |
134 | niro | 2 | |
135 | # disable colors if requested | ||
136 | if [[ ${NOCOLORS} = true ]] | ||
137 | then | ||
138 | niro | 29802 | default_opts+=" -DCMAKE_COLOR_MAKEFILE=OFF" |
139 | niro | 2 | fi |
140 | |||
141 | niro | 29802 | default_opts+=" -DCMAKE_VERBOSE_MAKEFILE=ON" |
142 | default_opts+=" -DCMAKE_BUILD_TYPE=Release" | ||
143 | default_opts+=" -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr}" | ||
144 | niro | 29889 | default_opts+=' -DLIB_SUFFIX=$(cmake_libsuffix)' |
145 | niro | 29810 | default_opts+=' -DLIB_INSTALL_DIR=${PREFIX:-/usr}/$(mlibdir)' |
146 | niro | 29802 | |
147 | if [[ ${MULTILIB_BUILD} = true ]] | ||
148 | then | ||
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 | niro | 29886 | cd ${BUILDDIR}/build-${abi} |
157 | niro | 29889 | abi-${abi} cmake ${default_opts} ${configure_opts} ${SRCDIR}-${abi}/${SRCSUBDIR} || die |
158 | niro | 29802 | done |
159 | else | ||
160 | cd ${BUILDDIR}/build | ||
161 | cmake ${default_opts} ${configure_opts} ${SRCDIR}/${SRCSUBDIR} || die | ||
162 | fi | ||
163 | niro | 2 | } |
164 | |||
165 | niro | 29802 | cmake_setup_builddir() |
166 | { | ||
167 | if [[ ${MULTILIB_BUILD} = true ]] | ||
168 | then | ||
169 | all-abis install -d ${BUILDDIR}/build-$(mabi) || die | ||
170 | else | ||
171 | install -d ${BUILDDIR}/build || die | ||
172 | fi | ||
173 | } | ||
174 | |||
175 | niro | 2 | cmake_src_compile() |
176 | { | ||
177 | cd ${SRCDIR} | ||
178 | |||
179 | niro | 29802 | cmake_setup_builddir || die |
180 | niro | 29992 | cmake_configure "$@" || die |
181 | niro | 29991 | mmake -C ${BUILDDIR}/build-$(mabi) || die |
182 | niro | 2 | } |
183 | |||
184 | niro | 20976 | cmake_src_check() |
185 | { | ||
186 | niro | 21166 | #cd ${BUILDDIR}/build |
187 | #mmake -j1 -k check || die | ||
188 | return 0 | ||
189 | niro | 20976 | } |
190 | |||
191 | niro | 29802 | cmake_multilib_src_check() |
192 | { | ||
193 | #local abi | ||
194 | #local abis_to_run="${MULTILIB_ABIS}" | ||
195 | # | ||
196 | ## respect MULTILIB_ONLY_ABI variable | ||
197 | #[[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
198 | #for abi in ${abis_to_run} | ||
199 | #do | ||
200 | # cd ${BUILDDIR}/build-${abi} | ||
201 | # mmake -j1 -k check || die | ||
202 | #done | ||
203 | return 0 | ||
204 | } | ||
205 | |||
206 | niro | 2 | cmake_src_install() |
207 | { | ||
208 | niro | 4858 | cd ${BUILDDIR}/build |
209 | niro | 29887 | make ${MAKEOPTS} DESTDIR=${BINDIR} install || die |
210 | niro | 2 | |
211 | niro | 4859 | cd ${SRCDIR} |
212 | niro | 2 | local i |
213 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
214 | FAQ LICENSE NEWS README TODO | ||
215 | do | ||
216 | if [ -f ${SRCDIR}/${i} ] | ||
217 | then | ||
218 | minstalldocs ${i} || die | ||
219 | fi | ||
220 | done | ||
221 | } | ||
222 | |||
223 | niro | 29802 | cmake_multilib_src_install() |
224 | { | ||
225 | local abi | ||
226 | local abis_to_run="${MULTILIB_ABIS}" | ||
227 | |||
228 | # respect MULTILIB_ONLY_ABI variable | ||
229 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
230 | for abi in ${abis_to_run} | ||
231 | do | ||
232 | cd ${BUILDDIR}/build-${abi} | ||
233 | niro | 29890 | abi-${abi} make ${MAKEOPTS} DESTDIR=${BINDIR} install || die |
234 | niro | 29802 | |
235 | cd ${SRCDIR}-${abi} | ||
236 | local i | ||
237 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
238 | FAQ LICENSE NEWS README TODO | ||
239 | do | ||
240 | if [ -f ${SRCDIR}-${abi}/${i} ] | ||
241 | then | ||
242 | minstalldocs ${i} || die | ||
243 | fi | ||
244 | done | ||
245 | done | ||
246 | } | ||
247 | |||
248 | export_inherits cmake src_prepare src_compile | ||
249 | if [[ ${MULTILIB_BUILD} = true ]] | ||
250 | then | ||
251 | export_inherits cmake_multilib src_check src_install | ||
252 | else | ||
253 | export_inherits cmake src_check src_install | ||
254 | fi |