firebird-2.5.7.27050.0.ebuild 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit autotools flag-o-matic user versionator
  5. MY_P=${PN/f/F}-$(replace_version_separator 4 -)
  6. DESCRIPTION="Relational database offering many ANSI SQL:2003 and some SQL:2008 features"
  7. HOMEPAGE="https://www.firebirdsql.org/"
  8. SRC_URI="
  9. mirror://sourceforge/firebird/${MY_P}.tar.bz2
  10. doc? ( ftp://ftpc.inprise.com/pub/interbase/techpubs/ib_b60_doc.zip )"
  11. LICENSE="IDPL Interbase-1.0"
  12. SLOT="0"
  13. KEYWORDS="~amd64 ~x86"
  14. IUSE="debug doc examples +superserver xinetd"
  15. REQUIRED_USE="?? ( superserver xinetd )"
  16. CDEPEND="
  17. dev-libs/icu:=
  18. dev-libs/libedit
  19. "
  20. DEPEND="${CDEPEND}
  21. >=dev-util/btyacc-3.0-r2
  22. doc? ( app-arch/unzip )
  23. "
  24. RDEPEND="${CDEPEND}
  25. xinetd? ( virtual/inetd )
  26. !sys-cluster/ganglia
  27. "
  28. RESTRICT="userpriv"
  29. PATCHES=( "${FILESDIR}"/${PN}-2.5.3.26780.0-deps-flags.patch )
  30. S="${WORKDIR}/${MY_P}"
  31. pkg_setup() {
  32. enewgroup firebird 450
  33. enewuser firebird 450 /bin/sh /usr/$(get_libdir)/firebird firebird
  34. }
  35. check_sed() {
  36. MSG="sed of $3, required $2 line(s) modified $1"
  37. einfo "${MSG}"
  38. [[ $1 -ge $2 ]] || die "${MSG}"
  39. }
  40. src_unpack() {
  41. unpack "${MY_P}.tar.bz2"
  42. if use doc; then
  43. # Unpack docs
  44. mkdir "manuals" || die
  45. cd "manuals" || die
  46. unpack ib_b60_doc.zip
  47. fi
  48. }
  49. src_prepare() {
  50. use xinetd || eapply "${FILESDIR}"/${PN}-2.5.1.26351.0-superclassic.patch
  51. default
  52. # Rename references to isql to fbsql
  53. # sed vs patch for portability and addtional location changes
  54. check_sed "$(sed -i -e 's:"isql :"fbsql :w /dev/stdout' \
  55. src/isql/isql.epp | wc -l)" "1" "src/isql/isql.epp" # 1 line
  56. check_sed "$(sed -i -e 's:isql :fbsql :w /dev/stdout' \
  57. src/msgs/history2.sql | wc -l)" "4" "src/msgs/history2.sql" # 4 lines
  58. check_sed "$(sed -i -e 's:--- ISQL:--- FBSQL:w /dev/stdout' \
  59. -e 's:isql :fbsql :w /dev/stdout' \
  60. -e 's:ISQL :FBSQL :w /dev/stdout' \
  61. src/msgs/messages2.sql | wc -l)" "6" "src/msgs/messages2.sql" # 6 lines
  62. find "${S}" -name \*.sh -exec chmod +x {} + || die
  63. rm -r "${S}"/extern/{btyacc,editline,icu} || die
  64. eautoreconf
  65. }
  66. src_configure() {
  67. filter-flags -fprefetch-loop-arrays
  68. filter-mfpmath sse
  69. econf \
  70. --prefix=/usr/$(get_libdir)/firebird \
  71. $(use_enable superserver) \
  72. $(use_enable debug) \
  73. --with-editline \
  74. --with-system-editline \
  75. --with-system-icu \
  76. --with-fbbin=/usr/bin \
  77. --with-fbsbin=/usr/sbin \
  78. --with-fbconf=/etc/${PN} \
  79. --with-fblib=/usr/$(get_libdir) \
  80. --with-fbinclude=/usr/include \
  81. --with-fbdoc=/usr/share/doc/${P} \
  82. --with-fbudf=/usr/$(get_libdir)/${PN}/UDF \
  83. --with-fbsample=/usr/share/doc/${P}/examples \
  84. --with-fbsample-db=/usr/share/doc/${P}/examples/db \
  85. --with-fbhelp=/usr/$(get_libdir)/${PN}/help \
  86. --with-fbintl=/usr/$(get_libdir)/${PN}/intl \
  87. --with-fbmisc=/usr/share/${PN} \
  88. --with-fbsecure-db=/etc/${PN} \
  89. --with-fbmsg=/usr/$(get_libdir)/${PN} \
  90. --with-fblog=/var/log/${PN}/ \
  91. --with-fbglock=/var/run/${PN} \
  92. --with-fbplugins=/usr/$(get_libdir)/${PN}/plugins \
  93. --with-gnu-ld \
  94. ${myconf}
  95. }
  96. src_compile() {
  97. MAKEOPTS="${MAKEOPTS/-j*/-j1} ${MAKEOPTS/-j/CPU=}"
  98. emake
  99. }
  100. src_install() {
  101. cd "gen/${PN}" || die
  102. if use doc; then
  103. dodoc "${S}"/doc/*.pdf
  104. find "${WORKDIR}"/manuals -type f -iname "*.pdf" -exec dodoc '{}' + || die
  105. fi
  106. doheader include/*
  107. rm lib/libfbstatic.a || die "failed to remove libfbstatic.a"
  108. insinto /usr/$(get_libdir)
  109. dolib.so lib/*.so*
  110. # links for backwards compatibility
  111. dosym libfbclient.so /usr/$(get_libdir)/libgds.so
  112. dosym libfbclient.so /usr/$(get_libdir)/libgds.so.0
  113. dosym libfbclient.so /usr/$(get_libdir)/libfbclient.so.1
  114. insinto /usr/$(get_libdir)/${PN}
  115. doins *.msg
  116. einfo "Renaming isql -> fbsql"
  117. mv bin/isql bin/fbsql || die "failed to rename isql -> fbsql"
  118. local bins="fbsql fbsvcmgr fbtracemgr gbak gdef gfix gpre gsec gstat nbackup qli"
  119. for bin in ${bins}; do
  120. dobin bin/${bin}
  121. done
  122. dosbin bin/fb_lock_print
  123. # SuperServer
  124. if use superserver ; then
  125. dosbin bin/{fbguard,fbserver}
  126. # ClassicServer
  127. elif use xinetd ; then
  128. dosbin bin/fb_inet_server
  129. # SuperClassic
  130. else
  131. dosbin bin/{fbguard,fb_smp_server}
  132. #Temp should not be necessary, need to patch/fix
  133. dosym ../../libib_util.so /usr/$(get_libdir)/${PN}/lib/libib_util.so
  134. fi
  135. exeinto /usr/bin/${PN}
  136. exeopts -m0755
  137. doexe bin/{changeRunUser,restoreRootRunUser,changeDBAPassword}.sh
  138. insinto /usr/$(get_libdir)/${PN}/help
  139. doins help/help.fdb
  140. exeinto /usr/$(get_libdir)/firebird/intl
  141. dolib.so intl/libfbintl.so
  142. dosym ../../libfbintl.so /usr/$(get_libdir)/${PN}/intl/fbintl
  143. dosym libfbintl.so /usr/$(get_libdir)/libfbintl.so.1
  144. dosym /etc/firebird/fbintl.conf /usr/$(get_libdir)/${PN}/intl/fbintl.conf
  145. exeinto /usr/$(get_libdir)/${PN}/plugins
  146. dolib.so plugins/libfbtrace.so
  147. dosym ../../libfbtrace.so /usr/$(get_libdir)/${PN}/plugins/libfbtrace.so
  148. dosym libfbtrace.so /usr/$(get_libdir)/libfbtrace.so.0
  149. exeinto /usr/$(get_libdir)/${PN}/UDF
  150. doexe UDF/*.so
  151. insinto /usr/share/${PN}/upgrade
  152. doins -r "${S}"/src/misc/upgrade/v2/*
  153. insinto /etc/${PN}
  154. insopts -m0644 -o firebird -g firebird
  155. doins ../install/misc/*.conf
  156. insopts -m0660 -o firebird -g firebird
  157. doins security2.fdb
  158. if use xinetd ; then
  159. insinto /etc/xinetd.d
  160. newins "${FILESDIR}/${PN}.xinetd" ${PN}
  161. else
  162. newinitd "${FILESDIR}/${PN}.init.d.2.5" ${PN}
  163. newconfd "${FILESDIR}/${PN}.conf.d.2.5" ${PN}
  164. fperms 640 /etc/conf.d/${PN}
  165. fi
  166. insinto /etc/logrotate.d
  167. newins "${FILESDIR}/${PN}.logrotate" ${PN}
  168. fperms 0644 /etc/logrotate.d/${PN}
  169. diropts -m 755 -o firebird -g firebird
  170. dodir /var/log/${PN}
  171. keepdir /var/log/${PN}
  172. use examples && docinto examples
  173. }
  174. pkg_postinst() {
  175. # Hack to fix ownership/perms
  176. chown -fR firebird:firebird "${ROOT}/etc/${PN}" "${ROOT}/usr/$(get_libdir)/${PN}"
  177. chmod 750 "${ROOT}/etc/${PN}"
  178. }
  179. pkg_config() {
  180. # if found /etc/security.gdb from previous install, backup, and restore as
  181. # /etc/security2.fdb
  182. if [[ -f "${ROOT}/etc/firebird/security.gdb" ]] ; then
  183. # if we have scurity2.fdb already, back it 1st
  184. if [[ -f "${ROOT}/etc/firebird/security2.fdb" ]] ; then
  185. cp "${ROOT}/etc/firebird/security2.fdb" "${ROOT}/etc/firebird/security2.fdb.old" || die
  186. fi
  187. gbak -B "${ROOT}/etc/firebird/security.gdb" "${ROOT}/etc/firebird/security.gbk" || die
  188. gbak -R "${ROOT}/etc/firebird/security.gbk" "${ROOT}/etc/firebird/security2.fdb" || die
  189. mv "${ROOT}/etc/firebird/security.gdb" "${ROOT}/etc/firebird/security.gdb.old" || die
  190. rm "${ROOT}/etc/firebird/security.gbk" || die
  191. # make sure they are readable only to firebird
  192. chown firebird:firebird "${ROOT}/etc/firebird/{security.*,security2.*}" || die
  193. chmod 660 "${ROOT}/etc/firebird/{security.*,security2.*}" || die
  194. echo
  195. einfo "Converted old security.gdb to security2.fdb, security.gdb has been "
  196. einfo "renamed to security.gdb.old. if you had previous security2.fdb, "
  197. einfo "it's backed to security2.fdb.old (all under ${ROOT}/etc/firebird)."
  198. echo
  199. fi
  200. # we need to enable local access to the server
  201. if [[ ! -f "${ROOT}/etc/hosts.equiv" ]] ; then
  202. touch "${ROOT}/etc/hosts.equiv" || die
  203. chown root:0 "${ROOT}/etc/hosts.equiv" || die
  204. chmod u=rw,go=r "${ROOT}/etc/hosts.equiv" || die
  205. fi
  206. # add 'localhost.localdomain' to the hosts.equiv file...
  207. if grep -q 'localhost.localdomain$' "${ROOT}/etc/hosts.equiv" ; then
  208. echo "localhost.localdomain" >> "${ROOT}/etc/hosts.equiv" || die
  209. einfo "Added localhost.localdomain to ${ROOT}/etc/hosts.equiv"
  210. fi
  211. # add 'localhost' to the hosts.equiv file...
  212. if grep -q 'localhost$' "${ROOT}/etc/hosts.equiv" ; then
  213. echo "localhost" >> "${ROOT}/etc/hosts.equiv" || die
  214. einfo "Added localhost to ${ROOT}/etc/hosts.equiv"
  215. fi
  216. HS_NAME=`hostname`
  217. if grep -q ${HS_NAME} "${ROOT}/etc/hosts.equiv" ; then
  218. echo "${HS_NAME}" >> "${ROOT}/etc/hosts.equiv" || die
  219. einfo "Added ${HS_NAME} to ${ROOT}/etc/hosts.equiv"
  220. fi
  221. einfo "If you're using UDFs, please remember to move them"
  222. einfo "to /usr/$(get_libdir)/firebird/UDF"
  223. }