Created
October 24, 2017 20:37
-
-
Save dineshshetty/8c4967fa5ed9532c36528806bdaec209 to your computer and use it in GitHub Desktop.
Script to install libimobiledevice on MacOS seamlessly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script by dns | |
# Script to install libimobiledevice on MacOS seamlessly | |
# Install these first before running the script -> brew install automake usbmuxd make autoconf libtool pkg-config gcc openssl gnutls libgcrypt | |
# to fix fatal error: 'openssl/ssl.h' file not found errors run the below commands | |
# ln -s /usr/local/Cellar/openssl/1.0.2l/include/openssl /usr/local/lib/ | |
# cp /usr/local/opt/openssl/include/openssl/* /usr/local/opt/openssl/include/ | |
# brew link --force openssl | |
# ln -s /usr/local/Cellar/openssl/1.0.2l/include/openssl /usr/local/include/openssl | |
# to fix ideviceinstaller.c ssize_t errors make the below changes | |
# In the specified file ideviceinstaller.c, change while (zfsize < zs.size) { to —— while (zfsize < (unsigned) zs.size) { | |
# In the specified file ideviceinstaller.c, comment out fprintf(stderr, "Error: wrote only %d of %" PRIi64 "\n", total, amount); | |
set -e; | |
export LIBTOOLIZE='glibtoolize'; | |
export openssl_CFLAGS='-I/usr/local/opt/' # changed it from openssl_CFLAGS=' ' to fix errors | |
export openssl_LIBS='-lssl -lcrypto' | |
#export LIBTOOL='libtool'; | |
urllist=('https://github.com/libimobiledevice/libplist.git' \ | |
'https://github.com/libimobiledevice/libusbmuxd.git' \ | |
'https://github.com/libimobiledevice/libimobiledevice.git' \ | |
'https://github.com/libimobiledevice/libirecovery.git' \ | |
'https://github.com/libimobiledevice/idevicerestore.git' \ | |
'https://github.com/libimobiledevice/ideviceinstaller.git'); | |
flags=(); | |
libstoinstall=("$@"); | |
for theurl in "${urllist[@]}"; do git clone "$theurl"; done # Comment this if all the required folders already exist and you are running the script again | |
if [ "${#libstoinstall[@]}" == 0 ]; then | |
libstoinstall=('libplist' 'libusbmuxd' 'libimobiledevice' 'libirecovery' 'idevicerestore' 'ideviceinstaller'); | |
fi; | |
cd "$(dirname "$0")"; | |
for library in "${libstoinstall[@]}"; do | |
cd "$library"; | |
NOCONFIGURE=1 ./autogen.sh; | |
cd ..; | |
rm -rf "$library-build"; | |
mkdir "$library-build"; | |
cd "$library-build"; | |
if [ "$library" == 'libimobiledevice' ]; then | |
flags+=('--disable-openssl'); | |
ldflags+=('-lgpg-error'); | |
elif [ "$library" == 'ideviceinstaller' ]; then | |
cflags+=('-Wno-error=format' '-Wno-error=sign-compare' '--disable-openssl' ); | |
fi; | |
"${PWD:0:${#PWD}-6}/configure" --prefix="$HOME/local/dist" --enable-static --disable-shared --disable-openssl "${flags[@]}" PKG_CONFIG_PATH="$HOME/local/dist/lib/pkgconfig"; | |
make install; | |
cd ..; | |
done; | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment