[PR #1907] [MERGED] build(linux): Add -system-libs flag for package manager compatibility #2695

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

📋 Pull Request Information

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

Base: masterHead: build/linux-system-libs-flag


📝 Commits (3)

  • f08fd65 build(linux): Add -system-libs flag for Homebrew compatibility
  • c8750e4 build(linux): use pkg-config cflags for system-libs includes
  • 170d769 Merge branch 'master' into build/linux-system-libs-flag

📊 Changes

2 files changed (+67 additions, -1 deletions)

View changed files

📝 docs/CHANGES.TXT (+2 -0)
📝 linux/build (+65 -1)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

build(linux): Add -system-libs flag for package manager compatibility

Summary

  • Add -system-libs flag to linux/build for package manager compatibility
  • Enable building with system-installed libraries instead of bundled dependencies

Problem

  • Linux package managers, including Linuxbrew/Homebrew, require builds to use system libraries via pkg-config, but the current Linux build script only supports bundled dependencies.

  • Currently, the Linux build script only supports bundled dependencies (zlib, libpng, freetype, utf8proc), making it difficult to create distribution-compliant packages.

Solution

Add a -system-libs flag that changes the build configuration:

Mode Dependencies Sources Compiled Linking
Default Bundled in src/thirdparty/ zlib, libpng, freetype, utf8proc Linking against bundled third-party sources
-system-libs System via pkg-config Only CCExtractor core Dynamic linking via pkg-config

Implementation Details

Dependency validation:

  • Checks for pkg-config availability
  • Validates presence of: libpng, zlib, freetype2, libutf8proc
  • Verifies headers: leptonica/allheaders.h, tesseract/capi.h
  • Provides helpful error messages with installation commands

Build configuration:

  • Excludes -DFT2_BUILD_LIBRARY flag (prevents building FreeType from source)
  • Overrides include paths to use system headers
  • Compiles only lib_ccx and lib_hash (excludes bundled thirdparty sources)
  • Links against system libraries via pkg-config --libs

Compatibility:

  • Handles non-standard utf8proc header locations with temporary symlink
  • Cleans up temporary directories after build
  • Works with existing flags (-debug, -hardsubx)

Test Plan

  • Built on Linux using ./build -system-libs — build completed successfully
  • Verified dynamic linking via ldd:
    • libfreetype.so.6
    • libpng16.so.16
    • libutf8proc.so.3
    • libz.so.1
  • Confirmed no bundled third-party libraries are linked
  • ./ccextractor --version runs correctly and reports expected build info

Usage

Default build (bundled libraries):

./build

System libraries build:

./build -system-libs
  • Follows pattern from macOS implementation in #1862

🔄 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/1907 **Author:** [@x15sr71](https://github.com/x15sr71) **Created:** 12/26/2025 **Status:** ✅ Merged **Merged:** 12/26/2025 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `build/linux-system-libs-flag` --- ### 📝 Commits (3) - [`f08fd65`](https://github.com/CCExtractor/ccextractor/commit/f08fd658e6e6ded820325bdbf53028fb8a5bb6ed) build(linux): Add -system-libs flag for Homebrew compatibility - [`c8750e4`](https://github.com/CCExtractor/ccextractor/commit/c8750e42d1694600f93645b70a820b939fe6b986) build(linux): use pkg-config cflags for system-libs includes - [`170d769`](https://github.com/CCExtractor/ccextractor/commit/170d769476d68b30a30aae02eae20185d1bc877f) Merge branch 'master' into build/linux-system-libs-flag ### 📊 Changes **2 files changed** (+67 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/CHANGES.TXT` (+2 -0) 📝 `linux/build` (+65 -1) </details> ### 📄 Description <!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. --> **In raising this pull request, I confirm the following (please check boxes):** - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that another pull request for this purpose does not exist. - [x] I have considered, and confirmed that this submission will be valuable to others. - [x] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [x] I give this submission freely, and claim no ownership to its content. - [x] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [ ] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [x] I am an active contributor to CCExtractor. --- # build(linux): Add -system-libs flag for package manager compatibility ## Summary - Add `-system-libs` flag to `linux/build` for package manager compatibility - Enable building with system-installed libraries instead of bundled dependencies ## Problem - Linux package managers, including **`Linuxbrew/Homebrew`**, require builds to use system libraries via pkg-config, but the current Linux build script only supports bundled dependencies. - Currently, the Linux build script only supports bundled dependencies (zlib, libpng, freetype, utf8proc), making it difficult to create distribution-compliant packages. ## Solution Add a `-system-libs` flag that changes the build configuration: | Mode | Dependencies | Sources Compiled | Linking | |------|--------------|------------------|---------| | **Default** | Bundled in `src/thirdparty/` | zlib, libpng, freetype, utf8proc | Linking against bundled third-party sources | | **-system-libs** | System via pkg-config | Only CCExtractor core | Dynamic linking via pkg-config | ### Implementation Details **Dependency validation:** - Checks for `pkg-config` availability - Validates presence of: `libpng`, `zlib`, `freetype2`, `libutf8proc` - Verifies headers: `leptonica/allheaders.h`, `tesseract/capi.h` - Provides helpful error messages with installation commands **Build configuration:** - Excludes `-DFT2_BUILD_LIBRARY` flag (prevents building FreeType from source) - Overrides include paths to use system headers - Compiles only `lib_ccx` and `lib_hash` (excludes bundled thirdparty sources) - Links against system libraries via `pkg-config --libs` **Compatibility:** - Handles non-standard `utf8proc` header locations with temporary symlink - Cleans up temporary directories after build - Works with existing flags (`-debug`, `-hardsubx`) ### Test Plan - Built on Linux using `./build -system-libs` — build completed successfully - Verified dynamic linking via `ldd`: - `libfreetype.so.6` - `libpng16.so.16` - `libutf8proc.so.3` - `libz.so.1` - Confirmed no bundled third-party libraries are linked - `./ccextractor --version` runs correctly and reports expected build info ## Usage **Default build (bundled libraries):** ```bash ./build ``` **System libraries build:** ```bash ./build -system-libs ``` ## Related - Follows pattern from macOS implementation in #1862 --- <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:28 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2695