File plplot-ocaml.patch of Package plplot
--- a/bindings/ocaml/CMakeLists.txt
+++ b/bindings/ocaml/CMakeLists.txt
@@ -224,7 +224,7 @@ if(ENABLE_ocaml)
# ocamlopt as appropriate). This failure is likely the cause
# of the ldd -r errors for the ocaml examples unless they are created
# with ocamlc or ocamlopt using the appropriate rpath option.
- COMMAND ${OCAMLMKLIB} -o plplot_stubs -L${CAMLIDL_LIB_DIR} -lcamlidl ${ocaml_LIBRARIES_FLAGS} plplot_core_stubs.o plplot_impl.o
+ COMMAND ${OCAMLMKLIB} -o plplot_stubs -L${CAMLIDL_LIB_DIR} ${CAMLIDL_LIB_FILE} ${ocaml_LIBRARIES_FLAGS} plplot_core_stubs.o plplot_impl.o
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/plplot_core_stubs.o
${CMAKE_CURRENT_BINARY_DIR}/plplot_impl.o
@@ -249,7 +249,7 @@ if(ENABLE_ocaml)
# ocamlopt as appropriate). This failure is likely the cause
# of the ldd -r errors for the ocaml examples unless they are created
# with ocamlc or ocamlopt using the appropriate rpath option.
- COMMAND ${OCAMLMKLIB} -o installed_plplot_stubs -L${CAMLIDL_LIB_DIR} -lcamlidl ${installed_ocaml_LIBRARIES_FLAGS} plplot_core_stubs.o plplot_impl.o
+ COMMAND ${OCAMLMKLIB} -o installed_plplot_stubs -L${CAMLIDL_LIB_DIR} ${CAMLIDL_LIB_FILE} ${installed_ocaml_LIBRARIES_FLAGS} plplot_core_stubs.o plplot_impl.o
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/plplot_core_stubs.o
${CMAKE_CURRENT_BINARY_DIR}/plplot_impl.o
@@ -330,7 +330,7 @@ if(ENABLE_ocaml)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/plplot.cma
- COMMAND ${OCAMLC} -a -custom -o plplot.cma plplot_core.cmo plplot.cmo -dllib -lplplot_stubs -ccopt -L. -cclib -lplplot_stubs -ccopt -L${CAMLIDL_LIB_DIR} -cclib -lcamlidl ${ocaml_LIBRARIES_FLAGS}
+ COMMAND ${OCAMLC} -a -custom -o plplot.cma plplot_core.cmo plplot.cmo -dllib -lplplot_stubs -ccopt -L. -cclib -lplplot_stubs -ccopt -L${CAMLIDL_LIB_DIR} -cclib ${CAMLIDL_LIB_FILE} ${ocaml_LIBRARIES_FLAGS}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/plplot_core.cmo
${CMAKE_CURRENT_BINARY_DIR}/plplot.cmo
@@ -341,7 +341,7 @@ if(ENABLE_ocaml)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/installed_plplot.cma
- COMMAND ${OCAMLC} -a -custom -o installed_plplot.cma plplot_core.cmo plplot.cmo -dllib -lplplot_stubs -ccopt -L. -cclib -lplplot_stubs -ccopt -L${CAMLIDL_LIB_DIR} -cclib -lcamlidl ${installed_ocaml_LIBRARIES_FLAGS}
+ COMMAND ${OCAMLC} -a -custom -o installed_plplot.cma plplot_core.cmo plplot.cmo -dllib -lplplot_stubs -ccopt -L. -cclib -lplplot_stubs -ccopt -L${CAMLIDL_LIB_DIR} -cclib ${CAMLIDL_LIB_FILE} ${installed_ocaml_LIBRARIES_FLAGS}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/plplot_core.cmo
${CMAKE_CURRENT_BINARY_DIR}/plplot.cmo
@@ -399,7 +399,7 @@ if(ENABLE_ocaml)
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/plplot.cmxa
${CMAKE_CURRENT_BINARY_DIR}/plplot.a
- COMMAND ${OCAMLOPT} -a -o plplot.cmxa plplot_core.cmx plplot.cmx -ccopt -L. -cclib -lplplot_stubs -ccopt -L${CAMLIDL_LIB_DIR} -cclib -lcamlidl ${ocaml_LIBRARIES_FLAGS}
+ COMMAND ${OCAMLOPT} -a -o plplot.cmxa plplot_core.cmx plplot.cmx -ccopt -L. -cclib -lplplot_stubs -ccopt -L${CAMLIDL_LIB_DIR} -cclib ${CAMLIDL_LIB_FILE} ${ocaml_LIBRARIES_FLAGS}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/plplot_core.cmx
${CMAKE_CURRENT_BINARY_DIR}/plplot.cmx
@@ -411,7 +411,7 @@ if(ENABLE_ocaml)
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/installed_plplot.cmxa
${CMAKE_CURRENT_BINARY_DIR}/installed_plplot.a
- COMMAND ${OCAMLOPT} -a -o installed_plplot.cmxa plplot_core.cmx plplot.cmx -ccopt -L. -cclib -lplplot_stubs -ccopt -L${CAMLIDL_LIB_DIR} -cclib -lcamlidl ${installed_ocaml_LIBRARIES_FLAGS}
+ COMMAND ${OCAMLOPT} -a -o installed_plplot.cmxa plplot_core.cmx plplot.cmx -ccopt -L. -cclib -lplplot_stubs -ccopt -L${CAMLIDL_LIB_DIR} -cclib ${CAMLIDL_LIB_FILE} ${installed_ocaml_LIBRARIES_FLAGS}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/plplot_core.cmx
${CMAKE_CURRENT_BINARY_DIR}/plplot.cmx
--- a/cmake/modules/ocaml.cmake
+++ b/cmake/modules/ocaml.cmake
@@ -115,17 +115,24 @@ if(ENABLE_ocaml)
OUTPUT_VARIABLE CAMLIDL_LIB_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- find_path(CAMLIDL_LIB_DIR libcamlidl.a PATHS ${CAMLIDL_LIB_PATH} ${OCAML_LIB_PATH} )
+ message(STATUS "CAMLIDL_LIB_PATH = ${CAMLIDL_LIB_PATH}")
+ find_file(CAMLIDL_LIB_FILE libcamlidl.a libcamlidl_stubs.a PATHS ${CAMLIDL_LIB_PATH} ${OCAML_LIB_PATH} )
+ get_filename_component(CAMLIDL_LIB_DIR ${CAMLIDL_LIB_FILE} DIRECTORY)
+ message(STATUS "CAMLIDL_LIB_FILE = ${CAMLIDL_LIB_FILE}")
+ message(STATUS "CAMLIDL_LIB_DIR = ${CAMLIDL_LIB_DIR}")
else(OCAMLFIND)
- find_path(CAMLIDL_LIB_DIR libcamlidl.a PATHS ${OCAML_LIB_PATH} )
- endif(OCAMLFIND)
- if(CAMLIDL_LIB_DIR)
+ find_file(CAMLIDL_LIB_FILE libcamlidl.a libcamlidl_stubs.a PATHS ${OCAML_LIB_PATH} )
+ get_filename_component(CAMLIDL_LIB_DIR ${CAMLIDL_LIB_FILE} DIRECTORY)
+ message(STATUS "CAMLIDL_LIB_FILE = ${CAMLIDL_LIB_FILE}")
message(STATUS "CAMLIDL_LIB_DIR = ${CAMLIDL_LIB_DIR}")
- else(CAMLIDL_LIB_DIR)
+ endif(OCAMLFIND)
+ if(CAMLIDL_LIB_FILE)
+ message(STATUS "CAMLIDL_LIB_FILE = ${CAMLIDL_LIB_FILE}")
+ else(CAMLIDL_LIB_FILE)
message(STATUS "WARNING: "
"The camlidl library not found. Disabling OCaml binding")
set(ENABLE_ocaml OFF CACHE BOOL "Enable OCaml binding" FORCE)
- endif(CAMLIDL_LIB_DIR)
+ endif(CAMLIDL_LIB_FILE)
endif(ENABLE_ocaml)
@@ -134,7 +141,7 @@ if(ENABLE_ocaml)
# standard.
set(
OCAML_INSTALL_DIR
- ${CMAKE_INSTALL_PREFIX}/lib/ocaml
+ ${OCAML_LIB_PATH}
CACHE PATH "PLplot install location for ocaml files"
)
list(APPEND INSTALL_LOCATION_VARIABLES_LIST OCAML_INSTALL_DIR)