Magellan Linux

Contents of /branches/magellan-next/include/cmake.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6654 - (show annotations) (download)
Tue Sep 14 16:46:32 2010 UTC (13 years, 7 months ago) by niro
File size: 2825 byte(s)
imported from trunk
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 cmake_src_prepare()
100 {
101 munpack ${SRCFILE} || die
102 }
103
104 cmake_configure()
105 {
106 local configure_opts="$@"
107 local libsuffix="$(mlibdir)"
108 local libsuffix="${libsuffix/lib}"
109
110 # disable colors if requested
111 if [[ ${NOCOLORS} = true ]]
112 then
113 configure_opts="${configure_opts} -DCMAKE_COLOR_MAKEFILE=OFF"
114 fi
115
116 cmake \
117 -DCMAKE_BUILD_TYPE=Release \
118 -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr} \
119 -DLIB_SUFFIX=${libsuffix} \
120 -DLIB_INSTALL_DIR=${PREFIX:-/usr}/$(mlibdir) \
121 ${configure_opts} \
122 ${SRCDIR} \
123 || die
124 }
125
126 cmake_src_compile()
127 {
128 cd ${SRCDIR}
129
130 # remove build dir if exist
131 [[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build
132
133 # build outside of the source dir
134 install -d ${BUILDDIR}/build || die
135 cd ${BUILDDIR}/build
136
137 cmake_configure || die
138 mmake || die
139 }
140
141 cmake_src_install()
142 {
143 cd ${BUILDDIR}/build
144 make DESTDIR=${BINDIR} install || die
145
146 cd ${SRCDIR}
147 local i
148 for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
149 FAQ LICENSE NEWS README TODO
150 do
151 if [ -f ${SRCDIR}/${i} ]
152 then
153 minstalldocs ${i} || die
154 fi
155 done
156 }
157
158 export_inherits cmake src_prepare src_compile src_install