-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-build.sh
More file actions
executable file
·167 lines (128 loc) · 3.22 KB
/
docker-build.sh
File metadata and controls
executable file
·167 lines (128 loc) · 3.22 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash
# Docker-optimized build script for Impulse BBS
set -e
echo "=== Impulse BBS Docker Build ==="
echo "Pipeline ID: ${CI_PIPELINE_ID:-local}"
echo "Commit: ${CI_COMMIT_SHORT_SHA:-local}"
# Paths in the Docker container
BUILD_DIR="/impulse-build/build"
SOURCE_DIR="/impulse-build/source"
OUTPUT_DIR="/impulse-build/output"
INCLUDE_DIR="/impulse-build/include"
BP_DIR="/impulse-build/BP"
# Create DOSBox configuration for headless operation
cat > dosbox.conf << EOF
[sdl]
windowresolution=800x600
output=surface
autolock=false
[dosbox]
machine=svga_s3
memsize=16
[cpu]
core=auto
cputype=auto
cycles=10000
[mixer]
nosound=true
[midi]
mpu401=none
[sblaster]
sbtype=none
[gus]
gus=false
[speaker]
pcspeaker=false
[autoexec]
# Mount directories
mount c: /tmp/impulse_dosbox
mount d: $SOURCE_DIR
mount e: $OUTPUT_DIR
mount f: $INCLUDE_DIR
# Change to source directory and build
d:
set PATH=c:\\bp\\bin;%PATH%
call c:\\build.bat
exit
EOF
# Create the DOS build batch file
cat > build.bat << 'EOF'
@echo off
echo === Impulse BBS Compilation ===
REM Check if Borland Pascal is available
if exist c:\bp\bin\bpc.exe goto bpfound
echo ERROR: Borland Pascal not found
goto end
:bpfound
echo Found Borland Pascal compiler
REM Check if imp.pas exists
d:
if exist imp.pas goto impfound
echo ERROR: imp.pas not found in source directory
goto end
:impfound
echo Found imp.pas in source directory
REM Step 1: Build with flags
echo Step 1: Building with -$G+ -B flags...
bpc -$G+ -B -Uf:\ -Ee:\ imp.pas
if errorlevel 1 goto buildfail
echo Build step completed
goto step2
:buildfail
echo ERROR: Build step failed
goto end
:step2
echo Step 2: Final compilation...
bpc -Uf:\ -Ee:\ imp.pas
if errorlevel 1 goto compfail
echo Compilation completed
goto end
:compfail
echo ERROR: Final compilation failed
:end
echo Build process finished
EOF
# Clean previous builds
rm -rf "$BUILD_DIR"/*
rm -rf "$OUTPUT_DIR"/*
# Set up DOSBox environment
DOSBOX_DIR="/tmp/impulse_dosbox"
rm -rf "$DOSBOX_DIR"
mkdir -p "$DOSBOX_DIR"
# Copy Borland Pascal to DOSBox C: drive
cp -r "$BP_DIR" "$DOSBOX_DIR/bp"
cp build.bat "$DOSBOX_DIR/"
echo "🚀 Starting headless DOSBox compilation..."
# Use Xvfb for headless DOSBox execution
xvfb-run -a dosbox -conf dosbox.conf -noconsole
echo "🔍 Checking compilation results..."
# Check if compilation was successful
if [ -f "$OUTPUT_DIR/IMP.EXE" ] && [ -f "$OUTPUT_DIR/IMP.OVR" ]; then
echo "✅ Compilation successful!"
# Copy files to build directory
cp "$OUTPUT_DIR/IMP.EXE" "$BUILD_DIR/"
cp "$OUTPUT_DIR/IMP.OVR" "$BUILD_DIR/"
# Create build info file
cat > "$BUILD_DIR/build-info.txt" << EOF
Impulse BBS 7.1 Build Information
================================
Build Date: $(date)
Pipeline ID: ${CI_PIPELINE_ID:-local}
Commit SHA: ${CI_COMMIT_SHA:-local}
Commit Message: ${CI_COMMIT_MESSAGE:-local build}
Files:
EOF
ls -la "$BUILD_DIR"/*.EXE "$BUILD_DIR"/*.OVR >> "$BUILD_DIR/build-info.txt"
echo ""
echo "🎉 Build complete! Files:"
ls -la "$BUILD_DIR"/
echo ""
echo "📊 File sizes:"
du -h "$BUILD_DIR"/IMP.*
else
echo "❌ Compilation failed"
echo "Output directory contents:"
ls -la "$OUTPUT_DIR/"
exit 1
fi
echo "=== Docker Build Complete ==="