Skip to content

Commit e651e06

Browse files
committed
tweaks
some minor changes to facilitate easier debugging without having to modify the script.
1 parent 5597ed0 commit e651e06

2 files changed

Lines changed: 54 additions & 12 deletions

File tree

qbittorrent-nox-static.sh

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ _set_default_values() {
220220

221221
# testing = easy way to switch to test qbt-musl-cross-make-test builds via an env in the workflow.
222222
qbt_mcm_url="${qbt_mcm_url:-userdocs/qbt-musl-cross-make}"
223+
# provide the github tag and it will use that to download instead of the latest release.
224+
qbt_mcm_tag="${qbt_mcm_tag:-}"
223225

224226
# Default to this version of libtorrent is no tag or branch is specified. qbt_libtorrent_version=1.2 or 2.0 or 2.1 or -lt v1.2.18
225227
qbt_libtorrent_version="${qbt_libtorrent_version:-2.0}"
@@ -294,14 +296,22 @@ _set_default_values() {
294296
# The Alpine repository we use for package sources
295297
CDN_URL="http://dl-cdn.alpinelinux.org/alpine/edge/main" # for alpine
296298

297-
# Dynamic tests to change settings based on the use of qmake,cmake,strip and debug
299+
# Native Alpine linux configuration. Does not apply when cross building using qbt-mcm
300+
qbt_use_lto="${qbt_use_lto:-yes}"
301+
302+
# Use mold as the linker - available from qbt-mcm 2614
303+
qbt_linker_mold="${qbt_linker_mold:-no}"
304+
305+
# Part 1: a series of # Dynamic tests to change settings based on the use of qmake,cmake,strip and debug
306+
# Part 2, the compiler options are located in the _custom_flags function.
298307
if [[ ${qbt_build_debug} == "yes" ]]; then
299308
qbt_optimise_strip="no"
300309
qbt_cmake_debug='ON'
301310
qbt_libtorrent_debug='debug-symbols=on'
302311
qbt_qbittorrent_debug='--enable-debug'
303312
qbt_cmake_build_type="Debug"
304313
qbt_openssl_build_type="--debug"
314+
qbt_use_lto="no"
305315
else
306316
qbt_cmake_debug='OFF'
307317
qbt_cmake_build_type="Release"
@@ -1214,7 +1224,7 @@ _debug() {
12141224
# https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html#tldr-what-compiler-options-should-i-use
12151225
_custom_flags() {
12161226

1217-
# Dynamic tests to change settings based on the use of qmake,cmake,strip and debug
1227+
# Part 2: Dynamic tests to change settings based on the use of qmake,cmake,strip and debug
12181228
if [[ ${qbt_build_debug} == "yes" ]]; then
12191229
# Debug builds always get priority
12201230
qbt_strip_qmake='-nostrip'
@@ -1316,7 +1326,7 @@ _custom_flags() {
13161326
qbt_security_flags+=" -mbranch-protection=standard"
13171327
fi
13181328

1319-
if [[ ${os_id} =~ ^(alpine)$ ]] && [[ -z ${qbt_cross_name} || ${qbt_cross_name} == "default" ]]; then
1329+
if [[ ${os_id} =~ ^(alpine)$ && ${qbt_use_lto} == "yes" ]] && [[ -z ${qbt_cross_name} || ${qbt_cross_name} == "default" ]]; then
13201330
if [[ ! ${app_name} =~ ^(openssl)$ ]]; then
13211331
qbt_optimization_flags+=" -flto=auto -fno-fat-lto-objects"
13221332
qbt_linker_flags+=" -flto -fuse-linker-plugin"
@@ -1342,6 +1352,13 @@ _custom_flags() {
13421352
qbt_static_flags="-static --static"
13431353
fi
13441354

1355+
# Mold linker - set -fuse-ld=mold when qbt_linker_mold=yes
1356+
if [[ ${qbt_linker_mold} == "yes" ]]; then
1357+
qbt_mold_flag="-fuse-ld=mold"
1358+
else
1359+
qbt_mold_flag=""
1360+
fi
1361+
13451362
# If you set and export your own flags in the env that the script is run, they will be appended to the defaults
13461363
# This is done via these checks and the flags are set in the _custom_flags_set function and it avoids duplication
13471364
[[ -z ${qbt_cflags_consumed} ]] && qbt_cflags="${CFLAGS}" qbt_cflags_consumed="yes"
@@ -1356,9 +1373,9 @@ _custom_flags() {
13561373

13571374
# Only set linker flags for final executables, not for libraries
13581375
if [[ ${app_name} =~ ^(icu|boost|qtbase|qbittorrent)$ ]]; then
1359-
LDFLAGS="-L${lib_dir} ${qbt_strip_flags} -pthread ${qbt_optimise_march} ${qbt_static_flags} ${qbt_linker_flags} ${qbt_ldflags:-}"
1376+
LDFLAGS="-L${lib_dir} ${qbt_strip_flags} -pthread ${qbt_optimise_march} ${qbt_static_flags} ${qbt_linker_flags} ${qbt_mold_flag} ${qbt_ldflags:-}"
13601377
else
1361-
LDFLAGS="-L${lib_dir} ${qbt_strip_flags} -pthread ${qbt_optimise_march} ${qbt_ldflags:-}"
1378+
LDFLAGS="-L${lib_dir} ${qbt_strip_flags} -pthread ${qbt_optimise_march} ${qbt_mold_flag} ${qbt_ldflags:-}"
13621379
fi
13631380

13641381
# Export compilation flags for build tools
@@ -2806,7 +2823,11 @@ _multi_arch() {
28062823
if [[ ${QBT_MCM_DOCKER} != "YES" ]]; then
28072824
if [[ ${1} == "bootstrap" || ${qbt_cache_dir_options} == "bs" || ! -f "${qbt_cache_dir:-${qbt_install_dir}}/${qbt_cross_host}.tar.gz" ]]; then
28082825
printf '\n%b\n' " ${unicode_blue_light_circle} Downloading ${color_magenta_light}${qbt_cross_host}.tar.gz${color_end} cross tool chain - ${color_cyan_light}https://github.com/${qbt_mcm_url}/releases/latest/download/${qbt_mcm_toolchain_prefix}-${qbt_cross_host}.tar.xz${color_end}"
2809-
_curl --create-dirs "https://github.com/${qbt_mcm_url}/releases/latest/download/${qbt_mcm_toolchain_prefix}-${qbt_cross_host}.tar.xz" -o "${qbt_cache_dir:-${qbt_install_dir}}/${qbt_cross_host}.tar.gz"
2826+
if [[ -z $qbt_mcm_tag ]]; then
2827+
_curl --create-dirs "https://github.com/${qbt_mcm_url}/releases/latest/download/${qbt_mcm_toolchain_prefix}-${qbt_cross_host}.tar.xz" -o "${qbt_cache_dir:-${qbt_install_dir}}/${qbt_cross_host}.tar.gz"
2828+
else
2829+
_curl --create-dirs "https://github.com/${qbt_mcm_url}/releases/download/${qbt_mcm_tag}/${qbt_mcm_toolchain_prefix}-${qbt_cross_host}.tar.xz" -o "${qbt_cache_dir:-${qbt_install_dir}}/${qbt_cross_host}.tar.gz"
2830+
fi
28102831
fi
28112832

28122833
if [[ -f "${qbt_install_dir}/.active-toolchain-info" ]]; then

qbt-nox-static.bash

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ _set_default_values() {
220220

221221
# testing = easy way to switch to test qbt-musl-cross-make-test builds via an env in the workflow.
222222
qbt_mcm_url="${qbt_mcm_url:-userdocs/qbt-musl-cross-make}"
223+
# provide the github tag and it will use that to download instead of the latest release.
224+
qbt_mcm_tag="${qbt_mcm_tag:-}"
223225

224226
# Default to this version of libtorrent is no tag or branch is specified. qbt_libtorrent_version=1.2 or 2.0 or 2.1 or -lt v1.2.18
225227
qbt_libtorrent_version="${qbt_libtorrent_version:-2.0}"
@@ -294,14 +296,22 @@ _set_default_values() {
294296
# The Alpine repository we use for package sources
295297
CDN_URL="http://dl-cdn.alpinelinux.org/alpine/edge/main" # for alpine
296298

297-
# Dynamic tests to change settings based on the use of qmake,cmake,strip and debug
299+
# Native Alpine linux configuration. Does not apply when cross building using qbt-mcm
300+
qbt_use_lto="${qbt_use_lto:-yes}"
301+
302+
# Use mold as the linker - available from qbt-mcm 2614
303+
qbt_linker_mold="${qbt_linker_mold:-no}"
304+
305+
# Part 1: a series of # Dynamic tests to change settings based on the use of qmake,cmake,strip and debug
306+
# Part 2, the compiler options are located in the _custom_flags function.
298307
if [[ ${qbt_build_debug} == "yes" ]]; then
299308
qbt_optimise_strip="no"
300309
qbt_cmake_debug='ON'
301310
qbt_libtorrent_debug='debug-symbols=on'
302311
qbt_qbittorrent_debug='--enable-debug'
303312
qbt_cmake_build_type="Debug"
304313
qbt_openssl_build_type="--debug"
314+
qbt_use_lto="no"
305315
else
306316
qbt_cmake_debug='OFF'
307317
qbt_cmake_build_type="Release"
@@ -1214,7 +1224,7 @@ _debug() {
12141224
# https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html#tldr-what-compiler-options-should-i-use
12151225
_custom_flags() {
12161226

1217-
# Dynamic tests to change settings based on the use of qmake,cmake,strip and debug
1227+
# Part 2: Dynamic tests to change settings based on the use of qmake,cmake,strip and debug
12181228
if [[ ${qbt_build_debug} == "yes" ]]; then
12191229
# Debug builds always get priority
12201230
qbt_strip_qmake='-nostrip'
@@ -1316,7 +1326,7 @@ _custom_flags() {
13161326
qbt_security_flags+=" -mbranch-protection=standard"
13171327
fi
13181328

1319-
if [[ ${os_id} =~ ^(alpine)$ ]] && [[ -z ${qbt_cross_name} || ${qbt_cross_name} == "default" ]]; then
1329+
if [[ ${os_id} =~ ^(alpine)$ && ${qbt_use_lto} == "yes" ]] && [[ -z ${qbt_cross_name} || ${qbt_cross_name} == "default" ]]; then
13201330
if [[ ! ${app_name} =~ ^(openssl)$ ]]; then
13211331
qbt_optimization_flags+=" -flto=auto -fno-fat-lto-objects"
13221332
qbt_linker_flags+=" -flto -fuse-linker-plugin"
@@ -1342,6 +1352,13 @@ _custom_flags() {
13421352
qbt_static_flags="-static --static"
13431353
fi
13441354

1355+
# Mold linker - set -fuse-ld=mold when qbt_linker_mold=yes
1356+
if [[ ${qbt_linker_mold} == "yes" ]]; then
1357+
qbt_mold_flag="-fuse-ld=mold"
1358+
else
1359+
qbt_mold_flag=""
1360+
fi
1361+
13451362
# If you set and export your own flags in the env that the script is run, they will be appended to the defaults
13461363
# This is done via these checks and the flags are set in the _custom_flags_set function and it avoids duplication
13471364
[[ -z ${qbt_cflags_consumed} ]] && qbt_cflags="${CFLAGS}" qbt_cflags_consumed="yes"
@@ -1356,9 +1373,9 @@ _custom_flags() {
13561373

13571374
# Only set linker flags for final executables, not for libraries
13581375
if [[ ${app_name} =~ ^(icu|boost|qtbase|qbittorrent)$ ]]; then
1359-
LDFLAGS="-L${lib_dir} ${qbt_strip_flags} -pthread ${qbt_optimise_march} ${qbt_static_flags} ${qbt_linker_flags} ${qbt_ldflags:-}"
1376+
LDFLAGS="-L${lib_dir} ${qbt_strip_flags} -pthread ${qbt_optimise_march} ${qbt_static_flags} ${qbt_linker_flags} ${qbt_mold_flag} ${qbt_ldflags:-}"
13601377
else
1361-
LDFLAGS="-L${lib_dir} ${qbt_strip_flags} -pthread ${qbt_optimise_march} ${qbt_ldflags:-}"
1378+
LDFLAGS="-L${lib_dir} ${qbt_strip_flags} -pthread ${qbt_optimise_march} ${qbt_mold_flag} ${qbt_ldflags:-}"
13621379
fi
13631380

13641381
# Export compilation flags for build tools
@@ -2806,7 +2823,11 @@ _multi_arch() {
28062823
if [[ ${QBT_MCM_DOCKER} != "YES" ]]; then
28072824
if [[ ${1} == "bootstrap" || ${qbt_cache_dir_options} == "bs" || ! -f "${qbt_cache_dir:-${qbt_install_dir}}/${qbt_cross_host}.tar.gz" ]]; then
28082825
printf '\n%b\n' " ${unicode_blue_light_circle} Downloading ${color_magenta_light}${qbt_cross_host}.tar.gz${color_end} cross tool chain - ${color_cyan_light}https://github.com/${qbt_mcm_url}/releases/latest/download/${qbt_mcm_toolchain_prefix}-${qbt_cross_host}.tar.xz${color_end}"
2809-
_curl --create-dirs "https://github.com/${qbt_mcm_url}/releases/latest/download/${qbt_mcm_toolchain_prefix}-${qbt_cross_host}.tar.xz" -o "${qbt_cache_dir:-${qbt_install_dir}}/${qbt_cross_host}.tar.gz"
2826+
if [[ -z $qbt_mcm_tag ]]; then
2827+
_curl --create-dirs "https://github.com/${qbt_mcm_url}/releases/latest/download/${qbt_mcm_toolchain_prefix}-${qbt_cross_host}.tar.xz" -o "${qbt_cache_dir:-${qbt_install_dir}}/${qbt_cross_host}.tar.gz"
2828+
else
2829+
_curl --create-dirs "https://github.com/${qbt_mcm_url}/releases/download/${qbt_mcm_tag}/${qbt_mcm_toolchain_prefix}-${qbt_cross_host}.tar.xz" -o "${qbt_cache_dir:-${qbt_install_dir}}/${qbt_cross_host}.tar.gz"
2830+
fi
28102831
fi
28112832

28122833
if [[ -f "${qbt_install_dir}/.active-toolchain-info" ]]; then

0 commit comments

Comments
 (0)