From: tangxiaofeng <tangxiaofeng@kylinos.cn>
Date: Mon, 19 Oct 2026 16:48:49 +0000
Subject: Add -fPIC to gif/exif/freetype C stubs

Description: Compile the gif, exif and freetype C stubs with -fPIC
 Patch 0001 added -fPIC to the jpeg/png/tiff/xpm stubs, but the gif, exif
 and freetype stubs still compile without it. Linking their non-PIC
 objects into the shared stub libraries then fails with
 "relocation ... can not be used when making a shared object;
 recompile with -fPIC" (__stack_chk_guard on arm64/riscv64, .rodata
 R_X86_64_32 on amd64). Add -fPIC to these three dune files too.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Origin: vendor
Forwarded: not-needed

---
--- camlimages-5.0.5.orig/exif/dune
+++ camlimages-5.0.5/exif/dune
@@ -8,7 +8,7 @@
  (foreign_stubs
    (language c)
    (names exif_c)
-   (flags
+   (flags -fPIC
      (:include ../config/exif_c_flags.sexp)))
  (c_library_flags
    (:include ../config/exif_c_library_flags.sexp)))
--- camlimages-5.0.5.orig/freetype/dune
+++ camlimages-5.0.5/freetype/dune
@@ -6,7 +6,7 @@
  (foreign_stubs
    (language c)
    (names ftintf)
-   (flags
+   (flags -fPIC
      (:include ../config/freetype_c_flags.sexp)))
  (c_library_flags
   (:include ../config/freetype_c_library_flags.sexp)))
--- camlimages-5.0.5.orig/gif/dune
+++ camlimages-5.0.5/gif/dune
@@ -7,7 +7,7 @@
  (foreign_stubs
    (language c)
    (names gifread gifwrite)
-   (flags
+   (flags -fPIC
      (:include ../config/gif_c_flags.sexp)))
  (c_library_flags
   (:include ../config/gif_c_library_flags.sexp)))
