From f0d0c31ae130aa5cbba1ae9a932629e094dc10a3 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Thu, 23 Jul 2015 08:04:20 +0200 Subject: [PATCH] rspamd: fix cross build. --- srcpkgs/rspamd/files/TryRunResults.cmake | 21 ++++++++++++++++++++ srcpkgs/rspamd/template | 25 +++++++++++++++++++++--- 2 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/rspamd/files/TryRunResults.cmake diff --git a/srcpkgs/rspamd/files/TryRunResults.cmake b/srcpkgs/rspamd/files/TryRunResults.cmake new file mode 100644 index 00000000000..95f689b4bc7 --- /dev/null +++ b/srcpkgs/rspamd/files/TryRunResults.cmake @@ -0,0 +1,21 @@ +# This file was generated by CMake because it detected TRY_RUN() commands +# in crosscompiling mode. It will be overwritten by the next CMake run. +# Copy it to a safe location, set the variables to appropriate values +# and use it then to preset the CMake cache (using -C). + + +# _CAN_RUN +# indicates whether the executable would have been able to run on its +# target platform. If so, set _CAN_RUN to +# the exit code (in many cases 0 for success), otherwise enter "FAILED_TO_RUN". +# The _CAN_COMPILE variable holds the build result for this TRY_RUN(). +# +# Source file : /builddir/rspamd-0.9.9/build/pthread_setpshared.c +# Executable : /builddir/rspamd-0.9.9/build/CMakeFiles/cmTryCompileExec2709940551-_CAN_RUN +# Run arguments : +# Called from: [1] /builddir/rspamd-0.9.9/CMakeLists.txt + +set( _CAN_RUN + "0" + CACHE STRING "Result from TRY_RUN" FORCE) + diff --git a/srcpkgs/rspamd/template b/srcpkgs/rspamd/template index 790a47f1249..3d10919fbf7 100644 --- a/srcpkgs/rspamd/template +++ b/srcpkgs/rspamd/template @@ -1,14 +1,17 @@ # Template file for 'rspamd' pkgname=rspamd version=0.9.9 -revision=1 +revision=2 build_style=cmake -configure_args="-DRSPAMD_USER=rspamd \ - -DRSPAMD_GROUP=rspamd \ +configure_args=" + -DRSPAMD_USER=rspamd \ -DCONFDIR=/etc/rspamd -DDBDIR=/var/lib/rspamd" hostmakedepends="cmake pkg-config" makedepends="LuaJIT-devel glib-devel libressl-devel gmime-devel libevent-devel sqlite-devel hiredis-devel" +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" $makedepends" +fi short_desc="Fast, free and open-source spam filtering system" maintainer="Enno Boland " license="BSD" @@ -38,6 +41,22 @@ conf_files=" /etc/rspamd/worker-controller.inc /etc/rspamd/worker-normal.inc" +pre_configure() { + if [ "$CROSS_BUILD" ]; then + configure_args+=" -C $FILESDIR/TryRunResults.cmake" + mkdir -p build_native + ( cd build_native; LD= CC= CFLAGS= LDFLAGS= cmake .. ) + fi +} + +pre_build() { + if [ "$CROSS_BUILD" ]; then + make -C build_native/contrib/snowball + sed -i "s#\./snowball#../../../build_native/contrib/snowball/snowball#g" \ + build/contrib/snowball/CMakeFiles/stemmer.dir/build.make + fi +} + post_install() { vsv rspamd }