blob: 1b610f47a36c78e202429364a7e68b17bbcdf5ff (
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
|
# Maintainer:
# Contributor: Javier TiĆ” <javier dot tia at gmail dot com>
# options
: ${_commit:=2d111f2f346b974cf86dcd9de0738e81e017c07f} # 2024.8.2.r4
: ${_install_path:=usr/lib}
# basic info
_pkgname="sourcetrail"
pkgname="$_pkgname"
pkgver=2024.8.2
pkgrel=1
pkgdesc='Interactive source explorer for C/C++ and Java'
url='https://github.com/xiota/sourcetrail'
license=('GPL-3.0-only')
arch=('x86_64')
depends=(
"clang"
"llvm-libs"
'boost-libs'
'qt6-5compat'
'qt6-base'
'qt6-svg'
'sqlite'
'tinyxml'
)
makedepends=(
"llvm"
"lld"
'boost'
'cmake'
'git'
'jdk-openjdk'
'maven'
'ninja'
'imagemagick'
'patchelf'
)
optdepends=(
'java-runtime'
'python'
)
_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git#commit=$_commit")
sha256sums=('SKIP')
prepare() {
magick "$_pkgsrc/bin/app/data/gui/icon/logo_1024_1024.png" -resize 256x256 "$_pkgname.png"
}
build() {
export CC=clang
export CXX=clang++
export LDFLAGS+=" -fuse-ld=lld"
#export Clang_DIR="/usr/lib/cmake/clang"
#export LLVM_DIR="/usr/lib/cmake/llvm"
local _cmake_options=(
-B build
-S "$_pkgsrc"
-G Ninja
-DCMAKE_BUILD_TYPE="Release"
-DCMAKE_INSTALL_PREFIX='/usr'
-DBUILD_CXX_LANGUAGE_PACKAGE=ON
-DBUILD_JAVA_LANGUAGE_PACKAGE=ON
-DBUILD_PYTHON_LANGUAGE_PACKAGE=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_VERBOSE_MAKEFILE=OFF
-Wno-dev
)
cmake "${_cmake_options[@]}"
cmake --build build
}
package() {
# binaries
install -Dm755 "build/app/sourcetrail_indexer" -t "$pkgdir/$_install_path/$_pkgname/"
install -Dm755 "build/app/Sourcetrail" "$pkgdir/$_install_path/$_pkgname/$_pkgname"
patchelf --add-rpath "/$_install_path/sourcetrail" "$pkgdir/$_install_path/$_pkgname/$_pkgname"
# data
local _data_path="$pkgdir/$_install_path/$_pkgname/data"
install -dm755 "$_data_path"
for i in color_schemes fallback fonts gui java license syntax_highlighting_rules; do
cp -a "$_pkgsrc/bin/app/data/$i" "$_data_path/"
done
# languages
for i in cxx java python; do
cp -a "build/app/data/$i" "$_data_path/"
done
# examples
cp -a "$_pkgsrc"/bin/app/user/projects "$_data_path/fallback/"
# icon
install -Dm644 "$_pkgname.png" "$pkgdir/usr/share/pixmaps/$_pkgname.png"
# desktop file
install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/$_pkgname.desktop" << END
[Desktop Entry]
Type=Application
Name=${_pkgname^}
Comment=$pkgdesc
Exec=$_pkgname
Icon=$_pkgname
Terminal=false
StartupNotify=true
Categories=Development;
MimeType=application/x-sourcetrail;
END
# script
install -Dm755 /dev/stdin "$pkgdir/usr/bin/$_pkgname" << END
#!/usr/bin/env bash
: \${XDG_CONFIG_HOME:=\$HOME/.config}
SOURCETRAIL_PATH=/$_install_path/$_pkgname
CONFIG_PATH="\$XDG_CONFIG_HOME/Sourcetrail"
if [ ! -e "\$CONFIG_PATH" ]; then
mkdir -p "\$CONFIG_PATH"
cp --reflink=auto -r "\$SOURCETRAIL_PATH/data/fallback"/* "\$CONFIG_PATH/"
fi
export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb:\$QT_XKB_CONFIG_ROOT"
export QT_QPA_FONTDIR="\$SOURCETRAIL_PATH/data/fonts:\$QT_QPA_FONTDIR"
export SOURCETRAIL_VIA_SCRIPT=1
export OPENSSL_CONF=/etc/ssl/
exec \$SOURCETRAIL_PATH/$_pkgname "\$@"
END
# fix permissions
chmod -R u+rwX,go+rX,go-w "$pkgdir/"
}
|