Contents of /branches/R11-unstable/include/cmake.sminc
Parent Directory | Revision Log
Revision 24893 -
(show annotations)
(download)
Tue Nov 25 02:21:44 2014 UTC (9 years, 11 months ago) by niro
File size: 3192 byte(s)
Tue Nov 25 02:21:44 2014 UTC (9 years, 11 months ago) by niro
File size: 3192 byte(s)
-release R11-unstable
1 | # $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 | >= dev-util/cmake-2.4.7" |
6 | |
7 | # enables features like --enable-blah with make |
8 | cmake_enable() |
9 | { |
10 | local feature="$1" |
11 | local option="$2" |
12 | [[ -z ${option} ]] && option=ON |
13 | |
14 | echo "-DENABLE_${feature}=${option}" |
15 | } |
16 | |
17 | # disables features like --disable-blah with make |
18 | cmake_disable() |
19 | { |
20 | local feature="$1" |
21 | echo "-DENABLE_${feature}=OFF" |
22 | } |
23 | |
24 | # enables features like --with-blah with make |
25 | cmake_with() |
26 | { |
27 | local feature="$1" |
28 | local option="$2" |
29 | [[ -z ${option} ]] && option=ON |
30 | |
31 | echo "-DWITH_${feature}=${option}" |
32 | } |
33 | |
34 | # enables features like --with-blah with make |
35 | cmake_without() |
36 | { |
37 | local feature="$1" |
38 | echo "-DWITH_${feature}=OFF" |
39 | } |
40 | |
41 | # tell cmake that we support a feature |
42 | cmake_have() |
43 | { |
44 | local feature="$1" |
45 | local option="$2" |
46 | [[ -z ${option} ]] && option=ON |
47 | |
48 | echo "-DHAVE_${feature}=${option}" |
49 | } |
50 | |
51 | # tell cmake that we don't support a feature |
52 | cmake_have_not() |
53 | { |
54 | local feature="$1" |
55 | echo "-DHAVE_${feature}=OFF" |
56 | } |
57 | |
58 | # tell cmake that we want a feature |
59 | cmake_want() |
60 | { |
61 | local feature="$1" |
62 | local option="$2" |
63 | [[ -z ${option} ]] && option=ON |
64 | |
65 | echo "-DWANT_${feature}=${option}" |
66 | } |
67 | |
68 | # tell cmake that we don't want a feature |
69 | cmake_want_not() |
70 | { |
71 | local feature="$1" |
72 | echo "-DWANT_${feature}=OFF" |
73 | } |
74 | |
75 | # tell cmake that we don't want a feature using -DNO |
76 | cmake_no() |
77 | { |
78 | local feature="$1" |
79 | echo "-DNO_${feature}=1" |
80 | } |
81 | |
82 | # tell cmake that we forcefully build a feature |
83 | cmake_build() |
84 | { |
85 | local feature="$1" |
86 | local option="$2" |
87 | [[ -z ${option} ]] && option=ON |
88 | |
89 | echo "-DBUILD_${feature}=${option}" |
90 | } |
91 | |
92 | # tell cmake that we don't build a feature |
93 | cmake_build_not() |
94 | { |
95 | local feature="$1" |
96 | echo "-DBUILD_${feature}=OFF" |
97 | } |
98 | |
99 | # install cmake opts |
100 | cmake_install() |
101 | { |
102 | local feature="$1" |
103 | local option="$2" |
104 | echo "-DINSTALL_${feature}=${option}" |
105 | } |
106 | |
107 | # generic cmake opts |
108 | cmake_opt() |
109 | { |
110 | local feature="$1" |
111 | local option="$2" |
112 | echo "-D${feature}=${option}" |
113 | } |
114 | |
115 | cmake_src_prepare() |
116 | { |
117 | munpack ${SRCFILE} || die |
118 | } |
119 | |
120 | cmake_configure() |
121 | { |
122 | local configure_opts="$@" |
123 | local libsuffix="$(mlibdir)" |
124 | local libsuffix="${libsuffix/lib}" |
125 | |
126 | # disable colors if requested |
127 | if [[ ${NOCOLORS} = true ]] |
128 | then |
129 | configure_opts="${configure_opts} -DCMAKE_COLOR_MAKEFILE=OFF" |
130 | fi |
131 | |
132 | cmake \ |
133 | -DCMAKE_VERBOSE_MAKEFILE=ON \ |
134 | -DCMAKE_BUILD_TYPE=Release \ |
135 | -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr} \ |
136 | -DLIB_SUFFIX=${libsuffix} \ |
137 | -DLIB_INSTALL_DIR=${PREFIX:-/usr}/$(mlibdir) \ |
138 | ${configure_opts} \ |
139 | ${SRCDIR}/${SRCSUBDIR} \ |
140 | || die |
141 | } |
142 | |
143 | cmake_src_compile() |
144 | { |
145 | cd ${SRCDIR} |
146 | |
147 | # remove build dir if exist |
148 | [[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build |
149 | |
150 | # build outside of the source dir |
151 | install -d ${BUILDDIR}/build || die |
152 | cd ${BUILDDIR}/build |
153 | |
154 | cmake_configure || die |
155 | mmake || die |
156 | } |
157 | |
158 | cmake_src_check() |
159 | { |
160 | #cd ${BUILDDIR}/build |
161 | #mmake -j1 -k check || die |
162 | return 0 |
163 | } |
164 | |
165 | cmake_src_install() |
166 | { |
167 | cd ${BUILDDIR}/build |
168 | make DESTDIR=${BINDIR} install || die |
169 | |
170 | cd ${SRCDIR} |
171 | local i |
172 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
173 | FAQ LICENSE NEWS README TODO |
174 | do |
175 | if [ -f ${SRCDIR}/${i} ] |
176 | then |
177 | minstalldocs ${i} || die |
178 | fi |
179 | done |
180 | } |
181 | |
182 | export_inherits cmake src_prepare src_compile src_check src_install |