From d827eb5d005810126914af45c3e96d50f021ce47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Sun, 25 Oct 2015 14:29:02 +0100 Subject: [PATCH] libcgroup: unbreak musl + libtool>=2.4.6 --- srcpkgs/libcgroup/patches/musl-decls.patch | 22 +++++++++++++++++++ .../libcgroup/patches/musl-strerror_r.patch | 22 +++++++++++++++++++ srcpkgs/libcgroup/template | 17 +++++++++++--- 3 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/libcgroup/patches/musl-decls.patch create mode 100644 srcpkgs/libcgroup/patches/musl-strerror_r.patch diff --git a/srcpkgs/libcgroup/patches/musl-decls.patch b/srcpkgs/libcgroup/patches/musl-decls.patch new file mode 100644 index 00000000000..eaebdb8936c --- /dev/null +++ b/srcpkgs/libcgroup/patches/musl-decls.patch @@ -0,0 +1,22 @@ +In musl libc these macros are defined in the deprecated +include file sys/cdefs.h + +--- include/libcgroup.h 2014-01-13 15:05:56.000000000 +0100 ++++ include/libcgroup.h 2015-10-25 14:03:32.921207668 +0100 +@@ -16,6 +16,16 @@ + #ifndef _LIBCGROUP_H + #define _LIBCGROUP_H + ++#if !defined(__GLIBC__) ++#ifdef __cplusplus ++# define __BEGIN_DECLS extern "C" { ++# define __END_DECLS } ++#else ++# define __BEGIN_DECLS ++# define __END_DECLS ++#endif ++#endif /* !defined(__GLIBC__) */ ++ + #define _LIBCGROUP_H_INSIDE + + #include diff --git a/srcpkgs/libcgroup/patches/musl-strerror_r.patch b/srcpkgs/libcgroup/patches/musl-strerror_r.patch new file mode 100644 index 00000000000..eac640ba994 --- /dev/null +++ b/srcpkgs/libcgroup/patches/musl-strerror_r.patch @@ -0,0 +1,22 @@ +The musl libc strerror_r(3) semantics are different from +GNU libc's if _GNU_SOURCE is defined. + +--- src/api.c 2014-01-13 15:05:56.000000000 +0100 ++++ src/api.c 2015-10-25 14:09:18.690232596 +0100 +@@ -3332,8 +3332,16 @@ + + const char *cgroup_strerror(int code) + { ++#if defined(__GLIBC__) + if (code == ECGOTHER) + return strerror_r(cgroup_get_last_errno(), errtext, MAXLEN); ++#else ++ if (code == ECGOTHER) { ++ if (0 == strerror_r(cgroup_get_last_errno(), errtext, MAXLEN)) ++ return errtext; ++ return "strerror_r() failed"; ++ } ++#endif + + return cgroup_strerror_codes[code % ECGROUPNOTCOMPILED]; + } diff --git a/srcpkgs/libcgroup/template b/srcpkgs/libcgroup/template index dde41f4ded5..7591cfb574f 100644 --- a/srcpkgs/libcgroup/template +++ b/srcpkgs/libcgroup/template @@ -1,10 +1,10 @@ # Template file for 'libcgroup' pkgname=libcgroup version=0.41 -revision=4 +revision=5 build_style=gnu-configure configure_args="--sbindir=/usr/bin --enable-pam-module-dir=/usr/lib/security" -hostmakedepends="flex libtool" +hostmakedepends="flex automake libtool" makedepends="pam-devel" short_desc="Library that abstracts the control group file system in Linux" maintainer="Juan RP " @@ -13,8 +13,19 @@ homepage="http://libcg.sourceforge.net" distfiles="${SOURCEFORGE_SITE}/libcg/$pkgname-$version.tar.bz2" checksum=e4e38bdc7ef70645ce33740ddcca051248d56b53283c0dc6d404e17706f6fb51 +case "$XBPS_TARGET_MACHINE" in + *-musl) # Add musl-fts implementation + makedepends+=" musl-fts" + LDFLAGS="-lfts" + ;; +esac + pre_configure() { - libtoolize -f + autoreconf -if +} +post_configure() { + # Disable tests + sed -i Makefile -e "/SUBDIRS =/ s; tests;;" } libcgroup-utils_package() {