Merge pull request #216 from pauliusbaulius/improvements

Build fixes and performance improvements
This commit is contained in:
daijro 2025-03-03 02:40:15 -06:00 committed by GitHub
commit 48ff474745
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 10 deletions

View file

@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y \
# Python
python3 python3-dev python3-pip \
# Camoufox build system tools
git p7zip-full golang-go aria2 curl \
git p7zip-full golang-go aria2 curl rsync \
# CA certificates
ca-certificates \
&& update-ca-certificates
@ -23,10 +23,10 @@ ENV PATH="/root/.cargo/bin:${PATH}"
# Fetch Firefox & apply initial patches
RUN make setup-minimal && \
make mozbootstrap && \
mkdir /app/dist
mkdir -p /app/dist
# Mount .mozbuild directory and dist folder
VOLUME /root/.mozbuild
VOLUME /app/dist
ENTRYPOINT ["python3", "./multibuild.py"]
ENTRYPOINT ["python3", "./multibuild.py"]

View file

@ -44,7 +44,10 @@ inline std::optional<std::string> get_env_utf8(const std::string& name) {
}
inline const nlohmann::json& GetJson() {
static const nlohmann::json jsonConfig = []() {
static std::once_flag initFlag;
static nlohmann::json jsonConfig;
std::call_once(initFlag, []() {
std::string jsonString;
int index = 1;
@ -63,17 +66,21 @@ inline const nlohmann::json& GetJson() {
if (originalConfig) jsonString = *originalConfig;
}
if (jsonString.empty()) return nlohmann::json{};
if (jsonString.empty()) {
jsonConfig = nlohmann::json{};
return;
}
// Validate
if (!nlohmann::json::accept(jsonString)) {
printf_stderr("ERROR: Invalid JSON passed to CAMOU_CONFIG!\n");
return nlohmann::json{};
jsonConfig = nlohmann::json{};
return;
}
nlohmann::json result = nlohmann::json::parse(jsonString);
return result;
}();
jsonConfig = nlohmann::json::parse(jsonString);
});
return jsonConfig;
}

View file

@ -22,6 +22,7 @@ import os
import sys
from dataclasses import dataclass
from typing import List
import shutil
# Constants
AVAILABLE_TARGETS = ["linux", "windows", "macos"]
@ -86,7 +87,7 @@ def run_build(target, arch):
# Move assets to dist
print('Assets:', ', '.join(builder.assets))
for asset in builder.assets:
os.rename(asset, f'dist/{asset}')
shutil.move(asset, f'dist/{asset}')
def main():