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