Merge pull request #1709 from sibuserv/add-qca

add package qca
This commit is contained in:
Tony Theodore 2017-04-02 14:16:56 +10:00 committed by GitHub
commit 3fcaa581b5
5 changed files with 138 additions and 0 deletions

23
src/qca-1-fixes.patch Normal file
View File

@ -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}")

21
src/qca-test.cmake Normal file
View File

@ -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)

38
src/qca-test.cpp Normal file
View File

@ -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;
}

11
src/qca-test.pro Normal file
View File

@ -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

45
src/qca.mk Normal file
View File

@ -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 =