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:
mkdir ~/theos
echo "export THEOS=~/theos" >> ~/.bash_profile
source ~/.bash_profile
git clone --recursive https://github.com/theos/theos.git $THEOS
brew install ldid
sudo cpan IO::Compress::Lzma
golang
Install golang to cross build the go source to static lib.
brew install golang
- setup the corresponding
GOROOT
andGOPATH
environment variable
dpkg
dpkg is used to extract the executable file from the final .deb package.
brew install dpkg
Building
git clone https://github.com/cszichao/theos-golang
cd theos-golang && bash ./build.sh
- now you get the iOS jail-broken executable file
/bin/cmd
How It Works
- cross build main.go on
GOOS=darwin GOARCH=arm GOARM=7
andGOOS=darwin GOARCH=arm64
to get a static library on armv7 and arm64 respectively - join the lib of arm64 and armv7 library together into a universal lib using
lipo
- link the static lib into a THEOS command line tool project and build it into a .deb package
- extract the executable file from the .deb package to
./bin/cmd