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
|
#!/bin/bash
#
# TODO:
#
# - modify parser to understand --prefix=/foo, not only --prefix /foo
#
# - test for ncurses headers:
#
# @echo -e "#include \"ncurses.h\"\nint main(void){}" | gcc -E - > /dev/null; \
# if [ "$$?" = "1" ]; then \
# echo; \
# echo "Error: you don't seem to have ncurses.h; this probably means"; \
# echo " that you'll have to install some ncurses-devel packet"; \
# echo " from your distribution."; \
# echo; \
# exit 1; \
# fi
#
PROMPT="ptxdist: "
PTXDIST_TOPDIR=$(cd $(dirname $0) && pwd)
#
# we need the PTXdist shell library
#
libptxdist=${PTXDIST_TOPDIR}/scripts/libptxdist.sh
if [ -e "$libptxdist" ]; then
. $libptxdist
else
echo "${PROMPT}didn't find \$(PTXDIST_TOPDIR)/scripts/libptxdist.sh"
exit 1
fi
#
# we need the static variable definitions
#
ptxdistvars=${PTXDIST_TOPDIR}/scripts/ptxdistvars.sh
if [ -e "$ptxdistvars" ]; then
. $ptxdistvars
else
echo "${PROMPT}didn't find \$(PTXDIST_TOPDIR)/scripts/ptxdistvars.sh"
exit 1
fi
#
# main()
#
PROGRAM_DESCRIPTION="PTXdist configure"
source $(cat << EOF | ptxd_generic_option_parser
PREFIX prefix <dir> Set Installation Directory
EOF
)
invoke_parser $@
prefix=${PREFIX:="/usr/local"}
libdir="${prefix}/lib"
bindir="${prefix}/bin"
instdir="${libdir}/ptxdist-${FULLVERSION}"
echo "checking version=${FULLVERSION}"
echo "checking prefix=${prefix}"
echo "checking topdir=${PTXDIST_TOPDIR}"
echo "checking instdir=${instdir}"
# substitute variables
echo "creating Makefile"
cat "${PTXDIST_TOPDIR}/Makefile.in" | \
sed -e "s,@PREFIX@,\"${prefix}\",g" | \
sed -e "s,@TOPDIR@,\"${PTXDIST_TOPDIR}\",g" | \
sed -e "s,@INSTDIR@,\"${instdir}\",g" | \
sed -e "s,@VERSION@,\"${FULLVERSION}\",g" \
> ${PTXDIST_TOPDIR}/Makefile
|