-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from code-mancers/deployment
Deployment
- Loading branch information
Showing
8 changed files
with
347 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ SUBDIRS = \ | |
|
||
CONFIG += ordered | ||
CONFIG += c++11 | ||
CONFIG += static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.