i3: use libglob to make GLOB_TILDE work as expected with musl.

This commit is contained in:
Juan RP 2015-12-17 08:36:22 +01:00
parent dd802a363f
commit 00c39e4a28
2 changed files with 15 additions and 42 deletions

View File

@ -1,41 +0,0 @@
--- ./libi3/resolve_tilde.c.orig 2015-10-07 20:13:31.744138877 -0400
+++ ./libi3/resolve_tilde.c 2015-10-07 20:16:03.268127887 -0400
@@ -18,6 +18,7 @@
* or multiple matches are found, it just returns a copy of path as given.
*
*/
+#ifdef GLOB_TILDE
char *resolve_tilde(const char *path) {
static glob_t globbuf;
char *head, *tail, *result;
@@ -43,3 +44,8 @@
return result;
}
+#else
+char *resolve_tilde(const char *path) {
+ return strdup(path);
+}
+#endif
--- ./i3bar/src/main.c.orig 2015-10-07 20:17:02.226123611 -0400
+++ ./i3bar/src/main.c 2015-10-07 20:20:58.476106477 -0400
@@ -44,6 +44,7 @@
* Glob path, i.e. expand ~
*
*/
+#ifdef GLOB_TILDE
char *expand_path(char *path) {
static glob_t globbuf;
if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) {
@@ -54,6 +55,11 @@
globfree(&globbuf);
return result;
}
+#else
+char *expand_path(char *path) {
+ return strdup(path);
+}
+#endif
void print_usage(char *elf_name) {
printf("Usage: %s -b bar_id [-s sock_path] [-h] [-v]\n", elf_name);

View File

@ -1,7 +1,7 @@
# Template file for 'i3'
pkgname=i3
version=4.11
revision=1
revision=2
build_style=gnu-makefile
hostmakedepends="pkg-config perl"
makedepends="pcre-devel yajl-devel libxcb-devel libev-devel
@ -15,6 +15,20 @@ homepage="http://i3wm.org/"
distfiles="${homepage}/downloads/${pkgname}-${version}.tar.bz2"
checksum=78ce1e06fbd92fd63765bbe23faa7b8f929c17f99ed623f7abf2e568169d982f
case "$XBPS_TARGET_MACHINE" in
*-musl) makedepends+=" libglob-devel";;
esac
pre_build() {
case "$XBPS_TARGET_MACHINE" in
*-musl)
sed -i '/LIBS =/s,-lm,& /usr/lib/libglob.a,g' common.mk
sed -i '/include/s,glob.h,libglob/glob.h,g' i3bar/src/main.c libi3/resolve_tilde.c
sed -i '/GLOB_TILDE/s/glob(/g_glob(/g' i3bar/src/main.c libi3/resolve_tilde.c
sed -i 's/globfree(/g_globfree(/g' i3bar/src/main.c libi3/resolve_tilde.c
;;
esac
}
post_install() {
vlicense LICENSE
vmkdir usr/share/man/man1