aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-03-19 17:52:44 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-03-19 17:52:44 +0100
commit3897ff83b6848e4169f1641b1132714870f01801 (patch)
tree5afcddd6543ceb0109db77156a6d9d452689c0a1
parentAdded build script (diff)
downloadsmolbote-3897ff83b6848e4169f1641b1132714870f01801.tar.xz
Updated BUILDING.md
mach script can now build tarballs
-rw-r--r--BUILDING.md51
-rwxr-xr-xmach19
-rw-r--r--smolbote.qbs28
-rw-r--r--src/browser.cpp9
-rw-r--r--src/browser.h6
-rw-r--r--src/main.cpp7
-rw-r--r--src/mainwindow.cpp11
7 files changed, 89 insertions, 42 deletions
diff --git a/BUILDING.md b/BUILDING.md
index 2af8d4b..8118420 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -14,73 +14,74 @@ qbs setup-qt /usr/bin/qmake-qt5 qt5
For more information on qbs, refer to the [Qbs manual][1], sections Configuring
and Managing Qt versions.
-### Steps
+### Compiling
* Create a build folder
```
-[smolbote repo]$ mkdir build
+[smolbote repo]$ mkdir ../build
```
* Run qbs
```
-[smolbote repo]$ qbs build --build-directory build profile:qt5 release
+[smolbote repo]$ qbs build -d ../build profile:qt5 release
```
-Shortened:
-```
-[smolbote repo]$ qbs build -d build profile:qt5 release
-```
-This installs the files to build/release/install-root.
+This installs the files to ../build/release/install-root.
-* Test run using the specified Qt profile (optional)
+* Test run (optional)
```
-[smolbote repo]$ qbs run --build-directory build --file src/smolbote.qbs --products poi profile:qt5 release
+[smolbote repo]$ qbs run -d ../build -p poi profile:qt5 release
```
-Shortened:
+
+### Installing
+* With qbs
```
-[smolbote repo]$ qbs run -d build -f src/smolbote.qbs -p poi profile:qt5 release
+[smolbote repo]$ sudo qbs install -d build --no-build --install-root /usr/local --settings-dir /home/usr/.config/QtProject/qbs/1.7.1 profile:qt5 release"
```
### Notes
* Windows: MSVC compiler is required because of QtWebEngine dependency
* Windows: Passing the -v or -h parameters creates a dialog box instead of
writing the output to stdout. This is Qt behaviour.
+* Windows: Use windeployqt.exe to collect the libraries
+```
+QT_DIR\QT_VER\msvc2015_64\windeployqt.exe build-PROFILE\release\qtbrowser.exe
+```
* grsecurity: You may need to exception qbs.
## Packaging
### Tarball
-Creating a tarball:
+* Creating a tarball:
```
-tar -I "lzip -9" -cf build.tar.lz release-folder/*
+tar -I"lzip -9" -cf smolbote-$(git describe --tags).tar.lz --directory=../build/release/install-root . --owner=user:1000 --group=users:1000
```
-Signing a tarball:
+* Signing a tarball:
```
-gpg -u $FINGERPRINT -b $FILENAME
+gpg -u $email -b --armor $tarball
```
-u, --local-user name
> Use name as the user ID to sign. This option is silently ignored for the list
commands, so that it can be used in an options file.
-
-b, --detach-sign
> Make a detached signature.
+--armor
+> Create a human-readable signature
-Creating checksum:
+* Verify signature:
```
-sha512sum --binary build.tar.lz > checksum.sha512
+gpg --verify $signature $tarball
```
-Verifying checksum:
+* Creating checksum:
```
-sha512sum --check checksum.sha512
+sha512sum --binary $tarball* > $tarball.sha512
```
-### Windows
-Collect the required libraries using
-
+* Verifying checksum:
```
-QT_DIR\QT_VER\msvc2015_64\windeployqt.exe build-PROFILE\release\qtbrowser.exe
+sha512sum --check $tarball.sha512
```
[1]: https://doc.qt.io/qbs/index.html
diff --git a/mach b/mach
index c99c47a..ce94972 100755
--- a/mach
+++ b/mach
@@ -7,7 +7,8 @@ options = {
:settings => "#{ENV['HOME']}/.config/QtProject/qbs/1.7.1",
:profile => 'qt5',
:buildDir => '../build',
- :installDir => '/usr/local'
+ :installDir => '/usr/local',
+ :email => 'xian.nox@gmail.com'
}
OptionParser.new do |opts|
@@ -16,7 +17,7 @@ OptionParser.new do |opts|
opts.on("-h", "--help", "Prints this help") do
puts opts
puts "Options: #{options}"
- puts 'Commands: build, install'
+ puts 'Commands: run, clean, build, install, tarball'
exit
end
@@ -37,10 +38,20 @@ end.parse!
if not ARGV.empty? then
ARGV.each do|arg|
case arg
+ when 'run'
+ system "qbs run -d #{options[:buildDir]} -p poi profile:#{options[:profile]} release"
+ when 'clean'
+ system "qbs clean -d #{options[:buildDir]} profile:#{options[:profile]} release"
when 'build'
- system "qbs build -d #{options[:buildDir]} profile:#{options[:profile]} release"
+ system "qbs build -d #{options[:buildDir]} --force-probe-execution profile:#{options[:profile]} release"
when 'install'
- system "sudo qbs install -d #{options[:buildDir]} --install-root #{options[:installDir]} --settings-dir #{options[:settings]} profile:#{options[:profile]} release"
+ system "sudo qbs install -d #{options[:buildDir]} --no-build --install-root #{options[:installDir]} --settings-dir #{options[:settings]} profile:#{options[:profile]} release"
+ when 'tarball'
+ filename = "smolbote-#{`git describe --tags`}.tar.lz".gsub("\n", '')
+ system "tar -I\"lzip -9\" -cf #{filename} --directory=#{options[:buildDir]}/release/install-root . --owner=user:1000 --group=users:1000"
+ system "gpg -u #{options[:email]} -b #{filename}"
+ system "gpg -u #{options[:email]} -b --armor #{filename}"
+ system "sha512sum --binary #{filename}* > #{filename}.sha512"
else
puts "Unknown argument #{a}; use ./mach -h for more details"
end
diff --git a/smolbote.qbs b/smolbote.qbs
index 5ad9008..829faaa 100644
--- a/smolbote.qbs
+++ b/smolbote.qbs
@@ -25,28 +25,43 @@ Project {
Probe {
id: git
- property string version: "1.0.0"
- property string describe: "1.0.0-0-00000000"
+ property string version: ""
+ property string describe: ""
configure: {
if(project.gitVersion) {
var meta = GitRepo.read(project.sourceDirectory);
version = meta.version;
describe = meta.describe;
+ found = true;
}
- found = true;
}
}
+ // global includes
cpp.includePaths: ['src', 'src/3rd-party']
+ // global defines
cpp.defines: {
if(project.deprecatedWarnings)
defines.push("QT_DEPRECATED_WARNINGS", "QT_DISABLE_DEPRECATED_BEFORE="+project.deprecatedBefore);
- if(git.found)
- defines.push('VERSION="'+git.version+'"', 'DESCRIBE="'+git.describe+'"');
return defines;
}
+
Depends { name: "Qt"; submodules: ["core", "widgets", "webengine", "webenginewidgets"] }
+ Group {
+ name: "main"
+ files: [
+ "src/browser.cpp",
+ "src/browser.h",
+ "src/main.cpp"
+ ]
+ cpp.defines: {
+ if(git.found)
+ defines.push('GIT_VERSION="'+git.version+'"', 'GIT_DESCRIBE="'+git.describe+'"');
+ return defines;
+ }
+ }
+
files: [
"data/resources.qrc",
"src/blocker/blockermanager.cpp",
@@ -59,8 +74,6 @@ Project {
"src/blocker/regexp.h",
"src/blocker/subscriptiondialog.ui",
"src/blocker/subscriptionform.ui",
- "src/browser.cpp",
- "src/browser.h",
"src/forms/bookmarksdialog.cpp",
"src/forms/bookmarksdialog.h",
"src/forms/bookmarksdialog.ui",
@@ -70,7 +83,6 @@ Project {
"src/forms/profiledialog.cpp",
"src/forms/profiledialog.h",
"src/forms/profiledialog.ui",
- "src/main.cpp",
"src/mainwindow.cpp",
"src/mainwindow.h",
"src/mainwindow.ui",
diff --git a/src/browser.cpp b/src/browser.cpp
index 41c6355..2c7115d 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -42,6 +42,15 @@ Browser::~Browser()
delete m_downloadManager;
}
+QString Browser::applicationLongVersion() const
+{
+#ifdef GIT_DESCRIBE
+ return QString(GIT_DESCRIBE);
+#else
+ return applicationVersion();
+#endif
+}
+
/*!
* Check if the settings are empty
*/
diff --git a/src/browser.h b/src/browser.h
index aa7c605..a6820c8 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -29,6 +29,10 @@
#include "settings.h"
#include <QNetworkAccessManager>
+#ifdef qApp
+#undef qApp
+#define qApp Browser::instance()
+#endif
#define sSettings Browser::instance()->settings()
#define sNetwork Browser::instance()->network()
@@ -41,6 +45,8 @@ public:
Browser(int &argc, char *argv[]);
~Browser();
+ QString applicationLongVersion() const;
+
void firstRun();
bool preLaunch(QStringList urls);
diff --git a/src/main.cpp b/src/main.cpp
index b787caf..a99e5de 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,9 +26,12 @@
int main(int argc, char *argv[])
{
Browser app(argc, argv);
-#ifdef VERSION
- app.setApplicationVersion(VERSION);
+#ifdef GIT_VERSION
+ app.setApplicationVersion(GIT_VERSION);
+#else
+ app.setApplicationVersion("1.0.0");
#endif
+
app.setWindowIcon(QIcon(QLatin1String(":/icon.svg")));
QCommandLineParser parser;
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 087c5f8..bab0520 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -155,13 +155,18 @@ void MainWindow::closeEvent(QCloseEvent *event)
void MainWindow::about()
{
- QMessageBox::about(this, tr("About"), tr("<h3>smolbote %1</h3>"
+ QMessageBox::about(this, tr("About"), tr("<h2>smolbote %1</h2>"
"<p><i>yet another Qute browser</i></p>"
"<p>Copyright (C) 2017 Xian Nox</p>"
"<p>This program comes with ABSOLUTELY NO WARRANTY. "
"This is free software, and you are welcome to redistribute it under the conditions set by the GNU GPLv3.</p>"
- "<p>Configuration lives in: %2</p>")
- .arg(DESCRIBE).arg(sSettings->filePath()));
+ "<p>"
+ "Version: %2<br>"
+ "Configuration: %3"
+ "</p>")
+ .arg(qApp->applicationVersion())
+ .arg(qApp->applicationLongVersion())
+ .arg(sSettings->filePath()));
}
void MainWindow::loadProfile(const QString &name)