mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-16 14:29:05 -07:00
sys-process/anacron: Port to C23, fix musl build
Incorrect signal handler defs, missing compatibility dependency on musl Closes: https://bugs.gentoo.org/943949 Closes: https://bugs.gentoo.org/715952 Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com> Part-of: https://codeberg.org/gentoo/gentoo/pulls/248 Merges: https://codeberg.org/gentoo/gentoo/pulls/248 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
77
sys-process/anacron/anacron-2.3-r6.ebuild
Normal file
77
sys-process/anacron/anacron-2.3-r6.ebuild
Normal file
@@ -0,0 +1,77 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit toolchain-funcs flag-o-matic
|
||||
|
||||
DESCRIPTION="A periodic command scheduler"
|
||||
HOMEPAGE="https://anacron.sourceforge.net/"
|
||||
SRC_URI="https://downloads.sourceforge.net/${PN}/${P}.tar.gz"
|
||||
|
||||
LICENSE="GPL-2+"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~arm ~ppc ~riscv ~x86"
|
||||
|
||||
DEPEND="
|
||||
acct-group/cron
|
||||
sys-process/cronbase
|
||||
elibc_musl? ( sys-libs/obstack-standalone )
|
||||
"
|
||||
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
virtual/mta
|
||||
"
|
||||
|
||||
BDEPEND="acct-group/cron"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${P}-compile-fix-from-debian.patch
|
||||
"${FILESDIR}"/${P}-headers.patch
|
||||
"${FILESDIR}"/${P}-sighandlers.patch
|
||||
"${FILESDIR}"/${P}-makefile.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
sed -i \
|
||||
-e '/^CFLAGS/{s:=:+=:;s:-O2::}' \
|
||||
Makefile || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
#715952
|
||||
use elibc_musl && append-libs -lobstack
|
||||
|
||||
tc-export CC
|
||||
}
|
||||
|
||||
src_install() {
|
||||
# This does not work if the directory already exists.
|
||||
diropts -m0750 -o root -g cron
|
||||
keepdir /var/spool/${PN}
|
||||
|
||||
doman ${PN}tab.5 ${PN}.8
|
||||
newinitd "${FILESDIR}/${PN}.rc6" "${PN}"
|
||||
dodoc ChangeLog README TODO
|
||||
dosbin "${PN}"
|
||||
|
||||
insinto /etc
|
||||
doins "${FILESDIR}/${PN}tab"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
if [[ -z ${REPLACING_VERSIONS} ]] ; then
|
||||
elog "Schedule the command \"anacron -s\" as a daily cron-job (preferably"
|
||||
elog "at some early morning hour). This will make sure that jobs are run"
|
||||
elog "when the systems is left running for a night."
|
||||
echo
|
||||
elog "Update /etc/anacrontab to include what you want anacron to run."
|
||||
echo
|
||||
elog "You may wish to read the Gentoo Linux Cron Guide, which can be"
|
||||
elog "found online at:"
|
||||
elog " https://wiki.gentoo.org/wiki/Cron"
|
||||
fi
|
||||
}
|
||||
14
sys-process/anacron/files/anacron-2.3-makefile.patch
Normal file
14
sys-process/anacron/files/anacron-2.3-makefile.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
https://bugs.gentoo.org/715952
|
||||
Need to append `-lobstack` for musl build, can't stuff it in
|
||||
LDFLAGS due to `--as-needed`
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -57,7 +57,7 @@
|
||||
include $(csources:.c=.d)
|
||||
|
||||
anacron: $(objects)
|
||||
- $(CC) $(LDFLAGS) $^ $(LOADLIBES) -o $@
|
||||
+ $(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LIBS) -o $@
|
||||
|
||||
%.o : %.c
|
||||
$(CC) -c $(ALL_CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
41
sys-process/anacron/files/anacron-2.3-sighandlers.patch
Normal file
41
sys-process/anacron/files/anacron-2.3-sighandlers.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
https://bugs.gentoo.org/943949
|
||||
Correct signal handler signatures.
|
||||
Also prevent unexpected environment modification
|
||||
by strdup'ing new environment. Mutes const qualifier
|
||||
discard warning, too.
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -214,19 +214,19 @@
|
||||
}
|
||||
|
||||
void
|
||||
-handle_sigalrm()
|
||||
+handle_sigalrm(int)
|
||||
{
|
||||
got_sigalrm = 1;
|
||||
}
|
||||
|
||||
void
|
||||
-handle_sigchld()
|
||||
+handle_sigchld(int)
|
||||
{
|
||||
got_sigchld = 1;
|
||||
}
|
||||
|
||||
void
|
||||
-handle_sigusr1()
|
||||
+handle_sigusr1(int)
|
||||
{
|
||||
got_sigusr1 = 1;
|
||||
}
|
||||
--- a/runjob.c
|
||||
+++ b/runjob.c
|
||||
@@ -86,7 +86,7 @@
|
||||
static void
|
||||
xputenv(const char *s)
|
||||
{
|
||||
- if (putenv(s)) die_e("Can't set the environment");
|
||||
+ if (putenv(strdup(s))) die_e("Can't set the environment");
|
||||
}
|
||||
|
||||
static void
|
||||
Reference in New Issue
Block a user