https://hal.archives-ouvertes.fr/hal-03445804
build.sh
#!/bin/sh
BUILD=build.linux
LOG=log.build
if test "$#" -ge 1
then
case "$1" in
clean)
echo "Cleaning package..."
for dir in SCEDA GDD RS SIRA
do
if test -r "$dir"
then
echo "Cleaning $dir"
cd "$dir"
ln -sf Makefile.config.linux Makefile.config
make clean > /dev/null 2>&1
rm -f Makefile.config
cd ..
fi
done
rm -rf "$BUILD"
rm -f "$LOG"
exit 0
;;
*)
echo "Unknown argument $1"
exit 1
esac
fi
if test -r "$BUILD"
then
echo "$BUILD already exists"
echo "To rebuild the entire package, please first clean the "
echo "package by typing ./`basename $0` clean"
exit 1
fi
mkdir -p "$BUILD"
rm -f "$LOG"
LIBPATH=`pwd`/"$BUILD"
LPSOLVEPATH=/usr/local
GDD_ask_XML() {
xmlpath=`which xml2-config`
if test "$?" -ne 0
then
echo "Can't find xml2-config... disabling xml parser feature"
return 0
fi
cat <<EOF
libGDD includes a basic xml parser (require libxml2 devel >= 2.7.1).
You may disable this feature but please note that in this case most
of furnished examples will fail to compile.
EOF
echo -n "Would you like to build the xml parsers of libGDD? [y] "
read withxml
withxml=`echo "$withxml" | tr [A-Z] [a-z]`
if test "/$withxml/" = "/n/" -o "/$withxml/" = "/no/"
then
return 0
else
return 1
fi
}
SIRA_ask_LPSOLVE() {
echo -n "Please enter lp_solve installation path: [$LPSOLVEPATH] "
read lppath
if test "/$lppath/" != "//"
then
LPSOLVEPATH="$lppath"
fi
if test -r "$LPSOLVEPATH"
then
return 0
else
echo "Invalid path."
return 1
fi
}
SIRA_ask_METHOD() {
cat <<EOF
libSIRA has three implementations of SIRALINA:
1-standalone version (LGPL)
2-lp_solve version (LGPL, require lp_solve >= 5.5)
3-GLPK version (GPL tainted, require GLPK devel >= 4.30)
EOF
echo -n "Which version do you want to build? [1] "
read method
if test "/$method/" = "/2/"
then
if SIRA_ask_LPSOLVE
then
return 2
else
return 1
fi
else if test "/$method/" = "/3/"
then
return 3
else
return 1
fi
fi
}
DOC_ask() {
doxpath=`which doxygen`
if test "$?" -ne 0
then
echo "Can't find doxygen... skipping documentation generation."
return 0
fi
echo -n "Would you like to build the documentations? [y] "
read ans
ans=`echo "$ans" | tr [A-Z] [a-z]`
if test "/$ans/" = "/n/" -o "/$ans/" = "/no/"
then
return 0
else
return 1
fi
}
for dir in SCEDA GDD RS SIRA
do
if test -r "$dir"
then
echo "Building $dir"
cd "$dir"
ln -sf Makefile.config.linux Makefile.config
case $dir in
GDD)
GDD_ask_XML
case "$?" in
0)
xml="no"
echo "Disabling XML parser"
;;
1)
xml="yes"
echo "Enabling XML parser"
;;
esac
make LIBHOME="$LIBPATH" install TARGET="$LIBPATH" ENABLE_XML_PARSER="$xml" >> "../$LOG" 2>&1
;;
SIRA)
SIRA_ask_METHOD
case "$?" in
1)
meth="flow"
echo "Chosen SIRA implementation: standalone version"
;;
2)
meth="lpsolve
" echo "Chosen SIRA implementation: lp_solve version"
;;
3)
meth="glpk"
echo "Chosen SIRA implementation: glpk version (GPL tainted binary)"
;;
esac
make LIBHOME="$LIBPATH" install TARGET="$LIBPATH" METHOD="$meth" LP_SOLVE="$LPSOLVEPATH" >> "../$LOG" 2>&1
;;
*)
make LIBHOME="$LIBPATH" install TARGET="$LIBPATH" >> "../$LOG" 2>&1
esac
cd ..
fi
done
if ! DOC_ask
then
for dir in SCEDA GDD RS SIRA
do
if test -r "$dir"
then
cd "$dir"
make doc >> "../$LOG" 2>&1
cd ..
fi
done
fi