How many people do you need Oracle Instant Client8 on FreeBSD?
Norikatsu Shigemura
nork at FreeBSD.org
Fri May 6 09:41:43 PDT 2005
How many people do you need Oracle Instant Client a.k.a.
OCI8 on FreeBSD native applications?
I am tring to use FreeBSD native php5-oci8 with Linux
Plugin Wrapper (LPW) technorogy. My attempt succeeded,
but it doesn't work. Because there are many functions
to have to convert Linux ones to FreeBSD ones. It is a
deadlock in me.
And so, anyone do you try to implement these ones?
-------------------------------------------------------
Step 1-5:
1. Get experimental LPW from following URL(use net/cvsync).
cvsync://cvsync.ninth-nine.com/LinuxPluginWrapper/
2. Compile and install LPW and set /etc/libmap.conf.
I confirmed on 6-current. I don't know [45]-stable.
3. Install following ports.
ports/databases/linux-oracle-instantclient-sdk
ports/databases/linux-oracle-instantclient-basic
4. Install following 000.oci8.sh script to /usr/local/etc/rc.d/
---------------------------------------------------------------
#!/bin/sh
# PROVIDE: oci8
# REQUIRE: ldconfig
# KEYWORD: FreeBSD
. /etc/rc.subr
name=oci8
start_cmd=oci8_start
stop_cmd=:
[ -z "$oci8_libdir" ] && oci8_libdir="/compat/linux/usr/lib/oracle/10.1.0.3/client/lib"
oci8_start() {
if [ -d "$oci8_libdir" ]; then
/sbin/ldconfig -m "$oci8_libdir"
fi
}
load_rc_config $name
run_rc_command "$1"
---------------------------------------------------------------
5. Test, please follwoing port skelton.
---------------------------------------------------------------
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# php5-oci8/Makefile
# php5-oci8/files/patch-config.m4
#
echo x - php5-oci8/Makefile
sed 's/^X//' >php5-oci8/Makefile << 'END-of-php5-oci8/Makefile'
X# New ports collection makefile for: php5-oci8
X# Date created: 2005-04-26
X# Whom: nork at FreeBSD.org
X#
X# $FreeBSD$
X#
X
XCATEGORIES= databases
X
XMASTERDIR= ${PORTSDIR}/lang/php5
X
XPKGNAMESUFFIX= -oci8
X
X.include "${MASTERDIR}/Makefile"
X
X.if ${PHP_MODNAME} == "oci8"
XOCI8_VER= 10.1.0.3
XBUILD_DEPENDS+= ${LINUXBASE}/usr/include/oracle/${OCI8_VER}/client/oci.h:${PORTSDIR}/local/linux-oracle-instantclient-sdk
XRUN_DEPENDS+= ${LINUXBASE}/usr/include/oracle/${OCI8_VER}/client/oci.h:${PORTSDIR}/local/linux-oracle-instantclient-sdk
X
XCONFIGURE_ARGS+=--with-oci8-instant-client=${LINUXBASE}/usr/lib/oracle/10.1.0.3/client/lib
X.endif
X
X
X
X#CONFIGURE_ENV+= LDFLAGS=-R${LINUXBASE}/usr/lib/oracle/10.1.0.3/client/lib /bin/sh -x
END-of-php5-oci8/Makefile
echo x - php5-oci8/files/patch-config.m4
sed 's/^X//' >php5-oci8/files/patch-config.m4 << 'END-of-php5-oci8/files/patch-config.m4'
X--- config.m4.orig Fri Feb 25 20:32:01 2005
X+++ config.m4 Sun May 1 23:48:55 2005
X@@ -18,31 +18,6 @@
X ])
X ])
X
X-AC_DEFUN([AC_OCI8_VERSION],[
X- AC_MSG_CHECKING([Oracle version])
X- if test -s "$OCI8_DIR/orainst/unix.rgs"; then
X- OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
X- test -z "$OCI8_VERSION" && OCI8_VERSION=7.3
X- elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
X- OCI8_VERSION=10.1
X- elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
X- OCI8_VERSION=9.0
X- elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
X- OCI8_VERSION=8.1
X- elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
X- OCI8_VERSION=8.0
X- elif test -f $OCI8_DIR/lib/libclntsh.a; then
X- if test -f $OCI8_DIR/lib/libcore4.a; then
X- OCI8_VERSION=8.0
X- else
X- OCI8_VERSION=8.1
X- fi
X- else
X- AC_MSG_ERROR([Oracle (OCI8) required libraries not found])
X- fi
X- AC_MSG_RESULT($OCI8_VERSION)
X-])
X-
X AC_DEFUN([AC_OCI8IC_VERSION],[
X AC_MSG_CHECKING([Oracle Instant Client version])
X if test -f $PHP_OCI8_INSTANT_CLIENT/libociei.$SHLIB_SUFFIX_NAME; then
X@@ -60,149 +35,15 @@
X AC_MSG_RESULT([$OCI8_VERSION])
X ])
X
X-PHP_ARG_WITH(oci8, for Oracle (OCI8) support using ORACLE_HOME installation,
X-[ --with-oci8[=DIR] Include Oracle (OCI8) support using an ORACLE_HOME
X- install. The default DIR is ORACLE_HOME])
X-
X-if test "$PHP_OCI8" = "no"; then
X- PHP_ARG_WITH(oci8-instant-client, for Oracle (OCI8) support using Oracle Instant Client,
X- [ --with-oci8-instant-client[=DIR]
X- Include Oracle (OCI8) support using
X- Oracle Instant Client. DIR is the directory with the
X- Instant Client libraries. On Linux it will default to
X- /usr/lib/oracle/<most_recent_version>/client/lib
X- Other platforms will need to have it explicitly specified.])
X-else
X- PHP_OCI8_INSTANT_CLIENT="no";
X-fi
X-
X-if test "$PHP_OCI8" != "no"; then
X-
X- if test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then
X- AC_MSG_ERROR([--with-oci8 and --with-oci8-instant-client are mutually exclusive])
X- fi
X-
X- AC_MSG_CHECKING([Oracle Install Directory])
X- if test "$PHP_OCI8" = "yes"; then
X- OCI8_DIR=$ORACLE_HOME
X- else
X- OCI8_DIR=$PHP_OCI8
X- fi
X- AC_MSG_RESULT($OCI8_DIR)
X-
X- if test -d "$OCI8_DIR/rdbms/public"; then
X- PHP_ADD_INCLUDE($OCI8_DIR/rdbms/public)
X- OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/public"
X- fi
X- if test -d "$OCI8_DIR/rdbms/demo"; then
X- PHP_ADD_INCLUDE($OCI8_DIR/rdbms/demo)
X- OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/rdbms/demo"
X- fi
X- if test -d "$OCI8_DIR/network/public"; then
X- PHP_ADD_INCLUDE($OCI8_DIR/network/public)
X- OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/network/public"
X- fi
X- if test -d "$OCI8_DIR/plsql/public"; then
X- PHP_ADD_INCLUDE($OCI8_DIR/plsql/public)
X- OCI8_INCLUDES="$OCI8_INCLUDES -I$OCI8_DIR/plsql/public"
X- fi
X-
X- if test -f "$OCI8_DIR/lib/sysliblist"; then
X- PHP_EVAL_LIBLINE(`cat $OCI8_DIR/lib/sysliblist`, OCI8_SYSLIB)
X- elif test -f "$OCI8_DIR/rdbms/lib/sysliblist"; then
X- PHP_EVAL_LIBLINE(`cat $OCI8_DIR/rdbms/lib/sysliblist`, OCI8_SYSLIB)
X- fi
X-
X- AC_OCI8_VERSION($OCI8_DIR)
X- case $OCI8_VERSION in
X- 8.0)
X- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", OCI8_SHARED_LIBADD)
X- PHP_ADD_LIBRARY_WITH_PATH(core4, "", OCI8_SHARED_LIBADD)
X- PHP_ADD_LIBRARY_WITH_PATH(psa, "", OCI8_SHARED_LIBADD)
X- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $OCI8_DIR/lib, OCI8_SHARED_LIBADD)
X- ;;
X-
X- 8.1)
X- PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
X- PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
X-
X- dnl
X- dnl OCI_ATTR_STATEMENT is not available in all 8.1.x versions
X- dnl
X- PHP_OCI_IF_DEFINED(OCI_ATTR_STATEMENT, [AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])], $OCI8_INCLUDES)
X- ;;
X-
X- 9.0)
X- PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
X- PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
X- AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
X-
X- dnl These functions are only available in version >= 9.2
X- PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
X- [
X- PHP_CHECK_LIBRARY(clntsh, OCINlsCharSetNameToId,
X- [
X- AC_DEFINE(HAVE_OCI_9_2,1,[ ])
X- OCI8_VERSION=9.2
X- ], [], [
X- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
X- ])
X- ], [], [
X- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
X- ])
X- ;;
X-
X- 10.1)
X- PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
X- PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
X- AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
X- AC_DEFINE(HAVE_OCI_9_2,1,[ ])
X- AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
X- AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ])
X- ;;
X-
X- *)
X- AC_MSG_ERROR([Unsupported Oracle version])
X- ;;
X- esac
X-
X- dnl
X- dnl Check if we need to add -locijdbc8
X- dnl
X- PHP_CHECK_LIBRARY(clntsh, OCILobIsTemporary,
X- [
X- AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
X- ], [
X- PHP_CHECK_LIBRARY(ocijdbc8, OCILobIsTemporary,
X- [
X- PHP_ADD_LIBRARY(ocijdbc8, 1, OCI8_SHARED_LIBADD)
X- AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
X- ], [], [
X- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
X- ])
X- ], [
X- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
X- ])
X-
X- dnl
X- dnl Check if we have collections
X- dnl
X- PHP_CHECK_LIBRARY(clntsh, OCICollAssign,
X- [
X- AC_DEFINE(PHP_OCI8_HAVE_COLLECTIONS,1,[ ])
X- ], [], [
X- -L$OCI8_DIR/lib $OCI8_SHARED_LIBADD
X- ])
X-
X-
X- PHP_NEW_EXTENSION(oci8, oci8.c, $ext_shared)
X- AC_DEFINE(HAVE_OCI8,1,[ ])
X-
X- PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
X- PHP_SUBST_OLD(OCI8_DIR)
X- PHP_SUBST_OLD(OCI8_VERSION)
X+PHP_ARG_WITH(oci8-instant-client, for Oracle (OCI8) support using Oracle Instant Client,
X+[ --with-oci8-instant-client[=DIR]
X+ Include Oracle (OCI8) support using
X+ Oracle Instant Client. DIR is the directory with the
X+ Instant Client libraries. On Linux it will default to
X+ /usr/lib/oracle/<most_recent_version>/client/lib
X+ Other platforms will need to have it explicitly specified.])
X
X-elif test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then
X+if test "$PHP_OCI8_INSTANT_CLIENT" != "no"; then
X
X AC_MSG_CHECKING([Oracle Instant Client directory])
X if test "$PHP_OCI8_INSTANT_CLIENT" = "yes"; then
X@@ -221,7 +62,7 @@
X AC_MSG_CHECKING([Oracle Instant Client SDK header directory])
X
X dnl Header directory for Instant Client SDK RPM install
X- OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | sed -e 's!^/usr/lib/oracle/\(.*\)/client/lib[[/]]*$!/usr/include/oracle/\1/client!'`
X+ OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | sed -e 's!lib/oracle/\(.*\)/client/lib[[/]]*$!include/oracle/\1/client!'`
X
X dnl Header directory for Instant Client SDK zip file install
X OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include
END-of-php5-oci8/files/patch-config.m4
exit
---------------------------------------------------------------
More information about the freebsd-database
mailing list