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

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1865
Author: @cfsmp3
Created: 12/20/2025
Status: Merged
Merged: 12/20/2025
Merged by: @cfsmp3

Base: masterHead: fix/issue-1173-hardsubx-macos


📝 Commits (3)

  • 70404c2 fix(mac): Fix HARDSUBX configure script and add documentation
  • d8504f8 ci(mac): Set Homebrew paths for autoconf HARDSUBX build
  • 8db7fc7 fix(mac): Correct leptonica library name in configure.ac

📊 Changes

4 files changed (+79 additions, -5 deletions)

View changed files

📝 .github/workflows/build_mac.yml (+50 -2)
📝 docs/HARDSUBX.txt (+26 -0)
📝 linux/configure.ac (+1 -1)
📝 mac/configure.ac (+2 -2)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1865 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 12/20/2025 **Status:** ✅ Merged **Merged:** 12/20/2025 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/issue-1173-hardsubx-macos` --- ### 📝 Commits (3) - [`70404c2`](https://github.com/CCExtractor/ccextractor/commit/70404c29ca019e0cc8d77defa5735f008ad3c3cf) fix(mac): Fix HARDSUBX configure script and add documentation - [`d8504f8`](https://github.com/CCExtractor/ccextractor/commit/d8504f80bdcdcd9df57c899f556933843bdfe00c) ci(mac): Set Homebrew paths for autoconf HARDSUBX build - [`8db7fc7`](https://github.com/CCExtractor/ccextractor/commit/8db7fc7a6df3811a7cb1b9a1fa081b62c242484f) fix(mac): Correct leptonica library name in configure.ac ### 📊 Changes **4 files changed** (+79 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/build_mac.yml` (+50 -2) 📝 `docs/HARDSUBX.txt` (+26 -0) 📝 `linux/configure.ac` (+1 -1) 📝 `mac/configure.ac` (+2 -2) </details> ### 📄 Description ## 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:23:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2636