Skip to content

Commit

Permalink
Improved build, added opam file, fixed travis build.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Sagot committed Sep 13, 2018
1 parent db05218 commit bfcb114
Show file tree
Hide file tree
Showing 26 changed files with 264 additions and 272 deletions.
11 changes: 2 additions & 9 deletions .travis-ci.sh
@@ -1,12 +1,5 @@
set -uex set -uex

# Install packages dependencies
export OPAMYES=1 export OPAMYES=1
eval $(opam config env) eval $(opam config env)
opam install ocamlfind camlp5 depext opam pin add geneweb . --no-action
opam depext -i lablgtk opam install geneweb

# Build GeneWeb
./configure -cibrew
make everything
make distrib
25 changes: 20 additions & 5 deletions .travis.yml
@@ -1,11 +1,26 @@
language: c
sudo: required sudo: required

language: c

install: install:
- wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-ocaml.sh - wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-ocaml.sh
- wget https://raw.githubusercontent.com/geneweb/geneweb/master/.travis-ci.sh
script: bash -ex .travis-ocaml.sh && bash -ex .travis-ci.sh
env:
- OCAML_VERSION=4.05
os: os:
- linux - linux
- osx - osx

env:
- OCAML_VERSION=4.05
- OCAML_VERSION=4.06
- OCAML_VERSION=4.07

fast_finish: true

script: bash -ex .travis-ocaml.sh && bash -ex .travis-ci.sh

notifications:
email:
recipients:
- julien.sagot@geneanet.org
on_success: always
on_failure: always
216 changes: 94 additions & 122 deletions Makefile
Expand Up @@ -10,16 +10,11 @@ include Makefile.config


# Variables for packagers. # Variables for packagers.
PREFIX=/usr PREFIX=/usr
LANGDIR=$(PREFIX)/share/geneweb DISTRIB_DIR=distribution
MANDIR=$(PREFIX)/man/man1
DESTDIR=distribution
MANPAGES=ged2gwb.1 gwb2ged.1 gwc.1 gwc2.1 gwu.1 gwd.1 consang.1 gwsetup.1


.DEFAULT_GOAL = exe BUILD_DIR=_build/default

BUILD_DIR=_build/default/


# Executables ###### [BEGIN] Executables list


INSTALL_EXE = \ INSTALL_EXE = \
src/gwc1 \ src/gwc1 \
Expand All @@ -33,8 +28,7 @@ INSTALL_EXE = \
gwb2ged/gwb2ged \ gwb2ged/gwb2ged \
setup/setup setup/setup


DISTRIB_EXE = \ DISTRIB_EXE = $(INSTALL_EXE) gwtp/gwtp
$(INSTALL_EXE) \


ALL_EXE = \ ALL_EXE = \
$(INSTALL_EXE) \ $(INSTALL_EXE) \
Expand Down Expand Up @@ -88,6 +82,10 @@ EVERYTHING_EXE = \
src/check_base \ src/check_base \
src/i18n_check src/i18n_check


###### [END] Executables list

###### [BEGIN] Generated .ml files section

CAMLP5_PA_EXTEND_FILES = \ CAMLP5_PA_EXTEND_FILES = \
ged2gwb/ged2gwb \ ged2gwb/ged2gwb \
ged2gwb/ged2gwb2 \ ged2gwb/ged2gwb2 \
Expand Down Expand Up @@ -115,142 +113,116 @@ $(CAMLP5_Q_MLAST_FILES:=.ml): CAMLP5_OPT += q_MLast.cmo
&& echo "(* DO NOT EDIT *)" > $@ \ && echo "(* DO NOT EDIT *)" > $@ \
&& echo "(* This file was generated from $< *)" >> $@ \ && echo "(* This file was generated from $< *)" >> $@ \
&& camlp5o pr_o.cmo $(CAMLP5_OPT) -impl $< >> $@ \ && camlp5o pr_o.cmo $(CAMLP5_OPT) -impl $< >> $@ \
&& sed -i -r 's/[(]\* (\[@.+\]) \*[)]/\1/g' $@ \ && sed -i.bak -E 's/[(]\* (\[@.+\]) \*[)]/\1/g' $@ \
&& echo " Done!") && echo " Done!")


%.bc %.exe: internal/gwlib.ml:
dune build $@ echo "let prefix =" > $@
echo " try Sys.getenv \"GWPREFIX\"" >> $@
echo " with Not_found -> \"$(PREFIX)\"" | sed -e 's|\\|/|g' >> $@


GENERATED_FILES_DEP = internal/gwlib.ml $(CAMLP5_FILES:=.ml) GENERATED_FILES_DEP = internal/gwlib.ml $(CAMLP5_FILES:=.ml)


###### [End] Generated .ml files section

geneweb.install: $(GENERATED_FILES_DEP) geneweb.install: $(GENERATED_FILES_DEP)
dune build @install dune build @install

.PHONY: geneweb.install .PHONY: geneweb.install


install-exe: $(GENERATED_FILES_DEP) $(INSTALL_EXE:=.exe) install-exe:
install-bc: $(GENERATED_FILES_DEP) $(INSTALL_EXE:=.bc) dune build $(INSTALL_EXE:=.exe)

distrib-exe:
exe: install-exe $(ALL_EXE:=.exe) dune build $(DISTRIB_EXE:=.exe)
bc: install-bc $(ALL_EXE:=.bc) exe:

dune build $(ALL_EXE:=.exe)
everything-bc: bc $(EVERYTHING_EXE:=.bc) everything-exe:
everything-exe: exe $(EVERYTHING_EXE:=.exe) dune build $(EVERYTHING_EXE:=.exe)

.DEFAULT_GOAL = exe
clean:
$(RM) $(GENERATED_FILES_DEP)
$(RM)r distribution
dune clean


internal/gwlib.ml: install-exe distrib-exe exe everything-exe: $(GENERATED_FILES_DEP)
echo "let prefix =" > $@
echo " try Sys.getenv \"GWPREFIX\"" >> $@
echo " with Not_found -> \"$(PREFIX)\"" | sed -e 's|\\|/|g' >> $@


.PHONY: piqi
piqi: piqi:
$(foreach p, $(wildcard lib/*.proto), \ $(foreach p, $(wildcard lib/*.proto), \
piqi of-proto --normalize $(p) ; \ piqi of-proto --normalize $(p) ; \
piqic-ocaml -C lib/ --ext $(p).piqi ; \ piqic-ocaml -C lib/ --ext $(p).piqi ; \
) )
$(RM) lib/*.piqi $(RM) lib/*.piqi
.PHONY: piqi


.PHONY: install uninstall distrib install-lib uninstall-lib ###### [BEGIN] Installation / Distribution section


install-lib: geneweb.install $(GENERATED_FILES_DEP) install: geneweb.install
dune install geneweb dune install geneweb


uninstall-lib: geneweb.install uninstall: geneweb.install
dune uninstall geneweb dune uninstall geneweb


install: install-exe distrib: distrib-exe
PWD=`pwd` $(RM) -r $(DISTRIB_DIR)
if test "$(OS_TYPE)" = "Darwin"; then \ mkdir $(DISTRIB_DIR)
etc/macOS/install.command $(PWD) $(DESTDIR) etc/macOS; \ mkdir -p $(DISTRIB_DIR)/bases
elif test "$(OS_TYPE)" = "Win"; then \ cp CHANGES $(DISTRIB_DIR)/CHANGES.txt
echo "No install for Window"; \ cp LICENSE $(DISTRIB_DIR)/LICENSE.txt
else \ cp etc/README.txt $(DISTRIB_DIR)/.
mkdir -p $(PREFIX)/bin; \ cp etc/LISEZMOI.txt $(DISTRIB_DIR)/.
cp $(BUILD_DIR)/src/gwc1.exe $(PREFIX)/bin/gwc$(EXE); \ cp etc/START.htm $(DISTRIB_DIR)/.
cp $(BUILD_DIR)/src/gwc1.exe $(PREFIX)/bin/gwc1$(EXE); \
cp $(BUILD_DIR)/src/gwc2.exe $(PREFIX)/bin/gwc2$(EXE); \
cp $(BUILD_DIR)/src/mk_consang.exe $(PREFIX)/bin/mk_consang$(EXE); \
cp $(BUILD_DIR)/src/mk_consang.exe $(PREFIX)/bin/consang$(EXE); \
cp $(BUILD_DIR)/src/gwd.exe $(PREFIX)/bin/gwd$(EXE); \
cp $(BUILD_DIR)/src/gwu.exe $(PREFIX)/bin/gwu$(EXE); \
cp $(BUILD_DIR)/ged2gwb/ged2gwb.exe $(PREFIX)/bin/ged2gwb$(EXE); \
cp $(BUILD_DIR)/ged2gwb/ged2gwb2.exe $(PREFIX)/bin/ged2gwb2$(EXE); \
cp $(BUILD_DIR)/gwb2ged/gwb2ged.exe $(PREFIX)/bin/gwb2ged$(EXE); \
cp $(BUILD_DIR)/setup/setup.exe $(PREFIX)/bin/gwsetup$(EXE); \
cp $(BUILD_DIR)/src/update_nldb.exe $(PREFIX)/bin/update_nldb$(EXE); \
mkdir -p $(LANGDIR); \
cp -R hd/* $(LANGDIR)/.; \
mkdir -p $(MANDIR); \
cd man; cp $(MANPAGES) $(MANDIR)/.; \
fi

uninstall:
$(RM) $(addprefix $(PREFIX)/bin/,$(INSTALL_EXE))
$(RM) -r $(PREFIX)/share/geneweb
cd $(MANDIR); $(RM) $(MANPAGES)

distribution: distrib
distrib: install-exe gwtp/gwtp.exe
$(RM) -r $(DESTDIR)
mkdir $(DESTDIR)
mkdir -p $(DESTDIR)/bases
cp CHANGES $(DESTDIR)/CHANGES.txt
cp LICENSE $(DESTDIR)/LICENSE.txt
cp etc/README.txt $(DESTDIR)/.
cp etc/LISEZMOI.txt $(DESTDIR)/.
cp etc/START.htm $(DESTDIR)/.
if test $(OS_TYPE) = "Win"; then \ if test $(OS_TYPE) = "Win"; then \
cp etc/Windows/gwd.bat $(DESTDIR); \ cp etc/Windows/gwd.bat $(DISTRIB_DIR); \
cp etc/Windows/gwsetup.bat $(DESTDIR); \ cp etc/Windows/gwsetup.bat $(DISTRIB_DIR); \
cp -f etc/Windows/README.txt $(DESTDIR)/README.txt; \ cp -f etc/Windows/README.txt $(DISTRIB_DIR)/README.txt; \
cp -f etc/Windows/LISEZMOI.txt $(DESTDIR)/LISEZMOI.txt; \ cp -f etc/Windows/LISEZMOI.txt $(DISTRIB_DIR)/LISEZMOI.txt; \
elif test $(OS_TYPE) = "Darwin"; then \ elif test $(OS_TYPE) = "Darwin"; then \
cp etc/gwd $(DESTDIR)/gwd.command; \ cp etc/gwd $(DISTRIB_DIR)/gwd.command; \
cp etc/gwsetup $(DESTDIR)/gwsetup.command; \ cp etc/gwsetup $(DISTRIB_DIR)/gwsetup.command; \
cp etc/macOS/geneweb.command $(DESTDIR); \ cp etc/macOS/geneweb.command $(DISTRIB_DIR); \
else \ else \
cp etc/gwd $(DESTDIR); \ cp etc/gwd $(DISTRIB_DIR); \
cp etc/gwsetup $(DESTDIR); \ cp etc/gwsetup $(DISTRIB_DIR); \
fi fi
mkdir $(DESTDIR)/gw mkdir $(DISTRIB_DIR)/gw
cp etc/a.gwf $(DESTDIR)/gw/. cp etc/a.gwf $(DISTRIB_DIR)/gw/.
echo "127.0.0.1" > $(DESTDIR)/gw/only.txt echo "127.0.0.1" > $(DISTRIB_DIR)/gw/only.txt
echo "-setup_link" > $(DESTDIR)/gw/gwd.arg echo "-setup_link" > $(DISTRIB_DIR)/gw/gwd.arg
cp $(BUILD_DIR)/src/gwc1.exe $(DESTDIR)/gw/gwc$(EXE) cp $(BUILD_DIR)/src/gwc1.exe $(DISTRIB_DIR)/gw/gwc$(EXE); \
cp $(BUILD_DIR)/src/gwc1.exe $(DESTDIR)/gw/gwc1$(EXE) cp $(BUILD_DIR)/src/gwc1.exe $(DISTRIB_DIR)/gw/gwc1$(EXE); \
cp $(BUILD_DIR)/src/gwc2.exe $(DESTDIR)/gw/gwc2$(EXE) cp $(BUILD_DIR)/src/gwc2.exe $(DISTRIB_DIR)/gw/gwc2$(EXE); \
cp $(BUILD_DIR)/src/mk_consang.exe $(DESTDIR)/gw/mk_consang$(EXE) cp $(BUILD_DIR)/src/mk_consang.exe $(DISTRIB_DIR)/gw/mk_consang$(EXE); \
cp $(BUILD_DIR)/src/mk_consang.exe $(DESTDIR)/gw/consang$(EXE) cp $(BUILD_DIR)/src/mk_consang.exe $(DISTRIB_DIR)/gw/consang$(EXE); \
cp $(BUILD_DIR)/src/gwd.exe $(DESTDIR)/gw/gwd$(EXE) cp $(BUILD_DIR)/src/gwd.exe $(DISTRIB_DIR)/gw/gwd$(EXE); \
cp $(BUILD_DIR)/src/gwu.exe $(DESTDIR)/gw/gwu$(EXE) cp $(BUILD_DIR)/src/gwu.exe $(DISTRIB_DIR)/gw/gwu$(EXE); \
cp $(BUILD_DIR)/src/update_nldb.exe $(DESTDIR)/gw/update_nldb$(EXE) cp $(BUILD_DIR)/ged2gwb/ged2gwb.exe $(DISTRIB_DIR)/gw/ged2gwb$(EXE); \
cp $(BUILD_DIR)/ged2gwb/ged2gwb.exe $(DESTDIR)/gw/ged2gwb$(EXE) cp $(BUILD_DIR)/ged2gwb/ged2gwb2.exe $(DISTRIB_DIR)/gw/ged2gwb2$(EXE); \
cp $(BUILD_DIR)/ged2gwb/ged2gwb2.exe $(DESTDIR)/gw/ged2gwb2$(EXE) cp $(BUILD_DIR)/gwb2ged/gwb2ged.exe $(DISTRIB_DIR)/gw/gwb2ged$(EXE); \
cp $(BUILD_DIR)/gwb2ged/gwb2ged.exe $(DESTDIR)/gw/gwb2ged$(EXE) cp $(BUILD_DIR)/contrib/gwbase/etc/connex.out $(DISTRIB_DIR)/gw/connex$(EXE); \
cp $(BUILD_DIR)/contrib/gwbase/etc/connex.out $(DESTDIR)/gw/connex$(EXE) cp $(BUILD_DIR)/contrib/gwdiff/gwdiff.out $(DISTRIB_DIR)/gw/gwdiff$(EXE); \
cp $(BUILD_DIR)/contrib/gwdiff/gwdiff.out $(DESTDIR)/gw/gwdiff$(EXE) cp $(BUILD_DIR)/setup/setup.exe $(DISTRIB_DIR)/gw/gwsetup$(EXE); \
cp $(BUILD_DIR)/setup/setup.exe $(DESTDIR)/gw/gwsetup$(EXE) cp $(BUILD_DIR)/src/update_nldb.exe $(DISTRIB_DIR)/gw/update_nldb$(EXE); \
mkdir $(DESTDIR)/gw/gwtp_tmp mkdir $(DISTRIB_DIR)/gw/gwtp_tmp
mkdir $(DESTDIR)/gw/gwtp_tmp/lang mkdir $(DISTRIB_DIR)/gw/gwtp_tmp/lang
cp gwtp/README $(DESTDIR)/gw/gwtp_tmp/. cp gwtp/README $(DISTRIB_DIR)/gw/gwtp_tmp/.
cp $(BUILD_DIR)/gwtp/gwtp.exe $(DESTDIR)/gw/gwtp_tmp/gwtp$(EXE) cp $(BUILD_DIR)/gwtp/gwtp.exe $(DISTRIB_DIR)/gw/gwtp_tmp/gwtp$(EXE)
cp gwtp/lang/*.txt $(DESTDIR)/gw/gwtp_tmp/lang/. cp gwtp/lang/*.txt $(DISTRIB_DIR)/gw/gwtp_tmp/lang/.
mkdir $(DESTDIR)/gw/setup mkdir $(DISTRIB_DIR)/gw/setup
cp setup/intro.txt $(DESTDIR)/gw/setup/. cp setup/intro.txt $(DISTRIB_DIR)/gw/setup/
mkdir $(DESTDIR)/gw/setup/lang mkdir $(DISTRIB_DIR)/gw/setup/lang
cp setup/setup.gwf $(DESTDIR)/gw/setup/. cp setup/setup.gwf $(DISTRIB_DIR)/gw/setup/
cp setup/setup.css $(DESTDIR)/gw/setup/. cp setup/setup.css $(DISTRIB_DIR)/gw/setup/
cp setup/lang/*.htm $(DESTDIR)/gw/setup/lang/. cp setup/lang/*.htm $(DISTRIB_DIR)/gw/setup/lang/
cp setup/lang/lexicon.txt $(DESTDIR)/gw/setup/lang/. cp setup/lang/lexicon.txt $(DISTRIB_DIR)/gw/setup/lang/
cp setup/lang/intro.txt $(DESTDIR)/gw/setup/lang/. cp setup/lang/intro.txt $(DESTDIR)/gw/setup/lang/
cp -R hd/* $(DESTDIR)/gw/. cp -R hd/* $(DISTRIB_DIR)/gw/
rm -f $(DESTDIR)/exe-version.txt $(RM) $(DISTRIB_DIR)/exe-version.txt
echo "Commit: `git log -1 | grep commit | cut -c8-15`, `date`" > $(DESTDIR)/commit.txt echo "Commit: `git log -1 | grep commit | cut -c8-15`, `date`" > $(DISTRIB_DIR)/commit.txt
echo "`ocaml -version`" >> $(DESTDIR)/commit.txt echo "`ocaml -version`" >> $(DISTRIB_DIR)/commit.txt
echo "`camlp5 -v 2>&1`" >> $(DESTDIR)/commit.txt echo "`camlp5 -v 2>&1`" >> $(DISTRIB_DIR)/commit.txt
echo "-----" >> $(DESTDIR)/commit.txt echo "-----" >> $(DISTRIB_DIR)/commit.txt

.PHONY: install uninstall distrib

###### [END] Installation / Distribution section

clean:
$(RM) $(GENERATED_FILES_DEP)
$(RM)r distribution
dune clean
.PHONY: clean
9 changes: 7 additions & 2 deletions configure
Expand Up @@ -33,8 +33,13 @@ print_check_ok() {


check_os() { check_os() {
OS_TYPE=`uname -s` OS_TYPE=`uname -s`
if [[ $OS_TYPE == "Darwin" ]] || [[ $OS_TYPE == "Linux" ]] ; then if [[ $OS_TYPE == "Linux" ]] ; then
print_check_ok "Checking OS type" "UNIX" print_check_ok "Checking OS type" "Linux"
EXE=
RM="/bin/rm -f"
STRIP=strip
elif [[ $OS_TYPE == "Darwin" ]] ; then
print_check_ok "Checking OS type" "Darwin"
EXE= EXE=
RM="/bin/rm -f" RM="/bin/rm -f"
STRIP=strip STRIP=strip
Expand Down
21 changes: 10 additions & 11 deletions contrib/gwFix/dune
@@ -1,13 +1,12 @@
(executables (executables
((names (gwFixBase (names gwFixBase
gwFixFromFile gwFixFromFile
gwFixFromFileDomicile gwFixFromFileDomicile
gwFixFromFileAlias gwFixFromFileAlias
gwFixBurial gwFixBurial
gwFixEvtSrc gwFixEvtSrc
gwFixColon gwFixColon
gwFindCpl gwFindCpl
gwFixY)) gwFixY)
(libraries (str geneweb.internal)) (libraries str geneweb.internal)
)
) )
5 changes: 2 additions & 3 deletions contrib/gwbase/etc/dune
@@ -1,7 +1,6 @@
; TOFIX_EXE := cleopatre popule modif ; TOFIX_EXE := cleopatre popule modif


(executables (executables
((names (public public2 geneanet clavier connex hist selroy chkimg consmoy lune titres gwck nbdesc probot)) (names public public2 geneanet clavier connex hist selroy chkimg consmoy lune titres gwck nbdesc probot)
(libraries (geneweb.internal)) (libraries geneweb.internal)
)
) )
5 changes: 2 additions & 3 deletions contrib/gwdiff/dune
@@ -1,5 +1,4 @@
(executable (executable
((name gwdiff) (name gwdiff)
(libraries (str geneweb.internal)) (libraries str geneweb.internal)
)
) )
5 changes: 2 additions & 3 deletions contrib/gwpublic/dune
@@ -1,5 +1,4 @@
(executables (executables
((names (gwpublic1 gwpublic2 gwpublic2priv gwprivate gwiftitles)) (names gwpublic1 gwpublic2 gwpublic2priv gwprivate gwiftitles)
(libraries (geneweb.internal)) (libraries geneweb.internal)
)
) )
5 changes: 2 additions & 3 deletions contrib/history/dune
@@ -1,5 +1,4 @@
(executables (executables
((names (convert_hist fix_hist is_gw_plus)) (names convert_hist fix_hist is_gw_plus)
(libraries (geneweb.internal)) (libraries geneweb.internal)
)
) )
5 changes: 2 additions & 3 deletions contrib/lex/dune
@@ -1,6 +1,5 @@
(executable (executable
((name lex_utils) (name lex_utils)
(libraries (str)) (libraries str)
)
) )


0 comments on commit bfcb114

Please sign in to comment.