aboutsummaryrefslogtreecommitdiffstats
path: root/community/qt5-qtbase/APKBUILD
blob: 77284049d6c33e89c19e6569978e16da4bab7fa7 (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
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtbase
pkgver=5.15.6_git20221010
pkgrel=1
_commit="23996edc504e9e5b5b0ec907380598bbe4bf591c"
pkgdesc="Qt5 - QtBase components"
url="https://qt.io/developers/"
arch="all"
license="LGPL-2.1-only AND LGPL-3.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
_sub="$pkgname-sqlite $pkgname-odbc $pkgname-postgresql
	$pkgname-mysql $pkgname-tds $pkgname-x11"
# icu-data-full: see https://gitlab.alpinelinux.org/alpine/aports/-/issues/13814
depends="icu-data-full"
depends_dev="$_sub
	dbus-dev
	fontconfig-dev
	freetype-dev
	glib-dev
	libice-dev
	libpng-dev
	libsm-dev
	libx11-dev
	libxext-dev
	mesa-dev
	openssl-dev>3
	perl
	sqlite-dev
	zlib-dev
	"
makedepends="$depends_dev
	at-spi2-core-dev
	bison
	cups-dev
	eudev-dev
	flex
	freetds-dev
	gawk
	gperf
	gtk+3.0-dev
	hicolor-icon-theme
	icu-dev
	libinput-dev
	libjpeg-turbo-dev
	libpq-dev
	libxi-dev
	libxkbcommon-dev
	libxrandr-dev
	libxrender-dev
	libxslt-dev
	libxv-dev
	mariadb-connector-c-dev
	mariadb-dev
	mtdev-dev
	pcre2-dev
	unixodbc-dev
	vulkan-headers
	xcb-util-dev
	xcb-util-image-dev
	xcb-util-keysyms-dev
	xcb-util-renderutil-dev
	xcb-util-wm-dev
	xdg-utils
	"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $_sub"
provides="qtbase=$pkgver-r$pkgrel"
builddir="$srcdir/qtbase-$_commit"

# temp allow textrels on riscv64
[ "$CARCH" = "riscv64" ] && options="$options textrels"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://dev.alpinelinux.org/archive/qt/qtbase-$_commit.tar.xz
	qt-musl-iconv-no-bom.patch
	qt5-base-cflags.patch
	qt5-base-nostrip.patch
	"

_qt5_prefix=/usr/lib/qt5
_qt5_datadir=/usr/share/qt5

case "$CTARGET_ARCH" in
	arm*|aarch64) _opengl="-opengl es2";;
	*) _opengl="-opengl";;
esac

case "$CTARGET_ARCH" in
	x86) _no_sse2=-no-sse2 ;;
	*) _no_sse2= ;;
esac

# secfixes:
#   5.15.0-r2:
#     - CVE-2020-17507

_disturl="dev.alpinelinux.org:/archive/qt/"
snapshot() {
	clean
	deps
	mkdir -p "$srcdir" && cd "$srcdir"
	git clone https://invent.kde.org/qt/qt/qtbase.git && cd qtbase
	git archive --format tar --prefix=qtbase-$_commit/ $_commit | xz -T0 -9 -vv - > $SRCDEST/qtbase-$_commit.tar.xz
	rsync --progress -La $SRCDEST/qtbase-$_commit.tar.xz $_disturl
}

prepare() {
	default_prepare

	sed -i -e "s|-O3|$CXXFLAGS|" \
		-e "/^QMAKE_RPATH/s| -Wl,-rpath,||g" \
		-e "/^QMAKE_LFLAGS\s/s|+=|+= $LDFLAGS|g" \
		mkspecs/common/*.conf

	# Make configure think we are running in a git directory
	# This makes it symlink the include files to the right directory
	mkdir .git
}

build() {
	./configure -confirm-license -opensource \
		-archdatadir "$_qt5_prefix" \
		-bindir  "$_qt5_prefix"/bin \
		-datadir "$_qt5_datadir" \
		-dbus-linked \
		-docdir /usr/share/doc/qt5 \
		-examplesdir /usr/share/doc/qt5/examples \
		-glib \
		-headerdir /usr/include/qt5 \
		-icu \
		-importdir "$_qt5_prefix"/imports \
		-libexecdir "$_qt5_prefix"/libexec \
		-no-rpath \
		-no-separate-debug-info \
		-no-pch \
		-nomake examples \
		$_opengl \
		-openssl-linked \
		-optimized-qmake \
		-plugin-sql-mysql \
		-plugin-sql-odbc \
		-plugin-sql-psql \
		-plugin-sql-sqlite \
		-plugin-sql-tds \
		-plugindir "$_qt5_prefix"/plugins \
		-prefix /usr \
		-sysconfdir /etc/xdg \
		-system-libjpeg \
		-system-libpng \
		-system-pcre \
		-system-sqlite \
		-system-zlib \
		-translationdir "$_qt5_datadir"/translations \
		-no-reduce-relocations \
		$_no_sse2
	# significantly reduce debug symbol size
	CFLAGS="$CFLAGS -g1" CXXFLAGS="$CXXFLAGS -g1" \
	make
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	mkdir -p "$pkgdir"/usr/bin/
	for i in "$pkgdir"/"$_qt5_prefix"/bin/*; do
		_name=${i##*/}
		case $_name in
		*.*)	_dest="$pkgdir"/usr/bin/${_name%.*}-qt5.${_name##*.};;
		*)	_dest="$pkgdir"/usr/bin/${_name%.*}-qt5;;
		esac
		ln -s ../lib/qt5/bin/"$_name" "$_dest"
	done

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
}

dev() {
	amove \
		usr/lib/qt5/mkspecs \
		usr/lib/cmake \
		usr/lib/qt5/bin \
		usr/bin
	cd "$pkgdir"
	find usr/ -name '*.prl' | while read -r i; do
		amove "$i"
	done

	default_dev
}

sqlite() {
	pkgdesc="SQLite driver for Qt5's SQL classes"
	depends=""

	amove usr/lib/qt5/plugins/sqldrivers/libqsqlite*
}

odbc() {
	pkgdesc="ODBC driver for Qt5's SQL classes"
	depends=""

	amove usr/lib/qt5/plugins/sqldrivers/libqsqlodbc*
}

postgresql() {
	pkgdesc="PostgreSQL driver for Qt5's SQL classes"
	depends=""

	amove usr/lib/qt5/plugins/sqldrivers/libqsqlpsql*
}

mysql() {
	pkgdesc="MySQL driver for Qt5's SQL classes"
	depends=""

	amove usr/lib/qt5/plugins/sqldrivers/libqsqlmysql*
}

tds() {
	pkgdesc="TDS driver for Qt5's SQL classes"
	depends=""

	amove usr/lib/qt5/plugins/sqldrivers/libqsqltds*
}

x11() {
	pkgdesc="Qt5 GUI-related libraries"
	depends="hicolor-icon-theme xdg-utils"

	amove \
		usr/lib/libQt5EglFSDeviceIntegration.so.* \
		usr/lib/libQt5EglFsKmsSupport.so.* \
		usr/lib/libQt5Gui.so.* \
		usr/lib/libQt5OpenGL.so.* \
		usr/lib/libQt5PrintSupport.so.* \
		usr/lib/libQt5Widgets.so.* \
		usr/lib/libQt5XcbQpa.so.* \
		usr/lib/qt5/plugins/egldeviceintegrations \
		usr/lib/qt5/plugins/generic \
		usr/lib/qt5/plugins/image* \
		usr/lib/qt5/plugins/platform* \
		usr/lib/qt5/plugins/printsupport* \
		usr/lib/qt5/plugins/xcbglintegrations

	scanelf -Rn "$pkgdir"/usr/ | grep -E '(libX|libQt5Gui|libGL)' && return 1
	return 0
}

sha512sums="
bc35125de23dc68b7a8877816938dc0e4219d82673cbcf7ac24d04e355bd60d5d14f3f9b79ae764240849d35e91148c7a9f8ab8f82d883132b9e2c106e8c4f68  qtbase-23996edc504e9e5b5b0ec907380598bbe4bf591c.tar.xz
7d68421a14f0259535c977d8a521c98918193c107b76ac664571b12f5b0d7588a0d0e1297af412a26753a393b21f3f44c3274fa8ab5bc87f03705a3a03acb444  qt-musl-iconv-no-bom.patch
fa3dddfe42b7f0ade45bd0530badfc3a3800adbd3798bd814597527713c9fe360a242f7cf39312f4cc3c88e9bd7aba233bd6674c0fc78e694a1fd868474c4240  qt5-base-cflags.patch
af061bb56d5079d11407e6eb352fa4af7fefa6aed7f8cc40b5b2d591ef7ff04e9da6c6d534ca1904355ea7552951a1610fdcefb04ef9d696cb2b23ad6a0606e8  qt5-base-nostrip.patch
"