1 # Copyright 1999-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit pax-utils multilib-minimal
8 DESCRIPTION="Oracle 18c Instant Client with SDK"
9 HOMEPAGE="https://www.oracle.com/database/technologies/instant-client.html"
11 MY_SOVER=21.1 # the library soname found in the zip files
13 IUSE="jdbc odbc precomp +sdk +sqlplus tools"
14 REQUIRED_USE="precomp? ( sdk )"
17 MY_P="instantclient_$(ver_rs 1 _ ${MY_PVM})"
19 MY_PVP=$(ver_cut 5) # p2
21 MY_URI="https://download.oracle.com/otn_software/linux/instantclient/$(ver_rs 1-5 '' $(ver_cut 1-5))"
22 MY_PLAT_x86="Linux x86"
24 MY_A_x86="${MY_URI}/${PN/oracle-/}-basic-linux-${PV}.zip"
25 MY_A_x86_jdbc="${MY_A_x86/basic/jdbc}"
26 MY_A_x86_odbc="${MY_A_x86/basic/odbc}"
27 MY_A_x86_precomp="${MY_A_x86/basic/precomp}"
28 MY_A_x86_sdk="${MY_A_x86/basic/sdk}"
29 MY_A_x86_sqlplus="${MY_A_x86/basic/sqlplus}"
30 MY_A_x86_tools="${MY_A_x86/basic/tools}"
32 MY_PLAT_amd64="Linux x86-64"
34 MY_A_amd64="${MY_URI}/${PN/oracle-}-basic-linux.x64-${PV}.zip"
35 MY_A_amd64_jdbc="${MY_A_amd64/basic/jdbc}"
36 MY_A_amd64_odbc="${MY_A_amd64/basic/odbc}"
37 MY_A_amd64_precomp="${MY_A_amd64/basic/precomp}"
38 MY_A_amd64_sdk="${MY_A_amd64/basic/sdk}"
39 MY_A_amd64_sqlplus="${MY_A_amd64/basic/sqlplus}"
40 MY_A_amd64_tools="${MY_A_amd64/basic/tools}"
42 if [[ ${MY_PVP} == p* ]]
45 # Updated 9/22/2017: instantclient-odbc-linux-12.2.0.1.0-2.zip
46 MY_A_x86_odbc="${MY_URI}/${MY_A_x86_odbc%.zip}${MY_PVP}.zip"
47 MY_A_amd64_odbc="${MY_URI}/${MY_A_amd64_odbc%.zip}${MY_PVP}.zip"
53 jdbc? ( ${MY_A_x86_jdbc} )
54 odbc? ( ${MY_A_x86_odbc} )
55 precomp? ( ${MY_A_x86_precomp} )
57 sdk? ( ${MY_A_x86_sdk} )
58 sqlplus? ( ${MY_A_x86_sqlplus} )
59 tools? ( ${MY_A_x86_tools} )
63 jdbc? ( ${MY_A_amd64_jdbc} )
64 odbc? ( ${MY_A_amd64_odbc} )
65 precomp? ( ${MY_A_amd64_precomp} )
66 sdk? ( ${MY_A_amd64_sdk} )
67 sqlplus? ( ${MY_A_amd64_sqlplus} )
68 tools? ( ${MY_A_amd64_tools} )
75 RESTRICT="mirror splitdebug test"
77 DEPEND="app-arch/unzip"
79 >=dev-libs/libaio-0.3.109-r5[${MULTILIB_USEDEP}]
81 odbc? ( dev-db/unixODBC )
84 S="${WORKDIR}/${MY_P}"
86 QA_PREBUILT="usr/lib*/oracle/client/*/*"
89 if multilib_is_native_abi; then
90 MY_WORKDIR="${WORKDIR}"
93 MY_WORKDIR="${WORKDIR}/${ABI}"
94 MY_S="${MY_WORKDIR}/${MY_P}"
98 [[ ${abi} == 'default' ]] && abi=${ARCH}
99 MY_PLAT=MY_PLAT_${abi} ; MY_PLAT=${!MY_PLAT} # platform name
100 MY_BITS=MY_BITS_${abi} ; MY_BITS=${!MY_BITS} # platform bitwidth
101 MY_A=MY_A_${abi} ; MY_A=${!MY_A##*/} # runtime distfile
102 MY_A_jdbc=MY_A_${abi}_jdbc ; MY_A_jdbc=${!MY_A_jdbc##*/} # jdbc distfile
103 MY_A_odbc=MY_A_${abi}_odbc ; MY_A_odbc=${!MY_A_odbc##*/} # odbc distfile
104 MY_A_precomp=MY_A_${abi}_precomp; MY_A_precomp=${!MY_A_precomp##*/} # precomp distfile
105 MY_A_sdk=MY_A_${abi}_sdk ; MY_A_sdk=${!MY_A_sdk##*/} # sdk distfile
106 MY_A_sqlplus=MY_A_${abi}_sqlplus; MY_A_sqlplus=${!MY_A_sqlplus##*/} # sqlplus distfile
107 MY_A_tools=MY_A_${abi}_tools ; MY_A_tools=${!MY_A_tools##*/} # tools distfile
114 for ABI in $(multilib_get_enabled_abis)
116 set_my_abivars || continue
117 mkdir -p "${MY_WORKDIR}" || die
118 cd "${MY_WORKDIR}" || die
120 use jdbc && unpack ${MY_A_jdbc}
121 use odbc && unpack ${MY_A_odbc}
122 use precomp && unpack ${MY_A_precomp}
123 if multilib_is_native_abi; then
124 use sdk && unpack ${MY_A_sdk}
125 use sqlplus && unpack ${MY_A_sqlplus}
126 use tools && unpack ${MY_A_tools}
134 # Not supporting COBOL for now
135 rm -f sdk/demo/*procob*
138 PATCHES+=( "${FILESDIR}"/21.3.0.0.0-makefile.patch )
139 rm sdk/include/ldap.h || die #299562
144 # silence configure&compile messages from multilib-minimal
145 src_configure() { :; }
149 # all content goes here without version number, bug#578402
150 local oracle_home=/usr/$(get_libdir)/oracle/client
151 local oracle_home_to_root=../../../.. # for dosym
155 for ABI in $(multilib_get_enabled_abis) # last iteration is final ABI
157 if ! set_my_abivars; then
158 elog "Skipping unsupported ABI ${ABI}."
161 ebegin "Installing runtime for ${MY_PLAT}"
166 into "${oracle_home}"
167 dolib.so lib*$(get_libname)*
168 use precomp && dolib.a cobsqlintf.o
170 # ensure to be linkable
171 [[ -e libocci$(get_libname) ]] ||
172 dosym libocci$(get_libname ${MY_SOVER}) \
173 "${oracle_home}"/$(get_libdir)/libocci$(get_libname)
174 [[ -e libclntsh$(get_libname) ]] ||
175 dosym libclntsh$(get_libname ${MY_SOVER}) \
176 "${oracle_home}"/$(get_libdir)/libclntsh$(get_libname)
179 insinto "${oracle_home}"/$(get_libdir)
182 # runtime library path
183 ldpath+=${ldpath:+:}${oracle_home}/$(get_libdir)
185 # Vanilla filesystem layout does not support multilib
186 # installation, so we need to move the libs into the
187 # ABI specific libdir. However, ruby-oci8 build system
188 # detects an instantclient along the shared libraries,
189 # and does expect the sdk right there.
190 use sdk && dosym ../sdk "${oracle_home}"/$(get_libdir)/sdk
195 local DOCS=( BASIC_README )
197 local paxbins=( adrci genezi uidrvci )
201 DOCS+=( JDBC_README )
204 DOCS+=( ODBC_README )
206 scripts+=( odbc_update_ini.sh )
209 DOCS+=( PRECOMP_README )
210 paxbins+=( sdk/proc )
211 # Install pcscfg.cfg into /etc/oracle, as the user probably
212 # wants to add the include path for the compiler headers
213 # here and we do not want this to be overwritten.
215 doins precomp/admin/pcscfg.cfg
216 sed -i -e "s%^sys_include=.*%sys_include=(${oracle_home}/sdk/include,${EPREFIX}/usr/include)%" \
217 "${ED}"/etc/oracle/pcscfg.cfg || die
218 dosym ../../${oracle_home_to_root}/etc/oracle/pcscfg.cfg "${oracle_home}/precomp/admin/pcscfg.cfg"
219 dosym ../.."${oracle_home}"/bin/proc /usr/bin/proc
220 # Not supporting COBOL for now
221 # paxbins+=( sdk/{procob,rtsora} )
222 # doins precomp/admin/pcbcfg.cfg
225 ebegin "Installing SDK"
228 insinto "${oracle_home}"/$(get_libdir)
229 doins sdk/ottclasses.zip
230 insinto "${oracle_home}"/sdk
231 doins -r sdk/{admin,demo,include}
232 # Some build systems simply expect ORACLE_HOME/include.
233 dosym sdk/include "${oracle_home}"/include
234 # Some build systems do not know the instant client,
235 # expecting headers in rdbms/public, see bug#669316.
236 # Additionally, some (probably older ruby-oci8) do
237 # require rdbms/public to be a real directory.
238 insinto "${oracle_home}"/rdbms/public
239 doins -r sdk/include/*
240 # Others (like the DBD::Oracle perl module) know the Oracle
241 # eXpress Edition's client, parsing an rdbms/demo/demo_xe.mk.
242 dosym ../../sdk/demo/demo.mk "${oracle_home}"/rdbms/demo/demo_xe.mk
243 # And some do expect /usr/include/oracle/<ver>/client/include,
244 # querying 'sqlplus' for the version number, also see bug#652096.
245 dosym ../../../.."${oracle_home}"/sdk/include /usr/include/oracle/${MY_PVM}/client
249 DOCS+=( SQLPLUS_README )
251 insinto "${oracle_home}"/sqlplus/admin
253 dosym ../.."${oracle_home}"/bin/sqlplus /usr/bin/sqlplus
256 DOCS+=( TOOLS_README )
257 paxbins+=( exp expdp imp impdp sqlldr wrc )
260 ebegin "Installing binaries for ${MY_PLAT}"
261 into "${oracle_home}"
262 dobin ${paxbins[*]} ${scripts[*]}
263 pushd "${ED}${oracle_home}/bin" >/dev/null || die
264 pax-mark -c ${paxbins[*]#*/} || die
265 popd >/dev/null || die
270 # create path for tnsnames.ora
272 doins "${FILESDIR}"/tnsnames.ora.sample
274 # Add OCI libs to library path
276 echo "# ${EPREFIX}/etc/env.d/50${PN}"
277 echo "# Do not edit this file, but 99${PN} instead"
279 echo "ORACLE_HOME=${EPREFIX}${oracle_home}"
280 echo "LDPATH=${ldpath}"
281 echo "TNS_ADMIN=${EPREFIX}/etc/oracle/"
284 doenvd "${T}"/50${PN}
286 # ensure ORACLE_HOME/lib exists
287 [[ -e ${ED}${oracle_home}/lib/. ]] ||
288 dosym $(get_libdir) "${oracle_home#/}"/lib
292 if [[ -r ${EROOT}/etc/env.d/99${PN} ]]; then
293 cp "${EROOT}/etc/env.d/99${PN}" "${ED}/etc/env.d/" || die
296 echo "# ${EPREFIX}/etc/env.d/99${PN}"
297 echo "# Configure system-wide defaults for your Oracle Instant Client here"
299 echo "#$(grep '^ORACLE_HOME=' "${ED}/etc/env.d/50${PN}")"
300 echo "#$(grep '^TNS_ADMIN=' "${ED}/etc/env.d/50${PN}")"
302 } > "${ED}/etc/env.d/99${PN}"
307 elog "${P} does not provide an sqlnet.ora"
308 elog "configuration file, redirecting oracle diagnostics for database-"
309 elog "and network-issues into ~USER/oradiag_USER/ instead."
310 elog "It should be safe to ignore this message in sqlnet.log there:"
311 elog " Directory does not exist for read/write [ORACLE_HOME/client/log] []"
312 elog "See https://bugs.gentoo.org/show_bug.cgi?id=465252 for reference."
313 elog "If you want to directly analyse low-level debug info or don't want"
314 elog "to see it at all, so you really need an sqlnet.ora file, please"
315 elog "consult http://search.oracle.com/search/search?q=sqlnet.ora"
317 elog "TNS_ADMIN has been set to ${EPREFIX}/etc/oracle by default,"
318 elog "put your tnsnames.ora there or configure TNS_ADMIN"
319 elog "to point to your user specific configuration."
322 elog "The proc precompiler uses the system library headers, which in"
323 elog "turn include the headers of the used compiler."
324 elog "To make proc work, please add the compiler header path of your"
325 elog "preferred compiler to sys_include in:"
326 elog " ${EPREFIX}/etc/oracle/pcscfg.cfg"
327 elog "Remember to update this setting when you switch or update the"
329 elog "For gcc, the headers are usually found in a path matching the"
330 elog "following pattern:"
331 elog " ${EPREFIX}/usr/lib/gcc/*/*/include"
332 elog "The exact details depend on the architecture and the version of"
333 elog "the compiler to be used."
335 ewarn "Please re-source your shell settings for ORACLE_HOME"
336 ewarn " changes, such as: source ${EPREFIX}/etc/profile"