Skip to content

Commit 6fdfde0

Browse files
authored
fix(mac): Fix HARDSUBX configure script and add documentation
2 parents feb2a61 + 8db7fc7 commit 6fdfde0

File tree

4 files changed

+79
-5
lines changed

4 files changed

+79
-5
lines changed

.github/workflows/build_mac.yml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,59 @@ jobs:
103103
working-directory: build
104104
- name: Display version information
105105
run: ./build/ccextractor --version
106+
build_shell_hardsubx:
107+
# Test build.command with -hardsubx flag (burned-in subtitle extraction)
108+
runs-on: macos-latest
109+
steps:
110+
- name: Install dependencies
111+
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac ffmpeg
112+
- uses: actions/checkout@v6
113+
- name: build with hardsubx
114+
run: ./build.command -hardsubx
115+
working-directory: ./mac
116+
- name: Display version information
117+
run: ./ccextractor --version
118+
working-directory: ./mac
119+
- name: Verify hardsubx support
120+
run: |
121+
# Check that -hardsubx is recognized (will fail if not compiled in)
122+
./ccextractor -hardsubx --help 2>&1 | head -20 || true
123+
working-directory: ./mac
124+
build_autoconf_hardsubx:
125+
# Test autoconf build with HARDSUBX enabled (fixes issue #1173)
126+
runs-on: macos-latest
127+
steps:
128+
- uses: actions/checkout@v6
129+
- name: Install dependencies
130+
run: brew install pkg-config autoconf automake libtool tesseract leptonica gpac ffmpeg
131+
- name: run autogen
132+
run: ./autogen.sh
133+
working-directory: ./mac
134+
- name: configure with hardsubx
135+
run: |
136+
# Set Homebrew paths for configure to find libraries
137+
export HOMEBREW_PREFIX="$(brew --prefix)"
138+
export LDFLAGS="-L${HOMEBREW_PREFIX}/lib"
139+
export CPPFLAGS="-I${HOMEBREW_PREFIX}/include"
140+
export PKG_CONFIG_PATH="${HOMEBREW_PREFIX}/lib/pkgconfig"
141+
./configure --enable-hardsubx --enable-ocr
142+
working-directory: ./mac
143+
- name: make
144+
run: make
145+
working-directory: ./mac
146+
- name: Display version information
147+
run: ./ccextractor --version
148+
working-directory: ./mac
149+
- name: Verify hardsubx support
150+
run: |
151+
# Check that -hardsubx is recognized
152+
./ccextractor -hardsubx --help 2>&1 | head -20 || true
153+
working-directory: ./mac
106154
build_rust:
107155
runs-on: macos-latest
108156
steps:
109157
- uses: actions/checkout@v6
110-
- name: cache
158+
- name: cache
111159
uses: actions/cache@v5
112160
with:
113161
path: |
@@ -121,5 +169,5 @@ jobs:
121169
toolchain: stable
122170
override: true
123171
- name: build
124-
run: cargo build
172+
run: cargo build
125173
working-directory: ./src/rust

docs/HARDSUBX.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,32 @@ To build the program with hardsubx support,
5454

5555
NOTE: The build has been tested with FFMpeg version 3.1.0, and Tesseract 3.04.
5656

57+
macOS
58+
-----
59+
60+
Install the required dependencies using Homebrew:
61+
brew install tesseract leptonica ffmpeg
62+
63+
To build the program with hardsubx support, use one of these methods:
64+
65+
== Using build.command (Recommended):
66+
cd ccextractor/mac
67+
./build.command -hardsubx
68+
69+
== Using autoconf:
70+
cd ccextractor/mac
71+
./autogen.sh
72+
./configure --enable-hardsubx --enable-ocr
73+
make
74+
75+
== Using cmake:
76+
cd ccextractor
77+
mkdir build && cd build
78+
cmake -DWITH_OCR=ON -DWITH_HARDSUBX=ON ../src/
79+
make
80+
81+
NOTE: The -hardsubx parameter uses a single dash (not --hardsubx).
82+
5783
Windows
5884
-------
5985

linux/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ AS_IF([ (test x$ocr = xtrue || test x$hardsubx = xtrue) && test ! $HAS_LEPT -gt
154154
AM_CONDITIONAL(HARDSUBX_IS_ENABLED, [ test x$hardsubx = xtrue ])
155155
AM_CONDITIONAL(OCR_IS_ENABLED, [ test x$ocr = xtrue || test x$hardsubx = xtrue ])
156156
AM_CONDITIONAL(FFMPEG_IS_ENABLED, [ test x$ffmpeg = xtrue ])
157-
AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z $(pkg-config --libs-only-l --silence-errors tesseract) ])
157+
AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z "$(pkg-config --libs-only-l --silence-errors tesseract)" ])
158158
AM_CONDITIONAL(TESSERACT_PRESENT_RPI, [ test -d "/usr/include/tesseract" && test $(ls -A /usr/include/tesseract | wc -l) -gt 0 ])
159159
AM_CONDITIONAL(SYS_IS_LINUX, [ test $(uname -s) = "Linux"])
160160
AM_CONDITIONAL(SYS_IS_MAC, [ test $(uname -s) = "Darwin"])

mac/configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fi
2525

2626
# Checks for libraries.
2727
AC_CHECK_LIB([m], [sin], [], [AC_MSG_ERROR(Math library not installed. Install it before proceeding.)])
28-
AC_CHECK_LIB([lept], [getLeptonicaVersion], [HAS_LEPT=1 && PKG_CHECK_MODULES([lept], [lept])], [HAS_LEPT=0])
28+
AC_CHECK_LIB([leptonica], [getLeptonicaVersion], [HAS_LEPT=1 && PKG_CHECK_MODULES([lept], [lept])], [HAS_LEPT=0])
2929
AC_CHECK_LIB([tesseract], [TessVersion], [HAS_TESSERACT=1 && PKG_CHECK_MODULES([tesseract], [tesseract])], [HAS_TESSERACT=0])
3030
AC_CHECK_LIB([avcodec], [avcodec_version], [HAS_AVCODEC=1 && PKG_CHECK_MODULES([libavcodec], [libavcodec])], [HAS_AVCODEC=0])
3131
AC_CHECK_LIB([avformat], [avformat_version], [HAS_AVFORMAT=1 && PKG_CHECK_MODULES([libavformat], [libavformat])], [HAS_AVFORMAT=0])
@@ -148,7 +148,7 @@ AS_IF([ (test x$ocr = xtrue || test x$hardsubx = xtrue) && test ! $HAS_LEPT -gt
148148
AM_CONDITIONAL(HARDSUBX_IS_ENABLED, [ test x$hardsubx = xtrue ])
149149
AM_CONDITIONAL(OCR_IS_ENABLED, [ test x$ocr = xtrue || test x$hardsubx = xtrue ])
150150
AM_CONDITIONAL(FFMPEG_IS_ENABLED, [ test x$ffmpeg = xtrue ])
151-
AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z $(pkg-config --libs-only-l --silence-errors tesseract) ])
151+
AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z "$(pkg-config --libs-only-l --silence-errors tesseract)" ])
152152
AM_CONDITIONAL(TESSERACT_PRESENT_RPI, [ test -d "/usr/include/tesseract" && test $(ls -A /usr/include/tesseract | wc -l) -gt 0 ])
153153
AM_CONDITIONAL(SYS_IS_LINUX, [ test $(uname -s) = "Linux"])
154154
AM_CONDITIONAL(SYS_IS_MAC, [ test $(uname -s) = "Darwin"])

0 commit comments

Comments
 (0)