diff --git a/libssh/mingw-w64/PKGBUILD b/libssh/mingw-w64/PKGBUILD new file mode 100644 index 00000000..4e1057b9 --- /dev/null +++ b/libssh/mingw-w64/PKGBUILD @@ -0,0 +1,76 @@ +# Maintainer: Karl-Felix Glatzer +# Contributor: Tom Gundersen +# Contributor: Andrea Scarpino +# Contributor: ice-man +# Contributor: sergeantspoon +# Contributor: Alexey Pavlov + +pkgname=mingw-w64-libssh +pkgver=0.7.2 +pkgrel=2 +pkgdesc="Library for accessing ssh client services through C libraries (mingw-w64)" +url="http://www.libssh.org/" +license=('LGPL') +arch=('any') +depends=('mingw-w64-openssl') +makedepends=('mingw-w64-gcc' 'mingw-w64-cmake' 'mingw-w64-pkg-config' 'doxygen') +options=(!strip !buildflags staticlibs) +#cmocka +#checkdepends=('openssh') +source=(https://red.libssh.org/attachments/download/177/libssh-${pkgver}.tar.xz + https://red.libssh.org/attachments/download/168/libssh-${pkgver}.tar.asc + mingw-as-unix.patch + mingw-DATADIR-conflict.patch + mingw-pkgconfig.patch + fix_check_include_files.patch) +md5sums=('5d7d468937649a6dfc6186edfff083db' + 'SKIP' + 'fc03637960f420837ad506892b444986' + '7be13e00d27ce77f862012ee0654019b' + '500031299c94117c62526601ec966f1e' + 'd608bd0626ef16ca7f1ac2446e8f411c') +validpgpkeys=('8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D') # Andreas Schneider +_architectures="i686-w64-mingw32 x86_64-w64-mingw32" + +prepare() { + # disable the test. It is confused by our clean container setup. + # 'extra-x86-build' uses user 'nobody' that has a record in /etc/passwd file + # but $HOME envvar is set to '/build'. The test expects that $HOME corresponds to passwd file. + sed 's/unit_test(torture_path_expand_tilde_unix),//' -i libssh-${pkgver}/tests/unittests/torture_misc.c + + cd "${srcdir}/libssh-${pkgver}" + + patch -p1 -i ${srcdir}/mingw-as-unix.patch + patch -p1 -i ${srcdir}/mingw-DATADIR-conflict.patch + patch -p1 -i ${srcdir}/mingw-pkgconfig.patch + patch -p1 -i ${srcdir}/fix_check_include_files.patch +} + +build() { + for _arch in ${_architectures}; do + mkdir -p "${srcdir}"/build-${_arch} && cd "${srcdir}"/build-${_arch} + + ${_arch}-cmake ../libssh-${pkgver} \ + -DCMAKE_INSTALL_PREFIX=/usr/${_arch} \ + -DCMAKE_BUILD_TYPE=Release \ + -DWITH_GSSAPI=OFF \ + -DWITH_STATIC_LIB=ON + + #-DWITH_TESTING=ON + make + done +} + +#TODO: Test with wine? +#check() { +# cd build +# make test +#} + +package(){ + for _arch in ${_architectures}; do + cd "${srcdir}"/build-${_arch} + + make DESTDIR="${pkgdir}" install + done +} diff --git a/libssh/mingw-w64/fix_check_include_files.patch b/libssh/mingw-w64/fix_check_include_files.patch new file mode 100644 index 00000000..a445855f --- /dev/null +++ b/libssh/mingw-w64/fix_check_include_files.patch @@ -0,0 +1,8 @@ +--- libssh-0.7.2/ConfigureChecks.cmake 2015-12-26 00:41:50.000000000 +0100 ++++ patched/ConfigureChecks.cmake 2015-12-26 00:49:18.862060811 +0100 +@@ -1,4 +1,5 @@ + include(CheckIncludeFile) ++include(CheckIncludeFiles) + include(CheckSymbolExists) + include(CheckFunctionExists) + include(CheckLibraryExists) diff --git a/libssh/mingw-w64/mingw-DATADIR-conflict.patch b/libssh/mingw-w64/mingw-DATADIR-conflict.patch new file mode 100644 index 00000000..ee3ce8ef --- /dev/null +++ b/libssh/mingw-w64/mingw-DATADIR-conflict.patch @@ -0,0 +1,24 @@ +diff -Naur libssh-0.6.4-orig/config.h.cmake libssh-0.6.4/config.h.cmake +--- libssh-0.6.4-orig/config.h.cmake 2014-12-19 11:11:17.000000000 +0300 ++++ libssh-0.6.4/config.h.cmake 2014-12-25 14:10:49.834000000 +0300 +@@ -5,7 +5,7 @@ + #cmakedefine VERSION "${APPLICATION_VERSION}" + + #cmakedefine LOCALEDIR "${LOCALE_INSTALL_DIR}" +-#cmakedefine DATADIR "${DATADIR}" ++#cmakedefine DATA_DIR "${DATA_DIR}" + #cmakedefine LIBDIR "${LIBDIR}" + #cmakedefine PLUGINDIR "${PLUGINDIR}" + #cmakedefine SYSCONFDIR "${SYSCONFDIR}" +diff -Naur libssh-0.6.4-orig/ConfigureChecks.cmake libssh-0.6.4/ConfigureChecks.cmake +--- libssh-0.6.4-orig/ConfigureChecks.cmake 2014-12-19 11:11:17.000000000 +0300 ++++ libssh-0.6.4/ConfigureChecks.cmake 2014-12-25 14:11:05.297000000 +0300 +@@ -8,7 +8,7 @@ + + set(PACKAGE ${APPLICATION_NAME}) + set(VERSION ${APPLICATION_VERSION}) +-set(DATADIR ${DATA_INSTALL_DIR}) ++set(DATA_DIR ${DATA_INSTALL_DIR}) + set(LIBDIR ${LIB_INSTALL_DIR}) + set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}") + set(SYSCONFDIR ${SYSCONF_INSTALL_DIR}) diff --git a/libssh/mingw-w64/mingw-as-unix.patch b/libssh/mingw-w64/mingw-as-unix.patch new file mode 100644 index 00000000..169c6b36 --- /dev/null +++ b/libssh/mingw-w64/mingw-as-unix.patch @@ -0,0 +1,47 @@ +diff -Naur libssh-0.6.4-orig/cmake/Modules/DefineInstallationPaths.cmake libssh-0.6.4/cmake/Modules/DefineInstallationPaths.cmake +--- libssh-0.6.4-orig/cmake/Modules/DefineInstallationPaths.cmake 2014-09-15 22:54:34.000000000 +0400 ++++ libssh-0.6.4/cmake/Modules/DefineInstallationPaths.cmake 2014-12-25 12:45:52.735000000 +0300 +@@ -1,4 +1,4 @@ +-if (UNIX OR OS2) ++if (UNIX OR OS2 OR MINGW) + IF (NOT APPLICATION_NAME) + MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME") + SET(APPLICATION_NAME ${PROJECT_NAME}) +diff -Naur libssh-0.6.4-orig/libssh.pc.cmake libssh-0.6.4/libssh.pc.cmake +--- libssh-0.6.4-orig/libssh.pc.cmake 2013-02-07 22:23:14.000000000 +0400 ++++ libssh-0.6.4/libssh.pc.cmake 2014-12-25 12:44:04.023000000 +0300 +@@ -1,6 +1,11 @@ +-Name: ${APPLICATION_NAME} ++prefix=@CMAKE_INSTALL_PREFIX@ ++exec_prefix=${prefix}/bin ++libdir=@LIB_INSTALL_DIR@ ++includedir=@INCLUDE_INSTALL_DIR@ ++ ++Name: @APPLICATION_NAME@ + Description: The SSH Library +-Version: ${APPLICATION_VERSION} +-Libs: -L${LIB_INSTALL_DIR} -lssh +-Cflags: -I${INCLUDE_INSTALL_DIR} ++Version: @APPLICATION_VERSION@ ++Libs: -L${libdir} -lssh ++Cflags: -I${includedir} + +diff -Naur libssh-0.6.4-orig/libssh_threads.pc.cmake libssh-0.6.4/libssh_threads.pc.cmake +--- libssh-0.6.4-orig/libssh_threads.pc.cmake 2014-09-15 22:54:34.000000000 +0400 ++++ libssh-0.6.4/libssh_threads.pc.cmake 2014-12-25 12:43:12.932000000 +0300 +@@ -1,6 +1,11 @@ +-Name: ${APPLICATION_NAME}_threads ++prefix=@CMAKE_INSTALL_PREFIX@ ++exec_prefix=${prefix}/bin ++libdir=@LIB_INSTALL_DIR@ ++includedir=@INCLUDE_INSTALL_DIR@ ++ ++Name: @APPLICATION_NAME@_threads + Description: The SSH Library Thread Extension +-Version: ${APPLICATION_VERSION} +-Libs: -L${LIB_INSTALL_DIR} -lssh_threads +-Cflags: -I${INCLUDE_INSTALL_DIR} ++Version: @APPLICATION_VERSION@ ++Libs: -L${libdir} -lssh_threads ++Cflags: -I${includedir} + diff --git a/libssh/mingw-w64/mingw-pkgconfig.patch b/libssh/mingw-w64/mingw-pkgconfig.patch new file mode 100644 index 00000000..563d6de5 --- /dev/null +++ b/libssh/mingw-w64/mingw-pkgconfig.patch @@ -0,0 +1,21 @@ +diff -ru libssh-0.7.2/CMakeLists.txt patched/CMakeLists.txt +--- libssh-0.7.2/CMakeLists.txt 2015-09-16 08:44:35.000000000 +0200 ++++ patched/CMakeLists.txt 2015-11-12 16:00:58.999198281 +0100 +@@ -84,7 +84,7 @@ + add_subdirectory(src) + + # pkg-config file +-if (UNIX) ++if (UNIX OR MINGW) + configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc) + install( + FILES +@@ -108,7 +108,7 @@ + pkgconfig + ) + endif (LIBSSH_THREADS) +-endif (UNIX) ++endif (UNIX OR MINGW) + + # cmake config files + set(LIBSSH_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX}) diff --git a/pkgbuilds.pro b/pkgbuilds.pro index 5beedcc9..904b2271 100644 --- a/pkgbuilds.pro +++ b/pkgbuilds.pro @@ -72,4 +72,9 @@ OTHER_FILES += \ gsm/mingw-w64/PKGBUILD \ gsm/mingw-w64/gsm.patch \ gsm/mingw-w64/makefile.patch \ - gsm/mingw-w64/win32.patch + gsm/mingw-w64/win32.patch \ + libssh/mingw-w64/PKGBUILD \ + libssh/mingw-w64/fix_check_include_files.patch \ + libssh/mingw-w64/mingw-as-unix.patch \ + libssh/mingw-w64/mingw-DATADIR-conflict.patch \ + libssh/mingw-w64/mingw-pkgconfig.patch