Diff qt-docs-5.15.2_p202011130614 with a qt-docs-6.5.2_p202307080352

/usr/portage/dev-qt/qt-docs/qt-docs-6.5.2_p202307080352.ebuild 2023-10-09 14:52:30.408368373 +0300
1
# Copyright 1999-2023 Gentoo Authors
1
# Copyright 2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=8
5 5

  
6 6
inherit unpacker
7 7

  
8
PV_FULL=${PV/_p/-0-}
9
PV_NODOTS=$(ver_rs 1-3 '' ${PV%_p*})
10
BASE_URI="https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/qt5_${PV_NODOTS}_src_doc_examples/qt.qt5.${PV_NODOTS}.doc"
11

  
12
declare -A QT5_DOCS=(
13
	[3d]="qt3d"
14
	[assistant]="qtassistant"
15
	[bluetooth]="qtbluetooth"
16
	[concurrent]="qtconcurrent"
17
	[dbus]="qtdbus"
18
	[declarative]="qtqml qtqmltest qtquick qtquickdialogs qtquickextras"
19
	[designer]="qtdesigner qtuitools"
20
	[gamepad]="qtgamepad"
21
	[graphicaleffects]="qtgraphicaleffects"
22
	[gui]="qtgui qtplatformheaders"
23
	[help]="qthelp"
24
	[imageformats]="qtimageformats"
25
	[linguist]="qtlinguist"
26
	[location]="qtlocation"
27
	[multimedia]="qtmultimedia"
28
	[network]="qtnetwork"
29
	[opengl]="qtopengl"
30
	[positioning]="qtpositioning"
31
	[printsupport]="qtprintsupport"
32
	[qdoc]="qdoc"
33
	[quickcontrols2]="qtquickcontrols"
34
	[quickcontrols]="qtquickcontrols1"
35
	[scxml]="qtscxml"
36
	[sensors]="qtsensors"
37
	[serialbus]="qtserialbus"
38
	[serialport]="qtserialport"
39
	[speech]="qtspeech"
40
	[sql]="qtsql"
41
	[svg]="qtsvg"
42
	[test]="qttestlib"
43
	[wayland]="qtwaylandcompositor"
44
	[webchannel]="qtwebchannel"
45
	[websockets]="qtwebsockets"
46
	[webview]="qtwebview"
47
	[widgets]="qtwidgets"
48
	[x11extras]="qtx11extras"
49
	[xml]="qtxml"
50
	[xmlpatterns]="qtxmlpatterns"
51
)
52

  
53
DESCRIPTION="Qt5 documentation, for use with Qt Creator and other tools"
8
DESCRIPTION="Qt6 documentation and examples for Qt Creator and other tools"
54 9
HOMEPAGE="https://doc.qt.io/"
55 10

  
56 11
LICENSE="FDL-1.3"
57
SLOT="5"
58
KEYWORDS="amd64 arm arm64 ~ppc ppc64 ~riscv x86"
59

  
60
IUSE="charts datavis +html networkauth +qch script timeline virtualkeyboard webengine"
61
REQUIRED_USE="|| ( html qch )"
12
SLOT="6"
13
KEYWORDS="amd64"
14
IUSE="+examples +html +qch"
15
REQUIRED_USE="|| ( examples html qch )"
62 16

  
63
SRC_URI="
64
	${BASE_URI}/${PV_FULL}qmake-documentation.7z
65
	${BASE_URI}/${PV_FULL}qtcore-documentation.7z
66
	${BASE_URI}/${PV_FULL}qtdoc-documentation.7z
67
	charts? ( ${BASE_URI}.qtcharts/${PV_FULL}qtcharts-documentation.7z )
68
	datavis? ( ${BASE_URI}.qtdatavis3d/${PV_FULL}qtdatavisualization-documentation.7z )
69
	networkauth? ( ${BASE_URI}.qtnetworkauth/${PV_FULL}qtnetworkauth-documentation.7z )
70
	script? ( ${BASE_URI}.qtscript/${PV_FULL}qtscript-documentation.7z
71
		${BASE_URI}.qtscript/${PV_FULL}qtscripttools-documentation.7z )
72
	timeline? ( ${BASE_URI}.qtquicktimeline/${PV_FULL}qtquicktimeline-documentation.7z )
73
	virtualkeyboard? ( ${BASE_URI}.qtvirtualkeyboard/${PV_FULL}qtvirtualkeyboard-documentation.7z )
74
	webengine? ( ${BASE_URI}.qtwebengine/${PV_FULL}qtwebengine-documentation.7z )
17
BDEPEND="
18
	examples? (
19
		$(unpacker_src_uri_depends .7z)
20
		media-libs/libpng
21
	)
75 22
"
76 23

  
77
for DOCUSE in ${!QT5_DOCS[@]}; do
78
	IUSE+=" +${DOCUSE}"
79
	for DOCTAR in ${QT5_DOCS[${DOCUSE}]}; do
80
		SRC_URI+=" ${DOCUSE}? ( ${BASE_URI}/${PV_FULL}${DOCTAR}-documentation.7z )"
24
qt6_docs_generate_metadata() {
25
	local qtver=${PV%%_p*}
26
	local prefix=${qtver}-0-${PV##*_p}
27
	local doc_suffix=-documentation.tar.xz
28
	local exa_suffix=-examples-${qtver}.7z
29
	local baseuri=https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/qt6_${qtver//.}_src_doc_examples/qt.qt6.${qtver//.}
30
	SRC_URI=
31
	S=${WORKDIR}
32

  
33
	# Bumping involves diff'ing the unversioned *_src_doc_examples/*/ files
34
	# list from old version to the new for -documentation and -examples
35
	# files, then adding/removing entries if anything changed.
36
	#
37
	# Format: [+-%]<USE>[</|^><package>[!|:]][="<module> ..."]
38
	#  -    [+-%]<USE>: enable(+), disable(-), or no IUSE(%)
39
	#          (should disable if associated package is not in tree)
40
	#  -    /<package>: qt.qt6.*.examples.<package>/*-<package>-examples*
41
	#  -    ^<package>: qt.qt6.*.examples/*-<package>-examples.7z
42
	#  -      <module>: qt.qt6.*.doc.<package>/*-<module>-documentation*
43
	#          (if <module> is unspecified, defaults to <package>)
44
	#  - <package>[!:]: only has examples(!) or documentation(:)
45
	# Note: sub-300 bytes examples archives are empty, can be skipped
46
	local map=(
47
		# map with (non-split) Qt6 packages rather than per-module
48
		%base^qtbase="
49
			qmake qtcmake qtconcurrent qtcore qtdbus
50
			qtgui qtnetwork qtopengl qtplatformintegration
51
			qtprintsupport qtsql qttestlib qtwidgets qtxml
52
		"
53
		+3d/qt3d
54
		-activeqt/qtactiveqt="activeqt"
55
		+charts/qtcharts
56
		+connectivity/qtbluetooth:
57
		+connectivity/qtconnectivity!
58
		+connectivity/qtnfc:
59
		-datavis/qtdatavis3d
60
		+declarative^qtdeclarative="
61
			qtlabsplatform qtqml qtqmlcore qtqmlmodels
62
			qtqmltest qtqmlworkerscript qtqmlxmllistmodel
63
			qtquick qtquickcontrols qtquickdialogs
64
		"
65
		%doc^qtdoc
66
		-grpc/qtgrpc="qtprotobuf"
67
		-httpserver/qthttpserver
68
		+imageformats/qtimageformats: # empty examples
69
#		-languageserver/qtlanguageserver # docs and examples are empty
70
		+location/qtlocation
71
		-lottie/qtlottie:="qtlottieanimation" # empty examples
72
		+multimedia/qtmultimedia
73
		+networkauth/qtnetworkauth
74
		+positioning/qtpositioning
75
		+qt5compat/qt5compat="qtcore5compat qtgraphicaleffects5compat"
76
#		+qt5="qt5" # already installed by qtbase (conflicts)
77
		-quick3dphysics/qtquick3dphysics
78
		+quick3d/qtquick3d
79
#		-quickeffectmaker/qtquickeffectmaker! # missing examples-manifest?
80
		-remoteobjects/qtremoteobjects
81
		+scxml/qtscxml
82
		+sensors/qtsensors
83
		-serialbus/qtserialbus
84
		+serialport/qtserialport
85
		+shadertools/qtshadertools: # empty examples
86
		+speech/qtspeech="qttexttospeech"
87
		+svg^qtsvg
88
		+timeline/qtquicktimeline:
89
		+tools^qttools="
90
			qdoc qtassistant qtdesigner qtdistancefieldgenerator
91
			qthelp qtlinguist qtuitools
92
		"
93
		+virtualkeyboard/qtvirtualkeyboard
94
		+wayland^qtwayland="qtwaylandcompositor"
95
		+webchannel/qtwebchannel
96
		+webengine/qtpdf:
97
		+webengine/qtwebengine
98
		+websockets/qtwebsockets
99
		-webview/qtwebview
100
	)
101

  
102
	local entry operator use subdir package exception modules uris
103
	local -A iuse
104
	for entry in "${map[@]}"; do
105
		[[ ${entry} =~ ^([%+-])([^/^!:=]+)([/^])?([^!:=]+)?([!:])?=?(.+)? ]] # || die
106
		operator=${BASH_REMATCH[1]#-}
107
		use=${BASH_REMATCH[2]}
108
		subdir=${BASH_REMATCH[3]}
109
		package=${BASH_REMATCH[4]}
110
		exception=${BASH_REMATCH[5]}
111
		modules=${BASH_REMATCH[6]:-${package}}
112

  
113
		[[ ${subdir} == / ]] && subdir=.${package} || subdir=
114

  
115
		[[ ${exception} == ! ]] ||
116
			printf -v uris "${baseuri}.doc${subdir}/${prefix}%s${doc_suffix} " \
117
				${modules}
118
		[[ ${exception} == : ]] ||
119
			uris+=" examples? ( ${baseuri}.examples${subdir}/${prefix}${package}${exa_suffix} )"
120

  
121
		if [[ ${operator} == % ]]; then
122
			SRC_URI+=" ${uris}"
123
		else
124
			iuse[${operator}${use}]= # avoid duplicates
125
			SRC_URI+=" ${use}? ( ${uris} )"
126
		fi
81 127
	done
82
done
83
unset DOCTAR DOCUSE
84

  
85
S=${WORKDIR}/Docs/Qt-${PV%_p*}
86

  
87
BDEPEND="
88
	$(unpacker_src_uri_depends .7z)
89
	media-libs/libpng:0
90
"
128
	IUSE+=" ${!iuse[*]}"
129
}
130
qt6_docs_generate_metadata
91 131

  
92 132
src_prepare() {
93 133
	default
94 134

  
95
	# Fix broken png file, bug 679146
96
	local png=qtdoc/images/used-in-examples/demos/tweetsearch/content/resources/anonymous.png
97
	pngfix -q --out=${png/.png/fixed.png} ${png} # see pngfix help for exit codes
98
	[[ $? -gt 15 ]] && die "Failed to fix ${png}"
99
	mv -f ${png/.png/fixed.png} ${png} || die
135
	if use examples; then
136
		# fix broken png from qtdoc-examples (bug #679146)
137
		pngfix -q --suffix=.fixed \
138
			Examples/*/demos/tweetsearch/content/resources/anonymous.png
139
		(( ${?} < 16 )) || die
140
		mv "${_}"{.fixed,} || die
141
	fi
100 142
}
101 143

  
102 144
src_install() {
103
	# must be the same as QT5_DOCDIR
104
	insinto /usr/share/qt5-doc
105
	use html && doins -r */
106
	use qch && doins *.qch
145
	insinto /usr/share/qt6-doc # QT6_DOCDIR
146
	use qch && doins -r Docs/*/*.qch
147

  
148
	if use html; then
149
		doins -r Docs/*/*/
150

  
151
		# needed not to let Qt Creator believe that these examples exist
152
		use examples ||
153
			find "${ED}" -type f -name examples-manifest.xml -delete || die
154
	elif use examples; then
155
		# still need docs tarballs even with USE="-html -qch"
156
		for dir in Docs/*/*/; do
157
			if [[ -e ${dir}/examples-manifest.xml ]]; then
158
				insinto /usr/share/qt6-doc/"${dir#*/*/}"
159
				doins ${dir}/examples-manifest.xml
160
			fi
161
		done
162
	fi
163

  
164
	insinto /usr/share/qt6/examples # QT6_EXAMPLESDIR
165
	use examples && doins -r Examples/*/*/
107 166
}
Thank you!