Skip to content

Commit 197069d

Browse files
cfsmp3claude
andcommitted
ci: add Debian 13 (Trixie) .deb build workflow
Creates .deb packages for Debian 13 using a Docker container. - Builds GPAC from source (abi-16.4 tag) - Creates basic and hardsubx variants - Uses Debian 13's library versions: - libtesseract5, libleptonica6 - libavcodec61, libavformat61, libavutil59, libswscale8 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7a810d7 commit 197069d

File tree

1 file changed

+275
-0
lines changed

1 file changed

+275
-0
lines changed
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
name: Build Debian 13 .deb Package
2+
3+
on:
4+
# Build on releases
5+
release:
6+
types: [published]
7+
# Allow manual trigger
8+
workflow_dispatch:
9+
inputs:
10+
build_type:
11+
description: 'Build type (all, basic, hardsubx)'
12+
required: false
13+
default: 'all'
14+
# Build on pushes to workflow file for testing
15+
push:
16+
paths:
17+
- '.github/workflows/build_deb_debian13.yml'
18+
19+
jobs:
20+
build-deb:
21+
runs-on: ubuntu-latest
22+
container:
23+
image: debian:trixie
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
build_type: [basic, hardsubx]
28+
29+
steps:
30+
- name: Check if should build this variant
31+
id: should_build
32+
run: |
33+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
34+
INPUT_TYPE="${{ github.event.inputs.build_type }}"
35+
if [ "$INPUT_TYPE" = "all" ] || [ "$INPUT_TYPE" = "${{ matrix.build_type }}" ]; then
36+
echo "should_build=true" >> $GITHUB_OUTPUT
37+
else
38+
echo "should_build=false" >> $GITHUB_OUTPUT
39+
fi
40+
else
41+
echo "should_build=true" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: Install git and dependencies for checkout
45+
if: steps.should_build.outputs.should_build == 'true'
46+
run: |
47+
apt-get update
48+
apt-get install -y git ca-certificates
49+
50+
- name: Checkout repository
51+
if: steps.should_build.outputs.should_build == 'true'
52+
uses: actions/checkout@v6
53+
54+
- name: Get version
55+
if: steps.should_build.outputs.should_build == 'true'
56+
id: version
57+
run: |
58+
# Extract version from source or use tag
59+
if [ "${{ github.event_name }}" = "release" ]; then
60+
VERSION="${{ github.event.release.tag_name }}"
61+
VERSION="${VERSION#v}" # Remove 'v' prefix if present
62+
else
63+
# Extract version from lib_ccx.h (e.g., #define VERSION "0.96.5")
64+
VERSION=$(grep -oP '#define VERSION "\K[^"]+' src/lib_ccx/lib_ccx.h || echo "0.96")
65+
fi
66+
echo "version=$VERSION" >> $GITHUB_OUTPUT
67+
echo "Building version: $VERSION"
68+
69+
- name: Install base dependencies
70+
if: steps.should_build.outputs.should_build == 'true'
71+
run: |
72+
apt-get install -y --no-install-recommends \
73+
build-essential \
74+
cmake \
75+
pkg-config \
76+
zlib1g-dev \
77+
libpng-dev \
78+
libjpeg-dev \
79+
libfreetype-dev \
80+
libxml2-dev \
81+
libcurl4-gnutls-dev \
82+
libssl-dev \
83+
clang \
84+
libclang-dev \
85+
tesseract-ocr \
86+
libtesseract-dev \
87+
libleptonica-dev \
88+
patchelf \
89+
curl
90+
91+
- name: Install FFmpeg dependencies (HardSubX)
92+
if: steps.should_build.outputs.should_build == 'true' && matrix.build_type == 'hardsubx'
93+
run: |
94+
apt-get install -y --no-install-recommends \
95+
libavcodec-dev \
96+
libavformat-dev \
97+
libavutil-dev \
98+
libswscale-dev \
99+
libswresample-dev \
100+
libavfilter-dev \
101+
libavdevice-dev
102+
103+
- name: Install Rust toolchain
104+
if: steps.should_build.outputs.should_build == 'true'
105+
run: |
106+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
107+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
108+
109+
- name: Build GPAC
110+
if: steps.should_build.outputs.should_build == 'true'
111+
run: |
112+
git clone -b abi-16.4 --depth 1 https://github.com/gpac/gpac
113+
cd gpac
114+
./configure --prefix=/usr
115+
make -j$(nproc)
116+
make install-lib
117+
ldconfig
118+
119+
- name: Build CCExtractor
120+
if: steps.should_build.outputs.should_build == 'true'
121+
run: |
122+
export PATH="$HOME/.cargo/bin:$PATH"
123+
mkdir build && cd build
124+
if [ "${{ matrix.build_type }}" = "hardsubx" ]; then
125+
cmake ../src -DCMAKE_BUILD_TYPE=Release -DWITH_OCR=ON -DWITH_HARDSUBX=ON
126+
else
127+
cmake ../src -DCMAKE_BUILD_TYPE=Release -DWITH_OCR=ON
128+
fi
129+
make -j$(nproc)
130+
131+
- name: Test build
132+
if: steps.should_build.outputs.should_build == 'true'
133+
run: ./build/ccextractor --version
134+
135+
- name: Create .deb package structure
136+
if: steps.should_build.outputs.should_build == 'true'
137+
id: create_deb
138+
run: |
139+
VERSION="${{ steps.version.outputs.version }}"
140+
VARIANT="${{ matrix.build_type }}"
141+
142+
if [ "$VARIANT" = "basic" ]; then
143+
PKG_NAME="ccextractor_${VERSION}_debian13_amd64"
144+
else
145+
PKG_NAME="ccextractor-${VARIANT}_${VERSION}_debian13_amd64"
146+
fi
147+
148+
mkdir -p ${PKG_NAME}/DEBIAN
149+
mkdir -p ${PKG_NAME}/usr/bin
150+
mkdir -p ${PKG_NAME}/usr/lib/ccextractor
151+
mkdir -p ${PKG_NAME}/usr/share/doc/ccextractor
152+
mkdir -p ${PKG_NAME}/usr/share/man/man1
153+
154+
# Copy binary
155+
cp build/ccextractor ${PKG_NAME}/usr/bin/
156+
157+
# Copy GPAC library
158+
cp /usr/lib/libgpac.so* ${PKG_NAME}/usr/lib/ccextractor/
159+
160+
# Set rpath so ccextractor finds bundled libgpac
161+
patchelf --set-rpath '/usr/lib/ccextractor:$ORIGIN/../lib/ccextractor' ${PKG_NAME}/usr/bin/ccextractor
162+
163+
# Copy documentation
164+
cp docs/CHANGES.TXT ${PKG_NAME}/usr/share/doc/ccextractor/changelog
165+
cp LICENSE.txt ${PKG_NAME}/usr/share/doc/ccextractor/copyright
166+
gzip -9 -n ${PKG_NAME}/usr/share/doc/ccextractor/changelog
167+
168+
# Create control file
169+
if [ "$VARIANT" = "basic" ]; then
170+
PKG_DESCRIPTION="CCExtractor - closed captions and teletext subtitle extractor"
171+
else
172+
PKG_DESCRIPTION="CCExtractor (with HardSubX) - closed captions and teletext subtitle extractor"
173+
fi
174+
175+
INSTALLED_SIZE=$(du -sk ${PKG_NAME}/usr | cut -f1)
176+
177+
# Determine dependencies based on build variant (Debian 13 Trixie)
178+
if [ "$VARIANT" = "hardsubx" ]; then
179+
DEPENDS="libc6, libtesseract5, libleptonica6, libcurl3t64-gnutls, libavcodec61, libavformat61, libavutil59, libswscale8"
180+
else
181+
DEPENDS="libc6, libtesseract5, libleptonica6, libcurl3t64-gnutls"
182+
fi
183+
184+
cat > ${PKG_NAME}/DEBIAN/control << CTRL
185+
Package: ccextractor
186+
Version: ${VERSION}
187+
Section: utils
188+
Priority: optional
189+
Architecture: amd64
190+
Installed-Size: ${INSTALLED_SIZE}
191+
Depends: ${DEPENDS}
192+
Maintainer: CCExtractor Development Team <carlos@ccextractor.org>
193+
Homepage: https://www.ccextractor.org
194+
Description: ${PKG_DESCRIPTION}
195+
CCExtractor is a tool that extracts closed captions and teletext subtitles
196+
from video files and streams. It supports a wide variety of input formats
197+
including MPEG, H.264/AVC, H.265/HEVC, MP4, MKV, WTV, and transport streams.
198+
.
199+
This package includes a bundled GPAC library for MP4 support.
200+
Built for Debian 13 (Trixie).
201+
CTRL
202+
203+
# Remove leading spaces from control file
204+
sed -i 's/^ //' ${PKG_NAME}/DEBIAN/control
205+
206+
# Create postinst to update library cache
207+
cat > ${PKG_NAME}/DEBIAN/postinst << 'POSTINST'
208+
#!/bin/sh
209+
set -e
210+
ldconfig
211+
POSTINST
212+
chmod 755 ${PKG_NAME}/DEBIAN/postinst
213+
214+
# Create postrm to update library cache
215+
cat > ${PKG_NAME}/DEBIAN/postrm << 'POSTRM'
216+
#!/bin/sh
217+
set -e
218+
ldconfig
219+
POSTRM
220+
chmod 755 ${PKG_NAME}/DEBIAN/postrm
221+
222+
# Set permissions
223+
chmod 755 ${PKG_NAME}/usr/bin/ccextractor
224+
chmod 755 ${PKG_NAME}/usr/lib/ccextractor
225+
find ${PKG_NAME}/usr/lib/ccextractor -name "*.so*" -exec chmod 644 {} \;
226+
227+
# Build the .deb
228+
dpkg-deb --build --root-owner-group ${PKG_NAME}
229+
230+
echo "deb_name=${PKG_NAME}.deb" >> $GITHUB_OUTPUT
231+
232+
- name: Test .deb package
233+
if: steps.should_build.outputs.should_build == 'true'
234+
run: |
235+
VERSION="${{ steps.version.outputs.version }}"
236+
VARIANT="${{ matrix.build_type }}"
237+
238+
if [ "$VARIANT" = "basic" ]; then
239+
PKG_NAME="ccextractor_${VERSION}_debian13_amd64"
240+
else
241+
PKG_NAME="ccextractor-${VARIANT}_${VERSION}_debian13_amd64"
242+
fi
243+
244+
# Install and test (apt handles dependencies automatically)
245+
apt-get update
246+
apt-get install -y ./${PKG_NAME}.deb
247+
ccextractor --version
248+
249+
- name: Get .deb filename
250+
if: steps.should_build.outputs.should_build == 'true'
251+
id: deb_name
252+
run: |
253+
VERSION="${{ steps.version.outputs.version }}"
254+
VARIANT="${{ matrix.build_type }}"
255+
256+
if [ "$VARIANT" = "basic" ]; then
257+
echo "name=ccextractor_${VERSION}_debian13_amd64.deb" >> $GITHUB_OUTPUT
258+
else
259+
echo "name=ccextractor-${VARIANT}_${VERSION}_debian13_amd64.deb" >> $GITHUB_OUTPUT
260+
fi
261+
262+
- name: Upload .deb artifact
263+
if: steps.should_build.outputs.should_build == 'true'
264+
uses: actions/upload-artifact@v6
265+
with:
266+
name: ${{ steps.deb_name.outputs.name }}
267+
path: ${{ steps.deb_name.outputs.name }}
268+
269+
- name: Upload to Release
270+
if: steps.should_build.outputs.should_build == 'true' && github.event_name == 'release'
271+
uses: softprops/action-gh-release@v2
272+
with:
273+
files: ${{ steps.deb_name.outputs.name }}
274+
env:
275+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)