apt-layer/build.bat

67 lines
No EOL
1.8 KiB
Batchfile

@echo off
REM Windows build script for apt-layer C implementation
echo Building apt-layer C implementation...
REM Create directories
if not exist "obj" mkdir obj
if not exist "bin" mkdir bin
REM Check if gcc is available
gcc --version >nul 2>&1
if errorlevel 1 (
echo Error: gcc not found. Please install MinGW or another C compiler.
exit /b 1
)
REM Compile source files
echo Compiling source files...
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/main.c -o obj/main.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/cli.c -o obj/cli.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/log.c -o obj/log.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/config.c -o obj/config.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/utils.c -o obj/utils.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/deps.c -o obj/deps.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/ostree.c -o obj/ostree.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/layer.c -o obj/layer.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/apt.c -o obj/apt.o
if errorlevel 1 goto error
gcc -Wall -Wextra -std=c99 -g -O2 -Iinclude -c src/container.c -o obj/container.o
if errorlevel 1 goto error
REM Link the binary
echo Linking binary...
gcc obj/*.o -o bin/apt-layer.exe
if errorlevel 1 goto error
echo.
echo Build successful! Binary created at: bin/apt-layer.exe
echo.
echo Note: This is a basic implementation. Some features may not work on Windows.
echo For full functionality, build and run on a Linux system.
goto end
:error
echo.
echo Build failed! Please check the error messages above.
exit /b 1
:end