forked from zmwangx/rust-ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.cmd
More file actions
108 lines (95 loc) · 3.19 KB
/
Copy pathbootstrap.cmd
File metadata and controls
108 lines (95 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
@echo off
:: Bootstrap script for playa-ffmpeg
:: Handles environment setup and runs build/publish commands
::
:: Usage:
:: bootstrap.cmd # Show help
:: bootstrap.cmd build # Build release (default)
:: bootstrap.cmd build --release # Build release
:: bootstrap.cmd build --debug # Build debug
:: bootstrap.cmd crate # Dry-run crate publish
:: bootstrap.cmd crate publish # Publish crate to crates.io
setlocal enabledelayedexpansion
:: Check if cargo is installed
where cargo >nul 2>&1
if errorlevel 1 (
echo Error: Rust/Cargo not found!
echo.
echo Please install Rust from: https://rustup.rs/
exit /b 1
)
:: Setup Visual Studio environment
echo Setting up build environment...
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist "%VSWHERE%" (
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvars64.bat"
if exist "!VCVARS!" (
call "!VCVARS!" >nul 2>&1
echo ✓ Visual Studio environment configured
)
)
)
:: Setup vcpkg
if exist "C:\vcpkg" (
set "VCPKG_ROOT=C:\vcpkg"
set "PKG_CONFIG_PATH=C:\vcpkg\installed\x64-windows-static-md\lib\pkgconfig"
echo ✓ vcpkg configured
)
echo.
:: Parse command
if "%~1"=="" goto :help
if /i "%~1"=="build" goto :build
if /i "%~1"=="format" goto :format
if /i "%~1"=="crate" goto :crate
goto :help
:build
:: Check for debug/release flag
set "BUILD_MODE=--release"
if /i "%~2"=="--debug" set "BUILD_MODE="
if /i "%~2"=="--release" set "BUILD_MODE=--release"
echo Building playa-ffmpeg %BUILD_MODE%...
cargo build --examples %BUILD_MODE%
exit /b %errorlevel%
:format
echo Formatting code with cargo fmt...
cargo fmt
if errorlevel 1 (
echo Error: Failed to format code
exit /b 1
)
echo ✓ Code formatted successfully
exit /b 0
:crate
cargo release --version >nul 2>&1
if errorlevel 1 (
echo Installing cargo-release...
cargo install cargo-release
if errorlevel 1 (
echo Error: Failed to install cargo-release
exit /b 1
)
)
if /i "%~2"=="publish" (
echo Publishing crate to crates.io...
cargo release patch --execute --no-confirm
exit /b %errorlevel%
)
echo Dry-run mode (use 'bootstrap crate publish' to actually publish)
echo This will NOT modify any files, just show what would happen
cargo release patch --no-push --allow-branch master
exit /b %errorlevel%
:help
echo playa-ffmpeg bootstrap
echo.
echo Usage:
echo bootstrap.cmd # Show this help
echo bootstrap.cmd build # Build release (default)
echo bootstrap.cmd build --release # Build release
echo bootstrap.cmd build --debug # Build debug
echo bootstrap.cmd format # Format code with cargo fmt
echo bootstrap.cmd crate # Dry-run crate publish
echo bootstrap.cmd crate publish # Publish crate to crates.io
echo.
exit /b 0
endlocal