464 lines
14 KiB
Text
464 lines
14 KiB
Text
# Contributor: Lauren N. Liberda <lauren@selfisekai.rocks>
|
|
# Maintainer: Lauren N. Liberda <lauren@selfisekai.rocks>
|
|
pkgname=signal-desktop
|
|
pkgver=6.12.0
|
|
pkgrel=1
|
|
pkgdesc="A messaging app for simple private communication with friends"
|
|
url="https://github.com/signalapp/Signal-Desktop/"
|
|
# same as electron
|
|
# aarch64: polyval-0.5.3 crate subdep uses unstable stdsimd feature
|
|
arch="x86_64"
|
|
license="AGPL-3.0-only"
|
|
# this build system sucks massive ass and does not add needed to anything
|
|
depends="
|
|
electron
|
|
ffmpeg-libs
|
|
font-barlow
|
|
font-eb-garamond
|
|
font-inter
|
|
font-parisienne
|
|
libevent
|
|
opus
|
|
"
|
|
makedepends="
|
|
alsa-lib-dev
|
|
bsd-compat-headers
|
|
cargo
|
|
cbindgen
|
|
clang-dev
|
|
cmake
|
|
electron-dev
|
|
electron-tasje
|
|
ffmpeg-dev
|
|
git-lfs
|
|
glib-dev
|
|
gn
|
|
libepoxy-dev
|
|
libevent-dev
|
|
lld
|
|
llvm-dev
|
|
mesa-dev
|
|
nodejs
|
|
npm
|
|
openssl-dev
|
|
opus-dev
|
|
pipewire-dev
|
|
protoc
|
|
pulseaudio-dev
|
|
py3-setuptools
|
|
python3
|
|
samurai
|
|
sqlcipher-dev
|
|
vips-dev
|
|
yarn
|
|
"
|
|
options="net !check"
|
|
|
|
# follow signal-desktop package.json -> @signalapp/libsignal-client
|
|
_libsignalver=0.22.0
|
|
|
|
# follow signal-desktop package.json -> @signalapp/ringrtc
|
|
_ringrtcver=2.25.2
|
|
|
|
# follow ringrtc (on version above) -> config/version.properties -> webrtc.version
|
|
# downloading tarball generated with abuild snapshot (with gclient dependencies fetched)
|
|
_webrtcver=5481
|
|
|
|
# follow @signalapp/better-sqlite3 (on version in package.json) -> deps/download.js -> TOKENIZER_VERSION
|
|
# last bsqlite version: 8.4.3
|
|
_stokenizerver=0.2.1
|
|
|
|
source="
|
|
https://github.com/signalapp/Signal-Desktop/archive/refs/tags/v$pkgver/Signal-Desktop-$pkgver.tar.gz
|
|
https://github.com/signalapp/libsignal/archive/refs/tags/v$_libsignalver/libsignal-$_libsignalver.tar.gz
|
|
https://github.com/signalapp/ringrtc/archive/refs/tags/v$_ringrtcver/ringrtc-$_ringrtcver.tar.gz
|
|
https://s3.sakamoto.pl/lnl-aports-snapshots/webrtc-$_webrtcver.tar.xz
|
|
https://github.com/signalapp/Signal-FTS5-Extension/archive/refs/tags/v$_stokenizerver/stokenizer-$_stokenizerver.tar.gz
|
|
|
|
bettersqlite-use-system-sqlcipher.patch
|
|
libsignal-too-new-clang.patch
|
|
signal-disable-updates.patch
|
|
signal-update-links.patch
|
|
signal-tasje-whatever-the-fuck-is-ignore-doing-here.patch
|
|
webrtc-use-alpine-target.patch
|
|
webrtc-no-shared-deps-in-static-lib.patch
|
|
|
|
signal-desktop
|
|
"
|
|
builddir="$srcdir/Signal-Desktop-$pkgver"
|
|
|
|
export CC=clang
|
|
export CXX=clang++
|
|
|
|
# required to find the tools
|
|
export AR=llvm-ar
|
|
export NM=llvm-nm
|
|
export LD=clang++
|
|
|
|
# less log spam, reproducible, allow lto with rust
|
|
export CFLAGS="${CFLAGS/-g/} -O2 -Wno-error -Wno-deprecated-builtins -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations"
|
|
export CXXFLAGS="${CXXFLAGS/-g/} -O2 -Wno-error -Wno-deprecated-builtins -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations"
|
|
export CPPFLAGS="$CPPFLAGS -D__DATE__= -D__TIME__= -D__TIMESTAMP__="
|
|
|
|
export CARGO_PROFILE_RELEASE_OPT_LEVEL=2
|
|
export CARGO_PROFILE_RELEASE_STRIP="symbols"
|
|
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"
|
|
export RUSTFLAGS="$RUSTFLAGS -C linker=clang -C link-arg=-fuse-ld=lld"
|
|
|
|
export YARN_CACHE_FOLDER="$srcdir/.yarn"
|
|
|
|
# webrtc only, the other dependencies are fine with tarballs
|
|
snapshot() {
|
|
mkdir -p "$srcdir"
|
|
cd "$srcdir"
|
|
|
|
# cleanup if retrying
|
|
rm -rf src
|
|
rm -rf webrtc-$_webrtcver
|
|
rm -f webrtc-$_webrtcver.tar
|
|
rm -f webrtc-$_webrtcver.tar.xz
|
|
|
|
echo "
|
|
solutions = [{
|
|
'name': 'src',
|
|
'url': 'https://github.com/signalapp/webrtc.git@$_webrtcver',
|
|
}]
|
|
target_cpu = ['x64', 'arm64']
|
|
target_cpu_only = True
|
|
" > .gclient
|
|
|
|
gclient sync --no-history --nohooks --tpot-cipd-ignore-platformed
|
|
|
|
# needed DEPS hooks
|
|
python3 'src/build/landmines.py' --landmine-scripts 'src/tools_webrtc/get_landmines.py' --src-dir 'src'
|
|
python3 'src/build/util/lastchange.py' -o 'src/build/util/LASTCHANGE'
|
|
|
|
for elf in $(scanelf -RA -F "%F" src); do
|
|
rm -f "$elf"
|
|
done
|
|
|
|
mv src webrtc-$_webrtcver
|
|
|
|
msg "generating tarball.."
|
|
tar -cf webrtc-$_webrtcver.tar \
|
|
--exclude="ChangeLog*" \
|
|
--exclude="testdata/" \
|
|
--exclude="test_data/" \
|
|
--exclude="android_rust_toolchain/toolchain/" \
|
|
--exclude="base/" \
|
|
--exclude-backups \
|
|
--exclude-caches-all \
|
|
--exclude-vcs \
|
|
webrtc-$_webrtcver
|
|
|
|
xz -T0 -e -9 -vv -k webrtc-$_webrtcver.tar
|
|
}
|
|
|
|
prepare() {
|
|
msg "Applying patches"
|
|
for x in $source; do
|
|
case "$x" in
|
|
signal-*.patch)
|
|
msg "$x"
|
|
patch -p1 -i "$srcdir"/$x -d "$srcdir"/Signal-Desktop-$pkgver
|
|
;;
|
|
libsignal-*.patch)
|
|
msg "$x"
|
|
patch -p1 -i "$srcdir"/$x -d "$srcdir"/libsignal-$_libsignalver
|
|
;;
|
|
ringrtc-*.patch)
|
|
msg "$x"
|
|
patch -p1 -i "$srcdir"/$x -d "$srcdir"/ringrtc-$_ringrtcver
|
|
;;
|
|
webrtc-*.patch)
|
|
msg "$x"
|
|
patch -p1 -i "$srcdir"/$x -d "$srcdir"/webrtc-$_webrtcver
|
|
;;
|
|
esac
|
|
done
|
|
|
|
msg "Installing signal-desktop JS dependencies"
|
|
echo 'ignore-engines true' > .yarnrc
|
|
yarn --ignore-scripts --frozen-lockfile
|
|
|
|
(
|
|
cd "$srcdir"/webrtc-$_webrtcver
|
|
|
|
local use_system="
|
|
ffmpeg
|
|
fontconfig
|
|
freetype
|
|
harfbuzz-ng
|
|
icu
|
|
libdrm
|
|
libevent
|
|
libjpeg
|
|
libpng
|
|
libwebp
|
|
libxml
|
|
libxslt
|
|
opus
|
|
re2
|
|
snappy
|
|
zlib
|
|
"
|
|
for _lib in $use_system libjpeg_turbo; do
|
|
msg "Removing buildscripts for system provided $_lib"
|
|
find . -type f -path "*third_party/$_lib/*" \
|
|
\! -path "*third_party/$_lib/chromium/*" \
|
|
\! -path "*third_party/$_lib/google/*" \
|
|
\! -path './base/third_party/icu/*' \
|
|
\! -path './third_party/libxml/*' \
|
|
\! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
|
|
\! -path './third_party/harfbuzz-ng/utils/hb_scoped.h' \
|
|
\! -path './third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h' \
|
|
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
|
|
-delete
|
|
done
|
|
|
|
msg "Replacing gn files"
|
|
python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
|
|
$use_system
|
|
|
|
# allow system dependencies in "official builds"
|
|
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
|
|
tools/generate_shim_headers/generate_shim_headers.py
|
|
|
|
mkdir path
|
|
ln -s /usr/bin/python3 path/vpython3
|
|
)
|
|
|
|
(
|
|
cd "$srcdir"/ringrtc-$_ringrtcver/src/rust
|
|
|
|
msg "Installing ringrtc rust dependencies"
|
|
cargo fetch --target="$CTARGET" --locked
|
|
)
|
|
|
|
(
|
|
cd "$srcdir"/libsignal-$_libsignalver
|
|
|
|
msg "Installing libsignal rust dependencies"
|
|
cargo fetch --target="$CTARGET" --locked
|
|
)
|
|
|
|
(
|
|
cd "$srcdir"/Signal-FTS5-Extension-$_stokenizerver
|
|
|
|
msg "Installing signal tokenizer rust dependencies"
|
|
cargo fetch --target="$CTARGET" --locked
|
|
)
|
|
|
|
(
|
|
cd "$srcdir"/ringrtc-$_ringrtcver/src/node
|
|
|
|
msg "Installing ringrtc js dependencies"
|
|
yarn --frozen-lockfile --ignore-scripts
|
|
)
|
|
|
|
(
|
|
cd "$srcdir"/libsignal-$_libsignalver/node
|
|
|
|
# fix target
|
|
sed -i 's/unknown-linux-gnu/alpine-linux-musl/g' binding.gyp
|
|
|
|
msg "Installing libsignal js dependencies"
|
|
yarn --ignore-scripts --frozen-lockfile
|
|
)
|
|
|
|
# remove shipped fonts for system-provided (part 1)
|
|
rm -rf fonts/
|
|
}
|
|
|
|
build() {
|
|
chromium_arch="$(node -e 'console.log(process.arch)')"
|
|
|
|
# required dependency of ringrtc
|
|
(
|
|
cd "$srcdir"/webrtc-$_webrtcver
|
|
export PATH="$PWD/path:$PATH"
|
|
|
|
# shellcheck disable=2089
|
|
local webrtc_args="
|
|
rtc_build_examples=false
|
|
rtc_build_tools=false
|
|
rtc_enable_protobuf=false
|
|
rtc_enable_sctp=false
|
|
rtc_include_tests=false
|
|
rtc_include_ilbc=false
|
|
rtc_libvpx_build_vp9=true
|
|
rtc_use_x11=false
|
|
|
|
build_with_mozilla=false
|
|
chrome_pgo_phase=0
|
|
clang_use_chrome_plugins=false
|
|
clang_base_path=\"/usr\"
|
|
custom_toolchain=\"//build/toolchain/linux/unbundle:default\"
|
|
is_cfi=false
|
|
is_clang=true
|
|
is_debug=false
|
|
is_official_build=true
|
|
host_toolchain=\"//build/toolchain/linux/unbundle:default\"
|
|
proprietary_codecs=true
|
|
rtc_link_pipewire=true
|
|
rtc_use_pipewire=true
|
|
symbol_level=0
|
|
use_custom_libcxx=false
|
|
use_sysroot=false
|
|
use_system_freetype=true
|
|
use_system_harfbuzz=true
|
|
use_system_libjpeg=true
|
|
"
|
|
mkdir -p "$srcdir"/ringrtc-$_ringrtcver/out/release
|
|
msg "Building signal's webrtc"
|
|
# shellcheck disable=2090,2116
|
|
gn gen "$srcdir"/ringrtc-$_ringrtcver/out/release --args="$(echo $webrtc_args)"
|
|
ninja -C "$srcdir"/ringrtc-$_ringrtcver/out/release webrtc
|
|
)
|
|
|
|
(
|
|
cd "$srcdir"/ringrtc-$_ringrtcver/src/rust
|
|
|
|
msg "Building libringrtc"
|
|
OUTPUT_DIR="$srcdir"/ringrtc-$_ringrtcver/out \
|
|
cargo build --features electron --release
|
|
mkdir -p ../node/build/linux
|
|
cp -fv target/release/libringrtc.so ../node/build/linux/libringrtc-$chromium_arch.node
|
|
)
|
|
|
|
(
|
|
cd "$srcdir"/ringrtc-$_ringrtcver/src/node
|
|
msg "Building ringrtc JS glue code"
|
|
yarn build
|
|
|
|
msg "Cleaning dev dependencies for ringrtc"
|
|
yarn --ignore-scripts --frozen-lockfile --production
|
|
)
|
|
|
|
# module on npm intentionally unbuildable: https://github.com/signalapp/libsignal/issues/464#issuecomment-1160665052
|
|
(
|
|
cd "$srcdir"/libsignal-$_libsignalver/node
|
|
|
|
msg "Building libsignal"
|
|
yarn node-gyp configure --nodedir=/usr/include/electron/node_headers --build-from-source
|
|
yarn node-gyp build --nodedir=/usr/include/electron/node_headers --build-from-source
|
|
|
|
mkdir -p prebuilds/linux-$chromium_arch
|
|
mv build/Release/libsignal_client_linux_$chromium_arch.node prebuilds/linux-$chromium_arch/node.napi.node
|
|
|
|
msg "Building libsignal glue code"
|
|
yarn tsc
|
|
|
|
msg "Cleaning dev dependencies for libsignal"
|
|
yarn --ignore-scripts --frozen-lockfile --production
|
|
)
|
|
|
|
(
|
|
cd "$srcdir"/Signal-FTS5-Extension-$_stokenizerver
|
|
|
|
msg "Building signal tokenizer"
|
|
cargo build --features extension --release --frozen
|
|
cbindgen --profile release . -o target/release/signal-tokenizer.h
|
|
)
|
|
|
|
# from package.json postinstall
|
|
yarn build:acknowledgments
|
|
yarn patch-package
|
|
rm -rf node_modules/dtrace-provider
|
|
|
|
# get esbuild installed (needed for next step)
|
|
npm rebuild esbuild
|
|
|
|
# build front
|
|
NODE_ENV=production \
|
|
SIGNAL_ENV=production \
|
|
NODE_OPTIONS=--openssl-legacy-provider \
|
|
yarn build:dev
|
|
|
|
# purge non-production deps
|
|
yarn install --ignore-scripts --frozen-lockfile --production
|
|
|
|
# XXX: the previous step undoes the patches. and removes the patch applier.
|
|
# please force me to just implement packaging without dev modules in tasje. -lnl
|
|
for x in patches/*.patch; do
|
|
# some of these patches are made for devDependencies
|
|
if [ -d "$(grep -Eo 'node_modules/(@[a-z\d_-]+/)?[a-z\d_-]+/' "$x" | head -n1)" ]; then
|
|
msg "$x"
|
|
patch -Np1 -i ./"$x"
|
|
fi
|
|
done
|
|
|
|
# use our libsignal
|
|
rm -rf node_modules/@signalapp/libsignal-client/
|
|
mv "$srcdir"/libsignal-$_libsignalver/node/ node_modules/@signalapp/libsignal-client
|
|
|
|
# use our libringrtc
|
|
rm -rf node_modules/@signalapp/ringrtc/
|
|
mv "$srcdir"/ringrtc-$_ringrtcver/src/node/ node_modules/@signalapp/ringrtc
|
|
|
|
# patch the sqlcipher module
|
|
for x in $source; do
|
|
case "$x" in
|
|
bettersqlite-*.patch)
|
|
msg "$x"
|
|
patch -Np1 -i "$srcdir"/$x -d "$srcdir"/Signal-Desktop-$pkgver/node_modules/@signalapp/better-sqlite3/
|
|
;;
|
|
esac
|
|
done
|
|
|
|
mkdir node_modules/@signalapp/better-sqlite3/tokenizer
|
|
mv "$srcdir"/Signal-FTS5-Extension-$_stokenizerver/target/release/libsignal_tokenizer.a node_modules/@signalapp/better-sqlite3/tokenizer/
|
|
mv "$srcdir"/Signal-FTS5-Extension-$_stokenizerver/target/release/signal-tokenizer.h node_modules/@signalapp/better-sqlite3/tokenizer/
|
|
|
|
npm rebuild \
|
|
sharp @signalapp/better-sqlite3 spellchecker websocket \
|
|
utf-8-validate bufferutil fs-xattr \
|
|
--nodedir=/usr/include/electron/node_headers --build-from-source
|
|
|
|
# unnecessary/unused native modules, blobs
|
|
find node_modules -type d -path '**/prebuilds' \
|
|
\! -path 'node_modules/@signalapp/libsignal-client/prebuilds' -exec rm -r {} \+
|
|
find node_modules -type d -path '**/build/*/obj.target' -exec rm -r {} \+
|
|
rm -r 'node_modules/@signalapp/libsignal-client/build/'
|
|
find node_modules/@signalapp/better-sqlite3 -type f -path 'build/**/*' \
|
|
\! -path 'build/Release/better_sqlite3.node' -delete
|
|
rm -r 'node_modules/@signalapp/better-sqlite3/tokenizer'
|
|
|
|
SIGNAL_ENV=production \
|
|
tasje pack
|
|
}
|
|
|
|
check() {
|
|
# tests run against downloaded build of electron for glibc, probably can be patched
|
|
yarn test
|
|
}
|
|
|
|
package() {
|
|
cd "$builddir"/tasje_out
|
|
|
|
install -Dm644 resources/app.asar "$pkgdir"/usr/lib/$pkgname/app.asar
|
|
cp -r resources/app.asar.unpacked "$pkgdir"/usr/lib/$pkgname/app.asar.unpacked
|
|
install -Dm644 $pkgname.desktop "$pkgdir"/usr/share/applications/$pkgname.desktop
|
|
|
|
install -Dm755 "$srcdir"/$pkgname "$pkgdir"/usr/bin/$pkgname
|
|
|
|
while read -r size; do
|
|
install -Dm644 icons/$size.png "$pkgdir"/usr/share/icons/hicolor/$size/apps/$pkgname.png
|
|
done < icons/size-list
|
|
}
|
|
|
|
sha512sums="
|
|
84e1e9f40aed65dbe48a98b8f7c863956e8e4922c6a6d7340db19f949e5077067100568ecab8005ee9ffe272b9f3efaf72f40dbb16aab30952aa1df10844904d Signal-Desktop-6.12.0.tar.gz
|
|
9483c8d302728d6caa123f1fb9a977c7cb3aea09ecd1d2cfb3b19f2f2c66f884c41e37642c89db4eeeb0d607fddf281ba27ba4bd0a90e43b972d0cbc607e1483 libsignal-0.22.0.tar.gz
|
|
148a6ab28e1115612144d74e2bdc70712674db19f1735343626605269eb97047feba7981dbb1269527d7779a8c2059be32adbfd65823f3fa601305f303e45b7c ringrtc-2.25.2.tar.gz
|
|
7b6c03da2c6fd33a60b56c29d35b56919aa3f0b7b02ba172010eaff29513d2f33dc434538d15caf9c39cbbd961f979bcda9de06edd98dcd794cc2c3c835ffcab webrtc-5481.tar.xz
|
|
84a1f2fc29262a12842e94698d124a85b823128e72a493b0be8ea92fbb72c5c268499f4a6827cdedaae06ec73cce4039a39fe5c5d536cbef330e59ba0183da28 stokenizer-0.2.1.tar.gz
|
|
be5b4e823543b79175a12314f10c6326d9f0d59f470136962daed4665887006acc05b48b40dc1b67747396d8f6f7d23be298c1e110ccdd35ff9b09d5e6b80bab bettersqlite-use-system-sqlcipher.patch
|
|
78be44ef201d9e6e127979a496f7244c8d93e936f85ad8753fea1646e6142f8a0dbff705ba612c8c724d19e6a9e89ccae254719326021818e04cccef452fc308 libsignal-too-new-clang.patch
|
|
60a45285d885922f5c21f64b761a10efbee9081baf3efa4c8c13abc6a43dc4d27662ed10e239b0fa2071ab9e3a0dbbb4b11d6e3d26fe2b74a19f39e72b74a5bd signal-disable-updates.patch
|
|
e50edde5a3a5b691eea4a595bd79672c207542ece710e53c26c70d7d2807335a418cfb9dc1aef6ce61ee41ee771a07534345ef4daaee8f0fdb4bab98a4034f0f signal-update-links.patch
|
|
536bca17e9ae774cd4c26e9012f628bee1273587e5b5db866de577025b0b9a36c68ec970d61605cdc3d470032adcdf53b948368b6cb4fe7f1bffe69d87371daf signal-tasje-whatever-the-fuck-is-ignore-doing-here.patch
|
|
354f516a74c5491727afe084ef7688b3e1359d230daa720ffc30b33d3ea7579c9f37a50fbdc5fe2e8dc5322e42a0a39e4ae3449d4cf5b77daed2229bd743028c webrtc-use-alpine-target.patch
|
|
bab56a33265b5b094f161af1462166e371913a5269fe8e7d12e9f65ec4f5b908157406b3bcbcf73db15d03470445127d27c64fd731b6ea57c631aba3f4d302cb webrtc-no-shared-deps-in-static-lib.patch
|
|
87534e7b5ad7365509eab75629e6bd1a9ed61ee92f7e358405a0abaf0df57de14623fb3894eb082f8785422e5c087e1c50f9e2e5cafbb2529591fd7bf447f7f5 signal-desktop
|
|
"
|