2014-01-07 16:29:49 +00:00
|
|
|
#
|
|
|
|
# This helper is for templates using cmake.
|
|
|
|
#
|
|
|
|
do_configure() {
|
2016-05-26 05:33:58 +00:00
|
|
|
local cmake_args=
|
2015-06-29 11:19:50 +00:00
|
|
|
[ ! -d ${cmake_builddir:=build} ] && mkdir -p ${cmake_builddir}
|
|
|
|
cd ${cmake_builddir}
|
2014-01-07 16:29:49 +00:00
|
|
|
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
|
|
cat > cross_${XBPS_CROSS_TRIPLET}.cmake <<_EOF
|
|
|
|
SET(CMAKE_SYSTEM_NAME Linux)
|
|
|
|
SET(CMAKE_SYSTEM_VERSION 1)
|
|
|
|
|
2017-08-16 16:07:14 +00:00
|
|
|
SET(CMAKE_C_COMPILER ${CC})
|
|
|
|
SET(CMAKE_CXX_COMPILER ${CXX})
|
2014-01-07 16:29:49 +00:00
|
|
|
SET(CMAKE_CROSSCOMPILING TRUE)
|
|
|
|
|
|
|
|
SET(CMAKE_FIND_ROOT_PATH ${XBPS_CROSS_BASE})
|
|
|
|
|
|
|
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
|
|
_EOF
|
2016-05-26 05:33:58 +00:00
|
|
|
cmake_args+=" -DCMAKE_TOOLCHAIN_FILE=cross_${XBPS_CROSS_TRIPLET}.cmake"
|
2014-01-07 16:29:49 +00:00
|
|
|
fi
|
2016-05-26 05:33:58 +00:00
|
|
|
cmake_args+=" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release"
|
2015-01-14 09:50:48 +00:00
|
|
|
|
|
|
|
if [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
|
2016-06-25 22:48:46 +00:00
|
|
|
cmake_args+=" -DCMAKE_INSTALL_LIBDIR=lib32"
|
2015-01-14 09:50:48 +00:00
|
|
|
else
|
2016-06-25 22:48:46 +00:00
|
|
|
cmake_args+=" -DCMAKE_INSTALL_LIBDIR=lib"
|
2015-01-14 09:50:48 +00:00
|
|
|
fi
|
|
|
|
|
2016-06-25 22:48:46 +00:00
|
|
|
cmake_args+=" -DCMAKE_INSTALL_SBINDIR=bin"
|
2014-01-07 16:29:49 +00:00
|
|
|
|
2016-05-26 05:33:58 +00:00
|
|
|
cmake ${cmake_args} ${configure_args} $(echo ${cmake_builddir}|sed \
|
2015-06-29 11:19:50 +00:00
|
|
|
-e 's|[^/]$|/|' -e 's|[^/]*||g' -e 's|/|../|g')
|
2017-01-15 01:50:14 +00:00
|
|
|
|
|
|
|
# Replace -isystem with -I for Qt4 and Qt5 packages
|
|
|
|
find -name flags.make -exec sed -i "{}" -e"s;-isystem;-I;g" \;
|
2014-01-07 16:29:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_build() {
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
|
2015-06-29 11:19:50 +00:00
|
|
|
cd ${cmake_builddir:=build}
|
2014-01-07 16:29:49 +00:00
|
|
|
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
|
|
|
}
|
|
|
|
|
|
|
|
do_install() {
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
: ${make_install_target:=install}
|
|
|
|
|
2015-06-29 11:19:50 +00:00
|
|
|
cd ${cmake_builddir:=build}
|
2015-02-19 15:38:30 +00:00
|
|
|
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
2014-01-07 16:29:49 +00:00
|
|
|
}
|