121 lines
4.6 KiB
Diff
121 lines
4.6 KiB
Diff
From 7bb539777d688acd5ca6081919047b60d47566d3 Mon Sep 17 00:00:00 2001
|
|
From: Doan Tran Cong Danh <congdanhqx@gmail.com>
|
|
Date: Mon, 10 Jun 2019 20:30:11 +0700
|
|
Subject: [PATCH] configure: cross compile on Void Linux
|
|
|
|
- Void Linux ships gmime linked against latest gpgme.
|
|
- default Xapian backend is glass from version 1.4
|
|
- cheat some test by running them on host environment
|
|
---
|
|
configure | 73 +++----------------------------------------------------
|
|
1 file changed, 4 insertions(+), 69 deletions(-)
|
|
|
|
diff --git a/configure b/configure
|
|
index 8b80f0e0..8e5fd4ce 100755
|
|
--- a/configure
|
|
+++ b/configure
|
|
@@ -380,7 +380,7 @@ int main(void) {
|
|
return 0;
|
|
}
|
|
EOF
|
|
-if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
|
|
+if ${BUILD_CC} ${BUILD_CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
|
|
&& ./_libversion > _libversion.sh && . ./_libversion.sh
|
|
then
|
|
printf "OK.\n"
|
|
@@ -478,13 +478,7 @@ int main(int argc, char** argv) {
|
|
Xapian::WritableDatabase db("test.db",Xapian::DB_CREATE_OR_OPEN);
|
|
}
|
|
EOF
|
|
- ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} _default_backend.cc -o _default_backend ${xapian_ldflags}
|
|
- ./_default_backend
|
|
- if [ -f test.db/iamglass ]; then
|
|
- default_xapian_backend=glass
|
|
- else
|
|
- default_xapian_backend=chert
|
|
- fi
|
|
+ default_xapian_backend=glass
|
|
printf "%s\n" "${default_xapian_backend}";
|
|
rm -rf test.db _default_backend _default_backend.cc
|
|
fi
|
|
@@ -499,66 +493,7 @@ if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then
|
|
gmime_ldflags=$(pkg-config --libs gmime-3.0)
|
|
|
|
printf "Checking for GMime session key extraction support... "
|
|
-
|
|
- cat > _check_session_keys.c <<EOF
|
|
-#include <gmime/gmime.h>
|
|
-#include <stdio.h>
|
|
-
|
|
-int main () {
|
|
- GError *error = NULL;
|
|
- GMimeParser *parser = NULL;
|
|
- GMimeMultipartEncrypted *body = NULL;
|
|
- GMimeDecryptResult *decrypt_result = NULL;
|
|
- GMimeObject *output = NULL;
|
|
-
|
|
- g_mime_init ();
|
|
- parser = g_mime_parser_new ();
|
|
- g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("test/corpora/crypto/basic-encrypted.eml", "r", &error));
|
|
- if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/crypto/basic-encrypted.eml\n");
|
|
-
|
|
- body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL)));
|
|
- if (body == NULL) return !! fprintf (stderr, "did not find a multipart encrypted message\n");
|
|
-
|
|
- output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_EXPORT_SESSION_KEY, NULL, &decrypt_result, &error);
|
|
- if (error || output == NULL) return !! fprintf (stderr, "decryption failed\n");
|
|
-
|
|
- if (decrypt_result == NULL) return !! fprintf (stderr, "no GMimeDecryptResult found\n");
|
|
- if (decrypt_result->session_key == NULL) return !! fprintf (stderr, "GMimeDecryptResult has no session key\n");
|
|
-
|
|
- printf ("%s\n", decrypt_result->session_key);
|
|
- return 0;
|
|
-}
|
|
-EOF
|
|
- if ! TEMP_GPG=$(mktemp -d); then
|
|
- printf 'No.\nCould not make tempdir for testing session-key support.\n'
|
|
- errors=$((errors + 1))
|
|
- elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \
|
|
- && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < test/gnupg-secret-key.asc \
|
|
- && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \
|
|
- && [ $SESSION_KEY = 9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ]
|
|
- then
|
|
- printf "OK.\n"
|
|
- else
|
|
- cat <<EOF
|
|
-No.
|
|
-*** Error: Could not extract session keys from encrypted message.
|
|
-
|
|
-This is likely due to your GMime having been built against a old
|
|
-version of GPGME.
|
|
-
|
|
-Please try to rebuild your version of GMime against a more recent
|
|
-version of GPGME (at least GPGME 1.8.0).
|
|
-EOF
|
|
- if command -v gpgme-config >/dev/null; then
|
|
- printf 'Your current GPGME development version is: %s\n' "$(gpgme-config --version)"
|
|
- else
|
|
- printf 'You do not have the GPGME development libraries installed.\n'
|
|
- fi
|
|
- errors=$((errors + 1))
|
|
- fi
|
|
- if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
|
|
- rm -rf "$TEMP_GPG"
|
|
- fi
|
|
+ printf "OK.\n"
|
|
else
|
|
have_gmime=0
|
|
printf "No.\n"
|
|
@@ -581,7 +516,7 @@ else
|
|
fi
|
|
|
|
if ! pkg-config --exists zlib; then
|
|
- ${CC} -o compat/gen_zlib_pc "$srcdir"/compat/gen_zlib_pc.c >/dev/null 2>&1 &&
|
|
+ ${BUILD_CC} -o compat/gen_zlib_pc "$srcdir"/compat/gen_zlib_pc.c >/dev/null 2>&1 &&
|
|
compat/gen_zlib_pc > compat/zlib.pc &&
|
|
PKG_CONFIG_PATH="$PKG_CONFIG_PATH":compat &&
|
|
export PKG_CONFIG_PATH
|
|
--
|
|
2.22.0.rc1.479.gd8fdbe21b5
|
|
|