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

@ -1,6 +1,6 @@
(in-package :qml) (in-package :qml)
#-mobile #-(or android ios)
(require :ecl-curl) (require :ecl-curl)
(defun curl (url) (defun curl (url)

View file

@ -1,5 +1,5 @@
(in-package :app) (in-package :app)
#+mobile #+(or android ios)
(when qml::*remote-ip* (when qml::*remote-ip*
(qsingle-shot 1000 'auto-reload-qml)) (qsingle-shot 1000 'auto-reload-qml))

View file

@ -7,7 +7,10 @@
(list "/ecl-android" "/ecl-ios") (list "/ecl-android" "/ecl-ios")
(list :android :ios))) (list :android :ios)))
#+(or android ios) (when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*) (pushnew :mobile *features*)
;;; copy Swank and ECL contrib files (mobile only) ;;; copy Swank and ECL contrib files (mobile only)

View file

@ -6,7 +6,10 @@
(list "/ecl-android" "/ecl-ios") (list "/ecl-android" "/ecl-ios")
(list :android :ios))) (list :android :ios)))
#+(or android ios) (when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*) (pushnew :mobile *features*)
(require :asdf) (require :asdf)

View file

@ -7,7 +7,10 @@
(list "/ecl-android" "/ecl-ios") (list "/ecl-android" "/ecl-ios")
(list :android :ios))) (list :android :ios)))
#+(or android ios) (when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*) (pushnew :mobile *features*)
;;; copy ECL '*.doc' and 'encodings/' (mobile only) ;;; copy ECL '*.doc' and 'encodings/' (mobile only)

View file

@ -1,6 +1,6 @@
(in-package :qml) (in-package :qml)
#-mobile #-(or android ios)
(require :ecl-curl) (require :ecl-curl)
(defun curl (url) (defun curl (url)

View file

@ -123,11 +123,11 @@
(defun location (name) (defun location (name)
(cond ((string= ":data" name) (cond ((string= ":data" name)
#+mobile #+(or android ios)
(progn (progn
#+android "/sdcard/Documents/" #+android "/sdcard/Documents/"
#+ios (namestring (truename (merge-pathnames "../Documents/")))) #+ios (namestring (truename (merge-pathnames "../Documents/"))))
#-mobile #-(or android ios)
(namestring (merge-pathnames "Documents/" (user-homedir-pathname)))) (namestring (merge-pathnames "Documents/" (user-homedir-pathname))))
((string= ":home" name) ((string= ":home" name)
(namestring *default-pathname-defaults*)))) (namestring *default-pathname-defaults*))))

View file

@ -29,7 +29,7 @@
;;; create default '.eclrc' ;;; create default '.eclrc'
#+mobile #+(or android ios)
(let ((ecl-rc (merge-pathnames ".eclrc"))) (let ((ecl-rc (merge-pathnames ".eclrc")))
(unless (probe-file ecl-rc) (unless (probe-file ecl-rc)
(with-open-file (s ecl-rc :direction :output) (with-open-file (s ecl-rc :direction :output)
@ -41,10 +41,10 @@
;;; check version ;;; check version
#+mobile #+(or android ios)
(defconstant +version+ 6) (defconstant +version+ 6)
#+mobile #+(or android ios)
(let ((.version (merge-pathnames ".version"))) (let ((.version (merge-pathnames ".version")))
(when (or (not (probe-file .version)) (when (or (not (probe-file .version))
(> +version+ (> +version+

View file

@ -1,5 +1,5 @@
(in-package :editor) (in-package :editor)
#+mobile #+(or android ios)
(when qml::*remote-ip* (when qml::*remote-ip*
(qsingle-shot 1000 'auto-reload-qml)) (qsingle-shot 1000 'auto-reload-qml))

View file

@ -88,8 +88,8 @@ it saves uploaded files on the server."
(start-server *web-server*) (start-server *web-server*)
(when ini (when ini
(register-context-handler *web-server* "/" 'static-resource/upload-handler (register-context-handler *web-server* "/" 'static-resource/upload-handler
:arguments (list #+mobile *default-pathname-defaults* :arguments (list #+(or android ios) *default-pathname-defaults*
#-mobile (merge-pathnames "www/"))))) #-(or android ios) (merge-pathnames "www/")))))
(x:when-it (qml:my-ip) (x:when-it (qml:my-ip)
(format nil "http://~A:1701/" x:it))) (format nil "http://~A:1701/" x:it)))

View file

@ -9,7 +9,10 @@
(list "/ecl-android" "/ecl-ios") (list "/ecl-android" "/ecl-ios")
(list :android :ios))) (list :android :ios)))
#+(or android ios) (when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*) (pushnew :mobile *features*)
;;; compile ASDF system ;;; compile ASDF system

View file

@ -9,7 +9,10 @@
(list "/ecl-android" "/ecl-ios") (list "/ecl-android" "/ecl-ios")
(list :android :ios))) (list :android :ios)))
#+(or android ios) (when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*) (pushnew :mobile *features*)
;;; copy Swank and ECL contrib files (mobile only) ;;; copy Swank and ECL contrib files (mobile only)

View file

@ -120,9 +120,7 @@ Rectangle {
y: main.small ? 7 : 10 y: main.small ? 7 : 10
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
spacing: 20 spacing: 20
visible: ((Qt.platform.os === "android") || visible: Lisp.call("qml:mobile-p") ? path.focus : false
(Qt.platform.os === "ios"))
? path.focus : false
// cursor back // cursor back
Ext.ArrowButton { Ext.ArrowButton {

View file

@ -11,8 +11,7 @@ Item {
} }
function message(text) { function message(text) {
if ((Qt.platform.os === "android") || if (Lisp.call("qml:mobile-p")) {
(Qt.platform.os === "ios")) {
loader.source = "MessageMobile.qml" loader.source = "MessageMobile.qml"
} else { } else {
loader.source = "Message.qml" loader.source = "Message.qml"
@ -23,8 +22,7 @@ Item {
} }
function confirm(title, text, callback) { function confirm(title, text, callback) {
if ((Qt.platform.os === "android") || if (Lisp.call("qml:mobile-p")) {
(Qt.platform.os === "ios")) {
loader.source = "ConfirmMobile.qml" loader.source = "ConfirmMobile.qml"
} else { } else {
loader.source = "Confirm.qml" loader.source = "Confirm.qml"

View file

@ -7,7 +7,10 @@
(list "/ecl-android" "/ecl-ios") (list "/ecl-android" "/ecl-ios")
(list :android :ios))) (list :android :ios)))
#+(or android ios) (when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*) (pushnew :mobile *features*)
;;; copy Swank and ECL contrib files (mobile only) ;;; copy Swank and ECL contrib files (mobile only)

View file

@ -1,6 +1,6 @@
(in-package :qml) (in-package :qml)
#-mobile #-(or android ios)
(require :ecl-curl) (require :ecl-curl)
(defun curl (url) (defun curl (url)

View file

@ -7,7 +7,10 @@
(list "/ecl-android" "/ecl-ios") (list "/ecl-android" "/ecl-ios")
(list :android :ios))) (list :android :ios)))
#+(or android ios) (when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*) (pushnew :mobile *features*)
;;; copy Swank and ECL contrib files (mobile only) ;;; copy Swank and ECL contrib files (mobile only)

View file

@ -6,7 +6,10 @@
(list "/ecl-android" "/ecl-ios") (list "/ecl-android" "/ecl-ios")
(list :android :ios))) (list :android :ios)))
#+(or android ios) (when (probe-file "/etc/sailfish-release")
(pushnew :sailfish *features*))
#+(or android ios sailfish)
(pushnew :mobile *features*) (pushnew :mobile *features*)
(require :asdf) (require :asdf)

View file

@ -5,16 +5,16 @@
#include <QTimer> #include <QTimer>
#include <QLibrary> #include <QLibrary>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <QGuiApplication>
#include <QThread> #include <QThread>
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
#include <QClipboard> #include <QtGui/QClipboard>
#include <QQuickItem> #include <QtGui/QGuiApplication>
#include <QQuickView> #include <QtQml/QQmlEngine>
#include <QQmlEngine> #include <QtQml/QQmlExpression>
#include <QQmlExpression> #include <QtQml/QQmlProperty>
#include <QQmlProperty> #include <QtQuick/QQuickItem>
#include <QtQuick/QQuickView>
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
#include <QtAndroid> #include <QtAndroid>
@ -32,6 +32,7 @@ void iniCLFunctions() {
DEFUN ("%disable-clipboard-menu", disable_clipboard_menu2, 1) DEFUN ("%disable-clipboard-menu", disable_clipboard_menu2, 1)
DEFUN ("%ensure-permissions", ensure_permissions2, 1) DEFUN ("%ensure-permissions", ensure_permissions2, 1)
DEFUN ("%js", js2, 2) DEFUN ("%js", js2, 2)
DEFUN ("mobile-p", mobile_p, 0)
DEFUN ("pixel-ratio", pixel_ratio, 0) DEFUN ("pixel-ratio", pixel_ratio, 0)
DEFUN ("%qapropos", qapropos2, 3) DEFUN ("%qapropos", qapropos2, 3)
DEFUN ("qchildren", qchildren, 1) 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++) { 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); cl_object l_el = cl_car(l_do_list);
if (qjs_call) { 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()' // will be converted back automatically if passed with 'Lisp.call()'
if (cl_integerp(l_el) == ECL_T) { if (cl_integerp(l_el) == ECL_T) {
l_el = cl_funcall(2, s_hex, l_el); l_el = cl_funcall(2, s_hex, l_el);
@ -629,6 +630,19 @@ cl_object qquit2(cl_object l_status) {
return ECL_NIL; 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() { cl_object pixel_ratio() {
/// args: () /// args: ()
/// Returns the effective device pixel ratio. /// 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 disable_clipboard_menu2 (cl_object);
cl_object ensure_permissions2 (cl_object); cl_object ensure_permissions2 (cl_object);
cl_object js2 (cl_object, cl_object); cl_object js2 (cl_object, cl_object);
cl_object mobile_p ();
cl_object pixel_ratio (); cl_object pixel_ratio ();
cl_object qapropos2 (cl_object, cl_object, cl_object); cl_object qapropos2 (cl_object, cl_object, cl_object);
cl_object qchildren (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) { cl_object from_qbytearray(const QByteArray& ba) {
STATIC_SYMBOL_PKG (s_make_byte_vector, "%MAKE-BYTE-VECTOR", "QML") // see 'ini.lisp' 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++) { for (int i = 0; i < ba.size(); i++) {
l_list = CONS(ecl_make_fixnum(static_cast<uchar>(ba.at(i))), l_list); 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; QHash<QByteArray, void*> lisp_functions;
cl_object lisp_apply(cl_object l_fun, cl_object l_args) { 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(); const cl_env_ptr l_env = ecl_process_env();
CL_CATCH_ALL_BEGIN(l_env) { CL_CATCH_ALL_BEGIN(l_env) {
CL_UNWIND_PROTECT_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 pkg = (p == -1) ? "qml-user" : pkgFun.left(p);
QByteArray fun = pkgFun.mid(pkgFun.lastIndexOf(':') + 1); QByteArray fun = pkgFun.mid(pkgFun.lastIndexOf(':') + 1);
cl_object l_pkg = cl_find_package(make_constant_base_string(pkg.toUpper().constData())); 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, cl_object l_sym = cl_find_symbol(2,
make_constant_base_string(fun.toUpper().constData()), make_constant_base_string(fun.toUpper().constData()),
l_pkg); l_pkg);
if (cl_fboundp(l_sym) != Cnil) { if (cl_fboundp(l_sym) != ECL_NIL) {
symbol = l_sym; symbol = l_sym;
lisp_functions[pkgFun] = symbol; lisp_functions[pkgFun] = symbol;
} }
} }
} }
cl_object l_args = Cnil; cl_object l_args = ECL_NIL;
if (!a1.isNull()) { PUSH_ARG(a1); if (!a1.isNull()) { PUSH_ARG(a1);
if (!a2.isNull()) { PUSH_ARG(a2); if (!a2.isNull()) { PUSH_ARG(a2);
if (!a3.isNull()) { PUSH_ARG(a3); if (!a3.isNull()) { PUSH_ARG(a3);

View file

@ -4,10 +4,10 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QTimer> #include <QTimer>
#include <QStringList> #include <QStringList>
#include <QQuickView> #include <QtQuick/QQuickView>
#include <QDebug> #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); extern "C" void ini_LQML(cl_object);

View file

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

View file

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

View file

@ -1,10 +1,10 @@
#include "marshal.h" #include "marshal.h"
#include <QColor>
#include <QUrl> #include <QUrl>
#include <QVariant> #include <QVariant>
#include <QObject> #include <QObject>
#include <QVariant> #include <QVariant>
#include <QJSValue> #include <QtGui/QColor>
#include <QtQml/QJSValue>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -220,7 +220,7 @@ QVariant toQVariantMap(cl_object l_list) {
cl_object l_keyword = cl_first(l_do_args); cl_object l_keyword = cl_first(l_do_args);
if (cl_keywordp(l_keyword) == ECL_T) { if (cl_keywordp(l_keyword) == ECL_T) {
cl_object l_value = cl_second(l_do_args); 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()' // will be converted back automatically if passed with 'Lisp.call()'
if (cl_integerp(l_value) == ECL_T) { if (cl_integerp(l_value) == ECL_T) {
l_value = cl_funcall(2, s_hex, l_value); 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) { cl_object from_qbytearray(const QByteArray& ba) {
STATIC_SYMBOL_PKG (s_make_byte_vector, "%MAKE-BYTE-VECTOR", "QML") // see 'ini.lisp' 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++) { for (int i = 0; i < ba.size(); i++) {
l_list = CONS(ecl_make_fixnum(static_cast<uchar>(ba.at(i))), l_list); 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 QHash<QByteArray, void*> lisp_functions;
static cl_object lisp_apply(cl_object l_fun, cl_object l_args) { 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(); const cl_env_ptr l_env = ecl_process_env();
CL_CATCH_ALL_BEGIN(l_env) { CL_CATCH_ALL_BEGIN(l_env) {
CL_UNWIND_PROTECT_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 pkg = (p == -1) ? "qml-user" : pkgFun.left(p);
QByteArray fun = pkgFun.mid(pkgFun.lastIndexOf(':') + 1); QByteArray fun = pkgFun.mid(pkgFun.lastIndexOf(':') + 1);
cl_object l_pkg = cl_find_package(make_constant_base_string(pkg.toUpper().constData())); 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, cl_object l_sym = cl_find_symbol(2,
make_constant_base_string(fun.toUpper().constData()), make_constant_base_string(fun.toUpper().constData()),
l_pkg); l_pkg);
if (cl_fboundp(l_sym) != Cnil) { if (cl_fboundp(l_sym) != ECL_NIL) {
symbol = l_sym; symbol = l_sym;
lisp_functions[pkgFun] = symbol; lisp_functions[pkgFun] = symbol;
} }
} }
} }
cl_object l_args = Cnil; cl_object l_args = ECL_NIL;
if (!a1.isNull()) { PUSH_ARG(a1); if (!a1.isNull()) { PUSH_ARG(a1);
if (!a2.isNull()) { PUSH_ARG(a2); if (!a2.isNull()) { PUSH_ARG(a2);
if (!a3.isNull()) { PUSH_ARG(a3); if (!a3.isNull()) { PUSH_ARG(a3);

View file

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

View file

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