diff options
Diffstat (limited to 'snap/snapcraft.yaml')
-rw-r--r-- | snap/snapcraft.yaml | 124 |
1 files changed, 95 insertions, 29 deletions
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f84bf53b..fb1e419d 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -19,7 +19,7 @@ architectures: apps: onionshare: common-id: org.onionshare.OnionShare - command: bin/onionshare + command: bin/onionshare-launcher extensions: [gnome-3-38] plugs: - desktop @@ -32,7 +32,7 @@ apps: cli: common-id: org.onionshare.OnionShareCli - command: bin/onionshare-cli + command: bin/onionshare-cli-launcher plugs: - home - network @@ -42,14 +42,57 @@ apps: LANG: C.UTF-8 parts: + launcher: + plugin: nil + override-build: | + mkdir -p $SNAPCRAFT_PART_INSTALL/bin + cat > $SNAPCRAFT_PART_INSTALL/bin/launcher-setup << EOF + #!/bin/sh + export PATH=\$SNAP/bin:\$SNAP/usr/bin:\$SNAP/usr/local/bin:\$PATH + export PYTHONPATH=\$SNAP/lib/python3.8/site-packages:\$SNAP/usr/lib/python3/dist-packages + export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$SNAP/usr/local/lib + ORIG_IFS=\$IFS + IFS=":" + LIB_BASE=\$(for D in \$LD_LIBRARY_PATH; do echo \$D; done | grep \$SNAP/usr/lib/) + IFS=\$ORIGIN_IFS + export QT_PLUGIN_PATH=\$LIB_BASE/qt5/plugins + EOF + cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher << EOF + #!/bin/sh + . \$SNAP/bin/launcher-setup + onionshare \$@ + EOF + cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher << EOF + #!/bin/sh + . \$SNAP/bin/launcher-setup + onionshare-cli \$@ + EOF + chmod 755 $SNAPCRAFT_PART_INSTALL/bin/launcher-setup + chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher + chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher + + onionshare-cli: + source: ./cli + plugin: nil + override-pull: | + snapcraftctl pull + rm pyproject.toml poetry.lock + after: [tor, obfs4, snowflake-client, meek-client] + onionshare: source: ./desktop plugin: python - python-packages: - - qrcode - - pyside2 == 5.15.2.1 - override-build: | - python3 setup.py install --prefix $SNAPCRAFT_PART_INSTALL + build-packages: + - build-essential + - libssl-dev + - libffi-dev + - python3-dev + - python3-pip + - rustc + - cargo + build-environment: + - PATH: /usr/bin:$PATH + - PYTHONPATH: "" stage-packages: - libasound2 - libatk1.0-0 @@ -65,7 +108,6 @@ parts: - libglx0 - libgtk-3-0 - libharfbuzz0b - - libicu66 - libjpeg8 - liblcms2-2 - libnspr4 @@ -112,25 +154,43 @@ parts: - libxslt1.1 - libxtst6 - qtwayland5 - after: [onionshare-cli] - - onionshare-cli: - source: ./cli - plugin: python - python-packages: - - poetry - stage-packages: - - build-essential - - libssl-dev - - libffi-dev - - python3-dev - - python3-pip - - cargo + - python3-pyside2.qtcore + - python3-pyside2.qtgui + - python3-pyside2.qtwidgets + override-pull: | + snapcraftctl pull + rm pyproject.toml poetry.lock + cat > requirements.txt << EOF + # onionshare_cli + click + flask==2.0.3 + flask-socketio==5.3.1 + psutil + pysocks + requests[socks] + unidecode + urllib3 + eventlet + setuptools + pynacl + colorama + gevent-websocket + stem==1.8.1 + werkzeug==2.0.3 + # onionshare + qrcode + EOF override-build: | - poetry install - poetry build - python3 -m pip install ./dist/onionshare_cli-*.whl --prefix $SNAPCRAFT_PART_INSTALL - after: [tor, obfs4, snowflake-client, meek-client] + python3 -m venv $SNAPCRAFT_PART_INSTALL + . $SNAPCRAFT_PART_INSTALL/bin/activate + pip install -U pip setuptools wheel + pip install -U -r requirements.txt + pip install -U ../../onionshare-cli/src + pip install -U . + deactivate + sed -i 's|'$SNAPCRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $SNAPCRAFT_PART_INSTALL/bin/onionshare + sed -i 's|'$SNAPCRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli + after: [onionshare-cli] tor: source: https://dist.torproject.org/tor-0.4.7.9.tar.gz @@ -138,7 +198,7 @@ parts: source-type: tar plugin: autotools autotools-configure-parameters: - - "--with-libevent-dir=/root/parts/libevent/install/usr/local" + - "--with-libevent-dir=$SNAPCRAFT_PART_INSTALL/../../libevent/install/usr/local" build-packages: - libssl-dev - zlib1g-dev @@ -152,12 +212,16 @@ parts: obfs4: plugin: go + build-snaps: + - go/latest/stable source: https://gitlab.com/yawning/obfs4.git source-type: git source-tag: obfs4proxy-0.0.13 snowflake-client: plugin: go + build-snaps: + - go/latest/stable source: https://git.torproject.org/pluggable-transports/snowflake.git source-type: git source-tag: v2.2.0 @@ -166,10 +230,12 @@ parts: meek-client: plugin: go + build-snaps: + - go/latest/stable source: https://git.torproject.org/pluggable-transports/meek.git source-type: git source-tag: v0.37.0 override-build: | cd meek-client - mkdir -p /root/parts/meek-client/install/bin - go build -o /root/parts/meek-client/install/bin/meek-client ./... + mkdir -p /build/onionshare/meek-client/install/bin + go build -o /build/onionshare/meek-client/install/bin/meek-client ./... |