camlspotter avatar camlspotter committed e36c709

tweak of CFLAGS/INCLUDES and exif support

Comments (0)

Files changed (2)

 
 ########################################## External arguments
 
-DEFAULT_INCLUDES[]=
-   /usr/include/X11
-   /usr/local/include
-if $(not $(defined INCLUDES)):
-    setvar(public.INCLUDES, $(DEFAULT_INCLUDES))
-
-if $(not $(defined LDFLAGS)):
-    setvar(public.LDFLAGS, $(EMPTY))
-
 # Specify directories where X's rgb.txt can be found
 PATH_RGB_TXT[]=
   /etc/X11
   /usr/share/X11
 
-BYTE_ENABLED=1
-if $(not $(defined NATIVE_ENABLED)):
-    setvar(public.NATIVE_ENABLED, 1)
-    export
-
 ########################################################################
 
-VERSION=4.0.4
+VERSION=4.1.0
 
 # for src/META
 PACKAGE_NAME=camlimages
   println(wordsize  $(WORD_SIZE))
   println(--- C libraries)
   println(libgif:   $(HAVE_GIF))
-  println(libpng:	  $(HAVE_PNG))
+  println(libpng:   $(HAVE_PNG))
   println(libjpeg:  $(HAVE_JPEG))
+  println(libexif:  $(HAVE_EXIF))
   println(libtiff:  $(HAVE_TIFF))
-  println(libxpm:	  $(HAVE_XPM))
-  println(libz:	  $(HAVE_Z))
+  println(libxpm:   $(HAVE_XPM))
+  println(libz:   $(HAVE_Z))
   println(--- Subpackages)
-  println(gif:      $(SUPPORT_GIF) \($(string $(LDFLAGS_gif)\)))
-  println(png:	  $(SUPPORT_PNG) \($(string $(LDFLAGS_png)\)))
-  println(jpeg:	  $(SUPPORT_JPEG) \($(string $(LDFLAGS_jpeg)\)))
-  println(tiff:	  $(SUPPORT_TIFF) \($(string $(LDFLAGS_tiff)\)))
-  println(xpm:	  $(SUPPORT_XPM) \($(string $(LDFLAGS_xpm)\)))
+  println(gif:    $(SUPPORT_GIF) \($(string $(LDFLAGS_gif)\)))
+  println(png:    $(SUPPORT_PNG) \($(string $(LDFLAGS_png)\)))
+  println(jpeg:   $(SUPPORT_JPEG) \($(string $(LDFLAGS_jpeg)\)))
+  println(exif:   $(SUPPORT_EXIF) \($(string $(LDFLAGS_exif)\)))
+  println(tiff:   $(SUPPORT_TIFF) \($(string $(LDFLAGS_tiff)\)))
+  println(xpm:    $(SUPPORT_XPM) \($(string $(LDFLAGS_xpm)\)))
   println(freetype: $(SUPPORT_FREETYPE) \($(PATH_FREETYPE_CONFIG)\) \($(string $(LDFLAGS_freetype))\))
   println(ps:       $(SUPPORT_PS) \($(PATH_GS)\))
   println(rgb.txt:  $(SUPPORT_RGB_TXT) \($(string $(PATH_RGB_TXT))\))
   println(supported subpackages:  $(string $(SUPPORTED_SUBPACKAGES)))
   println(supported formats:  $(string $(SUPPORTED_FORMATS)))
   println(supported non-formats:  $(string $(SUPPORTED_NON_FORMATS)))
-  println(CFLAGS:   $(string $(CFLAGS)))
-  println(LDFLAGS:  $(string $(LDFLAGS)))
+  # CFLAGS and LDFLAGS are already defined when print_configured()
+  # is defined, so using CFLAGS here just prints the value of 
+  # when this function is defined.
+  # CR jfuruse: Something messy which I do not understand yet happens here!
+  println(CFLAGS:   $(string $(CAMLIMAGES_CFLAGS)))
+  println(LDFLAGS:  $(string $(CAMLIMAGES_LDFLAGS)))
   println(---)
 
 true_if_not_defined(var)=
      eprintln(You need to install ocamlmklib and run "omake --configure".)
      exit 1
 
-  CFLAGS = $(addprefix -I , $(INCLUDES))
+  BYTE_ENABLED=1
+  if $(not $(defined NATIVE_ENABLED)):
+      setvar(public.NATIVE_ENABLED, 1)
+      export
+
+  # It seems changing CFLAGS and INCLUDES in .STATIC is not a good idea.
+  CAMLIMAGES_CFLAGS = $(CFLAGS) $(addprefix -I , $(INCLUDES))
 
   WORD_SIZE = $(Word_size)
 
   # Image formats implemented using external libraries or binaries
-  FORMATS= gif png jpeg tiff xpm ps
+  FORMATS= gif png jpeg exif tiff xpm ps
 
   # Image formats with necessary libraries supported
   SUPPORTED_FORMATS[]=
       failwith(jpeg requested but not found)
     export
 
+  SUPPORT_EXIF=false
+  if $(true_if_not_defined ARG_WANT_EXIF)
+    HAVE_EXIF = $(Check_header_library exif, exif-data.h, exif_data_load_data)
+    SUPPORT_EXIF = $(HAVE_EXIF)
+    LDFLAGS_exif=
+    if $(SUPPORT_EXIF)
+      LDFLAGS_exif=-lexif
+      SUPPORTED_FORMATS+=exif
+      export
+    else
+      failwith(exif requested but not found)
+    export
+
   SUPPORT_TIFF=false
   LDFLAGS_tiff=
   if $(true_if_not_defined ARG_WANT_TIFF)
         export
     if $(SUPPORT_FREETYPE)
       println(SUPPORT_FREETYPE=$(SUPPORT_FREETYPE)!)
-      CFLAGS= $(CFLAGS) $(shell freetype-config --cflags)
+      CAMLIMAGES_CFLAGS+= $(shell freetype-config --cflags)
       LDFLAGS_freetype= $(shell freetype-config --libs)
       export
     if $(SUPPORT_FREETYPE)
   SUPPORT_RGB_TXT = $(Check_file_in_path $(PATH_RGB_TXT), rgb.txt)
   PATH_RGB_TXT = $(WHERE)
 
+  # CR jfuruse: Something messy which I do not understand yet happens here!
+  CAMLIMAGES_LDFLAGS=$(LDFLAGS)
   print_configured()
 
+# CR jfuruse: Something messy which I do not understand yet happens here!
+CFLAGS=$(CAMLIMAGES_CFLAGS)
+LDFLAGS=$(CAMLIMAGES_LDFLAGS)
+
 # for config.h
 CGeneratedFiles(config.h)
 section:
 ################################################################### local build
 
 Subpackages_available(packs) =
-  sequence-forall($(fun elem, $(mem $(elem), all supported $(SUPPORTED_SUBPACKAGES))), $(packs))
+  sequence-forall($(fun elem, $(mem $(elem), core all_formats supported $(SUPPORTED_SUBPACKAGES))), $(packs))
 
 BuildExample(namex, modules, packages) = 
   .PHONY: clean
     OCAMLINCLUDES += $(SRCDIR)
     OCAML_LIBS+= $(addprefix $(SRCDIR)/camlimages_, $(subs))
     OCAML_BYTE_LINK_FLAGS+=-dllpath $(SRCDIR)
+    OCAMLPACKS[]+=unix # exif requires unix
     export
     .DEFAULT: $(OCamlProgram $(namex), $(modules))
   else
     println(Warning: $(namex) is not built: it requires $(string $(packages)))
+    println(Warning: Supported: $(string all_formats supported $(SUPPORTED_SUBPACKAGES)))
 
   clean:
-    rm -f $(filter-proper-targets $(ls R, .))
+    rm -f $(filter-proper-targets $(ls R, .)) *.cmt* *.sp*t
 
   export
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.