Skip to content

Commit

Permalink
Merge pull request #136 from code-mancers/deployment
Browse files Browse the repository at this point in the history
Deployment
  • Loading branch information
iffyuva committed Jan 8, 2015
2 parents b07f897 + 9bd8b73 commit d416b6b
Show file tree
Hide file tree
Showing 8 changed files with 347 additions and 8 deletions.
1 change: 1 addition & 0 deletions RbkitClient.pro
Expand Up @@ -14,3 +14,4 @@ SUBDIRS = \

CONFIG += ordered
CONFIG += c++11
CONFIG += static
1 change: 1 addition & 0 deletions rbkit-app/rbkit-app.pro
Expand Up @@ -8,6 +8,7 @@ TEMPLATE = app
SOURCES += main.cpp

CONFIG += c++11
CONFIG += static
ICON = rbkit.icns

# Include rbkit related include and lib paths
Expand Down
4 changes: 2 additions & 2 deletions rbkit-lib/ui/aboutdialog.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>504</width>
<height>197</height>
<height>211</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -91,7 +91,7 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://www.codemancers.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;http://www.codemancers.com&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://rbkit.codemancers.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;http://rbkit.codemancers.com&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
Expand Down
16 changes: 10 additions & 6 deletions rbkit-lib/ui/diffviewform.cpp
Expand Up @@ -4,23 +4,24 @@
#include "parentviewform.h"
#include "model/heap_item_types/baseheapitem.h"
#include <QStatusBar>
#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;
}
}
Expand All @@ -31,7 +32,7 @@ void DiffViewForm::treeNodeSelected(const QModelIndex &index)
RBKit::BaseHeapItem *nodeItem = static_cast<RBKit::BaseHeapItem *>(sourceIndex.internalPointer());
if (nodeItem != NULL) {
parentWindow->statusBar()->showMessage(nodeItem->leadingIdentifier());
if (parentViewForm == 0) {
if (!parentViewForm) {
initializeParentView();
}
updateParentView(nodeItem);
Expand Down Expand Up @@ -59,6 +60,9 @@ void DiffViewForm::initializeParentView()

void DiffViewForm::setSnapshotDiffNumbers(QList<int> selectedSnapshots)
{
diffLabel = new QLabel(QString("<b> Showing Comparison of Snapshot#%0-Snapshot#%1</b>").arg(selectedSnapshots.at(1)).arg(selectedSnapshots.at(0)));
diffLabel = new QLabel(QString("<b> Showing Comparison of %0-%1</b>")
.arg(RBKit::AppState::getInstance()->getSnapshotName(selectedSnapshots.at(1)))
.arg(RBKit::AppState::getInstance()->getSnapshotName(selectedSnapshots.at(0))));

ui->treeVerticalLayout->insertWidget(0, diffLabel);
}
28 changes: 28 additions & 0 deletions 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.
90 changes: 90 additions & 0 deletions 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

0 comments on commit d416b6b

Please sign in to comment.