Subject: [alpine-devel] [PATCH] testing/libcgroup: fix build

From: Isaac Dunham <[email-masked]>
Date: Fri, 12 Sep 2014 19:40:27 -0700

libcgroup needs the fts api, which musl does not include; depend on fts

remove the non-portable *DECLS mess while we're here
---
 testing/libcgroup/APKBUILD                |  22 +++-
 testing/libcgroup/musl-decls-compat.patch | 207 ++++++++++++++++++++++++++++++
 2 files changed, 225 insertions(+), 4 deletions(-)
 create mode 100644 testing/libcgroup/musl-decls-compat.patch

diff --git a/testing/libcgroup/APKBUILD b/testing/libcgroup/APKBUILD
index 4268781..b619a93 100644
--- a/testing/libcgroup/APKBUILD
+++ b/testing/libcgroup/APKBUILD
@@ -2,14 +2,14 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=libcgroup
 pkgver=0.38
-pkgrel=0
+pkgrel=1
 pkgdesc="Library to control and monitor control groups"
 url="http://libcg.sourceforge.net/"
 arch="all"
 license="LGPLv2+"
 depends=""
 depends_dev=""
-makedepends="$depends_dev bison flex linux-pam-dev"
+makedepends="$depends_dev bison flex linux-pam-dev fts-dev"
 install=""
 subpackages="$pkgname-dev $pkgname-doc $pkgname-tools $pkgname-pam"
 source="http://downloads.sourceforge.net/libcg/libcgroup-$pkgver.tar.bz2
@@ -17,6 +17,7 @@ source="http://downloads.sourceforge.net/libcg/libcgroup-$pkgver.tar.bz2
 	cgconfig.confd
 	cgred.initd
 	cgred.confd
+	musl-decls-compat.patch
 	"
 
 _builddir="$srcdir"/libcgroup-$pkgver
@@ -39,7 +40,7 @@ build() {
 		--enable-daemon \
 		--enable-tools \
 		|| return 1
-	make || return 1
+	make LIBS=-lfts || return 1
 }
 
 package() {
@@ -86,4 +87,17 @@ md5sums="f0f7d4060bf36ccc19d75dbf4f1695db  libcgroup-0.38.tar.bz2
 3fa43b95417d491450c8fe239fca8557  cgconfig.initd
 7743c134ead2422fbd375447c4c9654c  cgconfig.confd
 8bb3ca45c5ba91d4078e738978afb54d  cgred.initd
-f36926f1a968d3ee5fd7f0d7a6a7167e  cgred.confd"
+f36926f1a968d3ee5fd7f0d7a6a7167e  cgred.confd
+f9994beb5511e1381c2878fd9b7d1163  musl-decls-compat.patch"
+sha256sums="5d36d1a48b95f62fe9fcdf74a5a4089512e5e43e6011aa1504fd6f2a0909867f  libcgroup-0.38.tar.bz2
+fcc1259a4be7e1d64112bef3aa06d59e3f3d2d375f32d2b199cb864f67ee7860  cgconfig.initd
+ac52788366561ca6b79bca0e9fc9630568401b4301e386e6851fd8eb75a539ab  cgconfig.confd
+008aed91b2de6b65d7a6c08acaa24890c111e7dbe415ea83902e1df39c8e6d3b  cgred.initd
+72c00285c1f89f3a0564418c33bd02dfbcee2ae90f540a885ef57d1ef940a04c  cgred.confd
+02d6fb7911c433e1e373e8b548bbcc5c317f058e1aa5db226ce92a29a42696c0  musl-decls-compat.patch"
+sha512sums="763e52bee699b0461508eabb6fdf3a79f15d1d8cdbc6631fcae93127eb7648e6bab660cf3a31019b966095113f9a086d55b5351c7999f3654f8e6c95507725d5  libcgroup-0.38.tar.bz2
+a840137d97585920022d6ab09912634bdcf7c8200dda478400d0c765d17efb7ebe827fc7371c9ebddb4e5f3d5a5fefe61be101977c933fbbd18897ecea6c5654  cgconfig.initd
+9bb289c20c3230414888e82be2b7a1389ac652143bcbbc746d0731c46a2f1404b4bc8154c90b59ebc53520107fe2f04c9eb5df742451887947b8a3b7a4c31f00  cgconfig.confd
+163c702e714769bb7b1df3788ab679397b58ecfdff9032d40f568b8980744725d0df891ef8c46290d7f818d32c4d6be1d62d2e06dd298b74ce15a11fac42a9a6  cgred.initd
+871b7e7df26bf6b4164d5ec04e9998b0bd3f354e75ba2306b330e382eadd38ad044f85cfaa122a5a2e600fb4f39e1a7fe7778551a05dfc3e0ae095621c965996  cgred.confd
+8b4444b0583817bb6844d01a8d0d956a884a58ab8fb3ddd402a4ba9c5f505a7f8495abf06776685d9b10246b96ced64d74cab73484a84f3ecb53e8273ab76456  musl-decls-compat.patch"
diff --git a/testing/libcgroup/musl-decls-compat.patch b/testing/libcgroup/musl-decls-compat.patch
new file mode 100644
index 0000000..985a226
--- /dev/null
+++ b/testing/libcgroup/musl-decls-compat.patch
@@ -0,0 +1,207 @@
+commit ca780b4f7f71abeeb04a585f2a4d889caaa985fa
+Author: Isaac Dunham <[email-masked]>
+Date:   Fri Sep 5 22:35:32 2014 -0700
+
+    Remove __.*DECLS nonsense
+
+diff --git a/include/libcgroup/config.h b/include/libcgroup/config.h
+index 2dfdd32..859f7b5 100644
+--- a/include/libcgroup/config.h
++++ b/include/libcgroup/config.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_config 5. Configuration
+@@ -77,6 +79,8 @@ int cgroup_config_set_default(struct cgroup *new_default);
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /*_LIBCGROUP_CONFIG_H*/
+diff --git a/include/libcgroup/error.h b/include/libcgroup/error.h
+index 91b5c1c..02115f5 100644
+--- a/include/libcgroup/error.h
++++ b/include/libcgroup/error.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_errors 6. Error handling
+@@ -104,6 +106,8 @@ int cgroup_get_last_errno(void);
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_INIT_H */
+diff --git a/include/libcgroup/groups.h b/include/libcgroup/groups.h
+index 39596a1..451fbbd 100644
+--- a/include/libcgroup/groups.h
++++ b/include/libcgroup/groups.h
+@@ -11,7 +11,9 @@
+ #include <stdbool.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * Flags for cgroup_delete_cgroup_ext().
+@@ -570,6 +572,8 @@ int cg_chmod_recursive(struct cgroup *cgroup, mode_t dir_mode,
+  */
+ 
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_GROUPS_H */
+diff --git a/include/libcgroup/init.h b/include/libcgroup/init.h
+index 3709096..8ef69ec 100644
+--- a/include/libcgroup/init.h
++++ b/include/libcgroup/init.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_init 1. Initialization
+@@ -54,6 +56,8 @@ int cgroup_get_subsys_mount_point(const char *controller, char **mount_point);
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_INIT_H */
+diff --git a/include/libcgroup/iterators.h b/include/libcgroup/iterators.h
+index c6d453d..fb47d01 100644
+--- a/include/libcgroup/iterators.h
++++ b/include/libcgroup/iterators.h
+@@ -11,7 +11,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_iterators 3. Iterators
+@@ -423,6 +425,8 @@ int cgroup_get_subsys_mount_point_end(void **handle);
+  * @}
+  */
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_ITERATORS_H */
+diff --git a/include/libcgroup/tasks.h b/include/libcgroup/tasks.h
+index fb728f4..2f2e486 100644
+--- a/include/libcgroup/tasks.h
++++ b/include/libcgroup/tasks.h
+@@ -12,7 +12,9 @@
+ #include <stdbool.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /** Flags for cgroup_change_cgroup_uid_gid(). */
+ enum cgflags {
+@@ -189,6 +191,8 @@ int cgroup_register_unchanged_process(pid_t pid, int flags);
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_TASKS_H */
+diff --git a/src/daemon/cgrulesengd.h b/src/daemon/cgrulesengd.h
+index 97c62f1..23607d0 100644
+--- a/src/daemon/cgrulesengd.h
++++ b/src/daemon/cgrulesengd.h
+@@ -17,7 +17,9 @@
+ 
+ #include <features.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ #include "config.h"
+ #include "libcgroup.h"
+@@ -112,7 +114,9 @@ void cgre_flash_rules(int signum);
+  */
+ void cgre_catch_term(int signum);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _CGRULESENGD_H */
+ 
+diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h
+index b9d7b6b..46d1f56 100644
+--- a/src/libcgroup-internal.h
++++ b/src/libcgroup-internal.h
+@@ -16,7 +16,9 @@
+ 
+ #define __LIBCG_INTERNAL
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ #include "config.h"
+ #include <fts.h>
+@@ -269,6 +271,8 @@ extern void cgroup_dictionary_iterator_end(void **handle);
+  */
+ int cg_chmod_path(const char *path, mode_t mode, int owner_is_umask);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif
-- 
2.1.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---