Magellan Linux

Annotation of /trunk/include/cmake.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8018 - (hide annotations) (download)
Tue Jun 28 22:04:41 2011 UTC (12 years, 10 months ago) by niro
Original Path: branches/magellan-next/include/cmake.sminc
File size: 3053 byte(s)
-no escaping
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     >= 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 niro 8012 # install cmake opts
100     cmake_install()
101     {
102     local feature="$1"
103     local option="$2"
104 niro 8018 echo "-DINSTALL_${feature}=${option}"
105 niro 8012 }
106    
107     # generic cmake opts
108     cmake_opt()
109     {
110     local feature="$1"
111     local option="$2"
112 niro 8018 echo "-D${feature}=${option}"
113 niro 8012 }
114    
115 niro 2 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_BUILD_TYPE=Release \
134     -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr} \
135     -DLIB_SUFFIX=${libsuffix} \
136     -DLIB_INSTALL_DIR=${PREFIX:-/usr}/$(mlibdir) \
137     ${configure_opts} \
138     ${SRCDIR} \
139     || die
140     }
141    
142     cmake_src_compile()
143     {
144     cd ${SRCDIR}
145    
146 niro 4858 # remove build dir if exist
147     [[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build
148    
149     # build outside of the source dir
150     install -d ${BUILDDIR}/build || die
151     cd ${BUILDDIR}/build
152    
153 niro 2 cmake_configure || die
154     mmake || die
155     }
156    
157     cmake_src_install()
158     {
159 niro 4858 cd ${BUILDDIR}/build
160 niro 2 make DESTDIR=${BINDIR} install || die
161    
162 niro 4859 cd ${SRCDIR}
163 niro 2 local i
164     for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
165     FAQ LICENSE NEWS README TODO
166     do
167     if [ -f ${SRCDIR}/${i} ]
168     then
169     minstalldocs ${i} || die
170     fi
171     done
172     }
173    
174     export_inherits cmake src_prepare src_compile src_install