Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ClamAV: devel

[PATCH] Added a autogen.sh for buildstrap the build system

 

 

ClamAV devel RSS feed   Index | Next | Previous | View Threaded


gitter.spiros at gmail

Apr 16, 2012, 8:59 AM

Post #1 of 5 (1204 views)
Permalink
[PATCH] Added a autogen.sh for buildstrap the build system

This patch add a simple autogen.sh for buildstrap
the gnu build system. It also check the minimun version
of the gnu buildtool necessary for clamav.

Signed-off-by: Elia Pinto <gitter.spiros [at] gmail>
---
Makefile.am | 2 +-
autogen.sh | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 201 insertions(+), 1 deletions(-)
create mode 100755 autogen.sh

diff --git a/Makefile.am b/Makefile.am
index 3970e2e..b3c02a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
ACLOCAL_AMFLAGS=-I m4

SUBDIRS = libltdl libclamav clamscan clamd clamdscan freshclam sigtool clamconf database docs etc clamav-milter test clamdtop clambc unit_tests
-EXTRA_DIST = FAQ examples BUGS shared libclamav.pc.in libclamunrar_iface/Makefile.am libclamunrar_iface/Makefile.in UPGRADE COPYING.bzip2 COPYING.lzma COPYING.unrar COPYING.LGPL COPYING.llvm COPYING.file COPYING.zlib COPYING.getopt COPYING.regex COPYING.sha256 platform.h.in clamdscan/clamdscan.map win32
+EXTRA_DIST = FAQ examples BUGS shared libclamav.pc.in libclamunrar_iface/Makefile.am libclamunrar_iface/Makefile.in UPGRADE COPYING.bzip2 COPYING.lzma COPYING.unrar COPYING.LGPL COPYING.llvm COPYING.file COPYING.zlib COPYING.getopt COPYING.regex COPYING.sha256 platform.h.in clamdscan/clamdscan.map win32 README-prereq

bin_SCRIPTS=clamav-config

diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..f41e365
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,200 @@
+#!/bin/sh
+#
+# $Id$
+# autogen.sh: autogen.sh script for clamav projects
+#
+# Copyright (c) 2010-2011 Elia Pinto <gitter.spiros [at] gmail>
+#
+# This program have the same copyright notice as clamav
+# itself
+#
+# Global Function and Variables
+#
+_PROGNAME="$0"
+#
+red=; grn=; lgn=; blu=; std=;
+test "X$$TERM" != Xdumb \
+&& test -t 1 2>/dev/null \
+&& { \
+ red='[.0;31m'; \
+ grn='[.0;32m'; \
+ lgn='[.1;32m'; \
+ blu='[.1;34m'; \
+ std='[.m'; \
+}
+
+Die() {
+ color="$red"
+ echo "${color}${_PROGNAME}: Error: $@${std}" >&2
+ exit 1
+}
+
+Notice() {
+ color="$grn"
+ echo "${color}${_PROGNAME}: $@${std}"
+}
+
+
+# Function Used for checking the Version Used for building
+#
+# Note this deviates from the version comparison in automake
+# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
+# but this should suffice as we won't be specifying old
+# version formats or redundant trailing .0 in bootstrap.conf.
+# If we did want full compatibility then we should probably
+# use m4_version_compare from autoconf.
+sort_ver() { # sort -V is not generally available
+ ver1="$1"
+ ver2="$2"
+
+ # split on '.' and compare each component
+ i=1
+ while : ; do
+ p1=$(echo "$ver1" | cut -d. -f$i)
+ p2=$(echo "$ver2" | cut -d. -f$i)
+ if [ ! "$p1" ]; then
+ echo "$1 $2"
+ break
+ elif [ ! "$p2" ]; then
+ echo "$2 $1"
+ break
+ elif [ ! "$p1" = "$p2" ]; then
+ if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
+ echo "$2 $1"
+ elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
+ echo "$1 $2"
+ else # numeric, then lexicographic comparison
+ lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
+ if [ "$lp" = "$p2" ]; then
+ echo "$1 $2"
+ else
+ echo "$2 $1"
+ fi
+ fi
+ break
+ fi
+ i=$(($i+1))
+ done
+}
+
+get_version() {
+ app=$1
+
+ $app --version >/dev/null 2>&1 || return 1
+
+ $app --version 2>&1 |
+ sed -n '# extract version within line
+ s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
+ t done
+
+ # extract version at start of line
+ s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
+ t done
+
+ d
+
+ :done
+ #the following essentially does s/5.005/5.5/
+ s/\.0*\([1-9]\)/.\1/g
+ p
+ q'
+}
+
+check_versions() {
+ ret=0
+
+ while read app req_ver; do
+ # Honor $APP variables ($TAR, $AUTOCONF, etc.)
+ appvar=`echo $app | tr '[a-z]' '[A-Z]'`
+ test "$appvar" = TAR && appvar=AMTAR
+ eval "app=\${$appvar-$app}"
+ inst_ver=$(get_version $app)
+ if [ ! "$inst_ver" ]; then
+ echo "Error: '$app' not found" >&2
+ ret=1
+ elif [ ! "$req_ver" = "-" ]; then
+ latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
+ if [ ! "$latest_ver" = "$inst_ver" ]; then
+ echo "Error: '$app' version == $inst_ver is too old" >&2
+ echo " '$app' version >= $req_ver is required" >&2
+ ret=1
+ fi
+ fi
+ done
+
+ return $ret
+}
+
+print_versions() {
+ echo "Program Min_version"
+ echo "----------------------"
+ printf "$buildreq"
+ echo "----------------------"
+ # can't depend on column -t
+}
+
+#######################
+# Begin Bootstrapping
+#######################
+# Build prerequisites
+buildreq="\
+autoconf 2.59
+automake 1.11.1
+libtool 2.2.10
+"
+echo
+Notice "Bootstrapping clamav build system..."
+echo
+# Guess whether we are using configure.ac or configure.in
+if test -f configure.ac; then
+ conffile="configure.ac"
+elif test -f configure.in; then
+ conffile="configure.in"
+else
+ Die "could not find configure.ac or configure.in"
+ echo
+fi
+
+# Libtool
+libtoolize=`which glibtoolize 2>/dev/null`
+case $libtoolize in
+ /*) export LIBTOOL=glibtool;;
+ *) libtoolize=`which libtoolize 2>/dev/null`
+ case $libtoolize in
+ /*) ;;
+ *) libtoolize=libtoolize
+ esac
+esac
+
+[ ! -d m4 ] && mkdir m4
+[ ! -d config ] && mkdir config
+
+if test -z "$libtoolize"; then
+ Die "libtool not found."
+ echo
+else
+ # Check if libtool-ltdl is present
+ $libtoolize --force --copy --ltdl >/dev/null 2>&1
+ [ $? -ne 0 ] && Die "libtool libltdl or the static libraries and header files for development with ltdl are not found."
+fi
+
+if ! printf "$buildreq" | check_versions; then
+ test -f README-prereq &&
+ echo
+ echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2
+ echo
+ print_versions
+ exit 1
+fi
+
+find . -name "autom4te.cache" | xargs rm -rf
+
+ls "$po_dir"/*.po 2>/dev/null |
+ sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
+
+#
+echo
+Notice "done. Now you can run './configure'."
+#######################
+# End Bootstrapping
+#######################
--
1.7.8.rc3.31.g017d1

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net


gitter.spiros at gmail

Apr 16, 2012, 9:02 AM

Post #2 of 5 (1148 views)
Permalink
Re: [PATCH] Added a autogen.sh for buildstrap the build system [In reply to]

Please ignore this patch. It is incomplete, i am sorry.

I will reroll it shortly.

Thanks
2012/4/16 Elia Pinto <gitter.spiros [at] gmail>:
> This patch add a simple autogen.sh for buildstrap
> the gnu build system. It also check the minimun version
> of the gnu buildtool necessary for clamav.
>
> Signed-off-by: Elia Pinto <gitter.spiros [at] gmail>
> ---
>  Makefile.am |    2 +-
>  autogen.sh  |  200 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 201 insertions(+), 1 deletions(-)
>  create mode 100755 autogen.sh
>
> diff --git a/Makefile.am b/Makefile.am
> index 3970e2e..b3c02a5 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -19,7 +19,7 @@
>  ACLOCAL_AMFLAGS=-I m4
>
>  SUBDIRS = libltdl libclamav clamscan clamd clamdscan freshclam sigtool clamconf database docs etc clamav-milter test clamdtop clambc unit_tests
> -EXTRA_DIST = FAQ examples BUGS shared libclamav.pc.in libclamunrar_iface/Makefile.am libclamunrar_iface/Makefile.in UPGRADE COPYING.bzip2 COPYING.lzma COPYING.unrar COPYING.LGPL COPYING.llvm COPYING.file COPYING.zlib COPYING.getopt COPYING.regex COPYING.sha256 platform.h.in clamdscan/clamdscan.map win32
> +EXTRA_DIST = FAQ examples BUGS shared libclamav.pc.in libclamunrar_iface/Makefile.am libclamunrar_iface/Makefile.in UPGRADE COPYING.bzip2 COPYING.lzma COPYING.unrar COPYING.LGPL COPYING.llvm COPYING.file COPYING.zlib COPYING.getopt COPYING.regex COPYING.sha256 platform.h.in clamdscan/clamdscan.map win32 README-prereq
>
>  bin_SCRIPTS=clamav-config
>
> diff --git a/autogen.sh b/autogen.sh
> new file mode 100755
> index 0000000..f41e365
> --- /dev/null
> +++ b/autogen.sh
> @@ -0,0 +1,200 @@
> +#!/bin/sh
> +#
> +# $Id$
> +# autogen.sh: autogen.sh script for clamav projects
> +#
> +# Copyright (c) 2010-2011 Elia Pinto <gitter.spiros [at] gmail>
> +#
> +# This program have the same copyright notice as clamav
> +# itself
> +#
> +# Global Function and Variables
> +#
> +_PROGNAME="$0"
> +#
> +red=; grn=; lgn=; blu=; std=;
> +test "X$$TERM" != Xdumb \
> +&&  test -t 1 2>/dev/null  \
> +&& { \
> +  red=' [.0;31m'; \
> +  grn=' [.0;32m'; \
> +  lgn=' [.1;32m'; \
> +  blu=' [.1;34m'; \
> +  std=' [.m'; \
> +}
> +
> +Die()    {
> +        color="$red"
> +       echo "${color}${_PROGNAME}: Error: $@${std}" >&2
> +       exit 1
> +}
> +
> +Notice() {
> +        color="$grn"
> +       echo "${color}${_PROGNAME}: $@${std}"
> +}
> +
> +
> +# Function Used for checking the Version Used for building
> +#
> +# Note this deviates from the version comparison in automake
> +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
> +# but this should suffice as we won't be specifying old
> +# version formats or redundant trailing .0 in bootstrap.conf.
> +# If we did want full compatibility then we should probably
> +# use m4_version_compare from autoconf.
> +sort_ver() { # sort -V is not generally available
> +  ver1="$1"
> +  ver2="$2"
> +
> +  # split on '.' and compare each component
> +  i=1
> +  while : ; do
> +    p1=$(echo "$ver1" | cut -d. -f$i)
> +    p2=$(echo "$ver2" | cut -d. -f$i)
> +    if [ ! "$p1" ]; then
> +      echo "$1 $2"
> +      break
> +    elif [ ! "$p2" ]; then
> +      echo "$2 $1"
> +      break
> +    elif [ ! "$p1" = "$p2" ]; then
> +      if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
> +        echo "$2 $1"
> +      elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
> +        echo "$1 $2"
> +      else # numeric, then lexicographic comparison
> +        lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
> +        if [ "$lp" = "$p2" ]; then
> +          echo "$1 $2"
> +        else
> +          echo "$2 $1"
> +        fi
> +      fi
> +      break
> +    fi
> +    i=$(($i+1))
> +  done
> +}
> +
> +get_version() {
> +  app=$1
> +
> +  $app --version >/dev/null 2>&1 || return 1
> +
> +  $app --version 2>&1 |
> +  sed -n '# extract version within line
> +          s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
> +          t done
> +
> +          # extract version at start of line
> +          s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
> +          t done
> +
> +          d
> +
> +          :done
> +          #the following essentially does s/5.005/5.5/
> +          s/\.0*\([1-9]\)/.\1/g
> +          p
> +          q'
> +}
> +
> +check_versions() {
> +  ret=0
> +
> +  while read app req_ver; do
> +    # Honor $APP variables ($TAR, $AUTOCONF, etc.)
> +    appvar=`echo $app | tr '[a-z]' '[A-Z]'`
> +    test "$appvar" = TAR && appvar=AMTAR
> +    eval "app=\${$appvar-$app}"
> +    inst_ver=$(get_version $app)
> +    if [ ! "$inst_ver" ]; then
> +      echo "Error: '$app' not found" >&2
> +      ret=1
> +    elif [ ! "$req_ver" = "-" ]; then
> +      latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
> +      if [ ! "$latest_ver" = "$inst_ver" ]; then
> +        echo "Error: '$app' version == $inst_ver is too old" >&2
> +        echo "       '$app' version >= $req_ver is required" >&2
> +        ret=1
> +      fi
> +    fi
> +  done
> +
> +  return $ret
> +}
> +
> +print_versions() {
> +  echo "Program    Min_version"
> +  echo "----------------------"
> +  printf "$buildreq"
> +  echo "----------------------"
> +  # can't depend on column -t
> +}
> +
> +#######################
> +# Begin  Bootstrapping
> +#######################
> +# Build prerequisites
> +buildreq="\
> +autoconf   2.59
> +automake   1.11.1
> +libtool           2.2.10
> +"
> +echo
> +Notice "Bootstrapping clamav build system..."
> +echo
> +# Guess whether we are using configure.ac or configure.in
> +if test -f configure.ac; then
> +  conffile="configure.ac"
> +elif test -f configure.in; then
> +  conffile="configure.in"
> +else
> +  Die "could not find configure.ac or configure.in"
> +  echo
> +fi
> +
> +# Libtool
> +libtoolize=`which glibtoolize 2>/dev/null`
> +case $libtoolize in
> +               /*) export LIBTOOL=glibtool;;
> +               *)  libtoolize=`which libtoolize 2>/dev/null`
> +       case $libtoolize in
> +       /*) ;;
> +       *)  libtoolize=libtoolize
> +       esac
> +esac
> +
> +[ ! -d m4 ]     && mkdir m4
> +[ ! -d config ] && mkdir config
> +
> +if test -z "$libtoolize"; then
> +               Die "libtool not found."
> +               echo
> +else
> +  # Check if libtool-ltdl is present
> +  $libtoolize  --force --copy --ltdl >/dev/null 2>&1
> +  [ $? -ne 0 ] && Die "libtool libltdl or the static libraries and header files for development with ltdl are not found."
> +fi
> +
> +if ! printf "$buildreq" | check_versions; then
> +  test -f README-prereq &&
> +  echo
> +  echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2
> +  echo
> +  print_versions
> +  exit 1
> +fi
> +
> +find . -name "autom4te.cache" | xargs rm -rf
> +
> +ls "$po_dir"/*.po 2>/dev/null |
> +              sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
> +
> +#
> +echo
> +Notice "done.  Now you can run './configure'."
> +#######################
> +# End  Bootstrapping
> +#######################
> --
> 1.7.8.rc3.31.g017d1
>
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net


edwin at clamav

Apr 16, 2012, 9:13 AM

Post #3 of 5 (1155 views)
Permalink
Re: [PATCH] Added a autogen.sh for buildstrap the build system [In reply to]

On 04/16/2012 07:02 PM, Elia Pinto wrote:
> Please ignore this patch. It is incomplete, i am sorry.
>
> I will reroll it shortly.

autogen.sh is not needed, 'autoreconf -fvi' does the job.

Best regards,
--Edwin
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net


gitter.spiros at gmail

Apr 16, 2012, 9:18 AM

Post #4 of 5 (1145 views)
Permalink
Re: [PATCH] Added a autogen.sh for buildstrap the build system [In reply to]

2012/4/16 Török Edwin <edwin [at] clamav>:
> On 04/16/2012 07:02 PM, Elia Pinto wrote:
>> Please ignore this patch. It is incomplete, i am sorry.
>>
>> I will reroll it shortly.
>
> autogen.sh is not needed, 'autoreconf -fvi' does the job.
Yes, but not check the minimum version of the gnu buildtool used
by a project, giving strange error if not, and, in the clamav case,
don't check and give bad error if
libtool libtdl tool or the static library are missing.

Best Regards

Elia
>
> Best regards,
> --Edwin
> _______________________________________________
> http://lurker.clamav.net/list/clamav-devel.html
> Please submit your patches to our Bugzilla: http://bugs.clamav.net
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net


edwin at clamav

Apr 16, 2012, 10:17 AM

Post #5 of 5 (1146 views)
Permalink
Re: [PATCH] Added a autogen.sh for buildstrap the build system [In reply to]

On 04/16/2012 07:18 PM, Elia Pinto wrote:
> 2012/4/16 Török Edwin <edwin [at] clamav>:
>> On 04/16/2012 07:02 PM, Elia Pinto wrote:
>>> Please ignore this patch. It is incomplete, i am sorry.
>>>
>>> I will reroll it shortly.
>>
>> autogen.sh is not needed, 'autoreconf -fvi' does the job.
> Yes, but not check the minimum version of the gnu buildtool used
> by a project, giving strange error if not, and, in the clamav case,
> don't check and give bad error if
> libtool libtdl tool or the static library are missing.

autoconf version is checked by AC_PREREQ, and automake version by AM_INIT_AUTOMAKE,
so checking those in autogen.sh is redundant.
All that remains to be checked is the libtool version.

Or just run the build-system regeneration on an up-to-date Debian testing/unstable, like we do :)

Best regards,
--Edwin
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net

ClamAV devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.