3d678def67d77d3f07d0c58cf857fd3c4bf8703b
[debian/gnuradio] / README.components
1 #!/bin/sh
2  
3 # $Id$
4
5 # Copyright 2008 Free Software Foundation.
6 #
7 # DO NOT RUN THIS SCRIPT UNTIL YOU UNDERSTAND IT!!!  IT WILL REMOVE
8 # FILES ON YOUR SYSTEM.
9 #
10 # Read the script thoroughly before running it; it will *remove*
11 # /usr/local/gnuradio and repopulate it.
12 #
13 # This script provides a way to build GNU Radio modules individually,
14 # and both serves as an example of using the component build system
15 # and provides a way to test the build system.  When run, it will
16 # build and install each GNU Radio module in turn, using the
17 # just-installed modules as prerequisites.  It places the output of
18 # each build in a separate file BUILD.NNN.options, so that one can do
19 # 'tail -f BUILD.*' to see which components were successfully built.
20
21 # This script is intended to be broadly portable; be careful when
22 # modifying not to cause problems on systems that place dependencies
23 # in other than /usr
24 #
25 # Besides GNU Radio dependencies, this program requires sudo, with a
26 # timer long enough to build each module (or no password requirement).
27 #
28
29 set -x
30
31 # Do not use /opt, because many systems do not have /opt and that
32 # risks running out of space in /.  /usr/local/gnuradio is believed to
33 # be reasonable on all of *BSD and GNU/Linux.  Probably this needs
34 # OS-specific overrides.
35 PREFIX=/usr/local/gnuradio
36
37 echo "ABOUT TO COMPLETELY REMOVE $PREFIX in 10 SECONDS!"
38 sleep 10
39
40 echo -n "README.components START "; date
41
42 # This file provides an example of how to build GNU Radio under pkgsrc.
43
44 # Avoid using rm -rf with $PREFIX, which could be /.  Make a backup of
45 # the old prefix.
46 sudo rm -rf $PREFIX.old
47 if [ -d $PREFIX ]; then
48     sudo mv $PREFIX $PREFIX.old
49 fi
50 rm -rf BUILD.*
51
52 # Bootstrap just once, rather than once per module.
53 ./bootstrap
54
55 # Determine where prereqs come from.
56 export LDFLAGS=
57 export CPPFLAGS=
58 export PKG_CONFIG_PATH=
59 if [ -d /usr/pkg ]; then
60     # pkgsrc
61     LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
62     CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
63
64     # pkg-config is from pkgsrc, so already knows about /usr/pkg/lib/pkgconfig
65     PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PREFIX/lib/pkgconfig"
66 fi
67
68 echo LDFLAGS ,$LDFLAGS,
69 echo CPPFLAGS ,$CPPFLAGS,
70 echo PKG_CONFIG_PATH ,$PKG_CONFIG_PATH,
71
72 # Determine number of cpus and thus how many jobs to run.
73 ncpus=1
74 case x`uname` in
75     xNetBSD)
76         ncpus=`sysctl hw.ncpu|awk '{print $3}'`
77         ;;
78 esac
79 jflag=-j`expr $ncpus \* 2`
80
81 # These are currently ignored.
82 CONF_DOC_ARGS="
83 --enable-doxygen
84 --enable-dot
85 --enable-latex-docs
86 "
87 CONF_DISABLE_ALL="--disable-all-components"
88
89 # We use % instead of ' ' to be able to iterate with /bin/sh's for.
90 # This variable should list all possible arguments, in tsorted order.
91 CONF_ENABLE_ARGS="
92 --enable-omnithread
93 --with-omnithread%--enable-gnuradio-core
94 --with-omnithread%--enable-pmt
95 --with-omnithread%--with-pmt%--enable-mblock
96 --with-omnithread%--with-pmt%--with-mblock%--enable-usrp
97 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-usrp
98 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-alsa
99 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-jack
100 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-oss
101 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-osx
102 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-portaudio
103 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-windows
104 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-atsc
105 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-comedi
106 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-cvsd-vocoder
107 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-gpio
108 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-gsm-fr-vocoder
109 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-pager
110 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-radar-mono
111 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-radio-astronomy
112 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-trellis
113 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-video-sdl
114 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-wxgui
115 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-sounder
116 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--with-gr-usrp%--with-gr-wxgui%--enable-gr-utils
117 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gnuradio-examples
118 "
119
120 seq=0
121 for arg in $CONF_ENABLE_ARGS; do
122
123     # Convert sequence numbers and arguments to usable values.
124     seqprint=`printf "%03d" $seq`
125     argspace=`echo $arg | sed -e 's/%/ /g'`
126
127     echo "BUILDING WITH $argspace"
128
129     (
130     # configure with just one module
131     ./configure --prefix=$PREFIX $CONF_DISABLE_ALL $argspace &&
132
133     # remove all prior objects
134     make clean &&
135
136     # build
137     make $jflag &&
138
139     # install
140     sudo make install &&
141
142     echo "SUCCEEDED $argspace"
143
144     ) > BUILD.$seqprint.$arg 2>&1
145
146     seq=`expr $seq + 1`
147 done
148
149 echo -n "README.components FINISH "; date