prepare for SailfishOS (Qt5.15 libs & qt-runner)

This commit is contained in:
pls.153 2023-10-08 15:46:12 +02:00
parent 8cc84acbcc
commit b07152d7d4
28 changed files with 99 additions and 59 deletions

View file

@ -5,16 +5,16 @@
#include <QTimer>
#include <QLibrary>
#include <QLibraryInfo>
#include <QGuiApplication>
#include <QThread>
#include <QFile>
#include <QDir>
#include <QClipboard>
#include <QQuickItem>
#include <QQuickView>
#include <QQmlEngine>
#include <QQmlExpression>
#include <QQmlProperty>
#include <QtGui/QClipboard>
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlExpression>
#include <QtQml/QQmlProperty>
#include <QtQuick/QQuickItem>
#include <QtQuick/QQuickView>
#ifdef Q_OS_ANDROID
#include <QtAndroid>
@ -32,6 +32,7 @@ void iniCLFunctions() {
DEFUN ("%disable-clipboard-menu", disable_clipboard_menu2, 1)
DEFUN ("%ensure-permissions", ensure_permissions2, 1)
DEFUN ("%js", js2, 2)
DEFUN ("mobile-p", mobile_p, 0)
DEFUN ("pixel-ratio", pixel_ratio, 0)
DEFUN ("%qapropos", qapropos2, 3)
DEFUN ("qchildren", qchildren, 1)
@ -502,7 +503,7 @@ cl_object qinvoke_method2(cl_object l_obj, cl_object l_name, cl_object l_args) {
for (cl_object l_do_list = l_args; l_do_list != ECL_NIL; l_do_list = cl_cdr(l_do_list), i++) {
cl_object l_el = cl_car(l_do_list);
if (qjs_call) {
// convert INTEGER to hex string, since we only have floats in JS
// convert INTEGER to hex string, since we only have floats in JS;
// will be converted back automatically if passed with 'Lisp.call()'
if (cl_integerp(l_el) == ECL_T) {
l_el = cl_funcall(2, s_hex, l_el);
@ -629,6 +630,19 @@ cl_object qquit2(cl_object l_status) {
return ECL_NIL;
}
cl_object mobile_p() {
/// args: ()
/// Returns T on android, iOS, SailfishOS.
ecl_process_env()->nvalues = 1;
QString platform = qGuiApp->platformName();
if ((platform == QStringLiteral("android")) ||
(platform == QStringLiteral("ios")) ||
QFile::exists("/etc/sailfish-release")) {
return ECL_T;
}
return ECL_NIL;
}
cl_object pixel_ratio() {
/// args: ()
/// Returns the effective device pixel ratio.

View file

@ -54,6 +54,7 @@ cl_object clipboard_text ();
cl_object disable_clipboard_menu2 (cl_object);
cl_object ensure_permissions2 (cl_object);
cl_object js2 (cl_object, cl_object);
cl_object mobile_p ();
cl_object pixel_ratio ();
cl_object qapropos2 (cl_object, cl_object, cl_object);
cl_object qchildren (cl_object);

View file

@ -321,7 +321,7 @@ cl_object from_cstring(const QByteArray& s) {
cl_object from_qbytearray(const QByteArray& ba) {
STATIC_SYMBOL_PKG (s_make_byte_vector, "%MAKE-BYTE-VECTOR", "QML") // see 'ini.lisp'
cl_object l_list = Cnil;
cl_object l_list = ECL_NIL;
for (int i = 0; i < ba.size(); i++) {
l_list = CONS(ecl_make_fixnum(static_cast<uchar>(ba.at(i))), l_list);
}
@ -409,7 +409,7 @@ cl_object from_qvariant(const QVariant& var) {
QHash<QByteArray, void*> lisp_functions;
cl_object lisp_apply(cl_object l_fun, cl_object l_args) {
cl_object l_ret = Cnil;
cl_object l_ret = ECL_NIL;
const cl_env_ptr l_env = ecl_process_env();
CL_CATCH_ALL_BEGIN(l_env) {
CL_UNWIND_PROTECT_BEGIN(l_env) {
@ -469,17 +469,17 @@ QVariant ecl_fun(const QByteArray& pkgFun,
QByteArray pkg = (p == -1) ? "qml-user" : pkgFun.left(p);
QByteArray fun = pkgFun.mid(pkgFun.lastIndexOf(':') + 1);
cl_object l_pkg = cl_find_package(make_constant_base_string(pkg.toUpper().constData()));
if (l_pkg != Cnil) {
if (l_pkg != ECL_NIL) {
cl_object l_sym = cl_find_symbol(2,
make_constant_base_string(fun.toUpper().constData()),
l_pkg);
if (cl_fboundp(l_sym) != Cnil) {
if (cl_fboundp(l_sym) != ECL_NIL) {
symbol = l_sym;
lisp_functions[pkgFun] = symbol;
}
}
}
cl_object l_args = Cnil;
cl_object l_args = ECL_NIL;
if (!a1.isNull()) { PUSH_ARG(a1);
if (!a2.isNull()) { PUSH_ARG(a2);
if (!a3.isNull()) { PUSH_ARG(a3);

View file

@ -4,10 +4,10 @@
#include <QCoreApplication>
#include <QTimer>
#include <QStringList>
#include <QQuickView>
#include <QtQuick/QQuickView>
#include <QDebug>
const char LQML::version[] = "23.10.1"; // October 2023
const char LQML::version[] = "23.10.2"; // October 2023
extern "C" void ini_LQML(cl_object);

View file

@ -4,11 +4,11 @@
#include <QDir>
#include <QTimer>
#include <QRegularExpression>
#include <QQmlEngine>
#include <QQmlFileSelector>
#include <QQuickView>
#include <QTranslator>
#include <QtDebug>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlFileSelector>
#include <QtQuick/QQuickView>
#include <iostream>
#ifdef INI_WEBVIEW
@ -58,7 +58,7 @@ cl_object do_ini_app() {
#ifdef BACKGROUND_INI_LISP
ecl_init_module(NULL, ini_app);
#endif
return Cnil;
return ECL_NIL;
}
int main(int argc, char* argv[]) {

View file

@ -3,9 +3,9 @@
#undef SLOT
#include <ecl/ecl.h>
#include <QQmlEngine>
#include <QGuiApplication>
#include <QInputMethodEvent>
#include <QtQml/QQmlEngine>
#include <QtGui/QGuiApplication>
#include <QtGui/QInputMethodEvent>
QT_BEGIN_NAMESPACE

View file

@ -1,10 +1,10 @@
#include "marshal.h"
#include <QColor>
#include <QUrl>
#include <QVariant>
#include <QObject>
#include <QVariant>
#include <QJSValue>
#include <QtGui/QColor>
#include <QtQml/QJSValue>
QT_BEGIN_NAMESPACE
@ -220,7 +220,7 @@ QVariant toQVariantMap(cl_object l_list) {
cl_object l_keyword = cl_first(l_do_args);
if (cl_keywordp(l_keyword) == ECL_T) {
cl_object l_value = cl_second(l_do_args);
// convert INTEGER to hex string, since we only have floats in JS
// convert INTEGER to hex string, since we only have floats in JS;
// will be converted back automatically if passed with 'Lisp.call()'
if (cl_integerp(l_value) == ECL_T) {
l_value = cl_funcall(2, s_hex, l_value);
@ -258,7 +258,7 @@ cl_object from_cstring(const QByteArray& s) {
cl_object from_qbytearray(const QByteArray& ba) {
STATIC_SYMBOL_PKG (s_make_byte_vector, "%MAKE-BYTE-VECTOR", "QML") // see 'ini.lisp'
cl_object l_list = Cnil;
cl_object l_list = ECL_NIL;
for (int i = 0; i < ba.size(); i++) {
l_list = CONS(ecl_make_fixnum(static_cast<uchar>(ba.at(i))), l_list);
}

View file

@ -8,7 +8,7 @@ QT_BEGIN_NAMESPACE
static QHash<QByteArray, void*> lisp_functions;
static cl_object lisp_apply(cl_object l_fun, cl_object l_args) {
cl_object l_ret = Cnil;
cl_object l_ret = ECL_NIL;
const cl_env_ptr l_env = ecl_process_env();
CL_CATCH_ALL_BEGIN(l_env) {
CL_UNWIND_PROTECT_BEGIN(l_env) {
@ -46,17 +46,17 @@ QVariant ecl_fun(const QByteArray& pkgFun,
QByteArray pkg = (p == -1) ? "qml-user" : pkgFun.left(p);
QByteArray fun = pkgFun.mid(pkgFun.lastIndexOf(':') + 1);
cl_object l_pkg = cl_find_package(make_constant_base_string(pkg.toUpper().constData()));
if (l_pkg != Cnil) {
if (l_pkg != ECL_NIL) {
cl_object l_sym = cl_find_symbol(2,
make_constant_base_string(fun.toUpper().constData()),
l_pkg);
if (cl_fboundp(l_sym) != Cnil) {
if (cl_fboundp(l_sym) != ECL_NIL) {
symbol = l_sym;
lisp_functions[pkgFun] = symbol;
}
}
}
cl_object l_args = Cnil;
cl_object l_args = ECL_NIL;
if (!a1.isNull()) { PUSH_ARG(a1);
if (!a2.isNull()) { PUSH_ARG(a2);
if (!a3.isNull()) { PUSH_ARG(a3);

View file

@ -14,6 +14,7 @@
#:ensure-permissions
#:find-quick-item
#:hex
#:mobile-p
#:pixel-ratio
#:qapropos
#:qapropos*

View file

@ -7,7 +7,10 @@
(list "/ecl-android" "/ecl-ios")
(list :android :ios)))
#+(or android ios)
(when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*)
;;; compile ASDF system
@ -53,7 +56,8 @@
#-msvc "a"))
(to #+msvc "lisp.lib"
#-msvc (format nil "liblisp~A.a"
(if (<= most-positive-fixnum (expt 2 32)) "32" "")))
#+android (if (<= most-positive-fixnum (expt 2 32)) "32" "")
#-android ""))
(to* (format nil "platforms/~A/lib/~A"
#+(and linux (not android)) "linux"
#+(and darwin (not ios)) "macos"