From 5c4fb0eb7f673b08144d8b3355e2f107a0eac253 Mon Sep 17 00:00:00 2001 From: EndrII Date: Sat, 22 Sep 2018 20:43:29 +0300 Subject: [PATCH] added shared build --- .gitignore | 2 ++ CQtDeployer/CQtDeployer.pro | 3 ++- CQtDeployer/deploy.cpp | 2 +- qtBase | 2 +- sharedBuild.sh | 49 +++++++++++++++++++++++++++++++++++++ staticBuild.sh | 23 +++++++++++------ 6 files changed, 70 insertions(+), 11 deletions(-) create mode 100755 sharedBuild.sh diff --git a/.gitignore b/.gitignore index 81f4ba7..876a59f 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,5 @@ CMakeLists.txt.user* snap/\.snapcraft/ \.buildconfig + +sharedQt/ diff --git a/CQtDeployer/CQtDeployer.pro b/CQtDeployer/CQtDeployer.pro index 08030cb..793889c 100644 --- a/CQtDeployer/CQtDeployer.pro +++ b/CQtDeployer/CQtDeployer.pro @@ -39,4 +39,5 @@ DISTFILES += \ ../snapBuild.sh \ ../staticBuild.sh \ ../snap/snapcraft.yaml \ - ../README.md + ../README.md \ + ../sharedBuild.sh diff --git a/CQtDeployer/deploy.cpp b/CQtDeployer/deploy.cpp index 6021446..018ae75 100644 --- a/CQtDeployer/deploy.cpp +++ b/CQtDeployer/deploy.cpp @@ -88,7 +88,7 @@ bool Deploy::createRunScript() { QString content = "#!/bin/sh\n" - "BASEDIR=$(dirname $0)\n" + "BASE_DIR=$(dirname \"$(readlink -f \"$0\")\")\n" "export LD_LIBRARY_PATH=$BASEDIR/lib:$BASEDIR:$LD_LIBRARY_PATH\n" "export QML_IMPORT_PATH=$BASEDIR/qml:QML_IMPORT_PATH\n" "export QML2_IMPORT_PATH=$BASEDIR/qml:QML2_IMPORT_PATH\n" diff --git a/qtBase b/qtBase index bd42e2f..b0dce50 160000 --- a/qtBase +++ b/qtBase @@ -1 +1 @@ -Subproject commit bd42e2f0cebb2fe8de77a054e9d30aa803749a61 +Subproject commit b0dce506cc91c4b623eb323db7bbc18469e721c2 diff --git a/sharedBuild.sh b/sharedBuild.sh new file mode 100755 index 0000000..724c00d --- /dev/null +++ b/sharedBuild.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +declare -a QTLIBS + +BASE_DIR=$(dirname "$(readlink -f "$0")") + +QTLIBS=( libQt5Sql.so libQt5Xml.so libQt5Core.so libQt5Test.so libQt5Network.so libQt5Concurrent.so) + +cd $BASE_DIR/qtBase + +for var in "${QTLIBS[@]}" +do + if [ -e "$BASE_DIR/sharedQt/lib/$var" ] + then + echo "$var - ok" + else + echo "$var - not exits!. rebuild qt ..." + + sudo apt install libpcre2-dev + + rm -rdf $BASE_DIR/sharedQt + + git clean -xdf + + ./configure -confirm-license -prefix $BASE_DIR/sharedQt -release -shared -no-opengl -no-openssl -opensource -nomake tests -nomake examples -no-gui -no-widgets -no-dbus -no-accessibility + + make install -j$(nproc) + break + fi +done + +cd .. +rm -rdf $BASE_DIR/build + +export PATH=$PATH:$BASE_DIR/sharedQt + +$BASE_DIR/sharedQt/bin/qmake CQtDeployer.pro + +make -j$(nproc) + +strip build/* + +chmod +x $BASE_DIR/build/CQtDeployer + +$BASE_DIR/build/CQtDeployer -runScript cqtdeployer.sh -bin $BASE_DIR/build/CQtDeployer -qmake $BASE_DIR/sharedQt/bin/qmake + +tar -czvf $BASE_DIR/build/cqtdeployer.tar.gz $BASE_DIR/build/* + +rm $BASE_DIR/build/lib -rdf $BASE_DIR/build/*.so* $BASE_DIR/build/*.sh* diff --git a/staticBuild.sh b/staticBuild.sh index b71e276..d47512e 100755 --- a/staticBuild.sh +++ b/staticBuild.sh @@ -2,32 +2,39 @@ declare -a QTLIBS -BASE_DIR=$(dirname $0) +BASE_DIR=$(dirname "$(readlink -f "$0")") + QTLIBS=( libQt5Sql.a libQt5Xml.a libQt5Core.a libQt5Test.a libqtpcre2.a libQt5Network.a libQt5Bootstrap.a libQt5Concurrent.a) -cd qtBase +echo "base dir $BASE_DIR" + +cd $BASE_DIR/qtBase for var in "${QTLIBS[@]}" do - if [ -e "$BASE_DIR/lib/$var" ] + if [ -e "$BASE_DIR/staticQt/lib/$var" ] then echo "$var - ok" else echo "$var - not exits!. rebuild qt ..." - git clean -xfd + rm -rdf $BASE_DIR/staticQt + + git clean -xdf - ./configure -confirm-license -release -optimize-size -static -no-opengl -no-openssl -opensource -nomake tests -nomake examples -no-gui -no-widgets -no-dbus -no-accessibility + ./configure -confirm-license -prefix $BASE_DIR/staticQt -release -optimize-size -static -no-opengl -no-openssl -opensource -nomake tests -nomake examples -no-gui -no-widgets -no-dbus -no-accessibility - make -j$(nproc) + make install -j$(nproc) break fi done cd .. -export PATH=$PATH:/qtBase +rm -rdf $BASE_DIR/build -./qtBase/bin/qmake CQtDeployer.pro +export PATH=$PATH:$BASE_DIR/staticQt + +$BASE_DIR/staticQt/bin/qmake CQtDeployer.pro make -j$(nproc)