dev-ruby/metaclass-0.0.4-r0: add alpha keyword
[gentoo.git] / sys-libs / db / db-4.7.25_p4.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 inherit eutils db flag-o-matic java-pkg-opt-2 autotools multilib
6
7 #Number of official patches
8 #PATCHNO=`echo ${PV}|sed -e "s,\(.*_p\)\([0-9]*\),\2,"`
9 PATCHNO=${PV/*.*.*_p}
10 if [[ ${PATCHNO} == "${PV}" ]] ; then
11         MY_PV=${PV}
12         MY_P=${P}
13         PATCHNO=0
14 else
15         MY_PV=${PV/_p${PATCHNO}}
16         MY_P=${PN}-${MY_PV}
17 fi
18
19 S="${WORKDIR}/${MY_P}/build_unix"
20 DESCRIPTION="Oracle Berkeley DB"
21 HOMEPAGE="http://www.oracle.com/technology/software/products/berkeley-db/index.html"
22 SRC_URI="http://download.oracle.com/berkeley-db/${MY_P}.tar.gz"
23 for (( i=1 ; i<=${PATCHNO} ; i++ )) ; do
24         export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
25 done
26
27 LICENSE="Sleepycat"
28 SLOT="4.7"
29 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
30 IUSE="doc java cxx tcl test rpc"
31
32 # the entire testsuite needs the TCL functionality
33 DEPEND="tcl? ( >=dev-lang/tcl-8.4 )
34         test? ( >=dev-lang/tcl-8.4 )
35         java? ( >=virtual/jdk-1.5 )
36         >=sys-devel/binutils-2.16.1"
37 RDEPEND="tcl? ( dev-lang/tcl )
38         java? ( >=virtual/jre-1.5 )"
39
40 src_unpack() {
41         unpack "${MY_P}".tar.gz
42         cd "${WORKDIR}"/"${MY_P}"
43         for (( i=1 ; i<=${PATCHNO} ; i++ ))
44         do
45                 epatch "${DISTDIR}"/patch."${MY_PV}"."${i}"
46         done
47         epatch "${FILESDIR}"/"${PN}"-4.6-libtool.patch
48
49         # use the includes from the prefix
50         epatch "${FILESDIR}"/"${PN}"-4.6-jni-check-prefix-first.patch
51         epatch "${FILESDIR}"/"${PN}"-4.3-listen-to-java-options.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         cd "${S}"/../dist
62         rm -f aclocal/libtool.m4
63         sed -i \
64                 -e '/AC_PROG_LIBTOOL$/aLT_OUTPUT' \
65                 configure.ac
66         sed -i \
67                 -e '/^AC_PATH_TOOL/s/ sh, none/ bash, none/' \
68                 aclocal/programs.m4
69         AT_M4DIR="aclocal aclocal_java" eautoreconf
70         # Upstream sucks - they do autoconf and THEN replace the version variables.
71         . ./RELEASE
72         sed -i \
73                 -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
74                 -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
75                 -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
76                 -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
77                 -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
78                 -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure
79 }
80
81 src_compile() {
82         local myconf=''
83
84         # compilation with -O0 fails on amd64, see bug #171231
85         if use amd64; then
86                 replace-flags -O0 -O2
87                 is-flagq -O[s123] || append-flags -O2
88         fi
89
90         # use `set` here since the java opts will contain whitespace
91         set --
92         if use java ; then
93                 set -- "$@" \
94                         --with-java-prefix="${JAVA_HOME}" \
95                         --with-javac-flags="$(java-pkg_javac-args)"
96         fi
97
98         # Add linker versions to the symbols. Easier to do, and safer than header file
99         # mumbo jumbo.
100         if use userland_GNU ; then
101                 append-ldflags -Wl,--default-symver
102         fi
103
104         # Bug #270851: test needs TCL support
105         if use tcl || use test ; then
106                 myconf="${myconf} --enable-tcl"
107                 myconf="${myconf} --with-tcl=/usr/$(get_libdir)"
108         else
109                 myconf="${myconf} --disable-tcl"
110         fi
111
112         cd "${S}"
113         ECONF_SOURCE="${S}"/../dist \
114         STRIP="true" \
115         econf \
116                 --enable-compat185 \
117                 --enable-o_direct \
118                 --without-uniquename \
119                 $(use_enable rpc) \
120                 $(use arm && echo --with-mutex=ARM/gcc-assembly) \
121                 $(use amd64 && echo --with-mutex=x86/gcc-assembly) \
122                 $(use_enable cxx) \
123                 $(use_enable java) \
124                 ${myconf} \
125                 $(use_enable test) \
126                 "$@"
127
128         emake || die "make failed"
129 }
130
131 src_install() {
132         emake install DESTDIR="${D}" || die
133
134         db_src_install_usrbinslot
135
136         db_src_install_headerslot
137
138         db_src_install_doc
139
140         db_src_install_usrlibcleanup
141
142         dodir /usr/sbin
143         # This file is not always built, and no longer exists as of db-4.8
144         [[ -f "${D}"/usr/bin/berkeley_db_svc ]] && \
145         mv "${D}"/usr/bin/berkeley_db_svc "${D}"/usr/sbin/berkeley_db"${SLOT/./}"_svc
146
147         if use java; then
148                 java-pkg_regso "${D}"/usr/"$(get_libdir)"/libdb_java*.so
149                 java-pkg_dojar "${D}"/usr/"$(get_libdir)"/*.jar
150                 rm -f "${D}"/usr/"$(get_libdir)"/*.jar
151         fi
152 }
153
154 pkg_postinst() {
155         db_fix_so
156 }
157
158 pkg_postrm() {
159         db_fix_so
160 }