summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5933ccef58241d219b7334e7acda1e6d20d8a8ea (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# Maintainer:
# Contributor: sehraf

## links
# http://retroshare.cc/
# https://github.com/retroshare/retroshare

## options
# whether to build and install plugins
: ${_plugin_feedreader:=false}
: ${_plugin_voip:=false} # currently broken

# whether to enable automatically generated json api
: ${_jsonapi:=false}

# whether to enable auto login
: ${_autologin:=false}

# whether to enable native (system) dialogs
: ${_nativ_dialogs:=true}

# whether to enable wiki functionality (experimental)
: ${_wiki:=false}

# whether to compile with clang (experimental)
: ${_clang:=false}

# others
: ${_commit:=64f4d84e7407581808875ef93340ddadf976114e} # 0.6.7.2r133

## basic info
_pkgname="retroshare"
pkgname="$_pkgname"
pkgver=0.6.7.2
pkgrel=2
pkgdesc="Serverless encrypted instant messenger with filesharing, chatgroups, e-mail"
url="https://github.com/retroshare/retroshare"
license=('AGPL-3.0-or-later')
arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')

depends=(
  'libxss'
  'miniupnpc'
  'qt5-multimedia'
  'qt5-x11extras'
  'sqlcipher'
)
makedepends=(
  'cmake'
  'git'
  'qt5-tools'
  'rapidjson'
)
optdepends=(
  'tor: tor hidden node support'
  'i2p: i2p hidden node support'
  'i2pd: i2p hidden node support'
)

# Add extra dependencies
if [[ "${_plugin_voip::1}" =~ 't|y|1' ]]; then
  depends+=('ffmpeg' 'opencv3-opt')
fi

if [[ "${_plugin_feedreader::1}" =~ 't|y|1' ]]; then
  depends+=('curl' 'libxslt')
fi

if [[ "${_jsonapi::1}" =~ 't|y|1' ]]; then
  makedepends+=('doxygen')
fi

if [[ "${_clang::1}" =~ 't|y|1' ]]; then
  makedepends+=('clang')
fi

if [[ "${_autologin::1}" =~ 't|y|1' ]]; then
  depends+=('libsecret')
fi

_source_main() {
  _pkgsrc="$_pkgname"
  source=("$_pkgsrc"::"git+$url.git#commit=$_commit")
  sha256sums=('SKIP')
}

_source_retroshare() {
  source+=(
    'retroshare.openpgp-sdk'::'git+https://github.com/RetroShare/OpenPGP-SDK.git'
    'retroshare.bitdht'::'git+https://github.com/RetroShare/BitDHT.git'

    'commonmark.cmark'::'git+https://github.com/commonmark/cmark.git'
    'corvusoft.restbed'::'git+https://github.com/Corvusoft/restbed.git'
    'i2p.libsam3'::'git+https://github.com/i2p/libsam3.git'
    'retroshare.jni.hpp'::'git+https://github.com/RetroShare/jni.hpp.git'
    'retroshare.libretroshare'::'git+https://github.com/RetroShare/libretroshare.git'
    'retroshare.obs'::'git+https://github.com/RetroShare/OBS.git'
    'retroshare.rsnewwebui'::'git+https://github.com/RetroShare/RSNewWebUI.git'
    'tencent.rapidjson'::'git+https://github.com/Tencent/rapidjson.git'
    'truvorskameikin.udp-discovery-cpp'::'git+https://github.com/truvorskameikin/udp-discovery-cpp.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'

    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
  )
}

_source_rapidjson() {
  source+=(
    'google.googletest'::'git+https://github.com/google/googletest.git'
  )
  sha256sums+=(
    'SKIP'
  )
}

_source_restbed() {
  source+=(
    'corvusoft.asio-dependency'::'git+https://github.com/corvusoft/asio-dependency.git'
    'corvusoft.catch-dependency'::'git+https://github.com/corvusoft/catch-dependency.git'
    'corvusoft.openssl-dependency'::'git+https://github.com/corvusoft/openssl-dependency.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'
    'SKIP'
  )
}

_prepare_retroshare() (
  cd "${srcdir:?}/$_pkgsrc"
  local _submodules=(
    'retroshare.openpgp-sdk'::'openpgpsdk'
    'retroshare.bitdht'::'libbitdht'

    'commonmark.cmark'::'supportlibs/cmark'
    'corvusoft.restbed'::'supportlibs/restbed'
    'i2p.libsam3'::'supportlibs/libsam3'
    'retroshare.jni.hpp'::'supportlibs/jni.hpp'
    'retroshare.libretroshare'::'libretroshare'
    'retroshare.obs'::'build_scripts/OBS'
    'retroshare.rsnewwebui'::'retroshare-webui'
    'tencent.rapidjson'::'supportlibs/rapidjson'
    'truvorskameikin.udp-discovery-cpp'::'supportlibs/udp-discovery-cpp'
  )
  _submodule_update
)

_prepare_rapidjson() (
  cd "${srcdir:?}/$_pkgsrc"
  cd "supportlibs/rapidjson"
  local _submodules=(
    'google.googletest'::'thirdparty/gtest'
  )
  _submodule_update
)

_prepare_restbed() (
  cd "${srcdir:?}/$_pkgsrc"
  cd "supportlibs/restbed"
  local _submodules=(
    'corvusoft.asio-dependency'::'dependency/asio'
    'corvusoft.catch-dependency'::'dependency/catch'
    'corvusoft.openssl-dependency'::'dependency/openssl'
  )
  _submodule_update
)

_source_main

_source_retroshare
_source_rapidjson
_source_restbed

prepare() {
  _submodule_update() {
    local _module
    for _module in "${_submodules[@]}"; do
      git submodule init "${_module##*::}"
      git submodule set-url "${_module##*::}" "$srcdir/${_module%::*}"
      git -c protocol.file.allow=always submodule update "${_module##*::}"
    done
  }

  _prepare_retroshare
  _prepare_rapidjson
  _prepare_restbed

  # fix miniupnpc
  git -C "$_pkgsrc/libretroshare" checkout -f c54e0266e4483797c1d6bacee6f563979d683464
}

build() {
  cd "$_pkgsrc"

  # remove unwanted plugins
  if [[ ! "${_plugin_voip::1}" =~ 't|y|!' ]]; then
    sed -i '/VOIP \\/d' plugins/plugins.pro
  fi
  if [[ ! "$_plugin_feedreader" =~ 't|y|1' ]]; then
    sed -i '/FeedReader/d' plugins/plugins.pro
  fi

  local _qmake_options=(
    CONFIG-=debug
    CONFIG+=release
  )

  if [[ "${_jsonapi::1}" =~ 't|y|1' ]]; then
    _qmake_options+=(
      CONFIG+=rs_jsonapi
    )
  fi

  if [[ "${_clang::1}" =~ 't|y|1' ]]; then
    _qmake_options+=(
      -spec linux-clang
      CONFIG+=c++11
    )
  fi

  if [[ "${_autologin::1}" =~ 't|y|1' ]]; then
    _qmake_options+=(
      CONFIG+=rs_autologin
    )
  fi

  if [[ "${_nativ_dialogs::1}" =~ 't|y|1' ]]; then
    _qmake_options+=(
      CONFIG+=rs_use_native_dialogs
    )
  fi

  if [[ "${_plugin_voip::1}" =~ 't|y|1' ]] || [[ "${_plugin_feedreader::1}" =~ 't|y|1' ]]; then
    _qmake_options+=(
      CONFIG+=retroshare_plugins
    )
  fi

  if [[ "${_wiki::1}" =~ 't|y|1' ]]; then
    _qmake_options+=(
      CONFIG+=wikipoos
    )
  fi

  qmake_options+=(
    RS_UPNP_LIB="miniupnpc"
    CONFIG+=no_rs_friendserver
    QMAKE_CFLAGS_RELEASE="${CFLAGS}"
    QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}"
    RetroShare.pro
  )

  qmake "${_qmake_options[@]}"

  make || true
  rmdir supportlibs/restbed/include || true
  make
}

package() {
  cd "$_pkgsrc"
  make INSTALL_ROOT="$pkgdir" install
}