Add snap build scripts

This commit is contained in:
Simon Stürz 2018-10-17 17:17:28 +02:00
parent 8895221526
commit f44657450d
6 changed files with 1154 additions and 0 deletions

7
.gitignore vendored
View File

@ -1,3 +1,10 @@
*.pro.user
*.autosave
# QtCtreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCtreator CMake
CMakeLists.txt.user*
.crossbuilder

602
snap/gui/icon.svg Normal file
View File

@ -0,0 +1,602 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="500"
height="500"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="guh-logo.svg"
inkscape:export-filename="/home/timon/guh/guh/guh/icons/guh-logo-512x512.png"
inkscape:export-xdpi="92.160004"
inkscape:export-ydpi="92.160004">
<defs
id="defs4">
<linearGradient
id="SVGID_1_"
gradientUnits="userSpaceOnUse"
x1="369.02579"
y1="171.88429"
x2="441.68719"
y2="262.58051">
<stop
offset="0.1296"
style="stop-color:#7CC099"
id="stop46" />
<stop
offset="0.3785"
style="stop-color:#6FB594"
id="stop48" />
<stop
offset="0.835"
style="stop-color:#4E9688"
id="stop50" />
<stop
offset="1"
style="stop-color:#408A83"
id="stop52" />
</linearGradient>
<linearGradient
id="SVGID_2_"
gradientUnits="userSpaceOnUse"
x1="936.13898"
y1="154.45329"
x2="918.56207"
y2="154.45329"
gradientTransform="matrix(0.9669,0.2553,-0.2553,0.9669,-399.6603,-163.1002)">
<stop
offset="0"
style="stop-color:#DBE6E0"
id="stop61" />
<stop
offset="1"
style="stop-color:#BCDED3"
id="stop63" />
</linearGradient>
<linearGradient
id="SVGID_3_"
gradientUnits="userSpaceOnUse"
x1="451.01599"
y1="201.9489"
x2="442.73761"
y2="243.37801">
<stop
offset="0"
style="stop-color:#7CC099"
id="stop72" />
<stop
offset="0.2568"
style="stop-color:#78BC98"
id="stop74" />
<stop
offset="0.5165"
style="stop-color:#6CB193"
id="stop76" />
<stop
offset="0.7767"
style="stop-color:#589F8C"
id="stop78" />
<stop
offset="1"
style="stop-color:#408A83"
id="stop80" />
</linearGradient>
<linearGradient
id="SVGID_4_"
gradientUnits="userSpaceOnUse"
x1="457.62369"
y1="234.5722"
x2="457.47629"
y2="234.5722">
<stop
offset="0"
style="stop-color:#DBE6E0"
id="stop87" />
<stop
offset="1"
style="stop-color:#BCDED3"
id="stop89" />
</linearGradient>
<linearGradient
id="SVGID_5_"
gradientUnits="userSpaceOnUse"
x1="467.88159"
y1="223.4929"
x2="457.62369"
y2="223.4929">
<stop
offset="0"
style="stop-color:#DBE6E0"
id="stop96" />
<stop
offset="1"
style="stop-color:#BCDED3"
id="stop98" />
</linearGradient>
<linearGradient
id="SVGID_6_"
gradientUnits="userSpaceOnUse"
x1="457.47629"
y1="235.823"
x2="452.43719"
y2="235.823">
<stop
offset="0"
style="stop-color:#DBE6E0"
id="stop105" />
<stop
offset="1"
style="stop-color:#BCDED3"
id="stop107" />
</linearGradient>
<linearGradient
id="SVGID_7_"
gradientUnits="userSpaceOnUse"
x1="452.19159"
y1="227.27921"
x2="460.47461"
y2="227.27921">
<stop
offset="0"
style="stop-color:#6AA583"
id="stop112" />
<stop
offset="1"
style="stop-color:#4C9E96"
id="stop114" />
</linearGradient>
<linearGradient
id="SVGID_8_"
gradientUnits="userSpaceOnUse"
x1="473.17111"
y1="268.90411"
x2="455.23529"
y2="283.95389"
gradientTransform="matrix(0.9997,0.0227,-0.0227,0.9997,-36.4014,-7.9207)">
<stop
offset="0"
style="stop-color:#7CC099"
id="stop119" />
<stop
offset="1"
style="stop-color:#57BAAE"
id="stop121" />
</linearGradient>
<linearGradient
id="SVGID_9_"
gradientUnits="userSpaceOnUse"
x1="447.13129"
y1="274.66199"
x2="470.95151"
y2="274.66199"
gradientTransform="matrix(0.9997,0.0227,-0.0227,0.9997,-36.4014,-7.9207)">
<stop
offset="0"
style="stop-color:#7CC099"
id="stop126" />
<stop
offset="0.2327"
style="stop-color:#76BA97"
id="stop128" />
<stop
offset="0.5485"
style="stop-color:#65AB90"
id="stop130" />
<stop
offset="0.9106"
style="stop-color:#489186"
id="stop132" />
<stop
offset="1"
style="stop-color:#408A83"
id="stop134" />
</linearGradient>
<linearGradient
id="SVGID_10_"
gradientUnits="userSpaceOnUse"
x1="415.2153"
y1="260.93829"
x2="422.0509"
y2="252.7919">
<stop
offset="0"
style="stop-color:#4C9E96"
id="stop141" />
<stop
offset="0.4859"
style="stop-color:#489790"
id="stop143" />
<stop
offset="1"
style="stop-color:#408A83"
id="stop145" />
</linearGradient>
<linearGradient
id="SVGID_11_"
gradientUnits="userSpaceOnUse"
x1="425.60641"
y1="203.1666"
x2="393.7475"
y2="239.4308">
<stop
offset="0"
style="stop-color:#7CC099"
id="stop152" />
<stop
offset="0.3183"
style="stop-color:#77BF9C"
id="stop154" />
<stop
offset="0.6757"
style="stop-color:#6ABDA3"
id="stop156" />
<stop
offset="1"
style="stop-color:#57BAAE"
id="stop158" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.979899"
inkscape:cx="30.679884"
inkscape:cy="202.52602"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="2880"
inkscape:window-height="1749"
inkscape:window-x="0"
inkscape:window-y="51"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-552.36215)">
<rect
style="fill:#ffffff;fill-opacity:1;stroke:none"
id="rect4243"
width="500"
height="500"
x="0"
y="552.36218" />
<g
transform="matrix(2.2038606,0,0,2.2038606,-672.50331,283.61944)"
id="g41">
<g
id="g43">
<linearGradient
id="linearGradient3548"
gradientUnits="userSpaceOnUse"
x1="369.02579"
y1="171.88429"
x2="441.68719"
y2="262.58051">
<stop
offset="0.1296"
style="stop-color:#7CC099"
id="stop3550" />
<stop
offset="0.3785"
style="stop-color:#6FB594"
id="stop3552" />
<stop
offset="0.835"
style="stop-color:#4E9688"
id="stop3554" />
<stop
offset="1"
style="stop-color:#408A83"
id="stop3556" />
</linearGradient>
<path
style="fill:url(#SVGID_1_)"
inkscape:connector-curvature="0"
d="m 433.7,212.6 c -5.9,-10.1 -19,-17.9 -27.5,-21 -8.5,-3.2 -18,-10.1 -18,-10.1 -7.5,-5 -9.7,-9 -13.7,-14 -1.2,2.6 -2.2,5.8 -3,9.6 1.8,3.1 8.7,13.4 28.1,21.5 1.7,0.7 6.9,2.8 7,2.9 l 6.5,2.6 -6.7,-1.9 c -0.2,-0.1 -5.5,-1.6 -7.3,-2.2 -17.3,-6.3 -25,-15.1 -28,-19.9 -0.8,4.9 -1.1,10.6 -0.7,16.5 5.2,4.7 14,11 26.9,15.4 0.9,0.3 3.6,1.3 3.6,1.3 l 3.4,1.2 -3.5,-0.5 c -0.1,0 -3,-0.4 -4,-0.6 -12.1,-2.9 -20.5,-8.4 -26.1,-13.3 0.5,4.3 1.4,8.6 2.8,13 0.3,1 0.7,2.1 1.1,3 4.4,2 9.6,3.9 15.4,5.2 1.1,0.2 4.3,1.1 4.3,1.1 l 3.8,1 -4,-0.2 c -0.1,0 -3.4,-0.2 -4.5,-0.4 -5.1,-0.7 -9.8,-2 -13.9,-3.6 6.6,13.7 18.8,21.4 35.2,27.5 18.7,7 19.4,25 19.4,25 0,0 5.1,-3.8 9.6,-18.4 5.1,-16.2 -0.3,-30.6 -6.2,-40.7 z"
id="path54" />
</g>
<g
id="g56">
<g
id="g58">
<linearGradient
id="linearGradient3561"
gradientUnits="userSpaceOnUse"
x1="936.13898"
y1="154.45329"
x2="918.56207"
y2="154.45329"
gradientTransform="matrix(0.9669,0.2553,-0.2553,0.9669,-399.6603,-163.1002)">
<stop
offset="0"
style="stop-color:#DBE6E0"
id="stop3563" />
<stop
offset="1"
style="stop-color:#BCDED3"
id="stop3565" />
</linearGradient>
<path
style="fill:url(#SVGID_2_)"
inkscape:connector-curvature="0"
d="m 458.6,233.8 c 4.9,-3.6 6.9,-7.8 8.5,-12.5 0.7,-2.1 1.3,-5 0.3,-8.1 -0.8,-2.5 -6.5,-6.2 -11.2,-4.7 -5.1,1.7 -6.1,8.1 -6.5,10.9 -0.6,4.3 0.4,10.9 2.8,17.6 -0.1,0 2.1,-0.2 6.1,-3.2 z"
id="path65" />
</g>
<g
id="g67">
<g
id="g69">
<linearGradient
id="linearGradient3570"
gradientUnits="userSpaceOnUse"
x1="451.01599"
y1="201.9489"
x2="442.73761"
y2="243.37801">
<stop
offset="0"
style="stop-color:#7CC099"
id="stop3572" />
<stop
offset="0.2568"
style="stop-color:#78BC98"
id="stop3574" />
<stop
offset="0.5165"
style="stop-color:#6CB193"
id="stop3576" />
<stop
offset="0.7767"
style="stop-color:#589F8C"
id="stop3578" />
<stop
offset="1"
style="stop-color:#408A83"
id="stop3580" />
</linearGradient>
<path
style="fill:url(#SVGID_3_)"
inkscape:connector-curvature="0"
d="m 449.7,219.4 c 0.4,-2.8 1.4,-9.2 6.5,-10.9 4.2,-1.4 9.3,1.5 10.8,3.9 -1.5,-3.9 -5.6,-6.6 -9,-8.3 -4.8,-2.5 -10.8,-2.9 -15.7,-1.7 -4.6,1.1 -7,3.6 -10.9,6.9 0.8,1.1 1.6,2.2 2.2,3.3 4.6,8 9,18.6 8.2,30.6 3,-5 9.7,-6.1 10.6,-6.2 -2.4,-6.6 -3.4,-13.3 -2.7,-17.6 z"
id="path82" />
</g>
<g
id="g84">
<linearGradient
id="linearGradient3584"
gradientUnits="userSpaceOnUse"
x1="457.62369"
y1="234.5722"
x2="457.47629"
y2="234.5722">
<stop
offset="0"
style="stop-color:#DBE6E0"
id="stop3586" />
<stop
offset="1"
style="stop-color:#BCDED3"
id="stop3588" />
</linearGradient>
<path
style="fill:url(#SVGID_4_)"
inkscape:connector-curvature="0"
d="m 457.6,234.5 c -0.1,0 -0.1,0.1 -0.1,0.1 0,0 0.1,0 0.1,-0.1 z"
id="path91" />
</g>
<g
id="g93">
<linearGradient
id="linearGradient3592"
gradientUnits="userSpaceOnUse"
x1="467.88159"
y1="223.4929"
x2="457.62369"
y2="223.4929">
<stop
offset="0"
style="stop-color:#DBE6E0"
id="stop3594" />
<stop
offset="1"
style="stop-color:#BCDED3"
id="stop3596" />
</linearGradient>
<path
style="fill:url(#SVGID_5_)"
inkscape:connector-curvature="0"
d="m 467.4,213.2 c -0.1,-0.2 -0.2,-0.5 -0.4,-0.8 0.7,1.7 0.8,3.7 0.1,5.9 -1.5,4.9 -1.8,7.1 -6.1,12.9 -1,1.3 -2.2,2.4 -3.4,3.2 0.3,-0.2 0.6,-0.4 1,-0.7 4.9,-3.6 6.9,-7.8 8.5,-12.5 0.7,-2 1.2,-4.9 0.3,-8 z"
id="path100" />
</g>
<g
id="g102">
<linearGradient
id="linearGradient3600"
gradientUnits="userSpaceOnUse"
x1="457.47629"
y1="235.823"
x2="452.43719"
y2="235.823">
<stop
offset="0"
style="stop-color:#DBE6E0"
id="stop3602" />
<stop
offset="1"
style="stop-color:#BCDED3"
id="stop3604" />
</linearGradient>
<path
style="fill:url(#SVGID_6_)"
inkscape:connector-curvature="0"
d="m 452.4,237 c 0,0 0,0 0,0 0,0 1.8,-0.2 5,-2.4 -2.5,1.7 -4.9,2.4 -4.9,2.4 0,0 0,0 -0.1,0 z"
id="path109" />
</g>
</g>
<linearGradient
id="linearGradient3607"
gradientUnits="userSpaceOnUse"
x1="452.19159"
y1="227.27921"
x2="460.47461"
y2="227.27921">
<stop
offset="0"
style="stop-color:#6AA583"
id="stop3609" />
<stop
offset="1"
style="stop-color:#4C9E96"
id="stop3611" />
</linearGradient>
<path
style="fill:url(#SVGID_7_)"
inkscape:connector-curvature="0"
d="m 458.2,217.6 c -1,-0.3 -2,0 -2.8,0.6 -0.2,0.3 -0.3,0.6 -0.4,0.9 -0.4,1.6 0.5,3.3 2.2,3.7 0.7,0.2 1.3,0.1 1.9,-0.1 -0.9,6.9 -5.9,12.4 -6.9,13.5 0.1,0.4 0.2,0.5 0.2,0.7 0.3,0 0.4,-0.1 0.9,-0.2 1.7,-1.9 6.7,-7.9 7,-15.5 0.5,-1.5 -0.5,-3.1 -2.1,-3.6 z"
id="path116" />
</g>
<linearGradient
id="linearGradient3614"
gradientUnits="userSpaceOnUse"
x1="473.17111"
y1="268.90411"
x2="455.23529"
y2="283.95389"
gradientTransform="matrix(0.9997,0.0227,-0.0227,0.9997,-36.4014,-7.9207)">
<stop
offset="0"
style="stop-color:#7CC099"
id="stop3616" />
<stop
offset="1"
style="stop-color:#57BAAE"
id="stop3618" />
</linearGradient>
<path
style="fill:url(#SVGID_8_)"
inkscape:connector-curvature="0"
d="m 405.5,261.4 c 1.5,12.7 7.5,31.7 27.8,47.9 0,0 10.1,-15.4 0.4,-32.5 -9.7,-17.1 -23.8,-22.7 -28.8,-24.5 -0.2,3.6 0.4,6.8 0.6,9.1 z"
id="path123" />
<linearGradient
id="linearGradient3621"
gradientUnits="userSpaceOnUse"
x1="447.13129"
y1="274.66199"
x2="470.95151"
y2="274.66199"
gradientTransform="matrix(0.9997,0.0227,-0.0227,0.9997,-36.4014,-7.9207)">
<stop
offset="0"
style="stop-color:#7CC099"
id="stop3623" />
<stop
offset="0.2327"
style="stop-color:#76BA97"
id="stop3625" />
<stop
offset="0.5485"
style="stop-color:#65AB90"
id="stop3627" />
<stop
offset="0.9106"
style="stop-color:#489186"
id="stop3629" />
<stop
offset="1"
style="stop-color:#408A83"
id="stop3631" />
</linearGradient>
<path
style="fill:url(#SVGID_9_)"
inkscape:connector-curvature="0"
d="m 423.7,272.8 c -5.7,-10 -12.8,-16.8 -18.8,-20.5 -0.1,3.2 0.4,7 0.6,9.1 1.2,10.8 5.8,26.1 19.6,40.4 2.4,-5.5 5.5,-16.8 -1.4,-29 z"
id="path136" />
<g
id="g138">
<linearGradient
id="linearGradient3635"
gradientUnits="userSpaceOnUse"
x1="415.2153"
y1="260.93829"
x2="422.0509"
y2="252.7919">
<stop
offset="0"
style="stop-color:#4C9E96"
id="stop3637" />
<stop
offset="0.4859"
style="stop-color:#489790"
id="stop3639" />
<stop
offset="1"
style="stop-color:#408A83"
id="stop3641" />
</linearGradient>
<path
style="fill:url(#SVGID_10_)"
inkscape:connector-curvature="0"
d="m 411.9,246.7 c -2,-0.8 -4.9,-1.6 -6.8,-2.4 -0.3,2.5 -0.2,5.1 -0.2,8.1 4.4,1.6 16.1,6.2 25.5,19.3 0,-0.1 0,-0.2 0,-0.3 -0.2,-2.3 -1.1,-18.3 -18.5,-24.7 z"
id="path147" />
</g>
<g
id="g149">
<linearGradient
id="linearGradient3645"
gradientUnits="userSpaceOnUse"
x1="425.60641"
y1="203.1666"
x2="393.7475"
y2="239.4308">
<stop
offset="0"
style="stop-color:#7CC099"
id="stop3647" />
<stop
offset="0.3183"
style="stop-color:#77BF9C"
id="stop3649" />
<stop
offset="0.6757"
style="stop-color:#6ABDA3"
id="stop3651" />
<stop
offset="1"
style="stop-color:#57BAAE"
id="stop3653" />
</linearGradient>
<path
style="fill:url(#SVGID_11_)"
inkscape:connector-curvature="0"
d="m 433.7,212.6 c -5.9,-10.1 -19,-17.9 -27.5,-21 -8.5,-3.2 -18,-10.1 -18,-10.1 -2.1,-1.4 -3.8,-2.7 -5.2,-4 -0.4,3.6 -0.6,7.5 -0.4,11.6 4.2,3.2 9.7,6.5 16.9,9.5 1.7,0.7 6.9,2.8 7,2.9 l 6.5,2.6 -6.7,-1.9 c -0.2,-0.1 -5.5,-1.6 -7.3,-2.2 -6.8,-2.5 -12.1,-5.3 -16.2,-8.2 0.4,5 1.3,10.1 2.9,15.2 3.4,1.8 7.2,3.4 11.6,4.9 0.9,0.3 3.6,1.3 3.6,1.3 l 3.4,1.2 -3.5,-0.5 c -0.1,0 -3,-0.4 -4,-0.6 -3.7,-0.9 -7,-2 -10,-3.3 1.9,4.8 4.4,8.8 7.4,12.3 0.1,0 0.1,0 0.1,0 l 3.8,1 -3.2,-0.2 c 6.9,7.7 16.3,13.3 26.3,21.3 13.5,10.8 9.2,27.2 9.2,27.2 0,0 0.8,-0.6 1.5,-1.5 1.8,-2.1 5.1,-7 8.1,-16.9 5,-16.1 -0.4,-30.5 -6.3,-40.6 z"
id="path160" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

135
snap/plugins/x-autotools.py Normal file
View File

@ -0,0 +1,135 @@
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015, 2016 Canonical Ltd
# Copyright (C) 2016 Harald Sitter <sitter@kde.org>
# Copyright (C) 2017 Simon Stürz <simon.stuerz@guh.io>
#
# 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/>.
"""The autotools plugin is used for autotools based parts.
Autotools based projects are the ones that have the usual
`./configure && make && make install` instruction set.
The plugin tries to build using ./configure first, if it is not there
it will run ./autogen and if autogen is not there it will run autoreconf.
This plugin uses the common plugin keywords as well as those for "sources".
For more information check the 'plugins' topic for the former and the
'sources' topic for the latter.
In addition, this plugin uses the following plugin-specific keywords:
- configflags:
(list of strings)
configure flags to pass to the build such as those shown by running
'./configure --help'
- install-via:
(enum, 'destdir' or 'prefix')
Whether to install via DESTDIR or by using --prefix (default is
'prefix')
"""
import os
import stat
import snapcraft
class XAutotoolsPlugin(snapcraft.BasePlugin):
@classmethod
def schema(cls):
schema = super().schema()
schema['properties']['configflags'] = {
'type': 'array',
'minitems': 1,
'uniqueItems': False,
'items': {
'type': 'string',
},
'default': [],
}
schema['properties']['install-via'] = {
'enum': ['destdir', 'prefix'],
'default': 'prefix',
}
return schema
@classmethod
def get_build_properties(cls):
# Inform Snapcraft of the properties associated with building. If these
# change in the YAML Snapcraft will consider the build step dirty.
return super().get_build_properties() + ["configflags", "install-via"]
def __init__(self, name, options, project):
super().__init__(name, options, project)
self.build_packages.extend([
'autoconf',
'automake',
'autopoint',
'libtool',
'make',
])
if options.install_via == 'destdir':
self.install_via_destdir = True
elif options.install_via == 'prefix':
self.install_via_destdir = False
else:
raise RuntimeError('Unsupported installation method: "{}"'.format(
options.install_via))
def build(self):
super().build()
if not os.path.exists(os.path.join(self.builddir, "configure")):
generated = False
scripts = ["autogen.sh", "bootstrap"]
for script in scripts:
path = os.path.join(self.builddir, script)
if not os.path.exists(path) or os.path.isdir(path):
continue
# Make sure it's executable
if not os.access(path, os.X_OK):
os.chmod(path,
stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP |
stat.S_IROTH | stat.S_IWOTH | stat.S_IXOTH)
self.run(['env', 'NOCONFIGURE=1', './{}'.format(script)])
generated = True
break
if not generated:
self.run(['autoreconf', '-i'])
configure_command = ['./configure']
make_install_command = ['make', 'install']
if self.install_via_destdir:
# Use an empty prefix since we'll install via DESTDIR
#configure_command.append('--prefix=')
make_install_command.append('DESTDIR=' + self.installdir)
self.run(configure_command + ['-prefix', self.installdir] + self.options.configflags)
self.run(['make', '-j{}'.format(self.parallel_build_count)])
self.run(make_install_command)
def snap_fileset(self):
fileset = super().snap_fileset()
# Remove .la files which don't work when they are moved around
fileset.append("-**/*.la")
return fileset

129
snap/plugins/x-qmake.py Normal file
View File

@ -0,0 +1,129 @@
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
# Copyright (C) 2017 Simon Stürz <simon.stuerz@guh.io>
#
# 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/>.
"""The qmake plugin is useful for building qmake-based parts.
These are projects that are built using .pro files.
This plugin uses the common plugin keywords as well as those for "sources".
For more information check the 'plugins' topic for the former and the
'sources' topic for the latter.
Additionally, this plugin uses the following plugin-specific keywords:
- options:
(list of strings)
additional options to pass to the qmake invocation.
- project-files:
(list of strings)
list of .pro files to pass to the qmake invocation.
"""
import os
import snapcraft
from snapcraft import common
class XQmakePlugin(snapcraft.BasePlugin):
@classmethod
def schema(cls):
schema = super().schema()
schema['properties']['options'] = {
'type': 'array',
'minitems': 1,
'uniqueItems': True,
'items': {
'type': 'string',
},
'default': [],
}
schema['properties']['project-files'] = {
'type': 'array',
'minitems': 1,
'uniqueItems': True,
'items': {
'type': 'string',
},
'default': [],
}
return schema
@classmethod
def get_build_properties(cls):
# Inform Snapcraft of the properties associated with building. If these
# change in the YAML Snapcraft will consider the build step dirty.
return ['options', 'project-files']
def __init__(self, name, options, project):
super().__init__(name, options, project)
self.build_packages.append('make')
def build(self):
super().build()
env = self._build_environment()
sources = []
if self.options.project_files:
sourcedir = self.sourcedir
source_subdir = getattr(self.options, 'source_subdir', None)
if source_subdir:
sourcedir = os.path.join(sourcedir, source_subdir)
sources = [os.path.join(sourcedir, project_file)
for project_file in self.options.project_files]
#self.run(['qmake'] + self._extra_config() + self.options.options + sources, env=env)
self.run([ self.project.parts_dir + '/qt-5-11-1/install/bin/qmake'] + self._extra_config() + self.options.options + sources, env=env)
self.run(['make', '-j{}'.format( self.parallel_build_count)], env=env)
self.run(['make', 'install', 'INSTALL_ROOT=' + self.installdir], env=env)
def _extra_config(self):
extra_config = []
for root in [self.installdir, self.project.stage_dir]:
paths = common.get_library_paths(root, self.project.arch_triplet)
for path in paths:
extra_config.append("LIBS+=\"-L{}\"".format(path))
extra_config.append("LIBS+=\"-L{}\"".format(self.project.parts_dir + '/qt-5-11-1/install/lib'))
extra_config.append("QMAKE_LIBS+=\"-L{}\"".format(self.project.parts_dir + '/qt-5-11-1/install/lib'))
extra_config.append("QMAKE_LIBDIR+=\"{}\"".format(self.project.parts_dir + '/qt-5-11-1/install/lib'))
paths = common.get_include_paths(root, self.project.arch_triplet)
for path in paths:
extra_config.append("INCLUDEPATH+=\"{}\"".format(path))
extra_config.append("INCLUDEPATH+=\"{}\"".format(self.project.parts_dir + '/qt-5-11-1/install/include'))
extra_config.append("QML_IMPORT_PATH+=\"{}\"".format(self.project.parts_dir + '/qt-5-11-1/install/qml'))
extra_config.append("QML2_IMPORT_PATH+=\"{}\"".format(self.project.parts_dir + '/qt-5-11-1/install/qml'))
return extra_config
def _build_environment(self):
env = os.environ.copy()
env['QTDIR' ] = self.project.parts_dir + '/qt-5-11-1/install/'
env['QML_IMPORT_PATH' ] = self.project.parts_dir + '/qt-5-11-1/install/qml'
env['QML2_IMPORT_PATH' ] = self.project.parts_dir + '/qt-5-11-1/install/qml'
env['LD_LIBRARY_PATH' ] = self.project.parts_dir + '/qt-5-11-1/install/lib:' + self.project.parts_dir + '/qt-5-11-1/install/usr/lib/:'
env['PATH' ] = self.project.parts_dir + '/qt-5-11-1/install/bin:' + os.environ["PATH"]
return env

81
snap/qt5-launch Executable file
View File

@ -0,0 +1,81 @@
#!/bin/sh
case "$SNAP_ARCH" in
"amd64")
ARCH='x86_64-linux-gnu';;
"i386")
ARCH='i386-linux-gnu';;
"armhf")
ARCH='arm-linux-gnueabihf' ;;
*)
echo "Unsupported architecture $SNAP_ARCH for this app build"
exit 1;;
esac
# Add executable paths
export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH"
export LD_LIBRARY_PATH="$SNAP/lib:$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH
# XKB config
export XKB_CONFIG_ROOT=$SNAP/usr/share/X11/xkb
# Qt Platform to Mir
export QTCHOOSER_NO_GLOBAL_DIR=1
export QT_SELECT=snappy-qt5
# Qt Libs
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/qt5/libs:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/pulseaudio:$LD_LIBRARY_PATH
# Qt Modules
export QT_PLUGIN_PATH=$SNAP/plugins
# Mesa Libs
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa-egl:$LD_LIBRARY_PATH
# XDG Config
export XDG_CONFIG_DIRS=$SNAP/etc/xdg:$XDG_CONFIG_DIRS
export XDG_CONFIG_DIRS=$SNAP/usr/xdg:$XDG_CONFIG_DIRS
# Note: this doesn't seem to work, QML's LocalStorage either ignores
# or fails to use $SNAP_USER_DATA if defined here
export XDG_DATA_DIRS=$SNAP_USER_DATA:$XDG_DATA_DIRS
export XDG_DATA_DIRS=$SNAP/usr/share:$XDG_DATA_DIRS
# Not good, needed for fontconfig
export XDG_DATA_HOME=$SNAP/usr/share
# Font Config
export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf
# Tell libGL where to find the drivers
export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri
# Necessary for the SDK to find the translations directory
export APP_DIR=$SNAP
# Removes Qt warning: Could not find a location
# of the system Compose files
export QTCOMPOSE=$SNAP/usr/share/X11/locale
# Use GTK styling for running under Unity 7
# TODO: find out what needs to be done for Unity 8
export QT_STYLE_OVERRIDE=gtk
export DESKTOP_SESSION=ubuntu
export XDG_SESSION_DESKTOP=ubuntu
export XDG_CURRENT_DESKTOP=Unity
export GTK2_MODULES=overlay-scrollbar
export GTK_MODULES=gail:atk-bridge:unity-gtk-module
export QT_QPA_PLATFORMTHEME=appmenu-qt5
export GTK_PATH=$SNAP/usr/lib/$ARCH/gtk-2.0
export GIO_MODULE_DIR=$SNAP/usr/lib/$ARCH/gio/modules
cd $SNAP
exec "$@"

200
snap/snapcraft.yaml Normal file
View File

@ -0,0 +1,200 @@
name: nymea-networkmanager
version: 0.1.0
summary: Daemon for setup wireless connection using Bluetooth LE.
description: |
The nymea-networkmanager daemon provides a bluetooth low energy server and
allowes to configure the wireless network using the network-manager DBus connection.
grade: stable
confinement: classic
apps:
nymea-networkmanager:
command: env PATH=$PATH:$SNAP/bin nymea-networkmanager -a "BT WLAN setup" -m offline
daemon: simple
restart-condition: always
plugs:
- dbus
- bluez
- bluetooth-control
- network-manager
parts:
nymea-networkmanager:
plugin: qmake
source: https://github.com/guh/nymea-networkmanager.git
source-type: git
build-attributes: [keep-execstack]
source-branch: master
project-files: [ nymea-networkmanager.pro ]
after: [ qt-5-11-1 ]
build-packages:
- qt5-default
- qt5-qmake
- qtbase5-dev
- qtconnectivity5-dev
stage-packages:
- libqt5gui5
- libqt5core5a
- libqt5bluetooth5
- libqt5network5
- libqt5dbus5
# Custom launcher to support also armhf
qt5-launch:
plugin: dump
build-attributes: [keep-execstack]
source: .
organize:
qt5-launch: bin/
# Qt 5.11.1
qt-5-11-1:
plugin: autotools
source: http://download.qt.io/archive/qt/5.11/5.11.1/single/qt-everywhere-src-5.11.1.tar.xz
source-type: tar
build-attributes: [keep-execstack]
build-packages:
- g++
- freetds-dev
- gdb
- libatspi2.0-dev
- libdbus-1-dev
- libsystemd-dev
- libfontconfig1-dev
- libfreetype6-dev
- libgbm-dev
- libgles2-mesa-dev
- libglib2.0-dev
- libgstreamer-plugins-base1.0-dev
- libgstreamer1.0-dev
- libharfbuzz-dev
- libicu-dev
- libinput-dev
- libmtdev-dev
- libmysqlclient-dev
- libpcre3-dev
- libpq-dev
- libproxy-dev
- libsqlite3-dev
- libssl-dev
- libudev-dev
- libbluetooth-dev
- libx11-dev
- libx11-xcb-dev
- libxcb-icccm4-dev
- libxcb-image0-dev
- libxcb-keysyms1-dev
- libxcb-randr0-dev
- libxcb-render-util0-dev
- libxcb-render0-dev
- libxcb-shape0-dev
- libxcb-shm0-dev
- libxcb-sync-dev
- libxcb-xfixes0-dev
- libxcb-xinerama0-dev
- libxcb-xkb-dev
- libxcb1-dev
- libxext-dev
- libxi-dev
- libxkbcommon-dev
- libxkbcommon-x11-dev
- libxrender-dev
- pkg-kde-tools
- publicsuffix
- unixodbc-dev
- zlib1g-dev
configflags:
- -release
- -confirm-license
- -opensource
- -platform
- linux-g++
- -openssl
- -syslog
- -journald
- -no-rpath
- -verbose
- -silent
- -opengl
- es2
- -no-widgets
- -xcb
- -no-gtk
- -fontconfig
- -no-eglfs
- -no-cups
- -no-accessibility
- -no-use-gold-linker
- -nomake
- examples
- -nomake
- tests
- -skip
- qt3d
- -skip
- qtactiveqt
- -skip
- qtandroidextras
- -skip
- qtcanvas3d
- -skip
- qtcharts
- -skip
- qtdatavis3d
- -skip
- qtdoc
- -skip
- qtgamepad
- -skip
- qtlocation
- -skip
- qtmacextras
- -skip
- qtpurchasing
- -skip
- qtscxml
- -skip
- qtsensors
- -skip
- qtvirtualkeyboard
- -skip
- qtwayland
- -skip
- qtwebchannel
- -skip
- qtwebengine
- -skip
- qtwebview
- -skip
- qtwinextras
- -skip
- qtx11extras
- -skip
- qtxmlpatterns
stage-packages:
- icu-devtools
- libc6
- libdbus-1-3
- libdrm2
- libfreetype6
- libgbm1
- libgcc1
- libglib2.0-0
- libharfbuzz0b
- libice6
- libinput10
- libmtdev1
- libpcre16-3
- libproxy1v5
- libsm6
- libsqlite3-0
- libstdc++6
- libudev1
- libxext-dev
- libxi6
- libxkbcommon0
- perl
- zlib1g
- libdouble-conversion-dev