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
|
2018-10-03 06:07:08 +00:00
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
|
|
x86_64*) _CMAKE_SYSTEM_PROCESSOR=x86_64 ;;
|
|
|
|
i686*) _CMAKE_SYSTEM_PROCESSOR=x86 ;;
|
|
|
|
aarch64*) _CMAKE_SYSTEM_PROCESSOR=aarch64 ;;
|
|
|
|
arm*) _CMAKE_SYSTEM_PROCESSOR=arm ;;
|
|
|
|
mips*) _CMAKE_SYSTEM_PROCESSOR=mips ;;
|
2019-01-05 22:45:27 +00:00
|
|
|
ppc64le*) _CMAKE_SYSTEM_PROCESSOR=ppc64le ;;
|
2018-12-31 23:24:00 +00:00
|
|
|
ppc64*) _CMAKE_SYSTEM_PROCESSOR=ppc64 ;;
|
2020-04-29 23:06:03 +00:00
|
|
|
ppcle*) _CMAKE_SYSTEM_PROCESSOR=ppcle ;;
|
2019-05-31 17:27:12 +00:00
|
|
|
ppc*) _CMAKE_SYSTEM_PROCESSOR=ppc ;;
|
2018-10-03 06:07:08 +00:00
|
|
|
*) _CMAKE_SYSTEM_PROCESSOR=generic ;;
|
|
|
|
esac
|
2018-11-27 13:29:26 +00:00
|
|
|
if [ -x "${XBPS_CROSS_BASE}/usr/bin/wx-config-gtk3" ]; then
|
|
|
|
wx_config=wx-config-gtk3
|
|
|
|
fi
|
2014-01-07 16:29:49 +00:00
|
|
|
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)
|
|
|
|
|
2018-10-03 06:07:08 +00:00
|
|
|
SET(CMAKE_SYSTEM_PROCESSOR ${_CMAKE_SYSTEM_PROCESSOR})
|
|
|
|
|
2014-01-07 16:29:49 +00:00
|
|
|
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)
|
2018-01-07 17:36:08 +00:00
|
|
|
|
2018-11-27 13:29:26 +00:00
|
|
|
SET(wxWidgets_CONFIG_EXECUTABLE ${XBPS_WRAPPERDIR}/${wx_config:=wx-config})
|
2014-01-07 16:29:49 +00:00
|
|
|
_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
|
2019-01-12 13:34:46 +00:00
|
|
|
cmake_args+=" -DCMAKE_INSTALL_PREFIX=/usr"
|
2019-04-15 02:22:43 +00:00
|
|
|
cmake_args+=" -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
|
|
|
|
|
2019-10-19 13:25:45 +00:00
|
|
|
if [[ $build_helper = *"qemu"* ]]; then
|
2019-04-15 01:07:52 +00:00
|
|
|
echo "SET(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static)" \
|
|
|
|
>> cross_${XBPS_CROSS_TRIPLET}.cmake
|
|
|
|
fi
|
|
|
|
|
2016-06-25 22:48:46 +00:00
|
|
|
cmake_args+=" -DCMAKE_INSTALL_SBINDIR=bin"
|
2014-01-07 16:29:49 +00:00
|
|
|
|
2020-01-11 00:09:08 +00:00
|
|
|
# Override flags: https://gitlab.kitware.com/cmake/cmake/issues/19590
|
|
|
|
CFLAGS="${CFLAGS/ -pipe / }" CXXFLAGS="${CXXFLAGS/ -pipe / }" \
|
|
|
|
cmake ${cmake_args} ${configure_args} $(echo ${cmake_builddir}|sed \
|
|
|
|
-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}
|
|
|
|
}
|
|
|
|
|
2017-11-20 22:34:40 +00:00
|
|
|
do_check() {
|
2018-03-05 09:46:51 +00:00
|
|
|
cd ${cmake_builddir:=build}
|
|
|
|
|
2017-11-20 22:34:40 +00:00
|
|
|
if [ -z "$make_cmd" ] && [ -z "$make_check_target" ]; then
|
2017-11-22 11:55:15 +00:00
|
|
|
if make -q test 2>/dev/null; then
|
|
|
|
:
|
|
|
|
else
|
2017-11-20 22:34:40 +00:00
|
|
|
if [ $? -eq 2 ]; then
|
|
|
|
msg_warn 'No target to "make test".\n'
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
: ${make_check_target:=test}
|
|
|
|
|
2020-07-11 11:41:02 +00:00
|
|
|
CTEST_OUTPUT_ON_FAILURE=TRUE ${make_cmd} ${make_check_args} ${make_check_target}
|
2017-11-20 22:34:40 +00:00
|
|
|
}
|
|
|
|
|
2014-01-07 16:29:49 +00:00
|
|
|
do_install() {
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
: ${make_install_target:=install}
|
|
|
|
|
2015-06-29 11:19:50 +00:00
|
|
|
cd ${cmake_builddir:=build}
|
2020-02-06 09:34:32 +00:00
|
|
|
DESTDIR=${DESTDIR} ${make_cmd} ${make_install_args} ${make_install_target}
|
2014-01-07 16:29:49 +00:00
|
|
|
}
|