Skip to content
Commits on Source (7)
From: Sylvain Le Gall <sylvain@le-gall.net>
To: caml-list@inria.fr
Subject: [ANN] ocaml-gettext v0.3.3
Hello,
General:
ocaml-gettext is a library that enables string translation in OCaml. The API
is based on GNU gettext. It comes with a tool to extract strings which need to
be translated from OCaml source files.
This enables OCaml program to output string in the native language of the user,
if a corresponding translation file of the English strings is provided.
Changes:
v 0.3.3 is a bug fix release:
* compatible with ocaml-fileutils 0.4.0
* more static type-check of format string
Links:
http://le-gall.net/sylvain+violaine/ocaml-gettext.html
http://le-gall.net/sylvain+violaine/download/ocaml-gettext-0.3.3.tar.gz
Regards
Sylvain Le Gall
/_build/
/setup.data
/setup.log
/dist/
/test.byte
/ConfMakefile
/configure
/libgettext-ocaml/META
/libgettext-ocaml/gettextConfig.ml
/config.log
/config.status
/dist/
/po/*.mo
/po/fr.po.bak
/test/test
/test/tests/
*.merlin
/*.install
*.swp
profile = conventional
language: c
sudo: required
install: test -e .travis.opam.sh || wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-opam.sh
script: bash -ex .travis-opam.sh
env:
global:
- OUNIT_CI=true PINS="gettext.0.4.0:. gettext-stub.0.4.0:. gettext-camomile.0.4.0:."
addons:
homebrew:
update: true
cache:
directories:
- $HOME/Library/Caches/Homebrew
matrix:
include:
- name: "gettext: reverse dependencies with linux"
os: linux
env: OCAML_VERSION=4.08 PACKAGE="gettext" REVDEPS="true"
- name: "gettext-stub: reverse dependencies with linux"
os: linux
env: OCAML_VERSION=4.08 PACKAGE="gettext-stub" REVDEPS="true"
- name: "gettext-camomile: reverse dependencies with linux"
os: linux
env: OCAML_VERSION=4.08 PACKAGE="gettext-camomile" REVDEPS="true"
- name: "gettext: MacOSX"
os: osx
env: OCAML_VERSION=4.08 PACKAGE="gettext"
- name: "gettext-stub: MacOSX"
os: osx
env: OCAML_VERSION=4.08 PACKAGE="gettext-stub"
- name: "gettext-camomile: MacOSX"
os: osx
env: OCAML_VERSION=4.08 PACKAGE="gettext-camomile"
v 0.3.7 (Wed, 01 Mar 2017 22:55:57 +0100):
* Add an extra step to generate configure.
v 0.3.6 (Sun, 26 Feb 2017 12:34:34 +0100):
* Remove unix.cma linking argument for 4.0{3,4} compatibility
v 0.3.5 (Mon, 04 Aug 2014 23:31:41 +0200):
* Always use format_of_string to not segfault with OCaml 4.02.
v 0.3.4 (Tue, 09 Aug 2011 10:12:55 +0000):
* Use camomile 0.8.3
v 0.3.3 (Sun, 01 Nov 2009 23:59:13 +0100):
* Upgrade ocaml-fileutils 0.4.0
* Improve gettext-stub C parts (memory management)
* Correctly handle OCaml string, wrt of escape char (Closes: FS#70)
* Remove the right file when uninstalling (Closes: FS#61)
* Enforce type safety for format string and plural (Closes: FS#72)
* Only output warning for install check that can be handle afterwards i
(Closes: FS#74)
* Add a --strict flag to ocaml-gettext to make an error for every install check
failed.
* Take into account Windows eol '\r' when parsing comments
(Closes: FS#75)
* Don't include empty translation (Closes: FS#90)
* Check returned format string for fdgettext (Closes: FS#91)
v 0.3.2 (Thu, 05 Jun 2008 22:12:51 +0200):
* Fix bug when buggy LANG/LC_ALL is set, using gettext stub (Richard W.M. Jones)
v 0.3.1 (Fri, 09 May 2008 23:10:59 +0200):
* Fix bug when no LANG or LC_ALL is set
* Better autoconf use of @VERSION@
* Only remove build dir in top Makefile
v 0.3.0 (Tue, 29 Apr 2008 22:58:22 +0200):
* Get rid of ocaml-ast-analyze (Richard W.M. Jones)
* Port of camlp4 extension to OCaml 3.10.1 (Richard W.M. Jones)
* Compile with camomile 0.7.1 (Richar W.M. Jones)
* Check dependency on ocaml-fileutils in configure
* Add --disable-doc-pdf to configure, to allow building doc without PDF (and fop)
* Get rid of camlidl
* Distribute .mli and .cmx file
* Handle multiline comment when merging, especially location "#:" and special
comment "#,"
* Partially handle UTF-8, by not escaping string using "Printf.fprintf
"%S"" but by using the same rule as the one used for reading escaped string
* Rework build system to:
* use "install" programm to create dir and copy files
* use --docdir and --prefix from configure
* Don't build PDF document by default
* Install documentation in $docdir/html/{api|api-ref|reference-manual}
* Fix typo in documentation
v 0.2.0 :
* Full rewrite of ocaml-gettext.
* Contains two version of the gettext engine : one is based on a purely OCaml approach (gettext-camomile),
one is base on the former one (gettext-stub).
* The two engines shared a common interface based on gettext.base module.
* Most of the encoding/settings choice are accessible through command line option.
* Simplify the functions to accesse to gettext : 4 functions to translate
* Rebuild the string extractor with as a camlp4 analyzer
* Write test and benchmark program for maintaing the quality
* Write an example
* Write a manual
## v0.4.1 - 2019-10-02
### Fixed
- Improve documentation layout.
- Set minimum version of OCaml to 4.03.
- Add depext for Alpine Linux.
## v0.4.0 - 2019-10-02
### Changed
- Migrate build system to dune and opam.
- Make the package available on Linux, MacOSX and Windows.
- Reformat the documentation to use GitHub compatible Markdown.
### Fixed
- Move ocaml-xgettext from Camlp4 to ppx (thanks to Richard W.M. Jones).
## v0.3.8 - 2017-11-12
- Replace string by bytes, for compability with OCAml 4.06.
## v0.3.7 - 2017-03-01
- Add an extra step to generate configure.
## v0.3.6 - 2017-02-26
- Remove unix.cma linking argument for 4.0{3,4} compatibility
## v0.3.5 - 2014-08-04
- Always use format_of_string to not segfault with OCaml 4.02.
## v0.3.4 - 2011-08-09
- Use camomile 0.8.3
## v0.3.3 - 2009-11-01
- Upgrade ocaml-fileutils 0.4.0
- Improve gettext-stub C parts (memory management)
- Correctly handle OCaml string, wrt of escape char (Closes: FS#70)
- Remove the right file when uninstalling (Closes: FS#61)
- Enforce type safety for format string and plural (Closes: FS#72)
- Only output warning for install check that can be handle afterwards i
(Closes: FS#74)
- Add a --strict flag to ocaml-gettext to make an error for every install check
failed.
- Take into account Windows eol '\r' when parsing comments
(Closes: FS#75)
- Don't include empty translation (Closes: FS#90)
- Check returned format string for fdgettext (Closes: FS#91)
## v0.3.2 - 2008-06-05
- Fix bug when buggy LANG/LC_ALL is set, using gettext stub (Richard W.M. Jones)
## v0.3.1 - 2008-05-09
- Fix bug when no LANG or LC_ALL is set
- Better autoconf use of @VERSION@
- Only remove build dir in top Makefile
## v0.3.0 - 2008-04-29
- Get rid of ocaml-ast-analyze (Richard W.M. Jones)
- Port of camlp4 extension to OCaml 3.10.1 (Richard W.M. Jones)
- Compile with camomile 0.7.1 (Richar W.M. Jones)
- Check dependency on ocaml-fileutils in configure
- Add --disable-doc-pdf to configure, to allow building doc without PDF (and
fop)
- Get rid of camlidl
- Distribute .mli and .cmx file
- Handle multiline comment when merging, especially location "#:" and special
comment "#,"
- Partially handle UTF-8, by not escaping string using "Printf.fprintf
"%S"" but by using the same rule as the one used for reading escaped string
- Rework build system to:
- use "install" programm to create dir and copy files
- use --docdir and --prefix from configure
- Don't build PDF document by default
- Install documentation in $docdir/html/{api|api-ref|reference-manual}
- Fix typo in documentation
## v0.2.0
- Full rewrite of ocaml-gettext.
- Contains two version of the gettext engine : one is based on a purely OCaml
approach (gettext-camomile), one is base on the former one (gettext-stub).
- The two engines shared a common interface based on gettext.base module.
- Most of the encoding/settings choice are accessible through command line
option.
- Simplify the functions to accesse to gettext : 4 functions to translate
- Rebuild the string extractor with as a camlp4 analyzer
- Write test and benchmark program for maintaing the quality
- Write an example
- Write a manual
##########################################################################
# ocaml-gettext: a library to translate messages #
# #
# Copyright (C) 2001 Jean-Christophe FILLIATRE #
# Copyright (C) 2003-2008 Sylvain Le Gall <sylvain@le-gall.net> #
# #
# This library is free software; you can redistribute it and/or #
# modify it under the terms of the GNU Lesser General Public #
# License as published by the Free Software Foundation; either #
# version 2.1 of the License, or (at your option) any later version; #
# with the OCaml static compilation exception. #
# #
# This library is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
# Lesser General Public License for more details. #
# #
# You should have received a copy of the GNU Lesser General Public #
# License along with this library; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 #
# USA #
##########################################################################
# where to install the binaries
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
BINDIR =@bindir@
LIBDIR =@libdir@
MANDIR =@mandir@
DOCDIR =@docdir@
PODIR =@localedir@
OCAMLLIB=@OCAMLLIB@
# programs to build an compile
OCAMLFIND_COMMANDS = "ocamlc=@OCAMLC@ \
ocamlopt=@OCAMLOPT@ \
ocamldep=@OCAMLDEP@"
OCAMLC = @OCAMLFIND@ ocamlc
OCAMLOPT = @OCAMLFIND@ ocamlopt
OCAMLDEP = @OCAMLFIND@ ocamldep
OCAMLBEST = @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
OCAMLFIND = @OCAMLFIND@
OCAMLMKLIB = @OCAMLMKLIB@
OCAMLYACC = @OCAMLYACC@
OCAMLLEX = @OCAMLLEX@
EXE = @EXE@
XSLTPROC = @XSLTPROC@
XMLLINT = @XMLLINT@
OCAMLDOC = @OCAMLDOC@
FOP = @FOP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
VERSION = @PACKAGE_VERSION@
# stylesheets
HTMLXSL = @HTMLXSL@
MANXSL = @MANXSL@
FOXSL = @FOXSL@
# temporary build directory
abs_top_srcdir = @abs_top_srcdir@
TMPBUILDDIR = @TMPBUILDDIR@
# build target
BUILD_CAMOMILE=@BUILD_CAMOMILE@
BUILD_STUB=@BUILD_STUB@
BUILD_TEST=@BUILD_TEST@
BUILD_BENCH=@BUILD_BENCH@
BUILD_DOC=@BUILD_DOC@
BUILD_DOC_PDF=@BUILD_DOC_PDF@
# configuration
STUB_LDFLAGS=@STUB_LDFLAGS@
STUB_CFLAGS=@STUB_CFLAGS@
# ocamlfind install/remove flags
OCAMLFIND_INSTALL_FLAGS=@OCAMLFIND_INSTALL_FLAGS@
OCAMLFIND_REMOVE_FLAGS=@OCAMLFIND_REMOVE_FLAGS@
--------------
ocaml-gettext
--------------
Prerequisite :
In order to install you will need :
- ocaml ( >= 3.10.1 )
http://caml.inria.fr/
- ocamlfind ( >= 0.8 )
http://www.ocaml-programming.de/packages/
- make, a C compiler, libintl.h ( which is bundle in libc6 )
- camomile (>= 0.8.3)
- ocaml-fileutils (>= 0.4.0)
- ounit
- benchmark
- docbook DTD and XSL
- xsltproc
Installing :
1) Go in the untared source directory
2) ./configure
3) make
4) make install
Uninstalling :
With the same value you use to install
1) Go in the untared source directory
2) make uninstall
......@@ -20,67 +20,54 @@
# USA #
##########################################################################
all:
cd libgettext-ocaml && $(MAKE) all
cd libgettext-stub-ocaml && $(MAKE) all
cd libgettext-camomile-ocaml && $(MAKE) all
cd ocaml-gettext && $(MAKE) all
cd po && $(MAKE) all
cd doc && $(MAKE) all
cd test && $(MAKE) all
default: build test
install:
cd libgettext-ocaml && $(MAKE) install
cd libgettext-stub-ocaml && $(MAKE) install
cd libgettext-camomile-ocaml && $(MAKE) install
cd ocaml-gettext && $(MAKE) install
cd po && $(MAKE) install
cd doc && $(MAKE) install
GENERATED_FILES=src/lib/gettext/base/gettextConfigGen.ml
$(GENERATED_FILES): configure.ml
ocaml configure.ml
uninstall:
cd doc && $(MAKE) uninstall
cd po && $(MAKE) uninstall
cd ocaml-gettext && $(MAKE) uninstall
cd libgettext-camomile-ocaml && $(MAKE) uninstall
cd libgettext-stub-ocaml && $(MAKE) uninstall
cd libgettext-ocaml && $(MAKE) uninstall
build: $(GENERATED_FILES)
dune build @install
doc: $(GENERATED_FILES)
dune build @doc
test: $(GENERATED_FILES)
dune build examples/library/examplesLibrary.a
dune build examples/gui/examplesGUI.a
dune build examples/program/program.exe
dune runtest
all: $(GENERATED_FILES)
dune build @all
dune runtest
install: build
dune install
uninstall: all
dune uninstall
clean:
-cd test && $(MAKE) clean
-cd doc && $(MAKE) clean
-cd po && $(MAKE) clean
-cd examples && $(MAKE) clean
-cd ocaml-gettext && $(MAKE) clean
-cd libgettext-camomile-ocaml && $(MAKE) clean
-cd libgettext-stub-ocaml && $(MAKE) clean
-cd libgettext-ocaml && $(MAKE) clean
-$(RM) -r $(TMPBUILDDIR)
dune clean
distclean: clean
-cd test && $(MAKE) distclean
-cd doc && $(MAKE) distclean
-cd po && $(MAKE) distclean
-cd examples && $(MAKE) distclean
-cd ocaml-gettext && $(MAKE) distclean
-cd libgettext-camomile-ocaml && $(MAKE) distclean
-cd libgettext-stub-ocaml && $(MAKE) distclean
-cd libgettext-ocaml && $(MAKE) distclean
-$(RM) config.* ConfMakefile
-$(RM) -r autom4te.cache config.log config.cache config.status
bench:
dune exec test/bench/bench.exe
headache: distclean
headache -h .header -c .headache.config `find $(CURDIR)/ -type d -name .svn -prune -false -o -type f`
headache -h .header \
-c .headache.config \
`find $(CURDIR)/ -type d -name .svn -prune -false -o -type f`
deploy:
mkdir dist || true
admin-gallu-deploy \
--package_name ocaml-gettext --package_version "$(VERSION)" \
--verbose --forge_upload --forge_group ocaml-gettext \
--autogen
deploy: doc test
dune-release lint
dune-release tag
git push --all
git push --tag
dune-release
test: all
cd test && ./test
eol:
find ./ -name _build -prune -false -or -name "*.ml" | xargs grep -r -e " *$$"
-include ConfMakefile
.PHONY: build doc test all uninstall clean install bench deploy
.PHONY: all install uninstall clean distclean deploy test
--------------
ocaml-gettext
--------------
This library is a wrapper around gettext
(http://www.gnu.org/software/gettext/gettext.html), it also provides a pure
Ocaml implementation based on camomile.
The primary target of this work is to bring internationalization to
cameleon ( http://savannah.nongnu.org/projects/cameleon/ ). Before i
can do it, i need to test and test this library... ( so i package it
and try to use it with some program of my creation... ).
Feel free to use it in your application. There is no real doc coming
with it, but i will prepare some in the next future.
Sylvain LE GALL
OCaml-gettext - Internationalization library for OCaml (i18n)
=============================================================
[![Travis status][travis-img]][travis]
[![AppVeyor status][appveyor-img]][appveyor]
Internationalization of a program means that the program have the possibility
to handle different language. It can output messages which depend on the
language of the user. Typically, if a program can output "bonjour" for a
french user, and "hello" for an english user, this program is
internationalized.
GNU gettext is one of the standard solutions for i18n. You just need to use
special functions to translate strings. These functions are used when the
program is running to do the translation and when compiling the program to
extract the strings automatically. In ocaml-gettext these functions are "s_",
"f_","sn_" and "fn_". They are both used to translate at runtime and to extract
strings for translation.
ocaml-gettext provides enough service to build a internationalized program. It
comes with :
* a pure Ocaml implementation, based on Camomile,
* an alternative implementation with a binding to GNU gettext library,
* `ocaml-gettext` a tool to extract strings from Ocaml source.
[travis]: https://travis-ci.org/gildor478/ocaml-gettext
[travis-img]: https://travis-ci.org/gildor478/ocaml-gettext.svg?branch=master
[appveyor]: https://ci.appveyor.com/project/gildor478/ocaml-gettext
[appveyor-img]: https://ci.appveyor.com/api/projects/status/4dalakr6ixnhotve/branch/master?svg=true
Installation
------------
The recommended way to install ocaml-gettext is via the [opam package manager][opam]:
```sh
$ opam install ounit
```
Documentation
-------------
* API documentation is
[available online](https://gildor478.github.io/ocaml-gettext).
* [Reference manual](doc/reference-manual.md)
Examples
--------
* A [library](examples/library)
* A [program](examples/program)
* A [GUI](examples/gui)
##########################################################################
# ocaml-gettext: a library to translate messages #
# #
# Copyright (C) 2001 Jean-Christophe FILLIATRE #
# Copyright (C) 2003-2008 Sylvain Le Gall <sylvain@le-gall.net> #
# #
# This library is free software; you can redistribute it and/or #
# modify it under the terms of the GNU Lesser General Public #
# License as published by the Free Software Foundation; either #
# version 2.1 of the License, or (at your option) any later version; #
# with the OCaml static compilation exception. #
# #
# This library is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
# Lesser General Public License for more details. #
# #
# You should have received a copy of the GNU Lesser General Public #
# License along with this library; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 #
# USA #
##########################################################################
# destination dir
DOCHTML=$(DOCDIR)/html
DOCODOC=$(DOCDIR)/html
DOCPDF =$(DOCDIR)/pdf
# programs flags
FOPFLAGS =
XSLTPROCFLAGS = --xinclude
XMLLINTFLAGS = --xinclude --noent --noout --postvalid
OCAMLDOCFLAGS =
ifdef REQUIRES
CLI_REQUIRES = -package "$(REQUIRES)"
endif
ifdef PREDICATES
CLI_PREDICATES = -predicates "$(PREDICATES)"
endif
ifdef SYNTAX
CLI_SYNTAX = -syntax $(SYNTAX)
endif
CLI_OCAMLFIND = $(CLI_REQUIRES) $(CLI_PREDICATES) $(CLI_SYNTAX)
BUILDLIB = $(TMPBUILDDIR)/lib
BUILDBIN = $(TMPBUILDDIR)/bin
BUILDDOC = $(TMPBUILDDIR)/share/doc
BUILDHTML = $(BUILDDOC)/html
BUILDMAN = $(TMPBUILDDIR)/share/man
BUILDODOC = $(BUILDHTML)/api
BUILDPDF = $(BUILDDOC)
BUILDPO = $(TMPBUILDDIR)/share/locale
OCAMLPATH:=$(BUILDLIB)/:$(OCAMLPATH)
export OCAMLPATH
all: $(STUBSLIB) $(if $(NAME),all-$(OCAMLBEST))
all-byte: $(if $(LIBRARY), install-buildlib-byte, install-buildprog-byte)
all-opt: $(if $(LIBRARY), install-buildlib-opt, install-buildprog-opt)
all: install-builddoc-html
all: install-builddoc-man
all: install-builddoc-odoc
all: install-builddoc-pdf
install: all $(if $(NAME),install-$(OCAMLBEST))
install-byte: $(if $(LIBRARY), install-lib-byte, install-prog-byte)
install-opt: $(if $(LIBRARY), install-lib-opt, install-prog-byte)
install: install-doc-html
install: install-doc-man
install: install-doc-odoc
install: install-doc-pdf
uninstall: $(if $(LIBRARY), uninstall-lib, uninstall-prog)
uninstall: uninstall-doc-html
uninstall: uninstall-doc-man
uninstall: uninstall-doc-odoc
uninstall: uninstall-doc-pdf
clean:: $(if $(LIBRARY), clean-lib, clean-prog)
clean:: clean-doc-odoc
clean:: clean-doc-pdf
clean:: clean-doc-html
clean:: clean-doc-man
distclean::
CMX = $(patsubst dll%.so, lib%.a, $(CMO:.cmo=.cmx))
INSTALL_DIR_AUX=$(INSTALL) -d $(2); $(INSTALL_DATA) -t $(2) $(wildcard $(dir $(1))*)
INSTALL_DIR=$(call INSTALL_DIR_AUX,$(1),$(2)/$(notdir $(patsubst %/,%,$(dir $(1)))))
# Build the lib
ONLY_BYTE=$(filter-out %.o,$(filter-out %.a,$(filter-out %.cmx, $(filter-out %.cmxa,$(1))))) $(filter lib%.a,$(1))
ML_OR_MLI=$(if $(wildcard $(1).mli),$(1).mli,$(1).ml)
GET_MLI=$(foreach interf,$(patsubst %.mli,%,$(filter %.mli,$(patsubst %.cmi,%.mli,$(1)))),$(call ML_OR_MLI,$(interf)))
%.cmxa %.a %.so:
$(if $(STUBSOBJS), \
$(OCAMLMKLIB) -o $* $^ $(OCAMLMKLIB_FLAGS), \
$(OCAMLOPT) -a -o $*.cmxa $^ \
)
%.cma %.a %.so:
$(if $(STUBSOBJS), \
$(OCAMLMKLIB) -o $* $^ $(OCAMLMKLIB_FLAGS), \
$(OCAMLC) -a -o $*.cma $^ \
)
install-buildlib-byte: REAL_INSTALLIB = $(call ONLY_BYTE,$(INSTALLIB))
install-buildlib-byte: $(call ONLY_BYTE,$(INSTALLIB))
install-buildlib-byte: install-buildlib-common
install-buildlib-opt: REAL_INSTALLIB = $(INSTALLIB)
install-buildlib-opt: $(INSTALLIB)
install-buildlib-opt: install-buildlib-common
install-buildlib-common: $(call GET_MLI,$(INSTALLIB))
$(INSTALL) -d $(BUILDLIB)
-$(OCAMLFIND) remove -destdir $(BUILDLIB) $(NAME)
$(OCAMLFIND) install -ldconf ignore -destdir $(BUILDLIB) -patch-version $(VERSION) $(NAME) \
$(REAL_INSTALLIB) $(call GET_MLI, $(REAL_INSTALLIB))
install-lib-byte: REAL_INSTALLIB = $(call ONLY_BYTE,$(INSTALLIB))
install-lib-byte: $(call ONLY_BYTE,$(INSTALLIB))
install-lib-byte: install-lib-common
install-lib-opt: REAL_INSTALLIB = $(INSTALLIB)
install-lib-opt: $(INSTALLIB)
install-lib-opt: install-lib-common
install-lib-common: $(call GET_MLI,$(INSTALLIB))
-$(OCAMLFIND) remove $(OCAMLFIND_REMOVE_FLAGS) $(NAME)
$(OCAMLFIND) install $(OCAMLFIND_INSTALL_FLAGS) -patch-version $(VERSION) $(NAME) \
$(REAL_INSTALLIB) $(call GET_MLI,$(INSTALLIB))
uninstall-lib:
-$(OCAMLFIND) remove $(OCAMLFIND_REMOVE_FLAGS) $(NAME)
clean-lib:
-$(OCAMLFIND) remove -destdir $(BUILDLIB) $(NAME)
# Build the executable
BLIBS = $(addsuffix .cma,$(LIBS))
install-buildprog-byte: $(CMO)
$(OCAMLC) -o $(NAME) $(INCLUDES) -package "$(REQUIRES)" -linkpkg \
-predicates "$(PREDICATES)" $(BLIBS) $(CMO)
$(INSTALL) -d $(BUILDBIN)
$(INSTALL_SCRIPT) -t $(BUILDBIN) $(NAME)
install-prog-byte: install-buildprog-byte
$(INSTALL) -d $(BINDIR)
$(INSTALL_SCRIPT) -t $(BINDIR) $(NAME)
OLIBS = $(addsuffix .cmxa,$(LIBS))
install-buildprog-opt: $(CMX)
$(OCAMLOPT) -o $(NAME) $(INCLUDES) -package "$(REQUIRES)" -linkpkg \
-predicates "$(PREDICATES)" $(OLIBS) $(CMX)
$(INSTALL) -d $(BUILDBIN)
$(INSTALL_SCRIPT) -t $(BUILDBIN) $(NAME)
install-prog-opt: install-buildprog-opt
$(INSTALL) -d $(BINDIR)
$(INSTALL_SCRIPT) -t $(BINDIR)/ $(NAME)
uninstall-prog:
$(if $(NAME),-$(RM) $(BINDIR)/$(NAME))
clean-prog:
-$(RM) $(NAME)
# Build PDF files
PDF_TARGET=$(patsubst %.xml,$(BUILDPDF)/%.pdf,$(1))
$(BUILDPDF)/%.pdf: %.fo
$(INSTALL) -d $(dir $@)
$(FOP) $(FOPFLAGS) -fo $^ -pdf $@
%.fo: %.xml
$(XMLLINT) $(XMLLINTFLAGS) $^
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $(FOXSL) $^
install-builddoc-pdf: $(PDF_TARGETS)
clean-doc-pdf:
install-doc-pdf:
$(if $(PDF_TARGETS),$(INSTALL) -d $(DOCPDF))
$(if $(PDF_TARGETS),$(INSTALL_DATA) -t $(DOCPDF) $(PDF_TARGETS))
uninstall-doc-pdf:
-$(if $(PDF_TARGETS),$(RM) $(foreach i,$(PDF_TARGETS),$(DOCPDF)/$(notdir $(i))))
# Build OCaml documentaiton
ODOC_TARGET=$(BUILDODOC)/$(1)/index.html
TARGET_ODOC=$(notdir $(patsubst %/index.html,%,$(1)))
$(BUILDODOC)/%/index.html:
$(INSTALL) -d $(dir $@)
EXTRAFLAGS=`$(OCAMLFIND) query -i-format -r $(REQUIRES)`; \
$(OCAMLDOC) $(OCAMLDOCFLAGS) $$EXTRAFLAGS -d $(dir $@) -html $^
$(if $(EXTRAFILES),$(INSTALL_DATA) -t $(dir $@) $(EXTRAFILES))
install-builddoc-odoc: $(ODOC_TARGETS)
clean-doc-odoc:
install-doc-odoc:
$(if $(ODOC_TARGETS),$(foreach i,$(ODOC_TARGETS), $(INSTALL) -d $(DOCODOC)/$(call TARGET_ODOC,$(i));))
$(if $(ODOC_TARGETS),$(foreach i,$(ODOC_TARGETS), $(INSTALL_DATA) -t $(DOCODOC)/$(call TARGET_ODOC,$(i)) $(wildcard $(dir $(i))/*);))
uninstall-doc-odoc: clean-doc-odoc
-$(if $(ODOC_TARGETS),$(RM) -r $(foreach i,$(ODOC_TARGETS),$(DOCODOC)/$(call TARGET_ODOC,$(i))))
# Build HTML files
HTML_TARGET=$(patsubst %.xml,$(BUILDHTML)/%/index.html,$(1))
TARGET_HTML=$(notdir $(patsubst %/index.html,%,$(1)))
$(BUILDHTML)/%/index.html: %.xml
$(XMLLINT) $(XMLLINTFLAGS) $^
$(INSTALL) -d $(dir $@)
$(XSLTPROC) $(XSLTPROCFLAGS) --stringparam base.dir "$(dir $@)" $(HTMLXSL) $^
$(if $(IMAGES),$(INSTALL_DATA) -t $(dir $@) $(IMAGES))
install-builddoc-html: $(HTML_TARGETS)
clean-doc-html:
install-doc-html: install-builddoc-html
$(if $(HTML_TARGETS),$(foreach i,$(HTML_TARGETS),$(call INSTALL_DIR,$(i),$(DOCHTML));))
uninstall-doc-html: clean-doc-html
-$(if $(HTML_TARGETS),$(RM) -r $(foreach i,$(HTML_TARGETS),$(DOCHTML)/$(call TARGET_HTML,$(i))))
# Build MAN files
MAN_SECTION=man$(patsubst .%,%,$(suffix $(1)))
MAN_BUILD_TARGETS=$(BUILDMAN)/$(call MAN_SECTION,$(1))/$(1)
MAN_INSTALL_TARGETS=$(MANDIR)/$(call MAN_SECTION,$(1))/$(1)
define PROCESS_MAN
$(XMLLINT) $(XMLLINTFLAGS) $^
$(XSLTPROC) $(XSLTPROCFLAGS) $(MANXSL) $^
$(INSTALL) -d $(dir $(call MAN_BUILD_TARGETS,$@))
$(INSTALL_DATA) $@ $(call MAN_BUILD_TARGETS,$@)
endef
%.1:
$(PROCESS_MAN)
%.2:
$(PROCESS_MAN)
%.3:
$(PROCESS_MAN)
%.4:
$(PROCESS_MAN)
%.5:
$(PROCESS_MAN)
%.6:
$(PROCESS_MAN)
%.7:
$(PROCESS_MAN)
%.8:
$(PROCESS_MAN)
%.9:
$(PROCESS_MAN)
install-builddoc-man: $(MAN_TARGETS)
clean-doc-man:
install-doc-man: install-builddoc-man
$(if $(MAN_TARGETS),$(foreach i,$(MAN_TARGETS),$(INSTALL) -d $(dir $(call MAN_INSTALL_TARGETS,$(i)));))
$(if $(MAN_TARGETS),$(foreach i,$(MAN_TARGETS),$(INSTALL_DATA) $(call MAN_BUILD_TARGETS,$(i)) $(call MAN_INSTALL_TARGETS,$(i));))
uninstall-doc-man: clean-doc-man
-$(if $(MAN_TARGETS),$(RM) $(foreach i,$(MAN_TARGETS),$(call MAN_INSTALL_TARGETS,$(i))))
# Extra files
.SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .zog .idl .h .o
%.ml %.mli %.h %_stubs.c: %.idl
$(CAMLIDL) -nocpp -no-include $<
.c.o:
$(OCAMLC) $(INCLUDES) -c $<
.mli.cmi:
$(OCAMLC) $(INCLUDES) $(CLI_OCAMLFIND) -c $<
.ml.cmo:
$(OCAMLC) $(INCLUDES) $(CLI_OCAMLFIND) -c $<
.ml.o:
$(OCAMLOPT) $(INCLUDES) $(CLI_OCAMLFIND) -c $<
.ml.cmx:
$(OCAMLOPT) $(INCLUDES) $(CLI_OCAMLFIND) -c $<
.mll.ml:
$(OCAMLLEX) $<
.mly.ml:
$(OCAMLYACC) -v $<
.mly.mli:
$(OCAMLYACC) -v $<
#.ml.mli:
# $(OCAMLC) $(INCLUDES) $(CLI_OCAMLFIND) -i $< > $@ || $(RM) $@
# # Set date of the target to the date of the source
# touch -r $< $@
clean:: $(if $(LIBRARY),clean-lib,clean-prog)
-$(RM) *.cm[ioxa] *.o *.cmxa *.a *.so
-$(RM) $(GENERATED) *.output
distclean:: clean
##########################################################################
# ocaml-gettext: a library to translate messages #
# #
# Copyright (C) 2003-2008 Sylvain Le Gall <sylvain@le-gall.net> #
# #
# This library is free software; you can redistribute it and/or #
# modify it under the terms of the GNU Lesser General Public #
# License as published by the Free Software Foundation; either #
# version 2.1 of the License, or (at your option) any later version; #
# with the OCaml static compilation exception. #
# #
# This library is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
# Lesser General Public License for more details. #
# #
# You should have received a copy of the GNU Lesser General Public #
# License along with this library; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 #
# USA #
##########################################################################
# AC_PROG_OCAML_VERSION(prog,prog.opt,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Check for the existence of an ocaml tool and parse its version
# Version in $versionval, tool in $toolval
AC_DEFUN([AC_PROG_OCAML_VERSION],
[
AC_CHECK_PROG(ac_ocaml_$1,$1,$1)
AC_CHECK_PROG(ac_ocaml_$1_opt,$2,$2)
if test "x$ac_ocaml_$1" = "x" && test "x$ac_ocaml_$1_opt" = "x"; then
:
$4
else
if ! test "x$ac_ocaml_$1" = "x"; then
ac_ocaml_$1_version=`$ac_ocaml_$1 -v | sed -n -e "s|.*version *\(.*\)$|\1|p" `
versionval=$ac_ocaml_$1_version
toolval=$ac_ocaml_$1
fi
if ! test "x$ac_ocaml_$1_opt" = "x"; then
ac_ocaml_$1_opt_version=`$ac_ocaml_$1 -v | sed -n -e "s|.*version *\(.*\)$|\1|p" `
if ! test "x$ac_ocaml_$1" = "x" && test "$ac_ocaml_$1_opt_version" = "$ac_ocaml_$1_version"; then
versionval=$ac_ocaml_$1_opt_version
toolval=$ac_ocaml_$1_opt
elif test "x$ac_ocaml_$1" = "x"; then
versionval=$ac_ocaml_$1_opt_version
toolval=$ac_ocaml_$1_opt
else
AC_MSG_WARN("$1 and $2 version differs")
fi
fi
$3
fi
])
# AC_CHECK_OCAMLC([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Check for the existence of ocamlc (or ocamlc.opt)
# Subst OCAMLC, OCAMLVERSION, OCAMLBEST variable.
AC_DEFUN([AC_CHECK_OCAMLC],
[
dnl Check the presence of ocamlc/ocamlc.opt and their version
AC_PROG_OCAML_VERSION(ocamlc,ocamlc.opt,[
OCAMLC=$toolval
if test "x$OCAMLBEST" = "x"; then
OCAMLBEST=byte
fi
if ! test "x$OCAMLVERSION" = "x" && ! test "$versionval" = "$OCAMLVERSION"; then
AC_MSG_WARN($versionval doesn't match ocaml v. $OCAMLVERSION)
else
CAMLVERSION=$versionval
fi
],[$2])
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLBEST)
])
# AC_CHECK_OCAMLOPT([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Check for the existence of ocamlopt (or ocamlopt.opt)
# Subst OCAMLOPT, OCAMLVERSION, OCAMLBEST variable.
AC_DEFUN([AC_CHECK_OCAMLOPT],
[
dnl Check the presence of ocamlc/ocamlc.opt and their version
AC_PROG_OCAML_VERSION(ocamlopt,ocamlopt.opt,[
OCAMLOPT=$toolval
if test "x$OCAMLBEST" = "x" || test "$OCAMLBEST" = "byte"; then
OCAMLBEST=opt
fi
if ! test "x$OCAMLVERSION" = "x" && ! test "$versionval" = "$OCAMLVERSION"; then
AC_MSG_WARN($versionval doesn't match ocaml v. $OCAMLVERSION)
else
OCAMLVERSION=$versionval
fi
],[$2])
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLBEST)
])
# AC_CHECK_OCAMLLEX([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Check for the existence of ocamllex (or ocamllex.opt)
# Subst OCAMLLEX, OCAMLVERSION variable.
AC_DEFUN([AC_CHECK_OCAMLLEX],
[
dnl Check the presence of ocamlc/ocamlc.opt and their version
AC_PROG_OCAML_VERSION(ocamllex,ocamllex.opt,[
OCAMLLEX=$toolval
if ! test "x$OCAMLVERSION" = "x" && ! test "$versionval" = "$OCAMLVERSION"; then
AC_MSG_WARN($versionval doesn't match ocaml v. $OCAMLVERSION)
else
OCAMLVERSION=$versionval
fi
],[$2])
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLVERSION)
])
# AC_CHECK_OCAMLYACC([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Check for the existence of ocamlyacc (or ocamlyacc.opt)
# Subst OCAMLYACC variable.
AC_DEFUN([AC_CHECK_OCAMLYACC],
[
dnl Check the presence of ocamlyacc/ocamlyacc.opt and their version
AC_CHECK_PROG(ac_ocaml_ocamlyacc,ocamlyacc,ocamlyacc)
AC_CHECK_PROG(ac_ocaml_ocamlyacc_opt,ocamlyacc.opt,ocamlyacc.opt)
if test "x$ac_ocaml_ocamlyacc" = "x" && test "x$ac_ocaml_ocamlyacc_opt" = "x"; then
:
$2
elif ! test "x$ac_ocaml_ocamlyacc_opt" = "x"; then
OCAMLYACC=$ac_ocaml_ocamlyacc_opt
$1
else
OCAMLYACC=$ac_ocaml_ocamlyacc
$1
fi
AC_SUBST(OCAMLYACC)
])
# AC_CHECK_OCAMLBUILD([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Check for the existence of ocamlbuild.
# Subst OCAMLBUIKD variable.
AC_DEFUN([AC_CHECK_OCAMLBUILD],
[
dnl Check the presence of ocamlbuild/ocamlbuild.opt and their version
AC_CHECK_PROG(ac_ocaml_ocamlbuild,ocamlbuild,ocamlbuild)
if test "x$ac_ocaml_ocamlbuild" = "x"; then
:
$2
else
OCAMLBUILD=$ac_ocaml_ocamlbuild
$1
fi
AC_SUBST(OCAMLBUILD)
])
# AC_CHECK_OCAMLFIND ([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Check for the existence of ocamlfind.
# Subst OCAMLFIND variable.
AC_DEFUN([AC_CHECK_OCAMLFIND],
[
dnl Check the presence of ocamlfind
AC_CHECK_PROG(ac_ocaml_ocamlfind,ocamlfind,ocamlfind)
if test "x$ac_ocaml_ocamlfind" = "x"; then
:
$2
else
:
OCAMLFIND=$ac_ocaml_ocamlfind
$1
fi
AC_SUBST(OCAMLFIND)
])
# OCAMLFIND_CHECK_MODULE (MODULE,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Check for the existence of the module using OCAMLFIND
AC_DEFUN([OCAMLFIND_CHECK_MODULE],
[
AC_REQUIRE([AC_CHECK_OCAMLFIND])
dnl Check the presence of module $1
AC_MSG_CHECKING(for module $1)
if ! test "x$OCAMLFIND" = "x" ; then
ac_ocaml_pkg_$1=`$OCAMLFIND query $1 2> /dev/null`
if ! test "x$ac_ocaml_pkg_$1" = "x"; then
AC_MSG_RESULT($ac_ocaml_pkg_$1)
$2
else
AC_MSG_RESULT(no)
$3
fi
else
AC_MSG_RESULT(no)
$3
fi
])
# AC_CHECK_[CAMLP4,CAMLIDL,OCAMLMKLIB,MKCAMLP4] ([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#---------------------------------------------------------
# Subst the corresponding var
AC_DEFUN([AC_CHECK_STAR],
[
AC_CHECK_PROG($1,$2,$2)
if test "x$$1" = "x"; then
:
$4
else
:
$3
fi
AC_SUBST($1)
])
AC_DEFUN([AC_CHECK_CAMLP4], [AC_CHECK_STAR(CAMLP4,camlp4,$1,$2)])
AC_DEFUN([AC_CHECK_CAMLP4OF], [AC_CHECK_STAR(CAMLP4OF,camlp4of,$1,$2)])
AC_DEFUN([AC_CHECK_CAMLP4O], [AC_CHECK_STAR(CAMLP4O,camlp4o,$1,$2)])
AC_DEFUN([AC_CHECK_CAMLIDL], [AC_CHECK_STAR(CAMLIDL,camlidl,$1,$2)])
AC_DEFUN([AC_CHECK_OCAMLMKLIB], [AC_CHECK_STAR(OCAMLMKLIB,ocamlmklib,$1,$2)])
AC_DEFUN([AC_CHECK_MKCAMLP4], [AC_CHECK_STAR(MKCAMLP4,mkcamlp4,$1,$2)])
AC_DEFUN([AC_CHECK_OCAMLDOC], [AC_CHECK_STAR(OCAMLDOC,ocamldoc,$1,$2)])
AC_DEFUN([AC_CHECK_XSLTPROC], [AC_CHECK_STAR(XSLTPROC,xsltproc,$1,$2)])
AC_DEFUN([AC_CHECK_XMLLINT], [AC_CHECK_STAR(XMLLINT,xmllint,$1,$2)])
# AC_LIB_OCAML ()
#---------------------------------------------------------
# Get the library path
# Subst OCAMLLIB
AC_DEFUN([AC_LIB_OCAML],
[
AC_REQUIRE([AC_CHECK_OCAMLC])
AC_MSG_CHECKING(for ocaml libdir)
OCAMLLIB=`$OCAMLC -where`
AC_MSG_RESULT($OCAMLLIB)
AC_SUBST(OCAMLLIB)
])
# AC_CHECK_XSL (VAR,config,DEFAULT_STYLESHEET,[ACTION-IF-OK],[ACTION-IF-NOT-OK])
#---------------------------------------------------------
# Check the presence and the possibility to validate
# and apply the given stylesheet
# Subst XSLTPROC, XMLLINT, DOCBOOK_STYLESHEET_VAR,
AC_DEFUN([AC_CHECK_XSL],
[
AC_REQUIRE([AC_CHECK_XSLTPROC])
AC_REQUIRE([AC_CHECK_XMLLINT])
AC_ARG_WITH(docbook-stylesheet-$2,
AC_HELP_STRING([--with-docbook-stylesheet-$2=file], [Where to find the docbook stylesheet for $2 generation]),
$1=$withval, $1="$3")
AC_MSG_CHECKING(for $2 XSL)
if ! test -e "$$1"; then
AC_MSG_RESULT(no)
$1=
else
AC_MSG_RESULT($$1)
fi
if ! test "x$$1" = "x" && ! test "x$XSLTPROC" = "x"; then
:
$4
else
:
$5
fi
AC_SUBST($1)
])
# AC_CHECK_HTMLXSL (DEFAULT_STYLESHEET,[ACTION-IF-OK],[ACTION-IF-NOT-OK])
#---------------------------------------------------------
# Check the possibility to generate HTML out of Docbook XML
AC_DEFUN([AC_CHECK_HTMLXSL],
[
AC_CHECK_XSL(HTMLXSL,html,$1,$2,$3)
]);
# AC_CHECK_MANXSL (STYLESHEET,DEFAULT_STYLESHEET,[ACTION-IF-OK],[ACTION-IF-NOT-OK])
#---------------------------------------------------------
# Check the possibility to generate manpages out of Docbook XML
AC_DEFUN([AC_CHECK_MANXSL],
[
AC_CHECK_XSL(MANXSL,manpages,$1,$2,$3)
]);
# AC_CHECK_PDFXSL (STYLESHEET,DEFAULT_STYLESHEET,[ACTION-IF-OK],[ACTION-IF-NOT-OK])
#---------------------------------------------------------
# Check the possibility to generate PDF out of Docbook XML
AC_DEFUN([AC_CHECK_PDFXSL],
[
AC_CHECK_XSL(FOXSL,pdf,$1,$2,$3)
AC_CHECK_PROG(FOP,fop,fop)
if test "x$FOP" = "x"; then
AC_MSG_WARN(Cannot find fop.)
$3
fi
]);
platform:
- x86
environment:
FORK_USER: ocaml
FORK_BRANCH: master
CYG_ROOT: C:\cygwin64
PINS: gettext.0.4.0:. gettext-stub.0.4.0:. gettext-camomile.0.4.0:.
OUNIT_CI: true
matrix:
- PACKAGE: gettext
- PACKAGE: gettext-stub
- PACKAGE: gettext-camomile
install:
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/$env:FORK_USER/ocaml-ci-scripts/$env:FORK_BRANCH/appveyor-install.ps1"))
build_script:
- call %CYG_ROOT%\bin\bash.exe -l %APPVEYOR_BUILD_FOLDER%\appveyor-opam.sh
#!/bin/sh
set -e
autoconf
rm -rf autom4te.cache || true
local os = os
local error = error
local lfs = require("lfs")
local package = package
module("bootstrap")
function init ()
local ci_url = os.getenv("CI_URL")
if not ci_url then
ci_url = "http://mini:8080/job/continuous-integration/label=debian-squeeze64/lastSuccessfulBuild/artifact/dist/ci.zip"
end
local bootstrapdir = "build/bootstrap"
if lfs.attributes(bootstrapdir) then
for fn in lfs.dir(bootstrapdir) do
if fn ~= "." and fn ~= ".." then
local realfn = bootstrapdir .. "/" .. fn
if not os.remove(realfn) then
error("Cannot remove " .. realfn)
end
end
end
lfs.rmdir("build/bootstrap")
end
lfs.mkdir("build")
lfs.mkdir("build/bootstrap")
local topdir = lfs.currentdir()
lfs.chdir("build/bootstrap")
if os.execute("curl -o ci.zip " .. ci_url) ~= 0 then
error "Cannot download ci.zip"
end
if os.execute("unzip ci.zip") ~= 0 then
error "Cannot unzip ci.zip"
end
lfs.chdir(topdir)
package.path = "./build/bootstrap/?.lua;" .. package.path
end
bootstrap = require("bootstrap")
bootstrap.init()
oasis = require("oasis")
darcs = require("darcs")
ci = require("ci")
godi = require("godi")
ci.init()
godi.init()
oasis.init()
darcs.init()
godi.bootstrap("3.12")
godi.update()
godi.upgrade()
godi.build("godi-findlib")
godi.build("godi-camomile")
godi.build("godi-ocaml-fileutils")
godi.build("godi-ounit")
ci.exec("autoconf")
ci.exec("./configure", "--disable-doc", "--enable-test")
ci.exec("make", "all")
ci.exec("make", "test")
This diff is collapsed.