onionshare/snap/snapcraft.yaml

217 lines
6.0 KiB
YAML

name: onionshare
base: core24
version: "2.6.3"
summary: Securely and anonymously share files, host websites, and chat using Tor
description: |
OnionShare lets you securely and anonymously send and receive files. It works by starting
a web server, making it accessible as a Tor onion service, and generating an unguessable
web address so others can download files from you, or upload files to you. It does _not_
require setting up a separate server or using a third party file-sharing service.
grade: stable # stable or devel
confinement: strict
platforms:
amd64:
arm64:
apps:
onionshare:
common-id: org.onionshare.OnionShare
command: bin/onionshare
extensions: [gnome]
plugs:
- desktop
- home
- network
- network-bind
- removable-media
environment:
LANG: C.UTF-8
PATH: $SNAP/bin:$SNAP/usr/bin:$SNAP/usr/local/bin:$PATH
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/local/lib
cli:
common-id: org.onionshare.OnionShareCli
command: bin/onionshare-cli
plugs:
- home
- network
- network-bind
- removable-media
environment:
LANG: C.UTF-8
PATH: $SNAP/bin:$SNAP/usr/bin:$SNAP/usr/local/bin:$PATH
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/local/lib
parts:
onionshare:
source: .
plugin: python
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
- libcairo2
- libcairo-gobject2
- libcups2
- libdrm2
- libegl1
- libfreetype6
- libgdk-pixbuf2.0-0
- libgl1
- libglvnd0
- libglx0
- libgtk-3-0
- libharfbuzz0b
- libjpeg8
- liblcms2-2
- libnspr4
- libnss3
- libpango-1.0-0
- libpangocairo-1.0-0
- libpng16-16
- libpq5
- libpulse-mainloop-glib0
- librsvg2-2
- libspeechd2
- libwayland-client0
- libwayland-cursor0
- libwayland-egl1
- libwayland-server0
- libx11-6
- libx11-xcb1
- libxau6
- libxcb1
- libxcb-glx0
- libxcb-icccm4
- libxcb-image0
- libxcb-keysyms1
- libxcb-render0
- libxcb-render-util0
- libxcb-shm0
- libxcb-sync1
- libxcb-xfixes0
- libxcb-xinerama0
- libxcb-xkb1
- libxcomposite1
- libxcursor1
- libxdamage1
- libxdmcp6
- libxext6
- libxfixes3
- libxi6
- libxkbcommon0
- libxkbcommon-x11-0
- libxml2
- libxrandr2
- libxrender1
- libxslt1.1
- libxtst6
- qtwayland5
- libgstreamer1.0-0
- libgstreamer1.0-dev
- libgstreamer-gl1.0-0
- libgstreamer-plugins-base1.0-0
- libmysqlclient21
- libxcb-cursor0
- libxkbfile1
- libodbc2
override-pull: |
craftctl default
override-build: |
test -e $CRAFT_PART_INSTALL/bin/python3 && chmod 755 $CRAFT_PART_INSTALL/bin/python3 || true
python3 -m venv $CRAFT_PART_INSTALL
. $CRAFT_PART_INSTALL/bin/activate
pip install -r snap/local/cli-requirements.txt -r snap/local/desktop-requirements.txt
cd desktop && pip install ../cli && pip install .
deactivate
sed -i 's|'$CRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $CRAFT_PART_INSTALL/bin/onionshare
sed -i 's|'$CRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $CRAFT_PART_INSTALL/bin/onionshare-cli
tor:
source: https://dist.torproject.org/tor-0.4.8.14.tar.gz
source-checksum: sha256/5047e1ded12d9aac4eb858f7634a627714dd58ce99053d517691a4b304a66d10
source-type: tar
plugin: autotools
autotools-configure-parameters:
- "--with-libevent-dir=$CRAFT_PART_INSTALL/../../libevent/install/usr/local"
build-packages:
- libssl-dev
- zlib1g-dev
after: [libevent]
libevent:
source: https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
source-checksum: sha256/92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
source-type: tar
plugin: autotools
obfs4:
plugin: go
build-snaps:
- go/latest/stable
source: https://gitlab.com/yawning/obfs4.git
source-type: git
source-tag: obfs4proxy-0.0.14
after: [tor]
snowflake-client:
plugin: go
build-snaps:
- go/latest/stable
source: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
source-type: git
source-tag: v2.10.1
organize:
bin/client: bin/snowflake-client
after: [obfs4]
meek-client:
plugin: go
build-snaps:
- go/latest/stable
source: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/meek.git
source-type: git
source-tag: v0.38.0
override-build: |
cd meek-client
go build -o $SNAPCRAFT_PART_INSTALL/bin/meek-client ./...
after: [snowflake-client]
# This part removes all the files in this snap which already exist in
# connected content and base snaps. Since these files will be available
# at runtime from the content and base snaps, they do not need to be
# included in this snap itself.
#
# More info: https://forum.snapcraft.io/t/reducing-the-size-of-desktop-snaps/17280#heading--cleanup-part
#
cleanup:
after: # Make this part run last; list all your other parts here
- onionshare
- tor
- libevent
- obfs4
- snowflake-client
- meek-client
plugin: nil
build-snaps: # List all content-snaps and base snaps you're using here
- core24
- go/latest/stable
- gnome-46-2404-sdk
override-prime: |
set -eux
for snap in core24 go/latest/stable gnome-46-2404-sdk; do # List all content-snaps and base snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \;
done