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