summaryrefslogtreecommitdiff
path: root/README.components
blob: 3d678def67d77d3f07d0c58cf857fd3c4bf8703b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/sh
 
# $Id$

# Copyright 2008 Free Software Foundation.
#
# DO NOT RUN THIS SCRIPT UNTIL YOU UNDERSTAND IT!!!  IT WILL REMOVE
# FILES ON YOUR SYSTEM.
#
# Read the script thoroughly before running it; it will *remove*
# /usr/local/gnuradio and repopulate it.
#
# This script provides a way to build GNU Radio modules individually,
# and both serves as an example of using the component build system
# and provides a way to test the build system.  When run, it will
# build and install each GNU Radio module in turn, using the
# just-installed modules as prerequisites.  It places the output of
# each build in a separate file BUILD.NNN.options, so that one can do
# 'tail -f BUILD.*' to see which components were successfully built.

# This script is intended to be broadly portable; be careful when
# modifying not to cause problems on systems that place dependencies
# in other than /usr
#
# Besides GNU Radio dependencies, this program requires sudo, with a
# timer long enough to build each module (or no password requirement).
#

set -x

# Do not use /opt, because many systems do not have /opt and that
# risks running out of space in /.  /usr/local/gnuradio is believed to
# be reasonable on all of *BSD and GNU/Linux.  Probably this needs
# OS-specific overrides.
PREFIX=/usr/local/gnuradio

echo "ABOUT TO COMPLETELY REMOVE $PREFIX in 10 SECONDS!"
sleep 10

echo -n "README.components START "; date

# This file provides an example of how to build GNU Radio under pkgsrc.

# Avoid using rm -rf with $PREFIX, which could be /.  Make a backup of
# the old prefix.
sudo rm -rf $PREFIX.old
if [ -d $PREFIX ]; then
    sudo mv $PREFIX $PREFIX.old
fi
rm -rf BUILD.*

# Bootstrap just once, rather than once per module.
./bootstrap

# Determine where prereqs come from.
export LDFLAGS=
export CPPFLAGS=
export PKG_CONFIG_PATH=
if [ -d /usr/pkg ]; then
    # pkgsrc
    LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
    CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"

    # pkg-config is from pkgsrc, so already knows about /usr/pkg/lib/pkgconfig
    PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PREFIX/lib/pkgconfig"
fi

echo LDFLAGS ,$LDFLAGS,
echo CPPFLAGS ,$CPPFLAGS,
echo PKG_CONFIG_PATH ,$PKG_CONFIG_PATH,

# Determine number of cpus and thus how many jobs to run.
ncpus=1
case x`uname` in
    xNetBSD)
	ncpus=`sysctl hw.ncpu|awk '{print $3}'`
	;;
esac
jflag=-j`expr $ncpus \* 2`

# These are currently ignored.
CONF_DOC_ARGS="
--enable-doxygen
--enable-dot
--enable-latex-docs
"
CONF_DISABLE_ALL="--disable-all-components"

# We use % instead of ' ' to be able to iterate with /bin/sh's for.
# This variable should list all possible arguments, in tsorted order.
CONF_ENABLE_ARGS="
--enable-omnithread
--with-omnithread%--enable-gnuradio-core
--with-omnithread%--enable-pmt
--with-omnithread%--with-pmt%--enable-mblock
--with-omnithread%--with-pmt%--with-mblock%--enable-usrp
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-usrp
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-alsa
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-jack
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-oss
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-osx
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-portaudio
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-audio-windows
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-atsc
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-comedi
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-cvsd-vocoder
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-gpio
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-gsm-fr-vocoder
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-pager
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-radar-mono
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-radio-astronomy
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-trellis
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-video-sdl
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gr-wxgui
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--enable-gr-sounder
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--with-usrp%--with-gr-usrp%--with-gr-wxgui%--enable-gr-utils
--with-omnithread%--with-gnuradio-core%--with-pmt%--with-mblock%--enable-gnuradio-examples
"

seq=0
for arg in $CONF_ENABLE_ARGS; do

    # Convert sequence numbers and arguments to usable values.
    seqprint=`printf "%03d" $seq`
    argspace=`echo $arg | sed -e 's/%/ /g'`

    echo "BUILDING WITH $argspace"

    (
    # configure with just one module
    ./configure --prefix=$PREFIX $CONF_DISABLE_ALL $argspace &&

    # remove all prior objects
    make clean &&

    # build
    make $jflag &&

    # install
    sudo make install &&

    echo "SUCCEEDED $argspace"

    ) > BUILD.$seqprint.$arg 2>&1

    seq=`expr $seq + 1`
done

echo -n "README.components FINISH "; date