diff --git a/RbkitClient.pro b/RbkitClient.pro index e1f5770..50d16af 100644 --- a/RbkitClient.pro +++ b/RbkitClient.pro @@ -14,3 +14,4 @@ SUBDIRS = \ CONFIG += ordered CONFIG += c++11 +CONFIG += static diff --git a/rbkit-app/rbkit-app.pro b/rbkit-app/rbkit-app.pro index 297f389..23e42d3 100644 --- a/rbkit-app/rbkit-app.pro +++ b/rbkit-app/rbkit-app.pro @@ -8,6 +8,7 @@ TEMPLATE = app SOURCES += main.cpp CONFIG += c++11 +CONFIG += static ICON = rbkit.icns # Include rbkit related include and lib paths diff --git a/rbkit-lib/ui/aboutdialog.ui b/rbkit-lib/ui/aboutdialog.ui index 42f1d87..1ac3f4b 100644 --- a/rbkit-lib/ui/aboutdialog.ui +++ b/rbkit-lib/ui/aboutdialog.ui @@ -7,7 +7,7 @@ 0 0 504 - 197 + 211 @@ -91,7 +91,7 @@ - <html><head/><body><p><a href="http://www.codemancers.com"><span style=" text-decoration: underline; color:#0057ae;">http://www.codemancers.com</span></a></p></body></html> + <html><head/><body><p><a href="http://rbkit.codemancers.com"><span style=" text-decoration: underline; color:#0057ae;">http://rbkit.codemancers.com</span></a></p></body></html> true diff --git a/rbkit-lib/ui/diffviewform.cpp b/rbkit-lib/ui/diffviewform.cpp index 76e1eea..4358324 100644 --- a/rbkit-lib/ui/diffviewform.cpp +++ b/rbkit-lib/ui/diffviewform.cpp @@ -4,23 +4,24 @@ #include "parentviewform.h" #include "model/heap_item_types/baseheapitem.h" #include +#include "model/appstate.h" DiffViewForm::DiffViewForm(QWidget* parent, int _snapShotVersion) - : HeapDumpForm(parent, _snapShotVersion), parentViewForm(0) + : HeapDumpForm(parent, _snapShotVersion), parentViewForm(nullptr), parentLabel(nullptr), diffLabel(nullptr) { } DiffViewForm::~DiffViewForm() { - if (parentViewForm != NULL) { + if (parentViewForm) { delete parentViewForm; } - if (parentLabel != NULL) { + if (parentLabel) { delete parentLabel; } - if (diffLabel != NULL) { + if (diffLabel) { delete diffLabel; } } @@ -31,7 +32,7 @@ void DiffViewForm::treeNodeSelected(const QModelIndex &index) RBKit::BaseHeapItem *nodeItem = static_cast(sourceIndex.internalPointer()); if (nodeItem != NULL) { parentWindow->statusBar()->showMessage(nodeItem->leadingIdentifier()); - if (parentViewForm == 0) { + if (!parentViewForm) { initializeParentView(); } updateParentView(nodeItem); @@ -59,6 +60,9 @@ void DiffViewForm::initializeParentView() void DiffViewForm::setSnapshotDiffNumbers(QList selectedSnapshots) { - diffLabel = new QLabel(QString(" Showing Comparison of Snapshot#%0-Snapshot#%1").arg(selectedSnapshots.at(1)).arg(selectedSnapshots.at(0))); + diffLabel = new QLabel(QString(" Showing Comparison of %0-%1") + .arg(RBKit::AppState::getInstance()->getSnapshotName(selectedSnapshots.at(1))) + .arg(RBKit::AppState::getInstance()->getSnapshotName(selectedSnapshots.at(0)))); + ui->treeVerticalLayout->insertWidget(0, diffLabel); } diff --git a/tools/deploy.md b/tools/deploy.md new file mode 100644 index 0000000..c2cc51d --- /dev/null +++ b/tools/deploy.md @@ -0,0 +1,28 @@ +## Making Linux builds + +### Background Information + +The key thing is, to run the deploy script which should copy +dependencies of application itself to lib folder, but we are still +left with the dependencies of `libqxcb.so` and those can be checked +via `ldd -r -d libqxcb.so`. + +What I found was libQDBUS was missing from the list of libraries being +copied and hence that must be copied for making the deployment work. + +More information can be found on, https://qt-project.org/forums/viewthread/38695 + +### Using Ruby script here to make a linux build + +First navigate to the directory where local binary has been built. In many cases it +would be somewhere - `$HOME/build-RbkitClient-Desktop-xxx` or whatever is your location +of shadow build. + +1. Go to `rbit-app` folder of shadow build directory and check if you have `RbkitClient` executable present. +2. Once there, specify using script here to make a build: + +``` +~/nomads/rbkit-client/tools/deployqt.rb RbkitClient +``` + +This should give us a `rbkit.tar.gz` which can be now deployed on any Linux. diff --git a/tools/deployqt.rb b/tools/deployqt.rb new file mode 100755 index 0000000..22bca2c --- /dev/null +++ b/tools/deployqt.rb @@ -0,0 +1,90 @@ +#!/usr/bin/env ruby + +require "fileutils" +require "pry" + +class DeployQt + attr_accessor :qt_home, :executable, :dst + def initialize(executable) + @pwd = ENV["PWD"] + @executable = File.expand_path(File.join(@pwd, executable)) + @qt_home = "#{ENV['QT_HOME']}/5.4/gcc_64" + @dst = File.expand_path(File.join(@pwd, "/rbkit")) + remove_existing_files + @platform_plugin = File.expand_path(File.join(@qt_home, "/plugins/platforms/libqxcb.so")) + @sql_driver_path = File.expand_path(File.join(@qt_home, "/plugins/sqldrivers/libqsqlite.so")) + FileUtils.mkdir_p(@dst) + make_required_dirs + end + + def make_required_dirs + FileUtils.mkdir_p("#{dst}/fonts") + FileUtils.mkdir_p("#{dst}/libs") + FileUtils.mkdir_p("#{dst}/platforms") + FileUtils.mkdir_p("#{dst}/sqldrivers") + end + + def remove_existing_files + FileUtils.rm_rf(dst) + FileUtils.rm_rf("rbkit.tar.gz") + end + + def create_archive + copy_app_libs + copy_lib_dependencies + copy_sql_dependencies + make_executable + create_tar_file + end + + def create_tar_file + FileUtils.cd(@pwd) do + system("tar -zcvf rbkit.tar.gz rbkit") + end + end + + def copy_sql_dependencies + FileUtils.cp(@sql_driver_path, "#{dst}/sqldrivers") + end + + def copy_app_libs + puts "Copying application dependencies for #{executable}" + `ldd #{executable}`.tap do |deps| + deps_array = deps.split("\n") + deps_array.each { |deps_element| verify_and_copy(deps_element) } + end + end + + def copy_lib_dependencies + FileUtils.cp(@platform_plugin, "#{dst}/platforms") + `ldd #{@platform_plugin}`.tap do |deps| + deps_array = deps.split("\n") + deps_array.each { |deps_element| verify_and_copy(deps_element) } + end + end + + def make_executable + exec_string =<<-EOD +#!/bin/sh +export LD_LIBRARY_PATH=\`pwd\`/libs +export QT_QPA_FONTDIR=\`pwd\`/fonts +./#{File.basename(executable)} + EOD + FileUtils.cp(executable, dst) + File.open("#{dst}/rbkit", "w") do |fl| + fl.puts(exec_string) + end + system("chmod +x #{dst}/rbkit") + end + + private + + def verify_and_copy(deps_element) + dep_path = deps_element.split("=>").last.split("(").first.strip + if !dep_path.empty? && dep_path.match(/^#{ENV['HOME']}/) + FileUtils.cp(File.expand_path(dep_path), "#{dst}/libs") + end + end +end + +DeployQt.new(ARGV[0]).create_archive diff --git a/tools/deployqtapp.sh b/tools/deployqtapp.sh new file mode 100755 index 0000000..bb18626 --- /dev/null +++ b/tools/deployqtapp.sh @@ -0,0 +1,209 @@ +#!/bin/bash + +#================================================================================ +# Copyright (c) 2012 - 2013 by William Hallatt. +# +# This script is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# This script is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this script (GNUGPL.txt). If not, see +# +# +# +# Should you wish to contact me for whatever reason, please do so via: +# +# +# +#================================================================================ + +# Copy your executable as well as this script to the directory where you +# want to create the final tar ball. To execute, simply pass the name of the +# executable as command line parameter to this script. +# +# Worth noting is that I built Qt from source myself, you may or may not need +# additional plugins, etc and different or additional directory structures and +# will have to edit this script to suit your needs! + +if [ $# -ne 1 ] +then + echo "Usage: $0 " + exit 1 +fi + +executable=$1 + +# Obtain the Linux flavour and version. +distro=`lsb_release -d | awk '{print $2$3$4}' | sed 's/\./_/g'` + +# Create the directory that will be tarred up for distribution. +tardir="rbkit" +mkdir $tardir +echo "Created tar ball directory: "$tardir + +# Copy executable across. +chmod u+x $executable +cp $executable $tardir +echo "Copied executable "$executable" to "$tardir + +# Create the libs directory. +libsdir=$PWD/$tardir/libs +mkdir $libsdir +echo "Created libs directory: "$libsdir + +# Copy all dependencies across to the tar directory. +echo "Copying dependencies..." + +for dep in `ldd ./$executable | awk '{print $3}' | grep -v "("` +do + cp $dep $libsdir + echo "Copied dependency "$dep" to "$libsdir +done + +# Create the fonts directory and copy fonts across. You +# will obviously need to assign the directory path leading +# to your fonts to "fontdir", e.g. /home/you/qt/lib/fonts +qtfontsdir=$QT_HOME/5.4/gcc_64/lib/fonts +fontsdir=$PWD/$tardir/fonts +mkdir $fontsdir +echo "Created fonts directory: "$fontsdir" copying fonts..." +cp -r $qtfontsdir/* $fontsdir + +# You will need to change this to point to wherever libqxcb.so lives on your PC. +qtplatformplugin=$QT_HOME/5.4/gcc_64/plugins/platforms/libqxcb.so +for dep in `ldd $qtplatformplugin | awk '{print $3}' | grep -v "("` +do + cp $dep $libsdir + echo "Copied dependency "$dep" to "$libsdir +done + +qtplatformplugindir=$tardir/platforms +mkdir $qtplatformplugindir +echo "Created platforms directory: "$qtplatformplugindir +cp $qtplatformplugin $qtplatformplugindir +echo "Copied platform "$qtplatformplugin" to "$qtplatformplugindir + +# Create the script to fix xcb dependencies. +fixscript=$qtplatformplugindir/fixdep.sh +echo "Creating fixdep script: "$fixscript + +echo "#!/bin/sh" >> $fixscript +echo "" >> $fixscript +echo "#================================================================================" >> $fixscript +echo "# Copyright (c) 2012 - 2013 by William Hallatt." >> $fixscript +echo "#" >> $fixscript +echo "# This script is free software: you can redistribute it and/or modify it under" >> $fixscript +echo "# the terms of the GNU General Public License as published by the Free Software" >> $fixscript +echo "# Foundation, either version 3 of the License, or (at your option) any later" >> $fixscript +echo "# version." >> $fixscript +echo "#" >> $fixscript +echo "# This script is distributed in the hope that it will be useful, but WITHOUT" >> $fixscript +echo "# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS" >> $fixscript +echo "# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details." >> $fixscript +echo "#" >> $fixscript +echo "# You should have received a copy of the GNU General Public License along with" >> $fixscript +echo "# this script (GNUGPL.txt). If not, see" >> $fixscript +echo "#" >> $fixscript +echo "# " >> $fixscript +echo "#" >> $fixscript +echo "# Should you wish to contact me for whatever reason, please do so via:" >> $fixscript +echo "#" >> $fixscript +echo "# " >> $fixscript +echo "#" >> $fixscript +echo "#================================================================================" >> $fixscript +echo "" >> $fixscript +echo "# This script will install all \"not found\" dependencies for ALL libraries " >> $fixscript +echo "# that exist within the directory from where it is executed. " >> $fixscript +echo "" >> $fixscript +echo "# All of the packages thus installed can be removed through running the generated " >> $fixscript +echo "# \"removedep.sh\" script if you wish to undo these changes." >> $fixscript +echo "" >> $fixscript +echo "removescript=removedep.sh" >> $fixscript +echo "> \$removescript" >> $fixscript +echo "echo \"#!/bin/sh\" >> \$removescript" >> $fixscript +echo "" >> $fixscript +echo "# For each library in this directory..." >> $fixscript +echo "for lib in \`ls -F | grep -v @ | grep *.so\`" >> $fixscript +echo "do" >> $fixscript +echo " # Determine the dependencies, find only those that are not on the system, exclude all Qt5 libraries," >> $fixscript +echo " # print the name of the library (not full path) and extract the package name from the .so name itself." >> $fixscript +echo " lddquery=\`ldd \$lib | grep -i \"not found\" | grep -i -v qt5 | awk '{print \$1}' | sed 's/\\(^.*\\)\\.so.*\$/\\1/'\`" >> $fixscript +echo " #echo \$lddquery" >> $fixscript +echo "" >> $fixscript +echo " echo \"Installing dependencies for library: \"\$lib" >> $fixscript +echo " #echo \$lib" >> $fixscript +echo "" >> $fixscript +echo " for dep in \$lddquery" >> $fixscript +echo " do" >> $fixscript +echo " echo \"Found dependency: \"\$dep" >> $fixscript +echo "" >> $fixscript +echo " # Query apt-cache for the relevant package, excluding dev and dbg versions." >> $fixscript +echo " packagequery=\`apt-cache search \$dep | grep -v dev | grep -v dbg | awk '{print \$1}'\`" >> $fixscript +echo " echo \"Querying package list for: \"$packagequery" >> $fixscript +echo "" >> $fixscript +echo " sudo apt-get install \$packagequery" >> $fixscript +echo " echo \"Installing: \"\$packagequery" >> $fixscript +echo " echo \"sudo apt-get remove \$packagequery\" >> \$removescript" >> $fixscript +echo " done" >> $fixscript +echo "done" >> $fixscript +echo "" >> $fixscript +echo "chmod u+x \$removescript" >> $fixscript + +chmod u+x $fixscript + +# Edit this script to add whatever other additional plugins your application +# requires. +qtsqliteplugin=$QT_HOME/5.4/gcc_64/plugins/sqldrivers/libqsqlite.so +qtsqliteplugindir=$tardir/sqldrivers +mkdir $qtsqliteplugindir +echo "Created sql driver directory: "$qtsqliteplugindir +cp $qtsqliteplugin $qtsqliteplugindir +echo "Copied "$qtsqliteplugin" to "$qtsqliteplugindir + +# Create the run script. +execscript=$tardir/"rbkit" +echo "Created run script: "$execscript + +echo "#!/bin/sh" > $execscript +echo "export LD_LIBRARY_PATH=\`pwd\`/libs" >> $execscript +echo "export QT_QPA_FONTDIR=\`pwd\`/fonts" >> $execscript +echo "./$executable" >> $execscript + +# Make executable. +chmod u+x $execscript + +# Create a README +echo "Creating README..." + +readme=$tardir/README +echo "================================================================================" >> $readme +echo "Please launch $executable via" >> $readme +echo "" >> $readme +echo " $execscript" >> $readme +echo "" >> $readme +echo "If you run into any trouble regarding dependencies, all you need to do is to" >> $readme +echo "run " >> $readme +echo " $fixscript " >> $readme +echo "" >> $readme +echo "in order to automatically resolve dependencies on your behalf " >> $readme +echo "(note that you will need administrator privileges for this as this script will" >> $readme +echo "download the necessary libraries for your platform). " >> $readme +echo "" >> $readme +echo "Should you wish to contact me for whatever reason, please do so via:" >> $readme +echo "" >> $readme +echo " " >> $readme +echo "" >> $readme +echo "================================================================================" >> $readme + +echo "Creating tarball..." +tar -zcvf $tardir".tar" $tardir + +echo "Cleaning up..." +rm -rf $tardir +echo "Done!" diff --git a/tools/print_dep.sh b/tools/print_dep.sh new file mode 100755 index 0000000..59192a1 --- /dev/null +++ b/tools/print_dep.sh @@ -0,0 +1,6 @@ +executable=$1 +echo $executable +for dep in `ldd $executable | awk '{print $3}' | grep -v "("` +do + echo "Copied dependency "$dep" to "$libsdir +done