Commit dbd02d9d authored by bguillaum's avatar bguillaum

Fix dependency to lablwebkit, fix sed syntax for linux

git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/semagramme/dep2pict/trunk@8339 7838e531-6607-4d57-9587-6c381814729c
parent 8ddfbce9
VERSION = 2.16.1
VERSION = 2.16.2
INSTALL_DIR = @prefix@@bindir@
DATA_DIR = @prefix@@datarootdir@/dep2pict/
......@@ -26,6 +26,10 @@ CAIRO_DIR = @CAIRO_INCLUDE@
CAIRO_BYTE = $(CAIRO_DIR) cairo2.cma
CAIRO_OPT = $(CAIRO_DIR) cairo2.cmxa
LABLWEBKIT_DIR = @LABLWEBKIT_INCLUDE@
LABLWEBKIT_BYTE = $(LABLWEBKIT_DIR) lablwebkit.cma
LABLWEBKIT_OPT = $(LABLWEBKIT_DIR) lablwebkit.cmxa
LABLGTK_DIR = @LABLGTK_INCLUDE@
LABLGTK_BYTE = $(LABLGTK_DIR) lablgtk.cma lablglade.cma lablrsvg.cma
LABLGTK_OPT = $(LABLGTK_DIR) lablgtk.cmxa lablglade.cmxa lablrsvg.cmxa
......
......@@ -107,6 +107,9 @@ if test "$config" = yes ; then
AC_LIB_CHECKING(Lablgtk2,lablgtk2,lablgtk2,lablgtk,GMain,"",false,true)
AC_SUBST(LABLGTK_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Lablwebkit,lablwebkit,lablwebkit,lablwebkit,GWebView,"$LABLGTK_INCLUDE lablgtk.cma",false,true)
AC_SUBST(LABLWEBKIT_INCLUDE,$LIB_INCLUDE)
if test "$LABLGTK_INCLUDE" = no ;
then AC_SUBST(BUILD_GUI,no)
else
......
......@@ -593,6 +593,7 @@ INFO
MESSAGE
WARNING
DEBUG
LABLWEBKIT_INCLUDE
LABLGTK_INCLUDE
BUILD_GUI
XMLLIGHT_INCLUDE
......@@ -2001,7 +2002,6 @@ $as_echo "$as_me: WARNING: Cannot find ocamlfind" >&2;}
fi
################################################################################
# AC_LIB_CHECKING
# permet le test de la présence d'une librairie Ocaml dans le repertoire
......@@ -2019,7 +2019,6 @@ $as_echo "$as_me: WARNING: Cannot find ocamlfind" >&2;}
################################################################################
MACRO="A"
MACRO=$MACRO"C_LIB_CHECKING"
......@@ -2822,6 +2821,139 @@ $as_echo "The $NAME library is missing." >&6; }
LABLGTK_INCLUDE=$LIB_INCLUDE
MACRO="A"
MACRO=$MACRO"C_LIB_CHECKING"
NAME=Lablwebkit
STD_FOLDER=lablwebkit
OFIND_NAME=lablwebkit
LIB_FILE=lablwebkit
MOD=GWebView
OPTIONS="$LABLGTK_INCLUDE lablgtk.cma"
NO_OPTIONAL=false
FULL_PATH=true
OCAMLLIB_DIR=`ocamlc -where`
# test au cas ou un argument obligatoire est manquant
if test "$NAME" = "" || test "$STD_FOLDER" = "" || test "$OFIND_NAME" = "" || test "$LIB_FILE" = "" || test "$MOD" = "" ; then
echo ""
echo "Can't check a library"
echo "Missing argument in $MACRO($NAME,$STD_FOLDER,$OFIND_NAME,$LIB_FILE,$MOD,$OPTIONS,$NO_OPTIONAL)"
echo ""
exit 1
fi
# affichage du nom de la librairie a checker (avec details sur l'optionalité)
if test "$NO_OPTIONAL" = true; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for requested library : $NAME" >&5
$as_echo_n "checking for requested library : $NAME... " >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for optional library : $NAME" >&5
$as_echo_n "checking for optional library : $NAME... " >&6; }
fi
# si le fichier ml de test existe
if test -f c_check_$STD_FOLDER.ml ; then
# si on peut le supprimer
if test -w c_check_$STD_FOLDER.ml ; then
# on le supprimer
rm c_check_$STD_FOLDER.ml >& /dev/null
# sinon on arrete et on balance un message d'erreur (ie on a pas les droits sur le fichier
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Cannot remove c_check_lablwebkit.ml. Please change its right with chmod 666 c_check_lablwebkit.ml
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
# on prepare le fichier ml de test
echo "open $MOD;;" > c_check_$STD_FOLDER.ml
# si on arrive à l'executer avec la librairie dans le rep de lib de caml
if (ocamlc -c $OPTIONS c_check_$STD_FOLDER.ml >& /dev/null) ; then
# pas besoin d'include
LIB_INCLUDE=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Found in ocaml lib directory" >&5
$as_echo "Found in ocaml lib directory" >&6; }
# sinon on essaie avec un repertoire dedié à la lib (-I +xxx yyy.cma)
elif (ocamlc -c $OPTIONS -I +$STD_FOLDER $LIB_FILE.cma c_check_$STD_FOLDER.ml >& /dev/null) ; then
# si ca marche, on s'arrete et on precise le include
if test "$FULL_PATH" = "true" ; then
LIB_INCLUDE="-I $OCAMLLIB_DIR/$STD_FOLDER"
else
LIB_INCLUDE="-I +$STD_FOLDER"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Found in $STD_FOLDER directory => $LIB_INCLUDE" >&5
$as_echo "Found in $STD_FOLDER directory => $LIB_INCLUDE" >&6; }
# sinon, on essaie avec ocamlfind
else
# si on n'a pas ocamlfind , on s'arrete (dans le cas d'une lib oblig.) ou
# on lance un warning (dans le cas d'une lib optionelle)
if test "ocamlfind" = no ; then
if test "$NO_OPTIONAL" = "true"; then
as_fn_error $? "The $NAME library is missing." "$LINENO" 5
LIB_INCLUDE="no"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: The $NAME library is missing." >&5
$as_echo "The $NAME library is missing." >&6; }
LIB_INCLUDE="no"
fi
# sinon, ocamlfind est présent
else
# on regarde déjà si la lib est installée avec ocamlfind
if ocamlfind query $OFIND_NAME > /dev/null 2>&1 ; then
# si c'est le cas, on recupere le repertoire d'installation et le include correspondant
LIB_INCLUDE=`ocamlfind query $OFIND_NAME`
LIB_INCLUDE="-I $LIB_INCLUDE"
# on teste maintenant si on peut exectuer le fichier ml de test
if (ocamlc -c $OPTIONS $LIB_INCLUDE $LIB_FILE.cma c_check_$STD_FOLDER.ml >& /dev/null) ; then
# on y arrive, on dit qu'on a trouvé la lib avec ocamlfind
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Found with ocamlfind => $LIB_INCLUDE" >&5
$as_echo "Found with ocamlfind => $LIB_INCLUDE" >&6; }
# si on y arrive pas
else
# suivant l'optionalité de la lib: un warning ou une erreur
if test "$NO_OPTIONAL" = "true"; then
as_fn_error $? "The $NAME library is missing." "$LINENO" 5
LIB_INCLUDE="no"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: The $NAME library is missing." >&5
$as_echo "The $NAME library is missing." >&6; }
LIB_INCLUDE="no"
fi
fi
# si la lib n'est pas installée avec ocamlfind
else
# suivant l'optionalité de la lib: un warning ou une erreur
if test "$NO_OPTIONAL" = "true"; then
as_fn_error $? "The $NAME library is missing." "$LINENO" 5
LIB_INCLUDE="no"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: The $NAME library is missing." >&5
$as_echo "The $NAME library is missing." >&6; }
LIB_INCLUDE="no"
fi
fi
fi
fi
# suppression du fichier ml de test
rm c_check_$STD_FOLDER.ml >& /dev/null
rm c_check_$STD_FOLDER.cmo >& /dev/null
rm c_check_$STD_FOLDER.cmi >& /dev/null
LABLWEBKIT_INCLUDE=$LIB_INCLUDE
if test "$LABLGTK_INCLUDE" = no ;
then BUILD_GUI=no
......
......@@ -10,7 +10,7 @@ dep2pict_glade.ml : dep2pict.glade
@echo " ----> build file 'dep2pict_glade.ml' from 'dep2pict.glade'"
lablgladecc2 dep2pict.glade > dep2pict_glade.ml
@echo " ----> set absolute file location in 'dep2pict_glade.ml' (DATA_DIR = $(DATA_DIR))"
sed -i back 's|dep2pict.glade|$(DATA_DIR)dep2pict.glade|g' dep2pict_glade.ml
sed -iback 's|dep2pict.glade|$(DATA_DIR)dep2pict.glade|g' dep2pict_glade.ml
rm -f dep2pict_glade.mlback
# dep2pict_glade.ml : dep2pict.glade
......@@ -23,9 +23,9 @@ dep2pict_glade.ml : dep2pict.glade
dep2pict_glade.cmx : dep2pict_glade.ml
$(OCAMLOPT) -c $(LABLGTK_OPT) $(CAIRO_OPT) dep2pict_glade.ml
$(OCAMLOPT) -c $(LABLGTK_OPT) $(LABLWEBKIT_OPT) $(CAIRO_OPT) dep2pict_glade.ml
DEP_OPT= unix.cmxa str.cmxa bigarray.cmxa $(LABLGTK_OPT) $(CAIRO_OPT) $(XML_LIGHT_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(DEP2PICT_OPT)
DEP_OPT= unix.cmxa str.cmxa bigarray.cmxa $(LABLGTK_OPT) $(LABLWEBKIT_OPT) $(CAIRO_OPT) $(XML_LIGHT_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(DEP2PICT_OPT)
DEP_OPT_NOGUI= unix.cmxa str.cmxa bigarray.cmxa $(CAIRO_OPT) $(XML_LIGHT_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(DEP2PICT_OPT)
global.cmx : global.ml
......
......@@ -13,12 +13,12 @@ END
let version = VERSION
let _ =
let _ =
Log.set_active_levels [`INFO];
Log.set_info_label "DEP2PICT";
Log.set_critical_label "DEP2PICT";
Log.set_write_to_log_file false;
Log.set_info_foreground Log.f_green;
Log.set_info_foreground Log.f_green;
Log.set_critical_foreground Log.f_red;
Log.set_critical_background Log.b_default;
Log.set_show_time true
......@@ -66,7 +66,7 @@ let logo = String.concat "\n" [
let requested_sentid = ref None
let rec parse_arg = function
let rec parse_arg = function
| [] -> ()
| "-v"::_ | "--version"::_ -> printf "%s\n%!" version; exit 0
| "-h"::_ | "--help"::_ -> printf "%s\n%!" usage; exit 0
......@@ -74,17 +74,17 @@ let rec parse_arg = function
| "-i"::i::tail
| "--infos"::i::tail -> current_infos := Str.split (Str.regexp " *| *") i; parse_arg tail
| "-p"::i::tail
| "-p"::i::tail
| "--position"::i::tail -> current_position := Some (int_of_string i); parse_arg tail
| "-s"::s::tail
| "-s"::s::tail
| "--sentid"::s::tail -> requested_sentid := Some s
| "-d"::tail | "--debug"::tail -> debug := true; parse_arg tail
| s::_ when s.[0] = '-' -> Log.fcritical "Unknwon option \"%s\"" s
| anon :: tail ->
| anon :: tail ->
begin
match !input_file with
| None -> input_file := Some anon
......@@ -97,8 +97,8 @@ let rec parse_arg = function
let _ =
let () = parse_arg (List.tl (Array.to_list Sys.argv)) in
let _ =
let () = parse_arg (List.tl (Array.to_list Sys.argv)) in
(* check for input_file *)
match !input_file with
......@@ -144,7 +144,7 @@ let _ =
| (Conll, Dep) -> Dep2pict.fromConllStringToDep ~infos:!current_infos !current_source out_file
| (Dep, Dep)
| (Dep, Dep)
| (Xml, Dep) -> Log.fcritical "Conversion from Xml or Dep into Dep is not implemented. Please contact developers if your really need it!"
| (_, Xml) -> Log.fcritical "Conversion to Xml is not implemented. Please contact developers if your really need it!"
| (Pdf, _) -> Log.fcritical "pdf in not a valid input format"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment