Skip to content

Commit 286d07f

Browse files
hebastofanquake
authored andcommitted
build, qt: Fix lib paths in *.pc files
See: - QTBUG-72903, commit 9864d2c6f3b628ca9f07a56b197e77bd43931cca - QTBUG-78873, commit e55a61a77f0c87c05661a0335dfdb12673c6a27f Could be dropped for Qt 5.14+.
1 parent fa5e97e commit 286d07f

File tree

2 files changed

+195
-1
lines changed

2 files changed

+195
-1
lines changed

depends/packages/qt.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $(package)_qt_libs=corelib network widgets gui plugins testlib
99
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_no_printer.patch no-xlib.patch
1010
$(package)_patches+= fix_android_qmake_conf.patch fix_android_jni_static.patch dont_hardcode_pwd.patch
1111
$(package)_patches+= drop_lrelease_dependency.patch no_sdk_version_check.patch
12-
$(package)_patches+= fix_qpainter_non_determinism.patch
12+
$(package)_patches+= fix_qpainter_non_determinism.patch fix_lib_paths.patch
1313

1414
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
1515
$(package)_qttranslations_sha256_hash=e1de58ed108b7e0a138815ea60fd46a2c4e1fc31396a707e5630e92de79c53de
@@ -226,6 +226,7 @@ define $(package)_preprocess_cmds
226226
patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \
227227
patch -p1 -i $($(package)_patch_dir)/fix_qpainter_non_determinism.patch &&\
228228
patch -p1 -i $($(package)_patch_dir)/no_sdk_version_check.patch && \
229+
patch -p1 -i $($(package)_patch_dir)/fix_lib_paths.patch && \
229230
sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \
230231
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
231232
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
--- old/qtbase/mkspecs/common/mac.conf
2+
+++ new/qtbase/mkspecs/common/mac.conf
3+
@@ -14,7 +14,6 @@
4+
5+
QMAKE_RESOURCE = /Developer/Tools/Rez
6+
QMAKE_EXTENSION_SHLIB = dylib
7+
-QMAKE_EXTENSIONS_AUX_SHLIB = tbd
8+
QMAKE_LIBDIR =
9+
10+
# sdk.prf will prefix the proper SDK sysroot
11+
12+
--- old/qtbase/mkspecs/features/qmake_use.prf
13+
+++ new/qtbase/mkspecs/features/qmake_use.prf
14+
@@ -22,6 +22,8 @@
15+
!defined(QMAKE_LIBS_$$nu, var): \
16+
error("Library '$$lower($$replace(nu, _, -))' is not defined.")
17+
18+
+ QMAKE_LIBDIR += $$eval(QMAKE_LIBDIR_$$nu)
19+
+
20+
debug: \
21+
LIBS$${suffix} += $$eval(QMAKE_LIBS_$${nu}_DEBUG) $$eval(QMAKE_LIBS_$$nu)
22+
else: \
23+
24+
--- old/qtbase/mkspecs/features/qt_configure.prf
25+
+++ new/qtbase/mkspecs/features/qt_configure.prf
26+
@@ -526,98 +526,23 @@
27+
return($$sysrootified)
28+
}
29+
30+
-# libs-var, libs, in-paths, out-paths-var
31+
+# libs-var, libs, in-paths
32+
defineTest(qtConfResolveLibs) {
33+
- ret = true
34+
- paths = $$3
35+
- out =
36+
- copy = false
37+
- for (l, 2) {
38+
- $$copy {
39+
- copy = false
40+
- out += $$l
41+
- } else: equals(l, "-s") {
42+
- # em++ flag to link libraries from emscripten-ports; passed on literally.
43+
- copy = true
44+
- out += $$l
45+
- } else: contains(l, "^-L.*") {
46+
- lp = $$replace(l, "^-L", )
47+
- gcc: lp = $$qtGccSysrootifiedPath($$lp)
48+
- !exists($$lp/.) {
49+
- qtLog("Library path $$val_escape(lp) is invalid.")
50+
- ret = false
51+
- } else {
52+
- paths += $$lp
53+
- }
54+
- } else: contains(l, "^-l.*") {
55+
- lib = $$replace(l, "^-l", )
56+
- lcan =
57+
- integrity:contains(lib, "^.*\\.a") {
58+
- # INTEGRITY compiler searches for exact filename
59+
- # if -l argument has .a suffix
60+
- lcan += $${lib}
61+
- } else: contains(lib, "^:.*") {
62+
- # Use exact filename when -l:filename syntax is used.
63+
- lib ~= s/^://
64+
- lcan += $${lib}
65+
- } else: unix {
66+
- # Under UNIX, we look for actual shared libraries, in addition
67+
- # to static ones.
68+
- shexts = $$QMAKE_EXTENSION_SHLIB $$QMAKE_EXTENSIONS_AUX_SHLIB
69+
- for (ext, shexts) {
70+
- lcan += $${QMAKE_PREFIX_SHLIB}$${lib}.$${ext}
71+
- }
72+
- lcan += \
73+
- $${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB}
74+
- } else {
75+
- # Under Windows, we look only for static libraries, as even for DLLs
76+
- # one actually links against a static import library.
77+
- mingw {
78+
- lcan += \
79+
- # MinGW supports UNIX-style library naming in addition to
80+
- # the MSVC style.
81+
- lib$${lib}.dll.a lib$${lib}.a \
82+
- # Fun fact: prefix-less libraries are also supported.
83+
- $${lib}.dll.a $${lib}.a
84+
- }
85+
- lcan += $${lib}.lib
86+
- }
87+
- l = $$qtConfFindInPathList($$lcan, $$paths $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS)
88+
- isEmpty(l) {
89+
- qtLog("None of [$$val_escape(lcan)] found in [$$val_escape(paths)] and global paths.")
90+
- ret = false
91+
- } else {
92+
- out += $$l
93+
- }
94+
- } else {
95+
- out += $$l
96+
- }
97+
- }
98+
- $$1 = $$out
99+
+ for (path, 3): \
100+
+ pre_lflags += -L$$path
101+
+ $$1 = $$pre_lflags $$2
102+
export($$1)
103+
- !isEmpty(4) {
104+
- $$4 = $$paths
105+
- export($$4)
106+
- }
107+
- return($$ret)
108+
-}
109+
-
110+
-# source-var
111+
-defineTest(qtConfResolveAllLibs) {
112+
- ret = true
113+
- !qtConfResolveLibs($${1}.libs, $$eval($${1}.libs), , $${1}.libdirs): \
114+
- ret = false
115+
- for (b, $${1}.builds._KEYS_): \
116+
- !qtConfResolveLibs($${1}.builds.$${b}, $$eval($${1}.builds.$${b}), $$eval($${1}.libdirs), ): \
117+
- ret = false
118+
- return($$ret)
119+
+ return(true)
120+
}
121+
122+
# libs-var, in-paths, libs
123+
defineTest(qtConfResolvePathLibs) {
124+
ret = true
125+
- gcc: 2 = $$qtGccSysrootifiedPaths($$2)
126+
- for (libdir, 2) {
127+
+ gcc: \
128+
+ local_paths = $$qtGccSysrootifiedPaths($$2)
129+
+ else: \
130+
+ local_paths = $$2
131+
+ for (libdir, local_paths) {
132+
!exists($$libdir/.) {
133+
qtLog("Library path $$val_escape(libdir) is invalid.")
134+
ret = false
135+
@@ -667,8 +592,11 @@
136+
# includes-var, in-paths, test-object-var
137+
defineTest(qtConfResolvePathIncs) {
138+
ret = true
139+
- gcc: 2 = $$qtGccSysrootifiedPaths($$2)
140+
- for (incdir, 2) {
141+
+ gcc: \
142+
+ local_paths = $$qtGccSysrootifiedPaths($$2)
143+
+ else: \
144+
+ local_paths = $$2
145+
+ for (incdir, local_paths) {
146+
!exists($$incdir/.) {
147+
qtLog("Include path $$val_escape(incdir) is invalid.")
148+
ret = false
149+
@@ -727,6 +655,7 @@
150+
vars += $$eval(config.commandline.rev_assignments.$${iv})
151+
defined(config.input.$${iv}, var) {
152+
eval($${1}.builds.$${b} = $$eval(config.input.$${iv}))
153+
+ export($${1}.builds.$${b})
154+
$${1}.builds._KEYS_ *= $${b}
155+
any = true
156+
} else {
157+
@@ -741,11 +670,14 @@
158+
export($${1}.builds._KEYS_)
159+
# we also reset the generic libs, to avoid surprises.
160+
$${1}.libs =
161+
+ export($${1}.libs)
162+
}
163+
164+
# direct libs. overwrites inline libs.
165+
- defined(config.input.$${input}.libs, var): \
166+
+ defined(config.input.$${input}.libs, var) {
167+
eval($${1}.libs = $$eval(config.input.$${input}.libs))
168+
+ export($${1}.libs)
169+
+ }
170+
171+
includes = $$eval(config.input.$${input}.incdir)
172+
173+
@@ -754,6 +686,7 @@
174+
!isEmpty(prefix) {
175+
includes += $$prefix/include
176+
$${1}.libs = -L$$prefix/lib $$eval($${1}.libs)
177+
+ export($${1}.libs)
178+
}
179+
180+
libdir = $$eval(config.input.$${input}.libdir)
181+
@@ -762,11 +695,9 @@
182+
for (ld, libdir): \
183+
libs += -L$$ld
184+
$${1}.libs = $$libs $$eval($${1}.libs)
185+
+ export($${1}.libs)
186+
}
187+
188+
- !qtConfResolveAllLibs($$1): \
189+
- return(false)
190+
-
191+
!qtConfResolvePathIncs($${1}.includedir, $$includes, $$2): \
192+
return(false)
193+

0 commit comments

Comments
 (0)