Magellan Linux

Diff of /smage/branches/alx07x-stable/include/cmake.sminc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

smage/trunk/include/cmake.sminc revision 3582 by niro, Mon Jul 9 17:44:57 2012 UTC smage/branches/alx07x-stable/include/cmake.sminc revision 15579 by niro, Fri Sep 11 05:43:27 2020 UTC
# Line 2  Line 2 
2  # cmake config tools  # cmake config tools
3    
4  SDEPEND="${SDEPEND}  SDEPEND="${SDEPEND}
5   >= dev-util/cmake-2.4.7"   >= dev-util/cmake-2.4.7
6     >= virtual/sed"
7    
8  # enables features like --enable-blah with make  # enables features like --enable-blah with make
9  cmake_enable()  cmake_enable()
# Line 112  cmake_opt() Line 113  cmake_opt()
113   echo "-D${feature}=${option}"   echo "-D${feature}=${option}"
114  }  }
115    
116    cmake_libsuffix()
117    {
118     local libsuffix
119    
120     libsuffix="$(mlibdir)"
121     libsuffix="${libsuffix/lib}"
122     echo "${libsuffix}"
123    }
124    
125  cmake_src_prepare()  cmake_src_prepare()
126  {  {
127   munpack ${SRCFILE} || die   munpack ${SRCFILE} || die
# Line 120  cmake_src_prepare() Line 130  cmake_src_prepare()
130  cmake_configure()  cmake_configure()
131  {  {
132   local configure_opts="$@"   local configure_opts="$@"
133   local libsuffix="$(mlibdir)"   local default_opts
134   local libsuffix="${libsuffix/lib}"   [[ -n ${CMAKE_SRCDIR} ]] || local CMAKE_SRCDIR
135     [[ -n ${CMAKE_BUILDDIR} ]] || local CMAKE_BUILDDIR
136    
137   # disable colors if requested   # disable colors if requested
138   if [[ ${NOCOLORS} = true ]]   if [[ ${NOCOLORS} = true ]]
139   then   then
140   configure_opts="${configure_opts} -DCMAKE_COLOR_MAKEFILE=OFF"   default_opts+=" -DCMAKE_COLOR_MAKEFILE=OFF"
141   fi   fi
142    
143   cmake \   default_opts+=" -DCMAKE_VERBOSE_MAKEFILE=ON"
144   -DCMAKE_VERBOSE_MAKEFILE=ON \   default_opts+=" -DCMAKE_BUILD_TYPE=Release"
145   -DCMAKE_BUILD_TYPE=Release \   default_opts+=" -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr}"
146   -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr} \   if [[ ${MULTILIB_BUILD} = true ]]
147   -DLIB_SUFFIX=${libsuffix} \   then
148   -DLIB_INSTALL_DIR=${PREFIX:-/usr}/$(mlibdir) \   # eval these variables later with the abi-${ABI} caller
149   ${configure_opts} \   default_opts+=' -DLIB_SUFFIX=$(cmake_libsuffix)'
150   ${SRCDIR} \   default_opts+=' -DLIB_INSTALL_DIR=${PREFIX:-/usr}/$(mlibdir)'
151   || die   default_opts+=' -DLIB_SUFFIX=$(cmake_libsuffix)'
152     else
153     # eval these variables now
154     default_opts+=" -DLIB_SUFFIX=$(cmake_libsuffix)"
155     default_opts+=" -DLIB_INSTALL_DIR=${PREFIX:-/usr}/$(mlibdir)"
156     default_opts+=" -DLIB_SUFFIX=$(cmake_libsuffix)"
157     fi
158    
159     if [[ ${MULTILIB_BUILD} = true ]]
160     then
161     local abi
162     local abis_to_run="${MULTILIB_ABIS}"
163    
164     # respect MULTILIB_ONLY_ABI variable
165     [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
166     for abi in ${abis_to_run}
167     do
168     : ${CMAKE_SRCDIR="${SRCDIR}-${abi}/${SRCSUBDIR}"}
169     : ${CMAKE_BUILDDIR="${BUILDDIR}/build-${abi}"}
170     cd ${CMAKE_BUILDDIR}
171     abi-${abi} cmake ${default_opts} ${configure_opts} ${CMAKE_SRCDIR} || die
172     done
173     else
174     : ${CMAKE_SRCDIR="${SRCDIR}/${SRCSUBDIR}"}
175     : ${CMAKE_BUILDDIR="${BUILDDIR}/build"}
176     cd ${BUILDDIR}/build
177     cmake ${default_opts} ${configure_opts} ${SRCDIR}/${SRCSUBDIR} || die
178     fi
179  }  }
180    
181  cmake_src_compile()  cmake_setup_builddir()
182    {
183     [[ -n ${CMAKE_BUILDDIR} ]] || local CMAKE_BUILDDIR
184    
185     if [[ ${MULTILIB_BUILD} = true ]]
186     then
187     : ${CMAKE_BUILDDIR="${BUILDDIR}/build-$(mabi)"}
188     all-abis install -d ${CMAKE_BUILDDIR} || die
189     else
190     : ${CMAKE_BUILDDIR="${BUILDDIR}/build"}
191     install -d ${CMAKE_BUILDDIR} || die
192     fi
193    }
194    
195    cmake_mmake()
196  {  {
197   cd ${SRCDIR}   [[ -n ${CMAKE_BUILDDIR} ]] || local CMAKE_BUILDDIR
198    
199     if [[ ${MULTILIB_BUILD} = true ]]
200     then
201     : ${CMAKE_BUILDDIR="${BUILDDIR}/build-$(mabi)"}
202     mmake -C ${CMAKE_BUILDDIR} "$@" || die
203     else
204     : ${CMAKE_BUILDDIR="${BUILDDIR}/build"}
205     mmake -C ${CMAKE_BUILDDIR} "$@" || die
206     fi
207    }
208    
209   # remove build dir if exist  cmake_src_compile()
210   [[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build  {
211     [[ -n ${CMAKE_SRCDIR} ]] || local CMAKE_SRCDIR
212    
213   # build outside of the source dir   if [[ ${MULTILIB_BUILD} = true ]]
214   install -d ${BUILDDIR}/build || die   then
215   cd ${BUILDDIR}/build   : ${CMAKE_SRCDIR="${SRCDIR}-$(mabi)/${SRCSUBDIR}"}
216     else
217     : ${CMAKE_SRCDIR="${SRCDIR}"}
218     fi
219     cd ${CMAKE_SRCDIR}
220    
221   cmake_configure || die   cmake_setup_builddir || die
222   mmake || die   cmake_configure "$@" || die
223     cmake_mmake || die
224    }
225    
226    cmake_src_check()
227    {
228     #[[ -n ${CMAKE_BUILDDIR} ]] || local CMAKE_BUILDDIR
229     #
230     #: ${CMAKE_BUILDDIR="${BUILDDIR}/build"}
231     #cd ${CMAKE_BUILDDIR}
232     #mmake -j1 -k check || die
233     return 0
234    }
235    
236    cmake_multilib_src_check()
237    {
238     #[[ -n ${CMAKE_BUILDDIR} ]] || local CMAKE_BUILDDIR
239     #
240     #local abi
241     #local abis_to_run="${MULTILIB_ABIS}"
242     #
243     ## respect MULTILIB_ONLY_ABI variable
244     #[[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
245     #for abi in ${abis_to_run}
246     #do
247     # : ${CMAKE_BUILDDIR="${BUILDDIR}/build-${abi}"}
248     # cd ${CMAKE_BUILDDIR}
249     # mmake -j1 -k check || die
250     #done
251     return 0
252  }  }
253    
254  cmake_src_install()  cmake_src_install()
255  {  {
256   cd ${BUILDDIR}/build   [[ -n ${CMAKE_SRCDIR} ]] || local CMAKE_SRCDIR
257   make DESTDIR=${BINDIR} install || die  
258     : ${CMAKE_SRCDIR="${SRCDIR}"}
259    
260     cmake_mmake DESTDIR=${BINDIR} install || die
261    
262   cd ${SRCDIR}   cd ${CMAKE_SRCDIR}
263   local i   local i
264   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
265   FAQ LICENSE NEWS README TODO   FAQ LICENSE NEWS README TODO
266   do   do
267   if [ -f ${SRCDIR}/${i} ]   if [ -f ${CMAKE_SRCDIR}/${i} ]
268   then   then
269   minstalldocs ${i} || die   minstalldocs ${i} || die
270   fi   fi
271   done   done
272  }  }
273    
274  export_inherits cmake src_prepare src_compile src_install  cmake_multilib_src_install()
275    {
276     local abi
277     local abis_to_run="${MULTILIB_ABIS}"
278     [[ -n ${CMAKE_SRCDIR} ]] || local CMAKE_SRCDIR
279    
280     cmake_mmake DESTDIR=${BINDIR} install || die
281    
282     # respect MULTILIB_ONLY_ABI variable
283     [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
284     for abi in ${abis_to_run}
285     do
286     : ${CMAKE_SRCDIR="${SRCDIR}-${abi}"}
287    
288     cd ${CMAKE_SRCDIR}
289     local i
290     for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
291     FAQ LICENSE NEWS README TODO
292     do
293     if [ -f ${CMAKE_SRCDIR}/${i} ]
294     then
295     minstalldocs ${i} || die
296     fi
297     done
298     done
299    }
300    
301    export_inherits cmake src_prepare src_compile
302    if [[ ${MULTILIB_BUILD} = true ]]
303    then
304     export_inherits cmake_multilib src_check src_install
305    else
306     export_inherits cmake src_check src_install
307    fi

Legend:
Removed from v.3582  
changed lines
  Added in v.15579