Skip to content

Add partial support to use system libraries instead of ones downloaded and built off the network#84

Open
apteryks wants to merge 5 commits into
agruzdev:masterfrom
apteryks:cmake-system-libs
Open

Add partial support to use system libraries instead of ones downloaded and built off the network#84
apteryks wants to merge 5 commits into
agruzdev:masterfrom
apteryks:cmake-system-libs

Conversation

@apteryks

Copy link
Copy Markdown

Hi,

This was motivated because I wanted to try to build Ogre with this, and to package something in Guix, it needs to be able to build in an isolated container (no internet). We also prefer to use (shared) system libraries, to save on build time and centralize maintenance.

I expect that to be useful to other distributions as well!

Maxim Cournoyer added 5 commits May 31, 2026 14:41
Not all libraries are exposed yet; I've added only those I could test
with (via Guix).

To use, set -DUSE_SYSTEM_LIBRARIES=ON or the library individual
switches, e.g. -DUSE_SYSTEM_ZLIB=ON.

Fixes: agruzdev#26
Use the public API to retrieve the version information instead.
Use the 'unknown' type for the os code instead, for portability.
* CMakeLists.txt (FREEIMAGE_WITH_LIBJPEG_TRANSFORMS): New option.
* Source/CMakeLists.txt [FREEIMAGE_WITH_LIBJPEG_TRANSFORMS]: Add
accompanying CPP macro definition.
* Source/FreeImageToolkit/JPEGTransform.cpp: Add CPP conditionals to
disable problematic code.
@apteryks

Copy link
Copy Markdown
Author

I successfully built the package with this change using the following Guix package definition:

(define-public freeimagere
  (package
    (name "freeimagere")
    (version "4.2.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                     (url "https://github.com/agruzdev/FreeImageRe")
                     (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "17xl5y0zsg16i4ym6dgdlwyf3wa1warf45c84fgjpc9nx847k0ii"))
              (modules '((guix build utils)))
              (snippet '(delete-file-recursively "3rdParty"))))
    (build-system cmake-build-system)
    ;; The libjxr support depends on the bundled 3rdParty/LibJXR source.
    (arguments
     (list
      #:tests? #f                       ;also disabled upstream
      #:cmake cmake-minimal-4
      #:configure-flags
      #~(list
         "-DUSE_SYSTEM_LIBS=ON"
         "-DFREEIMAGE_WITH_LIBJXR=OFF"           ;relies on bundled 3rdParty
         "-DFREEIMAGE_WITH_LIBOPENJPEG=OFF"      ;not packaged
         "-DFREEIMAGE_WITH_LIBJPEGXL=OFF"        ;not packaged
         "-DFREEIMAGE_WITH_LIBJPEG_TRANSFORMS=OFF" ;requires private headers
         "-DFREEIMAGE_WITH_LIBTIFF=OFF")))         ;requires private headers
    (native-inputs (list pkg-config))
    (inputs
     (list libheif
           libjpeg-turbo
           libpng
           libraw
           libwebp
           openexr
           openjph
           yato
           zlib))
    (home-page "https://github.com/agruzdev/FreeImageRe")
    (synopsis "Library for handling popular graphics image formats")
    (description "FreeImage Re(surrected) is a fork of FreeImage, a library
that supports popular graphics image formats like PNG, BMP, JPEG, TIFF and
others.")
    (license (list license:gpl2+ license:gpl3+))))

This is with the following dependencies from Guix:

libheif@1.22.2 libjpeg-turbo@2.1.4 libpng@1.6.39 libraw@0.21.2 libwebp@1.3.2
+ openexr@3.2.4 openjph@0.27.3 pkg-config@0.29.2 yato@1.1-0.7999c10 zlib@1.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant