From 1c56565a5f91dcc6c9b35d87d46b33f496a6893a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20Casenave-P=C3=A9r=C3=A9?= Date: Sun, 21 Mar 2021 20:53:55 +0100 Subject: [PATCH] Add build setup for static library --- .gitignore | 1 + src/ecl_fun.cpp | 7 ++++++- src/eql_lib.pro | 20 +++++++++++++++++++- src/make-static.lisp | 3 +++ src/module_help.pro | 12 ++++++++++-- src/module_multimedia.pro | 10 +++++++++- src/module_network.pro | 10 +++++++++- src/module_quick.pro | 10 +++++++++- src/module_sql.pro | 10 +++++++++- src/module_svg.pro | 12 ++++++++++-- src/module_webengine.pro | 12 ++++++++++-- src/module_webkit.pro | 12 ++++++++++-- 12 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 src/make-static.lisp diff --git a/.gitignore b/.gitignore index 8509081..4005e9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.a +*.prl *.dll *.dylib *.exe diff --git a/src/ecl_fun.cpp b/src/ecl_fun.cpp index 435aed0..7d704e5 100644 --- a/src/ecl_fun.cpp +++ b/src/ecl_fun.cpp @@ -2442,10 +2442,13 @@ cl_object qrequire2(cl_object l_name, cl_object l_quiet) { /// qrequire path = appPath + "/../libs/"; } #endif #ifdef STATIC_MODULES +#ifndef OS_SAILFISH if("help" == name) { if(!ModuleInterface::help) { ModuleInterface::help = new ModuleHelp; }} - else if("multimedia" == name) { + else +#endif + if("multimedia" == name) { if(!ModuleInterface::multimedia) { ModuleInterface::multimedia = new ModuleMultimedia; }} else if("network" == name) { @@ -2457,6 +2460,7 @@ cl_object qrequire2(cl_object l_name, cl_object l_quiet) { /// qrequire else if("sql" == name) { if(!ModuleInterface::sql) { ModuleInterface::sql = new ModuleSql; }} +#ifndef OS_SAILFISH else if("svg" == name) { if(!ModuleInterface::svg) { ModuleInterface::svg = new ModuleSvg; }} @@ -2467,6 +2471,7 @@ cl_object qrequire2(cl_object l_name, cl_object l_quiet) { /// qrequire else if("webkit" == name) { if(!ModuleInterface::webkit) { ModuleInterface::webkit = new ModuleWebkit; }} */ +#endif else if(l_quiet == ECL_NIL) { error_msg("QREQUIRE", LIST1(l_name)); } return l_name; diff --git a/src/eql_lib.pro b/src/eql_lib.pro index 68b674f..62277d0 100644 --- a/src/eql_lib.pro +++ b/src/eql_lib.pro @@ -8,6 +8,7 @@ TARGET = eql5 DESTDIR = ../ OBJECTS_DIR = ./tmp/ MOC_DIR = ./tmp/ +VERSION = $$(EQL_VERSION) # static modules (optional) *** warning: only use them if you know what you are doing! *** #DEFINES += STATIC_MODULES @@ -45,11 +46,28 @@ win32 { sailfish { # on Sailfish run this prior to run qmake: # $ export SAILFISH=sailfish - QT -= printsupport uitools + QT -= printsupport uitools + CONFIG -= dll + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + CONFIG += create_prl + DEFINES += STATIC_MODULES + QT += qml multimedia network quick sql + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/ + MOC_DIR = ./tmp/static/ + + combinedlib.files = libeql5.a libeql5.prl + combinedlib.extra = ecl -shell make-static.lisp + combinedlib.path = $$[QT_INSTALL_LIBS] + + INSTALLS = combinedlib +} + HEADERS += gen/_lobjects.h \ gen/_main_q_classes.h \ gen/_main_n_classes.h \ diff --git a/src/make-static.lisp b/src/make-static.lisp new file mode 100644 index 0000000..52b6a28 --- /dev/null +++ b/src/make-static.lisp @@ -0,0 +1,3 @@ +(let* ((static-libs (mapcar #'file-namestring (directory "libeql5_*.a"))) + (mri (format nil "create libeql5static.a~%addlib libini_eql5.a~%addlib libeql5.a~%~{addlib ~a~%~}save~%end~%" static-libs))) + (ext:system (format nil "sh -c 'echo ~s | ar -M && mv libeql5static.a libeql5.a'" mri))) diff --git a/src/module_help.pro b/src/module_help.pro index 0510d9c..319f97b 100644 --- a/src/module_help.pro +++ b/src/module_help.pro @@ -2,13 +2,13 @@ QT += help printsupport uitools TEMPLATE = lib CONFIG += no_keywords release $$(SAILFISH) CONFIG += plugin -#CONFIG += static INCLUDEPATH += ../src /usr/local/include LIBS += -lecl -leql5 -L.. -L/usr/local/lib TARGET = eql5_help DESTDIR = ../ OBJECTS_DIR = ./tmp/help/ MOC_DIR = ./tmp/help/ +VERSION = $$(EQL_VERSION) linux { target.path = $$[QT_INSTALL_LIBS] @@ -27,11 +27,19 @@ win32 { sailfish { # on Sailfish run this prior to run qmake: # $ export SAILFISH=sailfish - QT -= printsupport uitools + QT -= printsupport uitools + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/help/ + MOC_DIR = ./tmp/static/help/ + INSTALLS -= target +} + HEADERS += gen/help/_ini.h \ gen/help/_ini2.h \ gen/help/_q_classes.h \ diff --git a/src/module_multimedia.pro b/src/module_multimedia.pro index 415957f..7f0465c 100644 --- a/src/module_multimedia.pro +++ b/src/module_multimedia.pro @@ -2,13 +2,13 @@ QT += multimedia multimediawidgets printsupport uitools TEMPLATE = lib CONFIG += no_keywords release $$(SAILFISH) CONFIG += plugin -#CONFIG += static INCLUDEPATH += ../src /usr/local/include LIBS += -lecl -leql5 -L.. -L/usr/local/lib TARGET = eql5_multimedia DESTDIR = ../ OBJECTS_DIR = ./tmp/multimedia/ MOC_DIR = ./tmp/multimedia/ +VERSION = $$(EQL_VERSION) linux { target.path = $$[QT_INSTALL_LIBS] @@ -29,10 +29,18 @@ sailfish { # $ export SAILFISH=sailfish QT -= multimediawidgets printsupport uitools QT += widgets + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/multimedia/ + MOC_DIR = ./tmp/static/multimedia/ + INSTALLS -= target +} + HEADERS += gen/multimedia/_ini.h \ gen/multimedia/_ini2.h \ gen/multimedia/_q_classes.h \ diff --git a/src/module_network.pro b/src/module_network.pro index efee1ef..e95e9d1 100644 --- a/src/module_network.pro +++ b/src/module_network.pro @@ -2,13 +2,13 @@ QT += network printsupport uitools TEMPLATE = lib CONFIG += no_keywords release $$(SAILFISH) CONFIG += plugin -#CONFIG += static INCLUDEPATH += ../src /usr/local/include LIBS += -lecl -leql5 -L.. -L/usr/local/lib TARGET = eql5_network DESTDIR = ../ OBJECTS_DIR = ./tmp/network/ MOC_DIR = ./tmp/network/ +VERSION = $$(EQL_VERSION) linux { target.path = $$[QT_INSTALL_LIBS] @@ -29,10 +29,18 @@ sailfish { # $ export SAILFISH=sailfish QT -= printsupport uitools QT += widgets + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/network/ + MOC_DIR = ./tmp/static/network/ + INSTALLS -= target +} + HEADERS += gen/network/_ini.h \ gen/network/_ini2.h \ gen/network/_q_classes.h \ diff --git a/src/module_quick.pro b/src/module_quick.pro index 297b113..cb13a49 100644 --- a/src/module_quick.pro +++ b/src/module_quick.pro @@ -2,13 +2,13 @@ QT += quick quickwidgets qml printsupport uitools TEMPLATE = lib CONFIG += no_keywords release $$(SAILFISH) CONFIG += plugin -#CONFIG += static INCLUDEPATH += ../src /usr/local/include LIBS += -lecl -leql5 -L.. -L/usr/local/lib TARGET = eql5_quick DESTDIR = ../ OBJECTS_DIR = ./tmp/quick/ MOC_DIR = ./tmp/quick/ +VERSION = $$(EQL_VERSION) linux { target.path = $$[QT_INSTALL_LIBS] @@ -29,10 +29,18 @@ sailfish { # $ export SAILFISH=sailfish QT -= quickwidgets printsupport uitools QT += widgets + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/quick/ + MOC_DIR = ./tmp/static/quick/ + INSTALLS -= target +} + HEADERS += gen/quick/_ini.h \ gen/quick/_ini2.h \ gen/quick/_q_classes.h \ diff --git a/src/module_sql.pro b/src/module_sql.pro index 999b2a7..cc1250f 100644 --- a/src/module_sql.pro +++ b/src/module_sql.pro @@ -2,13 +2,13 @@ QT += sql printsupport uitools TEMPLATE = lib CONFIG += no_keywords release $$(SAILFISH) CONFIG += plugin -#CONFIG += static INCLUDEPATH += ../src /usr/local/include LIBS += -lecl -leql5 -L.. -L/usr/local/lib TARGET = eql5_sql DESTDIR = ../ OBJECTS_DIR = ./tmp/sql/ MOC_DIR = ./tmp/sql/ +VERSION = $$(EQL_VERSION) linux { target.path = $$[QT_INSTALL_LIBS] @@ -29,10 +29,18 @@ sailfish { # $ export SAILFISH=sailfish QT -= printsupport uitools QT += widgets + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/sql/ + MOC_DIR = ./tmp/static/sql/ + INSTALLS -= target +} + HEADERS += gen/sql/_ini.h \ gen/sql/_ini2.h \ gen/sql/_q_classes.h \ diff --git a/src/module_svg.pro b/src/module_svg.pro index 8bfcfd1..55cf696 100644 --- a/src/module_svg.pro +++ b/src/module_svg.pro @@ -2,13 +2,13 @@ QT += svg printsupport uitools TEMPLATE = lib CONFIG += no_keywords release $$(SAILFISH) CONFIG += plugin -#CONFIG += static INCLUDEPATH += ../src /usr/local/include LIBS += -lecl -leql5 -L.. -L/usr/local/lib TARGET = eql5_svg DESTDIR = ../ OBJECTS_DIR = ./tmp/svg/ MOC_DIR = ./tmp/svg/ +VERSION = $$(EQL_VERSION) linux { target.path = $$[QT_INSTALL_LIBS] @@ -27,11 +27,19 @@ win32 { sailfish { # on Sailfish run this prior to run qmake: # $ export SAILFISH=sailfish - QT -= printsupport uitools + QT -= printsupport uitools + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/svg/ + MOC_DIR = ./tmp/static/svg/ + INSTALLS -= target +} + HEADERS += gen/svg/_ini.h \ gen/svg/_ini2.h \ gen/svg/_q_classes.h \ diff --git a/src/module_webengine.pro b/src/module_webengine.pro index 52e4411..6fbd155 100644 --- a/src/module_webengine.pro +++ b/src/module_webengine.pro @@ -2,13 +2,13 @@ QT += webengine webenginewidgets printsupport uitools TEMPLATE = lib CONFIG += no_keywords release $$(SAILFISH) CONFIG += plugin -#CONFIG += static INCLUDEPATH += ../src /usr/local/include LIBS += -lecl -leql5 -L.. -L/usr/local/lib TARGET = eql5_webengine DESTDIR = ../ OBJECTS_DIR = ./tmp/webengine/ MOC_DIR = ./tmp/webengine/ +VERSION = $$(EQL_VERSION) linux { target.path = $$[QT_INSTALL_LIBS] @@ -29,11 +29,19 @@ win32 { sailfish { # on Sailfish run this prior to run qmake: # $ export SAILFISH=sailfish - QT -= printsupport uitools + QT -= printsupport uitools + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/webengine/ + MOC_DIR = ./tmp/static/webengine/ + INSTALLS -= target +} + HEADERS += gen/webengine/_ini.h \ gen/webengine/_ini2.h \ gen/webengine/_q_classes.h \ diff --git a/src/module_webkit.pro b/src/module_webkit.pro index 09cad91..9331ef4 100644 --- a/src/module_webkit.pro +++ b/src/module_webkit.pro @@ -2,13 +2,13 @@ QT += webkit webkitwidgets printsupport uitools TEMPLATE = lib CONFIG += no_keywords release $$(SAILFISH) CONFIG += plugin -#CONFIG += static INCLUDEPATH += ../src /usr/local/include LIBS += -lecl -leql5 -L.. -L/usr/local/lib TARGET = eql5_webkit DESTDIR = ../ OBJECTS_DIR = ./tmp/webkit/ MOC_DIR = ./tmp/webkit/ +VERSION = $$(EQL_VERSION) macx:QT += network linux { @@ -28,11 +28,19 @@ win32 { sailfish { # on Sailfish run this prior to run qmake: # $ export SAILFISH=sailfish - QT -= printsupport uitools + QT -= printsupport uitools + CONFIG += shared_and_static build_all DEFINES += OS_SAILFISH message("*** Building for SailfishOS ***") } +static { + DESTDIR = ./ + OBJECTS_DIR = ./tmp/static/webkit/ + MOC_DIR = ./tmp/static/webkit/ + INSTALLS -= target +} + HEADERS += gen/webkit/_ini.h \ gen/webkit/_ini2.h \ gen/webkit/_q_classes.h \