Gentoo Archives: gentoo-commits

From: Thomas Beierlein <tomjbe@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-backup/bacula/files/, app-backup/bacula/
Date: Fri, 03 Jun 2022 07:58:27
Message-Id: 1654243086.e453613efdefbc2fbac2ed0454c3571e68276ceb.tomjbe@gentoo
1 commit: e453613efdefbc2fbac2ed0454c3571e68276ceb
2 Author: Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 3 07:51:10 2022 +0000
4 Commit: Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 3 07:58:06 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e453613e
7
8 app-backup/bacula: Fix soname in libbaccat.so i
9
10 Actual libtool needs a patch to accept '-soname' command line switch,
11 otherwise it will ignored.
12 slibtool in contrast responds with error and is not easy to patch.
13
14 Solution here drops the '-soname' switch and uses patchelf program to
15 fix the SONAME after the library is build.
16
17 Closes: https://bugs.gentoo.org/790140
18 Closes: https://bugs.gentoo.org/845126
19 Signed-off-by: Thomas Beierlein <tomjbe <AT> gentoo.org>
20
21 app-backup/bacula/bacula-11.0.6-r2.ebuild | 417 +++++++++++++++++++++
22 .../bacula/files/bacula-fix-sonames-new.patch | 37 ++
23 2 files changed, 454 insertions(+)
24
25 diff --git a/app-backup/bacula/bacula-11.0.6-r2.ebuild b/app-backup/bacula/bacula-11.0.6-r2.ebuild
26 new file mode 100644
27 index 000000000000..4f6706f68b34
28 --- /dev/null
29 +++ b/app-backup/bacula/bacula-11.0.6-r2.ebuild
30 @@ -0,0 +1,417 @@
31 +# Copyright 1999-2022 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +inherit desktop libtool qmake-utils systemd
37 +
38 +MY_PV=${PV/_beta/-b}
39 +MY_P=${PN}-${MY_PV}
40 +
41 +DESCRIPTION="Featureful client/server network backup suite"
42 +HOMEPAGE="https://www.bacula.org/"
43 +SRC_URI="mirror://sourceforge/bacula/${MY_P}.tar.gz"
44 +
45 +LICENSE="AGPL-3"
46 +SLOT="0"
47 +KEYWORDS="~amd64 ~ppc ~sparc ~x86"
48 +IUSE="acl bacula-clientonly bacula-nodir bacula-nosd +batch-insert examples ipv6 logwatch mysql postgres qt5 readline +sqlite ssl static tcpd vim-syntax X"
49 +
50 +DEPEND="
51 + !bacula-clientonly? (
52 + !bacula-nodir? ( virtual/mta )
53 + postgres? ( dev-db/postgresql:=[threads] )
54 + mysql? ( || ( dev-db/mysql-connector-c dev-db/mariadb-connector-c ) )
55 + sqlite? ( dev-db/sqlite:3 )
56 + )
57 + dev-libs/gmp:0
58 + qt5? (
59 + dev-qt/qtcore:5
60 + dev-qt/qtgui:5
61 + dev-qt/qtwidgets:5
62 + dev-qt/qtsvg:5
63 + x11-libs/qwt:6
64 + )
65 + logwatch? ( sys-apps/logwatch )
66 + readline? ( sys-libs/readline:0 )
67 + static? (
68 + dev-libs/lzo[static-libs]
69 + sys-libs/ncurses:=[static-libs]
70 + sys-libs/zlib[static-libs]
71 + acl? ( virtual/acl[static-libs(+)] )
72 + ssl? (
73 + dev-libs/openssl:0=[static-libs]
74 + )
75 + )
76 + !static? (
77 + dev-libs/lzo
78 + sys-libs/ncurses:=
79 + sys-libs/zlib
80 + acl? ( virtual/acl )
81 + ssl? (
82 + dev-libs/openssl:0=
83 + )
84 + )
85 + tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
86 + dev-util/patchelf
87 +"
88 +RDEPEND="${DEPEND}
89 + acct-user/bacula
90 + acct-group/bacula
91 + !bacula-clientonly? (
92 + !bacula-nosd? (
93 + app-arch/mt-st
94 + sys-block/mtx
95 + )
96 + )
97 + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
98 +"
99 +
100 +REQUIRED_USE="
101 + !bacula-clientonly? ( ^^ ( mysql postgres sqlite ) )
102 + static? ( bacula-clientonly )
103 +"
104 +
105 +S=${WORKDIR}/${MY_P}
106 +
107 +pkg_setup() {
108 + #XOR and !bacula-clientonly controlled by REQUIRED_USE
109 + use mysql && export mydbtype="mysql"
110 + use postgres && export mydbtype="postgresql"
111 + use sqlite && export mydbtype="sqlite3"
112 +
113 + if use bacula-clientonly && use static && use qt5; then
114 + ewarn
115 + ewarn "Building statically linked 'bat' is not supported. Ignorig 'qt5' useflag."
116 + ewarn
117 + fi
118 +}
119 +
120 +src_prepare() {
121 + # adjusts default configuration files for several binaries
122 + # to /etc/bacula/<config> instead of ./<config>
123 + pushd src >&/dev/null || die
124 + for f in console/console.c dird/dird.c filed/filed.c \
125 + stored/bcopy.c stored/bextract.c stored/bls.c \
126 + stored/bscan.c stored/btape.c stored/stored.c \
127 + qt-console/main.cpp; do
128 + sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bacula/|g' "${f}" \
129 + || die "sed on ${f} failed"
130 + done
131 + popd >&/dev/null || die
132 +
133 + # bug 466688 drop deprecated categories from Desktop file
134 + sed -i -e 's/Application;//' scripts/bat.desktop.in || die
135 +
136 + # bug 466690 Use CXXFLAGS instead of CFLAGS
137 + sed -i -e 's/@CFLAGS@/@CXXFLAGS@/' autoconf/Make.common.in || die
138 +
139 + # drop automatic install of unneeded documentation (for bug 356499)
140 + eapply -p0 "${FILESDIR}"/7.2.0/${PN}-7.2.0-doc.patch
141 +
142 + # bug #310087
143 + eapply "${FILESDIR}"/5.2.3/${PN}-5.2.3-as-needed.patch
144 +
145 + # bug #311161
146 + eapply -p0 "${FILESDIR}"/9.0.2/${PN}-9.0.2-lib-search-path.patch
147 +
148 + # bat needs to respect LDFLAGS and CFLAGS
149 + eapply -p0 "${FILESDIR}"/9.0.6/${PN}-9.0.6-bat-pro.patch
150 +
151 + # bug #328701
152 + eapply -p0 "${FILESDIR}"/5.2.3/${PN}-5.2.3-openssl-1.patch
153 +
154 + eapply -p0 "${FILESDIR}"/${PN}-11.0.2-fix-static.patch
155 +
156 + # fix soname in libbaccat.so, see bugs #602952, #790140 and #845126
157 + eapply "${FILESDIR}/bacula-fix-sonames-new.patch"
158 +
159 + # do not strip binaries
160 + sed -i -e "s/strip /# strip /" src/filed/Makefile.in || die
161 + sed -i -e "s/strip /# strip /" src/console/Makefile.in || die
162 +
163 + eapply_user
164 +
165 + # Fix systemd unit files:
166 + # bug 497748
167 + sed -i -e '/Requires/d' platforms/systemd/*.service.in || die
168 + sed -i -e '/StandardOutput/d' platforms/systemd/*.service.in || die
169 + # bug 504370
170 + sed -i -e '/Alias=bacula-dir/d' platforms/systemd/bacula-dir.service.in || die
171 + # bug 584442 and 504368
172 + sed -i -e 's/@dir_user@/root/g' platforms/systemd/bacula-dir.service.in || die
173 +
174 + # build 'bat' for Qt5
175 + export QMAKE="$(qt5_get_bindir)"/qmake
176 +
177 + # adapt to >=Qt-5.9 (see bug #644566)
178 + # qmake needs an existing target file to generate install instructions
179 + sed -i -e 's#bins.files = bat#bins.files = .libs/bat#g' \
180 + src/qt-console/bat.pro.in || die
181 + mkdir src/qt-console/.libs || die
182 + touch src/qt-console/.libs/bat || die
183 + chmod 755 src/qt-console/.libs/bat || die
184 +
185 + # Don't let program install man pages directly
186 + sed -i -e 's/ manpages//' Makefile.in || die
187 +
188 + # correct installation for plugins to mode 0755 (bug #725946)
189 + sed -i -e "s/(INSTALL_PROGRAM) /(INSTALL_LIB) /" src/plugins/fd/Makefile.in ||die
190 +
191 + # fix bundled libtool (bug 466696)
192 + # But first move directory with M4 macros out of the way.
193 + # It is only needed by autoconf and gives errors during elibtoolize.
194 + mv autoconf/libtool autoconf/libtool1 || die
195 + elibtoolize
196 +}
197 +
198 +src_configure() {
199 + local myconf=''
200 +
201 + if use bacula-clientonly; then
202 + myconf="${myconf} \
203 + $(use_enable bacula-clientonly client-only) \
204 + $(use_enable !static libtool) \
205 + $(use_enable static static-cons) \
206 + $(use_enable static static-fd)"
207 + else
208 + myconf="${myconf} \
209 + $(use_enable !bacula-nodir build-dird) \
210 + $(use_enable !bacula-nosd build-stored)"
211 + # bug #311099
212 + # database support needed by dir-only *and* sd-only
213 + # build as well (for building bscan, btape, etc.)
214 + myconf="${myconf}
215 + --with-${mydbtype}"
216 + fi
217 +
218 + # do not build bat if 'static' clientonly
219 + if ! use bacula-clientonly || ! use static; then
220 + myconf="${myconf} \
221 + $(use_enable qt5 bat)"
222 + fi
223 +
224 + myconf="${myconf} \
225 + $(use_with X x) \
226 + $(use_enable batch-insert) \
227 + $(use_enable !readline conio) \
228 + $(use_enable readline) \
229 + $(use_with ssl openssl) \
230 + $(use_enable ipv6) \
231 + $(use_enable acl) \
232 + $(use_with tcpd tcp-wrappers)"
233 +
234 + econf \
235 + --with-pid-dir=/var/run \
236 + --sysconfdir=/etc/bacula \
237 + --with-archivedir=/var/lib/bacula/tmp \
238 + --with-subsys-dir=/var/lock/subsys \
239 + --with-working-dir=/var/lib/bacula \
240 + --with-logdir=/var/lib/bacula \
241 + --with-scriptdir=/usr/libexec/bacula \
242 + --with-systemd=$(systemd_get_systemunitdir) \
243 + --with-dir-user=bacula \
244 + --with-dir-group=bacula \
245 + --with-sd-user=root \
246 + --with-sd-group=bacula \
247 + --with-fd-user=root \
248 + --with-fd-group=bacula \
249 + --enable-smartalloc \
250 + --disable-afs \
251 + --without-s3 \
252 + --host=${CHOST} \
253 + ${myconf}
254 +}
255 +
256 +src_compile() {
257 + # Make build log verbose (bug #447806)
258 + emake NO_ECHO=""
259 +}
260 +
261 +src_install() {
262 + emake DESTDIR="${D}" install
263 + doicon scripts/bacula.png
264 +
265 + # remove not needed .la files #840957
266 + find "${ED}" -name '*.la' -delete || die
267 +
268 + # install bat icon and desktop file when enabled
269 + # (for some reason ./configure doesn't pick this up)
270 + if use qt5 && ! use static ; then
271 + doicon src/qt-console/images/bat_icon.png
272 + domenu scripts/bat.desktop
273 + fi
274 +
275 + # remove some scripts we don't need at all
276 + rm -f "${D}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}
277 +
278 + # rename statically linked apps
279 + if use bacula-clientonly && use static ; then
280 + pushd "${D}"/usr/sbin || die
281 + mv static-bacula-fd bacula-fd || die
282 + mv static-bconsole bconsole || die
283 + popd || die
284 + fi
285 +
286 + # extra files which 'make install' doesn't cover
287 + if ! use bacula-clientonly; then
288 + # the database update scripts
289 + diropts -m0750
290 + insinto /usr/libexec/bacula/updatedb
291 + insopts -m0754
292 + doins "${S}"/updatedb/*
293 + fperms 0640 /usr/libexec/bacula/updatedb/README
294 +
295 + # the logrotate configuration
296 + # (now unconditional wrt bug #258187)
297 + diropts -m0755
298 + insinto /etc/logrotate.d
299 + insopts -m0644
300 + newins "${S}"/scripts/logrotate bacula
301 +
302 + # the logwatch scripts
303 + if use logwatch; then
304 + diropts -m0750
305 + dodir /usr/share/logwatch/scripts/services
306 + dodir /usr/share/logwatch/scripts/shared
307 + dodir /etc/logwatch/conf/logfiles
308 + dodir /etc/logwatch/conf/services
309 + pushd "${S}"/scripts/logwatch >&/dev/null || die
310 + emake DESTDIR="${D}" install
311 + popd >&/dev/null || die
312 + fi
313 + fi
314 +
315 + # Install all man pages
316 + doman "${S}"/manpages/*.[18]
317 +
318 + if ! use qt5; then
319 + rm -vf "${D}"/usr/share/man/man1/bat.1*
320 + fi
321 + rm -vf "${D}"/usr/share/man/man1/bacula-tray-monitor.1*
322 +
323 + if use bacula-clientonly || use bacula-nodir ; then
324 + rm -vf "${D}"/usr/libexec/bacula/create_*_database
325 + rm -vf "${D}"/usr/libexec/bacula/drop_*_database
326 + rm -vf "${D}"/usr/libexec/bacula/make_*_tables
327 + rm -vf "${D}"/usr/libexec/bacula/update_*_tables
328 + rm -vf "${D}"/usr/libexec/bacula/drop_*_tables
329 + rm -vf "${D}"/usr/libexec/bacula/grant_*_privileges
330 + rm -vf "${D}"/usr/libexec/bacula/*_catalog_backup
331 + fi
332 + if use bacula-clientonly || use bacula-nosd; then
333 + rm -vf "${D}"/usr/libexec/bacula/disk-changer
334 + rm -vf "${D}"/usr/libexec/bacula/mtx-changer
335 + rm -vf "${D}"/usr/libexec/bacula/dvd-handler
336 + fi
337 +
338 + # documentation
339 + dodoc ChangeLog ReleaseNotes SUPPORT
340 +
341 + # install examples (bug #457504)
342 + if use examples; then
343 + docinto examples/
344 + dodoc -r examples/*
345 + fi
346 +
347 + # vim-files
348 + if use vim-syntax; then
349 + insinto /usr/share/vim/vimfiles/syntax
350 + doins scripts/bacula.vim
351 + insinto /usr/share/vim/vimfiles/ftdetect
352 + newins scripts/filetype.vim bacula_ft.vim
353 + fi
354 +
355 + # setup init scripts
356 + myscripts="bacula-fd"
357 + if ! use bacula-clientonly; then
358 + if ! use bacula-nodir; then
359 + myscripts="${myscripts} bacula-dir"
360 + fi
361 + if ! use bacula-nosd; then
362 + myscripts="${myscripts} bacula-sd"
363 + fi
364 + fi
365 + for script in ${myscripts}; do
366 + # copy over init script and config to a temporary location
367 + # so we can modify them as needed
368 + cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd"
369 + cp "${FILESDIR}/newscripts/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd"
370 +
371 + # now set the database dependancy for the director init script
372 + case "${script}" in
373 + bacula-dir)
374 + case "${mydbtype}" in
375 + sqlite3)
376 + # sqlite databases don't have a daemon
377 + sed -i -e 's/need "%database%"/:/g' "${T}/${script}".initd || die
378 + ;;
379 + *)
380 + # all other databases have daemons
381 + sed -i -e "s:%database%:${mydbtype}:" "${T}/${script}".initd || die
382 + ;;
383 + esac
384 + ;;
385 + *)
386 + ;;
387 + esac
388 +
389 + # install init script and config
390 + newinitd "${T}/${script}".initd "${script}"
391 + newconfd "${T}/${script}".confd "${script}"
392 + done
393 +
394 + systemd_dounit "${S}"/platforms/systemd/bacula-{dir,fd,sd}.service
395 +
396 + # make sure the working directory exists
397 + diropts -m0750
398 + keepdir /var/lib/bacula
399 +
400 + # make sure bacula group can execute bacula libexec scripts
401 + fowners -R root:bacula /usr/libexec/bacula
402 +}
403 +
404 +pkg_postinst() {
405 + if use bacula-clientonly; then
406 + fowners root:bacula /var/lib/bacula
407 + else
408 + fowners bacula:bacula /var/lib/bacula
409 + fi
410 +
411 + einfo
412 + einfo "A group 'bacula' has been created. Any users you add to this"
413 + einfo "group have access to files created by the daemons."
414 + einfo
415 + einfo "A user 'bacula' has been created. Please see the bacula manual"
416 + einfo "for information about running bacula as a non-root user."
417 + einfo
418 +
419 + if ! use bacula-clientonly && ! use bacula-nodir; then
420 + einfo
421 + einfo "If this is a new install, you must create the ${mydbtype} databases with:"
422 + einfo " /usr/libexec/bacula/create_${mydbtype}_database"
423 + einfo " /usr/libexec/bacula/make_${mydbtype}_tables"
424 + einfo " /usr/libexec/bacula/grant_${mydbtype}_privileges"
425 + einfo
426 +
427 + ewarn "ATTENTION!"
428 + ewarn "The format of the database may have changed."
429 + ewarn "If you just upgraded from a version below 9.0.0 you must run"
430 + ewarn "'update_bacula_tables' now."
431 + ewarn "Make sure to have a backup of your catalog before."
432 + ewarn
433 + fi
434 +
435 + if use sqlite; then
436 + einfo
437 + einfo "Be aware that Bacula does not officially support SQLite database anymore."
438 + einfo "Best use it only for a client-only installation. See Bug #445540."
439 + einfo
440 + fi
441 +
442 + einfo "Please note that 'bconsole' will always be installed. To compile 'bat'"
443 + einfo "you have to enable 'USE=qt5'."
444 + einfo
445 + einfo "/var/lib/bacula/tmp was configured for archivedir. This dir will be used during"
446 + einfo "restores, so be sure to set it to an appropriate in dir in the bacula config."
447 +}
448
449 diff --git a/app-backup/bacula/files/bacula-fix-sonames-new.patch b/app-backup/bacula/files/bacula-fix-sonames-new.patch
450 new file mode 100644
451 index 000000000000..9a3abedb7d66
452 --- /dev/null
453 +++ b/app-backup/bacula/files/bacula-fix-sonames-new.patch
454 @@ -0,0 +1,37 @@
455 +# Fix soname in libbaccat.so, see bugs #602952, #790140 and #845126
456 +#
457 +# Actual libtool needs a patch to accept '-soname' command line switch,
458 +# otherwise it will ignored.
459 +# slibtool in contrast responds with error and is not easy to patch.
460 +#
461 +# Solution here drops the '-soname' switch and uses patchelf program to
462 +# fix the SONAME after the library is build.
463 +diff --git a/src/cats/Makefile.in b/src/cats/Makefile.in
464 +index d30cc75..9f87798 100644
465 +--- a/src/cats/Makefile.in
466 ++++ b/src/cats/Makefile.in
467 +@@ -135,17 +135,21 @@ libbaccats.la: Makefile cats_null.lo
468 + libbaccats-mysql.la: Makefile $(MYSQL_LOBJS)
469 + @echo "Making $@ ..."
470 + $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(MYSQL_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \
471 +- -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(MYSQL_LIBS)
472 ++ $(MYSQL_LIBS)
473 ++ patchelf --set-soname libbaccats-$(LIBBACCATS_LT_RELEASE).so .libs/libbaccats-mysql-$(LIBBACCATS_LT_RELEASE).so
474 +
475 + libbaccats-postgresql.la: Makefile $(POSTGRESQL_LOBJS)
476 + @echo "Making $@ ..."
477 + $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(POSTGRESQL_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \
478 +- -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(POSTGRESQL_LIBS)
479 ++ $(POSTGRESQL_LIBS)
480 ++ patchelf --set-soname libbaccats-$(LIBBACCATS_LT_RELEASE).so .libs/libbaccats-postgresql-$(LIBBACCATS_LT_RELEASE).so
481 +
482 + libbaccats-sqlite3.la: Makefile $(SQLITE_LOBJS)
483 + @echo "Making $@ ..."
484 + $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(SQLITE_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \
485 +- -soname libbaccats-$(LIBBACCATS_LT_RELEASE).so $(SQLITE_LIBS)
486 ++ $(SQLITE_LIBS)
487 ++ patchelf --set-soname libbaccats-$(LIBBACCATS_LT_RELEASE).so .libs/libbaccats-sqlite3-$(LIBBACCATS_LT_RELEASE).so
488 ++
489 + #libbaccats-dbi.la: Makefile $(DBI_LOBJS)
490 + # @echo "Making $@ ..."
491 + # $(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(DBI_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCATS_LT_RELEASE) \