Gentoo Archives: gentoo-commits

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