1 |
commit: e3dbf227fb7126e54e7b151aac2ec4feffff5e24 |
2 |
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 26 04:03:51 2016 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 26 04:03:51 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/dev/heroxbd.git/commit/?id=e3dbf227 |
7 |
|
8 |
db.eclass: import from prefix tree. |
9 |
|
10 |
eclass/db.eclass | 210 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
11 |
1 file changed, 210 insertions(+) |
12 |
|
13 |
diff --git a/eclass/db.eclass b/eclass/db.eclass |
14 |
new file mode 100644 |
15 |
index 0000000..f7070d4 |
16 |
--- /dev/null |
17 |
+++ b/eclass/db.eclass |
18 |
@@ -0,0 +1,210 @@ |
19 |
+# Copyright 1999-2013 Gentoo Foundation |
20 |
+# Distributed under the terms of the GNU General Public License v2 |
21 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/db.eclass,v 1.49 2013/07/21 09:23:45 pacho Exp $ |
22 |
+# This is a common location for functions used in the sys-libs/db ebuilds |
23 |
+# |
24 |
+# Bugs: maintainer-needed@g.o |
25 |
+ |
26 |
+inherit eutils multilib |
27 |
+ |
28 |
+IUSE="doc test examples" |
29 |
+ |
30 |
+EXPORT_FUNCTIONS src_test |
31 |
+ |
32 |
+DEPEND="test? ( >=dev-lang/tcl-8.4 )" |
33 |
+ |
34 |
+RDEPEND="" |
35 |
+ |
36 |
+db_fix_so() { |
37 |
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" |
38 |
+ LIB="${EROOT}/usr/$(get_libdir)" |
39 |
+ |
40 |
+ cd "${LIB}" |
41 |
+ |
42 |
+ # first clean up old symlinks |
43 |
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname)" -delete |
44 |
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname "[23]")" -delete |
45 |
+ find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname)" -delete #519364 |
46 |
+ find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname "[23]")" -delete #519364 |
47 |
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete |
48 |
+ |
49 |
+ # now rebuild all the correct ones |
50 |
+ for ext in so a dylib sl; do |
51 |
+ for name in libdb libdb_{cxx,tcl,java,sql,stl}; do |
52 |
+ target=`find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -n |tail -n 1` |
53 |
+ [ -n "${target}" ] || continue; |
54 |
+ case ${CHOST} in |
55 |
+ *-aix*) |
56 |
+ aixdll --merge-runtime \ |
57 |
+ --keepdir=false \ |
58 |
+ --target="${name}.${ext}" \ |
59 |
+ --current="${target}" \ |
60 |
+ `find . -maxdepth 1 -type f -name "${name}-*.${ext}"` |
61 |
+ ;; |
62 |
+ *) |
63 |
+ ln -sf ${target//.\//} ${name}.${ext} |
64 |
+ ;; |
65 |
+ esac; |
66 |
+ done; |
67 |
+ done; |
68 |
+ |
69 |
+ # db[23] gets some extra-special stuff |
70 |
+ if [ -f libdb1$(get_libname 2) ]; then |
71 |
+ ln -sf libdb1$(get_libname 2) libdb$(get_libname 2) |
72 |
+ ln -sf libdb1$(get_libname 2) libdb1$(get_libname) |
73 |
+ ln -sf libdb1$(get_libname 2) libdb-1$(get_libame) |
74 |
+ fi |
75 |
+ # what do we do if we ever get 3.3 ? |
76 |
+ for i in libdb libdb_{cxx,tcl,java,sql,stl}; do |
77 |
+ if [ -f $i-3$(get_libname 2) ]; then |
78 |
+ ln -sf $i-3$(get_libname 2) $i-3$(get_libname) |
79 |
+ ln -sf $i-3$(get_libname 2) $i$(get_libname 3) |
80 |
+ fi |
81 |
+ done |
82 |
+ |
83 |
+ # do the same for headers now |
84 |
+ # but since there are only two of them, just overwrite them |
85 |
+ cd "${EROOT}"/usr/include |
86 |
+ target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ -f2- | tail -n1` |
87 |
+ if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then |
88 |
+ einfo "Creating db.h symlinks to ${target}" |
89 |
+ ln -sf "${target}"/db.h . |
90 |
+ ln -sf "${target}"/db_185.h . |
91 |
+ elif [ ! -e "${target}/db.h" ]; then |
92 |
+ if [ -n "${target}" ]; then |
93 |
+ ewarn "Could not find ${target}/db.h" |
94 |
+ elif [ -h db.h ]; then |
95 |
+ einfo "Apparently you just removed the last instance of $PN. Removing the symlinks" |
96 |
+ rm -f db.h db_185.h |
97 |
+ fi |
98 |
+ fi |
99 |
+} |
100 |
+ |
101 |
+db_src_install_doc() { |
102 |
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" |
103 |
+ # not everybody wants this wad of documentation as it is primarily API docs |
104 |
+ if use doc; then |
105 |
+ dodir /usr/share/doc/${PF}/html |
106 |
+ mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/ |
107 |
+ rm -rf "${ED}"/usr/docs |
108 |
+ else |
109 |
+ rm -rf "${ED}"/usr/docs |
110 |
+ fi |
111 |
+ |
112 |
+ db_src_install_examples |
113 |
+} |
114 |
+ |
115 |
+db_src_install_examples() { |
116 |
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" |
117 |
+ if use examples ; then |
118 |
+ local langs="c cxx stl" |
119 |
+ [[ "${IUSE/java}" != "${IUSE}" ]] \ |
120 |
+ && use java \ |
121 |
+ && langs="${langs} java" |
122 |
+ for i in $langs ; do |
123 |
+ destdir="/usr/share/doc/${PF}/" |
124 |
+ src="${S}/../examples_${i}/" |
125 |
+ if [ -f "${src}" ]; then |
126 |
+ dodir "${destdir}" |
127 |
+ cp -ra "${src}" "${ED}${destdir}/" |
128 |
+ fi |
129 |
+ done |
130 |
+ fi |
131 |
+} |
132 |
+ |
133 |
+db_src_install_usrbinslot() { |
134 |
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" |
135 |
+ # slot all program names to avoid overwriting |
136 |
+ for fname in "${ED}"/usr/bin/db* |
137 |
+ do |
138 |
+ dn="$(dirname "${fname}")" |
139 |
+ bn="$(basename "${fname}")" |
140 |
+ bn="${bn/db/db${SLOT}}" |
141 |
+ mv "${fname}" "${dn}/${bn}" || \ |
142 |
+ die "Failed to rename ${fname} to ${dn}/${bn}" |
143 |
+ done |
144 |
+} |
145 |
+ |
146 |
+db_src_install_headerslot() { |
147 |
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" |
148 |
+ # install all headers in a slotted location |
149 |
+ dodir /usr/include/db${SLOT} |
150 |
+ mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/ |
151 |
+} |
152 |
+ |
153 |
+db_src_install_usrlibcleanup() { |
154 |
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" |
155 |
+ LIB="${ED}/usr/$(get_libdir)" |
156 |
+ # Clean out the symlinks so that they will not be recorded in the |
157 |
+ # contents (bug #60732) |
158 |
+ |
159 |
+ if [ "${ED}" = "" ]; then |
160 |
+ die "Calling clean_links while \$ED not defined" |
161 |
+ fi |
162 |
+ |
163 |
+ if [ -e "${LIB}"/libdb.a ] && [ ! -e "${LIB}"/libdb-${SLOT}.a ]; then |
164 |
+ einfo "Moving libdb.a to a versioned name" |
165 |
+ mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a" |
166 |
+ fi |
167 |
+ |
168 |
+ if [ -e "${LIB}"/libdb_cxx.a ] && [ ! -e "${LIB}"/libdb_cxx-${SLOT}.a ]; then |
169 |
+ einfo "Moving libdb_cxx.a to a versioned name" |
170 |
+ mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a" |
171 |
+ fi |
172 |
+ |
173 |
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname)" -delete |
174 |
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname "[23]")" -delete |
175 |
+ find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname)" -delete #519364 |
176 |
+ find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname "[23]")" -delete #519364 |
177 |
+ einfo "removing unversioned static archives" |
178 |
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete |
179 |
+ |
180 |
+ rm -f \ |
181 |
+ "${ED}"/usr/include/{db,db_185}.h \ |
182 |
+ "${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a |
183 |
+} |
184 |
+ |
185 |
+db_src_test() { |
186 |
+ if [[ $UID -eq 0 ]]; then |
187 |
+ M="You must run the testsuite as non-root, skipping" |
188 |
+ ewarn "${M}" |
189 |
+ elog "${M}" |
190 |
+ return 0 |
191 |
+ fi |
192 |
+ |
193 |
+ if use tcl; then |
194 |
+ einfo "Running sys-libs/db testsuite" |
195 |
+ ewarn "This can take 6+ hours on modern machines" |
196 |
+ # Fix stuff that fails with relative paths, and upstream moving files |
197 |
+ # around... |
198 |
+ local test_parallel='' |
199 |
+ for t in \ |
200 |
+ "${S}"/test/parallel.tcl \ |
201 |
+ "${S}"/../test/parallel.tcl \ |
202 |
+ "${S}"/test/tcl/parallel.tcl \ |
203 |
+ "${S}"/../test/tcl/parallel.tcl \ |
204 |
+ ; do |
205 |
+ [[ -f "${t}" ]] && test_parallel="${t}" && break |
206 |
+ done |
207 |
+ |
208 |
+ sed -ri \ |
209 |
+ -e '/regsub .test_path ./s,(regsub),#\1,g' \ |
210 |
+ -e '/regsub .src_root ./s,(regsub),#\1,g' \ |
211 |
+ -e '/regsub .tcl_utils ./s,(regsub),#\1,g' \ |
212 |
+ "${test_parallel}" |
213 |
+ cd "${S}" |
214 |
+ for t in \ |
215 |
+ ../test/test.tcl \ |
216 |
+ ../test/tcl/test.tcl \ |
217 |
+ ; do |
218 |
+ [[ -f "${t}" ]] && testbase="${t}" && break |
219 |
+ done |
220 |
+ echo "source ${t}" > testrunner.tcl |
221 |
+ echo "run_parallel $(makeopts_jobs) run_std" >> testrunner.tcl |
222 |
+ |
223 |
+ tclsh testrunner.tcl |
224 |
+ egrep -qs '^FAIL' ALL.OUT* && die "Some tests failed, please see ${S}/ALL.OUT*" |
225 |
+ else |
226 |
+ eerror "You must have USE=tcl to run the sys-libs/db testsuite." |
227 |
+ fi |
228 |
+} |