Add support for packaging openflowext.
[sliver-openvswitch.git] / boot.sh
1 #! /bin/sh -e
2
3 have_ext=$(if test -e ext/automake.mk; then echo yes; else echo no; fi)
4 for opt
5 do
6     case $opt in
7         (--enable-ext) have_ext=yes ;;
8         (--disable-ext) have_ext=no ;;
9         (--help) cat <<EOF
10 $0: bootstrap OpenFlow from a Git repository
11 usage: $0 [OPTIONS]
12 The recognized options are:
13   --enable-ext      include openflowext
14   --disable-ext     exclude openflowext
15 By default, openflowext is included if it is present.
16 EOF
17         exit 0
18         ;;
19         (*) echo "unknown option $opt; use --help for help"; exit 1 ;;
20     esac
21 done
22
23 # Generate list of files in debian/ to distribute.
24 (echo '# Automatically generated by boot.sh (from Git tree).' &&
25  printf 'EXTRA_DIST += \\\n' &&
26  git ls-files debian | grep -v '^debian/\.gitignore$' | 
27  sed -e 's/\(.*\)/      \1 \\/' -e '$s/ \\//') > debian/automake.mk
28
29 # Enable or disable ext.
30 if test "$have_ext" = yes; then
31     echo 'Enabling openflowext...'
32     echo 'include ext/automake.mk' > ext.mk
33     echo 'm4_include([ext/configure.m4])' > ext.m4
34     cat debian/control.in ext/debian/control.in > debian/control
35     for d in $(cd ext/debian && git ls-files --exclude-from=debian/dontlink)
36     do
37         test -e debian/$d || ln -s ../ext/debian/$d debian/$d
38         if ! fgrep -q $d debian/.gitignore; then
39             echo "Adding $d to debian/.gitignore"
40             (cat debian/.gitignore && printf '/%s' "$d") \
41                 | LC_ALL=C sort > tmp$$ \
42                 && mv tmp$$ debian/.gitignore
43         fi
44     done
45 else
46     echo 'Disabling openflowext...'
47     echo '# This file intentionally left blank.' > ext.mk
48     echo '# This file intentionally left blank.' > ext.m4
49     cat debian/control.in > debian/control
50 fi
51
52 # Bootstrap configure system from .ac/.am files
53 autoreconf --install -I config --force