dev-qt/qtx11extras: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / dev-db / oracle-instantclient / oracle-instantclient-19.3.0.0-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 inherit eutils pax-utils multilib-minimal
7
8 DESCRIPTION="Oracle 18c Instant Client with SDK"
9 HOMEPAGE="https://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html"
10
11 MY_SOVER=18.1 # the library soname found in the zip files
12
13 IUSE="jdbc odbc precomp +sdk +sqlplus tools"
14 REQUIRED_USE="precomp? ( sdk )"
15
16 MY_PVM=$(ver_cut 1-2)
17 MY_P="instantclient_$(ver_rs 1 _ ${MY_PVM})"
18
19 MY_PV=$(ver_cut 1-4)
20 MY_PVP=$(ver_cut 5) # p2
21
22 MY_PLAT_x86="Linux x86"
23 MY_BITS_x86=32
24 MY_A_x86="${PN/oracle-/}-basic-linux-${MY_PV}.0dbru.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}"
31
32 MY_PLAT_amd64="Linux x86-64"
33 MY_BITS_amd64=64
34 MY_A_amd64="${PN/oracle-}-basic-linux.x64-${MY_PV}.0dbru.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}"
41
42 if [[ ${MY_PVP} == p* ]]
43 then
44         MY_PVP=-${MY_PVP#p}
45         # Updated 9/22/2017: instantclient-odbc-linux-12.2.0.1.0-2.zip
46         MY_A_x86_odbc="${MY_A_x86_odbc%.zip}${MY_PVP}.zip"
47         MY_A_amd64_odbc="${MY_A_amd64_odbc%.zip}${MY_PVP}.zip"
48 fi
49
50 SRC_URI="
51         abi_x86_32? (
52                 ${MY_A_x86}
53                 jdbc?    ( ${MY_A_x86_jdbc}    )
54                 odbc?    ( ${MY_A_x86_odbc}    )
55                 precomp? ( ${MY_A_x86_precomp} )
56                 !abi_x86_64? (
57                         sdk?     ( ${MY_A_x86_sdk}     )
58                         sqlplus? ( ${MY_A_x86_sqlplus} )
59                         tools?   ( ${MY_A_x86_tools}   )
60         ) )
61         abi_x86_64? (
62                 ${MY_A_amd64}
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}   )
69         )
70 "
71
72 LICENSE="OTN"
73 SLOT="0/${MY_SOVER}"
74 KEYWORDS="~amd64 ~x86"
75 RESTRICT="fetch splitdebug"
76
77 DEPEND="app-arch/unzip"
78 RDEPEND="
79         >=dev-libs/libaio-0.3.109-r5[${MULTILIB_USEDEP}]
80         !<dev-db/oracle-instantclient-basic-12
81         !<dev-db/oracle-instantclient-odbc-12
82         !<dev-db/oracle-instantclient-jdbc-12
83         !<dev-db/oracle-instantclient-sqlplus-12
84 "
85
86 S="${WORKDIR}/${MY_P}"
87
88 QA_PREBUILT="usr/lib*/oracle/client/*/*"
89
90 set_my_abivars() {
91         if multilib_is_native_abi; then
92                 MY_WORKDIR="${WORKDIR}"
93                 MY_S="${S}"
94         else
95                 MY_WORKDIR="${WORKDIR}/${ABI}"
96                 MY_S="${MY_WORKDIR}/${MY_P}"
97         fi
98
99         local abi=${ABI}
100         [[ ${abi} == 'default' ]] && abi=${ARCH}
101         MY_PLAT=MY_PLAT_${abi}          ; MY_PLAT=${!MY_PLAT}         # platform name
102         MY_BITS=MY_BITS_${abi}          ; MY_BITS=${!MY_BITS}         # platform bitwidth
103         MY_A=MY_A_${abi}                ; MY_A=${!MY_A}               # runtime distfile
104         MY_A_jdbc=MY_A_${abi}_jdbc      ; MY_A_jdbc=${!MY_A_jdbc}       # jdbc distfile
105         MY_A_odbc=MY_A_${abi}_odbc      ; MY_A_odbc=${!MY_A_odbc}       # odbc distfile
106         MY_A_precomp=MY_A_${abi}_precomp; MY_A_precomp=${!MY_A_precomp} # precomp distfile
107         MY_A_sdk=MY_A_${abi}_sdk        ; MY_A_sdk=${!MY_A_sdk}         # sdk distfile
108         MY_A_sqlplus=MY_A_${abi}_sqlplus; MY_A_sqlplus=${!MY_A_sqlplus} # sqlplus distfile
109         MY_A_tools=MY_A_${abi}_tools    ; MY_A_tools=${!MY_A_tools}     # tools distfile
110
111         [[ -n ${MY_PLAT} ]]
112 }
113
114 oic_distfile_status() {
115         : # We must not access DISTDIR in pkg_* phase, bug#612966.
116 # Not removing this lines yet, we may eventually specify this feature.
117 #       if [[ -r ${DISTDIR}/${1} ]]; then
118 #               echo "already here"
119 #       else
120 #               echo "still absent"
121 #       fi
122 }
123
124 pkg_nofetch() {
125         eerror "Please go to"
126         eerror "  ${HOMEPAGE//overview/downloads}"
127         eerror "  and download"
128         local ABI
129         for ABI in $(multilib_get_enabled_abis)
130         do
131                 set_my_abivars || continue
132                 eerror "Instant Client for ${MY_PLAT}"
133                 # convenient ordering like Linux x86-64 download site
134                 eerror "            Basic: $(oic_distfile_status ${MY_A}) ${MY_A}"
135                 use sqlplus && multilib_is_native_abi &&
136                 eerror "         SQL*Plus: $(oic_distfile_status ${MY_A_sqlplus}) ${MY_A_sqlplus}"
137                 use tools && multilib_is_native_abi &&
138                 eerror "            Tools: $(oic_distfile_status ${MY_A_tools}) ${MY_A_tools}"
139                 use sdk && multilib_is_native_abi &&
140                 eerror "              SDK: $(oic_distfile_status ${MY_A_sdk}) ${MY_A_sdk}"
141                 use jdbc &&
142                 eerror "             JDBC: $(oic_distfile_status ${MY_A_jdbc}) ${MY_A_jdbc}"
143                 use odbc &&
144                 eerror "             ODBC: $(oic_distfile_status ${MY_A_odbc}) ${MY_A_odbc}"
145                 use precomp &&
146                 eerror "      Precompiler: $(oic_distfile_status ${MY_A_precomp}) ${MY_A_precomp}"
147         done
148         eerror "After downloading these files (for *all* shown architectures),"
149         eerror "put them in your DISTDIR filesystem directory."
150 }
151
152 src_unpack() {
153         local ABI
154         for ABI in $(multilib_get_enabled_abis)
155         do
156                 set_my_abivars || continue
157                 mkdir -p "${MY_WORKDIR}" || die
158                 cd "${MY_WORKDIR}" || die
159                 unpack ${MY_A}
160                 use jdbc    && unpack ${MY_A_jdbc}
161                 use odbc    && unpack ${MY_A_odbc}
162                 use precomp && unpack ${MY_A_precomp}
163                 if multilib_is_native_abi; then
164                         use sdk     && unpack ${MY_A_sdk}
165                         use sqlplus && unpack ${MY_A_sqlplus}
166                         use tools   && unpack ${MY_A_tools}
167                 fi
168         done
169 }
170
171 src_prepare() {
172         local PATCHES=()
173         if use precomp; then
174                 PATCHES+=( "${FILESDIR}"/18.3.0.0-proc-makefile.patch )
175                 # Not supporting COBOL for now
176                 rm -f sdk/demo/*procob*
177         fi
178         if use sdk; then
179                 PATCHES+=( "${FILESDIR}"/18.3.0.0-makefile.patch )
180                 rm sdk/include/ldap.h || die #299562
181         fi
182         default
183 }
184
185 # silence configure&compile messages from multilib-minimal
186 src_configure() { :; }
187 src_compile() { :; }
188
189 src_install() {
190         # all content goes here without version number, bug#578402
191         local oracle_home=/usr/$(get_libdir)/oracle/client
192         local oracle_home_to_root=../../../.. # for dosym
193         local ldpath=
194
195         local ABI
196         for ABI in $(multilib_get_enabled_abis) # last iteration is final ABI
197         do
198                 if ! set_my_abivars; then
199                         elog "Skipping unsupported ABI ${ABI}."
200                         continue
201                 fi
202                 einfo "Installing runtime for ${MY_PLAT} ..."
203
204                 cd "${MY_S}" || die
205
206                 # shared libraries
207                 into "${oracle_home}"
208                 dolib.so lib*$(get_libname)*
209                 use precomp && dolib.a cobsqlintf.o
210
211                 # ensure to be linkable
212                 [[ -e libocci$(get_libname) ]] ||
213                 dosym libocci$(get_libname ${MY_SOVER}) \
214                         "${oracle_home}"/$(get_libdir)/libocci$(get_libname)
215                 [[ -e libclntsh$(get_libname) ]] ||
216                 dosym libclntsh$(get_libname ${MY_SOVER}) \
217                         "${oracle_home}"/$(get_libdir)/libclntsh$(get_libname)
218
219                 # java archives
220                 insinto "${oracle_home}"/$(get_libdir)
221                 doins *.jar
222
223                 # runtime library path
224                 ldpath+=${ldpath:+:}${oracle_home}/$(get_libdir)
225
226                 # Vanilla filesystem layout does not support multilib
227                 # installation, so we need to move the libs into the
228                 # ABI specific libdir.  However, ruby-oci8 build system
229                 # detects an instantclient along the shared libraries,
230                 # and does expect the sdk right there.
231                 use sdk && dosym ../sdk "${oracle_home}"/$(get_libdir)/sdk
232
233                 eend $?
234         done
235
236         local DOCS=( BASIC_README )
237         local HTML_DOCS=()
238         local paxbins=( adrci genezi uidrvci )
239         local scripts=()
240
241         if use jdbc; then
242                 DOCS+=( JDBC_README )
243         fi
244         if use odbc; then
245                 DOCS+=( ODBC_README )
246                 HTML_DOCS+=( help )
247                 scripts+=( odbc_update_ini.sh )
248         fi
249         if use precomp; then
250                 DOCS+=( PRECOMP_README )
251                 paxbins+=( sdk/proc )
252                 # Install pcscfg.cfg into /etc/oracle, as the user probably
253                 # wants to add the include path for the compiler headers
254                 # here and we do not want this to be overwritten.
255                 insinto /etc/oracle
256                 doins precomp/admin/pcscfg.cfg
257                 sed -i -e "s%^sys_include=.*%sys_include=(${oracle_home}/sdk/include,${EPREFIX}/usr/include)%" \
258                         "${ED}"/etc/oracle/pcscfg.cfg || die
259                 dosym ../../${oracle_home_to_root}/etc/oracle/pcscfg.cfg "${oracle_home}/precomp/admin/pcscfg.cfg"
260                 dosym ../.."${oracle_home}"/bin/proc /usr/bin/proc
261                 # Not supporting COBOL for now
262                 # paxbins+=( sdk/{procob,rtsora} )
263                 # doins precomp/admin/pcbcfg.cfg
264         fi
265         if use sdk; then
266                 einfo "Installing SDK ..."
267                 DOCS+=( SDK_README )
268                 scripts+=( sdk/ott )
269                 insinto "${oracle_home}"/$(get_libdir)
270                 doins sdk/ottclasses.zip
271                 insinto "${oracle_home}"/sdk
272                 doins -r sdk/{admin,demo,include}
273                 # Some build systems simply expect ORACLE_HOME/include.
274                 dosym sdk/include "${oracle_home}"/include
275                 # Some build systems do not know the instant client,
276                 # expecting headers in rdbms/public, see bug#669316.
277                 # Additionally, some (probably older ruby-oci8) do
278                 # require rdbms/public to be a real directory.
279                 insinto "${oracle_home}"/rdbms/public
280                 doins -r sdk/include/*
281                 # Others (like the DBD::Oracle perl module) know the Oracle
282                 # eXpress Edition's client, parsing an rdbms/demo/demo_xe.mk.
283                 dosym ../../sdk/demo/demo.mk "${oracle_home}"/rdbms/demo/demo_xe.mk
284                 # And some do expect /usr/include/oracle/<ver>/client/include,
285                 # querying 'sqlplus' for the version number, also see bug#652096.
286                 dosym ../../../.."${oracle_home}"/sdk/include /usr/include/oracle/${MY_PVM}/client
287                 eend $?
288         fi
289         if use sqlplus; then
290                 DOCS+=( SQLPLUS_README )
291                 paxbins+=( sqlplus )
292                 insinto "${oracle_home}"/sqlplus/admin
293                 doins glogin.sql
294                 dosym ../.."${oracle_home}"/bin/sqlplus /usr/bin/sqlplus
295         fi
296         if use tools; then
297                 DOCS+=( TOOLS_README )
298                 paxbins+=( exp expdp imp impdp sqlldr wrc )
299         fi
300
301         einfo "Installing binaries for ${MY_PLAT} ..."
302         into "${oracle_home}"
303         dobin ${paxbins[*]} ${scripts[*]}
304         pushd "${ED}${oracle_home}/bin" >/dev/null || die
305         pax-mark -c ${paxbins[*]#*/} || die
306         popd >/dev/null || die
307         eend $?
308
309         einstalldocs
310
311         # create path for tnsnames.ora
312         insinto /etc/oracle
313         doins "${FILESDIR}"/tnsnames.ora.sample
314
315         # Add OCI libs to library path
316         {
317                 echo "# ${EPREFIX}/etc/env.d/50${PN}"
318                 echo "# Do not edit this file, but 99${PN} instead"
319                 echo
320                 echo "ORACLE_HOME=${EPREFIX}${oracle_home}"
321                 echo "LDPATH=${ldpath}"
322                 echo "TNS_ADMIN=${EPREFIX}/etc/oracle/"
323         } > "${T}"/50${PN}
324
325         doenvd "${T}"/50${PN}
326
327         # ensure ORACLE_HOME/lib exists
328         [[ -e ${ED}${oracle_home}/lib/. ]] ||
329         dosym $(get_libdir) "${oracle_home#/}"/lib
330 }
331
332 pkg_preinst() {
333         if [[ -r ${EROOT}/etc/env.d/99${PN} ]]; then
334                 cp "${EROOT}/etc/env.d/99${PN}" "${ED}/etc/env.d/" || die
335         else
336                 {
337                         echo "# ${EPREFIX}/etc/env.d/99${PN}"
338                         echo "# Configure system-wide defaults for your Oracle Instant Client here"
339                         echo
340                         echo "#$(grep '^ORACLE_HOME=' "${ED}/etc/env.d/50${PN}")"
341                         echo "#$(grep '^TNS_ADMIN=' "${ED}/etc/env.d/50${PN}")"
342                         echo "#NLS_LANG="
343                 } > "${ED}/etc/env.d/99${PN}"
344         fi
345 }
346
347 pkg_postinst() {
348         elog "${P} does not provide an sqlnet.ora"
349         elog "configuration file, redirecting oracle diagnostics for database-"
350         elog "and network-issues into ~USER/oradiag_USER/ instead."
351         elog "It should be safe to ignore this message in sqlnet.log there:"
352         elog "   Directory does not exist for read/write [ORACLE_HOME/client/log] []"
353         elog "See https://bugs.gentoo.org/show_bug.cgi?id=465252 for reference."
354         elog "If you want to directly analyse low-level debug info or don't want"
355         elog "to see it at all, so you really need an sqlnet.ora file, please"
356         elog "consult http://search.oracle.com/search/search?q=sqlnet.ora"
357         elog ""
358         elog "TNS_ADMIN has been set to ${EPREFIX}/etc/oracle by default,"
359         elog "put your tnsnames.ora there or configure TNS_ADMIN"
360         elog "to point to your user specific configuration."
361         if use precomp; then
362                 elog ""
363                 elog "The proc precompiler uses the system library headers, which in"
364                 elog "turn include the headers of the used compiler."
365                 elog "To make proc work, please add the compiler header path of your"
366                 elog "preferred compiler to sys_include in:"
367                 elog "  ${EPREFIX}/etc/oracle/pcscfg.cfg"
368                 elog "Remember to update this setting when you switch or update the"
369                 elog "compiler."
370                 elog "For gcc, the headers are usually found in a path matching the"
371                 elog "following pattern:"
372                 elog "  ${EPREFIX}/usr/lib/gcc/*/*/include"
373                 elog "The exact details depend on the architecture and the version of"
374                 elog "the compiler to be used."
375         fi
376         ewarn "Please re-source your shell settings for ORACLE_HOME"
377         ewarn "  changes, such as: source ${EPREFIX}/etc/profile"
378 }