*/*: Specify EAPI=0 explicitly, to ease greps
[gentoo.git] / sys-libs / db / db-4.2.52_p5-r1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=0
5
6 inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
7
8 #Number of official patches
9 #PATCHNO=`echo ${PV}|sed -e "s,\(.*_p\)\([0-9]*\),\2,"`
10 PATCHNO=${PV/*.*.*_p}
11 if [[ ${PATCHNO} == "${PV}" ]] ; then
12         MY_PV=${PV}
13         MY_P=${P}
14         PATCHNO=0
15 else
16         MY_PV=${PV/_p${PATCHNO}}
17         MY_P=${PN}-${MY_PV}
18 fi
19
20 S="${WORKDIR}/${MY_P}/build_unix"
21 DESCRIPTION="Oracle Berkeley DB"
22 HOMEPAGE="http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html"
23 SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
24 for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
25         export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
26 done
27
28 LICENSE="Sleepycat"
29 SLOT="4.2"
30 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
31 IUSE="tcl java doc cxx rpc"
32
33 DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
34         java? ( >=virtual/jdk-1.4 )"
35 RDEPEND="tcl? ( dev-lang/tcl )
36         java? ( >=virtual/jre-1.4 )"
37
38 src_unpack() {
39         unpack "${MY_P}".tar.gz
40         cd "${WORKDIR}"/"${MY_P}"
41         for (( i=1 ; i<=${PATCHNO} ; i++ ))
42         do
43                 epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
44         done
45         epatch "${FILESDIR}"/"${PN}"-4.2.52_p2-TXN.patch
46         epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-libtool.patch
47
48         # use the includes from the prefix
49         epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-jni-check-prefix-first.patch
50         epatch "${FILESDIR}"/"${PN}"-"${SLOT}"-listen-to-java-options.patch
51         epatch "${FILESDIR}"/"${PN}"-4.0.14-fix-dep-link.patch
52
53         sed -e "/^DB_RELEASE_DATE=/s/%B %e, %Y/%Y-%m-%d/" -i dist/RELEASE
54
55         # Include the SLOT for Java JAR files
56         # This supersedes the unused jarlocation patches.
57         sed -r -i \
58                 -e '/jarfile=.*\.jar$/s,(.jar$),-$(LIBVERSION)\1,g' \
59                 "${S}"/../dist/Makefile.in
60
61         # START of 4.5+earlier specific
62         # Upstream sucks, they normally concat these
63         cd "${S}"/../dist/aclocal
64         for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
65         cd "${S}"/../dist/aclocal_java
66         for i in *; do ln -s $i ${i%.ac}.m4 ; done ;
67         # END of 4.5+earlier specific
68         cd "${S}"/../dist
69         rm -f aclocal/libtool.{m4,ac} aclocal.m4
70         sed -i \
71                 -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
72                 configure.ac
73         sed -i \
74                 -e '/^AC_PATH_TOOL/s/ sh, missing_sh/ bash, missing_sh/' \
75                 aclocal/programs.m4
76         AT_M4DIR="aclocal aclocal_java" eautoreconf
77         # Upstream sucks - they do autoconf and THEN replace the version variables.
78         . ./RELEASE
79         sed -i \
80                 -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
81                 -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
82                 -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
83                 -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
84                 -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
85                 -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
86 }
87
88 src_compile() {
89         local myconf=""
90
91         use amd64 && myconf="${myconf} --with-mutex=x86/gcc-assembly"
92
93         myconf="${myconf} $(use_enable cxx)"
94
95         use tcl \
96                 && myconf="${myconf} --enable-tcl --with-tcl=${EPREFIX}/usr/$(get_libdir)" \
97                 || myconf="${myconf} --disable-tcl"
98
99         myconf="${myconf} $(use_enable java)"
100         if use java; then
101                 myconf="${myconf} --with-java-prefix=${JAVA_HOME}"
102                 # Can't get this working any other way, since it returns spaces, and
103                 # bash doesn't seem to want to pass correctly in any way i try
104                 local javaconf="-with-javac-flags=$(java-pkg_javac-args)"
105         fi
106
107         [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
108
109         # the entire testsuite needs the TCL functionality
110         if use tcl && use test; then
111                 myconf="${myconf} --enable-test"
112         else
113                 myconf="${myconf} --disable-test"
114         fi
115
116         cd "${S}" && ECONF_SOURCE="${S}"/../dist econf \
117                 --prefix="${EPREFIX}"/usr \
118                 --mandir="${EPREFIX}"/usr/share/man \
119                 --infodir="${EPREFIX}"/usr/share/info \
120                 --datadir="${EPREFIX}"/usr/share \
121                 --sysconfdir="${EPREFIX}"/etc \
122                 --localstatedir="${EPREFIX}"/var/lib \
123                 --libdir="${EPREFIX}"/usr/"$(get_libdir)" \
124                 --enable-compat185 \
125                 --with-uniquename \
126                 $(use_enable rpc) \
127                 --host="${CHOST}" \
128                 ${myconf} "${javaconf}" || die "configure failed"
129
130         # This isn't safe for prefix (Darwin should be .jnilib), but I can't get the
131         # build system to behave itself, it generates libtool too late.
132         sed -i \
133                 -e 's/-shrext  $(SOFLAGS)/-shrext .so $(SOFLAGS)/g' \
134                 Makefile
135         emake || die "make failed"
136 }
137
138 src_install() {
139         einstall libdir="${ED}/usr/$(get_libdir)" strip="${ED}/bin/strip" || die
140
141         db_src_install_usrbinslot
142
143         db_src_install_headerslot
144
145         db_src_install_doc
146
147         db_src_install_usrlibcleanup
148
149         dodir /usr/sbin
150         # This file is not always built, and no longer exists as of db-4.8
151         [[ -f "${ED}"/usr/bin/berkeley_db_svc ]] && \
152         mv "${ED}"/usr/bin/berkeley_db_svc "${ED}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
153
154         if use java; then
155                 java-pkg_regso "${ED}"/usr/"$(get_libdir)"/libdb_java*.so
156                 java-pkg_dojar "${ED}"/usr/"$(get_libdir)"/*.jar
157                 rm -f "${ED}"/usr/"$(get_libdir)"/*.jar
158         fi
159 }
160
161 pkg_postinst() {
162         db_fix_so
163 }
164
165 pkg_postrm() {
166         db_fix_so
167 }