Skip to content

Commit 8352c41

Browse files
committed
Add SDL3 as git submodule + dark mode template
1 parent 460dfcf commit 8352c41

7 files changed

Lines changed: 191 additions & 55 deletions

File tree

.github/config.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ BINDING_SRC_DIR="src/${BINDING_MODULE_NAME}"
1414
SDL_HEADER_COMMIT="e1a623f129e75ad532315852d656fb26c80382a6"
1515

1616
# Search paths for SDL3 headers (colon-separated)
17-
SDL_HEADER_PATHS="/usr/local/include/SDL3:/usr/include/SDL3:/opt/homebrew/include/SDL3"
17+
# Includes local submodule path first, then system paths
18+
SDL_HEADER_PATHS="SDL3/include/SDL3:/usr/local/include/SDL3:/usr/include/SDL3:/opt/homebrew/include/SDL3"
1819

1920
# Export for subprocesses
2021
export BINDING_MODULE_NAME BINDING_SRC_DIR SDL_HEADER_COMMIT SDL_HEADER_PATHS

.github/generate-binding-status.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ fi
2323
echo "Building binding checker..." >&2
2424
cabal build exe:binding-checker -f-pkgconfig >/dev/null 2>&1
2525

26-
# Find SDL3 headers
27-
SDL_PATHS="/usr/local/include/SDL3:/usr/include/SDL3:/opt/homebrew/include/SDL3"
26+
# Find SDL3 headers (check submodule first, then system paths)
27+
SDL_PATHS="SDL3/include/SDL3:/usr/local/include/SDL3:/usr/include/SDL3:/opt/homebrew/include/SDL3"
2828
sdl_dir=""
2929

3030
IFS=':' read -ra PATHS <<< "$SDL_PATHS"

.github/template.html

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<!--
33
Pandoc HTML Template for SDL3 Haskell Bindings Documentation
44
@@ -146,6 +146,52 @@
146146
max-width: 100%;
147147
height: auto;
148148
}
149+
150+
/* Dark mode support */
151+
@media (prefers-color-scheme: dark) {
152+
body {
153+
background-color: #1a1625;
154+
color: #e0dce8;
155+
}
156+
h1, h2, h3, h4, h5, h6 {
157+
color: #f0ecf8;
158+
}
159+
h1 {
160+
border-bottom-color: #4a4060;
161+
}
162+
h2 {
163+
border-bottom-color: #3a3050;
164+
}
165+
pre {
166+
background-color: #252030;
167+
border-color: #3a3050;
168+
}
169+
p > code, li > code, td > code {
170+
background-color: rgba(200, 180, 220, 0.15);
171+
}
172+
table {
173+
border-color: #4a4060;
174+
}
175+
th, td {
176+
border-color: #3a3050;
177+
}
178+
th {
179+
background-color: #2a2540;
180+
}
181+
blockquote {
182+
border-left-color: #6a5090;
183+
background-color: #252035;
184+
color: #c8c0d8;
185+
}
186+
a {
187+
color: #a090d0;
188+
}
189+
.note {
190+
background-color: #2a2820;
191+
border-left-color: #a09020;
192+
color: #d8d0a0;
193+
}
194+
}
149195
</style>
150196
</head>
151197
<body>

.github/workflows/deploy-readme.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,42 @@ jobs:
1515
steps:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
18+
with:
19+
submodules: true
1820

1921
- name: Set up Haskell
2022
uses: haskell-actions/setup@v2
2123
with:
2224
ghc-version: "9.8.4"
2325
cabal-version: "latest"
2426

25-
- name: Clone SDL3 headers for binding validation
27+
- name: Set up SDL3 headers from submodule
2628
run: |
27-
echo "Cloning SDL3 headers for binding checker..."
29+
echo "Setting up SDL3 headers from submodule..."
2830
29-
# Clone SDL3 source to get headers (using specific commit e1a623f129e75ad532315852d656fb26c80382a6 for SDL3 3.3.0 pre-release)
30-
git clone https://github.com/libsdl-org/SDL.git /tmp/SDL3-headers
31-
cd /tmp/SDL3-headers
32-
git checkout e1a623f129e75ad532315852d656fb26c80382a6
33-
cd -
31+
# Source config to get the expected commit
32+
source .github/config.sh
3433
35-
# Create include directory structure that binding checker expects
36-
sudo mkdir -p /usr/local/include/SDL3
34+
# Verify submodule is at expected commit
35+
cd SDL3
36+
current_commit=$(git rev-parse HEAD)
37+
echo "SDL3 submodule at commit: $current_commit"
38+
if [ "$current_commit" != "$SDL_HEADER_COMMIT" ]; then
39+
echo "⚠️ Warning: Submodule commit ($current_commit) differs from config ($SDL_HEADER_COMMIT)"
40+
fi
41+
cd ..
3742
38-
# Copy all SDL3 headers
39-
sudo cp /tmp/SDL3-headers/include/SDL3/*.h /usr/local/include/SDL3/
43+
# Create symlink to system include path for compatibility
44+
sudo mkdir -p /usr/local/include
45+
sudo ln -sf "$(pwd)/SDL3/include/SDL3" /usr/local/include/SDL3
4046
4147
# Verify headers are available
4248
echo "Verifying SDL3 headers..."
43-
header_count=$(find /usr/local/include/SDL3 -name "SDL_*.h" | wc -l)
44-
echo "✅ Found $header_count SDL3 headers in /usr/local/include/SDL3"
49+
header_count=$(find SDL3/include/SDL3 -name "SDL_*.h" | wc -l)
50+
echo "✅ Found $header_count SDL3 headers in SDL3/include/SDL3"
4551
4652
# List first few headers for verification
47-
ls /usr/local/include/SDL3/SDL_*.h | head -5
53+
ls SDL3/include/SDL3/SDL_*.h | head -5
4854
4955
- name: Cache Cabal packages
5056
uses: actions/cache@v4

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "SDL3"]
2+
path = SDL3
3+
url = https://github.com/libsdl-org/SDL.git

0 commit comments

Comments
 (0)