oracle-instantclient-12.1.0.2.ebuild 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit eutils versionator pax-utils multilib-minimal
  5. MY_PVM=$(get_version_component_range 1-2)
  6. MY_PLAT_x86="Linux x86"
  7. MY_BITS_x86=32
  8. MY_A_x86="${PN/oracle-/}-basic-linux-${PV}.0.zip"
  9. MY_A_x86_sdk="${MY_A_x86/basic/sdk}"
  10. MY_A_x86_odbc="${MY_A_x86/basic/odbc}"
  11. MY_A_x86_jdbc="${MY_A_x86/basic/jdbc}"
  12. MY_A_x86_sqlplus="${MY_A_x86/basic/sqlplus}"
  13. MY_A_x86_tools="${MY_A_x86/basic/tools}"
  14. MY_PLAT_amd64="Linux x86-64"
  15. MY_BITS_amd64=64
  16. MY_A_amd64="${PN/oracle-}-basic-linux.x64-${PV}.0.zip"
  17. MY_A_amd64_sdk="${MY_A_amd64/basic/sdk}"
  18. MY_A_amd64_odbc="${MY_A_amd64/basic/odbc}"
  19. MY_A_amd64_jdbc="${MY_A_amd64/basic/jdbc}"
  20. MY_A_amd64_sqlplus="${MY_A_amd64/basic/sqlplus}"
  21. MY_A_amd64_tools="${MY_A_amd64/basic/tools}"
  22. DESCRIPTION="Oracle 12c Instant Client with SDK"
  23. HOMEPAGE="http://www.oracle.com/technetwork/database/features/instant-client/index.html"
  24. SRC_URI="
  25. abi_x86_32? (
  26. ${MY_A_x86}
  27. odbc? ( ${MY_A_x86_odbc} )
  28. jdbc? ( ${MY_A_x86_jdbc} )
  29. !abi_x86_64? (
  30. sdk? ( ${MY_A_x86_sdk} )
  31. sqlplus? ( ${MY_A_x86_sqlplus} )
  32. tools? ( ${MY_A_x86_tools} )
  33. ) )
  34. abi_x86_64? (
  35. ${MY_A_amd64}
  36. odbc? ( ${MY_A_amd64_odbc} )
  37. jdbc? ( ${MY_A_amd64_jdbc} )
  38. sdk? ( ${MY_A_amd64_sdk} )
  39. sqlplus? ( ${MY_A_amd64_sqlplus} )
  40. tools? ( ${MY_A_amd64_tools} )
  41. )
  42. "
  43. LICENSE="OTN"
  44. SLOT="0/${MY_PVM}"
  45. KEYWORDS="~amd64 ~x86"
  46. RESTRICT="fetch splitdebug"
  47. IUSE="jdbc odbc +sdk +sqlplus tools"
  48. DEPEND="app-arch/unzip"
  49. RDEPEND="
  50. >=dev-libs/libaio-0.3.109-r5[${MULTILIB_USEDEP}]
  51. !<dev-db/oracle-instantclient-basic-12
  52. !<dev-db/oracle-instantclient-odbc-12
  53. !<dev-db/oracle-instantclient-jdbc-12
  54. !<dev-db/oracle-instantclient-sqlplus-12
  55. "
  56. S="${WORKDIR}"
  57. QA_PREBUILT="usr/lib*/oracle/*/client/lib*/lib*"
  58. set_my_abivars() {
  59. S="${WORKDIR}/${ABI}/instantclient_$(
  60. replace_version_separator 1 "_" "${MY_PVM}"
  61. )"
  62. local abi=${ABI}
  63. [[ ${abi} == 'default' ]] && abi=${ARCH}
  64. MY_PLAT=MY_PLAT_${abi} ; MY_PLAT=${!MY_PLAT} # platform name
  65. MY_BITS=MY_BITS_${abi} ; MY_BITS=${!MY_BITS} # platform bitwidth
  66. MY_A=MY_A_${abi} ; MY_A=${!MY_A} # runtime distfile
  67. MY_A_sdk=MY_A_${abi}_sdk ; MY_A_sdk=${!MY_A_sdk} # sdk distfile
  68. MY_A_odbc=MY_A_${abi}_odbc ; MY_A_odbc=${!MY_A_odbc} # odbc distfile
  69. MY_A_jdbc=MY_A_${abi}_jdbc ; MY_A_jdbc=${!MY_A_jdbc} # jdbc distfile
  70. MY_A_sqlplus=MY_A_${abi}_sqlplus; MY_A_sqlplus=${!MY_A_sqlplus} # sqlplus distfile
  71. MY_A_tools=MY_A_${abi}_tools ; MY_A_tools=${!MY_A_tools} # tools distfile
  72. [[ -n ${MY_PLAT} ]]
  73. }
  74. oic_distfile_status() {
  75. if [[ -r ${DISTDIR}/${1} ]]; then
  76. echo "already here"
  77. else
  78. echo "still absent"
  79. fi
  80. }
  81. pkg_nofetch() {
  82. eerror "Please go to"
  83. eerror " ${HOMEPAGE%/*}/index-097480.html"
  84. eerror " and download"
  85. local ABI
  86. for ABI in $(multilib_get_enabled_abis)
  87. do
  88. set_my_abivars || continue
  89. eerror "Instant Client for ${MY_PLAT}"
  90. eerror " Basic: ($(oic_distfile_status ${MY_A})) ${MY_A}"
  91. use odbc &&
  92. eerror " ODBC: ($(oic_distfile_status ${MY_A_odbc})) ${MY_A_odbc}"
  93. use jdbc &&
  94. eerror " JDBC: ($(oic_distfile_status ${MY_A_jdbc})) ${MY_A_jdbc}"
  95. if multilib_is_native_abi; then
  96. use sdk &&
  97. eerror " SDK: ($(oic_distfile_status ${MY_A_sdk})) ${MY_A_sdk}"
  98. use sqlplus &&
  99. eerror " SQL*Plus: ($(oic_distfile_status ${MY_A_sqlplus})) ${MY_A_sqlplus}"
  100. use tools &&
  101. eerror " WRC: ($(oic_distfile_status ${MY_A_tools})) ${MY_A_tools}"
  102. fi
  103. done
  104. eerror "After downloading these files (for *all* shown architectures), put them in:"
  105. eerror " ${DISTDIR}/"
  106. }
  107. src_unpack() {
  108. local ABI
  109. for ABI in $(multilib_get_enabled_abis)
  110. do
  111. set_my_abivars || continue
  112. mkdir "${WORKDIR}"/${ABI} || die
  113. cd "${WORKDIR}"/${ABI} || die
  114. unpack ${MY_A}
  115. use odbc && unpack ${MY_A_odbc}
  116. use jdbc && unpack ${MY_A_jdbc}
  117. if multilib_is_native_abi; then
  118. use sdk && unpack ${MY_A_sdk}
  119. use sqlplus && unpack ${MY_A_sqlplus}
  120. use tools && unpack ${MY_A_tools}
  121. fi
  122. done
  123. }
  124. src_prepare() {
  125. use sdk && PATCHES=( "${FILESDIR}"/12.1.0.2-makefile.patch )
  126. default
  127. }
  128. # silence configure&compile messages from multilib-minimal
  129. src_configure() { :; }
  130. src_compile() { :; }
  131. src_install() {
  132. # all content goes here
  133. local oracle_home=usr/$(get_libdir)/oracle/${MY_PVM}/client
  134. into "/${oracle_home}"
  135. local ldpath= ABI
  136. for ABI in $(multilib_get_enabled_abis) # last iteration is final ABI
  137. do
  138. if ! set_my_abivars; then
  139. elog "Skipping unsupported ABI ${ABI}."
  140. continue
  141. fi
  142. einfo "Installing runtime for ${MY_PLAT} ..."
  143. cd "${S}" || die
  144. # shared libraries
  145. dolib.so lib*$(get_libname)*
  146. # ensure to be linkable
  147. [[ -e libocci$(get_libname) ]] ||
  148. dosym libocci$(get_libname ${MY_PVM}) \
  149. "/${oracle_home}"/$(get_libdir)/libocci$(get_libname)
  150. [[ -e libclntsh$(get_libname) ]] ||
  151. dosym libclntsh$(get_libname ${MY_PVM}) \
  152. "/${oracle_home}"/$(get_libdir)/libclntsh$(get_libname)
  153. # java archives
  154. insinto "/${oracle_home}"/$(get_libdir)
  155. doins *.jar
  156. # runtime library path
  157. ldpath+=${ldpath:+:}/${oracle_home}/$(get_libdir)
  158. eend $?
  159. done
  160. local DOCS=()
  161. local HTML_DOCS=()
  162. local paxbins=( adrci genezi uidrvci )
  163. local scripts=()
  164. use sqlplus && paxbins+=( sqlplus )
  165. use tools && paxbins+=( wrc )
  166. if use odbc; then
  167. scripts+=( odbc_update_ini.sh )
  168. HTML_DOCS+=( ODBC_IC_Readme_Unix.html help )
  169. fi
  170. einfo "Installing binaries for ${MY_PLAT} ..."
  171. dobin ${paxbins[@]} ${scripts}
  172. cd "${ED}${oracle_home}"/bin || die
  173. pax-mark -c ${paxbins[@]} || die
  174. cd "${S}" || die
  175. eend $?
  176. if use sqlplus; then
  177. insinto "/${oracle_home}"/sqlplus/admin
  178. doins glogin.sql
  179. dosym "/${oracle_home}"/bin/sqlplus /usr/bin/sqlplus
  180. fi
  181. if use sdk; then
  182. einfo "Installing SDK ..."
  183. DOCS+=( sdk/demo )
  184. cd "${S}"/sdk || die
  185. # SDK makefile, for #165834
  186. # As we change the relative filesystem layout compared
  187. # to vanilla instantclient.zip content, it feels easier
  188. # to fake the layout found in Oracle eXpress Edition.
  189. # Both layouts are known to DBD::Oracle (cpan).
  190. insinto "/${oracle_home}"/rdbms/demo
  191. newins demo/demo.mk demo_xe.mk
  192. # Remove ldap.h, #299562
  193. rm include/ldap.h || die
  194. # DBD::Oracle needs rdbms/public as real directory
  195. insinto "/${oracle_home}"/rdbms/public
  196. doins include/*.h
  197. dosym rdbms/public "/${oracle_home}"/include
  198. # ruby-oci8 expects the headers here
  199. dosym "/${oracle_home}"/rdbms/public /usr/include/oracle/${MY_PVM}/client
  200. # ott
  201. insinto "/${oracle_home}"/$(get_libdir)
  202. dobin ott
  203. doins *.zip
  204. # more files found in the zip
  205. insinto "/${oracle_home}"/admin
  206. doins admin/oraaccess.xsd
  207. eend $?
  208. fi
  209. cd "${S}" || die
  210. einstalldocs
  211. # create path for tnsnames.ora
  212. insinto /etc/oracle
  213. doins "${FILESDIR}"/tnsnames.ora.sample
  214. # Add OCI libs to library path
  215. {
  216. echo "# ${EPREFIX}/etc/env.d/50${PN}"
  217. echo "# Do not edit this file, but 99${PN} instead"
  218. echo
  219. echo "ORACLE_HOME=${EPREFIX}/${oracle_home}"
  220. echo "LDPATH=${ldpath}"
  221. echo "TNS_ADMIN=/etc/oracle/"
  222. } > "${T}"/50${PN}
  223. doenvd "${T}"/50${PN}
  224. # ensure ORACLE_HOME/lib exists
  225. [[ -e ${ED}${oracle_home}/lib/. ]] ||
  226. dosym $(get_libdir) "${oracle_home}"/lib
  227. }
  228. pkg_preinst() {
  229. if [[ -r ${EROOT}/etc/env.d/99${PN} ]]; then
  230. cp "${EROOT}/etc/env.d/99${PN}" "${ED}/etc/env.d/" || die
  231. else
  232. {
  233. echo "# ${EPREFIX}/etc/env.d/99${PN}"
  234. echo "# Configure system-wide defaults for your Oracle Instant Client here"
  235. echo
  236. echo "#$(grep '^ORACLE_HOME=' "${ED}/etc/env.d/50${PN}")"
  237. echo "#$(grep '^TNS_ADMIN=' "${ED}/etc/env.d/50${PN}")"
  238. echo "#NLS_LANG="
  239. } > "${ED}/etc/env.d/99${PN}"
  240. fi
  241. }
  242. pkg_postinst() {
  243. elog "${P} does not provide an sqlnet.ora"
  244. elog "configuration file, redirecting oracle diagnostics for database-"
  245. elog "and network-issues into ~USER/oradiag_USER/ instead."
  246. elog "It should be safe to ignore this message in sqlnet.log there:"
  247. elog " Directory does not exist for read/write [ORACLE_HOME/client/log] []"
  248. elog "See https://bugs.gentoo.org/show_bug.cgi?id=465252 for reference."
  249. elog "If you want to directly analyse low-level debug info or don't want"
  250. elog "to see it at all, so you really need an sqlnet.ora file, please"
  251. elog "consult http://search.oracle.com/search/search?q=sqlnet.ora"
  252. elog ""
  253. elog "TNS_ADMIN has been set to ${EROOT}etc/oracle by default,"
  254. elog "put your tnsnames.ora there or configure TNS_ADMIN"
  255. elog "to point to your user specific configuration."
  256. ewarn "Please re-source your shell settings for ORACLE_HOME"
  257. ewarn " changes, such as: source /etc/profile"
  258. }