diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..db0d239 --- /dev/null +++ b/build.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Build Nebula Browser (macOS). +# Usage: +# ./build.sh - configure + Release build +# ./build.sh Debug - configure + Debug build +# ./build.sh Release - configure + Release build +# ./build.sh configure - configure only +# ./build.sh clean - remove the build folder + +cd "$(dirname "$0")" + +if [[ "${1:-}" == "clean" ]]; then + echo "Removing build/ ..." + rm -rf build + echo "Done." + exit 0 +fi + +CONFIG="Release" +case "${1:-}" in + Debug|debug) CONFIG="Debug" ;; + Release|release) CONFIG="Release" ;; +esac + +if [[ ! -f "thirdparty/cef/cmake/FindCEF.cmake" ]]; then + echo "ERROR: CEF not found at thirdparty/cef/" + echo "Download a macOS CEF standard binary distribution and extract it" + echo "so that thirdparty/cef/cmake/FindCEF.cmake exists." + exit 1 +fi + +case "$(uname -m)" in + arm64) PROJECT_ARCH="arm64" ;; + x86_64) PROJECT_ARCH="x86_64" ;; + *) + echo "ERROR: Unsupported architecture: $(uname -m)" + exit 1 + ;; +esac + +echo "Configuring CMake (arch=$PROJECT_ARCH, config=$CONFIG)..." +cmake -B build \ + -DPROJECT_ARCH="$PROJECT_ARCH" \ + -DCMAKE_BUILD_TYPE="$CONFIG" \ + || { echo "Configure failed."; exit 1; } + +if [[ "${1:-}" == "configure" ]]; then + echo "Configure complete." + exit 0 +fi + +echo "Building $CONFIG..." +cmake --build build --config "$CONFIG" \ + || { echo "Build failed."; exit 1; } + +APP_PATH="" +for candidate in "build/$CONFIG/NebulaBrowser.app" "build/NebulaBrowser.app"; do + if [[ -d "$candidate" ]]; then + APP_PATH="$candidate" + break + fi +done + +echo "" +if [[ -n "$APP_PATH" ]]; then + echo "Build succeeded: $APP_PATH" +else + echo "Build succeeded (app bundle location may vary under build/)" +fi diff --git a/src/extensions/extension_manager.cpp b/src/extensions/extension_manager.cpp index 6b4437c..0360979 100644 --- a/src/extensions/extension_manager.cpp +++ b/src/extensions/extension_manager.cpp @@ -26,16 +26,6 @@ std::string ReadFile(const std::filesystem::path& path) { return buffer.str(); } -std::string Trim(std::string value) { - while (!value.empty() && std::isspace(static_cast(value.front()))) { - value.erase(value.begin()); - } - while (!value.empty() && std::isspace(static_cast(value.back()))) { - value.pop_back(); - } - return value; -} - std::string ToLowerAscii(std::string value) { std::transform(value.begin(), value.end(), value.begin(), [](unsigned char ch) { return static_cast(std::tolower(ch));