summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f717319642f6d372cf23f1651e5e68a9395ff3eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Maintainer: Revincx <revincx233@gmail.com>

pkgname=yukigram-rua
pkgver=6.9.3
pkgrel=1
pkgdesc='Yet another unofficial tdesktop client, but forked from yukigram'
arch=('x86_64')
url="https://github.com/Revincx/Yukigram"
license=('GPL3')
provides=('yukigram-desktop')
conflicts=('yukigram-desktop')
depends=(
    'abseil-cpp'
    'ada'
    'ffmpeg'
    'glib2'
    'hicolor-icon-theme'
    'hunspell'
    'kcoreaddons'
    'libavif'
    'libheif'
    'libjxl'
    'libstdc++'
    'libxcomposite'
    'libxdamage'
    'libxrandr'
    'libxtst'
    'lz4'
    'minizip'
    'zlib'
    'glibc'
    'libgcc'
    'openal'
    'openh264'
    'openssl'
    'pipewire'
    'protobuf'
    'qt6-imageformats'
    'qt6-svg'
    'qt6-wayland'
    'rnnoise'
    'xxhash'
)
makedepends=('cmake' 'boost' 'boost-libs' 'git' 'ninja' 'python' 'range-v3' 'microsoft-gsl' 'ccache'
             'libtg_owt' 'gobject-introspection' 'fmt' 'glib2-devel' 'gperf')
optdepends=('geoclue: geoinformation support'
            'geocode-glib-2: geocoding support'
            'webkit2gtk: embedded browser features'
            'xdg-desktop-portal: desktop integration')

_source="https://github.com/Revincx/Yukigram.git"

source=("$pkgname::git+$_source#tag=$pkgver-$pkgrel")

_source_tdlib() {
  _pkgsrc_tdlib="telegram-tdlib"
  source+=("$_pkgsrc_tdlib"::"git+https://github.com/tdlib/td.git")
  sha256sums+=('SKIP')
}

sha256sums=('SKIP')

_source_tdlib

prepare() {
    cd "$pkgname"
    git reset --hard $HEAD
    export __SOURCE_DIR=$_source_dir

    git submodule update --init --recursive --force
}

bail() {
    echo "$@"
    exit 1
}

validate_api() {

    # Use the default API_ID and API_HASH from Telegram snap builds
    # ref: https://gitlab.archlinux.org/archlinux/packaging/packages/telegram-desktop/-/blob/main/PKGBUILD#L98

    export API_ID=${API_ID:-"611335"}
    export API_HASH=${API_HASH:-"d524b414d21f4d37f08684c1df41ac9c"}

    [[ "$API_ID" =~ ^[1-9][0-9]*$ ]] || bail "API_ID must be a positive number"
    [[ "$API_HASH" =~ ^[0-9a-f]{32}$ ]] || bail "API_HASH must contain 32 hex digits [0-9a-f]"
}

build() {
    validate_api

    CXXFLAGS+=' -ffat-lto-objects'

    echo "Building tde2e..."

    cmake -B "build_tde2e" \
        -S "$_pkgsrc_tdlib" \
        -G Ninja \
        -DCMAKE_BUILD_TYPE=None \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DTD_E2E_ONLY=ON \
        -DBUILD_SHARED_LIBS=OFF \
        -DBUILD_TESTING=OFF \
        -Wno-dev

    cmake --build "build_tde2e"
    DESTDIR="$srcdir/deps" cmake --install "build_tde2e"

    echo "Building yukigram..."
    cmake -B build \
        -S $pkgname \
        -G Ninja \
        -D CMAKE_INSTALL_PREFIX="/usr" \
        -D CMAKE_PREFIX_PATH="$srcdir/deps/usr" \
        -D CMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
        -D CMAKE_EXE_LINKER_FLAGS="-Wl,--copy-dt-needed-entries" \
        -D TDESKTOP_API_ID="$API_ID" \
        -D TDESKTOP_API_HASH="$API_HASH" \
        -D DESKTOP_APP_DISABLE_AUTOUPDATE=ON \
        -Wno-dev
    
    cmake --build build --config Release --parallel
}

package() {
    DESTDIR="$pkgdir" cmake --install build
}

# Based on https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=telegram-desktop-userfonts (commit 9ce5fd07)
# fix-lzma.patch took from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=64gram-desktop (commit 2f6d1aeb)