Skip to content

Commit 8a3beb3

Browse files
authored
[gmime] Update to 3.2.15, use official build system (microsoft#42959)
1 parent a54ecb2 commit 8a3beb3

File tree

12 files changed

+227
-90
lines changed

12 files changed

+227
-90
lines changed

ports/gmime/CMakeLists.txt

Lines changed: 0 additions & 58 deletions
This file was deleted.

ports/gmime/msvc-ssize_t.diff

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
diff --git a/configure.ac b/configure.ac
2+
index 9d368e0..c534a09 100644
3+
--- a/configure.ac
4+
+++ b/configure.ac
5+
@@ -168,6 +168,13 @@ AC_TYPE_MODE_T
6+
AC_TYPE_OFF_T
7+
AC_TYPE_SIZE_T
8+
AC_TYPE_SSIZE_T
9+
+AH_BOTTOM([
10+
+#ifdef _MSC_VER
11+
+#undef ssize_t;
12+
+#include <BaseTsd.h>
13+
+typedef SSIZE_T ssize_t;
14+
+#endif
15+
+])
16+
AC_TYPE_UINT32_T
17+
AC_TYPE_UINT64_T
18+
AC_TYPE_UINT8_T
19+
diff --git a/gmime/gmime.h b/gmime/gmime.h
20+
index ef6b93e..d3696ac 100644
21+
--- a/gmime/gmime.h
22+
+++ b/gmime/gmime.h
23+
@@ -22,6 +22,10 @@
24+
#ifndef __GMIME_H__
25+
#define __GMIME_H__
26+
27+
+#ifdef _MSC_VER
28+
+#include <BaseTsd.h>
29+
+typedef SSIZE_T ssize_t;
30+
+#endif
31+
#include <glib.h>
32+
#include <gmime/gmime-version.h>
33+
#include <gmime/gmime-error.h>

ports/gmime/portfile.cmake

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,71 @@
1-
set(LIB_NAME gmime)
2-
set(LIB_VERSION 3.2.6)
3-
4-
set(LIB_FILENAME ${LIB_NAME}-${LIB_VERSION}.tar.xz)
5-
61
vcpkg_download_distfile(ARCHIVE
7-
URLS "https://download.gnome.org/sources/gmime/3.2/${LIB_FILENAME}"
8-
FILENAME "${LIB_FILENAME}"
9-
SHA512 a60d3f9f1aa8490865c22cd9539544e9c9f3ceb4037b9749cf9e5c279f97aa88fc4cd077bf2aff314ba0db2a1b7bbe76f9b1ca5a17fffcbd6315ecebc5414a3d
2+
URLS https://github.com/jstedfast/gmime/releases/download/${VERSION}/gmime-${VERSION}.tar.xz
3+
FILENAME "gmime-${VERSION}.tar.xz"
4+
SHA512 cafb89854b2441508bf940fd6f991739d30fb137b8928ad33e8e4d2a0293a6460e4d1318e73c3ee9e5a964b692f36e7a4eb5f2930c6998698bd9edf866629655
105
)
116

127
vcpkg_extract_source_archive(
138
SOURCE_PATH
149
ARCHIVE "${ARCHIVE}"
15-
SOURCE_BASE "${LIB_VERSION}"
10+
PATCHES
11+
subdirs.diff
12+
msvc-ssize_t.diff
1613
)
1714

18-
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
15+
set(ENV{ACLOCAL} "aclocal -I \"${CURRENT_INSTALLED_DIR}/share/aclocal/\"") # for glib
16+
set(ENV{GTKDOCIZE} true)
17+
18+
vcpkg_list(SET options)
19+
set(iconv_detect_h "${CURRENT_HOST_INSTALLED_DIR}/share/${PORT}/iconv-detect-${VCPKG_CMAKE_SYSTEM_NAME}.h")
20+
if(EXISTS "${iconv_detect_h}")
21+
vcpkg_list(APPEND options "ac_cv_have_iconv_detect_h=yes")
22+
elseif(VCPKG_CROSSCOMPILING)
23+
vcpkg_list(APPEND options "ac_cv_have_iconv_detect_h=no")
24+
endif()
1925

20-
# We can use file supplied with original sources
21-
configure_file("${SOURCE_PATH}/build/vs2017/unistd.h" "${SOURCE_PATH}" COPYONLY)
22-
configure_file("${SOURCE_PATH}/build/vs2017/config.h" "${SOURCE_PATH}" COPYONLY)
23-
configure_file("${SOURCE_PATH}/build/vs2017/gmime.def" "${SOURCE_PATH}" COPYONLY)
24-
vcpkg_find_acquire_program(PKGCONFIG)
25-
vcpkg_cmake_configure(
26+
if("crypto" IN_LIST FEATURES)
27+
vcpkg_list(APPEND options "--enable-crypto")
28+
else()
29+
vcpkg_list(APPEND options "--disable-crypto")
30+
endif()
31+
32+
vcpkg_configure_make(
2633
SOURCE_PATH "${SOURCE_PATH}"
34+
AUTOCONFIG
35+
ADD_BIN_TO_PATH # for iconv-detect
2736
OPTIONS
28-
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
37+
${options}
38+
--disable-crypto
39+
--disable-glibtest
40+
--disable-introspection
41+
--disable-vala
2942
)
3043

31-
vcpkg_cmake_install()
32-
33-
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
44+
if(EXISTS "${iconv_detect_h}")
45+
file(COPY_FILE "${iconv_detect_h}" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/iconv-detect.h")
46+
if(NOT VCPKG_BUILD_TYPE)
47+
file(COPY_FILE "${iconv_detect_h}" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/iconv-detect.h")
48+
endif()
49+
endif()
3450

35-
# License and man
36-
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${LIB_NAME}" RENAME copyright)
51+
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
52+
file(COPY "${SOURCE_PATH}/build/vs2017/unistd.h" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
53+
if(NOT VCPKG_BUILD_TYPE)
54+
file(COPY "${SOURCE_PATH}/build/vs2017/unistd.h" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
55+
endif()
56+
endif()
3757

58+
vcpkg_install_make()
3859
vcpkg_copy_pdbs()
60+
vcpkg_fixup_pkgconfig()
61+
62+
if(NOT VCPKG_CROSSCOMPILING)
63+
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/iconv-detect.h"
64+
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
65+
RENAME "iconv-detect-${VCPKG_CMAKE_SYSTEM_NAME}.h"
66+
)
67+
endif()
68+
69+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
70+
71+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")

ports/gmime/subdirs.diff

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/Makefile.am b/Makefile.am
2+
index c004167..0fafe72 100644
3+
--- a/Makefile.am
4+
+++ b/Makefile.am
5+
@@ -2,10 +2,9 @@
6+
7+
ACLOCAL_AMFLAGS = -I m4
8+
9+
-SUBDIRS = m4 build util gmime tests docs
10+
+SUBDIRS = m4 build util gmime
11+
12+
if !PLATFORM_WIN32
13+
-SUBDIRS += examples
14+
endif
15+
16+
SUBDIRS += tools .

ports/gmime/vcpkg.json

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
{
22
"name": "gmime",
3-
"version": "3.2.6",
4-
"port-version": 6,
3+
"version": "3.2.15",
54
"description": "GMime is a C/C++ library which may be used for the creation and parsing of messages using the Multipurpose Internet Mail Extension (MIME).",
6-
"homepage": "https://developer.gnome.org/gmime/",
5+
"homepage": "https://github.com/jstedfast/gmime",
76
"license": "LGPL-2.1-or-later",
8-
"supports": "windows & !xbox",
7+
"supports": "!xbox",
98
"dependencies": [
109
"glib",
11-
"libiconv",
12-
"libidn2",
1310
{
14-
"name": "vcpkg-cmake",
11+
"name": "gmime",
1512
"host": true
1613
},
14+
"libiconv",
15+
"libidn2",
1716
"zlib"
18-
]
17+
],
18+
"features": {
19+
"crypto": {
20+
"description": "PGP and S/MIME support",
21+
"dependencies": [
22+
{
23+
"name": "gpgme",
24+
"default-features": false
25+
}
26+
]
27+
}
28+
}
1929
}

ports/gmime/win32_ssize_t.diff

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/gmime/gmime.h b/gmime/gmime.h
2+
index ef6b93e..d3696ac 100644
3+
--- a/gmime/gmime.h
4+
+++ b/gmime/gmime.h
5+
@@ -22,6 +22,10 @@
6+
#ifndef __GMIME_H__
7+
#define __GMIME_H__
8+
9+
+#ifdef _MSC_VER
10+
+#include <BaseTsd.h>
11+
+typedef SSIZE_T ssize_t;
12+
+#endif
13+
#include <glib.h>
14+
#include <gmime/gmime-version.h>
15+
#include <gmime/gmime-error.h>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
2+
3+
vcpkg_find_acquire_program(PKGCONFIG)
4+
5+
vcpkg_cmake_configure(
6+
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
7+
OPTIONS
8+
"-DFEATURES=${FEATURES}"
9+
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
10+
)
11+
vcpkg_cmake_build()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
project(vcpkg-ci-gmime C)
4+
5+
set(CMAKE_C_STANDARD 11)
6+
7+
find_package(PkgConfig REQUIRED)
8+
pkg_check_modules(gmime REQUIRED IMPORTED_TARGET gmime-3.0)
9+
10+
add_executable(main main.c)
11+
target_link_libraries(main PRIVATE PkgConfig::gmime)
12+
13+
if("crypto" IN_LIST FEATURES)
14+
target_compile_definitions(main PRIVATE ENABLE_CRYPTO)
15+
endif()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <glib.h>
2+
#include <gmime/gmime.h>
3+
4+
void verify_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data)
5+
{
6+
#ifdef ENABLE_CRYPTO
7+
if (GMIME_IS_MULTIPART_SIGNED(part))
8+
{
9+
GMimeMultipartSigned *mps = (GMimeMultipartSigned *)part;
10+
GError *err = NULL;
11+
GMimeSignatureList *signatures = g_mime_multipart_signed_verify(mps, GMIME_VERIFY_NONE, &err);
12+
g_object_unref(signatures);
13+
}
14+
#endif
15+
}
16+
17+
int main()
18+
{
19+
g_mime_init();
20+
GMimeParser *parser = g_mime_parser_new();
21+
GMimeMessage *message = g_mime_parser_construct_message(parser, NULL);
22+
g_mime_message_foreach(message, verify_callback, NULL);
23+
g_object_unref(message);
24+
g_object_unref(parser);
25+
return 0;
26+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "vcpkg-ci-gmime",
3+
"version-string": "ci",
4+
"description": "Validates gmime",
5+
"dependencies": [
6+
"gmime",
7+
{
8+
"name": "vcpkg-cmake",
9+
"host": true
10+
}
11+
],
12+
"default-features": [
13+
{
14+
"name": "crypto",
15+
"platform": "!windows | mingw"
16+
}
17+
],
18+
"features": {
19+
"crypto": {
20+
"description": "gmime[crypo]",
21+
"dependencies": [
22+
{
23+
"name": "gmime",
24+
"features": [
25+
"crypto"
26+
]
27+
}
28+
]
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)