Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
ocamlnet: fix to Makefiles here and there so can compile just the net…
Browse files Browse the repository at this point in the history
…string/ and

netsys/ libraries
  • Loading branch information
pad committed Feb 24, 2011
1 parent af1a76e commit 61a5a9e
Show file tree
Hide file tree
Showing 11 changed files with 509 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,14 @@ external/ocamlbdb/libcamlbdb.a
/lang_erlang/parsing/parser_erlang.mli
/lang_erlang/parsing/parser_erlang.output
/lang_php/analyze/Analyze_php.out
/external/ocamlnet/netstring/depend
/external/ocamlnet/netsys/depend
/external/ocamlnet/netstring/tools/unimap_to_ocaml/unimap_to_ocaml
/external/ocamlnet/netstring/tools_done
/external/ocamlnet/netstring/netconst.ml
/external/ocamlnet/netstring/netdate.ml
/external/ocamlnet/netstring/netdb.ml
/external/ocamlnet/netstring/netmappings_iso.ml
/external/ocamlnet/netstring/netmappings_jp.ml
/external/ocamlnet/netstring/netmappings_kr.ml
/external/ocamlnet/netstring/netmappings_other.ml
2 changes: 2 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ if($pcre) {
# system("cd external/ocamlgraph; ./configure");
#}

#TODO: my $err = system("cd external/ocamlnet; ./configure");

if($gui) {
pr2 "";
pr2 "Configuring ocamlgtk";
Expand Down
66 changes: 66 additions & 0 deletions external/ocamlnet/Makefile.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Makefike.conf written by configure
# The Ocamlnet version
VERSION = 3.2.1

# The packages to build in the right order:
PKGLIST = netsys netshm netstring equeue shell rpc-generator rpc pop smtp netclient netcgi2 netplex netcgi2-plex netcamlbox netmulticore rpc-auth-local

# All packages:
FULL_PKGLIST = netsys netshm netstring equeue shell rpc-generator rpc pop smtp netclient netcgi2 netplex netcgi2-plex netcamlbox netmulticore rpc-auth-local rpc-xti equeue-tcl equeue-gtk1 equeue-gtk2 equeue-ssl rpc-ssl rpc-auth-dh nethttpd nethttpd-for-netcgi2 netzip

# Whether the OS needs an .exe suffix for executables:
EXEC_SUFFIX =

# Required packages (findlib):
REQUIRES = unix pcre

# Additional options only for ocamlc:
OCAMLC_OPTIONS =

# Additional options only for ocamlopt:
OCAMLOPT_OPTIONS =

# Where the ocamlnet lookup tables are to be installed (both findlib
# and non-findlib):
NET_DB_DIR = /home/pad/packages/Linux/stow/ocaml-3.12/lib/ocaml/site-lib/netstring

# Where binaries are installed:
BINDIR = /home/pad/packages/Linux/bin

# Method of installation:
INSTMETHOD = findlib

# Multi-threading type:
MT_TYPE = posix

# word size:
WORD_SIZE = 64

# gprof:
HAVE_GPROF = 1

# Compiler switch to enable multi-threading:
THREAD = -thread

# For -enable-tcl:
EQUEUE_TCL_DEFS =
EQUEUE_TCL_LIBS =

# For -enable-gtk2:
GTK_EXTRA_DEFINES =

# For -with-auth-dh:
RPC_AUTH_DH_CONNECTOR = unixdomain
AUTHDHREQS =

# For -enable-apache
APACHE_MAJOR =
APACHE_LIBDIR =
APACHE_OCAMLLIBS = -l -ltermcap -lunix -l
APACHE_INCDIR =
APACHE_CONFDIR =
APACHE_LDFLAGS_SHLIB =
APACHE_CC =
APACHE_CFLAGS =
APACHE_OCAMLLIBDIR =
APXS =
209 changes: 209 additions & 0 deletions external/ocamlnet/Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# -*- Makefile -*-
# Inclusion of Makefile.conf may fail when cleaning up:

-include $(TOP_DIR)/Makefile.conf

# Makefile.conf: written by "configure".

# How to invoke compilers and tools:
# (May be moved to Makefile.conf if necessary)

OCAMLC = ocamlc -g $(OCAMLC_OPTIONS) $(INCLUDES)
OCAMLC_MLI= ocamlc -g $(OCAMLC_OPTIONS) $(INCLUDES)
OCAMLOPT = ocamlopt $(OCAMLOPT_OPTIONS) $(INCLUDES)
OCAMLDEP = ocamldep $(OCAMLDEP_OPTIONS) $(PP_OPTIONS)

#pad: was originally:
#OCAMLC = $(OCAMLFIND) ocamlc -g $(OCAMLC_OPTIONS) $(INCLUDES) -package "$(REQUIRES)" $(PP_OPTIONS)
#OCAMLC_MLI= $(OCAMLFIND) ocamlc -g $(OCAMLC_OPTIONS) $(INCLUDES) -package "$(REQUIRES)"
## Note that PP_OPTIONS do not affect .mli! (usually breaks ocamldoc)
#
#OCAMLOPT = $(OCAMLFIND) ocamlopt $(OCAMLOPT_OPTIONS) $(INCLUDES) -package "$(REQUIRES)" $(PP_OPTIONS)
#OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAMLDEP_OPTIONS) $(PP_OPTIONS)
#OCAMLFIND = ocamlfind
OCAMLYACC = ocamlyacc
OCAMLLEX = ocamllex
CAMLP4 = camlp4
OCAMLMKLIB = $(TOP_DIR)/tools/mkstublib
OCAMLDOC = $(OCAMLFIND) ocamldoc
STUBCC = $(TOP_DIR)/tools/stubcc -ocamlc ocamlc

TOOLS_DIR = $(TOP_DIR)/tools
COLLECT_FILES = $(TOOLS_DIR)/collect_files

#pad: removed the src/
INC_NETSYS = -I $(TOP_DIR)/netsys

# To be overridden by the command line:
INC_NETSTRING = -I $(TOP_DIR)/src/netstring
INC_EQUEUE = -I $(TOP_DIR)/src/equeue
INC_EQUEUE_SSL = -I $(TOP_DIR)/src/equeue-ssl
INC_NETCGI2 = -I $(TOP_DIR)/src/netcgi2
INC_NETCGI2_APACHE = -I $(TOP_DIR)/src/netcgi2-apache
INC_NETPLEX = -I $(TOP_DIR)/src/netplex
INC_NETCAMLBOX = -I $(TOP_DIR)/src/netcamlbox
INC_RPC = -I $(TOP_DIR)/src/rpc
INC_SHELL = -I $(TOP_DIR)/src/shell

# Standard definitions and rules

XOBJECTS = $(OBJECTS:.cmo=.cmx)
POBJECTS = $(OBJECTS:.cmo=.p.cmx)
ARCHIVE ?= $(PKGNAME)

.PHONY: all opt all-mt-vm opt-mt-vm all-mt-posix opt-mt-posix

ARCHIVE_CMA ?= $(ARCHIVE).cma
ARCHIVE_CMXA ?= $(ARCHIVE).cmxa
ARCHIVE_P ?= $(ARCHIVE).p
ARCHIVE_P_CMXA ?= $(ARCHIVE_P).cmxa

ALL ?= $(ARCHIVE_CMA) $(ALL_EXTRA) \
all-mt-$(MT_TYPE)
OPT ?= $(ARCHIVE_CMXA) $(OPT_EXTRA) \
opt-mt-$(MT_TYPE) opt-p-$(HAVE_GPROF) opt-mt-$(MT_TYPE)-p-$(HAVE_GPROF)

all: $(ALL)

opt: $(OPT)

all-mt-vm: $(ALLMT_EXTRA)
all-mt-posix: $(ALLMT_EXTRA)
opt-mt-vm:
opt-mt-posix: $(OPTMT_EXTRA)
opt-p-0:
opt-p-1: $(ARCHIVE_P_CMXA) $(OPTP_EXTRA)
opt-mt-vm-p-0:
opt-mt-posix-p-0:
opt-mt-vm-p-1:
opt-mt-posix-p-1: $(OPTMTP_EXTRA)



$(ARCHIVE_CMA): $(OBJECTS) $(COBJECTS)
if [ "X$(COBJECTS)" = "X" ]; then \
$(OCAMLC) -a -o $(ARCHIVE_CMA) $(OBJECTS); \
else \
$(OCAMLMKLIB) -o $(ARCHIVE) $(OBJECTS) $(COBJECTS) $(LINK_OPTIONS); \
fi

$(ARCHIVE_CMXA): $(XOBJECTS) $(COBJECTS)
if [ "X$(COBJECTS)" = "X" ]; then \
$(OCAMLOPT) -a -o $(ARCHIVE_CMXA) $(XOBJECTS); \
else \
$(OCAMLMKLIB) -o $(ARCHIVE) $(XOBJECTS) $(COBJECTS) $(LINK_OPTIONS); \
fi

$(ARCHIVE_P_CMXA): $(XOBJECTS) $(COBJECTS)
if [ "X$(COBJECTS)" = "X" ]; then \
$(OCAMLOPT) -a -o $(ARCHIVE_P_CMXA) $(POBJECTS); \
else \
$(OCAMLMKLIB) -o $(ARCHIVE_P) $(POBJECTS) $(COBJECTS) $(LINK_OPTIONS); \
fi

# Files to remove everywhere by "make clean":

CLEAN_LIST = *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa dll* packlist-* \
ocamldoc.dump META depend $(PACKLIST) $(GENERATE)

# Generic build rules:

.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll .mly .c .o

.ml.cmx:
$(OCAMLOPT) -c $(OCAMLOPT_OPTIONS_FOR_$<) $<
[ $(HAVE_GPROF) -eq 0 ] || $(OCAMLOPT) -c -p -o `basename $@ .cmx`.p.cmx $(OCAMLOPT_OPTIONS_FOR_$<) $<

.ml.cmo:
$(OCAMLC) -c $(OCAMLC_OPTIONS_FOR_$<) $<

.mli.cmi:
$(OCAMLC_MLI) -c $(OCAMLC_OPTIONS_FOR_$<) $<

.mll.ml:
$(OCAMLLEX) $<

.mly.ml:
$(OCAMLYACC) $<

.c.o:
$(STUBCC) -ccopt -O $(CC_OPTIONS) $(CC_OPTIONS_FOR_$<) $<

# We add $(OBJECTS) to the antecedents of ocamldoc.dump to ensure that
# the files are compiled. ocamldoc needs the .cmi files, and this is
# the simplest way of ensuring that.

ocamldoc.dump: $(DOBJECTS) $(OBJECTS)
$(OCAMLDOC) -dump ocamldoc.dump -stars $(INCLUDES) -package "$(REQUIRES)" $(OCAMLDOC_OPTIONS) $(DOBJECTS) || { rm -f ocamldoc.dump; exit 1; }

# Install rules:

.PHONY: install
install:
@$(MAKE) -f Makefile.pre realinstall

.PHONY: realinstall
realinstall: install-$(INSTMETHOD) $(INSTOTHER) $(PACKLIST)


.PHONY: uninstall
uninstall:
@$(MAKE) -f Makefile.pre realuninstall

.PHONY: realuninstall
realuninstall: $(UNINSTOTHER) uninstall-$(INSTMETHOD)

.PHONY: install-findlib
install-findlib: META
files=`$(COLLECT_FILES) *.mli *.cmi *.cma *.cmxa *.a dll* META $(INSTALL_EXTRA)` && \
$(OCAMLFIND) install $(PKGNAME) $$files

.PHONY: uninstall-findlib
uninstall-findlib:
$(OCAMLFIND) remove $(PKGNAME)
if [ -n "$(PACKLIST)" ]; then \
if packlist=`ocamlfind query $(PKGNAME)`/$(PACKLIST); then \
if [ -f "$$packlist" ]; then \
files=`cat $$packlist` && \
rm -f $$files; \
echo "$$files" | xargs echo "Removed "; \
fi; \
fi; \
fi

META: META.in
sed -e 's/@VERSION@/$(VERSION)/' \
-e 's/@AUTHDHREQS@/$(AUTHDHREQS)/' \
-e 's/@PREFERRED_CGI_PKG@/$(PREFERRED_CGI_PKG)/' \
META.in >META

#----------------------------------------------------------------------
# general rules:


DEP_FILES ?= $(wildcard *.ml) $(wildcard *.mli)

# Set NODEP to "@true" in order to disable "depend".

depend: $(DEP_FILES)
$(NODEP) $(OCAMLDEP) *.ml *.mli >$@ || { rm -f $@; exit 1; }

.PHONY: clean
clean::
rm -f $(CLEAN_LIST)

.PHONY: clean-doc
clean-doc::
rm -f ocamldoc.dump

.PHONY: distclean
distclean::
rm -f $(CLEAN_LIST) META
rm -f *~ depend

.PHONY: generate
generate:
@$(MAKE) -f Makefile.pre realgenerate

.PHONY: realgenerate
realgenerate:: $(GENERATE)
2 changes: 1 addition & 1 deletion external/ocamlnet/netstring/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TOP_DIR=../..
TOP_DIR=..

include Makefile.def

Expand Down
5 changes: 4 additions & 1 deletion external/ocamlnet/netstring/Makefile.def
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ OBJECTS = netconst.cmo netstring_pcre.cmo netstring_str.cmo netbuffer.cmo \

PKGNAME = netstring

REQUIRES = pcre bigarray
#pad: was when using ocamlfind
#REQUIRES = pcre bigarray
INCLUDES += -I ../../ocamlpcre/lib

INCLUDES += $(INC_NETSYS)

ISO_MAPPINGS = mappings/iso*.unimap
Expand Down
15 changes: 14 additions & 1 deletion external/ocamlnet/netsys/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TOP_DIR=../..
TOP_DIR=../

include $(TOP_DIR)/Makefile.conf
include Makefile.conf
Expand Down Expand Up @@ -80,5 +80,18 @@ netsys_oothr-posix: netsys_oothr_mt.cmx
clean::
rm -f configtests/*.o configtests/*.err
rm -f configtests/posix_shm
rm -f configtests/atfunctions
rm -f configtests/fchdir
rm -f configtests/fdopendir
rm -f configtests/ocaml_fancy_page_tables
rm -f configtests/posix_fadvise
rm -f configtests/posix_fadvise.tmp
rm -f configtests/posix_fallocate
rm -f configtests/posix_fallocate.tmp
rm -f configtests/posix_memalign
rm -f configtests/posix_pthread
rm -f configtests/posix_sem
rm -f configtests/syslog


include depend
1 change: 1 addition & 0 deletions external/ocamlnet/netsys/Makefile.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NETSYS_LINK_OPTIONS = -lrt -lpthread
29 changes: 29 additions & 0 deletions external/ocamlnet/tools/collect_files
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /bin/sh
#
# $Id: collect_files 1448 2010-05-05 12:34:11Z gerd $
# ----------------------------------------------------------------------
#
# usage: collect_files file ...
#
# Prints the names of the files passed as arguments which actually
# exist and are regular files.

for x in "$@"; do
if [ -f "$x" ]; then
case "$x" in
*.p.cmi) : ;;
*.p.so) : ;;
*) echo "$x" ;;
esac
fi
done

# ======================================================================
#
# $Log$
# Revision 1.1 2001/10/04 01:56:23 stolpmann
# Initial revision
#
# Revision 1.1 2000/07/27 21:07:26 gerd
# Initial revision.
#
Loading

0 comments on commit 61a5a9e

Please sign in to comment.