Skip to content

Commit c670568

Browse files
committed
docs
1 parent dcc54f7 commit c670568

File tree

4 files changed

+452
-164
lines changed

4 files changed

+452
-164
lines changed

docs/src/components/BuildConfigTool.astro

Lines changed: 194 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,37 @@ const configOptions: ConfigOption[] = [
8383
type: "select",
8484
allowCustom: true,
8585
},
86+
{
87+
variable: "qbt_docker_volume",
88+
label: "Docker Volume Mapping",
89+
description: "Volume mapping for Docker container (host:container format)",
90+
defaultVal: "~/qbt:/root",
91+
options: [
92+
{
93+
value: "~/qbt:/root",
94+
label: "~/qbt:/root",
95+
description: "Default volume mapping to home directory",
96+
},
97+
{
98+
value: "./qbt:/root",
99+
label: "./qbt:/root",
100+
description: "Current directory volume mapping",
101+
},
102+
{
103+
value: "/tmp/qbt:/root",
104+
label: "/tmp/qbt:/root",
105+
description: "Temporary directory volume mapping",
106+
},
107+
{
108+
value: "custom",
109+
label: "Custom...",
110+
description: "Enter custom volume mapping",
111+
},
112+
],
113+
category: "basic",
114+
type: "select",
115+
allowCustom: true,
116+
},
86117
{
87118
variable: "qbt_libtorrent_version",
88119
label: "Libtorrent Version",
@@ -442,6 +473,110 @@ const configOptions: ConfigOption[] = [
442473
category: "advanced",
443474
type: "boolean",
444475
},
476+
{
477+
variable: "qbt_build_dir",
478+
label: "Build Directory",
479+
description: "Directory name for build files",
480+
defaultVal: "qbt-build",
481+
options: [
482+
{ value: "qbt-build", label: "qbt-build", description: "Default build directory" },
483+
{ value: "build", label: "build", description: "Standard build directory" },
484+
{ value: "custom", label: "Custom...", description: "Enter custom build directory" },
485+
],
486+
category: "advanced",
487+
type: "select",
488+
allowCustom: true,
489+
},
490+
{
491+
variable: "qbt_build_tool",
492+
label: "Build Tool",
493+
description: "Build system to use",
494+
defaultVal: "cmake",
495+
options: [
496+
{ value: "cmake", label: "CMake", description: "Use CMake build system" },
497+
{ value: "qmake", label: "QMake", description: "Use QMake build system" },
498+
],
499+
category: "advanced",
500+
type: "select",
501+
},
502+
{
503+
variable: "qbt_mcm_url",
504+
label: "Musl Cross Make URL",
505+
description: "GitHub repository for musl cross make toolchain",
506+
defaultVal: "userdocs/qbt-musl-cross-make",
507+
options: [
508+
{ value: "userdocs/qbt-musl-cross-make", label: "userdocs/qbt-musl-cross-make", description: "Default repository" },
509+
{ value: "custom", label: "Custom...", description: "Enter custom repository" },
510+
],
511+
category: "advanced",
512+
type: "select",
513+
allowCustom: true,
514+
},
515+
{
516+
variable: "qbt_patches_url",
517+
label: "Patches URL",
518+
description: "GitHub repository for patches",
519+
defaultVal: "userdocs/qbittorrent-nox-static",
520+
options: [
521+
{ value: "userdocs/qbittorrent-nox-static", label: "userdocs/qbittorrent-nox-static", description: "Default patches repository" },
522+
{ value: "custom", label: "Custom...", description: "Enter custom patches repository" },
523+
],
524+
category: "advanced",
525+
type: "select",
526+
allowCustom: true,
527+
},
528+
{
529+
variable: "qbt_cache_dir",
530+
label: "Cache Directory",
531+
description: "Directory for build cache (empty for no cache)",
532+
defaultVal: "",
533+
options: [
534+
{ value: "", label: "None", description: "No cache directory" },
535+
{ value: ".cache", label: ".cache", description: "Use .cache directory" },
536+
{ value: "/tmp/qbt-cache", label: "/tmp/qbt-cache", description: "Use /tmp cache" },
537+
{ value: "custom", label: "Custom...", description: "Enter custom cache directory" },
538+
],
539+
category: "advanced",
540+
type: "select",
541+
allowCustom: true,
542+
},
543+
{
544+
variable: "qbt_optimise_strip",
545+
label: "Optimize Strip",
546+
description: "Strip debug symbols for smaller binaries",
547+
defaultVal: "yes",
548+
options: [
549+
{ value: "yes", label: "Yes", description: "Strip debug symbols" },
550+
{ value: "no", label: "No", description: "Keep debug symbols" },
551+
],
552+
category: "advanced",
553+
type: "boolean",
554+
},
555+
{
556+
variable: "qbt_static_ish",
557+
label: "Static-ish Build",
558+
description: "Build with static-ish linking",
559+
defaultVal: "no",
560+
options: [
561+
{ value: "yes", label: "Yes", description: "Enable static-ish build" },
562+
{ value: "no", label: "No", description: "Standard dynamic linking" },
563+
],
564+
category: "advanced",
565+
type: "boolean",
566+
},
567+
{
568+
variable: "qbt_host_deps_repo",
569+
label: "Host Dependencies Repository",
570+
description: "GitHub repository for host dependencies",
571+
defaultVal: "userdocs/qbt-host-deps",
572+
options: [
573+
{ value: "userdocs/qbt-host-deps", label: "userdocs/qbt-host-deps", description: "Default host deps repository" },
574+
{ value: "custom", label: "Custom...", description: "Enter custom host deps repository" },
575+
],
576+
category: "advanced",
577+
type: "select",
578+
allowCustom: true,
579+
},
445580
];
446581
447582
const basicOptions = configOptions.filter((opt) => opt.category === "basic");
@@ -621,12 +756,18 @@ const advancedOptions = configOptions.filter(
621756
font-weight: 500;
622757
transition: var(--transition-fast);
623758
min-width: 200px;
759+
max-width: 300px;
760+
width: 200px;
624761
cursor: pointer;
625762
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
626763
text-align: left;
627764
text-align-last: left;
628765
height: 2.5rem;
629766
box-sizing: border-box;
767+
overflow: hidden;
768+
text-overflow: ellipsis;
769+
white-space: nowrap;
770+
justify-self: start;
630771
}
631772

632773
.option-control select:hover {
@@ -681,15 +822,23 @@ const advancedOptions = configOptions.filter(
681822
font-size: 0.75rem;
682823
font-weight: 500;
683824
white-space: nowrap;
684-
min-width: 80px;
825+
width: 90px;
826+
min-width: 90px;
827+
max-width: 90px;
685828
text-align: left;
686829
height: 2rem;
830+
box-sizing: border-box;
831+
justify-self: end;
687832
}
688833

689834
.status-label {
690835
color: var(--sl-color-gray-2);
691836
text-transform: uppercase;
692837
letter-spacing: 0.025em;
838+
overflow: hidden;
839+
text-overflow: ellipsis;
840+
flex: 1;
841+
min-width: 0;
693842
}
694843

695844
.option-control select:focus {
@@ -1047,7 +1196,7 @@ const advancedOptions = configOptions.filter(
10471196
<div class="config-options">
10481197
{
10491198
basicOptions.map((option) => (
1050-
<div class="config-option" data-docker-only={option.variable === "qbt_docker_base" || option.variable === "qbt_docker_port" ? "true" : undefined}>
1199+
<div class="config-option" data-docker-only={option.variable === "qbt_docker_base" || option.variable === "qbt_docker_port" || option.variable === "qbt_docker_volume" ? "true" : undefined}>
10511200
<div class="option-info">
10521201
<h4>{option.label}</h4>
10531202
</div>
@@ -1310,7 +1459,7 @@ const advancedOptions = configOptions.filter(
13101459
const currentValue = getSelectValue(select);
13111460

13121461
// Skip invalid or Docker-specific variables for native builds
1313-
if (!variable || variable === "qbt_docker_base" || variable === "qbt_docker_port") {
1462+
if (!variable || variable === "qbt_docker_base" || variable === "qbt_docker_port" || variable === "qbt_docker_volume") {
13141463
return;
13151464
}
13161465

@@ -1369,7 +1518,7 @@ const advancedOptions = configOptions.filter(
13691518
const currentValue = getSelectValue(select);
13701519

13711520
// Skip invalid or Docker-specific variables for native builds
1372-
if (!variable || variable === "qbt_docker_base" || variable === "qbt_docker_port") {
1521+
if (!variable || variable === "qbt_docker_base" || variable === "qbt_docker_port" || variable === "qbt_docker_volume") {
13731522
return;
13741523
}
13751524

@@ -1384,15 +1533,19 @@ const advancedOptions = configOptions.filter(
13841533
}
13851534
});
13861535

1536+
// Add download and chmod commands
1537+
const downloadCommands = `curl -sL usrdx.github.io/s/qbt.bash -o qbt.bash && \\
1538+
chmod +x qbt.bash`;
1539+
13871540
if (envVars.length === 0) {
1388-
return baseCommand;
1541+
return `${downloadCommands}\n${baseCommand}`;
13891542
}
13901543

13911544
// Format with line breaks using backslashes
13921545
const envVarsFormatted = envVars
13931546
.map((envVar) => `${envVar} \\`)
13941547
.join("\n");
1395-
return `${envVarsFormatted}\n${baseCommand}`;
1548+
return `${downloadCommands}\n${envVarsFormatted}\n${baseCommand}`;
13961549
}
13971550

13981551
function generateDockerCommand() {
@@ -1413,6 +1566,7 @@ const advancedOptions = configOptions.filter(
14131566
let packageManager = "apk update && apk add bash git curl";
14141567
let shell = "/bin/ash";
14151568
let portMapping = "8080:8080";
1569+
let volumeMapping = "~/qbt:/root";
14161570

14171571
selects.forEach((select) => {
14181572
const variable = select.dataset.variable;
@@ -1443,6 +1597,12 @@ const advancedOptions = configOptions.filter(
14431597
return; // Don't include this in env vars
14441598
}
14451599

1600+
// Handle volume mapping selection
1601+
if (variable === "qbt_docker_volume") {
1602+
volumeMapping = currentValue || defaultValue || "~/qbt:/root";
1603+
return; // Don't include this in env vars
1604+
}
1605+
14461606
// Only include variables that differ from default and are not empty
14471607
if (
14481608
currentValue !== defaultValue &&
@@ -1456,7 +1616,7 @@ const advancedOptions = configOptions.filter(
14561616
if (envVars.length === 0) {
14571617
return `docker run -it -w /root \\
14581618
\t-p ${portMapping} \\
1459-
\t-v ~/qbt:/root \\
1619+
\t-v ${volumeMapping} \\
14601620
\t${baseImage} ${shell} -c \\
14611621
\t'${packageManager} && \\
14621622
\t${scriptCommand}'`;
@@ -1468,7 +1628,7 @@ const advancedOptions = configOptions.filter(
14681628
.join("\n");
14691629
return `docker run -it -w /root \\
14701630
\t-p ${portMapping} \\
1471-
\t-v ~/qbt:/root \\
1631+
\t-v ${volumeMapping} \\
14721632
\t${baseImage} ${shell} -c \\
14731633
\t'${packageManager} && \\
14741634
${envVarsFormatted}
@@ -1493,6 +1653,7 @@ ${envVarsFormatted}
14931653
let packageManager = "apk update && apk add bash git curl";
14941654
let shell = "/bin/ash";
14951655
let portMapping = "8080:8080";
1656+
let volumeMapping = "~/qbt:/root";
14961657

14971658
selects.forEach((select) => {
14981659
const variable = select.dataset.variable;
@@ -1523,6 +1684,12 @@ ${envVarsFormatted}
15231684
return; // Don't include this in env vars
15241685
}
15251686

1687+
// Handle volume mapping selection
1688+
if (variable === "qbt_docker_volume") {
1689+
volumeMapping = currentValue || defaultValue || "~/qbt:/root";
1690+
return; // Don't include this in env vars
1691+
}
1692+
15261693
// Only include variables that differ from default and are not empty
15271694
if (
15281695
currentValue !== defaultValue &&
@@ -1533,11 +1700,16 @@ ${envVarsFormatted}
15331700
}
15341701
});
15351702

1703+
// Extract local directory from volume mapping (part before the colon)
1704+
const localDir = volumeMapping.split(':')[0];
1705+
15361706
if (envVars.length === 0) {
1537-
return `docker run -it -w /root \\
1707+
return `curl --create-dirs -sL usrdx.github.io/s/qbt.bash -o ${localDir}/qbt.bash && \\
1708+
chmod +x ${localDir}/qbt.bash && \\
1709+
docker run -it -w /root \\
15381710
\t-p ${portMapping} \\
1539-
\t-v ~/qbt:/root \\
1540-
\t-v ./qbt.bash:/root/qbt.bash \\
1711+
\t-v ${volumeMapping} \\
1712+
\t-v ${localDir}/qbt.bash:/root/qbt.bash \\
15411713
\t${baseImage} ${shell} -c \\
15421714
\t'${packageManager} && \\
15431715
\t${scriptCommand}'`;
@@ -1547,10 +1719,12 @@ ${envVarsFormatted}
15471719
const envVarsFormatted = envVars
15481720
.map((envVar) => `\t${envVar} \\`)
15491721
.join("\n");
1550-
return `docker run -it -w /root \\
1722+
return `curl --create-dirs -sL usrdx.github.io/s/qbt.bash -o ${localDir}/qbt.bash && \\
1723+
chmod +x ${localDir}/qbt.bash && \\
1724+
docker run -it -w /root \\
15511725
\t-p ${portMapping} \\
1552-
\t-v ~/qbt:/root \\
1553-
\t-v ./qbt.bash:/root/qbt.bash \\
1726+
\t-v ${volumeMapping} \\
1727+
\t-v ${localDir}/qbt.bash:/root/qbt.bash \\
15541728
\t${baseImage} ${shell} -c \\
15551729
\t'${packageManager} && \\
15561730
${envVarsFormatted}
@@ -1723,6 +1897,7 @@ CMD ["qbt.bash", "bootstrap_deps", "all"]`;
17231897
// Handle custom input toggling and values
17241898
function handleCustomInput(select: HTMLSelectElement): void {
17251899
const variable = select.dataset.variable;
1900+
const defaultValue = select.dataset.default || "";
17261901
const customInput = document.getElementById(
17271902
`custom_input_${variable}`
17281903
) as HTMLInputElement | null;
@@ -1735,7 +1910,12 @@ CMD ["qbt.bash", "bootstrap_deps", "all"]`;
17351910
// Hide description and show custom input
17361911
if (descriptionP) descriptionP.style.display = "none";
17371912
customInput.style.display = "block";
1913+
// Populate with default value if empty
1914+
if (!customInput.value.trim()) {
1915+
customInput.value = defaultValue;
1916+
}
17381917
customInput.focus();
1918+
customInput.select(); // Select all text for easy editing
17391919
} else {
17401920
// Show description and hide custom input
17411921
if (descriptionP) descriptionP.style.display = "block";

0 commit comments

Comments
 (0)