forked from IRATI/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·131 lines (114 loc) · 3.56 KB
/
configure
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
#!/bin/bash
BUILDDIR=`pwd`/build
SRCDIR=`pwd`
FLAGS="--enable-debug"
TCP_UDP_BUFFER_SIZE=1500
INSTALL_PREFIX="/"
KERNBUILDDIR="/lib/modules/`uname -r`/build"
BUILD_USER="y"
# Option parsing
while [[ $# > 0 ]]
do
key="$1"
case $key in
"--prefix")
if [ -n "$2" ]; then
INSTALL_PREFIX=$2
shift
else
echo "--prefix requires a path argument"
exit 255
fi
;;
"--tcp-udp-buffer-size")
if [ -n "$2" ]; then
TCP_UDP_BUFFER_SIZE=$2
shift
else
echo "--tcp-udp-buffer-size requires a value argument"
exit 255
fi
;;
"--kernbuilddir")
if [ -n "$2" ]; then
KERNBUILDDIR=$2
shift
else
echo "--kernbuilddir requires a path argument"
exit 255
fi
;;
"--no-user")
BUILD_USER="n"
;;
*)
echo "Unknown option '$key'"
exit 255
;;
esac
shift
done
# Generate the main Makefile
cp Makefile.in Makefile
sed -i "s|@KERNBUILDDIR@|${KERNBUILDDIR}|g" Makefile
sed -i "s|@INSTALLDIR@|${INSTALL_PREFIX}|g" Makefile
(cd kernel && ./configure --kernbuilddir $KERNBUILDDIR --tcp-udp-buffer-size $TCP_UDP_BUFFER_SIZE) || {
echo "Cannot complete kernel configuration"
exit 1
}
if [ "$BUILD_USER" == "n" ]; then
exit 0
fi
echo "Installation directory will be \`$INSTALL_PREFIX'"
if test -n "$INSTALL_PREFIX" ; then
mkdir -p $INSTALL_PREFIX || {
echo "Cannot create directory \`$INSTALL_PREFIX'"
}
fi
echo "Build directory will be \`$BUILDDIR'"
rm -rf $BUILDDIR
if test -n "$BUILDDIR" ; then
mkdir -p $BUILDDIR || {
echo "Cannot create directory \`$BUILDDIR'"
}
fi
echo "Java directory will be \`$BUILDDIR/java'"
if test -n "$BUILDDIR/java" ; then
mkdir -p $BUILDDIR/java || {
echo "Cannot create directory \`$BUILDDIR/java'"
}
fi
echo "Creating symbolic links within librina folder"
(cd librina/src && ln -sf ../../common/ker-numtables.c ker-numtables.c && ln -sf ../../common/serdes-utils.c serdes-utils.c)
(cd librina/src && mkdir irati && cd irati && ln -sf ../../../include/irati/kucommon.h kucommon.h && ln -sf ../../../include/irati/kernel-msg.h kernel-msg.h && ln -sf ../../../include/irati/serdes-utils.h serdes-utils.h)
echo "Starting librina phase"
(cd librina && ./bootstrap) || {
echo "Cannot bootstrap"
exit 1
}
(mkdir -p $BUILDDIR/librina && cd $BUILDDIR/librina && $SRCDIR/librina/configure --disable-java-bindings $FLAGS --prefix=$INSTALL_PREFIX && make clean install) || {
echo "Cannot complete librina phase"
exit 1
}
echo "Starting rinad phase"
(cd rinad && ./bootstrap) || {
echo "Cannot bootstrap"
exit 1
}
(mkdir -p $BUILDDIR/rinad && cd $BUILDDIR/rinad && PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig LD_LIBRARY_PATH=$INSTALL_PREFIX/lib:$LD_LIBRARY_PATH $SRCDIR/rinad/configure --prefix=$INSTALL_PREFIX --disable-java-bindings $FLAGS) || {
echo "Cannot complete rinad phase"
echo "LIBRINA Version ="
pkg-config --modversion librina
exit 1
}
echo "Starting rina-tools phase"
(cd rina-tools && ./bootstrap) || {
echo "$ME: Cannot bootstrap"
exit 1
}
(mkdir -p $BUILDDIR/rina-tools && cd $BUILDDIR/rina-tools && PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig LD_LIBRARY_PATH=$INSTALL_PREFIX/lib:$LD_LIBRARY_PATH $SRCDIR/rina-tools/configure $FLAGS --prefix=$INSTALL_PREFIX) || {
echo "Cannot complete rina-tools phase"
echo "LIBRINA Version ="
pkg-config --modversion librina
exit 1
}