From fe0d7a43065555ad151853e3756b6462fa91e8b7 Mon Sep 17 00:00:00 2001
From: "a.yankovich" <a.yankovich@rtp.by>
Date: Thu, 13 Sep 2018 13:51:17 +0300
Subject: [PATCH 1/7] added snapcraft

---
 .buildconfig          | 10 ++++++++++
 .gitignore            |  4 ++++
 snap/.snapcraft/state |  6 ++++++
 snap/snapcraft.yaml   | 28 ++++++++++++++++++++++++++++
 4 files changed, 48 insertions(+)
 create mode 100644 .buildconfig
 create mode 100644 snap/.snapcraft/state
 create mode 100644 snap/snapcraft.yaml

diff --git a/.buildconfig b/.buildconfig
new file mode 100644
index 0000000..7a633df
--- /dev/null
+++ b/.buildconfig
@@ -0,0 +1,10 @@
+[default]
+name=Default
+runtime=host
+config-opts=
+run-opts=
+prefix=/home/andrei/.cache/gnome-builder/install/snap/host
+app-id=
+postbuild=
+prebuild=
+default=true
diff --git a/.gitignore b/.gitignore
index c700f1c..2da21f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
 *.so
 *.dll
 *.dylib
+*.snap
 
 # Qt-es
 object_script.*.Release
@@ -29,6 +30,9 @@ ui_*.h
 Makefile*
 *build-*
 build/*
+stage/*
+prime/*
+parts/*
 
 # Qt unit tests
 target_wrapper.*
diff --git a/snap/.snapcraft/state b/snap/.snapcraft/state
new file mode 100644
index 0000000..a15d613
--- /dev/null
+++ b/snap/.snapcraft/state
@@ -0,0 +1,6 @@
+!GlobalState
+assets:
+  build-packages: [libglib2.0-dev-bin=2.56.2-0ubuntu0.18.04.1, libglib2.0-bin=2.56.2-0ubuntu0.18.04.1,
+    libglib2.0-dev=2.56.2-0ubuntu0.18.04.1, libglib2.0-0=2.56.2-0ubuntu0.18.04.1,
+    'libglib2.0-0:i386=2.56.2-0ubuntu0.18.04.1']
+  build-snaps: []
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
new file mode 100644
index 0000000..620436a
--- /dev/null
+++ b/snap/snapcraft.yaml
@@ -0,0 +1,28 @@
+name: cqtdeployer # you probably want to 'snapcraft register <name>'
+version: '1.0.1' # just for humans, typically '1.2+git' or '1.3.2'
+summary: deploy your qt projects # 79 char long summary
+description: |
+  Console app for deploy qt libs.
+  Key differences of this program
+  Performance-this program deploys the application several times faster (up to 10 seconds)
+  Flexibility-this application has flags that will help you configure the deployment as you need and your project
+
+grade: stable # must be 'stable' to release into candidate/stable channels
+confinement: strict # use 'strict' once you have the right plugs and slots
+base: core18
+
+
+apps:
+  cqtdeployer:
+    command: desktop-launch $SNAP/CQtDeployer
+
+    plugs: [classic-support]
+
+parts:
+  cqtdeployer:
+    # See 'snapcraft plugins'
+
+    plugin: dump
+    source: build
+
+    after: [desktop-glib-only]

From e49b34f8a926de08d7570de0e91da3649d32fbda Mon Sep 17 00:00:00 2001
From: EndrII <endriimail@gmail.com>
Date: Sat, 15 Sep 2018 11:49:26 +0300
Subject: [PATCH 2/7] fix staticBuild (check buildet data)

---
 snapBuild.sh   | 34 ++++++++++++++++++++++++++++++++++
 staticBuild.sh | 24 +++++++++++++++++++++---
 2 files changed, 55 insertions(+), 3 deletions(-)
 create mode 100755 snapBuild.sh

diff --git a/snapBuild.sh b/snapBuild.sh
new file mode 100755
index 0000000..b71e276
--- /dev/null
+++ b/snapBuild.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+declare -a QTLIBS
+
+BASE_DIR=$(dirname $0)
+QTLIBS=( libQt5Sql.a libQt5Xml.a libQt5Core.a libQt5Test.a libqtpcre2.a libQt5Network.a libQt5Bootstrap.a libQt5Concurrent.a)  
+
+cd qtBase
+
+for var in "${QTLIBS[@]}"
+do
+	if [ -e "$BASE_DIR/lib/$var" ]
+	then
+	    echo "$var - ok"
+	else
+	    echo "$var - not exits!. rebuild qt ..."
+
+	    git clean -xfd
+	    
+	    ./configure -confirm-license -release -optimize-size -static -no-opengl -no-openssl -opensource -nomake tests -nomake examples -no-gui -no-widgets -no-dbus -no-accessibility
+	    
+	    make -j$(nproc)
+	    break
+	fi
+done
+	
+cd ..
+export PATH=$PATH:/qtBase
+
+./qtBase/bin/qmake CQtDeployer.pro
+
+make -j$(nproc)
+
+strip build/*
diff --git a/staticBuild.sh b/staticBuild.sh
index 918704f..b71e276 100755
--- a/staticBuild.sh
+++ b/staticBuild.sh
@@ -1,11 +1,29 @@
 #!/bin/bash
 
+declare -a QTLIBS
+
+BASE_DIR=$(dirname $0)
+QTLIBS=( libQt5Sql.a libQt5Xml.a libQt5Core.a libQt5Test.a libqtpcre2.a libQt5Network.a libQt5Bootstrap.a libQt5Concurrent.a)  
+
 cd qtBase
-git clean -xfd
 
-./configure -confirm-license -release -optimize-size -static -no-opengl -no-openssl -opensource -nomake tests -nomake examples -no-gui -no-widgets -no-dbus -no-accessibility
+for var in "${QTLIBS[@]}"
+do
+	if [ -e "$BASE_DIR/lib/$var" ]
+	then
+	    echo "$var - ok"
+	else
+	    echo "$var - not exits!. rebuild qt ..."
 
-make -j$(nproc)
+	    git clean -xfd
+	    
+	    ./configure -confirm-license -release -optimize-size -static -no-opengl -no-openssl -opensource -nomake tests -nomake examples -no-gui -no-widgets -no-dbus -no-accessibility
+	    
+	    make -j$(nproc)
+	    break
+	fi
+done
+	
 cd ..
 export PATH=$PATH:/qtBase
 

From d83192ffdb05f1fdf602a8b768141295b7c05f94 Mon Sep 17 00:00:00 2001
From: "a.yankovich" <a.yankovich@rtp.by>
Date: Thu, 20 Sep 2018 16:53:08 +0300
Subject: [PATCH 3/7] added first snap script

---
 CQtDeployer/CQtDeployer.pro |  4 ++++
 snapBuild.sh                | 33 ++++-----------------------------
 2 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/CQtDeployer/CQtDeployer.pro b/CQtDeployer/CQtDeployer.pro
index 8df3c97..f3e3492 100644
--- a/CQtDeployer/CQtDeployer.pro
+++ b/CQtDeployer/CQtDeployer.pro
@@ -34,3 +34,7 @@ HEADERS += \
     deploy.h
 
 QMAKE_LFLAGS += -Wl,-rpath,"'$$DESTDIR'"
+
+DISTFILES += \
+    ../snapBuild.sh \
+    ../staticBuild.sh
diff --git a/snapBuild.sh b/snapBuild.sh
index b71e276..94fb1ea 100755
--- a/snapBuild.sh
+++ b/snapBuild.sh
@@ -1,34 +1,9 @@
 #!/bin/bash
 
-declare -a QTLIBS
-
 BASE_DIR=$(dirname $0)
-QTLIBS=( libQt5Sql.a libQt5Xml.a libQt5Core.a libQt5Test.a libqtpcre2.a libQt5Network.a libQt5Bootstrap.a libQt5Concurrent.a)  
 
-cd qtBase
+echo "clean build dir"
+rm -rfd $BASE_DIR/build
 
-for var in "${QTLIBS[@]}"
-do
-	if [ -e "$BASE_DIR/lib/$var" ]
-	then
-	    echo "$var - ok"
-	else
-	    echo "$var - not exits!. rebuild qt ..."
-
-	    git clean -xfd
-	    
-	    ./configure -confirm-license -release -optimize-size -static -no-opengl -no-openssl -opensource -nomake tests -nomake examples -no-gui -no-widgets -no-dbus -no-accessibility
-	    
-	    make -j$(nproc)
-	    break
-	fi
-done
-	
-cd ..
-export PATH=$PATH:/qtBase
-
-./qtBase/bin/qmake CQtDeployer.pro
-
-make -j$(nproc)
-
-strip build/*
+echo "Start static build"
+$BASE_DIR/staticBuild.sh

From 3ae92eadf4fbb5e4fb6c2fa0d8a607e9c0df997d Mon Sep 17 00:00:00 2001
From: EndrII <EndrIIMail@gmail.com>
Date: Sat, 22 Sep 2018 16:35:20 +0300
Subject: [PATCH 4/7] added snap into project

---
 .buildconfig                | 10 ----------
 .gitignore                  |  4 ++++
 CQtDeployer/CQtDeployer.pro |  3 ++-
 snap/.snapcraft/state       |  6 ------
 snap/snapcraft.yaml         |  2 +-
 snapBuild.sh                |  2 ++
 6 files changed, 9 insertions(+), 18 deletions(-)
 delete mode 100644 .buildconfig
 delete mode 100644 snap/.snapcraft/state

diff --git a/.buildconfig b/.buildconfig
deleted file mode 100644
index 7a633df..0000000
--- a/.buildconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-[default]
-name=Default
-runtime=host
-config-opts=
-run-opts=
-prefix=/home/andrei/.cache/gnome-builder/install/snap/host
-app-id=
-postbuild=
-prebuild=
-default=true
diff --git a/.gitignore b/.gitignore
index 2da21f5..81f4ba7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,3 +46,7 @@ target_wrapper.*
 
 # QtCreator CMake
 CMakeLists.txt.user*
+
+snap/\.snapcraft/
+
+\.buildconfig
diff --git a/CQtDeployer/CQtDeployer.pro b/CQtDeployer/CQtDeployer.pro
index f3e3492..ec44b1a 100644
--- a/CQtDeployer/CQtDeployer.pro
+++ b/CQtDeployer/CQtDeployer.pro
@@ -37,4 +37,5 @@ QMAKE_LFLAGS += -Wl,-rpath,"'$$DESTDIR'"
 
 DISTFILES += \
     ../snapBuild.sh \
-    ../staticBuild.sh
+    ../staticBuild.sh \
+    ../snap/snapcraft.yaml
diff --git a/snap/.snapcraft/state b/snap/.snapcraft/state
deleted file mode 100644
index a15d613..0000000
--- a/snap/.snapcraft/state
+++ /dev/null
@@ -1,6 +0,0 @@
-!GlobalState
-assets:
-  build-packages: [libglib2.0-dev-bin=2.56.2-0ubuntu0.18.04.1, libglib2.0-bin=2.56.2-0ubuntu0.18.04.1,
-    libglib2.0-dev=2.56.2-0ubuntu0.18.04.1, libglib2.0-0=2.56.2-0ubuntu0.18.04.1,
-    'libglib2.0-0:i386=2.56.2-0ubuntu0.18.04.1']
-  build-snaps: []
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 620436a..3004fb9 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -16,7 +16,7 @@ apps:
   cqtdeployer:
     command: desktop-launch $SNAP/CQtDeployer
 
-    plugs: [classic-support]
+    plugs: [home, removable-media]
 
 parts:
   cqtdeployer:
diff --git a/snapBuild.sh b/snapBuild.sh
index 94fb1ea..e034af5 100755
--- a/snapBuild.sh
+++ b/snapBuild.sh
@@ -7,3 +7,5 @@ rm -rfd $BASE_DIR/build
 
 echo "Start static build"
 $BASE_DIR/staticBuild.sh
+
+snapcraft

From 1b5e3ff98fb6cd65b9f3501948aa77b60b99c4f9 Mon Sep 17 00:00:00 2001
From: EndrII <EndrIIMail@gmail.com>
Date: Sat, 22 Sep 2018 16:54:52 +0300
Subject: [PATCH 5/7] strict snap not work

---
 CQtDeployer/main.cpp | 17 ++++++++++++++---
 README.md            |  8 ++++----
 snapBuild.sh         |  2 ++
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/CQtDeployer/main.cpp b/CQtDeployer/main.cpp
index 8a7c463..37c67e6 100644
--- a/CQtDeployer/main.cpp
+++ b/CQtDeployer/main.cpp
@@ -15,7 +15,7 @@
 
 void help() {
     qInfo() << "";
-    qInfo() << "Usage: CDQ <-bin    [params]> [options]";
+    qInfo() << "Usage: cqtdeployer <-bin    [params]> [options]";
     qInfo() << "";
     qInfo() << "Options:";
     qInfo() << "   help / h                 : show help.";
@@ -35,20 +35,31 @@ void help() {
     qInfo() << "   -libDir [list,params]    : set additional path for extralib of app.";
     qInfo() << "                            | for example -libDir ~/myLib,~/newLibs";
     qInfo() << "   -extraPlugin[list,params]: set additional path for extraPlugin of app";
+    qInfo() << "   verbose                  : show debug log";
 
 
     qInfo() << "";
-    qInfo() << "Example: CDQ -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear";
-    qInfo() << "Example (only C libs): CDQ -bin myApp clear";
+    qInfo() << "Example: cqtdeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear";
+    qInfo() << "Example (only C libs): cqtdeployer -bin myApp clear";
 
 }
 
+void verboseLog(const QString& str) {
+    if (QuasarAppUtils::isEndable("verbose")) {
+        qDebug() << str;
+    }
+}
+
 bool parseQt(Deploy& deploy) {
 
     auto bin = QuasarAppUtils::getStrArg("bin");
 
     QFileInfo info(bin);
     if (!info.isFile()) {
+        verboseLog(QDir::homePath());
+        verboseLog(QDir("./").absolutePath());
+
+        verboseLog("bin file is not file path: " + bin);
         return false;
     }
 
diff --git a/README.md b/README.md
index 482cebf..1a3c062 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ Key differences of this program:
 
 ### How to use
 
-#### Usage: CQtDeployer <-bin    [params]> [options]
+#### Usage: cqtdeployer <-bin    [params]> [options]
 
 #### Options:
 | Option                      | Descriptiion                                              |
@@ -39,7 +39,7 @@ Key differences of this program:
 
 
 
-#### Example: CQtDeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear
+#### Example: cqtdeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear
 
 
 
@@ -69,7 +69,7 @@ Console QtDeployer является консольной реализацией
 ##### Данный проект преднозначен для сборки проектов состоящих всего из одного pro файла, если вам необходимо собрать крупный проект то вам нужно воспользоватся нашим [шаблоном](https://quasarapp.github.io/QtDeployTemplate/) для сборки и развертывания qt приложений 
 
 ### Как использовать
-#### пример : CQtDeployer <-bin    [params]> [options]
+#### пример : cqtdeployer <-bin    [params]> [options]
 
 #### Options:
 | Option                      | Descriptiion                                              |
@@ -93,7 +93,7 @@ Console QtDeployer является консольной реализацией
 |  -extraPlugin [list,params] | установить дополнительный путь для extraPlugin приложения |
 
 
-#### Пример: CQtDeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear
+#### Пример: cqtdeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear
 
 ## Build для Linux 
   -  qmake & make или установите qtcreator и соберите проект с qt5.9 или выше.
diff --git a/snapBuild.sh b/snapBuild.sh
index e034af5..773700a 100755
--- a/snapBuild.sh
+++ b/snapBuild.sh
@@ -8,4 +8,6 @@ rm -rfd $BASE_DIR/build
 echo "Start static build"
 $BASE_DIR/staticBuild.sh
 
+snapcraft clean cqtdeployer -s pull
+
 snapcraft

From 5c4fb0eb7f673b08144d8b3355e2f107a0eac253 Mon Sep 17 00:00:00 2001
From: EndrII <EndrIIMail@gmail.com>
Date: Sat, 22 Sep 2018 20:43:29 +0300
Subject: [PATCH 6/7] 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)
 

From 893fcb624e7e3c261f62953e118632b83e694ae6 Mon Sep 17 00:00:00 2001
From: EndrII <EndrIIMail@gmail.com>
Date: Sat, 22 Sep 2018 23:07:27 +0300
Subject: [PATCH 7/7] fix scrypt builds

---
 .gitignore             |  2 ++
 CQtDeployer/deploy.cpp |  2 +-
 sharedBuild.sh         | 18 +++++++-----------
 staticBuild.sh         | 15 +++++----------
 4 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/.gitignore b/.gitignore
index 876a59f..9499cd7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,3 +52,5 @@ snap/\.snapcraft/
 \.buildconfig
 
 sharedQt/
+
+staticQt/
diff --git a/CQtDeployer/deploy.cpp b/CQtDeployer/deploy.cpp
index 018ae75..720e06a 100644
--- a/CQtDeployer/deploy.cpp
+++ b/CQtDeployer/deploy.cpp
@@ -94,7 +94,7 @@ bool Deploy::createRunScript() {
         "export QML2_IMPORT_PATH=$BASEDIR/qml:QML2_IMPORT_PATH\n"
         "export QT_PLUGIN_PATH=$BASEDIR/plugins:QT_PLUGIN_PATH\n"
         "export QT_QPA_PLATFORM_PLUGIN_PATH=$BASEDIR/plugins/platforms:QT_QPA_PLATFORM_PLUGIN_PATH\n"
-        "$BASEDIR/%1 \"$@\"";
+        ".$BASEDIR/%1 \"$@\"";
 
     content = content.arg(QFileInfo(target).fileName());
 
diff --git a/sharedBuild.sh b/sharedBuild.sh
index 724c00d..63ffa24 100755
--- a/sharedBuild.sh
+++ b/sharedBuild.sh
@@ -3,9 +3,11 @@
 declare -a QTLIBS
 
 BASE_DIR=$(dirname "$(readlink -f "$0")")
-
 QTLIBS=( libQt5Sql.so libQt5Xml.so libQt5Core.so libQt5Test.so libQt5Network.so libQt5Concurrent.so)
 
+make clean
+find $BASE_DIR -type f -name 'Makefile' -exec rm {} \;
+
 cd $BASE_DIR/qtBase
 
 for var in "${QTLIBS[@]}"
@@ -16,14 +18,9 @@ do
 	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
@@ -31,19 +28,18 @@ 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/*
+cd $BASE_DIR/build
+
+tar -czvf $BASE_DIR/build/cqtdeployer.tar.gz ./*
+cd $BASE_DIR
 
 rm $BASE_DIR/build/lib -rdf $BASE_DIR/build/*.so* $BASE_DIR/build/*.sh*
diff --git a/staticBuild.sh b/staticBuild.sh
index d47512e..901635d 100755
--- a/staticBuild.sh
+++ b/staticBuild.sh
@@ -3,11 +3,11 @@
 declare -a QTLIBS
 
 BASE_DIR=$(dirname "$(readlink -f "$0")")
-
-QTLIBS=( libQt5Sql.a libQt5Xml.a libQt5Core.a libQt5Test.a libqtpcre2.a libQt5Network.a libQt5Bootstrap.a libQt5Concurrent.a)  
-
+QTLIBS=( libQt5Sql.a libQt5Xml.a libQt5Core.a libQt5Test.a libQt5Network.a libQt5Bootstrap.a libQt5Concurrent.a)
 echo "base dir $BASE_DIR"
 
+make clean
+find $BASE_DIR -type f -name 'Makefile' -exec rm {} \;
 cd $BASE_DIR/qtBase
 
 for var in "${QTLIBS[@]}"
@@ -17,13 +17,9 @@ do
 	    echo "$var - ok"
 	else
 	    echo "$var - not exits!. rebuild qt ..."
-
             rm -rdf $BASE_DIR/staticQt
-
-            git clean -xdf
-	    
-            ./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
-	    
+            git clean -xdf    
+            ./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 install -j$(nproc)
 	    break
 	fi
@@ -33,7 +29,6 @@ cd ..
 rm -rdf $BASE_DIR/build
 
 export PATH=$PATH:$BASE_DIR/staticQt
-
 $BASE_DIR/staticQt/bin/qmake CQtDeployer.pro
 
 make -j$(nproc)