about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xdistribute.sh44
1 files changed, 39 insertions, 5 deletions
diff --git a/distribute.sh b/distribute.sh
index 55f684c..2700fac 100755
--- a/distribute.sh
+++ b/distribute.sh
@@ -12,7 +12,8 @@ else
 fi
 set -u
 
-WINDOWS="false"
+WINDOWS="false" # Windows needs special treatment
+mkdir -p "$CONFIG_INSTALL_PREFIX/libs"
 case "$(uname -s)" in
 	MINGW*)
 		for i in $(ldd "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/mingw*/ {print $3}');
@@ -21,14 +22,47 @@ case "$(uname -s)" in
 		done
 		WINDOWS="true"
 		;;
-	*)
-		mkdir -p "$CONFIG_INSTALL_PREFIX/libs"
-		# This is a catch all, above are specific loops for specific platforms.
+	Linux)
 		for i in $(ldd "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/usr/ {print $3}');
 		do
 			cp "$i" "$CONFIG_INSTALL_PREFIX/libs/"
 		done
 		;;
+	NetBSD)
+		# NetBSD, unlike the other BSDs keep their packages in /usr/pkg
+		for i in $(ldd "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/usr\/pkg/ {print $3}');
+		do
+			cp "$i" "$CONFIG_INSTALL_PREFIX/libs/"
+		done
+		;;
+	*BSD)
+		# BSDs keep installed packages in /usr/local
+		for i in $(ldd "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/usr\/local/ {print $3}');
+		do
+			cp "$i" "$CONFIG_INSTALL_PREFIX/libs/"
+		done
+		;;
+	Darwin)
+		# Try to see if my otool-tree program is there, if not, just use otool.
+		# (WARNING: otool on it's own, only shows directly linked libraries, but
+		# doesn't show the libraries needed by those said libraries.
+		if which otool-tree > /dev/null;
+		then
+			for i in $(otool-tree "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/usr\/local/');
+			do
+				cp "$i" "$CONFIG_INSTALL_PREFIX/libs/"
+			done
+		else
+			for i in $(otool -L "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/usr\/local/{print $1}');
+			do
+				cp "$i" "$CONFIG_INSTALL_PREFIX/libs/"
+			done
+		fi
+		;;
+	*)
+		echo "Unsupported System for distribute.sh, you'll have to package it yourself. =("
+		exit 1
+		;;
 esac
 
 cd "$CONFIG_INSTALL_PREFIX"
@@ -51,5 +85,5 @@ else
 	rm libs/libdrm*
 	# Remove libstdc++
 	rm libs/libstdc++*
-	bsdtar --options xz:compression-level=9 -caf ../Pong_"$(uname -s)-$(uname -r)-$(uname -m)".txz -- *
+	bsdtar --options gzip:compression-level=9 -caf ../Pong_"$(uname -s)-$(uname -r)-$(uname -m)".tgz -- *
 fi