/[gentoo-alt]/trunk/prefix/eclass/db.eclass
Gentoo

Contents of /trunk/prefix/eclass/db.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 982 - (show annotations) (download)
Thu Feb 2 04:20:17 2006 UTC (13 years, 2 months ago) by kito
File size: 3425 byte(s)
Initial eclass import from gentoo-x86
1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/db.eclass,v 1.22 2006/01/01 01:14:59 swegener Exp $
4 # This is a common location for functions used in the sys-libs/db ebuilds
5
6 IUSE="doc"
7
8 EXPORT_FUNCTIONS src_test
9
10 db_fix_so () {
11 cd ${ROOT}/usr/lib
12
13 # first clean up old symlinks
14 find ${ROOT}/usr/lib -maxdepth 1 -type l -name 'libdb[1._-]*so' -exec rm \{} \;
15 find ${ROOT}/usr/lib -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -exec rm \{} \;
16 find ${ROOT}/usr/lib -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
17
18 # now rebuild all the correct ones
19 for ext in so a; do
20 for name in libdb libdb_cxx libdb_tcl libdb_java; do
21 target=`find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -g |tail -n 1`
22 [ -n "${target}" ] && ln -sf ${target//.\//} ${name}.${ext}
23 done;
24 done;
25
26 # db[23] gets some extra-special stuff
27 if [ -f libdb1.so.2 ]; then
28 ln -sf libdb1.so.2 libdb.so.2
29 ln -sf libdb1.so.2 libdb1.so
30 ln -sf libdb1.so.2 libdb-1.so
31 fi
32 # what do we do if we ever get 3.3 ?
33 for i in libdb libdb_cxx libdb_tcl libdb_java; do
34 if [ -f $i-3.2.so ]; then
35 ln -sf $i-3.2.so $i-3.so
36 ln -sf $i-3.2.so $i.so.3
37 fi
38 done
39
40 # do the same for headers now
41 # but since there are only two of them, just overwrite them
42 cd ${ROOT}/usr/include
43 target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -g |cut -d/ -f2- | tail -n1`
44 if [ -n "${target}" ] && [ -e "${target}/db.h" ]; then
45 einfo "Creating db.h symlinks to ${target}"
46 ln -sf ${target}/db.h .
47 ln -sf ${target}/db_185.h .
48 elif [ ! -e "${target}/db.h" ]; then
49 if [ -n ${target} ]; then
50 ewarn "Could not find ${target}/db.h"
51 else
52 einfo "Apparently you just removed the last instance of $PN. Removing the symlinks"
53 fi
54 rm db.h db_185.h
55 fi
56 }
57
58 db_src_install_doc() {
59 # not everybody wants this wad of documentation as it is primarily API docs
60 if use doc; then
61 dodir /usr/share/doc/${PF}/html
62 mv ${D}/usr/docs/* ${D}/usr/share/doc/${PF}/html/
63 rm -rf ${D}/usr/docs
64 else
65 rm -rf ${D}/usr/docs
66 fi
67 }
68
69 db_src_install_usrbinslot() {
70 # slot all program names to avoid overwriting
71 for fname in ${D}/usr/bin/db_*
72 do
73 mv ${fname} ${fname//\/db_/\/db${SLOT}_}
74 done
75 }
76
77 db_src_install_headerslot() {
78 # install all headers in a slotted location
79 dodir /usr/include/db${SLOT}
80 mv ${D}/usr/include/*.h ${D}/usr/include/db${SLOT}/
81 }
82
83 db_src_install_usrlibcleanup() {
84 # Clean out the symlinks so that they will not be recorded in the
85 # contents (bug #60732)
86
87 if [ "${D}" = "" ]; then
88 die "Calling clean_links while \$D not defined"
89 fi
90
91 find ${D}/usr/lib -maxdepth 1 -type l -name 'libdb[1._-]*so' -exec rm \{} \;
92 find ${D}/usr/lib -maxdepth 1 -type l -name 'libdb[1._-]*so.[23]' -exec rm \{} \;
93 find ${D}/usr/lib -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
94
95 rm -f ${D}/usr/include/db.h ${D}/usr/include/db_185.h
96 }
97
98 db_src_test() {
99 if has test $FEATURES; then
100 if useq tcltk; then
101 einfo "Running sys-libs/db testsuite"
102 ewarn "This can take 6+ hours on modern machines"
103 cd ${S}
104 echo 'source ../test/test.tcl' >testrunner.tcl
105 echo 'run_std' >>testrunner.tcl
106 tclsh testrunner.tcl
107 egrep -sv '^FAIL' ALL.OUT
108 ret=$?
109 [ $ret -gt 0 ] && die "Some tests failed, please see ${S}/ALL.OUT"
110 else
111 eerror "You must have USE=tcltk to run the sys-libs/db testsuite."
112 fi
113 fi
114 }

  ViewVC Help
Powered by ViewVC 1.1.20