File: configure.curvedns

package info (click to toggle)
curvedns 0.87-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,964 kB
  • sloc: asm: 19,669; ansic: 11,907; cpp: 1,066; sh: 954; makefile: 57
file content (112 lines) | stat: -rwxr-xr-x 2,818 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash

# XXX: make it POSIX-shell compatible (select isn't)

start="`pwd`"
top="`pwd`/nacl/build"
bin="$top/bin"
lib="$top/lib"
include="$top/include"
work="$top/work"
curve="$work/curvedns"

PATH="/usr/local/bin:$PATH"
PATH="/usr/sfw/bin:$PATH"
PATH="$bin:$PATH"
export PATH

# ------------------- funcs

doMakefile() {
  sed -e "s/@ABI@/$abi/g" \
      -e "s/@CC@/$compiler/" \
      -e "s/@CFLAGS@/$cflags/" \
          Makefile.in > Makefile
}

# ------------------- NaCl stuff

if [ ! -d "$bin" ] || [ ! -d "$work" ]; then
  echo "No NaCl build that is ready for deployment yet, did you run 'configure.nacl'?"
  exit 1
fi

if [ -z "$1" ] && ([ -f "$curve"/abi ] || [ -f "$curve"/compiler ] || [ -f "$curve"/cflags ]); then
  echo "You have already picked an ABI, compiler, or -options for CurveDNS:"
  [ -f "$curve"/abi ] && ( echo -n "ABI:			"; cat "$curve"/abi )
  [ -f "$curve"/compiler ] && ( echo -n "Compiler:		"; cat "$curve"/compiler )
  [ -f "$curve"/cflags ] && ( echo -n "Compiler options:	"; cat "$curve"/cflags )
  echo
  echo "If you want to change this, remove the following directory and rerun:"
  echo "$curve"
  if [ -f "$curve"/abi ] && [ -f "$curve"/compiler ] && [ -f "$curve"/cflags ]; then
    echo
    echo "Nevertheless, a new Makefile has been generated."
    abi=`cat "$curve"/abi`
    compiler=`cat "$curve"/compiler`
    cflags=`cat "$curve"/cflags`
    doMakefile
    exit 0
  fi
  exit 1
fi

rm -rf "$curve"
mkdir "$curve"

cd "$bin"

# Saving intermediate result in a file, because subprocesses (okabi opens a pipe) kill local vars:
okabi \
| while read abi
do
  echo "$abi" > "$curve"/lastabi
done

abis=`okabi | wc -l`
lastabi=`cat "$curve"/lastabi`

rm -f "$curve"/*

if [ "$abis" -gt 1 ] && [ -z "$1" ]; then
  echo "There are more than one application binary interfaces generated for your "
  echo "system, which one do you want to use for CurveDNS?"
  select abi in $(okabi); do
    if [ -n "$abi" ]; then break; fi
  done
  echo $abi > "$curve"/abi
elif [ "$abis" -gt 1 ] && [ ! -z "$1" ]; then
  echo "$1" > "$curve"/abi
else
  echo "$lastabi" > "$curve"/abi
fi

abi=`cat "$curve"/abi`

if [ ! -f "okc-$abi" ]; then
  echo "Did not find any suitable compiler for this ABI, does the '$abi' ABI exist?"
  rm -rf "$curve"
  exit 1
fi

compiler=`okc-$abi | tail -1 | cut -d' ' -f1`
cflags=`okc-$abi | tail -1 | cut -d' ' -f2-`

echo "$compiler" > "$curve"/compiler
echo "$cflags" > "$curve"/cflags

# --------------------- Regular configure stuff

cd "$start"

doMakefile

echo "Finished configuring CurveDNS, ready for compiling."
echo -n "Chosen/picked ABI:		"
cat "$curve"/abi
echo -n "Chosen/picked compiler:		"
cat "$curve"/compiler
echo -n "Chosen/picked compiler options:	"
cat "$curve"/cflags
echo
echo "We are now ready to compile, run 'make' to do so."