tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
qt55.qtbase: fix setup hook and QMake hook
Thomas Tuegel
9 years ago
343415e0
5c837e95
+50
-92
3 changed files
expand all
collapse all
unified
split
pkgs
development
libraries
qt-5
5.5
make-qt-wrapper.sh
qmake-hook.sh
qtbase
default.nix
+36
-1
pkgs/development/libraries/qt-5/5.5/make-qt-wrapper.sh
···
1
1
-
../5.6/make-qt-wrapper.sh
1
1
+
wrapQtProgram() {
2
2
+
local prog="$1"
3
3
+
shift
4
4
+
wrapProgram "$prog" \
5
5
+
--set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
6
6
+
--set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
7
7
+
--set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
8
8
+
--prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
9
9
+
--prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
10
10
+
"$@"
11
11
+
}
12
12
+
13
13
+
makeQtWrapper() {
14
14
+
local old="$1"
15
15
+
local new="$2"
16
16
+
shift
17
17
+
shift
18
18
+
makeWrapper "$old" "$new" \
19
19
+
--set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
20
20
+
--set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
21
21
+
--set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
22
22
+
--prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
23
23
+
--prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
24
24
+
"$@"
25
25
+
}
26
26
+
27
27
+
_makeQtWrapperSetup() {
28
28
+
# cannot use addToSearchPath because these directories may not exist yet
29
29
+
export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
30
30
+
export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
31
31
+
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
32
32
+
export RUNTIME_XDG_DATA_DIRS="$XDG_DATA_DIRS${XDG_DATA_DIRS:+:}${!outputBin}/share"
33
33
+
export RUNTIME_XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS${XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
34
34
+
}
35
35
+
36
36
+
prePhases+=(_makeQtWrapperSetup)
+13
-91
pkgs/development/libraries/qt-5/5.5/qmake-hook.sh
···
1
1
-
if [[ -z "$QMAKE" ]]; then
2
2
-
3
3
-
_qtLinkDependencyDir() {
4
4
-
@lndir@/bin/lndir -silent "$1/$2" "$qtOut/$2"
5
5
-
if [ -n "$NIX_QT_SUBMODULE" ]; then
6
6
-
find "$1/$2" -printf "$2/%P\n" >> "$out/nix-support/qt-inputs"
7
7
-
fi
8
8
-
}
9
9
-
10
10
-
_qtLinkModule() {
11
11
-
if [ -d "$1/mkspecs" ]; then
12
12
-
# $1 is a Qt module
13
13
-
_qtLinkDependencyDir "$1" mkspecs
14
14
-
15
15
-
for dir in bin include lib share; do
16
16
-
if [ -d "$1/$dir" ]; then
17
17
-
_qtLinkDependencyDir "$1" "$dir"
18
18
-
fi
19
19
-
done
20
20
-
fi
21
21
-
}
22
22
-
23
23
-
_qtRmModules() {
24
24
-
cat "$out/nix-support/qt-inputs" | while read file; do
25
25
-
if [ -h "$out/$file" ]; then
26
26
-
rm "$out/$file"
27
27
-
fi
28
28
-
done
1
1
+
qmakeConfigurePhase() {
2
2
+
runHook preConfigure
29
3
30
30
-
cat "$out/nix-support/qt-inputs" | while read file; do
31
31
-
if [ -d "$out/$file" ]; then
32
32
-
rmdir --ignore-fail-on-non-empty -p "$out/$file"
33
33
-
fi
34
34
-
done
35
35
-
36
36
-
rm "$out/nix-support/qt-inputs"
37
37
-
}
4
4
+
qmake PREFIX=$out $qmakeFlags
38
5
39
39
-
_qtRmQmake() {
40
40
-
rm "$qtOut/bin/qmake" "$qtOut/bin/qt.conf"
6
6
+
runHook postConfigure
41
7
}
42
8
43
43
-
_qtSetQmakePath() {
44
44
-
export PATH="$qtOut/bin${PATH:+:}$PATH"
45
45
-
}
9
9
+
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
10
10
+
configurePhase=qmakeConfigurePhase
11
11
+
fi
46
12
47
47
-
_qtMultioutModuleDevs() {
13
13
+
_qtModuleMultioutDevsPre() {
48
14
# We cannot simply set these paths in configureFlags because libQtCore retains
49
15
# references to the paths it was built with.
50
16
moveToOutput "bin" "${!outputDev}"
···
53
19
# The destination directory must exist or moveToOutput will do nothing
54
20
mkdir -p "${!outputDev}/share"
55
21
moveToOutput "share/doc" "${!outputDev}"
22
22
+
}
56
23
24
24
+
_qtModuleMultioutDevsPost() {
57
25
# Move libtool archives and qmake project files to $dev/lib
58
26
if [ "z${!outputLib}" != "z${!outputDev}" ]; then
59
27
pushd "${!outputLib}"
60
28
if [ -d "lib" ]; then
61
61
-
find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' -print0 \) | \
29
29
+
find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | \
62
30
while read -r -d $'\0' file; do
63
31
mkdir -p "${!outputDev}/$(dirname "$file")"
64
32
mv "${!outputLib}/$file" "${!outputDev}/$file"
···
68
36
fi
69
37
}
70
38
71
71
-
_qtRmQtOut() {
72
72
-
rm -fr "$qtOut"
73
73
-
}
74
74
-
75
75
-
qmakeConfigurePhase() {
76
76
-
runHook preConfigure
77
77
-
78
78
-
qmake PREFIX=$out $qmakeFlags
79
79
-
80
80
-
runHook postConfigure
81
81
-
}
82
82
-
83
83
-
qtOut=""
84
84
-
if [[ -z "$NIX_QT_SUBMODULE" ]]; then
85
85
-
qtOut=`mktemp -d`
86
86
-
else
87
87
-
qtOut=$out
88
88
-
fi
89
89
-
90
90
-
mkdir -p "$qtOut/bin" "$qtOut/mkspecs" "$qtOut/include" "$qtOut/nix-support" "$qtOut/lib" "$qtOut/share"
91
91
-
92
92
-
cp "@qt_dev@/bin/qmake" "$qtOut/bin"
93
93
-
cat >"$qtOut/bin/qt.conf" <<EOF
94
94
-
[Paths]
95
95
-
Prefix = $qtOut
96
96
-
Plugins = lib/qt5/plugins
97
97
-
Imports = lib/qt5/imports
98
98
-
Qml2Imports = lib/qt5/qml
99
99
-
Documentation = share/doc/qt5
100
100
-
EOF
101
101
-
102
102
-
export QMAKE="$qtOut/bin/qmake"
103
103
-
104
104
-
envHooks+=(_qtLinkModule)
105
105
-
# Set PATH to find qmake first in a preConfigure hook
106
106
-
# It must run after all the envHooks!
107
107
-
postHooks+=(_qtSetQmakePath)
108
108
-
109
109
-
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
110
110
-
configurePhase=qmakeConfigurePhase
111
111
-
fi
112
112
-
113
39
if [ -n "$NIX_QT_SUBMODULE" ]; then
114
114
-
postInstallHooks+=(_qtRmQmake _qtRmModules)
115
115
-
preFixupHooks+=(_qtMultioutModuleDevs)
116
116
-
else
117
117
-
postInstallHooks+=(_qtRmQtOut)
118
118
-
fi
119
119
-
40
40
+
preFixupHooks+=(_qtModuleMultioutDevsPre)
41
41
+
postFixupHooks+=(_qtModuleMultioutDevsPost)
120
42
fi
+1
pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
···
276
276
fixQtModuleCMakeConfig "Xml"
277
277
'';
278
278
279
279
+
inherit lndir;
279
280
setupHook = ./setup-hook.sh;
280
281
281
282
enableParallelBuilding = true;