Skip to content

Commit

Permalink
sys-apps/apmd: Fix the build with rlibtool
Browse files Browse the repository at this point in the history
When building with rlibtool the build will fail because there is no
generated libtool to determine if building shared or static. This adds a
minimal autoreconf to fix the build.

Bug: https://bugs.gentoo.org/778383
Signed-off-by: orbea <orbea@riseup.net>
  • Loading branch information
orbea committed Jun 19, 2022
1 parent 2670dcf commit 7574896
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 0 deletions.
95 changes: 95 additions & 0 deletions sys-apps/apmd/apmd-3.2.2_p14-r3.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools toolchain-funcs

MY_PV="${PV%_p*}"
MY_P="${PN}_${MY_PV}"
PATCHV="${PV#*_p}"

DESCRIPTION="Advanced Power Management Daemon"
HOMEPAGE="https://packages.qa.debian.org/a/apmd.html"
SRC_URI="mirror://debian/pool/main/a/apmd/${MY_P}.orig.tar.gz
mirror://debian/pool/main/a/apmd/${MY_P}-${PATCHV}.diff.gz"
S="${WORKDIR}/${PN}-${MY_PV}.orig"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm ppc ppc64 x86"
IUSE="nls X"

RDEPEND="
>=sys-apps/debianutils-1.16
>=sys-power/powermgmt-base-1.31
X? (
x11-libs/libX11
x11-libs/libXaw
x11-libs/libXmu
x11-libs/libSM
x11-libs/libICE
x11-libs/libXt
x11-libs/libXext
)"
DEPEND="${RDEPEND}
virtual/os-headers"

PATCHES=(
"${WORKDIR}"/${MY_P}-${PATCHV}.diff
"${FILESDIR}"/${PN}-${MY_PV}-libtool.patch # 778383
)

src_prepare() {
default

if ! use X; then
sed -i \
-e 's:\(EXES=.*\)xapm:\1:' \
-e 's:\(.*\)\$(LT_INSTALL).*xapm.*$:\1echo:' \
Makefile.in || die
fi

# use system headers and skip on_ac_power
rm on_ac_power* || die

sed -i \
-e '/on_ac_power/d' \
-e 's:-I/usr/src/linux/include -I/usr/X11R6/include::' \
-e 's:-L/usr/X11R6/lib::' \
Makefile.in || die

eautoreconf
}

src_compile() {
emake \
CC="$(tc-getCC)" \
CFLAGS="${CFLAGS}" \
LIBDIR=/usr/$(get_libdir) \
LDFLAGS="${LDFLAGS}"
}

src_install() {
dodir /usr/sbin
emake DESTDIR="${D}" PREFIX=/usr LIBDIR=/usr/$(get_libdir) install

keepdir /etc/apm/{event.d,suspend.d,resume.d,other.d,scripts.d}
exeinto /etc/apm
doexe debian/apmd_proxy
dodoc AUTHORS {,apmsleep.}README debian/{changelog,README.Debian}

doman *.{1,8}

# note: apmd_proxy.conf is currently disabled and not used, thus
# not installed - liquidx (01 Mar 2004)

newconfd "${FILESDIR}"/apmd.confd apmd
newinitd "${FILESDIR}"/apmd.rc6 apmd

if ! use nls; then
rm -r "${ED}"/usr/share/man/fr || die
fi

find "${ED}" -name '*.la' -delete || die
}
89 changes: 89 additions & 0 deletions sys-apps/apmd/files/apmd-3.2.2-libtool.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
https://bugs.gentoo.org/778383

From: orbea <orbea@riseup.net>
Date: Sun, 19 Jun 2022 10:56:10 -0700
Subject: [PATCH] build: Add minimal configure.ac

This is required to generate libtool for the build which allows the
build with rlibtool to work correctly.

diff --git a/Makefile b/Makefile.in
similarity index 93%
rename from Makefile
rename to Makefile.in
index 92fc0fd..922b9ea 100644
--- a/Makefile
+++ b/Makefile.in
@@ -19,7 +19,7 @@
# $Id: Makefile,v 1.30 2001/11/25 22:46:16 apenwarr Exp $
#

-VERSION=3.2.1
+VERSION=@PACKAGE_VERSION@
LIB_VERSION=1:0

ifneq (,)
@@ -28,7 +28,7 @@ endif

.SUFFIXES:

-OBJS=apmlib.o
+OBJS=apmlib.lo
EXES=apm apmd xapm apmsleep
HEADERS=apm.h

@@ -58,7 +58,9 @@ RANLIB=ranlib
#CFLAGS=-O3 -m486 -fomit-frame-pointer
#LDFLAGS=-s

-LIBTOOL=libtool --quiet
+top_builddir := @top_builddir@
+
+LIBTOOL = @LIBTOOL@
LT_COMPILE = $(LIBTOOL) --mode=compile $(CC)
LT_LINK = $(LIBTOOL) --mode=link $(CC)
LT_INSTALL = $(LIBTOOL) --mode=install install
@@ -68,22 +70,22 @@ all: $(EXES)

$(OBJS): $(HEADERS)

-%.o: %.c
+%.lo: %.c
$(LT_COMPILE) -c $(CPPFLAGS) $(CFLAGS) $(XTRACFLAGS) $<

-%: %.o $(LIBAPM)
+%: %.lo $(LIBAPM)
$(LT_LINK) -o $@ $< $(LDFLAGS) $(LIBAPM)

-xapm.o: xapm.c
+xapm.lo: xapm.c
$(LT_COMPILE) -c $(CPPFLAGS) $(CFLAGS) $(XTRACFLAGS) -DNARROWPROTO $<

-apmd: apmd.o
+apmd: apmd.lo

-apmsleep: apmsleep.o
+apmsleep: apmsleep.lo

-apmexists: apmexists.o
+apmexists: apmexists.lo

-xapm: xapm.o $(LIBAPM)
+xapm: xapm.lo $(LIBAPM)
$(LT_LINK) -o $@ $< $(LDFLAGS) $(LIBAPM) $(XLDFLAGS) $(XLIBS)

$(LIBAPM): apmlib.lo
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..d60161c
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,8 @@
+AC_INIT([apmd], [3.3.2])
+AC_CONFIG_FILES([Makefile])
+
+LT_INIT
+
+AC_SUBST([top_builddir], [$abs_builddir])
+
+AC_OUTPUT

0 comments on commit 7574896

Please sign in to comment.