[PR #1865] fix(mac): Fix HARDSUBX configure script and add documentation #2640

Closed
opened 2026-01-29 17:23:13 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1865

State: closed
Merged: Yes


Summary

  • Fixes #1173 - Error in ./configure enabling hardsubx on Mac
  • Fixes #1306 - Add HARDSUBX compilation docs for macOS

The configure.ac script failed on macOS with "binary operator expected" because the pkg-config output was unquoted. When pkg-config returns multiple libraries (e.g., -ltesseract -lcurl), the unquoted expansion caused test ! -z to receive multiple arguments instead of a single string.

Changes

  1. Quote pkg-config output in TESSERACT_PRESENT conditional (both mac/ and linux/configure.ac)
  2. Add macOS section to docs/HARDSUBX.txt with all three build methods:
    • ./build.command -hardsubx (recommended)
    • autoconf with --enable-hardsubx --enable-ocr
    • cmake with -DWITH_HARDSUBX=ON
  3. Add GitHub Actions jobs to test HARDSUBX builds on macOS:
    • build_shell_hardsubx: Tests ./build.command -hardsubx
    • build_autoconf_hardsubx: Tests ./configure --enable-hardsubx --enable-ocr

Root Cause

# Before (broken):
AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z  $(pkg-config --libs-only-l --silence-errors tesseract) ])
# When pkg-config returns "-ltesseract -lcurl", shell expands to:
# test ! -z -ltesseract -lcurl  <-- ERROR: "-ltesseract" looks like an operator

# After (fixed):
AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z  "$(pkg-config --libs-only-l --silence-errors tesseract)" ])
# Shell expands to:
# test ! -z "-ltesseract -lcurl"  <-- Correct: single quoted string

Test plan

  • GitHub Actions build_autoconf_hardsubx job passes (tests the fix)
  • GitHub Actions build_shell_hardsubx job passes
  • Verify -hardsubx parameter is recognized in built binary

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1865 **State:** closed **Merged:** Yes --- ## Summary - Fixes #1173 - Error in ./configure enabling hardsubx on Mac - Fixes #1306 - Add HARDSUBX compilation docs for macOS The configure.ac script failed on macOS with "binary operator expected" because the `pkg-config` output was unquoted. When pkg-config returns multiple libraries (e.g., `-ltesseract -lcurl`), the unquoted expansion caused `test ! -z` to receive multiple arguments instead of a single string. ## Changes 1. **Quote pkg-config output** in `TESSERACT_PRESENT` conditional (both mac/ and linux/configure.ac) 2. **Add macOS section** to docs/HARDSUBX.txt with all three build methods: - `./build.command -hardsubx` (recommended) - autoconf with `--enable-hardsubx --enable-ocr` - cmake with `-DWITH_HARDSUBX=ON` 3. **Add GitHub Actions jobs** to test HARDSUBX builds on macOS: - `build_shell_hardsubx`: Tests `./build.command -hardsubx` - `build_autoconf_hardsubx`: Tests `./configure --enable-hardsubx --enable-ocr` ## Root Cause ```bash # Before (broken): AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z $(pkg-config --libs-only-l --silence-errors tesseract) ]) # When pkg-config returns "-ltesseract -lcurl", shell expands to: # test ! -z -ltesseract -lcurl <-- ERROR: "-ltesseract" looks like an operator # After (fixed): AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z "$(pkg-config --libs-only-l --silence-errors tesseract)" ]) # Shell expands to: # test ! -z "-ltesseract -lcurl" <-- Correct: single quoted string ``` ## Test plan - [ ] GitHub Actions `build_autoconf_hardsubx` job passes (tests the fix) - [ ] GitHub Actions `build_shell_hardsubx` job passes - [ ] Verify `-hardsubx` parameter is recognized in built binary 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claunia added the pull-request label 2026-01-29 17:23:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2640