blob: fe7ed5b9b331c5aa396bd1abf316ac008d6a40da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#!/bin/sh -xeu
# This script will detect the OS, and try to grab the libraries. And then
# creates a tarball for distribution.
# Check if another config is being sourced.
set +u
if [ -z "$TUP_CONFIG" ];
then
. ./tup.config
else
. ./"$TUP_CONFIG"
fi
set -u
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}');
do
cp "$i" "$CONFIG_INSTALL_PREFIX/"
done
WINDOWS="true"
;;
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
;;
OpenBSD)
for i in $(ldd "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/usr\/local/ {print $7}');
do
cp "$i" "$CONFIG_INSTALL_PREFIX/libs/"
done
;;
SunOS)
for i in $(ldd "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/usr\/lib/ {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"
# Tarball the finish result!
if [ "$WINDOWS" = "true" ];
then
ARCHIVE_NAME="Pong_$(uname -s)-$(uname -r)"
SEVENZIP="$(which 7z)" || SEVENZIP="/c/Program Files/7-Zip/7z.exe"
if [ -f "$SEVENZIP" ];
then # Try to use 7z's self extracting feature if possible.
"$SEVENZIP" a -sfx7z.sfx ../"$ARCHIVE_NAME".exe -- *
else # If not, just create a standard zip file.
zip -9 -r ../"$ARCHIVE_NAME".zip -- *
fi
exit 0
else
set +e
# Remove GL drivers, as they almost always conflict with system driver.
rm -f libs/libGL*
rm -f libs/libdrm*
# Remove libstdc++
rm -f libs/libstdc++*
set -e
bsdtar --options gzip:compression-level=9 -caf ../Pong_"$(uname -s)-$(uname -r)-$(uname -m)".tgz -- *
fi
|