forked from norman784/libimobiledevice-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·148 lines (137 loc) · 4.56 KB
/
install.sh
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/sh
export root_path=$PWD
export install_dir="$root_path/dependencies"
export tmp_dir="tmp"
export tmp_path="$root_path/$tmp_dir"
export openssl_url="https://www.openssl.org/source/openssl-1.0.2l.tar.gz"
export openssl_file="openssl-1.0.2l.tar.gz"
export openssl_dir="openssl-1.0.2l"
export openssl_check_file="${install_dir}/include/openssl/opensslv.h"
export libplist_url="https://github.com/libimobiledevice-win32/libplist.git"
export libplist_dir="libplist"
export libplist_check_file="${install_dir}/lib/libplist.la"
export libusbmuxd_url="https://github.com/libimobiledevice-win32/libusbmuxd.git"
export libusbmuxd_dir="libusbmuxd"
export libusbmuxd_check_file="${install_dir}/lib/libusbmuxd.la"
export libimobiledevice_url="https://github.com/libimobiledevice-win32/libimobiledevice.git"
export libimobiledevice_dir="libimobiledevice"
export libimobiledevice_check_file="${install_dir}/lib/libimobiledevice.la"
mkdir $tmp_dir
cd $tmp_path
## openssl
#if is not installed, install it
if [ ! -f $openssl_check_file ]; then
echo "\n\n"
echo "Install openssl"
echo "-------------------------------------------\n\n"
# download sources
curl -OL $openssl_url
tar xvzf $openssl_file
# compile it
cd $openssl_dir
if [ "$(uname -s)" == "Darwin" ]; then
echo "\n\n ------- Compiling Openssl with Darwin ------- \n\n"
./Configure --prefix=$install_dir --openssldir=$install_dir/openssl darwin64-x86_64-cc
elif [[ "$(uname -s)" == *"CYGWIN"* ]]; then
dos2unix ./*
./Configure --prefix=$install_dir --openssldir=$install_dir/openssl Cygwin-x86_64
else
echo "\n\n ------- No suitable compiler has been found ------- \n\n"
fi
make
make install_sw
fi
## lipplist
# if is not installed, install it
if [ ! -f $libplist_check_file ]; then
echo "\n\n"
echo "Install libplist"
echo "-------------------------------------------\n\n"
# download sources
cd $tmp_path
git clone $libplist_url
# compile it
cd $libplist_dir
git checkout v1.2.76
# for some reason the first time it set the libtool folter to ../.. instead of .
# so running a second time the issue its fixed
if [[ "$(uname -s)" == *"CYGWIN"* ]]; then
dos2unix ./*
fi
./autogen.sh
./autogen.sh
./configure --prefix=$install_dir
make
make install
# this file was created the first time autogen.sh runs (in the wrong directory)
rm ../../ltmain.sh
fi
## libusbmuxd
# if is not installed, install it
if [ ! -f $libusbmuxd_check_file ]; then
echo "\n\n"
echo "Install libusbmuxd"
echo "-------------------------------------------\n\n"
# download sources
cd $tmp_path
git clone $libusbmuxd_url
# compile it
cd $libusbmuxd_dir
git checkout v1.2.76
export PKG_CONFIG_PATH=$install_dir/lib/pkgconfig
# for some reason the first time it set the libtool folter to ../.. instead of .
# so running a second time the issue its fixed
if [[ "$(uname -s)" == *"CYGWIN"* ]]; then
dos2unix ./*
fi
./autogen.sh
./autogen.sh
./configure --prefix=$install_dir
make
make install
# this file was created the first time autogen.sh runs (in the wrong directory)
rm ../../ltmain.sh
fi
## openssl
# if is not installed, install it
if [ ! -f $libimobiledevice_check_file ]; then
echo "\n\n"
echo "Install libimobiledevice"
echo "-------------------------------------------\n\n"
# download sources
cd $tmp_path
git clone $libimobiledevice_url
# compile it
cd $libimobiledevice_dir
git checkout v1.2.76
export PKG_CONFIG_PATH=$install_dir/lib/pkgconfig
export LD_LIBRARY_PATH=$install_dir/lib:$LD_LIBRARY_PATH
export CPATH=$install_dir/include/openssl:$CPATH
# for some reason the first time it set the libtool folter to ../.. instead of .
# so running a second time the issue its fixed
if [[ "$(uname -s)" == *"CYGWIN"* ]]; then
dos2unix ./*
fi
./autogen.sh
./autogen.sh
./configure --prefix=$install_dir
make
make install
# this file was created the first time autogen.sh runs (in the wrong directory)
rm ../../ltmain.sh
fi
# clean
cd $root_path
rm -rf $tmp_dir
# remove binaries, we don't need them
rm -rf $install_dir/bin
if [ "$(uname -s)" == "Darwin" ]; then
echo ""
echo "Change absolute path to relative path"
echo "-------------------------------------------"
echo "[✔] libimobiledevice.6.dylib"
install_name_tool -change $install_dir/lib/libusbmuxd.4.dylib @loader_path/libusbmuxd.4.dylib $install_dir/lib/libimobiledevice.6.dylib
install_name_tool -change $install_dir/lib/libplist.3.dylib @loader_path/libplist.3.dylib $install_dir/lib/libimobiledevice.6.dylib
echo "[✔] libusbmuxd.4.dylib"
install_name_tool -change $install_dir/lib/libplist.3.dylib @loader_path/libplist.3.dylib $install_dir/lib/libusbmuxd.4.dylib
fi