X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fautodist%2Fautodist.in;h=3154d5ffaceb7afe0fbbb83c097bed4caa240fdf;hb=193db015b0c8cddb4ca3f1601d5c67f16bde6bbc;hp=df1c2e622d959e65be6314c1f98de08bb0dae1bb;hpb=d1e71f42379e8b5cd0748a7aeae8561b02cfe53d;p=runtime.git diff --git a/apps/autodist/autodist.in b/apps/autodist/autodist.in index df1c2e62..3154d5ff 100755 --- a/apps/autodist/autodist.in +++ b/apps/autodist/autodist.in @@ -2,7 +2,7 @@ # # Author: Pekka Riikonen # -# Copyright (C) 2005 Pekka Riikonen +# Copyright (C) 2005 - 2007 Pekka Riikonen # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -565,16 +565,22 @@ ad_process_ads() for i in $files do fname=`echo $i | sed s/\.ad//` + orig=$i ad_debug "Processing $i to be $fname" ad_log " $i into $fname" # Run the distribution processing for this file - ad_process_file $i $fname false - if test -f $fname; then - cp -p $i $fname || exit 1 + ad_process_file $i $fname.tmp false + + # Remove any trailing backslashes + if test -f "$fname.tmp"; then + sed -e :a -e '/\\$/N; s/[ ]*\\\n//; ta' < $fname.tmp > $fname + else + cp -p $orig $fname || exit 1 fi + rm -f $fname.tmp done ad_log "" @@ -833,6 +839,9 @@ ad_process_tree() \! -name \*\.[cC][pP][pP] -a \ \! -name \*\.[cC]++ -a \ \! -name \*\.m -a \ + \! -name \*\.mm -o \ + \! -name \*\.M -o \ + \! -name \*\.S -o \ \! -name \*\.[hH] -a \ \! -name \*\.hh -a \ \! -name \*\.[cC]\.in -a \ @@ -872,8 +881,9 @@ ad_process_source_tree() { ad_debug "Starting processing source files: $1" - # We take only C/C++ files since they use the C compiler friendly - # version of distdefs. Other files are not assumed to use them. + # We take only C/C++ (and other files that are run through traditional + # preprocessor) files since they use the C compiler friendly version + # of distdefs. Other files are not assumed to use them. files=`find $am_distdir -type f \! -name \*\.ad \( \ -name \*\.[cC] -o \ -name \*\.[cC][cCpP] -o \ @@ -881,6 +891,9 @@ ad_process_source_tree() -name \*\.[cC][pP][pP] -o \ -name \*\.[cC]++ -o \ -name \*\.m -o \ + -name \*\.mm -o \ + -name \*\.M -o \ + -name \*\.S -o \ -name \*\.[hH] -o \ -name \*\.hh -o \ -name \*\.[cC]\.in -o \ @@ -996,6 +1009,7 @@ ad_makedist() distribution=`grep "dist:" < autodist.dist | cut -d: -f2` || exit 1 dist_version=`grep "ver:" < autodist.dist | cut -d: -f2` || exit 1 am_distdir=`grep "distdir:" < autodist.dist | cut -d: -f2` || exit 1 + params=`grep "params:" < autodist.dist | cut -d: -f2` || exit 1 ad_parse_distribution $distribution false ad_log " Distribution: $distribution $dist_version" ad_log " Destination directory: $am_distdir" @@ -1007,7 +1021,7 @@ ad_makedist() fi # Run pre-dist-hooks - ad_run_dist_hooks "$pre_dist_hooks" + ad_run_dist_hooks "$pre_dist_hooks" "$params" # Create distribution directory ad_debug "Creating distribution directory $am_distdir" @@ -1019,7 +1033,7 @@ ad_makedist() fi # Run pre-process-dist-hooks - ad_run_dist_hooks "$pre_p_dist_hooks" + ad_run_dist_hooks "$pre_p_dist_hooks" "$params" # Run excludes ad_dist_excludes "$excludes" true @@ -1061,7 +1075,7 @@ ad_makedist() ad_process_noprocess false # Run post-process_dist-hooks - ad_run_dist_hooks "$post_p_dist_hooks" + ad_run_dist_hooks "$post_p_dist_hooks" "$params" # Make distribution sane ad_makedist_makesane @@ -1092,7 +1106,7 @@ ad_makedist() rm -f $am_distdir.tar # Run post-dist-hooks - ad_run_dist_hooks "$post_dist_hooks" + ad_run_dist_hooks "$post_dist_hooks" "$params" # Cleanup rm -rf $am_distdir @@ -1181,6 +1195,15 @@ ad_parse_distribution() ad_fatal "Distribution '$1' is not declared" fi + # Get and enforce prereq version + prereq=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \ + | grep "prereq " | cut -d' ' -f2- | sort | uniq` + if test '!' -z $prereq; then + if test "$ver" \< "$prereq"; then + ad_fatal "Autodist $prereq or newer is required for distribution $1" + fi + fi + # Get inherited inhs=`sed 's/^[ ]*//' < $distdir/$1 | grep -v "^#" \ | grep "inherit " | cut -d' ' -f2 | sort | uniq` @@ -1554,9 +1577,9 @@ ad_process_file() # This also handles the #ifdef's #else (ie. #ifndef) branch. if test x$found = xfalse; then ad_debug "ifdef $d will be excluded (it is NOT defined)" - echo "/^#ifdef $d/,/^#else !$d|^#endif $d/ { next; }" >> $f + echo "/^#ifdef $d$/,/^#else !$d$|^#endif $d$/ { next; }" >> $f else - echo "/^#else !$d/,/^#endif $d/ { next; }" >> $f + echo "/^#else !$d$/,/^#endif $d$/ { next; }" >> $f fi done @@ -1577,9 +1600,9 @@ ad_process_file() # This also handles the #ifndef's #else (ie. #ifdef) branch. if test x$found = xtrue; then ad_debug "ifndef $d will be excluded (it IS defined)" - echo "/^#ifndef $d/,/^#else $d|^#endif $d/ { next; }" >> $f + echo "/^#ifndef $d$/,/^#else $d$|^#endif $d$/ { next; }" >> $f else - echo "/^#else $d/,/^#endif $d/ { next; }" >> $f + echo "/^#else $d$/,/^#endif $d$/ { next; }" >> $f fi done @@ -1665,9 +1688,9 @@ ad_process_source_file() # This also handles the #ifdef's #else (ie. #ifndef) branch. if test x$found = xfalse; then ad_debug "ifdef $d will be excluded (it is NOT defined)" - echo "/^#ifdef $d/,/^#else \/\* \!$d|^#endif \/\* $d/ { next; }" >> $f + echo "/^#ifdef $d$/,/^#else \/\* \!$d |^#endif \/\* $d / { next; }" >> $f else - echo "/^#else \/\* \!$d/,/^#endif \/\* $d/ { next; }" >> $f + echo "/^#else \/\* \!$d /,/^#endif \/\* $d / { next; }" >> $f fi done @@ -1688,9 +1711,9 @@ ad_process_source_file() # This also handles the #ifndef's #else (ie. #ifdef) branch. if test x$found = xtrue; then ad_debug "ifndef $d will be excluded (it IS defined)" - echo "/^#ifndef $d/,/^#else \/\* $d|^#endif \/\* $d/ { next; }" >> $f + echo "/^#ifndef $d$/,/^#else \/\* $d |^#endif \/\* $d / { next; }" >> $f else - echo "/^#else \/\* $d/,/^#endif \/\* $d/ { next; }" >> $f + echo "/^#else \/\* $d /,/^#endif \/\* $d / { next; }" >> $f fi done @@ -1775,7 +1798,7 @@ ad_process() # # Run hooks # -# Arguments: ad_run_hooks +# Arguments: ad_run_hooks # ad_run_hooks() { @@ -1790,8 +1813,8 @@ ad_run_hooks() if test '!' -f $i; then ad_fatal "Hook script $i does not exist" fi - ad_log " sh $i \"$distribution\" \"$dist_version\" \"$package\"" - sh $i "$distribution" "$dist_version" "$package" || exit 1 + ad_log " sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$2\"" + sh $i "$distribution" "$dist_version" "$package" "$2" || exit 1 done ad_log "" @@ -1801,7 +1824,7 @@ ad_run_hooks() # # Run dist hooks # -# Arguments: ad_run_dist_hooks +# Arguments: ad_run_dist_hooks # ad_run_dist_hooks() { @@ -1817,8 +1840,8 @@ ad_run_dist_hooks() ad_fatal "Dist hook script $i does not exist" fi - ad_log " sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$am_distdir\"" - sh $i "$distribution" "$dist_version" "$package" "$am_distdir" || exit 1 + ad_log " sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$am_distdir\" \"$2\"" + sh $i "$distribution" "$dist_version" "$package" "$am_distdir" "$2" || exit 1 done ad_log "" @@ -1828,12 +1851,12 @@ ad_run_dist_hooks() ############################################################################### # Autodist code -usage="Usage: autodist [options] [distribution] [version]" +usage="Usage: autodist [options] [distribution] [version] [params]" help="\ Autodist prepares source tree for configuration, compilation and -distribution. Generates Automake.am files from Automake.ad files, -configure.ac file from configure.ad file(s), generates the configure -script by running Autoconf tool, and generates Makefile.in files by +distribution. Generates Automake.am files from Automake.ad files, +configure.ac file from configure.ad file(s), generates the configure +script by running Autoconf tool, and generates Makefile.in files by running Automake tool. Operation modes: @@ -1934,7 +1957,7 @@ while test $# -gt 0; do echo "@PACKAGE@ (@PACKAGE_NAME@) $ver" 1>&2; echo "Written by Pekka Riikonen" 1>&2; echo 1>&2; - echo "Copyright (C) 2004 - 2005 SILC Project" 1>&2; + echo "Copyright (C) 2004 - 2007 SILC Project" 1>&2; echo "\ This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " 1>&2; @@ -1993,10 +2016,15 @@ else ad_fatal "DISTDEFS not defined in $distdir/autodist.conf" fi +# Get extra parameters from command line +if test $# != 0; then + shift +fi + # # Run pre-hooks # -ad_run_hooks "$pre_hooks" +ad_run_hooks "$pre_hooks" "$@" # # Generate the Makefile.am files from Makefile.ad files @@ -2030,11 +2058,12 @@ ad_debug "Creating autodist.dist" echo "dist:$distfile" > autodist.dist echo "ver:$dist_version" >> autodist.dist echo "distdir:$package-$dist_version" >> autodist.dist +echo "params:$@" >> autodist.dist # # Run post-hooks # -ad_run_hooks "$post_hooks" +ad_run_hooks "$post_hooks" "$@" ad_log "Source tree processed successfully." ad_debug "Done, now run ./configure and make."