From 03ab09a97aec61abf547fb0c90251e12afb5f048 Mon Sep 17 00:00:00 2001
From: Thomas Debesse <dev@illwieckz.net>
Date: Sun, 7 Mar 2021 06:15:23 +0100
Subject: [PATCH] library-bundler: only call rmdir on empty directories when
 cleaning-up useless stuff

---
 library-bundler | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/library-bundler b/library-bundler
index 235734ea..b08b9c89 100755
--- a/library-bundler
+++ b/library-bundler
@@ -333,6 +333,9 @@ Multi::bundleLibFromFile () {
 }
 
 Multi::cleanUp () {
+	# Remove from bundle things that useless to be distributed,
+	# like headers or static libraries, also remove
+	# empty directories.
 	find "${bundle_dir}/lib" \
 		-type f \
 		-name '*.a' \
@@ -346,8 +349,8 @@ Multi::cleanUp () {
 	find "${bundle_dir}/lib" \
 		-depth \
 		-type d \
-		-exec rmdir {} \; \
-	|| true
+		-empty \
+		-exec rmdir {} \;
 }
 
 Linux::getRpath () {
-- 
2.39.5