aboutsummaryrefslogtreecommitdiffstats
path: root/japanese/postgresql-tcltk/scripts/configure.postgresql
blob: 6215d5b6dad3e006b9f3771a04dc794383787caa (plain) (blame)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#!/bin/sh
# -*- tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD: /tmp/pcvs/ports/japanese/postgresql-tcltk/scripts/Attic/configure.postgresql,v 1.3 2001-06-13 15:30:50 knu Exp $
#
if [ -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc ]; then
    exit
fi

if [ ! "${BATCH}" ]; then
    dialog --title "Backup your data NOW" \
    --msgbox "`sed -e \"s#%%PREFIX%%#${PREFIX}#\" < ${FILESDIR}/pre-install-notes`" \
    -1 -1
fi

if [ "${BATCH}" ]; then
    set \"MultiByte\" \"ODBC\" \"SSL\" \"TCL\" \"TCLTK\"
else
    /usr/bin/dialog --title "configuration options" --clear \
                    --checklist "\n\
Please select desired options:" -1 -1 7 \
JDBC       "Java DataBase Connectivity" OFF \
MultiByte  "Multibyte for Multilingualism" ON \
ODBC       "Open Database Connectivity" ON \
TCL        "Tcl" ON \
TCLTK      "Tcl/Tk" ON \
SSL        "Secure Socket Layer" ON \
KRB5       "Kerberos 5" OFF \
2> /tmp/checklist.tmp.$$

    retval=$?

    if [ -s /tmp/checklist.tmp.$$ ]; then
        set `cat /tmp/checklist.tmp.$$`
    fi
    rm -f /tmp/checklist.tmp.$$

    case $retval in
        0)  if [ -z "$*" ]; then
                echo "Nothing selected"
            fi
            ;;
        1)  echo "Cancel pressed."
            exit 1
            ;;
    esac
fi

${MKDIR} ${WRKDIRPREFIX}${CURDIR}
exec > ${WRKDIRPREFIX}${CURDIR}/Makefile.inc

while [ "$1" ]; do
    case $1 in
        \"JDBC\")
            # We use JAVA_HOME if set correctly. If the user has
            # specified a JVM with JAVA_HOME or via the javavmwrapper,
            # we validate that it really exists. It is unnecessarily
            # complicated and error prone to try to figure out the
            # correct java version just to be able to determine a
            # BUILD_DEPEND in this case. Instead, assume that a set
            # JAVA_HOME together with simple sanity check mean we have
            # an installed JVM, and we don't bother setting
            # BUILD_DEPENDS.

            echo "# JDBC"
            # if JAVA_HOME is set and exists, use it
            if [ "${JAVA_HOME}" -a -x "${JAVA_HOME}/bin/javac" ]; then
                echo JAVA_HOME=${JAVA_HOME}
            else
                # No JAVA_HOME, check javavmwrapper's config file
                if [ -r "${LOCALBASE}/etc/javavms" ]; then
                    VMS=`/usr/bin/sed 's|#.*||' < "${LOCALBASE}/etc/javavms" | uniq`
                    for JAVAVM in ${VMS}; do
                        if [ -x "${JAVAVM}" ]; then
                            JAVA_HOME=`echo ${JAVAVM} | /usr/bin/sed 's|/bin/java$||`
                            break
                        fi
                    done
                fi
                if [ "${JAVA_HOME}" -a -x "${JAVA_HOME}/bin/javac" ]; then
                    # yep, wrapper was good
                    echo JAVA_HOME=${JAVA_HOME}
                else
                    # nothing, use our boring 1.1.8, the only native non-beta jdk :(
                    echo BUILD_DEPENDS+=    \${LOCALBASE}/jdk1.1.8/bin/javac:\${PORTSDIR}/java/jdk
                    echo JAVA_HOME=\${LOCALBASE}/jdk1.1.8
                fi
            fi
            cat <<-EOF
                BUILD_DEPENDS+= \${LOCALBASE}/bin/ant:\${PORTSDIR}/devel/jakarta-ant
                CONFIGURE_ENV+= ANT=\${LOCALBASE}/bin/ant
                WITH_JDBC=YES
                MAKE_ENV+=  JAVA_HOME=\${JAVA_HOME}
                SCRIPTS_ENV+=   JAVA_HOME=\${JAVA_HOME}
                CONFIGURE_ARGS+=    --with-java

            EOF
            ;;
        \"MultiByte\")
            MULTIBYTE=1
            ;;
        \"ODBC\")
            cat <<-EOF
                # ODBC
                WITH_ODBC=YES
                CONFIGURE_ARGS+=  --with-odbc

            EOF
            ;;
        \"TCL\")
            TCL=1
            ;;
        \"TCLTK\")
            echo "#TCLTK"
            echo WITH_TK=YES
            echo
            TCL=1
            ;;
        \"SSL\")
            cat <<-EOF
                # SSL
                USE_OPENSSL=    yes
                CFLAGS+=    -DUSE_SSL
                WITH_SSL=   yes
                CONFIGURE_ENV+= LDFLAGS="-L\${OPENSSLLIB} -lssl -lcrypto"
                CONFIGURE_ARGS+=    --with-openssl

            EOF
            ;;
        \"KRB5\")
            KRB5=1
            ;;
        \"nothing\"|true)
            ;;
        *)
            echo "Invalid option(s): $*" > /dev/stderr
            rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
            exit 1
            ;;
    esac
    shift
done

exec > /dev/stderr

# if multibyte, determine charset
echo "# Multibyte" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc

if [ ! "${MULTIBYTE}" ]; then
    echo "WITHOUT_MULTIBYTE=YES" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
else
    if [ "${BATCH}" ]; then
        set "nothing"
    else
        /usr/bin/dialog --title "configuration options" --clear \
                        --radiolist "\n\
Please select desired options:" -1 -1 16 \
EUC_JP        "EUC_JP" ON  \
SQL_ASCII     "SQL_ASCII" OFF \
LATIN1        "LATIN1" OFF \
LATIN2        "LATIN2" OFF \
LATIN3        "LATIN3" OFF \
LATIN4        "LATIN4" OFF \
LATIN5        "LATIN5" OFF \
EUC_KR        "EUC_KR" OFF \
EUC_TW        "EUC_TW" OFF \
KOI8          "KOI8" OFF \
UNICODE       "UNICODE" OFF \
MULE_INTERNAL "MULE_INTERNAL" OFF \
WIN           "WIN" OFF \
ALT           "ALT" OFF \
2> /tmp/checklist.tmp.$$

        retval=$?

        if [ -s /tmp/checklist.tmp.$$ ]; then
            set `cat /tmp/checklist.tmp.$$`
        fi
        rm -f /tmp/checklist.tmp.$$
        if [ $retval = 1 ]; then
            echo "Cancel pressed."
            rm ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
            exit 1
        fi
    fi

    if [ "$1" = "nothing" ]; then
        echo "CONFIGURE_ARGS+=  --enable-multibyte" \
            >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
    else
        echo "CONFIGURE_ARGS+=  --enable-multibyte=$1" \
            >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
    fi
fi
echo

if [ "${TCL}" ]; then
    echo "# TCL" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
    if [ "${BATCH}" ]; then
        echo WITH_TCL=8.0jp  >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
    else
        dialog --title "TCL version" \
               --inputbox "Please enter japanese TCL version. Default is 8.0jp." -1 -1 "8.0jp" \
            2> /tmp/checklist.tmp.$$
        retval=$?
        if [ -s /tmp/checklist.tmp.$$ ]; then
            set `cat /tmp/checklist.tmp.$$`
        fi
        rm -f /tmp/checklist.tmp.$$
        case $retval in
            0)  if [ -z "$*" ]; then
                    echo "Nothing selected"
                fi
                ;;
            1)  echo "Cancel pressed."
                rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
                exit 1
                ;;
        esac
        echo WITH_TCL=\"$1\" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
    fi
    cat <<-EOF >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
        CONFIGURE_ARGS+= --with-tcl --with-tclconfig="\${TCLCONFIG}"
        TCLV=\${WITH_TCL:S/.//}
        TCLP=\${TCLV:S/jp//}
        TCL_INCDIR=     \${LOCALBASE}/include/tcl\${WITH_TCL}
        MAKE_ENV+=      TCL_INCDIR=\${TCL_INCDIR}
        LIB_DEPENDS+=   tcl\${TCLV}:\${PORTSDIR}/japanese/tcl\${TCLP}
        TCLCONFIG=      "\${LOCALBASE}/lib/tcl\${WITH_TCL}"
        .if defined(WITH_TK)
        CONFIGURE_ARGS+= --with-tkconfig="\${TKCONFIG}"
        TK_INCDIR=      \${LOCALBASE}/include/tk\${WITH_TCL}
        CONFIGURE_ENV+= WISH=\${LOCALBASE}/bin/wish\${WITH_TCL}
        LIB_DEPENDS+=   tk\${TCLV}:\${PORTSDIR}/japanese/tk\${TCLP}
        TKCONFIG=       "\${LOCALBASE}/lib/tk\${WITH_TCL}"
        TCLCONFIG+=     \${TKCONFIG}
        TCL_PLIST=     pkg-plist.tcl
        .else
        TCL_PLIST=     pkg-plist.notk
        CONFIGURE_ARGS+=        --without-tk
        .endif

    EOF
fi

if [ "${KRB5}" ]; then
    if [ "${BATCH}" ]; then
        # never gets here, but what the heck...
        echo KRB5_HOME=\${LOCALBASE} >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
    else
        dialog --inputbox "Please enter the KRB5_HOME path" -1 -1 "${KRB_HOME:-${LOCALBASE}}" \
            2> /tmp/checklist.tmp.$$
        retval=$?
        if [ -s /tmp/checklist.tmp.$$ ]; then
            set `cat /tmp/checklist.tmp.$$`
        fi
        rm -f /tmp/checklist.tmp.$$
        case $retval in
            0)  if [ -z "$*" ]; then
                    echo "No input"
                fi
                ;;
            1)  echo "Cancel pressed."
                rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
                exit 1
                ;;
        esac
        echo KRB5_HOME=\"$1\" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
    fi
    cat <<-EOF >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
        .if defined(KRB5_HOME) && exists(\${KRB5_HOME})
        CONFIGURE_KRB=  --with-krb5=\${KRB5_HOME}
        .endif

    EOF
fi