Adding support for cmake-based builds.
authorAndrej Kacian <andrej@kacian.sk>
Sat, 28 Jan 2017 13:39:04 +0000 (14:39 +0100)
committerAndrej Kacian <andrej@kacian.sk>
Sat, 28 Jan 2017 17:54:12 +0000 (18:54 +0100)
Also adding libical package.

12 files changed:
.gitignore
Makefile.am
README
configure.ac.template
packages/download.sh
packages/packages.current
patches/libical-2.0.0/01-gmtime_r.patch [new file with mode: 0755]
src/Makefile.am
src/Toolchain-mingw32.cmake.in [new file with mode: 0644]
src/claws-mail.mk.in
src/sections-installer.nsi
src/sections-uninstaller.nsi

index 00e1fc297307f88b960915feb593334184b7cdc0..478d823d253b925c4c247fbfd8cab6e674cab2d2 100644 (file)
@@ -59,3 +59,4 @@ src/claws-mail.mk
 /po/build-cc
 /src/license.blurb
 /src/mkportable.exe
+/src/Toolchain-mingw32.cmake
index d75123d8d08e613e5d65754baf0d9a3b6b488a2e..d10e9fd4ed73464f283f4ff55fd50efdebb85b2a 100644 (file)
@@ -45,6 +45,7 @@ EXTRA_DIST = autogen.sh \
         patches/libetpan-1.7/notests.patch \
         patches/libetpan-1.7/sasl_set_path.patch \
         patches/libetpan-1.7/mingw-closesocket-include.patch \
+                               patches/libical-2.0.0/01-gmtime_r.patch \
         patches/libiconv-1.14/01-aliases2_lookup-no-inline.patch \
         patches/crypt-1.1/01-build-dll.patch \
         patches/webkit-1.3.10/01-fixes.patch \
diff --git a/README b/README
index 8b2f07828a065fd83d91c29c68f1abd1b71bff12..8dc0cfa9c36ca4da91ac06e56029b695ec31135e 100644 (file)
--- a/README
+++ b/README
@@ -88,6 +88,10 @@ This requires editing a couple of files.
 Then run the usual "./autogen.sh" to create the actual configure file
 and run configure as described above.
 
+If the package is using cmake, set pkg_cm_<package>_cmake to "yes",
+and optionally set pkg_cm_<package>_cmake_args. Libical is an example
+to follow.
+
 
 SASL and unofficial patches
 ===========================
index fe276d3347f42d0899b075beac917ae91e3dbb48..461aafc352ab8c9ab8ef3625d457bfdeb497f035 100644 (file)
@@ -224,6 +224,7 @@ fi
 AC_SUBST(gpg_dll_num)
 AC_SUBST(libgcc_dll)
 AC_SUBST(w64)
+AC_SUBST(host)
 
 # For the manual we need:
 AC_CHECK_PROGS(DOCBOOK2HTML, docbook2html)
@@ -285,9 +286,10 @@ CM_SPKG([curl], [zlib gnutls])
 CM_SPKG([cyrus-sasl])
 CM_SPKG([libetpan], [gnutls cyrus-sasl])
 CM_BPKG_GNUWIN32([bsfilter])
+CM_SPKG([libical])
 CM_SPKG([claws-mail], [libiconv gettext zlib gtk+ libpng enchant glib dnl
                             gpgme crypt regex libetpan gnutls dnl
-                            libxml2 expat webkit curl])
+                            libxml2 expat webkit curl libical])
 
 
 CM_FINALIZE
@@ -318,6 +320,7 @@ fi
 
 AC_CONFIG_FILES(Makefile)
 AC_CONFIG_FILES(packages/Makefile src/Makefile po/Makefile.in)
+AC_CONFIG_FILES(src/Toolchain-mingw32.cmake)
 AC_CONFIG_FILES(po/build-cc)
 AC_CONFIG_FILES(src/config.nsi src/claws-mail.mk)
 AC_CONFIG_FILES(doc/Makefile)
index 685fd67f4e2b65bd471578df248a7cc74ae2db78..965beef4e117571a2b6514ae210b8451427a423a 100755 (executable)
@@ -157,7 +157,7 @@ while read key value ; do
            [ $quiet = no ] && echo "package     \`$url' ... already exists"
        else
            echo -n "downloading \`$url' ..."
-           if ${WGET} -c -q "$url" -O "$name" ; then
+           if ${WGET} "$url" -O "$name" ; then
                if [ $(stat -c'%s' "$name" 2>/dev/null || echo 0) -eq 0 ]; then
                  echo " FAILED (line $lnr)"
                  echo "line $lnr: $url has zero length" >> '.#download.failed'
index 7ebe23cd35432c5f226d3f0da818df232d43f2fd..19a4be750701f84f6f862a93b9deb4821a1ebdf8 100644 (file)
@@ -263,3 +263,8 @@ server ftp://ftp.cyrusimap.org/cyrus-sasl
 
 file cyrus-sasl-2.1.26.tar.gz
 chk d6669fb91434192529bd13ee95737a8a5040241c
+
+# libical
+server https://github.com/libical/libical/releases/download
+file v2.0.0/libical-2.0.0.tar.gz
+chk 8540d5d73422496e1d350b86ff32333daa08144c
diff --git a/patches/libical-2.0.0/01-gmtime_r.patch b/patches/libical-2.0.0/01-gmtime_r.patch
new file mode 100755 (executable)
index 0000000..ca1fd9e
--- /dev/null
@@ -0,0 +1,74 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+diff -ruN libical-2.0.0-orig/config.h.cmake libical-2.0.0/config.h.cmake
+--- libical-2.0.0-orig/config.h.cmake  2015-12-28 22:44:53.000000000 +0100
++++ libical-2.0.0/config.h.cmake       2017-01-28 17:58:18.365969029 +0100
+@@ -495,34 +495,6 @@
+ #endif
+ #endif
+-/* gmtime_r - thread safe gmtime() really only needed on Unix */
+-#if !defined(HAVE_GMTIME_R)
+-#if !defined(_WIN32)
+-#error "No thread-safe gmtime function available"
+-#endif
+-/*on Windows there might be a macro called gmtime_r in pthread.h. don't use it.*/
+-#if defined(gmtime_r)
+-#undef gmtime_r
+-#endif
+-/* FYI: The gmtime() in Microsoft's C library is MT-safe */
+-#define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
+-#endif
+-#include <time.h>
+-
+-/* localtime_r - thread safe localtime() really only needed on Unix */
+-#if !defined(HAVE_LOCALTIME_R)
+-#if !defined(_WIN32)
+-#error "No thread-safe localtime function available"
+-#endif
+-/*on Windows there might be a macro called localtime_r in pthread.h. don't use it.*/
+-#if defined(localtime_r)
+-#undef localtime_r
+-#endif
+-/* FYI: The localtime() in Microsoft's C library is MT-safe */
+-#define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
+-#endif
+-#include <time.h>
+-
+ /* define MAXPATHLEN */
+ #if defined(_WIN32)
+ #include <windows.h> //for MAX_PATH
+diff -ruN libical-2.0.0-orig/ConfigureChecks.cmake libical-2.0.0/ConfigureChecks.cmake
+--- libical-2.0.0-orig/ConfigureChecks.cmake   2015-12-28 22:44:53.000000000 +0100
++++ libical-2.0.0/ConfigureChecks.cmake        2017-01-28 14:16:30.568151735 +0100
+@@ -10,6 +10,7 @@
+ check_include_files(fcntl.h HAVE_FCNTL_H)
+ check_include_files(unistd.h HAVE_UNISTD_H)
+ check_include_files(wctype.h HAVE_WCTYPE_H)
++check_include_files(time.h HAVE_TIME_H)
+ include(CheckFunctionExists)
+ if(WIN32 AND MSVC)
+diff -ruN libical-2.0.0-orig/Toolchain-mingw32.cmake libical-2.0.0/Toolchain-mingw32.cmake
+--- libical-2.0.0-orig/Toolchain-mingw32.cmake 1970-01-01 01:00:00.000000000 +0100
++++ libical-2.0.0/Toolchain-mingw32.cmake      2017-01-28 14:05:21.057799373 +0100
+@@ -0,0 +1,17 @@
++# the name of the target operating system
++SET(CMAKE_SYSTEM_NAME Windows)
++
++# which compilers to use for C and C++
++SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
++SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
++SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
++
++# here is the target environment located
++SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
++
++# adjust the default behaviour of the FIND_XXX() commands:
++# search headers and libraries in the target environment, search 
++# programs in the host environment
++set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
++set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
++set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
index 881dbef3a933841b050f604d39198a424f3db620..8974760e828cdd8ae2d5f2e8257f4eedd3a52008 100644 (file)
@@ -24,7 +24,7 @@ EXTRA_DIST = pkg-config claws-mail.nsi \
                                gnupg-uninst.nsi \
                                sections-installer.nsi sections-uninstaller.nsi \
         libiconv.def libintl.def \
-        Memento.nsh
+        Memento.nsh Toolchain-mingw32.cmake.in
 
 SUBDIRS = dictionaries
 
@@ -41,7 +41,7 @@ cm_spkgs = glib libffi gdk-pixbuf gtk+ expat \
                jpeg glib-networking libsoup webkit gmp nettle \
                harfbuzz pango pixman cairo libetpan claws-mail \
                libgcrypt libassuan cyrus-sasl \
-               w32pth regex libiconv gettext
+               w32pth regex libiconv gettext libical
 
 # Extra options to configure for individual packages.
 # We can use $(idir) here for the installation prefix.
@@ -77,8 +77,9 @@ cm_pkg_nettle_make_args = -j$(NUMPROC)
 cm_pkg_pixman_make_args = -j$(NUMPROC)
 cm_pkg_cairo_make_args = -j$(NUMPROC)
 cm_pkg_cyrus_sasl_make_args = -j$(NUMPROC)
+cm_pkg_libical_make_args = -j$(NUMPROC)
 
-
+cm_pkg_libical_cmake = yes
 
 cm_pkg_libiconv_configure = \
        --enable-shared=yes --enable-static=no
@@ -343,6 +344,8 @@ cm_pkg_webkit_configure = \
                CPPFLAGS=\"-I$(idir)/include -g -O2 -std=gnu++98 -mms-bitfields\" \
          CC=$(CC) LIBS=\"-L$(idir)/lib\"
 
+cm_pkg_libical_cmake_args = \
+                                                                                        -DCMAKE_TOOLCHAIN_FILE=$(tsdir)/src/Toolchain-mingw32.cmake
 
 # This is not anymore needed sinces 3.8.0 already builds a PDF version.
 # define cm_pkg_claws_mail_post_install
diff --git a/src/Toolchain-mingw32.cmake.in b/src/Toolchain-mingw32.cmake.in
new file mode 100644 (file)
index 0000000..b23f1b4
--- /dev/null
@@ -0,0 +1,17 @@
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Windows)
+
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER @host@-gcc)
+SET(CMAKE_CXX_COMPILER @host@-g++)
+SET(CMAKE_RC_COMPILER @host@-windres)
+
+# here is the target environment located
+SET(CMAKE_FIND_ROOT_PATH /usr/@host@)
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search 
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
index 138fc1bb9a7e7c960f15b32a6c89666a9148ba5d..eb14a372a66ae4ce147bd79e6b4476cc83b37193 100644 (file)
@@ -68,7 +68,12 @@ define SETVARS
        pkg_dev="$(call GETVAR,cm_pkg_$(1)_dev)";                       \
        pkg_version_dev="$(1)-dev-$(call GETVAR,cm_pkg_$(1)_version)"; \
        pkgidir_dev="$(ipdir)/$$$${pkg_version_dev}";                   \
-       pkgcfg="$(call GETVAR,cm_pkg_$(1)_configure)";          \
+       if [ "x$(call GETVAR,cm_pkg_$(1)_cmake)" = "xyes" ]; then \
+               pkgcmake="yes"; \
+               pkgcfg="$(call GETVAR,cm_pkg_$(1)_cmake_args)"; \
+       else \
+               pkgcfg="$(call GETVAR,cm_pkg_$(1)_configure)";          \
+       fi; \
        pkgextracflags="$(call GETVAR,cm_pkg_$(1)_extracflags)";        \
        pkgmkargs="$(call GETVAR,cm_pkg_$(1)_make_args)";          \
        pkgmkargs_inst="$(call GETVAR,cm_pkg_$(1)_make_args_inst)";\
@@ -138,22 +143,26 @@ stamps/stamp-$(1)-01-patch: stamps/stamp-$(1)-00-unpack
 
 stamps/stamp-$(1)-02-configure: stamps/stamp-$(1)-01-patch
        ($(call SETVARS,$(1));                          \
-        mkdir "$$$${pkgbdir}";                         \
-         cd "$$$${pkgbdir}";                           \
-        eval "../$$$${pkg_version}/configure"          \
-               --prefix="$$$${pkgidir}"                \
-               --host=$(host)                          \
-               --build=$(build)                        \
-               $$$${pkgcfg} CFLAGS=\"-mms-bitfields $$$${pkgextracflags}\";\
-        shopt -s nullglob;                                     \
-        for pfile in "$$$${pkgpbdir}"/*.postcfg                \
-                       "$$$${pkgpdir}"/*.postcfg ; do                  \
-          (cd "$$$${pkgsdir}"; "$$$${pfile}")                  \
-        done;                                                  \
-        for pfile in "$$$${pkgpbdir}"/*.postcfg-build          \
-                       "$$$${pkgpdir}"/*.postcfg-build ; do    \
-          (cd "$$$${pkgbdir}"; "$$$${pfile}")                  \
-        done)
+       mkdir "$$$${pkgbdir}";                          \
+       cd "$$$${pkgbdir}";                             \
+       if [ "$$$${pkgcmake}" = "yes" ]; then \
+               eval "cmake $$$${pkgcfg} -DCMAKE_INSTALL_PREFIX=$$$${pkgidir} ../$$$${pkg_version}"; \
+       else \
+               eval "../$$$${pkg_version}/configure"           \
+                       --prefix="$$$${pkgidir}"                \
+                       --host=$(host)                          \
+                       --build=$(build)                        \
+                       $$$${pkgcfg} CFLAGS=\"-mms-bitfields $$$${pkgextracflags}\"; \
+               shopt -s nullglob;                                      \
+               for pfile in "$$$${pkgpbdir}"/*.postcfg                 \
+                              "$$$${pkgpdir}"/*.postcfg ; do           \
+                       (cd "$$$${pkgsdir}"; "$$$${pfile}")                     \
+               done;                                                   \
+               for pfile in "$$$${pkgpbdir}"/*.postcfg-build           \
+                              "$$$${pkgpdir}"/*.postcfg-build ; do     \
+                       (cd "$$$${pkgbdir}"; "$$$${pfile}")                     \
+               done; \
+       fi)
        touch stamps/stamp-$(1)-02-configure
 
 stamps/stamp-$(1)-03-make: stamps/stamp-$(1)-02-configure
index afd7548f2b1771a03d26e6add5dedf80561e732b..59fd96f1fdef2c87676732c35b11f99441f50c02 100644 (file)
@@ -491,6 +491,13 @@ File ${prefix}/bin/libgmp-10.dll
 File ${prefix}/bin/libnettle-6-2.dll
 File ${prefix}/bin/libhogweed-4-2.dll
 
+#######################################
+### nettle
+!insertmacro SetPrefix libical
+File ${prefix}/bin/libical.dll
+File ${prefix}/bin/libicalss.dll
+File ${prefix}/bin/libicalvcal.dll
+
 #######################################
 ### claws-mail
 !insertmacro SetPrefix2 claws_mail claws-mail
index f6b9c9a525bc0c553ca30580816dc98e89c21279..503917e5774f93405f9955172bb6e965515ba809 100644 (file)
@@ -61,6 +61,12 @@ Delete "$INSTDIR\share\locale\sv\LC_MESSAGES\claws-mail.mo"
 Delete "$INSTDIR\share\locale\tr\LC_MESSAGES\claws-mail.mo"
 Delete "$INSTDIR\share\locale\zh_TW\LC_MESSAGES\claws-mail.mo"
 
+#######################################
+### libical
+Delete "$INSTDIR\libical.dll"
+Delete "$INSTDIR\libicalss.dll"
+Delete "$INSTDIR\libicalvcal.dll"
+
 #######################################
 ### nettle
 Delete "$INSTDIR\libhogweed-4-2.dll"