Set PREFIX back to /usr/gnuradio, because systems that do not use /opt
[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 # Do not use /opt, because many systems do not have /opt and that
22 # risks running out of space in /.  Probably this needs OS-specific
23 # overrides.
24 PREFIX=/usr/gnuradio
25
26 echo -n "README.components START "; date
27
28 # This file provides an example of how to build GNU Radio under pkgsrc.
29
30 # Avoid using rm -rf with $PREFIX, which could be /.  Make a backup of
31 # the old prefix.
32 sudo rm -rf $PREFIX.old
33 if [ -d $PREFIX ]; then
34     sudo mv $PREFIX $PREFIX.old
35 fi
36 rm -rf BUILD.*
37
38 # Bootstrap just once, rather than once per module.
39 ./bootstrap
40
41 # Determine where prereqs come from.
42 export LDFLAGS=
43 export CPPFLAGS=
44 export PKG_CONFIG_PATH=
45 if [ -d /usr/pkg ]; then
46     # pkgsrc
47     LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
48     CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
49
50     # pkg-config is from pkgsrc, so already knows about /usr/pkg/lib/pkgconfig
51     PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PREFIX/lib/pkgconfig"
52 fi
53
54 echo LDFLAGS ,$LDFLAGS,
55 echo CPPFLAGS ,$CPPFLAGS,
56 echo PKG_CONFIG_PATH ,$PKG_CONFIG_PATH,
57
58 # Determine number of cpus and thus how many jobs to run.
59 ncpus=1
60 case x`uname` in
61     xNetBSD)
62         ncpus=`sysctl hw.ncpu|awk '{print $3}'`
63         ;;
64 esac
65 jflag=-j`expr $ncpus \* 2`
66
67 # These are currently ignored.
68 CONF_DOC_ARGS="
69 --enable-doxygen
70 --enable-dot
71 --enable-latex-docs
72 "
73 CONF_DISABLE_ALL="--disable-all-components"
74
75 # We use % instead of ' ' to be able to iterate with /bin/sh's for.
76 # This variable should list all possible arguments, in tsorted order.
77 CONF_ENABLE_ARGS="
78 --enable-omnithread
79 --with-omnithread%--enable-gnuradio-core
80 --with-omnithread%--enable-pmt
81 --with-omnithread%--with-pmt%--enable-mblock
82 --with-omnithread%--with-pmt%--with-mblock%--enable-usrp
83 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-usrp
84 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-alsa
85 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-jack
86 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-oss
87 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-osx
88 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-portaudio
89 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-windows
90 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-atsc
91 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-comedi
92 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-cvsd-vocoder
93 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-gpio
94 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-gsm-fr-vocoder
95 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-pager
96 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-radar-mono
97 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-radio-astronomy
98 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-trellis
99 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-video-sdl
100 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-wxgui
101 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-sounder
102 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--with-gr-usrp%--with-gr-wxgui%--enable-gr-utils
103 --with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gnuradio-examples
104 "
105
106 seq=0
107 for arg in $CONF_ENABLE_ARGS; do
108
109     # Convert sequence numbers and arguments to usable values.
110     seqprint=`printf "%03d" $seq`
111     argspace=`echo $arg | sed -e 's/%/ /g'`
112
113     echo "BUILDING WITH $argspace"
114
115     (
116     # configure with just one module
117     ./configure --prefix=$PREFIX $CONF_DISABLE_ALL $argspace &&
118
119     # remove all prior objects
120     make clean &&
121
122     # build
123     make $jflag &&
124
125     # install
126     sudo make install &&
127
128     echo "SUCCEEDED $argspace"
129
130     ) > BUILD.$seqprint.$arg 2>&1
131
132     seq=`expr $seq + 1`
133 done
134
135 echo -n "README.components FINISH "; date