configure 4.2.0 (see NEWS for details)

parent e7ec8eb6
......@@ -19,6 +19,12 @@ MODE=user
QUIET=false
PYTHON=$(which python)
BINDIR="$PREFIX/bin"
PCDIR="$PREFIX/lib/pkgconfig/"
DATADIR="$PREFIX/share/"
DOCDIR="$DATADIR/doc/"
PROFILEDIR="/etc/profile.d/"
export OLDPATH=$PATH
export PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
......@@ -31,16 +37,16 @@ export_result ()
echo -e "MODE=\"$MODE\"\
\nPREFIX=\"$PREFIX\"\
\nDATADIR=\"$PREFIX/share/bashstyle-ng/\"\
\nDATADIR=\"$DATADIR/bashstyle-ng/\"\
\nDATADIR_LIST=( bin ui data rc/{,ascii,dirinfo,functions,generator,internal,settings,styles,wizard} terminfo/{,b,m,n} vim/{,colors} )\
\nPROFILEDIR=\"/etc/profile.d/\"\
\nBINDIR=\"$PREFIX/bin\"\
\nLOCALEDIR=\"$PREFIX/share/locale/\"\
\nPROFILEDIR=\"$PROFILEDIR/\"\
\nBINDIR=\"$BINDIR\"\
\nLOCALEDIR=\"$DATADIR/locale/\"\
\nLOCALEDIR_LIST=( {de,es,it,ru}/LC_MESSAGES/ )\
\nICONDIR=\"$PREFIX/share/icons/hicolor/32x32/apps/\"\
\nDOCDIR=\"$PREFIX/share/doc/bashstyle-ng/\"\
\nICONDIR=\"$DATADIR/icons/hicolor/32x32/apps/\"\
\nDOCDIR=\"$DOCDIR/bashstyle-ng/\"\
\nDOCDIR_LIST=( img img-style )\
\nPCDIR=\"$PREFIX/lib/pkgconfig/\"\
\nPCDIR=\"$PCDIR/\"\
\nDIRINFO_ENABLE=\"$DIRINFO_ENABLE\"\
\nMISSING=($MISSING )" >> $PWD/.configure/results
......
......@@ -16,107 +16,148 @@ check ()
}
check_helper () {
if [[ ${APPS[@]} != "" ]]; then
section_message APP
check_apps "false" "${APPS[@]}"
fi
if [[ ${OPT_APPS[@]} != "" ]]; then
section_message OPT_APP
check_apps "true" "${OPT_APPS[@]}"
fi
if [[ ${SAPPS[@]} != "" ]]; then
section_message SBINAPP
check_apps "false" "${SAPPS[@]}"
fi
if [[ ${OPT_SAPPS[@]} != "" ]]; then
section_message OPT_SBINAPP
check_apps "true" "${OPT_SAPPS[@]}"
fi
check_python
if [[ ${PYMODS[@]} != "" ]]; then
section_message PYMOD
check_pymods "false" "${PYMODS[@]}"
fi
if [[ ${OPT_PYMODS[@]} != "" ]]; then
section_message OPT_PYMOD
check_pymods "true" "${OPT_PYMODS[@]}"
fi
if [[ ${LIBS[@]} != "" ]]; then
section_message LIB
check_libs "false" "${LIBS[@]}"
fi
if [[ ${OPT_LIBS[@]} != "" ]]; then
section_message OPT_LIB
check_libs "false" "${OPT_LIBS[@]}"
fi
if [[ ${GIR[@]} != "" ]]; then
section_message GIR
check_gir "false" "${GIR[@]}"
fi
if [[ ${OPT_GIR[@]} != "" ]]; then
section_message OPT_GIR
check_gir "false" "${OPT_GIR[@]}"
fi
}
check_apps () {
for SECTION in APP OPT_APP SBINAPP OPT_SBINAPP; do
CHKS_COUNTER=$(grep -w ${SECTION}[0-9]* .configure/depends | wc -l)
DONE_COUNTER=1
if [[ $CHKS_COUNTER != "0" ]]; then
section_message $SECTION
while (( $DONE_COUNTER <= $CHKS_COUNTER )); do
DEPENDENCY=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}')
DEP_RETURN=$(check $DEPENDENCY)
if [[ $DEP_RETURN == "found" ]]; then
ok_message $DEPENDENCY
elif [[ $DEP_RETURN != "found" && $SECTION == OPT* ]]; then
warn_message $DEPENDENCY
ERR_MSG+=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk -F ':' '{print $2}')
MISSING+=" $(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}' )"
else fail_message m $DEPENDENCY
exit 1
fi
DONE_COUNTER=$(($DONE_COUNTER+1)); done
fi
unset CHKS_COUNTER DONE_COUNTER
OPT=$1
shift
for ARG in "$@"; do
APP="${ARG/:*}"
DESC="${ARG/*:}"
DEP_RETURN=$(check $APP)
if [[ $DEP_RETURN == "found" ]]; then
ok_message "$APP"
elif [[ $DEP_RETURN != "found" && $OPT == "true" ]]; then
warn_message $APP "$DESC"
MISSING+=" $APP"
else fail_message m $APP
exit 1
fi
done
}
check_libs () {
for SECTION in LIB OPT_LIB; do
CHKS_COUNTER=$(grep -w ${SECTION}[0-9]* .configure/depends | wc -l)
DONE_COUNTER=1
if [[ $CHKS_COUNTER != "0" ]]; then
section_message $SECTION
while (( $DONE_COUNTER <= $CHKS_COUNTER )); do
DEPENDENCY=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}')
VERSION=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $3}')
PC_FILE=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $4}')
pkg-config --exists $PC_FILE
EXIST_RETURN=$?
pkg-config --atleast-version=$VERSION $PC_FILE
DEP_RETURN=$?
if [[ $EXIST_RETURN != 0 && ! $SECTION == OPT* ]]; then
fail_message m $DEPENDENCY
exit 1
elif [[ $DEP_RETURN == 0 ]]; then
ok_message $DEPENDENCY ${VERSION}+
elif [[ $EXIST_RETURN != 0 && $SECTION == OPT* ]]; then
warn_message $DEPENDENCY
ERR_MSG+=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk -F':' '{print $2}')
MISSING+=" $(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}' )"
else fail_message o $DEPENDENCY $VERSION
exit 1
fi
DONE_COUNTER=$(($DONE_COUNTER+1)); done
fi
unset CHKS_COUNTER DONE_COUNTER
OPT=$1
shift
for ARG in "$@"; do
LIB=$(gawk -F \: '{print $1}' <(echo $ARG))
VERSION=$(gawk -F \: '{print $2}' <(echo $ARG))
PC_FILE=$(gawk -F \: '{print $3}' <(echo $ARG))
DESC=$(gawk -F \: '{print $4}' <(echo $ARG))
pkg-config --exists $PC_FILE
EXIST_RETURN=$?
pkg-config --atleast-version=$VERSION $PC_FILE
DEP_RETURN=$?
if [[ $EXIST_RETURN != 0 && ! $OPT == "true" ]]; then
fail_message m $LIB
exit 1
elif [[ $DEP_RETURN == 0 ]]; then
ok_message $LIB ${VERSION}+
elif [[ $EXIST_RETURN != 0 && $OPT == "true" ]]; then
warn_message $LIB "$DESC"
MISSING+=" $LIB"
else fail_message o $LIB $VERSION
exit 1
fi
done
}
check_gir () {
for SECTION in GIR OPT_GIR; do
CHKS_COUNTER=$(grep -w ${SECTION}[0-9]* .configure/depends | wc -l)
DONE_COUNTER=1
if [[ $CHKS_COUNTER != "0" ]]; then
section_message $SECTION
while (( $DONE_COUNTER <= $CHKS_COUNTER )); do
DEPENDENCY=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}')
VERSION=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $3}')
TYPE_LIB=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $4}')
FILE=$(basename $(ls ${GIRPATH}/$TYPE_LIB* 2>/dev/null) .typelib 2>/dev/null)
if [[ $FILE != ".typelib" ]]; then
EXIST_RETURN=0
XVER=$(echo $FILE | gawk -F \- '{print $2}')
DEP_RETURN=$(echo "$XVER >= $VERSION" | bc)
fi
if [[ $EXIST_RETURN != 0 && ! $SECTION == OPT* ]]; then
fail_message m $DEPENDENCY
exit 1
elif [[ $DEP_RETURN == 1 ]]; then
ok_message $DEPENDENCY ${VERSION}+
elif [[ $EXIST_RETURN != 0 && $SECTION == OPT* ]]; then
warn_message $DEPENDENCY
ERR_MSG+=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk -F':' '{print $2}')
MISSING+=" $(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}' )"
else fail_message o $DEPENDENCY $VERSION
exit 1
fi
DONE_COUNTER=$(($DONE_COUNTER+1)); done
fi
unset CHKS_COUNTER DONE_COUNTER
OPT=$1
shift
for ARG in "$@"; do
GIR=$(gawk -F \: '{print $1}' <(echo $ARG))
VERSION=$(gawk -F \: '{print $2}' <(echo $ARG))
TYPE_LIB=$(gawk -F \: '{print $3}' <(echo $ARG))
DESC=$(gawk -F \: '{print $4}' <(echo $ARG))
FILE=$(basename ${GIRPATH}/$TYPE_LIB* .typelib 2>/dev/null)
if [[ $FILE != ".typelib" ]]; then
EXIST_RETURN=0
XVER=$(gawk -F \- '{print $2}' <(echo $FILE))
DEP_RETURN=$(echo "$XVER >= $VERSION" | bc)
fi
if [[ $EXIST_RETURN != 0 && ! $OPT == "true" ]]; then
fail_message m $GIR
exit 1
elif [[ $DEP_RETURN == 1 ]]; then
ok_message $GIR ${VERSION}+
elif [[ $EXIST_RETURN != 0 && $OPT == "true" ]]; then
warn_message $GIR "$DESC"
MISSING+=" $GIR"
else fail_message o $GIR $VERSION
exit 1
fi
done
}
......@@ -139,7 +180,7 @@ else
fail_message p+
exit 1
else
ok_message Python $PYTHON
ok_message Python
fi
fi
......@@ -147,38 +188,34 @@ fi
check_pymods () {
for SECTION in PYMOD OPT_PYMOD; do
CHKS_COUNTER=$(grep -w ${SECTION}[0-9]* .configure/depends | wc -l)
DONE_COUNTER=1
if [[ $CHKS_COUNTER != "0" ]]; then
section_message $SECTION
while (( $DONE_COUNTER <= $CHKS_COUNTER )); do
DEPENDENCY=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}')
if [[ $DEPENDENCY == *:* ]]; then
FROM=$(echo $DEPENDENCY | gawk -F \: '{print $1}')
SMOD=$(echo $DEPENDENCY | gawk -F \: '{print $2}')
python -c "from $FROM import $SMOD" 2>/dev/null
else
python -c "import imp
imp.find_module('$DEPENDENCY')" 2>/dev/null
fi
DEP_RETURN=$?
if [[ $DEP_RETURN == 0 ]]; then
ok_message $DEPENDENCY
elif [[ $DEP_RETURN != 0 && $SECTION == OPT* ]]; then
warn_message $DEPENDENCY
ERR_MSG+=$(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk -F':' '{print $2}')
MISSING+=" $(grep -w ${SECTION}${DONE_COUNTER} .configure/depends | gawk '{print $2}' )"
else fail_message m $DEPENDENCY
exit 1
fi
DONE_COUNTER=$(($DONE_COUNTER+1)); done
fi
unset CHKS_COUNTER DONE_COUNTER
OPT=$1
shift
for ARG in "$@"; do
MOD=$(gawk -F \: '{print $1}' <(echo $ARG))
SMOD=$(gawk -F \: '{print $2}' <(echo $ARG))
DESC=$(gawk -F \: '{print $3}' <(echo $ARG))
if [[ $SMOD != "" ]]; then
DEP="$SMOD ($MOD)"
python -c "from $MOD import $SMOD" 2>/dev/null
else
DEP="$MOD"
python -c "import imp
imp.find_module('$MOD')" 2>/dev/null
fi
DEP_RETURN=$?
if [[ $DEP_RETURN == 0 ]]; then
ok_message "$DEP"
elif [[ $DEP_RETURN != 0 && $OPT == "true" ]]; then
warn_message $DEP "${DESC}"
MISSING+=" $DEP"
else fail_message m $DEP
exit 1
fi
done
}
APP1 bash
APP2 gawk
APP3 grep
APP4 sed
APP5 python
APP6 bc
APP7 msgfmt
APP8 whiptail
APPS=( bash gawk grep sed python bc msgfmt whiptail )
OPT_APPS=( "apm:showbatteryload --apm won't work" \
"acpi:showbatteryload --acpi won't work" \
"lspci:systeminfos --pci won't work"
"lsusb:systeminfos --usb' won't work"
"ps2pdf:man2pdf won't work"
"lynx:show_weather and define won't work"
"tree:treecd won't work" )
OPT_APP1 apm :* The optional apm coulnd't be found. `showbatteryload --apm' won't work\n
OPT_APP2 acpi :* The optional acpi couldn't be found. `showbatteryload --acpi' won't work\n
OPT_APP3 lspci :* The optional lspci couldn't be found. `systeminfos --pci' won't work\n
OPT_APP4 lsusb :* The optional lsusb couldn't be found. `systeminfos --usb' won't work\n
OPT_APP5 ps2pdf :* The optional ps2pdf couldn't be found. `man2pdf' won't work\n
OPT_APP6 lynx :* The optional lynx couldn't be found. `show_weather' and `define' won't work\n
OPT_APP7 tree :* The optional tree couldn't be found. `treecd' won't work\n
SAPPS=( )
OPT_SAPPS=( "dmidecode:systeminfos --bios won't work" )
OPT_SBINAPP1 dmidecode :* The optional dmidecode couldn't be found. `systeminfos --bios' won't work\n
LIBS=( )
OPT_LIBS=( )
GIR1 Gtk+3 3.0 Gtk-3.0
GIR=( "Gtk+3:3.0:Gtk-3.0" )
OPT_GIR=( )
PYMOD1 ctypes
PYMOD2 gettext
PYMOD3 gi.repository:Gtk
PYMOD4 configobj
PYMOD5 shutil
PYMODS=( ctypes gettext gi.repository:Gtk configobj shutil )
OPT_PYMODS=( )
......@@ -102,7 +102,8 @@ fail_message () {
warn_message () {
echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${YELLOW} Not Available"
echo -e "${WHITE}\t+ ${CYAN}$1${MAGENTA} >${YELLOW} Not Available\
\n\t > ${WHITE}$2"
tput sgr0
}
......@@ -120,25 +121,27 @@ end_message () {
echo -e "\n${YELLOW}Prefix:${WHITE} $PREFIX\
\n${YELLOW}Python:${WHITE} $PYTHON\
\n${YELLOW}Dirinfo Wrappers:${WHITE} $DIRINFO_ENABLE\n"
if [[ $ERR_MSG != "" ]]; then
echo -e "${YELLOW}Notes:\
\n${WHITE}${ERR_MSG}"
fi
tput sgr0
}
help_message () {
echo -e "\n${GREEN}BashStyle-NG ${YELLOW}(configure 4.1.0) ${CYAN}help
\n${WHITE}Options:\
\n${ORANGE}--help${WHITE} |${GREEN} Display this help message\
\n${ORANGE}--mode${WHITE} |${GREEN} user (do checks) or maintainer (skip checks)\
\n${ORANGE}--prefix=${WHITE} |${GREEN} Change Installation Prefix (default: /usr)\
\n${ORANGE}--girpath=${WHITE} |${GREEN} Where to look G-I typelibs (default: /usr/lib/girepository-1.0/)\
\n${ORANGE}--python=${WHITE} |${GREEN} Make BashStyle-NG use a specific python (default: /usr/bin/python)\
\n${ORANGE}--quiet${WHITE} |${GREEN} Only display warnings, failures and results\
\n${ORANGE}--dirinfo=${WHITE} |${GREEN} true: enable dirinfo wrappers, false: disable (default: disable)\n"
echo -e "\n${GREEN}BashStyle-NG ${YELLOW}(configure 4.2.0) ${CYAN}help
\n${WHITE}Options:"
echo -e "${ORANGE}--help${WHITE} *|${GREEN} Display this help message\
\n${ORANGE}--mode=<mode>${WHITE} *|${GREEN} user (do checks) or maintainer (skip checks)\
\n${ORANGE}--prefix=<prefix>${WHITE} *|${GREEN} Change installation prefix (default: /usr)\
\n${ORANGE}--bindir=<bindir>${WHITE} *|${GREEN} Change binary path (default: /usr/bin)\
\n${ORANGE}--docdir=<docdir>${WHITE} *|${GREEN} Change doc path (default: /usr/share/doc/)\
\n${ORANGE}--datadir=<datadir>${WHITE} *|${GREEN} Change data path (default: /usr/share/)\
\n${ORANGE}--pcdir=<pcdir>${WHITE} *|${GREEN} Change pkg-config path (default: /usr/lib/pkgconfig)\
\n${ORANGE}--profiledir=<profiledir>${WHITE} *|${GREEN} Change profile path (default: /etc/profile.d/)\
\n${ORANGE}--girpath=<girpath>${WHITE} *|${GREEN} Where to look G-I typelibs (default: /usr/lib/girepository-1.0/)\
\n${ORANGE}--python=<python>${WHITE} *|${GREEN} Make BashStyle-NG use a specific python (default: /usr/bin/python)\
\n${ORANGE}--quiet${WHITE} *|${GREEN} Only display warnings, failures and results\
\n${ORANGE}--dirinfo=<bool>${WHITE} *|${GREEN} true: enable dirinfo wrappers, false: disable (default: disable)" | column -t -s \*
echo
tput sgr0
}
......@@ -18,6 +18,7 @@ substitute_values () {
sed -e "s>@VERSION@>$xVERSION>g" -i ${SUB_VERSION_FILES[@]}
sed -e "s>@PREFIX@>$PREFIX>g" -i ${SUB_PREFIX_FILES[@]}
sed -e "s>@DATADIR@>$DATADIR>g" -i ${SUB_PREFIX_FILES[@]}
sed -e "s>@DIRINFO_ENABLE@>$DIRINFO_ENABLE>g" -i data/bashstyle.sh
sed -e "s>@PYTHON@>$PYTHON>g" -i ${SUB_PY_FILES[@]}
......
......@@ -9,16 +9,25 @@ Overview of changes in v8.1 "Sonic Empire"
make sure PATH is setup early (fixes issue that
bs-ng-wizard is not available on bash startup)
=== configure 4.1.0 ===
=== configure 4.2.0 ===
* configure now accepts --girpath argument (girpath to use)
* configure now accepts --mode argument (user = check dependencies,
maintainer = don't check dependencies (speed up re-builds))
* configure now accepts --dirinfo argument (replacing --dirinfo-enable
and --dirinfo-disable arguements)
and --dirinfo-disable arguments)
* configure now accepts --python argument (python interpreter to use,
part of fixing bug #139)
* configure now checks version of python interpreter to be greater or
equal 2.7.0 and lower than 3.0
* configure now accepts --bindir argument
* configure now accepts --pcdir argument
* configure now accepts --docdir argument
* configure now accepts --datadir argument
* configure now accepts --profiledir argument
* configure now displays information about non-function features due to
missing optional dependencies inline, instead of the end
* improved dependency definition and streamlined checking them
* improved help message
* minor internal improvements in configure
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
......
#!/bin/bash
shopt -s extglob
MODULES=( base color messages checks substitute )
MODULES=( base color messages checks substitute depends )
for mod in ${MODULES[@]}; do
source $PWD/.configure/$mod
......@@ -19,11 +19,31 @@ while [[ $xcount -lt $pcount ]]; do
--prefix=* )
PREFIX="${1/*=}"
;;
--pcdir=* )
PCDIR="${1/*=}"
;;
--docdir=* )
DOCDIR="${1/*=}"
;;
--profiledir=* )
PROFILEDIR="${1/*}"
;;
--bindir=* )
BINDIR="${1/*=}"
;;
--girpath=* )
GIRPATH="${1/*=}"
;;
--datadir=* )
DATADIR="${1/*=}"
;;
--python=* )
PYTHON="${1/*=}"
;;
......@@ -61,11 +81,7 @@ elif [[ $MODE == maintainer ]]; then
elif [[ $MODE == user ]]; then
start_message
check_apps
check_libs
check_gir
check_python
check_pymods
check_helper
copy_in_files
substitute_values
end_message
......
prefix=@PREFIX@
datadir=@PREFIX@/share/bashstyle-ng
datadir=@DATADIR@/bashstyle-ng/
Name: bashstyle-ng
Description: BashStyle-NG
......
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