forked from archbirdplus/Cubyz-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·68 lines (55 loc) · 2.18 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·68 lines (55 loc) · 2.18 KB
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
#!/bin/bash
SUPERDIR="$(dirname "$(dirname "$(realpath $0)")")"
ROOTDIR="$(dirname "$(realpath $0)")"
APPDIR="$(dirname "$(realpath $0)")/Cubyz.app"
echo "SUPER $SUPERDIR"
mkdir -p Cubyz.app/Contents/Library
cd Cubyz.app/Contents/Library
ROOT_DEPS="libGL.1.dylib libglapi.0.dylib"
sizeof () {
du -schH $1 | grep total | awk -F'\t' '{print $1}'
}
include () {
local dep=$1
local dep_name=`basename $dep`
install_name_tool -id $dep_name $dep_name 2>/dev/null
otool -L $dep | grep -v ':' | grep homebrew | awk '{print $1}' | while read homebrew_lib_path; do
local dylib_name=`basename $homebrew_lib_path`
echo "$dep_name needs $dylib_name"
if [ $dylib_name != "libLLVM.dylib" -a $dylib_name != "libzstd.1.dylib" ]; then
if ! [ -f $homebrew_lib_path ]; then
local brew_dep=`echo $homebrew_lib_path | awk -F '/' '{print $5}'`
echo "Installing $brew_dep"
brew install $brew_dep
fi
install_name_tool $dep_name -change $homebrew_lib_path @loader_path/$dylib_name 2>/dev/null
if ! [ -f $dylib_name ]; then
echo " ... packaging $dylib_name ($(sizeof $homebrew_lib_path))"
cp $homebrew_lib_path .
include $homebrew_lib_path
fi
fi
done
}
for root_dep in $ROOT_DEPS; do
cp /usr/local/GL/lib/$root_dep .
echo " including packaging $root_dep ($(sizeof $root_dep))"
include $root_dep
done
pwd
mkdir "$APPDIR/Contents/Resources" "$APPDIR/Contents/MacOS"
cp "$ROOTDIR/templates/Info.plist" "$APPDIR/Contents"
cp "$ROOTDIR/templates/Install.sh" "$APPDIR/Contents/MacOS"
cp "$ROOTDIR/templates/RunCubyzig.sh" "$APPDIR/Contents/MacOS"
cp "$ROOTDIR"/logo.icns ../Resources/Cubyz.icns
cp "$ROOTDIR"/logo.png ../MacOS/logo.png
cd ../MacOS
cp -r "$SUPERDIR"/Cubyz/assets assets
cp -r "$SUPERDIR"/Cubyz/launchConfig.zon "$APPDIR/Contents/MacOS"
cp -r "$SUPERDIR"/Cubyz/settings.zig.zon settings.zig.zon
cp "$SUPERDIR"/Cubyz/zig-out/bin/Cubyz Cubyzig
for dep in $DEPS; do
args -change $dep "@rpath/`basename $dep`" Cubyzig
install_name_tool -change $dep "@rpath/`basename $dep`" Cubyzig
done
cd "$SUPERDIR"/Cubyz-app