mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
feat(web): implement macOS app feature and file logger (#1723)
This commit is contained in:
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
# Build macOS .app bundle for PicoClaw Launcher
|
||||
|
||||
set -e
|
||||
|
||||
EXECUTABLE=$1
|
||||
|
||||
if [ -z "$EXECUTABLE" ]; then
|
||||
echo "Usage: $0 <executable>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "executable: $EXECUTABLE"
|
||||
|
||||
APP_NAME="PicoClaw Launcher"
|
||||
APP_PATH="./build/${APP_NAME}.app"
|
||||
APP_CONTENTS="${APP_PATH}/Contents"
|
||||
APP_MACOS="${APP_CONTENTS}/MacOS"
|
||||
APP_RESOURCES="${APP_CONTENTS}/Resources"
|
||||
APP_EXECUTABLE="picoclaw-launcher"
|
||||
ICON_SOURCE="./scripts/icon.icns"
|
||||
|
||||
# Clean up existing .app
|
||||
if [ -d "$APP_PATH" ]; then
|
||||
echo "Removing existing ${APP_PATH}"
|
||||
rm -rf "$APP_PATH"
|
||||
fi
|
||||
|
||||
# Create directory structure
|
||||
echo "Creating .app bundle structure..."
|
||||
mkdir -p "$APP_MACOS"
|
||||
mkdir -p "$APP_RESOURCES"
|
||||
|
||||
# Copy executable
|
||||
echo "Copying executable..."
|
||||
if [ -f "./web/build/${APP_EXECUTABLE}" ]; then
|
||||
cp "./web/build/${APP_EXECUTABLE}" "${APP_MACOS}/"
|
||||
else
|
||||
echo "Error: ./web/build/${APP_EXECUTABLE} not found. Please build the web backend first."
|
||||
echo "Run: make build in web dir"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f "./build/picoclaw" ]; then
|
||||
cp "./build/picoclaw" "${APP_MACOS}/"
|
||||
else
|
||||
echo "Error: ./build/picoclaw not found. Please build the main file first."
|
||||
echo "Run: make build"
|
||||
exit 1
|
||||
fi
|
||||
chmod +x "${APP_MACOS}/"*
|
||||
|
||||
# Create Info.plist
|
||||
echo "Creating Info.plist..."
|
||||
cat > "${APP_CONTENTS}/Info.plist" << 'EOF'
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>picoclaw-launcher</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.picoclaw.launcher</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>PicoClaw Launcher</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>PicoClaw Launcher</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.icns</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>LSUIElement</key>
|
||||
<string>1</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
#sips -z 128 128 "$ICON_SOURCE" --out "${ICONSET_PATH}/icon_128x128.png" > /dev/null 2>&1
|
||||
#
|
||||
## Create icns file
|
||||
#iconutil -c icns "$ICONSET_PATH" -o "$ICON_OUTPUT" 2>/dev/null || {
|
||||
# echo "Warning: iconutil failed"
|
||||
#}
|
||||
|
||||
cp $ICON_SOURCE "${APP_RESOURCES}/icon.icns"
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Successfully created: ${APP_PATH}"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "To launch PicoClaw:"
|
||||
echo " 1. Double-click ${APP_NAME}.app in Finder"
|
||||
echo " 2. Or use: open ${APP_PATH}"
|
||||
echo ""
|
||||
echo "Note: The app will run in the menu bar (systray) without a terminal window."
|
||||
echo ""
|
||||
Binary file not shown.
@@ -0,0 +1,65 @@
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "PicoClaw Launcher"
|
||||
#define MyAppVersion "1.0"
|
||||
#define MyAppPublisher "PicoClaw"
|
||||
#define MyAppURL "https://github.com/sipeed/picoclaw"
|
||||
#define MyAppExeName "picoclaw-launcher.exe"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppId={{C8A1B4E7-D5F9-4C2A-8A6E-5F4D3C2A1B0E}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
;AppVerName={#MyAppName} {#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={autopf}\PicoClaw
|
||||
DefaultGroupName={#MyAppName}
|
||||
; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run
|
||||
; on anything but x64 and Windows 11 on Arm.
|
||||
ArchitecturesAllowed=x64compatible
|
||||
; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the
|
||||
; install be done in "64-bit mode" on x64 or Windows 11 on Arm,
|
||||
; meaning it should use the native 64-bit Program Files directory and
|
||||
; the 64-bit view of the registry.
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
DisableProgramGroupPage=yes
|
||||
; Remove the following line to run in administrative install mode (install for all users.)
|
||||
PrivilegesRequired=lowest
|
||||
OutputDir=build
|
||||
OutputBaseFilename=PicoClawSetup
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
; SourceDir=windows
|
||||
SetupIconFile=icon.ico
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Dirs]
|
||||
|
||||
[Files]
|
||||
Source: "..\web\build\picoclaw-launcher.exe"; DestDir: "{app}"; DestName: "{#MyAppExeName}"; Flags: ignoreversion
|
||||
Source: "..\build\picoclaw.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\web\backend\icon.ico"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[UninstallDelete]
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; WorkingDir: "{app}"; IconFilename: "{app}\icon.ico"
|
||||
Name: "{group}\Uninstall {#MyAppName}"; Filename: "{uninstallexe}"
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; WorkingDir: "{app}"; Tasks: desktopicon; IconFilename: "{app}\icon.ico"
|
||||
|
||||
[Run]
|
||||
Filename:"{app}\{#MyAppExeName}"; WorkingDir: "{app}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
Reference in New Issue
Block a user