Skip to content

Commit

Permalink
deps.qt: Update Qt6 macOS build script
Browse files Browse the repository at this point in the history
  • Loading branch information
PatTheMav committed Jun 13, 2023
1 parent 7127e97 commit b8fd73f
Showing 1 changed file with 64 additions and 57 deletions.
121 changes: 64 additions & 57 deletions deps.qt/qt6.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ patch() {
for patch (${patches}) {
read _target _url _hash <<< "${patch}"

if [[ "${target%%-*}" == ${~_target} ]] apply_patch "${_url}" "${_hash}"
if [[ "${target%%-*}" == ${~_target} ]] apply_patch ${_url} ${_hash}
}
}

Expand All @@ -90,59 +90,66 @@ config() {

local _onoff=(OFF ON)
local -a common_cmake_flags=(
${cmake_flags}
-DBUILD_SHARED_LIBS="${_onoff[(( shared_libs + 1 ))]}"
-DFEATURE_rpath="${_onoff[(( shared_libs + 1 ))]}"
${cmake_flags//-std=c17/}
-DBUILD_SHARED_LIBS:BOOL="${_onoff[(( shared_libs + 1 ))]}"
-DFEATURE_rpath:BOOL="${_onoff[(( shared_libs + 1 ))]}"
)
if (( ${+commands[ccache]} )) common_cmake_flags+=(-DQT_USE_CCACHE=ON)
if (( ${+commands[ccache]} )) common_cmake_flags+=(-DQT_USE_CCACHE:BOOL=ON)

if [[ ${CPUTYPE} != "${arch}" && ${host_os} == 'macos' ]] {
if [[ ${CPUTYPE} != ${arch} && ${host_os} == macos ]] {
unset VCPKG_ROOT
if ! /usr/bin/pgrep -q oahd; then
local -A other_arch=(arm64 x86_64 x86_64 arm64)
common_cmake_flags+=(-DCMAKE_OSX_ARCHITECTURES="${CPUTYPE};${other_arch[${CPUTYPE}]}")
common_cmake_flags+=(-DCMAKE_OSX_ARCHITECTURES:STRING="${CPUTYPE};${other_arch[${CPUTYPE}]}")
fi
}

if [[ ${config} == 'RelWithDebInfo' ]] common_cmake_flags+=(-DFEATURE_separate_debug_info=ON)
if (( shared_libs)) && [[ ${config} == Release ]] common_cmake_flags+=(-DFEATURE_separate_debug_info:BOOL=ON -DQT_FEATURE_force_debug_info:BOOL=ON)

args=(
${common_cmake_flags}
-DFEATURE_brotli=OFF
-DFEATURE_cups=OFF
-DFEATURE_dbus=OFF
-DFEATURE_glib=OFF
-DFEATURE_itemmodeltester=OFF
-DFEATURE_macdeployqt=OFF
-DFEATURE_windeployqt=OFF
-DFEATURE_androiddeployqt=OFF
-DFEATURE_printsupport=OFF
-DFEATURE_printer=OFF
-DFEATURE_printdialog=OFF
-DFEATURE_printpreviewdialog=OFF
-DFEATURE_printpreviewwidget=OFF
-DFEATURE_qmake=OFF
-DFEATURE_sql=OFF
-DFEATURE_system_zlib=ON
-DINPUT_libjpeg=qt
-DINPUT_libpng=qt
-DINPUT_pcre=qt
-DINPUT_doubleconversion=qt
-DINPUT_libmd4c=qt
-DFEATURE_openssl=OFF
-DQT_BUILD_BENCHMARKS=OFF
-DQT_BUILD_EXAMPLES=OFF
-DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF
-DQT_BUILD_MANUAL_TESTS=OFF
-DQT_BUILD_TESTS=OFF
-DQT_BUILD_TOOLS_BY_DEFAULT=OFF
-DQT_CREATE_VERSIONED_HARD_LINK=OFF
-DFEATURE_androiddeployqt:BOOL=OFF
-DFEATURE_brotli:BOOL=OFF
-DFEATURE_cups:BOOL=OFF
-DFEATURE_dbus:BOOL=OFF
-DFEATURE_doubleconversion:BOOL=ON
-DFEATURE_glib:BOOL=OFF
-DFEATURE_itemmodeltester:BOOL=OFF
-DFEATURE_libjpeg:BOOL=ON
-DFEATURE_libpng:BOOL=ON
-DFEATURE_macdeployqt:BOOL=OFF
-DFEATURE_openssl:BOOL=OFF
-DFEATURE_pcre2:BOOL=ON
-DFEATURE_pdf:BOOL=OFF
-DFEATURE_printdialog:BOOL=OFF
-DFEATURE_printer:BOOL=OFF
-DFEATURE_printpreviewdialog:BOOL=OFF
-DFEATURE_printpreviewwidget:BOOL=OFF
-DFEATURE_printsupport:BOOL=OFF
-DFEATURE_qmake:BOOL=OFF
-DFEATURE_sql:BOOL=OFF
-DFEATURE_system_doubleconversion:BOOL=OFF
-DFEATURE_system_libjpeg:BOOL=OFF
-DFEATURE_system_libpng:BOOL=OFF
-DFEATURE_system_pcre2:BOOL=OFF
-DFEATURE_system_zlib:BOOL=ON
-DFEATURE_textmarkdownreader:BOOL=OFF
-DFEATURE_textmarkdownwriter:BOOL=OFF
-DFEATURE_windeployqt:BOOL=OFF
-DQT_BUILD_BENCHMARKS:BOOL=OFF
-DQT_BUILD_EXAMPLES:BOOL=OFF
-DQT_BUILD_EXAMPLES_BY_DEFAULT:BOOL=OFF
-DQT_BUILD_MANUAL_TESTS:BOOL=OFF
-DQT_BUILD_TESTS:BOOL=OFF
-DQT_BUILD_TESTS_BY_DEFAULT:BOOL=OFF
-DQT_BUILD_TOOLS_BY_DEFAULT:BOOL=OFF
-DQT_CREATE_VERSIONED_HARD_LINK:BOOL=OFF
)

log_info "Config qtbase (%F{3}${target}%f)"
pushd ${dir}/qtbase
log_debug "CMake configuration options: ${args}'"
progress cmake -S . -B "build_${arch}" -G Ninja ${args}
progress cmake -S . -B build_${arch} -G Ninja ${args}
popd
}

Expand All @@ -153,8 +160,8 @@ build() {
pushd ${dir}/qtbase

args=(
--build "build_${arch}"
--config "${config}"
--build build_${arch}
--config ${config}
)

if (( _loglevel > 1 )) args+=(--verbose)
Expand All @@ -169,11 +176,11 @@ install() {
log_info "Install qtbase (%F{3}${target}%f)"

args=(
--install "build_${arch}"
--config "${config}"
--install build_${arch}
--config ${config}
)

if [[ "${config}" =~ "Release|MinSizeRel" ]] args+=(--strip)
if [[ ${config} == (Release|MinSizeRel) ]] args+=(--strip)
if (( _loglevel > 1 )) args+=(--verbose)

pushd ${dir}/qtbase
Expand All @@ -189,34 +196,34 @@ qt_add_submodules() {
local _onoff=(OFF ON)
local -a common_cmake_flags=(
${cmake_flags}
-DBUILD_SHARED_LIBS="${_onoff[(( shared_libs + 1 ))]}"
-DQT_USE_CCACHE=ON
-DBUILD_SHARED_LIBS:BOOL="${_onoff[(( shared_libs + 1 ))]}"
-DQT_USE_CCACHE:BOOL=ON
)

if [[ ${CPUTYPE} != "${arch}" && ${host_os} == 'macos' ]] {
if [[ ${CPUTYPE} != ${arch} && ${host_os} == macos ]] {
if ! /usr/bin/pgrep -q oahd; then
local -A other_arch=(arm64 x86_64 x86_64 arm64)
common_cmake_flags+=(-DCMAKE_OSX_ARCHITECTURES="${CPUTYPE};${other_arch[${CPUTYPE}]}")
common_cmake_flags+=(-DCMAKE_OSX_ARCHITECTURES:STRING="${CPUTYPE};${other_arch[${CPUTYPE}]}")
fi
}

if [[ ${config} == 'RelWithDebInfo' ]] common_cmake_flags+=(-DFEATURE_separate_debug_info=ON)
if (( shared_libs)) && [[ ${config} == Release ]] common_cmake_flags+=(-DFEATURE_separate_debug_info:BOOL=ON)

for component (${qt_components[2,-1]}) {
if ! (( ${skips[(Ie)all]} + ${skips[(Ie)build]} )) {
log_info "Config ${component} (%F{3}${target}%f)"

local -a _args=(${common_cmake_flags})
if [[ ${component} == 'qtimageformats' ]] _args+=(-DINPUT_tiff=qt -DINPUT_webp=qt)
if [[ ${component} == qtimageformats ]] _args+=(-DINPUT_tiff:STRING=qt -DINPUT_webp:STRING=qt)

pushd ${dir}/${component}
log_debug "CMake configuration options: ${_args}'"
progress cmake -S . -B "build_${arch}" -G Ninja ${_args}
progress cmake -S . -B build_${arch} -G Ninja ${_args}

log_info "Build ${component} (%F{3}${target}%f)"
args=(
--build "build_${arch}"
--config "${config}"
--build build_${arch}
--config ${config}
)

if (( _loglevel > 1 )) args+=(--verbose)
Expand All @@ -228,11 +235,11 @@ qt_add_submodules() {
pushd ${dir}/${component}

args=(
--install "build_${arch}"
--config "${config}"
--install build_${arch}
--config ${config}
)

if [[ "${config}" =~ "Release|MinSizeRel" ]] args+=(--strip)
if [[ ${config} == (Release|MinSizeRel) ]] args+=(--strip)
if (( _loglevel > 1 )) args+=(--verbose)

log_info "Install ${component} (%F{3}${target}%f)"
Expand All @@ -244,8 +251,8 @@ qt_add_submodules() {

fixup() {
if [[ \
${CPUTYPE} != "${arch}" && \
${target} =~ "macos-[arm64|x86_64]" \
${CPUTYPE} != ${arch} && \
${target} == macos-(arm64|x86_64) \
]] && ! /usr/bin/pgrep -q oahd; then
local file
local magic
Expand Down

0 comments on commit b8fd73f

Please sign in to comment.