Commits

Peter Szilagyi committed e887dc1

Build compatibly with an opam system compiler.
Also include CentOS 5 compatibility tweaks in all ocamlopt invocations.

Comments (0)

Files changed (4)

+# CR pszilagyi: The following compatibility settings are necessary but
+# not sufficient to build an ocaml/omake/omake_server.exe (for
+# example) on CentOS 6 that can be run on CentOS 5.  These take care
+# of application libraries, such as libtinfo.so, but not libc.so.
+#
+# When using opam with a recent Jane Street system compiler
+# (/janelibs/ocaml-4.00.0+jane1+with-fp, for example), these are not
+# necessary.  We may want to remove these if we decide to use a
+# /janelibs build as an opam system compiler.
+#
+# Jane-specific CentOS 5 build compatibility based on jane/trunk/OMakeroot:
+REDHAT_RELEASE = $(shell \
+  test -f /etc/redhat-release \
+   && cat /etc/redhat-release)
+REDHAT_VERSION = $(strip \
+  $(if $(findstring CentOS release 5,$(REDHAT_RELEASE)),5,\
+  $(if $(findstring CentOS release 6,$(REDHAT_RELEASE)),6)))
+C5COMPATROOT = /usr/jane
+C5_COMPAT_ROOT_DIRS = \
+  $(C5COMPATROOT)/lib64 \
+  $(C5COMPATROOT)/usr/lib64 \
+  $(C5COMPATROOT)/usr/lib64/mysql
+OCAML_LIB_FLAGS = $(foreach d,$(C5_COMPAT_ROOT_DIRS),\
+  -ccopt -Xlinker \
+  -ccopt -rpath \
+  -ccopt -Xlinker \
+  -ccopt $(d))
+ifeq ($(REDHAT_VERSION),6)
+  OCAMLOPTFLAGS += $(OCAML_LIB_FLAGS)
+endif
+export OCAMLOPTFLAGS
 
 default : ocaml
 

ocaml/contrib/ocaml_inotify/Makefile

 OCAMLC = ocamlc
 OCAMLOPT = ocamlopt
 
-OCAMLOPTFLAGS =
+OCAMLOPTFLAGS ?=
 
 OCAMLABI := $(shell ocamlc -version)
 OCAMLLIBDIR := $(shell ocamlc -where)

ocaml/contrib/ocaml_inotify_dummy/Makefile

 
 # dummy inotify rules must come after all other rules that match cmx files
 inotify.cmx : inotify.ml
-	ocamlopt -c -o $@ $<
+	ocamlopt $(OCAMLOPTFLAGS) -c -o $@ $<
 
 inotify.cmxa : inotify.cmx
-	ocamlopt -a -o $@ inotify.cmx
+	ocamlopt $(OCAMLOPTFLAGS) -a -o $@ inotify.cmx
 
 clean :
 	rm -f *.cmx *.cmxa *.a *.cmi *.o

ocaml/omake/Makefile

 OCAMLLIBDIR := $(shell ocamlc -where)
 LIB := $(OCAMLLIBDIR)/..
 
-PP='camlp4o $(LIB)/type_conv/pa_type_conv.cma $(LIB)/sexplib/pa_sexp_conv.cma $(LIB)/fieldslib/pa_fields_conv.cma $(LIB)/pa_pipebang/pa_pipebang.cma'
+# In the opam context with a system compiler (like one in /janelibs),
+# the syntax extensions don't live in the same place as ocamlc.
+#
+#PP='camlp4o $(LIB)/type_conv/pa_type_conv.cma $(LIB)/sexplib/pa_sexp_conv.cma $(LIB)/fieldslib/pa_fields_conv.cma $(LIB)/pa_pipebang/pa_pipebang.cma'
+CAMLP4OLIBS = $(LIB) $(shell ocamlfind printconf path 2> /dev/null || :)
+CAMLP4OFLAGS = $(CAMLP4OLIBS:%=-I %)
+PP='camlp4o $(CAMLP4OFLAGS) type_conv/pa_type_conv.cma sexplib/pa_sexp_conv.cma fieldslib/pa_fields_conv.cma pa_pipebang/pa_pipebang.cma'
 
 OS=$(shell uname)
 
 	INOTIFY_DIR='../contrib/ocaml_inotify_dummy'
 endif
 
-OCAMLOPT=ocamlfind ocamlopt -thread -w @a-4-7-9-29-28 \
+OCAMLOPT=ocamlfind ocamlopt $(OCAMLOPTFLAGS) -thread -w @a-4-7-9-29-28 \
         -pp $(PP) \
         -strict-sequence -inline 20 -nodynlink -g \
 	-package core -package core_extended -package async -package pcre \
 	-I $(INOTIFY_DIR) inotify.cmxa
 
-# Jane-specific CentOS 5 build compatibility based on jane/trunk/OMakeroot:
-REDHAT_RELEASE = $(shell \
-  test -f /etc/redhat-release \
-   && cat /etc/redhat-release)
-REDHAT_VERSION = $(strip \
-  $(if $(findstring CentOS release 5,$(REDHAT_RELEASE)),5,\
-  $(if $(findstring CentOS release 6,$(REDHAT_RELEASE)),6)))
-C5COMPATROOT = /usr/jane
-C5_COMPAT_ROOT_DIRS = \
-  $(C5COMPATROOT)/lib64 \
-  $(C5COMPATROOT)/usr/lib64 \
-  $(C5COMPATROOT)/usr/lib64/mysql
-OCAML_LIB_FLAGS = $(foreach d,$(C5_COMPAT_ROOT_DIRS),\
-  -ccopt -Xlinker \
-  -ccopt -rpath \
-  -ccopt -Xlinker \
-  -ccopt $(d))
-ifeq ($(REDHAT_VERSION),6)
-  OCAMLOPT += $(OCAML_LIB_FLAGS)
-endif
-
 FILES=          \
 process         \
 omake_inotify   \
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.