summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4b0b48573c3de946a5a7070712035ffb4a9eef3f (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
# Maintainer: texas0295 <texas0295@outlook.com>

_reponame="Solian"
pkgname=solian-git
pkgver=r2940.acde0de6
pkgrel=1
pkgdesc="Next Generation Network Center (unstable)"
arch=('x86_64')
url="https://solsynth.dev"
license=('AGPL3')

depends=(
  'gtk3'
  'libnotify'
  'gstreamer'
  'libayatana-appindicator'
  'libayatana-indicator'
  'libkeybinder3'
  'mpv'
  'libsecret'
  'libpdfium-nojs'
  'icu76'
)

makedepends=(
  'git'
  'unzip'
  'xz'
  'clang'
  'cmake'
  'ninja'
)

provides=('solian')
conflicts=('solian' 'solian-bin' 'solian-bin-git')

source=(
    "git+https://github.com/Solsynth/${_reponame}.git"
    "icon-padded.png"
)

sha256sums=(
    'SKIP'
    '448670e6164b577892733ebdd267830e21509136175df35abb87717d14a63a05'
)

options=('!debug')

_binname="island"

_flutter_ver=3.44.1
_flutter_repo=https://github.com/flutter/flutter.git

pkgver() {
  cd "$srcdir/$_reponame"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir"

  if [[ ! -d flutter-sdk ]]; then
    git clone --depth=1 -b "$_flutter_ver" "$_flutter_repo" flutter-sdk
  else
    pushd flutter-sdk >/dev/null
    git fetch --depth=1 origin "refs/tags/$_flutter_ver:refs/tags/$_flutter_ver" || true
    git checkout -f "tags/$_flutter_ver" || git checkout -f "$_flutter_ver"
    popd >/dev/null
  fi

  cd "$srcdir/$_reponame"
  git submodule update --init --recursive
}

build() {
  export PUB_CACHE="$srcdir/.pub_cache"
  export PATH="$srcdir/flutter-sdk/bin:$PATH"
  export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
  export CFLAGS="${CFLAGS} -Wno-error"
  export CXXFLAGS="${CXXFLAGS} -Wno-error"

  cd "$srcdir/$_reponame"

  # build isolated quickjs bridge
  cmake -B build_qjs -S linux/third_party/quickjs_c_bridge/linux/ -DCMAKE_BUILD_TYPE=Release
  cmake --build build_qjs

  flutter precache --linux
  flutter pub get

  # patch libwebrtc
  echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include stdint.h")' >> linux/flutter/ephemeral/.plugin_symlinks/flutter_webrtc/linux/CMakeLists.txt

  dart run build_runner build --delete-conflicting-outputs
  flutter build linux --no-pub --release

  # override flawed prebuilt binary
  cp build_qjs/libquickjs_c_bridge_plugin.so build/linux/x64/release/bundle/lib/
}

package() {
  install -dm755 "$pkgdir/usr/share/icons/hicolor/256x256/apps"
  install -Dm644 "icon-padded.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/solian.png"

  cd "$srcdir/$_reponame"

  install -dm755 "$pkgdir/usr/lib/solian"
  cp -r build/linux/x64/release/bundle/* "$pkgdir/usr/lib/solian/"

  install -Dm755 /dev/stdin "$pkgdir/usr/bin/solian" << 'EOF'
#!/bin/sh
cd /usr/lib/solian
exec ./island "$@"
EOF

  install -dm755 "$pkgdir/usr/share/applications"
  cat > "$pkgdir/usr/share/applications/solian.desktop" << 'EOF'
[Desktop Entry]
Type=Application
Version=1.0
Name=Solian
Comment=Next Generation Network Center (unstable)
Exec=solian %u
Icon=solian
Terminal=false
Categories=Network;InstantMessaging;
EOF

  install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}