Skip to content

Commit

Permalink
Use sedlex instead ulex
Browse files Browse the repository at this point in the history
Sedlex is a successor of ulex based ppx.

A side effect of this change is that now we use opam for installing
third-party dependencies.
  • Loading branch information
alavrik committed Aug 18, 2019
1 parent e220d22 commit a7a9cd6
Show file tree
Hide file tree
Showing 18 changed files with 327 additions and 294 deletions.
22 changes: 1 addition & 21 deletions .travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ else
brew upgrade python

# build dependencies (Mac OS X)
brew install ocaml opam
brew install opam

# optional dependencies for running tests
brew install protobuf
Expand All @@ -39,36 +39,16 @@ else
opam init
eval `opam config env`

# install basic build dependencies using opam
opam install ocamlfind camlp5

# so that tests pass with the latest protobuf version
export CXXFLAGS='-std=c++14'

elif [ "$OCAML_VERSION" = "system" ]
then
# build dependencies (Ubuntu)
sudo apt-get install ocaml-nox camlp5 ocaml-findlib

# optional dependencies for running tests and building docs
#
# NOTE: these need to be tested only once, no need to re-run these
# tests for all OCaml versions
sudo apt-get install libprotoc-dev protobuf-compiler pandoc

echo "system OCaml version:"
ocaml -version
else
# install specific ocaml version
wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-ocaml.sh

. .travis-ocaml.sh

# install basic build dependencies using opam
opam install ocamlfind camlp5
fi


./configure
make deps
make
Expand Down
51 changes: 11 additions & 40 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -19,59 +19,30 @@ architectures supported by OCaml. See the list of supported platforms at
PREREQUISITES
=============

On Debian and Ubuntu:
1. Install OCaml and opam (package manager for OCaml)

apt-get install ocaml camlp5 ocaml-findlib gcc make sed
On Debian and Ubuntu:

apt-get install opam

On Mac OS X (using Homebrew):

brew install ocaml opam
opam init
eval `opam config env`
opam install ocamlfind camlp5

(Here, we used [OPAM](http://opam.ocaml.org/) to build and install
ocamlfind).


On Windows:

See the "CROSS-COMPILATION" section below for instructions on building a
Windows executable on Linux and Mac OS X.

For building native Windows binaries, download and install OCaml for
Windows from here:
On other systems, see [OPAM](http://opam.ocaml.org/)

http://protz.github.io/ocaml-installer/
To cross-compile for Windows, see the "CROSS-COMPILATION" section below

For building under Cygwin, follow the steps from the next section.

2. Configure opam

On other Unix systems:

* OCaml (>= 4.03.0)

OCaml is available in most Linux distributions. It can also be
downloaded from here:

http://caml.inria.fr/download.en.html

* Camlp5 -- Caml Preprocessor and Pretty Printer

* Ocamlfind/Findlib -- library manager for OCaml

If installed separately form prepackaged OCaml distribution, it
is recommended to build it from sources after you build/install
OCaml. It can be downloaded from here:
opam init
eval `opam config env`

http://projects.camlcity.org/projects/findlib.html
* C compiler

GCC works. Other compilers should work if they are able to build
OCaml.
3. Install dependencies

* GNU make, sed and probably some other tools.
opam install --deps-only ./opam


INSTALLATION INSTRUCTIONS
Expand All @@ -81,7 +52,7 @@ INSTALLATION INSTRUCTIONS

Run "./configure --help" for the list of available options.

2. Build third-party dependencies
2. Install third-party dependencies

make deps

Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ endif


deps: build-dir
$(MAKE) -C deps download
$(MAKE) -C deps
$(MAKE) -C deps uninstall install
@#$(MAKE) -C deps download
@#$(MAKE) -C deps
@#$(MAKE) -C deps uninstall install
opam install -y --deps-only ./opam


build-dir:
Expand Down
27 changes: 14 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ then
# skipping everything else in cross-compilation mode; namely, we have to
# cross-compile deps that come with the package
echo "export SYSTEM := unix" >> $M

# figure out which dependencies we need to build
echo "checking whether necessary dependencies are already installed..."
for i in xmlm easy-format base64
do
dir="`$OCAMLFIND query $i 2>/dev/null`"
if [ $? -eq 0 ]
then
echo "$i is installed in $dir"
echo "SKIP-$i = 1" >> $M
else
echo "$i is not installed; it will be built during \"make deps\""
fi
done
else
# detecting the type of OCaml toolchain
system="`ocamlc -config 2>/dev/null | grep system | sed 's/system: //'`"
Expand All @@ -109,19 +123,6 @@ else
echo "detected $system OCaml toolchain"
fi

# figure out which dependencies we need to build
echo "checking whether necessary dependencies are already installed..."
for i in xmlm ulex-camlp5 easy-format base64
do
dir="`$OCAMLFIND query $i 2>/dev/null`"
if [ $? -eq 0 ]
then
echo "$i is installed in $dir"
echo "SKIP-$i = 1" >> $M
else
echo "$i is not installed; it will be built during \"make deps\""
fi
done

OCAML_VERSION=`$OCAMLFIND ocamlc -version`
if [ $? -ne 0 ]
Expand Down
4 changes: 0 additions & 4 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ endif
export OCAMLPATH


ifndef SKIP-ulex
DIRS += ulex-camlp5
endif

ifndef SKIP-xmlm
DIRS += xmlm
endif
Expand Down
6 changes: 0 additions & 6 deletions deps/ulex-camlp5/META

This file was deleted.

40 changes: 0 additions & 40 deletions deps/ulex-camlp5/Makefile

This file was deleted.

16 changes: 0 additions & 16 deletions deps/ulex-camlp5/Makefile.camlp5

This file was deleted.

38 changes: 0 additions & 38 deletions deps/ulex-camlp5/Makefile.download

This file was deleted.

2 changes: 1 addition & 1 deletion opam
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ depends: [
"ocaml" {>= "4.03"}
"ocamlfind" {build}
"easy-format"
"ulex-camlp5"
"sedlex"
"xmlm"
"base64" {>="3.1.0"}
]
Expand Down
2 changes: 1 addition & 1 deletion piqilib/META.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description = "The Piqi library -- runtime support for multi-format Protobuf/JSON/XML/Piq data serialization and conversion"
requires = "ulex-camlp5 easy-format xmlm base64"
requires = "easy-format xmlm base64 sedlex"
archive(byte) = "piqilib.cma"
archive(native) = "piqilib.cmxa"
4 changes: 2 additions & 2 deletions piqilib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ LIBINSTALL_FILES += \
$(wildcard *.cmi) \


PACKS = ulex-camlp5 easy-format xmlm base64

PACKS = easy-format xmlm base64 sedlex sedlex.ppx

SOURCES = \
piqi_version.ml \
Expand Down Expand Up @@ -39,6 +38,7 @@ SOURCES = \
piqi_protobuf.ml \
piqi_db.ml \
\
piqi_utf8.ml \
piq_lexer.ml \
piq_parser.ml \
piq_gen.ml \
Expand Down
Loading

0 comments on commit a7a9cd6

Please sign in to comment.