summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2017-04-02 04:16:56 (GMT)
committerGitHub <noreply@github.com>2017-04-02 04:16:56 (GMT)
commit3fcaa581b5d27463c3ef7610cd24ae4add9c3766 (patch)
tree203113aacebf05a4cfc230edd040b5df9fb553e2 /src
parentf07c3f01225531b351b8f79fafb175f94965c027 (diff)
parentde42ef92b46d28cb4fff427a51a4404bc6c0b5ef (diff)
downloadmxe-3fcaa581b5d27463c3ef7610cd24ae4add9c3766.zip
mxe-3fcaa581b5d27463c3ef7610cd24ae4add9c3766.tar.gz
mxe-3fcaa581b5d27463c3ef7610cd24ae4add9c3766.tar.bz2
Merge pull request #1709 from sibuserv/add-qca
add package qca
Diffstat (limited to 'src')
-rw-r--r--src/qca-1-fixes.patch23
-rw-r--r--src/qca-test.cmake21
-rw-r--r--src/qca-test.cpp38
-rw-r--r--src/qca-test.pro11
-rw-r--r--src/qca.mk45
5 files changed, 138 insertions, 0 deletions
diff --git a/src/qca-1-fixes.patch b/src/qca-1-fixes.patch
new file mode 100644
index 0000000..ee43168
--- /dev/null
+++ b/src/qca-1-fixes.patch
@@ -0,0 +1,23 @@
+This file is part of MXE. See LICENSE.md for licensing information.
+
+Contains ad hoc patches for cross building.
+
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Tony Theodore <tonyt@logyst.com>
+Date: Sun, 26 Mar 2017 12:36:55 +1100
+Subject: [PATCH] qca: add INSTAL_PKGCONFIG option
+
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1111111..2222222 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -233,7 +233,7 @@ foreach(PATH QCA_PLUGINS_INSTALL_DIR
+ endif()
+ endforeach()
+
+-if(NOT WIN32)
++if(NOT WIN32 OR INSTAL_PKGCONFIG)
+ if(OSX_FRAMEWORK)
+ set(PKGCONFIG_CFLAGS "-F\${libdir} -I\${includedir}")
+ set(PKGCONFIG_LIBS "-F\${libdir} -framework ${QCA_LIB_NAME}")
diff --git a/src/qca-test.cmake b/src/qca-test.cmake
new file mode 100644
index 0000000..00f9d2d
--- /dev/null
+++ b/src/qca-test.cmake
@@ -0,0 +1,21 @@
+# This file is part of MXE. See LICENSE.md for licensing information.
+
+# partial module - included by src/cmake/CMakeLists.txt
+
+set(TGT test-${PKG}-cmake)
+
+enable_language(CXX)
+add_executable(${TGT} ${CMAKE_CURRENT_LIST_DIR}/${PKG}-test.cpp)
+
+find_package(Qt5Core REQUIRED)
+find_package(Qca-qt5 REQUIRED)
+
+include_directories (${Qt5Core_INCLUDE_DIRS})
+target_link_libraries(${TGT} Qt5::Core qca-qt5)
+
+# Statically link QCA plugins when necessary
+if(BUILD_STATIC_LIBS)
+ target_link_libraries(${TGT} qca-ossl)
+endif(BUILD_STATIC_LIBS)
+
+install(TARGETS ${TGT} DESTINATION bin)
diff --git a/src/qca-test.cpp b/src/qca-test.cpp
new file mode 100644
index 0000000..73a6b5c
--- /dev/null
+++ b/src/qca-test.cpp
@@ -0,0 +1,38 @@
+/*
+ * This file is part of MXE. See LICENSE.md for licensing information.
+ */
+
+#include <QCoreApplication>
+#include <QtCrypto>
+#include <QDebug>
+
+#include <iostream>
+
+#ifdef QT_STATICPLUGIN
+#include "import_plugins.h"
+#endif
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication a(argc, argv);
+ QCA::init();
+
+ QByteArray inputString = "Hello world!";
+ if (a.arguments().size() > 1) {
+ inputString = a.arguments().at(1).toUtf8();
+ }
+ std::cout << "input string:\n" << inputString.toStdString() << "\n\n";
+
+ // Calculate hashes of a string with all available hashing algorithms:
+ QByteArray outputString;
+ for (const QString &hastType : QCA::Hash::supportedTypes()) {
+ QCA::Hash hashObject(hastType);
+ hashObject.update(inputString);
+ outputString = hashObject.final().toByteArray().toHex();
+
+ std::cout << hastType.toStdString() << " hash:\n"
+ << outputString.toStdString() << "\n\n";
+ }
+
+ return 0;
+}
diff --git a/src/qca-test.pro b/src/qca-test.pro
new file mode 100644
index 0000000..f11c34a
--- /dev/null
+++ b/src/qca-test.pro
@@ -0,0 +1,11 @@
+# This file is part of MXE. See LICENSE.md for licensing information.
+
+TEMPLATE = app
+TARGET = test-qca-qmake
+SOURCES += qca-test.cpp
+CONFIG += crypto console
+QMAKE_CXXFLAGS += -Wall -Werror
+
+# For static linking:
+LIBS += -L$$[QT_INSTALL_PLUGINS]/crypto -lqca-ossl
+
diff --git a/src/qca.mk b/src/qca.mk
new file mode 100644
index 0000000..1c3687c
--- /dev/null
+++ b/src/qca.mk
@@ -0,0 +1,45 @@
+# This file is part of MXE. See LICENSE.md for licensing information.
+
+PKG := qca
+$(PKG)_WEBSITE := https://userbase.kde.org/QCA
+$(PKG)_DESCR := Qt Cryptographic Architecture
+$(PKG)_IGNORE :=
+$(PKG)_VERSION := 2.1.3
+$(PKG)_CHECKSUM := a5135ffb0250a40e9c361eb10cd3fe28293f0cf4e5c69d3761481eafd7968067
+$(PKG)_GH_CONF := KDE/qca,v
+$(PKG)_DEPS := gcc qtbase
+
+define $(PKG)_BUILD
+ cd '$(BUILD_DIR)' && $(TARGET)-cmake '$(SOURCE_DIR)' \
+ -DBUILD_TESTS=OFF \
+ -DBUILD_TOOLS=OFF \
+ -DUSE_RELATIVE_PATHS=OFF \
+ -DBUILD_PLUGINS="auto" \
+ -DINSTAL_PKGCONFIG=ON \
+ -DQCA_MAN_INSTALL_DIR="$(BUILD_DIR)/null"
+ $(MAKE) -C '$(BUILD_DIR)' -j $(JOBS)
+ $(MAKE) -C '$(BUILD_DIR)' -j 1 install
+
+ # build test as qmake project
+ mkdir '$(BUILD_DIR).test-qmake'
+ cd '$(BUILD_DIR).test-qmake' && '$(PREFIX)/$(TARGET)/qt5/bin/qmake' '$(PWD)/src/qca-test.pro'
+ $(MAKE) -C '$(BUILD_DIR).test-qmake' -j 1
+ $(INSTALL) -m755 '$(BUILD_DIR).test-qmake/$(BUILD_TYPE)/test-qca-qmake.exe' '$(PREFIX)/$(TARGET)/bin/'
+
+ # build test as cmake project
+ mkdir '$(BUILD_DIR).test-cmake'
+ cd '$(BUILD_DIR).test-cmake' && $(TARGET)-cmake \
+ -DPKG=$(PKG) \
+ '$(PWD)/src/cmake/test'
+ $(MAKE) -C '$(BUILD_DIR).test-cmake' -j 1 install VERBOSE=ON
+
+ # build test manually
+ '$(TARGET)-g++' \
+ -W -Wall -Werror -std=gnu++11 \
+ '$(PWD)/src/qca-test.cpp' \
+ -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG)-pkgconfig.exe' \
+ $(if $(BUILD_STATIC), -L'$(PREFIX)/$(TARGET)/qt5/plugins/crypto' -lqca-ossl) \
+ `'$(TARGET)-pkg-config' qca2-qt5 --cflags --libs`
+endef
+
+$(PKG)_BUILD_STATIC =