Skip to content

Instantly share code, notes, and snippets.

@TheRealKeto
Last active August 1, 2022 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheRealKeto/8aa8aaccf43553bca0daef841d47f3ec to your computer and use it in GitHub Desktop.
Save TheRealKeto/8aa8aaccf43553bca0daef841d47f3ec to your computer and use it in GitHub Desktop.
Extra notes about working with Procursus

Other things about Procursus

This document contains miscellaneous notes on Procursus, which don't particularly go along with the current documentation and wiki of the project.

This is a weird way, but the main purpose is so that this isn't lost knowledge; in the case that only one person has figured out how to do something with Procursus and that person has no longer taken on the task of carrying the project, this is here to help you.

Most sections are compiled from things I've ran across, some based on my experience on doing something with Procursus, while others being something that people have mentioned.

Compiling Rust projects on Linux

Rust projects can be compiled on Linux, but they require specific Rust targets to be installed on your local machine before you can start compiling.

Make sure that your Rust toolchain from your specific Linux flavor has already been set up. Then, proceed to install the iOS Rust target

rustup target add aarch64-apple-ios

To link Clang from your cctools toolchain, you'll need a configuration file in your Cargo directory. This should be generated in your home directory, ~/.cargo/. Inside your configuration file, ~/.cargo/config, do the following

[target.aarch64-apple-ios]
linker = "/path/to/cc/from/cctools"

Lastly, some Rust libraries (which Rust projects generally depend on) will check for an SDK present on your system using xcrun. xcrun isn't available on Linux (or any other platform other than macOS).

To circumvent this, the best option is to create your own xcrun bin, which will return the PATH of your iOS SDK used by your cctools-port toolchain

#!/bin/sh

# This part can also be echoing a specific var, such as TARGET_SYSROOT
echo "/path/to/sdk"

Once you've set that up, install the bin within your cctools-port PATH, or within /usr/local/bin, and Rust should fully compile Rust projects on Procursus.

install -Dm755 xcrun -t /usr/local/bin

Bootstrapping macOS

Procursus is not only capable of running on iOS; it can also run on macOS, providing an alternative to tools provided by Homebrew. Due to the fact that Procursus is a self-hosted build system, an already existing instance of Procursus is needed.

To circumvent this, you can install the Procursus dependencies from Homebrew, which are documented in the documentation and wiki page of the project.

Perhaps in an alternative universe, a specific tarball of the Procursus suite is accessible for users. Should that case ever come to light (though, please, don't hold your breath), follow the directions below

  1. Get a copy of this accessible tarball and download it to your local machine. Then, extract it.

    Pray that the compression algorithm used to make the tarball was zstd

     zstd -d /path/to/tarball.zst
     sudo tar --preserve-permissions -xkf /path/to/tarball -C
    

    In case you have tar from Homebrew on your local machine

     sudo gtar --preserve-permissions -xkf /path/to/tarball.tar.zst -C
    
  2. Move the extracted files, and add /opt/procursus/bin to the start of your PATH on your shell configuration

Setting up and using X11 on iOS

At some point in time, X11 was showcased to be functional on iOS, and many users had wondered how the Procursus Team had achieved this. The following instructions detail just that.

  1. Bootstrap your device with Procursus

    You can do this in two ways: use a coolstar-based jailbreak, or compile a Procursus suite for your specific target, then install it accordingly

  2. Install the X11 suite provided by Procursus

     sudo apt install \
     	xserver-xorg-core \
     	tigervnc-standalone-server \
     	xterm \
     	xfe \
     	fluxbox \
     	x11-apps
    
  3. Configure your VNC password with vncpasswd. Then, attempt to start your X server and Xvnc

     Xvnc -PasswordFile ~/.vnc/passwd -extension MIT-SHM :1 &
    
  4. Specify the DISPLAY environment variable

     export DISPLAY=:0 >> ~/.zshrc
    
  5. Start Flubox. Then, attempt to connect to port 5901 running on localhost (127.0.0.1:5901) on the same device with a VNC client

Notes to consider

These notes detail further functionality of the X11 suite provided by Procursus

  • To start a file manager: xfe &
  • To start a terminal: xterm &
  • To start xeyes: xeyes &
  • To kill/exit your X11 setup: killall Xvnc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment