forked from mobile-shell/mosh
-
Notifications
You must be signed in to change notification settings - Fork 1
Build instructions for iOS
Lucian Fratila edited this page May 30, 2013
·
5 revisions
# thanks to Quentin Smith and others for help with configure arguments.
# install Xcode and the latest Xcode command line tools package
git clone -b macosx git://github.com/piannucci/mosh.git mosh
cd mosh
mkdir include
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
export MACSDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
cp "$MACSDKROOT"/usr/include/{curses,ncurses,ncurses_dll,term,unctrl}.h include/
# protobufs
curl http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2 | tar xvf -
# install locally (OS X protoc needed later)
pushd protobuf-2.5.0 >/dev/null
./configure
make install
mkdir -p prefix
./configure --target=armv7-apple-darwin --build=i686-apple-darwin --host=armv7-apple-darwin \
--prefix=`pwd`/prefix --with-protoc=`which protoc` \
CC="cc -arch armv7" CXX="c++ -arch armv7" \
CFLAGS="-isysroot $SDKROOT" CXXFLAGS="-isysroot $SDKROOT" \
CPPFLAGS="-isysroot $SDKROOT -I`pwd`/include" LDFLAGS="-isysroot $SDKROOT"
make install
popd >/dev/null
# openssl
curl http://www.openssl.org/source/openssl-1.0.1e.tar.gz | tar xvf -
pushd openssl-1.0.1e >/dev/null
mkdir -p prefix
export CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
export CROSS_SDK=iPhoneOS6.1.sdk
CC="cc -arch armv7" ./Configure iphoneos-cross --prefix=`pwd`/prefix
make install
popd >/dev/null
# mosh
# Note: if this fails complaining about missing 'autoreconf', download and install (./configure & make install) autoconf and automake from:
# http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
# http://ftp.gnu.org/gnu/automake/automake-1.13.2.tar.gz
./autogen.sh
./configure --target=armv7-apple-darwin --build=i686-apple-darwin --host=armv7-apple-darwin \
ac_cv_c_restrict=no ac_cv_poll_pty=yes \
CC="clang -arch armv7" CXX="clang++ -arch armv7" \
PKG_CONFIG_PATH=`pwd`/protobuf-2.5.0/prefix/lib/pkgconfig:`pwd`/openssl-1.0.1e/prefix/lib/pkgconfig \
protobuf_LIBS=`pwd`/protobuf-2.5.0/prefix/lib/libprotobuf.a \
CFLAGS="-isysroot $SDKROOT" CXXFLAGS="-isysroot $SDKROOT" \
CPPFLAGS="-isysroot $SDKROOT -I`pwd`/include" LDFLAGS="-isysroot $SDKROOT"
make
rm -rf prefix
rm mosh.zip
mkdir -p prefix/usr/local/bin
cp scripts/mosh src/frontend/mosh{-client,-server} prefix/usr/local/bin/
export CODESIGN_ALLOCATE=${"$CROSS_TOP"/usr/bin/codesign_allocate}
codesign -fs - prefix/usr/local/bin/mosh{,-client,-server}
mkdir -p prefix/usr/share
cp -r /usr/share/locale prefix/usr/share/locale
cp -r /usr/share/terminfo prefix/usr/share/terminfo
pushd prefix >/dev/null
zip -r9 ../mosh.zip .
popd >/dev/null
# copy mosh.zip to your device and ssh into the device as root
# on iOS
unzip mosh.zip -d /
cat <<EOF >> ~/.profile
export LC_ALL=en_US.UTF-8
export TERMINFO=/usr/share/terminfo
EOF
. ~/.profile
# mosh in to your device with mosh user@device --server="/usr/local/bin/mosh-server"
# mosh out as usual