4
0
mirror of https://github.com/QuasarApp/Hanoi-Towers.git synced 2025-05-14 18:39:33 +00:00

last snap

This commit is contained in:
Andrei Yankovich 2018-05-08 02:44:57 +03:00
parent 599c5ae9ad
commit 8d330cd923
4 changed files with 18 additions and 279 deletions

2
.gitignore vendored

@ -48,3 +48,5 @@ CMakeLists.txt.user*
snap/plugins/__pycache__/
*.snap
\.buildconfig

@ -1,5 +1,5 @@
[Desktop Entry]
Version=1.3
Version=1.4
Name=Hanoi Towers
Comment=Hanoi Towers Game.
Exec=hanoi-towers
@ -10,5 +10,5 @@ Categories=Games;Application;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=hanoi-towers
X-GNOME-Bugzilla-Component=General
X-GNOME-Bugzilla-Version=1.3
X-GNOME-Bugzilla-Version=1.4
StartupNotify=true

@ -1,198 +0,0 @@
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Author: Marco Trevisan <marco@ubuntu.com>
# Copyright (C) 2017-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program 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 program. If not, see <http://www.gnu.org/licenses/>.
import os
import snapcraft
from snapcraft.plugins import make
class QtBuilderPlugin(make.MakePlugin):
@classmethod
def schema(cls):
schema = super().schema()
schema['properties']['configflags'] = {
'type': 'array',
'minitems': 1,
'uniqueItems': False,
'items': {
'type': 'string',
},
'default': [],
}
schema['properties']['qt-source-git'] = {
'type': 'string'
}
schema['properties']['qt-source-depth'] = {
'type': 'integer',
'default': 1
}
schema['properties']['qt-version'] = {
'type': 'string'
}
schema['properties']['qt-patches-base-url'] = {
'type': 'string'
}
schema['properties']['qt-patches-path'] = {
'type': 'string'
}
schema['properties']['qt-submodules'] = {
'type': 'array',
'minitems': 0,
'uniqueItems': True,
'items': {
'type': 'string',
},
'default': [],
}
schema['properties']['qt-extra-plugins'] = {
'type': 'array',
'minitems': 0,
'uniqueItems': True,
'items': {
'type': 'object',
'minitems': 0,
'uniqueItems': True,
'items': {
'type': 'string',
},
},
'default': [],
}
schema['properties']['environment'] = {
'type': 'array',
'minitems': 0,
'uniqueItems': True,
'items': {
'type': 'object',
'minitems': 0,
'uniqueItems': True,
'items': {
'type': 'string',
},
},
'default': [],
}
schema['required'].append('qt-source-git')
schema['build-properties'].append('configflags')
return schema
@classmethod
def get_pull_properties(cls):
return [
'qt-version',
'qt-patches-base-url',
'qt-patches-path',
'qt-submodules',
'qt-extra-plugins',
]
def __init__(self, name, options, project):
super().__init__(name, options, project)
self.build_packages.extend(['g++', 'patch', 'perl', 'wget'])
self.options.source_depth = self.options.qt_source_depth
if self.options.qt_version:
self.options.source_branch = '.'.join(
self.options.qt_version.split('.')[:-1])
def pull(self):
if not os.path.exists(os.path.join(self.sourcedir, '.git')) or \
not os.path.exists(os.path.join(self.sourcedir, 'init-repository')):
self.run('rm -rf {}'.format(self.sourcedir).split())
command = 'git clone {} {}'.format(
self.options.qt_source_git, self.sourcedir).split()
if self.options.source_branch:
command.extend(['--branch', str(self.options.source_branch)])
if self.options.source_depth:
command.extend(['--depth', str(self.options.source_depth)])
self.run(command)
command = 'perl init-repository --branch -f'.split()
if len(self.options.qt_submodules):
command.extend('--module-subset={}'.format(
','.join(self.options.qt_submodules)).split())
self.run(command, cwd=self.sourcedir)
if self.options.qt_version:
self.run("git submodule foreach git checkout v{}".format(
self.options.qt_version).split(), self.sourcedir)
patch_file_template = '${{name}}{}.diff'.format(
'_' + self.options.qt_version.replace('.', '_') \
if self.options.qt_version else '')
if self.options.qt_patches_base_url:
patch_uri_template = '{}/{}'.format(
self.options.qt_patches_base_url, patch_file_template)
patch_cmd = 'git submodule foreach -q'.split() + \
['[ -e {touch_file} ] || ' \
'wget -q -O - {patch_uri_template} | patch -p1 && ' \
'touch {touch_file}'.format(
patch_uri_template=patch_uri_template,
touch_file='.snapcraft-qt-patched')]
self.run(patch_cmd, cwd=self.sourcedir)
if self.options.qt_patches_path:
patch_path_template = os.path.join(
os.getcwd(), self.options.qt_patches_path, patch_file_template)
patch_cmd = 'git submodule foreach -q'.split() + \
['[ -e {patch} ] && git apply -v3 {patch} || true'.format(
patch=patch_path_template)]
self.run(patch_cmd, cwd=self.sourcedir)
for extra_plugin in self.options.qt_extra_plugins:
[framework] = list(extra_plugin)
final_path = os.path.join(self.sourcedir, 'qtbase', 'src',
'plugins', framework)
for repo in extra_plugin[framework]:
repo_path = os.path.basename(repo)
if repo_path.endswith('.git'):
repo_path = repo_path[:-4]
if not os.path.exists(os.path.join(final_path, repo_path)):
command = 'git clone {}'.format(repo).split()
self.run(command, cwd=final_path)
def build(self):
env = {}
for environ in self.options.environment:
[env_name] = list(environ)
env[env_name] = str(environ[env_name])
self.run(['./configure'] + self.options.configflags, env=env)
super().build()

@ -1,4 +1,4 @@
name: hanoi-towers
name: hanoi-towers-new
version: '1.4'
summary: Hanoi Towers Game
description: |
@ -11,7 +11,7 @@ icon: source/res/icon.png
apps:
hanoi-towers:
command: bin/hanoi-towers
command: qt5-launch hanoi-towers
# desktop: usr/share/applications/desc.desktop
plugs: [desktop, unity7, home, opengl, x11, wayland]
@ -20,83 +20,18 @@ parts:
hanoi-towers:
plugin: qmake
source: source/
organize:
opt/hanoi-towers/bin: bin
build-packages:
- qtbase5-dev
- qtdeclarative5-dev
stage-packages:
- libc6
after:
- qt
qt:
plugin: qtbuilder
qt-version: 5.10.1
qt-source-git: https://code.qt.io/qt/qt5.git
qt-submodules: ['qtbase', 'qtimageformats', 'qtsvg', 'qtquickcontrols', 'qtquickcontrols2', 'qtdeclarative']
environment:
- CC: gcc-7
- CXX: g++-7
- QMAKE_CC: gcc-7
- QMAKE_CXX: g++-7
build-packages:
- libasound2-dev
- libdbusmenu-glib-dev
- libffi-dev
- liblzma-dev
- libpulse-dev
- libssl-dev
- libx11-xcb-dev
- libxcb-icccm4-dev
- libxcb-image0-dev
- libxcb-keysyms1-dev
- libxcb-randr0-dev
- libxcb-render-util0-dev
- libxcb-sync-dev
- libxcb-util0-dev
- libxcb-xfixes0-dev
- libxcb1-dev
- libxrender-dev
configflags:
- -prefix
- $SNAPCRAFT_STAGE
- -release
- -force-debug-info
- -opensource
- -confirm-license
- -qt-zlib
- -qt-libpng
- -qt-libjpeg
- -qt-freetype
- -qt-harfbuzz
- -qt-pcre
- -qt-xcb
- -qt-xkbcommon-x11
- -no-opengl
- -static
- -dbus-runtime
- -openssl-linked
- -nomake
- examples
- -nomake
- tests
after:
- gcc7
# Here for the plugins-- they're not linked in automatically.
- libqt5gui5
- libqt5qml5
- libqt5quick5
- qml-module-qtquick2
- qml-module-qtquick-dialogs
- qml-module-qtquick-controls
- qml-module-qtgraphicaleffects
after: [qt5conf] # A wiki part
gcc7:
plugin: nil
build-packages:
- libmpc-dev
- libcloog-ppl-dev
prepare: |
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main" | \
sudo tee /etc/apt/sources.list.d/ubuntu-toolchain-r.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60C317803A41BA51845E371A1E9377A2BA9EF27F
sudo apt-get update \
-o Dir::Etc::sourcelist="sources.list.d/ubuntu-toolchain-r.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
install: |
sudo apt install gcc-7 g++-7 -o Debug::pkgProblemResolver=yes --no-install-recommends -y
sudo apt-mark auto gcc-7 g++-7
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r.list
prime: [-./*]