/theos-golang

Build a theos command line tool using golang on a jail-broken iOS device

Primary LanguageShell

theos-golang

Build a theos command line tool using golang on a jail-broken iOS device.

Getting Started

Prerequisites

This project needs a macOS environment with Xcode installed.

Homebrew is also strongly recommended to manage the installed packages.

THEOS

Follow the steps of THEOS Installation. You can also follow this quick start steps blow:

  1. mkdir ~/theos
  2. echo "export THEOS=~/theos" >> ~/.bash_profile
  3. source ~/.bash_profile
  4. git clone --recursive https://github.com/theos/theos.git $THEOS
  5. brew install ldid
  6. sudo cpan IO::Compress::Lzma

golang

Install golang to cross build the go source to static lib.

  1. brew install golang
  2. setup the corresponding GOROOT and GOPATH environment variable

dpkg

dpkg is used to extract the executable file from the final .deb package.

brew install dpkg

Building

  1. git clone https://github.com/cszichao/theos-golang
  2. cd theos-golang && bash ./build.sh
  3. now you get the iOS jail-broken executable file /bin/cmd

How It Works

  1. cross build main.go on GOOS=darwin GOARCH=arm GOARM=7 and GOOS=darwin GOARCH=arm64 to get a static library on armv7 and arm64 respectively
  2. join the lib of arm64 and armv7 library together into a universal lib using lipo
  3. link the static lib into a THEOS command line tool project and build it into a .deb package
  4. extract the executable file from the .deb package to ./bin/cmd