Skip to content

Commit 8509533

Browse files
committed
(macos) update qmlfmt to one that supports 5.15 syntax
1 parent 0c18527 commit 8509533

File tree

5 files changed

+98
-15
lines changed

5 files changed

+98
-15
lines changed

cookiecutter/init_repo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ git add -f AppImage_staging/.do_not_format
2121
git add -f dl_third_party/.do_not_format
2222
git add -f dl_third_party/Qt_desktop/5.15.0/clang_64/extrabin/macos/qmlfmt
2323
git add -f dl_third_party/Qt_desktop/5.15.0/gcc_64/extrabin/qmlfmt
24-
# git add -f dl_third_party/Qt_desktop/6.2.2/clang_64/extrabin/macos/qmlfmt # TODO(pestophagous)
24+
git add -f dl_third_party/Qt_desktop/6.2.2/macos/extrabin/qmlfmt
2525
git add -f dl_third_party/Qt_desktop/6.2.2/gcc_64/extrabin/qmlfmt
2626
git add -f dl_third_party/Qt_desktop/5.15.0/ios/mkspecs/qconfig.pri
2727
git add -f dl_third_party/Qt_desktop/5.15.0/msvc2019_64/mkspecs/qconfig.pri
6.85 MB
Binary file not shown.

tools/ci/get_qt_libs_mac.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ else
2929
qtsvg \
3030
qttools
3131

32+
# we still need qt6 in order to execute qmlfmt.
33+
bash -x $CUR_GIT_ROOT/tools/ci/install-qt.sh \
34+
--directory $DL_FOLDER/Qt_desktop \
35+
--version 6.2.2 \
36+
qtbase \
37+
qtdeclarative \
38+
qt5compat
39+
3240
fi
3341

3442
if [ -d $DL_FOLDER/Qt_desktop/5.15.0/ios/bin ]; then

tools/ci/install-qt.sh

Lines changed: 88 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,25 @@ if ! ${FORCE_DOWNLOAD} && [ -f "${HASH_FILEPATH}" ]; then
218218
fi
219219

220220
if ${INSTALLATION_IS_VALID}; then
221-
echo "Already installed. Skipping download."
221+
echo "Already installed. Skipping download." >&2
222222
exit 0
223223
fi
224224

225+
MIRRORS="\
226+
http://download.qt.io \
227+
http://ftp.fau.de/qtproject \
228+
http://ftp.acc.umu.se/mirror/qt.io/qtproject \
229+
"
230+
231+
for MIRROR in ${MIRRORS}; do
232+
if curl "${MIRROR}/online" -s -f -o /dev/null; then
233+
break;
234+
else
235+
echo "Server ${MIRROR} not availabe. Trying next alternative..." >&2
236+
MIRROR=""
237+
fi
238+
done
239+
225240
DOWNLOAD_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'install-qt'`
226241

227242
#
@@ -230,20 +245,36 @@ DOWNLOAD_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'install-qt'`
230245
function compute_url(){
231246
local COMPONENT=$1
232247
local CURL="curl -s -L"
233-
local BASE_URL="http://download.qt.io/online/qtsdkrepository/${HOST_OS}/${TARGET_PLATFORM}"
248+
local BASE_URL="${MIRROR}/online/qtsdkrepository/${HOST_OS}/${TARGET_PLATFORM}"
249+
local ANDROID_ARCH=$(echo ${TOOLCHAIN##android_})
234250

235251
if [[ "${COMPONENT}" =~ "qtcreator" ]]; then
236252

237-
REMOTE_BASE="tools_qtcreator/qt.tools.qtcreator"
238-
REMOTE_PATH="$(${CURL} ${BASE_URL}/${REMOTE_BASE}/ | grep -o -E "${VERSION}[0-9\-]*${COMPONENT}\.7z" | tail -1)"
253+
if [[ "${HOST_OS}" == "windows_x86" ]]; then
254+
# newer QtC versions do not supported x86 version anymore
255+
HOST_OS="windows_x64"
256+
fi
257+
258+
SHORT_VERSION=${VERSION%??}
259+
BASE_URL="${MIRROR}/official_releases/qtcreator"
260+
REMOTE_PATH="${SHORT_VERSION}/${VERSION}/installer_source/${HOST_OS}/qtcreator.7z"
261+
echo "${BASE_URL}/${REMOTE_PATH}"
262+
return 0
263+
elif [[ "${COMPONENT}" =~ "mingw" ]]; then
264+
REMOTE_BASE="tools_mingw/qt.tools.${TOOLCHAIN}${VERSION//./}"
239265

266+
REMOTE_PATH="$(${CURL} ${BASE_URL}/${REMOTE_BASE}/ | grep -o -E "[[:alnum:]_.\-]*7z" | grep -v "meta" | head -1)"
240267
if [ ! -z "${REMOTE_PATH}" ]; then
241268
echo "${BASE_URL}/${REMOTE_BASE}/${REMOTE_PATH}"
242269
return 0
243270
fi
244-
245271
else
246272
REMOTE_BASES=(
273+
# New repository format (>=6.0.0)
274+
"qt6_${VERSION//./}/qt.qt6.${VERSION//./}.${TOOLCHAIN}"
275+
"qt6_${VERSION//./}/qt.qt6.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}"
276+
"qt6_${VERSION//./}_${ANDROID_ARCH}/qt.qt6.${VERSION//./}.${TOOLCHAIN}"
277+
"qt6_${VERSION//./}_${ANDROID_ARCH}/qt.qt6.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}"
247278
# New repository format (>=5.9.6)
248279
"qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${TOOLCHAIN}"
249280
"qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}"
@@ -268,16 +299,39 @@ function compute_url(){
268299
exit 1
269300
}
270301

302+
function version {
303+
echo "$@" | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }';
304+
}
305+
271306
mkdir -p ${INSTALL_DIR}
272307
rm -f "${HASH_FILEPATH}"
273308

274309
for COMPONENT in ${COMPONENTS}; do
275310

311+
if [[ "${COMPONENT}" =~ "qtcreator" ]] && [[ "${HOST_OS}" != "mac_x64" ]]; then
312+
UNPACK_DIR="${INSTALL_DIR}/Tools/QtCreator"
313+
mkdir -p ${UNPACK_DIR}
314+
else
315+
UNPACK_DIR="${INSTALL_DIR}"
316+
fi
317+
318+
if [ "$(version "${VERSION}")" -ge "$(version "6.0.0")" ]; then
319+
if [[ "${COMPONENT}" =~ "qtscript" ]] || [[ "${COMPONENT}" =~ "qtscxml" ]] || [[ "${COMPONENT}" =~ "qtx11extras" ]]; then
320+
echo "Component ${COMPONENT} was removed in Qt6, skipping" >&2
321+
continue
322+
fi
323+
else
324+
if [[ "${COMPONENT}" =~ "qt5compat" ]]; then
325+
echo "Component ${COMPONENT} is not present in Qt ${VERSION}, skipping" >&2
326+
continue
327+
fi
328+
fi
329+
276330
URL="$(compute_url ${COMPONENT})"
277-
echo "Downloading ${COMPONENT}..." >&2
331+
echo "Downloading ${COMPONENT} ${URL}..." >&2
278332
curl --progress-bar -L -o ${DOWNLOAD_DIR}/package.7z ${URL} >&2
279-
7z x -y -o${INSTALL_DIR} ${DOWNLOAD_DIR}/package.7z >/dev/null 2>&1
280-
7z l -ba -slt -y ${DOWNLOAD_DIR}/package.7z | tr '\\' '/' | sed -n -e "s|^Path\ =\ |${INSTALL_DIR}/|p" >> "${HASH_FILEPATH}" 2>/dev/null
333+
7z x -y -o${UNPACK_DIR} ${DOWNLOAD_DIR}/package.7z >/dev/null 2>&1
334+
7z l -ba -slt -y ${DOWNLOAD_DIR}/package.7z | tr '\\' '/' | sed -n -e "s|^Path\ =\ |${UNPACK_DIR}/|p" >> "${HASH_FILEPATH}" 2>/dev/null
281335
rm -f ${DOWNLOAD_DIR}/package.7z
282336

283337
#
@@ -294,26 +348,47 @@ for COMPONENT in ${COMPONENTS}; do
294348
SUBDIR="${TOOLCHAIN/win32_/}"
295349
elif [[ "${TOOLCHAIN}" =~ "any" ]] && [[ "${TARGET_PLATFORM}" == "android" ]]; then
296350
SUBDIR="android"
351+
elif [ "${HOST_OS}" == "mac_x64" ] && [ ! "${VERSION}" \< "6.1.2" ]; then
352+
SUBDIR="macos"
297353
else
298354
SUBDIR="${TOOLCHAIN}"
299355
fi
300356

301-
CONF_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/qt.conf"
302-
echo "[Paths]" > ${CONF_FILE}
303-
echo "Prefix = .." >> ${CONF_FILE}
357+
if [ "${TARGET_PLATFORM}" == "android" ] && [ ! "${VERSION}" \< "6.0.0" ]; then
358+
CONF_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/target_qt.conf"
359+
sed -i "s|target|../$TOOLCHAIN|g" "${CONF_FILE}"
360+
sed -i "/HostPrefix/ s|$|gcc_64|g" "${CONF_FILE}"
361+
ANDROID_QMAKE_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/qmake"
362+
QMAKE_FILE="${UNPACK_DIR}/${VERSION}/gcc_64/bin/qmake"
363+
sed -i "s|\/home\/qt\/work\/install\/bin\/qmake|$QMAKE_FILE|g" "${ANDROID_QMAKE_FILE}"
364+
else
365+
CONF_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/qt.conf"
366+
echo "[Paths]" > ${CONF_FILE}
367+
echo "Prefix = .." >> ${CONF_FILE}
368+
fi
304369

305370
# Adjust the license to be able to run qmake
306371
# sed with -i requires intermediate file on Mac OS
307-
PRI_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/mkspecs/qconfig.pri"
372+
PRI_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/mkspecs/qconfig.pri"
308373
sed -i.bak 's/Enterprise/OpenSource/g' "${PRI_FILE}"
309374
sed -i.bak 's/licheck.*//g' "${PRI_FILE}"
310375
rm "${PRI_FILE}.bak"
311376

312377
# Print the directory so that the caller can
313378
# adjust the PATH variable.
314379
echo $(dirname "${CONF_FILE}")
380+
elif [[ "${COMPONENT}" =~ "mingw" ]]; then
381+
if [[ "${TOOLCHAIN}" =~ "win64_mingw" ]]; then
382+
echo "${UNPACK_DIR}/Tools/mingw${VERSION//./}_64/bin"
383+
elif [[ "${TOOLCHAIN}" =~ "win32_mingw" ]]; then
384+
echo "${UNPACK_DIR}/Tools/mingw${VERSION//./}_32/bin"
385+
fi
315386
elif [[ "${COMPONENT}" =~ "qtcreator" ]]; then
316-
echo "${INSTALL_DIR}/Tools/QtCreator/bin"
387+
if [ "${HOST_OS}" == "mac_x64" ]; then
388+
echo "${UNPACK_DIR}/Qt Creator.app/Contents/MacOS"
389+
else
390+
echo "${UNPACK_DIR}/bin"
391+
fi
317392
fi
318393

319394
done

tools/formatters/enforce_qml_format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if [[ -n ${MYAPP_TEMPLATE_LEGACY_UBUNTU18-} ]]; then
3737
fi
3838

3939
if [[ "$OSTYPE" == "darwin"* ]]; then
40-
qml_formatter="${DL_FOLDER}/Qt_desktop/${MY_QT_VERSION}/clang_64/extrabin/macos/qmlfmt"
40+
qml_formatter="${DL_FOLDER}/Qt_desktop/${MY_QT_VERSION}/macos/extrabin/qmlfmt"
4141
else
4242
export LD_LIBRARY_PATH="${DL_FOLDER}/Qt_desktop/${MY_QT_VERSION}/gcc_64/lib"
4343
qml_formatter="${DL_FOLDER}/Qt_desktop/${MY_QT_VERSION}/gcc_64/extrabin/qmlfmt"

0 commit comments

Comments
 (0)