Skip to content

Commit

Permalink
Initial open-source release
Browse files Browse the repository at this point in the history
  • Loading branch information
MLstate committed Jun 21, 2011
0 parents commit fccc685
Show file tree
Hide file tree
Showing 1,857 changed files with 407,648 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
@@ -0,0 +1,18 @@
_build
*~
.*.swp
.*.swo
.DS_Store
\#*#
.#*
TAGS
._d
config.ml
config.sh
config.make
config.log
doc.odocl
access.log
error.log
*.native
repos/
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -0,0 +1,3 @@
opa (1.0s3.4) unstable; urgency=low
* initial open-source release
-- Louis Gesbert <louis.gesbert@mlstate.com> Fri, 10 Jun 2011 15:44:20 +0200
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

219 changes: 219 additions & 0 deletions Makefile
@@ -0,0 +1,219 @@
#!/usr/bin/make

# [ Warning ] don't use make to solve dependencies !!
#
# we rely on ocamlbuild which already handles them ; every rule should
# call it only once (no recursion)
#
# More info in build/Makefile.bld

include config.make

INSTALL ?= cp -u -L

.PHONY: default
default: all

include build/Makefile.bld

OPAOPT += "--rebuild"

export

##
## STANDARD TARGETS
##

.PHONY: all
all: $(MYOCAMLBUILD)
$(OCAMLBUILD) $(call target-tools,$(ALL_TOOLS)) opa-packages.stamp
@$(call copy-tools,$(ALL_TOOLS))

.PHONY: build
build: all

.PHONY: runtime-libs
runtime-libs: $(MYOCAMLBUILD)
$(OCAMLBUILD) runtime-libs.stamp

$(BUILD_DIR)/bin/opa: $(MYOCAMLBUILD)
$(OCAMLBUILD) opa-packages.stamp $(target-tool-opa-bin)
@$(copy-tool-opa-bin)
@utils/install.sh --quiet --dir $(PWD)/$(BUILD_DIR) --ocaml-prefix $(OCAMLLIB)/../..

.PHONY: opa
opa: $(BUILD_DIR)/bin/opa

.PHONY: opa-packages
opa-packages: $(MYOCAMLBUILD)
$(OCAMLBUILD) opa-packages.stamp

.PHONY: stdlib
stdlib: opa-packages

DISTRIB_TOOLS = opa-bin opadoc opa-plugin-builder-bin opa-plugin-browser-bin bslServerLib.ml opa-db-server opa-db-tool opa-cloud

.PHONY: distrib
distrib: $(MYOCAMLBUILD)
$(OCAMLBUILD) $(call target-tools,$(DISTRIB_TOOLS)) opa-packages.stamp
@$(call copy-tools,$(DISTRIB_TOOLS))

##
## INSTALLATION
##

.PHONY: install*

STDLIB_DIR = $(PREFIX)/lib/opa/stdlib
define install-package
@echo "Installing into $(STDLIB_DIR)/$*.opx\r\c"
@mkdir -p "$(STDLIB_DIR)/$*.opx/_build"
@find "$(BUILD_DIR)/$*.opx" -maxdepth 1 ! -type d -exec $(INSTALL) {} "$(STDLIB_DIR)/$*.opx/" \;
@$(INSTALL) $(BUILD_DIR)/$*.opx/_build/*.a "$(STDLIB_DIR)/$*.opx/_build/"
@$(INSTALL) $(BUILD_DIR)/$*.opx/_build/*.cmi "$(STDLIB_DIR)/$*.opx/_build/"
@$(INSTALL) $(BUILD_DIR)/$*.opx/_build/*.cmxa "$(STDLIB_DIR)/$*.opx/_build/"
endef

OPA_PACKAGES := $(shell cd stdlib && ./all_packages.sh)

# Rules installing everything that has been compiled
#
# This doesn't rely on install rules generated by Makefile.bld ;
# instead it assumes that what you want to install has been properly
# put in $(BUILD_DIR)/{bin,lib/opa,share/opa}.
#
# This is the case of tools (because of Makefile.bld),
# and of opa runtime libs (because build rules copy them
# to $(BUILD_DIR)/lib/opa/static).
# This doesn't install the other libs though, use target install-libs
# for that

install-packageopt-%:
$(if $(wildcard $(BUILD_DIR)/$*.opx/_build/*),$(install-package))

install-package-%:
$(install-package)

install-packages: $(addprefix install-packageopt-,$(OPA_PACKAGES))
@echo "Installation to $(STDLIB_DIR) done."

install-all-packages: $(addprefix install-package-,$(OPA_PACKAGES))
@echo "Installation to $(STDLIB_DIR) done."

install-bin:
@echo "Installing into $(PREFIX)/bin\r\c"
@mkdir -p $(PREFIX)/bin
@$(if $(wildcard $(BUILD_DIR)/bin/*),$(INSTALL) -r $(BUILD_DIR)/bin/* $(PREFIX)/bin)
@utils/install.sh --quiet --dir $(PREFIX) --ocamllib $(OCAMLLIB) --ocamlopt $(OCAMLOPT)
@echo "Installation to $(PREFIX)/bin done."

install-lib:
@echo "Installing into $(PREFIX)/lib/opa\r\c"
@mkdir -p $(PREFIX)/lib/opa
@$(if $(wildcard $(BUILD_DIR)/lib/opa/*),$(INSTALL) -r $(BUILD_DIR)/lib/opa/* $(PREFIX)/lib/opa/)
@echo "Installation to $(PREFIX)/lib/opa done."

install-share:
@echo "Installing into $(PREFIX)/share/opa\r\c"
@mkdir -p $(PREFIX)/share/opa
@$(if $(wildcard $(BUILD_DIR)/share/opa/*),$(INSTALL) -r $(BUILD_DIR)/share/opa/* $(PREFIX)/share/opa/)
@echo "Installation to $(PREFIX)/share/opa done."

install-doc:
@echo "Installing into $(PREFIX)/share/doc/opa\r\c"
@if [ -d $(BUILD_DIR)/opadoc/doc/ ]; then \
mkdir -p $(PREFIX)/share/doc/opa/api; \
$(INSTALL) -r $(BUILD_DIR)/opadoc/doc/* $(PREFIX)/share/doc/opa/api; \
fi
@echo "Installation to $(PREFIX)/share/doc/opa done."

install: install-bin install-lib install-share install-packages install-doc
@echo "Installation under prefix $(PREFIX) done."

.PHONY: uninstall
uninstall:
rm -rf $(PREFIX)/lib/opa
@[ ! -d $(PREFIX)/lib ] || [ -n "`ls -A $(PREFIX)/lib`" ] || rmdir $(PREFIX)/lib
rm -rf $(PREFIX)/share/opa
rm -rf $(PREFIX)/share/doc/opa
@[ ! -d $(PREFIX)/share ] || [ -n "`ls -A $(PREFIX)/share`" ] || rmdir $(PREFIX)/share
$(foreach file,$(BUILD_DIR)/bin/*,rm -f $(PREFIX)/bin/$(notdir $(file));)
@utils/install.sh --uninstall --dir $(PREFIX)
@[ ! -d $(PREFIX)/bin ] || [ -n "`ls -A $(PREFIX)/bin`" ] || rmdir $(PREFIX)/bin
@echo "Uninstall done."

# Install our ocamlbuild-generation engine
install-bld:
@mkdir -p $(PREFIX)/bin
@echo "#!/bin/bash -ue" > $(PREFIX)/bin/bld
@chmod 755 $(PREFIX)/bin/bld
@echo "BLDDIR=$(PREFIX)/share/opa/bld $(PREFIX)/share/opa/bld/gen_myocamlbuild.sh" >> $(PREFIX)/bin/bld
@echo "_build/myocamlbuild -no-plugin -j 6 \"\$$@\"" >> $(PREFIX)/bin/bld
@mkdir -p $(PREFIX)/share/opa/bld
@$(INSTALL) build/gen_myocamlbuild.sh build/myocamlbuild_*fix.ml config.sh config.mli config.ml\
$(PREFIX)/share/opa/bld

# Install an opa wrapper with different stdlib and options (for some backwards-compatibility)
install-qmlflat: # depends on opabsl_for_compiler, but we don't want to run ocamlbuild twice
@mkdir -p $(PREFIX)/bin $(PREFIX)/share/opa/mlstatebsl
@$(INSTALL) $(BUILD_DIR)/opabsl/mlstatebsl/opabslgen_*.opa $(PREFIX)/share/opa/mlstatebsl
@echo "#!/bin/bash -ue" > $(PREFIX)/bin/qmlflat
@chmod 755 $(PREFIX)/bin/qmlflat
@echo 'exec opa --no-stdlib --no-server --no-cps --no-closure --no-ei --no-constant-sharing --no-undot --separated off --value-restriction disabled --no-warn duplicateL0 --no-warn typer.warncoerce --no-warn unused --no-discard-of-unused-stdlib --no-warn pattern $$(if ! grep -qE "(^| )--no-stdlib( |$$)" <<<"$$*"; then echo $(shell sed "s%^[^# ]\+%$(PREFIX)/share/opa/mlstatebsl/opabslgen_&%; t OK; d; :OK" opabsl/mlstatebsl/bsl-sources); fi) "$$@"' \
>> $(PREFIX)/bin/qmlflat

# installs some dev tools on top of the normal install; these should not change often
install-all: install install-bld install-qmlflat
@$(INSTALL) platform_helper.sh $(PREFIX)/bin/

##
## DOCUMENTATION
##
# (in this section, multiple calls to ocamlbuild are tolerated)

.PHONY: doc.jsbsl
doc.jsbsl: $(MYOCAMLBUILD)
$(OCAMLBUILD) $@/index.html

# this rules provides the doc.html target (from Makefile.bld)
# the sed are just there to help sorting by filename-within-directory
.PHONY: doc.odocl
doc.odocl:
echo $(foreach lib,$(ALL_LIBS),$(lib-cmi-$(lib):%.cmi=%)) \
| sed 's# \+#\n#g' \
| sed 's#\(.*\)/\([^/]*\)#\1 \2#' \
| sort -k 2 -u \
| sed 's#\(.*\) \([^ ]*\)#\1/\2#' \
>$@

.PHONY: packages-api
packages-api: $(MYOCAMLBUILD)
OPAOPT="$(OPAOPT) --rebuild --api" $(OCAMLBUILD) opa-packages.stamp

.PHONY: opadoc/doc
opadoc/doc: opadoc packages-api
@mkdir -p $(BUILD_DIR)/$@
$(BUILD_DIR)/bin/opadoc -o $(BUILD_DIR)/$@ $(BUILD_DIR)/stdlib

.PHONY: book
book:
$(MAKE) -C doc/book

.PHONY: examples
examples: $(MYOCAMLBUILD)
$(OCAMLBUILD) $(call target-tools,opa-bin opa-plugin-builder-bin) opa-packages.stamp
$(call copy-tools,opa-bin opa-plugin-builder-bin)
MLSTATELIBS=`pwd`/$(BUILD_DIR) \
OPA="`pwd`/$(BUILD_DIR)/lib/opa/bin/opa-bin -I `pwd`/$(BUILD_DIR)" \
OPA_PLUGIN_BUILDER=`pwd`/$(BUILD_DIR)/lib/opa/bin/opa-plugin-builder-bin \
$(MAKE) -C doc/book examples

.PHONY: book-clean
book-clean:
$(MAKE) -C doc/book clean

.PHONY: clean
clean: book-clean

.PHONY: doc
doc: doc.html opadoc/doc book
103 changes: 103 additions & 0 deletions README
@@ -0,0 +1,103 @@
OPA


Overview
--------

Opa is a new generation of cloud development platform. It is a new programming
language, a new web server, a new database and a new distributed execution
engine, all of them tightly integrated to provide a great experience for cloud
developers.

This repository contains all the sources of the OPA compiler and libraries.


Quick build instructions
------------------------

$ ./configure
$ make
$ sudo make install

should get you there. ./configure should report any missing dependencies and
point you to the packages you may install to fix them (although those may depend
on your distribution).

The main dependency of OPA is OCaml 3.12. In case your distribution doesn't
provide a recent enough version, or if you miss some other dependencies, you can
use the installation_helper.sh script, which automates the download and
installation of our dependencies. Try

$ dependencies/installation_helper.sh --help


Directory layout
----------------

* _build: compilation target directory
* build: build scripts and auxiliary Makefiles
* copyright: some copyright information used in our binary package, which
includes external software (as obtained from the dependency installation
helper).
* dependencies: contains the dependency installation helper
* dissemination: contains helper programs to run on the cloud (transitional)
* installer: auxiliary files used to build binary packages
* plugins: additional OPA library modules (work in progress)
* stdlib: the OPA standard library
* tools: contains external checking tools; see Credits below
* utils: some auxiliary, independent tools like bash completion, syntax
highlighting for popular editors, etc.

The other directories contain the source of the OPA libraries, compiler, and
tools.

Files at the root of the repository:
* *.mllib: ocamlbuild target declaration for building an ocaml lib
* *.itarget: ocamlbuild target declaration for building a set of targets
* install_release.sh: builds a full OPA runtime in order to make a binary
package
* platform_helper.sh: some helpers to guarantee script compatibility, mostly
between Linux and MacOS
* make_package.sh: builds various kinds of binary packages from the file
hierarchy created by install_release.sh


The build system
----------------

The build system is based on OCamlbuild; the included build/Makefile.bld
dynamically builds an ocamlbuild plugin and generates targets based on files
build_libs, build_tools and build_rules.ml.

See build/Makefile.bld and build_rules.ml for more information. All generated
files are put in _build, following the same hierarchy as the source directory.


License & Credits
-----------------

OPA is Copyright 2011, MLstate ; it is distributed under the terms of the GNU
Affero General Public License, version 3. See file LICENSE for details.

The repository opalang is currently versioning 2 external tools in tools/
used only during the build process of Opa :

* The Closure Compiler (see tools/jschecker/README for copyright information)
* JsDoc Toolkit (see tools/jsdoc-toolkit/README.txt for copyright information)

The Closure Compiler is used as a checker for the Javascript part of the sources
of Opa, and JsDoc Toolkit is used for generating html documentation pages from this
Javascript code.

The use of these tools is transitional, and will soon be made optional.


Contact
-------

All bug reports, feedback, comments, contributions or remarks are welcome,
either on our website:
http://opalang.org

or by email, to:
support@opalang.org
42 changes: 42 additions & 0 deletions _tags
@@ -0,0 +1,42 @@
# -*- conf -*- (for emacs)
#
# GLOBAL TAGS
#
# <!> PLEASE BE VERY VERY (VERY) RESTRICTED WITH DEPENDENCIES
# if you are adding a flag 'use_something' in this file, you are probably doing something wrong
# this file should only contain restricted traverse directives, sorted by repos, and warning-error directives

# Default : do not include or traverse anything
<**/*>: -include, -traverse

# Warnings
<**/*.ml>: warn_L, warn_Z, warn_error_A

# -- from opageneral --

<{utils,buildinfos}>: traverse

# -- from libqml --

<{pplib,libbase,compilerlib,passlib,libtrx,jslang,ocamllang,libqmlcompil,libruntime,oparuntime,database,teerex,libbsl,qmlslicer,ulex,qmlpasses,libsession}>: traverse

<{libbase.{cma,cmxa},ocamlbase.top}>: use_stubs
<ocamlbase.top>: thread, use_unix, use_str, use_zip, use_ulex

# -- from qml2llvm --

<{opatop,qmlflat,qmlcps,qml2ocaml,qml2js,qmljsimp,qmlcompilers,tools}>: traverse

# -- from opa --

<{opacapi,opalib,shared,opa,plugins,opabsl,test,opalang,passes,stdlib,ml2opa,opadoc}>: traverse

# -- from appserver --
<{appruntime,libnet,libsecurity,libtools,protocols,opasmanagers}>: traverse
<libsecurity.*a>: use_cryptokit2, use_ssl_ext
<appruntime.*a>: use_io
<libnattraversal.*a>: use_miniupnpc_idl, use_natpmp_idl

# --
<{dissemination}>: traverse
<{libirc}>: traverse

0 comments on commit fccc685

Please sign in to comment.