Skip to content

[graf2d] Make libgif a builtin obtained from the web and remove the vendored code#21578

Merged
dpiparo merged 4 commits intoroot-project:masterfrom
dpiparo:builtin_giflib
Mar 13, 2026
Merged

[graf2d] Make libgif a builtin obtained from the web and remove the vendored code#21578
dpiparo merged 4 commits intoroot-project:masterfrom
dpiparo:builtin_giflib

Conversation

@dpiparo
Copy link
Member

@dpiparo dpiparo commented Mar 12, 2026

This PR is analogous to #21556 , but for libgif.

  • Adds libgif as a builtin, taking the source tarball from the web
  • Removes the vendored libgif
  • Provides all the CMake infrastructure to build the newly provided builtin. A difference with the changes necessary for png and jpeg is that a CMakeLists.txt had to be added as a patch to be able to use the standard configure&build mechanism.

@dpiparo dpiparo requested a review from hageboeck March 12, 2026 09:17
@dpiparo dpiparo self-assigned this Mar 12, 2026
@dpiparo dpiparo requested review from bellenot and couet as code owners March 12, 2026 09:17
+cmake_minimum_required(VERSION 3.23)
+project(LibUngif VERSION 1.0) # The version does not matter here
+
+add_library(gif-static
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be explicit here, making it a static library:

- +add_library(gif-static
+ +add_library(gif-static STATIC

Otherwise, you might get surprises based on:

If no <type> is given the default is STATIC or SHARED based on the value of the BUILD_SHARED_LIBS variable.

--- /dev/null 2026-03-12 08:23:04
+++ CMakeLists.txt 2026-03-12 08:20:11
@@ -0,0 +1,29 @@
+cmake_minimum_required(VERSION 3.23)
Copy link
Collaborator

@ferdymercury ferdymercury Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This CMake version was discouraged here: #19941

@guitargeek mentioned:

but maybe at some point we should discuss if we should keep it like that when Ubuntu doesn't update it's CMake version in 5 years at all. Even RedHat does that.

From my point of view, (I am still using Ubuntu22), I think it's no problem at all to install from the official CMake PPA or snap rather than from the outdated APT package. Ubu22 users building themselves won't lose more than 2 minutes with this.

On the other hand, ROOT 6.42 will start more or less at the same time than Ubu22 is EOL, so maybe in a couple of months this can be done already in the master branch?

Comment on lines 31 to 32
/* Define if using builtin libungif */
#define HAVE_BUILTIN_UNGIF 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* Define if using builtin libungif */
#define HAVE_BUILTIN_UNGIF 1

@github-actions
Copy link

github-actions bot commented Mar 12, 2026

Test Results

    22 files      22 suites   3d 4h 9m 26s ⏱️
 3 808 tests  3 807 ✅ 1 💤 0 ❌
76 718 runs  76 709 ✅ 9 💤 0 ❌

Results for commit 3ba4129.

♻️ This comment has been updated with latest results.

As of version 5.2.2, the sources need to be patched to create a CMakeLists
for the library itself.
After that, the builtin can be treated as libpng and libjpeg.
@dpiparo dpiparo force-pushed the builtin_giflib branch 2 times, most recently from 85fa5c5 to d673de9 Compare March 12, 2026 14:18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_link_libraries(${LIB_NAME} PRIVATE ${JPEG_LIBRARY_LOCATION} ${PNG_LIBRARY_LOCATION} ${GIF_LIBRARY_LOCATION})

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in the last push

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${GIF_INCLUDE_DIR})

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in the last push

Both on Windows and macOS/Linux.
This is necessary not to have subtle misconfigurations when dealing
with parallelised builds.
@dpiparo dpiparo merged commit 146197b into root-project:master Mar 13, 2026
29 of 30 checks passed
@dpiparo dpiparo deleted the builtin_giflib branch March 13, 2026 09:32
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.

5 participants