4 # Placed into the public domain by
5 # Partition Surprise Team <surprise-dev@lists.sourceforge.net>
11 # Executable code to be included from ./autogen script
14 # defaultCONFDEFS, project, want_tarZ, upload, docdir, subdirs, CLEAN_LOCAL
26 if $automake_gnu;then for i in $automake_reqd;do if [ '!' -s "$i" ];then rm -f "$i";fi;done;fi
31 if $autogen_failed;then
33 echo -e "\n$0 failed! Try the following command to debug it: set -x"
40 if [ "$1" = help -o "$1" = -h -o "$1" = --help ];then cat <<EOHELP
41 Beware!: "autogen" is a tool only for maintainers.
44 rpm: Build RPM packages locally (needs /usr/src/(redhat|packages)/ access)
45 rpmtest: Build RPM like "rpm" but w/o gpg/pgp signing
46 rpmup: Like rpm target but also uploads the result
47 tar: Build tar file (its basename dir-based) with only vital files incl. CVS dirs
48 clean: Standard cleanup method
49 fullclean: Like clean but even the .cvsignore files are removed
50 sym: Like clean but don't remove symbolic links, should be equal (check!)
51 copy: Behave exactly like in default mode but copy all instead of symlinks
59 if [ -f "$HOME/.$project.autogen" ];then
60 . "$HOME/.$project.autogen"
62 CONFDEFS="$defaultCONFDEFS $CONFDEFS"
69 if declare -f "$func" >/dev/null;then
73 if $func_exit;then exit;fi
76 funcdo ARGS_LOCAL "$@"
78 if expr match "$1" "rpm" >/dev/null;then
79 builds="/usr/src/redhat /usr/src/packages"
81 if test -d $b;then break;fi
84 echo Build directory not reachable, searched: $builds
87 rm -r -f /var/tmp/$project-*-root $b/BUILD/$project-*
88 specsrc="$project.spec.m4.in"
89 if [ '!' -f "$specsrc" ];then specsrc="$project.spec.in";fi
90 CONFDEFS="`awk '/^(.*)\\$/{x=x$1" ";next}{print x$0;x=""}' <$specsrc \
91 |sed -n 's/^.*\.\/configure \(.*\)$/\1/p'`" ./autogen copy
92 make dist $project.spec
93 cp $project-*.tar.gz $b/SOURCES
94 if [ "$1" = "rpmtest" ];then SIGNIT=;else SIGNIT=--sign;fi
95 rpm -ba $SIGNIT $project.spec
96 if $want_tarZ;then make dist-tarZ;fi
97 rm $b/SOURCES/$project-*.tar.gz
98 mv $b/SRPMS/$project-*.src.rpm .
99 mv $b/RPMS/i386/$project-*.i386.rpm .
101 if [ "$1" = rpmup ];then
102 echo "Uploading $[`cat $project-*|wc -c`] bytes..."
103 if [ -n "$upload" ];then
104 scp -v $project-* "$upload"
106 echo "Upload not done."
115 for i in _ $subdirs;do
118 ./autogen $subdir_args
123 subdir_args="${*:-dist}"
124 if [ "$subdir_args" = "copy" ];then
125 subdir_args="copy dist"
128 # maintainer-clean hack is not safe, please list all files for 'rm'.
129 # When the filename doesn't contain '/', it is applied to ALL directories.
130 # Please note that files exactly in root dir MUST have ./ in the front
131 # (to not to be considered as ALL-directories files).
144 ./configure ./configure.scan
145 ./config.guess ./config.status ./config.sub ./config.log ./config.cache
146 ./config.h ./config.h.in
147 ./confdefs.h ./conftest* ./autoh[0-9]* ./confcache
148 ./stamp-h ./stamp-h.in
153 ./libtool ./ltconfig ./ltmain.sh
155 ./ABOUT-NLS ./COPYING
156 ./$project-[0-9]* ./$project-devel-[0-9]*
157 ./$project.spec ./$project.m4 ./$project.spec.m4
159 po/Makefile.in.in po/POTFILES* po/cat-id-tbl.c po/cat-id-tbl.tmp po/*.gmo po/*.mo po/stamp-cat-id po/$project.pot
163 if [ -n "$docdir" ];then
172 if [ "$1" != sym ];then CLEANFILES="$CLEANFILES `find . -type l`";fi
173 CLEANFILES="`echo "$CLEANFILES"|tr ' ' '\n'|sed 's,^\./\(.*/.*\)$,\1,'|sort|uniq|grep -v '^ *$'`"
176 echo "$CLEANFILES"|while read -r fi;do
177 if [ "$fi" != "${fi#*/}" ];then
178 echo "$fi" >>"$t.discard"
179 else echo "-o -name $fi" >>"$t.find"
181 for dirpatt in `(find . -type d '!' \( -name CVS $(sed 's,[]*?[],\\&,g' <"$t.find") \)|sort|uniq;cat "$t.discard")|sort|uniq -u`;do
182 for dir in $dirpatt;do if test -d $dir;then
184 (echo "$CLEANFILES" #ALL-dir files
185 echo "$CLEANFILES"|sed -n "s,^\\$(echo $dir|sed 's,^\./,,')/,,p" #THIS-dir files
186 echo .cvsignore #MUST be last!
187 )|grep -v / >.cvsignore
188 if [ "$1" = "${1#tar}" ];then
190 if [ "$1" = fullclean ];then cat .cvsignore
191 else grep -v '^\.cvsignore' <.cvsignore
197 rm -f "$t.find" "$t.discard"
198 if [ "$1" = tarprep ];then
202 if [ "$1" = tar ];then
205 mydir="$(basename `pwd`)"
208 $(for fi in `find "$mydir" -name .cvsignore`;do sed "s,^,--exclude=`dirname $fi`/," <$fi;done) \
213 if [ "$1" != "${1#*clean}" ];then
219 funcdo PREP_LOCAL "$@"
222 if [ "$1" = copy ];then COPY=--copy;shift
223 else unset COPY|cat # |cat construction is used to not fail in "set -e" state
230 if test -d macros;then
231 aclocal_opts="-I macros $aclocal_opts"
233 aclocal $aclocal_opts
234 if $want_gettext;then
236 rm -f aclocal.m4 # We delete created aclocal.m4 as it's just bug in gettextize. It shouldn't link that file here
237 aclocal $aclocal_opts # gettextize made some changes of files which need to be reflected
239 if $want_libtool;then
244 if $automake_gnu;then
245 automake_reqd="$automake_reqd ChangeLog README"
246 automake_opts="$automake_opts --gnu"
247 for i in $automake_reqd;do if [ '!' -f "$i" ];then touch "$i";fi;done
249 automake --add-missing $COPY $automake_opts
254 if [ "$1" != dist ];then
255 # shared/static switching cannot be based on maintainer-mode in configure
256 ./configure --enable-maintainer-mode --enable-shared --disable-static $CONFDEFS